@import url('https://fonts.googleapis.com/css2?family=Barlow+Condensed:wght@400;500;600;700;800;900&family=Barlow:wght@300;400;500;600&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --black: #0a0b0d;
  --dark: #111318;
  --surface: #181c23;
  --surface2: #1f2430;
  --border: rgba(255,255,255,0.07);
  --border-bright: rgba(255,255,255,0.14);
  --orange: #e8622a;
  --orange-dim: rgba(232,98,42,0.15);
  --orange-glow: rgba(232,98,42,0.4);
  --text: #f0f2f5;
  --muted: #6b7280;
  --muted2: #9ca3af;
  --green: #22c55e;
  --green-dim: rgba(34,197,94,0.12);
  --amber: #f59e0b;
  --amber-dim: rgba(245,158,11,0.12);
  --red: #ef4444;
  --red-dim: rgba(239,68,68,0.12);
  --font-display: 'Barlow Condensed', sans-serif;
  --font-body: 'Barlow', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

/* ─── LIGHT MODE ─── */
body.light-mode {
  --black: #f0f2f5;
  --dark: #ffffff;
  --surface: #ffffff;
  --surface2: #f0f2f5;
  --border: rgba(0,0,0,0.08);
  --border-bright: rgba(0,0,0,0.15);
  --text: #0f1117;
  --muted: #9ca3af;
  --muted2: #6b7280;
  --green-dim: rgba(34,197,94,0.1);
  --amber-dim: rgba(245,158,11,0.1);
  --red-dim: rgba(239,68,68,0.1);
  --orange-dim: rgba(232,98,42,0.1);
}

body.light-mode .sidebar {
  background: #ffffff;
  border-right-color: rgba(0,0,0,0.08);
}

body.light-mode .topbar {
  background: rgba(240,242,245,0.9);
  border-bottom-color: rgba(0,0,0,0.08);
}

body.light-mode .brand-name { color: #0f1117; }
body.light-mode .brand-sub  { color: #9ca3af; }
body.light-mode .sidebar-footer p { color: #9ca3af; }

body.light-mode .nav-item { color: #6b7280; }
body.light-mode .nav-item:hover { background: #f0f2f5; color: #0f1117; }
body.light-mode .nav-item.active { background: rgba(232,98,42,0.1); color: var(--orange); }

body.light-mode .vehicle-card { background: #ffffff; border-color: rgba(0,0,0,0.08); }
body.light-mode .vehicle-card:hover { border-color: rgba(0,0,0,0.15); }
body.light-mode .stat-card { background: #f0f2f5; }
body.light-mode .form-card { background: #ffffff; border-color: rgba(0,0,0,0.08); }
body.light-mode .form-group input,
body.light-mode .form-group select,
body.light-mode .form-group textarea { background: #f7f8fa; border-color: rgba(0,0,0,0.12); color: #0f1117; }
body.light-mode .check-item { background: #f7f8fa; border-color: rgba(0,0,0,0.08); color: #6b7280; }
body.light-mode .check-item:hover { color: #0f1117; }
body.light-mode .check-item.checked { background: rgba(232,98,42,0.08); color: var(--orange); }
body.light-mode .history-table th { color: #9ca3af; border-bottom-color: rgba(0,0,0,0.08); }
body.light-mode .history-table td { border-bottom-color: rgba(0,0,0,0.06); }
body.light-mode .modal { background: #ffffff; border-color: rgba(0,0,0,0.12); }
body.light-mode .modal-overlay { background: rgba(0,0,0,0.4); }
body.light-mode .vd-header { background: #ffffff; border-color: rgba(0,0,0,0.08); }
body.light-mode .vd-hero { background: linear-gradient(135deg, #1a2e4a 0%, #243d5e 100%) !important; }
body.light-mode .progress-track { background: #e5e7eb; }
body.light-mode .scan-card { background: #ffffff; border-color: rgba(0,0,0,0.08); }
body.light-mode .scan-card-top { background: linear-gradient(135deg, #0a0b0d 0%, #181c23 100%); }
body.light-mode .qr-card { background: #ffffff; border-color: rgba(0,0,0,0.08); }
body.light-mode .btn { background: #ffffff; border-color: rgba(0,0,0,0.15); color: #0f1117; }
body.light-mode .btn:hover { background: #f0f2f5; }
body.light-mode .btn-ghost { background: transparent; color: #6b7280; }
body.light-mode .btn-ghost:hover { background: #f0f2f5; color: #0f1117; }
body.light-mode body::before { opacity: 0; }
body.light-mode .demo-note { background: rgba(232,98,42,0.08); }

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--black);
  color: var(--text);
  min-height: 100vh;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ─── NOISE OVERLAY ─── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.035'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 0;
}

/* ─── LAYOUT ─── */
.layout { display: flex; min-height: 100vh; position: relative; z-index: 1; }

/* ─── SIDEBAR ─── */
.sidebar {
  width: 260px;
  flex-shrink: 0;
  background: var(--dark);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
}

.sidebar-brand {
  padding: 28px 24px 24px;
  border-bottom: 1px solid var(--border);
}

.brand-badge {
  display: inline-block;
  background: var(--orange);
  color: white;
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  padding: 3px 8px;
  margin-bottom: 10px;
  clip-path: polygon(0 0, calc(100% - 6px) 0, 100% 100%, 6px 100%);
}

.brand-name {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 900;
  letter-spacing: 0.02em;
  line-height: 1;
  color: var(--text);
}

.brand-sub {
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-top: 4px;
  font-weight: 500;
}

.sidebar-nav { padding: 16px 12px; flex: 1; }

.nav-section-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 8px 12px 6px;
  margin-top: 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted2);
  transition: all 0.15s;
  border: 1px solid transparent;
  margin-bottom: 2px;
  text-decoration: none;
}

.nav-item:hover {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}

.nav-item.active {
  background: var(--orange-dim);
  color: var(--orange);
  border-color: rgba(232,98,42,0.25);
}

.nav-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.7;
}

.nav-item.active .nav-icon { opacity: 1; }

.sidebar-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
}

.sidebar-footer p { font-size: 11px; color: var(--muted); }

/* ─── MAIN CONTENT ─── */
.main {
  margin-left: 260px;
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ─── TOPBAR ─── */
.topbar {
  height: 60px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  background: rgba(10,11,13,0.8);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.page-title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-date {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
}

/* ─── PAGE CONTENT ─── */
.page-content {
  padding: 32px;
  flex: 1;
}

.screen { display: none; }
.screen.active { display: block; }

/* ─── STAT GRID ─── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px 24px;
  position: relative;
  overflow: hidden;
  transition: border-color 0.2s;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--orange);
  opacity: 0;
  transition: opacity 0.2s;
}

.stat-card:hover { border-color: var(--border-bright); }
.stat-card:hover::before { opacity: 1; }

.stat-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
}

.stat-value {
  font-family: var(--font-display);
  font-size: 40px;
  font-weight: 800;
  line-height: 1;
  color: var(--text);
}

.stat-value.green { color: var(--green); }
.stat-value.amber { color: var(--amber); }
.stat-value.red { color: var(--red); }

.stat-sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

/* ─── SECTION HEADER ─── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.section-title {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-title::before {
  content: '';
  display: block;
  width: 3px;
  height: 14px;
  background: var(--orange);
  border-radius: 2px;
}

/* ─── VEHICLE CARDS ─── */
.vehicle-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.vehicle-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}

.vehicle-card:hover {
  border-color: var(--border-bright);
  transform: translateY(-2px);
}

.vehicle-card-top {
  padding: 20px 20px 16px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.vehicle-icon-wrap {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  background: var(--surface2);
  border: 1px solid var(--border-bright);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 22px;
}

.vehicle-meta { flex: 1; }

.vehicle-rego {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0.06em;
  line-height: 1;
  color: var(--text);
}

.vehicle-name {
  font-size: 12px;
  color: var(--muted2);
  margin-top: 3px;
  font-weight: 500;
}

.vehicle-id {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted);
  margin-top: 4px;
}

.vehicle-card-body { padding: 0 20px 20px; }

.km-row {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 6px;
}

.km-value { color: var(--muted2); font-weight: 500; }

.progress-track {
  height: 4px;
  background: var(--surface2);
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: 12px;
}

.progress-fill {
  height: 100%;
  border-radius: 99px;
  background: var(--green);
  transition: width 0.6s ease;
}
.progress-fill.amber { background: var(--amber); }
.progress-fill.red { background: var(--red); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.badge-green { background: var(--green-dim); color: var(--green); border: 1px solid rgba(34,197,94,0.2); }
.badge-amber { background: var(--amber-dim); color: var(--amber); border: 1px solid rgba(245,158,11,0.2); }
.badge-red { background: var(--red-dim); color: var(--red); border: 1px solid rgba(239,68,68,0.2); }
.badge-orange { background: var(--orange-dim); color: var(--orange); border: 1px solid rgba(232,98,42,0.2); }

.badge-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* ─── VEHICLE DETAIL ─── */
.vd-header {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 20px;
}

.vd-hero {
  background: linear-gradient(135deg, var(--surface2) 0%, var(--surface) 100%);
  border-bottom: 1px solid var(--border);
  padding: 32px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}

.vd-hero::before {
  content: attr(data-rego);
  position: absolute;
  right: -20px;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--font-display);
  font-size: 120px;
  font-weight: 900;
  color: rgba(255,255,255,0.03);
  letter-spacing: 0.04em;
  pointer-events: none;
  user-select: none;
}

.vd-rego {
  font-family: var(--font-display);
  font-size: 52px;
  font-weight: 900;
  letter-spacing: 0.04em;
  line-height: 1;
  color: var(--text);
}

.vd-asset-id {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--orange);
  letter-spacing: 0.1em;
  margin-bottom: 6px;
}

.vd-vehicle-name {
  font-size: 15px;
  color: var(--muted2);
  margin-top: 6px;
  font-weight: 400;
}

.vd-body { padding: 24px 32px 32px; }

.spec-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin: 24px 0;
}

.spec-item label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  display: block;
  margin-bottom: 4px;
}

.spec-item span {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--text);
  font-weight: 500;
}

/* ─── BUTTON ─── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 6px;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border-bright);
  background: var(--surface2);
  color: var(--text);
  transition: all 0.15s;
  text-decoration: none;
  letter-spacing: 0.02em;
}

.btn:hover {
  background: var(--surface);
  border-color: rgba(255,255,255,0.2);
}

.btn-orange {
  background: var(--orange);
  border-color: var(--orange);
  color: white;
}

.btn-orange:hover {
  background: #d4571f;
  border-color: #d4571f;
}

.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--muted2);
}
.btn-ghost:hover { color: var(--text); border-color: var(--border-bright); background: var(--surface); }

.btn-danger {
  background: var(--red-dim);
  border-color: rgba(239,68,68,0.25);
  color: var(--red);
}
.btn-danger:hover { background: rgba(239,68,68,0.2); }

.btn-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 20px;
}

/* ─── FORMS ─── */
.form-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 28px 32px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.full { grid-column: 1 / -1; }

.form-group label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted2);
}

.form-group input,
.form-group select,
.form-group textarea {
  background: var(--surface2);
  border: 1px solid var(--border-bright);
  border-radius: 6px;
  padding: 10px 14px;
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
  -webkit-appearance: none;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--orange);
}

.form-group select option { background: var(--surface2); }
.form-group textarea { height: 100px; resize: vertical; line-height: 1.5; }

/* ─── CHECKLIST ─── */
.checklist-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 6px;
}

.check-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
  font-size: 13px;
  color: var(--muted2);
  font-weight: 500;
}

.check-item:hover {
  border-color: var(--border-bright);
  color: var(--text);
}

.check-item input[type=checkbox] { display: none; }

.check-box {
  width: 16px; height: 16px;
  border: 1.5px solid var(--border-bright);
  border-radius: 3px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.check-item.checked {
  background: var(--orange-dim);
  border-color: rgba(232,98,42,0.3);
  color: var(--orange);
}

.check-item.checked .check-box {
  background: var(--orange);
  border-color: var(--orange);
}

.check-item.checked .check-box::after {
  content: '';
  display: block;
  width: 4px; height: 7px;
  border: 2px solid white;
  border-top: none;
  border-left: none;
  transform: rotate(45deg) translateY(-1px);
}

/* ─── HISTORY TABLE ─── */
.history-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.history-table th {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 10px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.history-table td {
  padding: 14px 16px;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.history-table tr:last-child td { border-bottom: none; }
.history-table tr:hover td { background: rgba(255,255,255,0.02); }

.type-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.type-service { background: var(--green-dim); color: var(--green); }
.type-defect { background: var(--red-dim); color: var(--red); }

/* ─── SUCCESS MESSAGE ─── */
.success-banner {
  display: none;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--green-dim);
  border: 1px solid rgba(34,197,94,0.2);
  border-radius: 6px;
  color: var(--green);
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 20px;
}

.success-banner.show { display: flex; }

/* ─── QR STICKER ─── */
.qr-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.qr-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.qr-code-wrap {
  background: white;
  padding: 16px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.qr-code-wrap canvas { display: block; }

.qr-info { text-align: center; }
.qr-rego { font-family: var(--font-display); font-size: 24px; font-weight: 800; letter-spacing: 0.06em; }
.qr-name { font-size: 12px; color: var(--muted2); margin-top: 2px; }
.qr-id { font-family: var(--font-mono); font-size: 10px; color: var(--orange); margin-top: 4px; }

/* ─── DIVIDER ─── */
.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 24px 0;
}

/* ─── BACK BUTTON ─── */
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  margin-bottom: 20px;
  font-family: var(--font-body);
  transition: color 0.15s;
  font-weight: 500;
  letter-spacing: 0.04em;
}

.back-btn:hover { color: var(--text); }

/* ─── EMPTY STATE ─── */
.empty-state {
  text-align: center;
  padding: 60px 24px;
  color: var(--muted);
}

.empty-state p { font-size: 14px; margin-top: 8px; }

/* ─── MOBILE ─── */
.mobile-menu-btn {
  display: none;
  background: none;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px;
  border-radius: 6px;
  cursor: pointer;
}

@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-260px);
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 40px rgba(0,0,0,0.5);
  }
  .main { margin-left: 0; }
  .mobile-menu-btn { display: flex; align-items: center; justify-content: center; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .vehicle-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .spec-grid { grid-template-columns: repeat(2, 1fr); }
  .page-content { padding: 20px; }
  .qr-grid { grid-template-columns: 1fr; }
}

/* ─── LOGIN MODAL ─── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}
.modal-overlay.open { display: flex; }

.modal {
  background: var(--surface);
  border: 1px solid var(--border-bright);
  border-radius: 12px;
  width: 100%;
  max-width: 400px;
  margin: 20px;
  overflow: hidden;
  animation: modalIn 0.2s ease;
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(-12px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
  padding: 24px 28px 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.modal-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.modal-close {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  line-height: 1;
  transition: color 0.15s;
}
.modal-close:hover { color: var(--text); }

.modal-body { padding: 20px 28px 28px; }

.modal-sub {
  font-size: 13px;
  color: var(--muted2);
  margin-bottom: 20px;
}

.modal-error {
  display: none;
  padding: 10px 14px;
  background: var(--red-dim);
  border: 1px solid rgba(239,68,68,0.2);
  border-radius: 6px;
  color: var(--red);
  font-size: 13px;
  margin-bottom: 14px;
}

.modal-demo-hint {
  margin-top: 16px;
  padding: 10px 14px;
  background: var(--orange-dim);
  border: 1px solid rgba(232,98,42,0.2);
  border-radius: 6px;
  font-size: 12px;
  color: var(--muted2);
}
.modal-demo-hint strong { color: var(--orange); font-family: var(--font-mono); }

/* ─── AUTH TOPBAR ELEMENTS ─── */
.auth-user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted2);
  font-family: var(--font-mono);
}

.auth-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--green);
  flex-shrink: 0;
}

/* ─── DEMO BANNER ─── */
.demo-note {
  display: none;
  background: var(--orange-dim);
  border-bottom: 1px solid rgba(232,98,42,0.2);
  padding: 8px 32px;
  font-size: 12px;
  color: var(--orange);
  font-family: var(--font-mono);
}

/* ─── LOGIN SUCCESS BANNER ─── */
#login-success-banner {
  position: fixed;
  top: 70px;
  right: 24px;
  z-index: 500;
  padding: 12px 18px;
  background: var(--green-dim);
  border: 1px solid rgba(34,197,94,0.25);
  border-radius: 8px;
  color: var(--green);
  font-size: 13px;
  font-weight: 500;
  display: none;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
  animation: slideIn 0.2s ease;
}
#login-success-banner.show { display: flex; }
@keyframes slideIn {
  from { opacity: 0; transform: translateX(12px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ─── PUBLIC SCAN PAGE ─── */
#scan-page {
  display: none;
  min-height: 100vh;
  background: var(--black);
  align-items: flex-start;
  justify-content: center;
  padding: 32px 16px 64px;
  position: relative;
  z-index: 1;
}

.scan-loading {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted2);
  font-size: 14px;
  margin-top: 80px;
}

.scan-spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--border-bright);
  border-top-color: var(--orange);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.scan-card {
  width: 100%;
  max-width: 480px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
}

.scan-card-top {
  background: linear-gradient(135deg, #0a0b0d 0%, #181c23 100%);
  padding: 28px 28px 24px;
  border-bottom: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}

.scan-card-top::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--orange);
}

.scan-brand {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: var(--orange);
  margin-bottom: 10px;
  font-family: var(--font-display);
}

.scan-asset-id {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 4px;
  letter-spacing: 0.1em;
}

.scan-rego {
  font-family: var(--font-display);
  font-size: 48px;
  font-weight: 900;
  letter-spacing: 0.04em;
  line-height: 1;
  color: var(--text);
}

.scan-vehicle-name {
  font-size: 14px;
  color: var(--muted2);
  margin-top: 6px;
}

.scan-body { padding: 24px 24px 28px; }

.scan-status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.scan-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.scan-info-item label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  display: block;
  margin-bottom: 3px;
}

.scan-info-item span {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text);
}

.scan-section-title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
}
.scan-section-title::before {
  content: '';
  display: block;
  width: 3px; height: 12px;
  background: var(--orange);
  border-radius: 2px;
}

.scan-history-item {
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.scan-history-item:last-child { border-bottom: none; }

/* ─── LOGIN MODAL ─── */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.7); z-index: 1000;
  align-items: center; justify-content: center;
  backdrop-filter: blur(4px);
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--surface); border: 1px solid var(--border-bright);
  border-radius: 12px; width: 100%; max-width: 400px; margin: 20px; overflow: hidden;
  animation: modalIn 0.2s ease;
}
@keyframes modalIn {
  from { opacity:0; transform: translateY(-12px) scale(0.97); }
  to   { opacity:1; transform: translateY(0) scale(1); }
}
.modal-header { padding: 24px 28px 0; display: flex; align-items: flex-start; justify-content: space-between; }
.modal-title  { font-family: var(--font-display); font-size: 22px; font-weight: 800; letter-spacing: 0.04em; }
.modal-close  { background:none; border:none; color:var(--muted); cursor:pointer; padding:4px; border-radius:4px; transition:color 0.15s; }
.modal-close:hover { color: var(--text); }
.modal-body   { padding: 20px 28px 28px; }
.modal-sub    { font-size: 13px; color: var(--muted2); margin-bottom: 20px; }
.modal-error  { display:none; padding:10px 14px; background:var(--red-dim); border:1px solid rgba(239,68,68,0.2); border-radius:6px; color:var(--red); font-size:13px; margin-bottom:14px; }

/* ─── AUTH CHIP ─── */
.auth-user-chip { display:flex; align-items:center; gap:8px; font-size:12px; color:var(--muted2); font-family:var(--font-mono); }
.auth-dot { width:7px; height:7px; border-radius:50%; background:var(--green); flex-shrink:0; }

/* ─── TOAST ─── */
.toast {
  position: fixed; top: 70px; right: 24px; z-index: 500;
  padding: 12px 18px; border-radius: 8px; font-size: 13px; font-weight: 500;
  display: none; align-items: center; gap: 8px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3); animation: slideIn 0.2s ease;
}
.toast.show { display: flex; }
.toast-success { background:var(--green-dim); border:1px solid rgba(34,197,94,0.25); color:var(--green); }
.toast-error   { background:var(--red-dim);   border:1px solid rgba(239,68,68,0.25);  color:var(--red); }
@keyframes slideIn { from{opacity:0;transform:translateX(12px)} to{opacity:1;transform:translateX(0)} }

/* ─── PUBLIC SCAN PAGE ─── */
#scan-page { display:none; min-height:100vh; background:var(--black); align-items:flex-start; justify-content:center; padding:32px 16px 64px; position:relative; z-index:1; }
.scan-loading { display:flex; align-items:center; gap:12px; color:var(--muted2); font-size:14px; margin-top:80px; }
.scan-spinner { width:20px; height:20px; border:2px solid var(--border-bright); border-top-color:var(--orange); border-radius:50%; animation:spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.scan-card { width:100%; max-width:480px; background:var(--surface); border:1px solid var(--border); border-radius:14px; overflow:hidden; }
.scan-card-top { background:linear-gradient(135deg,#0a0b0d 0%,#181c23 100%); padding:28px 28px 24px; border-bottom:1px solid var(--border); position:relative; overflow:hidden; }
.scan-card-top::before { content:''; position:absolute; top:0; left:0; right:0; height:3px; background:var(--orange); }
.scan-brand { font-size:10px; font-weight:700; letter-spacing:0.18em; color:var(--orange); margin-bottom:10px; font-family:var(--font-display); }
.scan-asset-id { font-family:var(--font-mono); font-size:11px; color:var(--muted); margin-bottom:4px; letter-spacing:0.1em; }
.scan-rego { font-family:var(--font-display); font-size:48px; font-weight:900; letter-spacing:0.04em; line-height:1; color:var(--text); }
.scan-vehicle-name { font-size:14px; color:var(--muted2); margin-top:6px; }
.scan-body { padding:24px 24px 28px; }
.scan-status-row { display:flex; align-items:center; justify-content:space-between; margin-bottom:4px; }
.scan-info-grid { display:grid; grid-template-columns:1fr 1fr; gap:12px; margin-bottom:16px; }
.scan-info-item label { font-size:10px; font-weight:600; letter-spacing:0.12em; text-transform:uppercase; color:var(--muted); display:block; margin-bottom:3px; }
.scan-info-item span { font-family:var(--font-mono); font-size:13px; color:var(--text); }
.scan-section-title { font-size:10px; font-weight:700; letter-spacing:0.14em; text-transform:uppercase; color:var(--muted); margin-bottom:12px; padding-bottom:8px; border-bottom:1px solid var(--border); display:flex; align-items:center; gap:8px; }
.scan-section-title::before { content:''; display:block; width:3px; height:12px; background:var(--orange); border-radius:2px; }
.scan-history-item { padding:12px 0; border-bottom:1px solid var(--border); }
.scan-history-item:last-child { border-bottom:none; }

/* ─── ADMIN PANEL ─── */
.user-row { display:flex; align-items:center; justify-content:space-between; padding:12px 0; border-bottom:1px solid var(--border); }
.user-row:last-child { border-bottom:none; }
.user-info { display:flex; flex-direction:column; gap:2px; }
.user-email { font-size:13px; font-weight:500; }
.user-meta  { font-size:11px; color:var(--muted); font-family:var(--font-mono); }

/* ─── AUTH VISIBILITY ─── */
[hidden] { display: none !important; }
#auth-logout-btn { display: flex; align-items: center; gap: 12px; }
#auth-logout-btn[hidden] { display: none !important; }

/* ─── AUTH TOGGLE ─── */
.auth-hidden { display: none !important; }
