/* ============================================================
   styles.css — CMMS Enterprise Theme for Cloudflare Pages
   Standard-021: Enterprise Architecture Migration
   ============================================================ */

:root, [data-theme="dark"] {
  --bg: #0b0d14;
  --bg-secondary: #111320;
  --surface: #181a2a;
  --surface-hover: #1e2035;
  --card: rgba(24,26,42,0.8);
  --border: rgba(255,255,255,0.08);
  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --primary: #6366f1;
  --primary-hover: #818cf8;
  --accent: #8b5cf6;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #3b82f6;
  --shadow: 0 4px 24px rgba(0,0,0,0.3);
  --radius: 12px;
  --radius-sm: 8px;
  --sidebar-width: 260px;
  --topbar-height: 56px;
}

[data-theme="light"] {
  --bg: #f1f5f9;
  --bg-secondary: #ffffff;
  --surface: #ffffff;
  --surface-hover: #f8fafc;
  --card: rgba(255,255,255,0.9);
  --border: rgba(0,0,0,0.08);
  --text: #1e293b;
  --text-muted: #64748b;
  --shadow: 0 4px 24px rgba(0,0,0,0.08);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow: hidden;
}

/* ---- Glass Card ---- */
.glass-card {
  background: var(--card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 16px; border-radius: var(--radius-sm); border: none;
  font-size: 13px; font-weight: 500; cursor: pointer; transition: all 0.2s;
  font-family: inherit; white-space: nowrap;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); }
.btn-secondary { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover:not(:disabled) { background: var(--surface-hover); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #dc2626; }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover:not(:disabled) { background: #16a34a; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-icon {
  background: none; border: none; color: var(--text); cursor: pointer;
  width: 36px; height: 36px; display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm); font-size: 18px; transition: background 0.2s;
}
.btn-icon:hover { background: var(--surface-hover); }

/* ---- Forms ---- */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 12px; font-weight: 500; color: var(--text-muted); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.5px; }
.form-input, .form-select, .form-textarea {
  width: 100%; padding: 10px 14px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text); font-size: 14px; font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.15);
}
.form-input::placeholder { color: var(--text-muted); opacity: 0.6; }
.form-textarea { min-height: 80px; resize: vertical; }
.form-select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }

/* ---- Layout ---- */
.app-container { display: flex; flex-direction: column; height: 100vh; }

.topbar {
  height: var(--topbar-height); background: var(--surface); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px; z-index: 100; flex-shrink: 0;
}
.topbar-left { display: flex; align-items: center; gap: 12px; }
.topbar-right { display: flex; align-items: center; gap: 16px; }

.sidebar {
  position: fixed; left: 0; top: var(--topbar-height); bottom: 0;
  width: var(--sidebar-width); background: var(--surface); border-right: 1px solid var(--border);
  overflow-y: auto; z-index: 90; transition: transform 0.3s;
}
.sidebar-header { padding: 16px; border-bottom: 1px solid var(--border); }
.sidebar-logo { display: flex; align-items: center; gap: 10px; }
.sidebar-nav { padding: 8px 0; }
.sidebar-group { margin-bottom: 4px; }
.sidebar-group-header {
  padding: 8px 16px 4px; font-size: 10px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 1px; color: var(--text-muted); opacity: 0.6;
}
.sidebar-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 16px;
  color: var(--text-muted); text-decoration: none; font-size: 13px; font-weight: 400;
  transition: all 0.15s; cursor: pointer; border-left: 3px solid transparent;
}
.sidebar-item:hover { background: var(--surface-hover); color: var(--text); }
.sidebar-item.active {
  color: var(--primary); background: rgba(99,102,241,0.08);
  border-left-color: var(--primary); font-weight: 500;
}
.sidebar-icon { font-size: 16px; width: 20px; text-align: center; }

.main-content {
  flex: 1; margin-left: var(--sidebar-width); margin-top: var(--topbar-height);
  overflow-y: auto; padding: 24px; background: var(--bg);
}

/* ---- Login ---- */
.login-container {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: var(--bg); padding: 20px;
}
.login-card { max-width: 420px; width: 100%; padding: 40px 32px; }

/* ---- Tables ---- */
.table-container { overflow-x: auto; border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; }
thead th {
  padding: 10px 14px; text-align: left; font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted);
  background: var(--surface); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 1;
}
tbody td {
  padding: 10px 14px; font-size: 13px; border-bottom: 1px solid var(--border);
}
tbody tr { transition: background 0.15s; }
tbody tr:hover { background: var(--surface-hover); }

/* ---- Badges ---- */
.badge {
  display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 20px;
  font-size: 11px; font-weight: 600; text-transform: capitalize;
}
.badge-success { background: rgba(34,197,94,0.12); color: var(--success); }
.badge-warning { background: rgba(245,158,11,0.12); color: var(--warning); }
.badge-danger { background: rgba(239,68,68,0.12); color: var(--danger); }
.badge-info { background: rgba(59,130,246,0.12); color: var(--info); }
.badge-primary { background: rgba(99,102,241,0.12); color: var(--primary); }
.badge-secondary { background: rgba(148,163,184,0.12); color: var(--text-muted); }

/* ---- Cards ---- */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; backdrop-filter: blur(20px); }
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.card-title { font-size: 16px; font-weight: 600; }

/* ---- Stat Cards ---- */
.stat-card { text-align: center; padding: 20px; }
.stat-value { font-size: 28px; font-weight: 800; color: var(--primary); margin: 8px 0 4px; }
.stat-label { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }

/* ---- Grid ---- */
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* ---- Tabs ---- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 20px; overflow-x: auto; }
.tab {
  padding: 10px 16px; border: none; background: none; color: var(--text-muted);
  font-size: 13px; font-weight: 500; cursor: pointer; border-bottom: 2px solid transparent;
  transition: all 0.2s; white-space: nowrap; font-family: inherit;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ---- Modal ---- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.6); backdrop-filter: blur(4px);
  z-index: 1000; display: flex; align-items: center; justify-content: center;
}
.modal {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  width: 90%; max-width: 600px; max-height: 85vh; overflow-y: auto; box-shadow: 0 24px 64px rgba(0,0,0,0.4);
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px; border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 18px; font-weight: 600; margin: 0; }
.modal-body { padding: 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }

/* ---- Spinner ---- */
.spinner {
  width: 40px; height: 40px; border: 3px solid var(--border);
  border-top-color: var(--primary); border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Empty State ---- */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty-state-icon { font-size: 48px; margin-bottom: 16px; }
.empty-state-text { font-size: 14px; }

/* ---- Search ---- */
.search-box {
  position: relative; display: flex; align-items: center;
}
.search-box input {
  padding-left: 36px;
}
.search-box::before {
  content: '&#128269;'; position: absolute; left: 12px;
  color: var(--text-muted); font-size: 14px;
}

/* ---- Pagination ---- */
.pagination { display: flex; align-items: center; justify-content: center; gap: 4px; margin-top: 16px; }
.pagination button {
  padding: 6px 12px; border: 1px solid var(--border); background: var(--surface);
  color: var(--text); border-radius: var(--radius-sm); font-size: 12px; cursor: pointer;
}
.pagination button.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.pagination button:disabled { opacity: 0.4; cursor: not-allowed; }

/* ---- Skeleton ---- */
.skeleton { background: linear-gradient(90deg, var(--surface) 25%, var(--surface-hover) 50%, var(--surface) 75%); background-size: 200% 100%; animation: shimmer 1.5s infinite; border-radius: var(--radius-sm); }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ---- Toast Animation ---- */
@keyframes toastSlideIn { from { transform: translateX(100px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.sidebar-open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; }
  .topbar { padding: 0 12px; }
  .login-card { padding: 28px 20px; }
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ---- Page Content ---- */
.page-content { min-height: calc(100vh - var(--topbar-height) - 48px); }
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; flex-wrap: wrap; gap: 12px; }
.page-header h2 { font-size: 22px; font-weight: 700; }

/* ---- Filter Bar ---- */
.filter-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.filter-btn {
  padding: 6px 14px; border-radius: 20px; border: 1px solid var(--border);
  background: transparent; color: var(--text-muted); font-size: 12px; font-weight: 500;
  cursor: pointer; transition: all 0.2s; font-family: inherit;
}
.filter-btn:hover { border-color: var(--primary); color: var(--text); }
.filter-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ============================================================
   Standard-015: QR System Styles
   ============================================================ */

/* ---- QR Scanner ---- */
.qr-scanner-container {
  position: relative;
  width: 100%;
  max-width: 500px;
  margin: 0 auto;
  border-radius: var(--radius);
  overflow: hidden;
  background: #000;
  aspect-ratio: 1;
}
.qr-scanner-container video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.qr-scan-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.qr-scan-frame {
  width: 220px;
  height: 220px;
  position: relative;
}
.qr-scan-frame::before,
.qr-scan-frame::after {
  content: '';
  position: absolute;
  border: 3px solid var(--primary);
  border-radius: 4px;
}
.qr-scan-frame::before {
  top: 0; left: 0; width: 40px; height: 40px;
  border-right: none; border-bottom: none;
}
.qr-scan-frame::after {
  top: 0; right: 0; width: 40px; height: 40px;
  border-left: none; border-bottom: none;
}
.qr-scan-frame-bottom {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 40px;
}
.qr-scan-frame-bottom::before {
  content: '';
  position: absolute;
  bottom: 0; left: 0;
  width: 40px; height: 40px;
  border: 3px solid var(--primary);
  border-radius: 4px;
  border-right: none; border-top: none;
}
.qr-scan-frame-bottom::after {
  content: '';
  position: absolute;
  bottom: 0; right: 0;
  width: 40px; height: 40px;
  border: 3px solid var(--primary);
  border-radius: 4px;
  border-left: none; border-top: none;
}
.qr-scan-line {
  position: absolute;
  left: 10px;
  right: 10px;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--primary), var(--accent), var(--primary), transparent);
  animation: scanLine 2s ease-in-out infinite;
  box-shadow: 0 0 8px rgba(99,102,241,0.5);
}
@keyframes scanLine {
  0%, 100% { top: 10px; }
  50% { top: calc(100% - 10px); }
}
.qr-scanner-status {
  text-align: center;
  padding: 12px;
  font-size: 13px;
  color: var(--text-muted);
  background: var(--surface);
  border-radius: 0 0 var(--radius) var(--radius);
}
.qr-scanner-status.scanning {
  color: var(--primary);
}
.qr-scanner-status.success {
  color: var(--success);
}
.qr-scanner-status.error {
  color: var(--danger);
}

/* ---- QR Manual Input ---- */
.qr-manual-input {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
}
.qr-manual-input input {
  flex: 1;
}

/* ---- QR Stat Cards ---- */
.qr-stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}
.qr-stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
  backdrop-filter: blur(20px);
  transition: transform 0.2s, box-shadow 0.2s;
}
.qr-stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
}
.qr-stat-card .stat-icon {
  font-size: 24px;
  margin-bottom: 8px;
}
.qr-stat-card .stat-num {
  font-size: 24px;
  font-weight: 800;
  color: var(--primary);
}
.qr-stat-card .stat-lbl {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 4px;
}

/* ---- QR Detail Card ---- */
.qr-detail-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  backdrop-filter: blur(20px);
}
.qr-detail-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 16px;
}
.qr-detail-header-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
}
.qr-detail-header-icon.machine { background: rgba(99,102,241,0.12); color: var(--primary); }
.qr-detail-header-icon.asset { background: rgba(139,92,246,0.12); color: var(--accent); }
.qr-detail-header-icon.jobcard { background: rgba(245,158,11,0.12); color: var(--warning); }
.qr-detail-header-icon.sparepart { background: rgba(34,197,94,0.12); color: var(--success); }
.qr-detail-header-title h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
}
.qr-detail-header-title p {
  margin: 2px 0 0;
  font-size: 13px;
  color: var(--text-muted);
}
.qr-detail-body {
  padding: 20px 24px;
}
.qr-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px 24px;
}
.qr-detail-field {
  padding: 8px 0;
}
.qr-detail-field-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.qr-detail-field-value {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  word-break: break-word;
}
.qr-detail-section-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  margin: 20px 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ---- QR Timeline ---- */
.qr-timeline {
  position: relative;
  padding-left: 24px;
}
.qr-timeline::before {
  content: '';
  position: absolute;
  left: 7px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--border);
}
.qr-timeline-item {
  position: relative;
  padding: 0 0 16px 16px;
}
.qr-timeline-item::before {
  content: '';
  position: absolute;
  left: -20px;
  top: 4px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--primary);
  border: 2px solid var(--bg);
}
.qr-timeline-item.completed::before { background: var(--success); }
.qr-timeline-item.pending::before { background: var(--warning); }
.qr-timeline-item.cancelled::before { background: var(--danger); }
.qr-timeline-event {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.qr-timeline-date {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}
.qr-timeline-by {
  font-size: 11px;
  color: var(--text-muted);
}
.qr-timeline-reason {
  font-size: 12px;
  color: var(--warning);
  margin-top: 4px;
  font-style: italic;
}

/* ---- QR Job Card Mini Stats ---- */
.qr-mini-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 12px 0;
}
.qr-mini-stat {
  text-align: center;
  padding: 12px 8px;
  background: var(--surface);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.qr-mini-stat .num {
  font-size: 20px;
  font-weight: 800;
  color: var(--primary);
}
.qr-mini-stat .lbl {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ---- QR History Table ---- */
.qr-history-filters {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
  align-items: center;
}
.qr-history-filters select,
.qr-history-filters input {
  max-width: 180px;
}

/* ---- QR Search Results ---- */
.qr-search-results {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.qr-search-result-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
}
.qr-search-result-item:hover {
  border-color: var(--primary);
  background: var(--surface-hover);
}
.qr-search-result-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.qr-search-result-info {
  flex: 1;
  min-width: 0;
}
.qr-search-result-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.qr-search-result-meta {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  gap: 12px;
  margin-top: 2px;
}

/* ---- QR Print Label ---- */
.qr-print-label {
  background: #fff;
  color: #1a1a1a;
  border: 1px solid #ccc;
  border-radius: 4px;
  padding: 12px;
  text-align: center;
  font-family: Arial, sans-serif;
  margin: 0 auto;
}
.qr-print-label .company-name {
  font-size: 9px;
  font-weight: 700;
  color: #1a237e;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}
.qr-print-label .item-name {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 2px;
}
.qr-print-label .item-code {
  font-size: 11px;
  color: #666;
  margin-bottom: 4px;
}
.qr-print-label .item-detail {
  font-size: 10px;
  color: #888;
  margin-bottom: 2px;
}
.qr-print-label .item-id {
  font-size: 9px;
  color: #999;
  margin-bottom: 6px;
}
.qr-print-label .barcode-text {
  font-family: monospace;
  font-size: 11px;
  letter-spacing: 1px;
  margin-top: 6px;
  color: #333;
}
.qr-print-label.size-small {
  width: 200px;
  height: 100px;
  font-size: 8px;
}
.qr-print-label.size-medium {
  width: 300px;
  height: 200px;
}
.qr-print-label.size-large {
  width: 400px;
  height: 200px;
}
.qr-print-label.size-a4 {
  width: 100%;
  max-width: 800px;
}

/* ---- QR Offline Badge ---- */
.qr-offline-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  background: rgba(245,158,11,0.12);
  color: var(--warning);
}
.qr-offline-badge .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--warning);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ---- QR Module Tag ---- */
.qr-module-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}
.qr-module-tag.machine { background: rgba(99,102,241,0.12); color: var(--primary); }
.qr-module-tag.asset { background: rgba(139,92,246,0.12); color: var(--accent); }
.qr-module-tag.jobcard { background: rgba(245,158,11,0.12); color: var(--warning); }
.qr-module-tag.sparepart { background: rgba(34,197,94,0.12); color: var(--success); }

/* ---- QR Action Buttons Row ---- */
.qr-actions-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

/* ---- QR Scan Success Animation ---- */
.qr-scan-success {
  position: fixed;
  inset: 0;
  z-index: 9998;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(8px);
  animation: fadeIn 0.2s ease;
}
.qr-scan-success-content {
  text-align: center;
  color: #fff;
}
.qr-scan-success-icon {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--success);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  margin: 0 auto 16px;
  animation: scaleIn 0.3s ease;
}
.qr-scan-success-text {
  font-size: 18px;
  font-weight: 600;
}
.qr-scan-success-module {
  font-size: 13px;
  color: rgba(255,255,255,0.7);
  margin-top: 4px;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes scaleIn { from { transform: scale(0); } to { transform: scale(1); } }

/* ---- QR Empty Scanner ---- */
.qr-scanner-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}
.qr-scanner-empty-icon {
  font-size: 64px;
  margin-bottom: 16px;
  opacity: 0.5;
}
.qr-scanner-empty h3 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}
.qr-scanner-empty p {
  font-size: 13px;
}

/* ---- QR Detail Action Buttons ---- */
.qr-detail-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ---- QR History Item (Mobile Card View) ---- */
.qr-history-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  transition: background 0.15s;
}
.qr-history-card:hover {
  background: var(--surface-hover);
}
.qr-history-card-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}
.qr-history-card-info {
  flex: 1;
  min-width: 0;
}
.qr-history-card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.qr-history-card-meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.qr-history-card-time {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  text-align: right;
}

/* ---- Responsive: QR System ---- */
@media (max-width: 768px) {
  .qr-stats-row { grid-template-columns: repeat(2, 1fr); }
  .qr-detail-grid { grid-template-columns: 1fr; }
  .qr-mini-stats { grid-template-columns: repeat(3, 1fr); }
  .qr-scanner-container { max-width: 100%; aspect-ratio: auto; min-height: 280px; }
  .qr-scan-frame { width: 180px; height: 180px; }
  .qr-history-filters { flex-direction: column; }
  .qr-history-filters select,
  .qr-history-filters input { max-width: 100%; }
  .qr-manual-input { flex-direction: column; }
}

@media (max-width: 480px) {
  .qr-stats-row { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .qr-stat-card { padding: 12px 8px; }
  .qr-stat-card .stat-num { font-size: 20px; }
  .qr-detail-header { padding: 16px; flex-direction: column; text-align: center; }
  .qr-detail-body { padding: 16px; }
  .qr-actions-row { justify-content: center; }
}

/* ---- Print Styles ---- */
@media print {
  body * { visibility: hidden; }
  .qr-print-area, .qr-print-area * { visibility: visible; }
  .qr-print-area { position: absolute; left: 0; top: 0; }
  .qr-no-print { display: none !important; }
}
