/* ══════════════════════════════════════════════════════════
   AerisJet Inventory & Asset Tracker — Brand Theme
   Palette: Deep Blue #082742, Blue #11548F, Grey #333,
            Light Grey #F4F6F9, White #FFF
   Typography: Gill Sans MT (headings), Inter (body),
               JetBrains Mono (data)
   Mobile-first; collapses to a bottom nav under 700px
   ══════════════════════════════════════════════════════════ */

:root {
  --bg: #041c32;
  --surface: #082742;
  --surface2: #0a3256;
  --surface3: #0d3d6b;
  --border: rgba(17,84,143,0.25);
  --border2: rgba(17,84,143,0.40);
  --text: #e8eff6;
  --text-muted: #7ba3c4;
  --text-dim: #a4c4de;
  --accent: #11548F;
  --accent2: #4a8ec8;
  --accent-glow: rgba(17,84,143,0.15);
  --green: #10b981;
  --green-bg: rgba(16,185,129,0.12);
  --amber: #f59e0b;
  --amber-bg: rgba(245,158,11,0.12);
  --red: #ef4444;
  --red-bg: rgba(239,68,68,0.12);
  --grey: #6b7f94;
  --grey-bg: rgba(107,127,148,0.15);
  --safe-top: env(safe-area-inset-top);
  --safe-bot: env(safe-area-inset-bottom);
}

body.light-mode {
  --bg: #F4F6F9;
  --surface: #FFFFFF;
  --surface2: #EDF1F7;
  --surface3: #E2E8F0;
  --border: #CBD5E1;
  --border2: #B0BEC5;
  --text: #333333;
  --text-muted: #64748B;
  --text-dim: #475569;
  --accent: #11548F;
  --accent2: #1a6db5;
  --accent-glow: rgba(17,84,143,0.08);
  --green: #059669;
  --green-bg: rgba(5,150,105,0.08);
  --amber: #d97706;
  --amber-bg: rgba(217,119,6,0.08);
  --red: #dc2626;
  --red-bg: rgba(220,38,38,0.08);
  --grey: #6b7280;
  --grey-bg: rgba(107,114,128,0.10);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', Aptos, 'Segoe UI', system-ui, sans-serif;
  font-size: 14px;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}
code { font-family: 'JetBrains Mono', monospace; font-size: 0.9em; background: var(--surface2); padding: 1px 5px; border-radius: 3px; }

/* ══ MATERIAL ICON SIZE DEFAULT ══ */
.material-symbols-outlined {
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
  font-size: 18px;
  line-height: 1;
  vertical-align: middle;
}

/* ══ AUTH SCREEN ══ */
#auth-screen {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--bg) 0%, var(--surface) 100%);
  z-index: 1000;
  padding: 24px;
}
.auth-box {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; padding: 36px 32px;
  width: 100%; max-width: 380px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}
.auth-logo { display: flex; justify-content: center; margin-bottom: 18px; }
.auth-logo img { width: 56px; height: 56px; }
.auth-title {
  font-family: 'Gill Sans MT', 'Gill Sans', Calibri, sans-serif;
  font-size: 26px; font-weight: 700; text-align: center;
  letter-spacing: 1.5px; color: var(--text);
}
.auth-sub {
  font-size: 13px; color: var(--text-muted); text-align: center;
  margin-bottom: 22px; letter-spacing: 0.4px;
}
.auth-error {
  background: var(--red-bg); color: var(--red);
  border: 1px solid var(--red); border-radius: 6px;
  padding: 10px 12px; font-size: 12px; margin-top: 12px; text-align: center;
}

/* ══ HEADER ══ */
header {
  position: sticky; top: 0; z-index: 50;
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 18px calc(12px); padding-top: calc(12px + var(--safe-top));
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.logo { display: flex; align-items: center; gap: 12px; }
.logo-icon { width: 36px; height: 36px; display: grid; place-items: center; }
.logo-icon img { width: 100%; height: 100%; }
.logo-name {
  font-family: 'Gill Sans MT', 'Gill Sans', Calibri, sans-serif;
  font-size: 18px; font-weight: 700; letter-spacing: 1.5px;
  line-height: 1; color: var(--text);
}
.logo-tag {
  font-size: 10px; color: var(--text-muted); letter-spacing: 1px;
  text-transform: uppercase; margin-top: 2px;
}
.header-right { display: flex; align-items: center; gap: 10px; }
.role-pill {
  font-family: 'JetBrains Mono', monospace; font-size: 10px; font-weight: 600;
  padding: 3px 8px; border-radius: 4px;
}
.role-admin { background: rgba(17,84,143,0.18); color: var(--accent2); }
.role-readonly { background: var(--grey-bg); color: var(--text-muted); }

/* ══ TABS / BOTTOM NAV ══ */
.tabs {
  position: sticky; top: 61px; z-index: 49;
  display: flex; gap: 0; padding: 0 18px;
  background: var(--surface); border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  display: flex; align-items: center; gap: 6px;
  padding: 12px 18px; cursor: pointer;
  font-size: 13px; font-weight: 500; color: var(--text-muted);
  border-bottom: 2px solid transparent;
  white-space: nowrap; user-select: none;
  transition: all 0.15s;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); border-bottom-color: var(--accent2); }
.tab .tab-icon { font-size: 18px; }
.tab.tab-fab { color: var(--accent2); }

@media (max-width: 700px) {
  header { padding: 10px 14px; padding-top: calc(10px + var(--safe-top)); }
  .logo-tag { display: none; }
  .header-right { gap: 6px; }
  .header-right #user-display { display: none; }
  .tabs {
    position: fixed; top: auto; bottom: 0; left: 0; right: 0;
    z-index: 100;
    border-top: 1px solid var(--border); border-bottom: none;
    padding: 0;
    padding-bottom: var(--safe-bot);
    box-shadow: 0 -4px 12px rgba(0,0,0,0.25);
    justify-content: space-around;
  }
  .tab {
    flex-direction: column; gap: 2px; padding: 8px 4px;
    font-size: 10px; flex: 1; min-width: 0;
    border-bottom: none; border-top: 2px solid transparent;
  }
  .tab.active { border-top-color: var(--accent2); border-bottom: none; }
  .tab .tab-icon { font-size: 22px; }
  .tab.tab-fab .tab-icon { font-size: 28px; }
  main { padding-bottom: 80px !important; }
}

/* ══ MAIN ══ */
main {
  max-width: 1400px; margin: 0 auto;
  padding: 18px;
}
.view { display: none; }
.view.active { display: block; }

/* ══ BUTTONS ══ */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: 6px; cursor: pointer;
  font-family: inherit; font-size: 13px; font-weight: 500;
  border: 1px solid var(--border); background: var(--surface2);
  color: var(--text); transition: all 0.12s;
  user-select: none; min-height: 36px;
}
.btn:hover { background: var(--surface3); border-color: var(--border2); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover { background: var(--accent2); border-color: var(--accent2); }
.btn-ghost { background: transparent; }
.btn-ghost:hover { background: var(--surface2); }
.btn-ghost.active { background: var(--accent-glow); color: var(--accent2); border-color: var(--border2); }
.btn-danger { background: var(--red); color: #fff; border-color: var(--red); }
.btn-danger:hover { filter: brightness(1.1); }
.btn-sm { padding: 6px 10px; font-size: 12px; min-height: 30px; }
.btn-icon-only { padding: 6px; }

/* ══ ITEMS TOOLBAR ══ */
.items-toolbar {
  display: flex; gap: 10px; align-items: center;
  margin-bottom: 12px;
}
.search-wrap {
  flex: 1; position: relative;
  display: flex; align-items: center;
}
.search-icon {
  position: absolute; left: 12px; color: var(--text-muted); pointer-events: none;
}
.search-wrap input {
  flex: 1; width: 100%;
  padding: 10px 36px 10px 38px;
  border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text);
  font-size: 14px; font-family: inherit;
  min-height: 42px;
}
.search-wrap input:focus { outline: none; border-color: var(--accent2); }
.search-clear {
  position: absolute; right: 8px;
  background: var(--surface2); border: none; border-radius: 50%;
  width: 22px; height: 22px; cursor: pointer; color: var(--text-muted);
  display: grid; place-items: center;
}
.view-toggle { display: flex; gap: 4px; }
.view-toggle .btn { padding: 8px 10px; }
@media (max-width: 700px) {
  .view-toggle { display: none; }
}

/* ══ FILTER CHIPS ══ */
.filter-chips {
  display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px;
}
.filter-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 5px 10px; border-radius: 14px;
  background: var(--surface2); border: 1px solid var(--border);
  color: var(--text-muted); font-size: 12px; cursor: pointer;
  user-select: none; transition: all 0.12s;
}
.filter-chip:hover { background: var(--surface3); color: var(--text); }
.filter-chip.active {
  background: var(--accent-glow); border-color: var(--accent2); color: var(--accent2);
  font-weight: 600;
}
.filter-chip-clear {
  background: var(--red-bg); color: var(--red); border-color: var(--red);
}

.items-stats {
  font-size: 12px; color: var(--text-muted); margin-bottom: 10px;
  font-family: 'JetBrains Mono', monospace;
}

/* ══ ITEM CARDS (grid view) ══ */
.items-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
.item-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 0; cursor: pointer;
  transition: all 0.15s; overflow: hidden;
  display: flex; flex-direction: column;
  position: relative;
}
.item-card:hover { border-color: var(--accent2); transform: translateY(-2px); }
.item-card.selected { border-color: var(--accent2); box-shadow: 0 0 0 2px var(--accent-glow); }
.item-card-photo {
  aspect-ratio: 4 / 3; background: var(--surface2);
  display: grid; place-items: center; color: var(--text-muted);
  overflow: hidden; position: relative;
}
.item-card-photo img { width: 100%; height: 100%; object-fit: cover; }
.item-card-photo .placeholder { font-size: 38px; opacity: 0.4; }
.item-card-body { padding: 10px 12px; flex: 1; display: flex; flex-direction: column; gap: 4px; }
.item-card-title {
  font-weight: 600; font-size: 13px; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.item-card-meta {
  font-size: 11px; color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
}
.item-card-tags { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 4px; }
.item-tag-mini {
  font-size: 10px; padding: 1px 6px;
  background: var(--accent-glow); color: var(--accent2);
  border-radius: 8px;
}
.item-card-checkbox {
  position: absolute; top: 8px; left: 8px;
  width: 22px; height: 22px; border-radius: 4px;
  background: rgba(0,0,0,0.55); border: 1px solid #fff;
  display: grid; place-items: center;
  color: #fff; font-weight: 700; font-size: 14px;
  cursor: pointer;
}
.item-card.selected .item-card-checkbox { background: var(--accent2); }
.item-card-type-badge {
  position: absolute; top: 8px; right: 8px;
  font-size: 9px; font-weight: 700; letter-spacing: 0.5px;
  padding: 2px 6px; border-radius: 4px;
  background: rgba(0,0,0,0.6); color: #fff; text-transform: uppercase;
}

/* ══ ITEM LIST (table view) ══ */
.items-list {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; overflow: hidden;
}
.items-list table { width: 100%; border-collapse: collapse; font-size: 13px; }
.items-list th {
  text-align: left; padding: 10px 12px;
  background: var(--surface2); color: var(--text-muted);
  font-weight: 600; font-size: 11px; letter-spacing: 0.5px;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
}
.items-list td {
  padding: 10px 12px; border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.items-list tr:hover td { background: var(--surface2); cursor: pointer; }
.items-list tr.selected td { background: var(--accent-glow); }
.items-list-thumb {
  width: 36px; height: 36px; border-radius: 4px;
  background: var(--surface2); object-fit: cover;
  display: inline-block; vertical-align: middle;
}
.items-list-thumb-placeholder {
  width: 36px; height: 36px; border-radius: 4px;
  background: var(--surface2);
  display: inline-grid; place-items: center; color: var(--text-muted);
}

/* ══ STATUS BADGES ══ */
.status-badge {
  display: inline-block; padding: 2px 7px; border-radius: 4px;
  font-size: 11px; font-weight: 600;
  font-family: 'JetBrains Mono', monospace;
}
.status-in_service { background: var(--green-bg); color: var(--green); }
.status-checked_out { background: rgba(6,182,212,0.12); color: #06b6d4; }
.status-maintenance { background: var(--amber-bg); color: var(--amber); }
.status-broken { background: var(--red-bg); color: var(--red); }
.status-retired { background: var(--grey-bg); color: var(--grey); }
.status-lost { background: var(--red-bg); color: var(--red); }

.type-badge {
  display: inline-block; padding: 2px 7px; border-radius: 4px;
  font-size: 10px; font-weight: 700; letter-spacing: 0.5px;
  text-transform: uppercase;
  font-family: 'JetBrains Mono', monospace;
}
.type-asset { background: rgba(17,84,143,0.18); color: var(--accent2); }
.type-asset_stock { background: rgba(139,92,246,0.18); color: #a78bfa; }
.type-consumable { background: rgba(245,158,11,0.18); color: var(--amber); }

/* ══ EMPTY STATE ══ */
.empty-state {
  text-align: center; padding: 60px 20px;
  color: var(--text-muted);
}
.empty-state .material-symbols-outlined {
  font-size: 64px; opacity: 0.3; margin-bottom: 12px;
}
.empty-state-title { font-size: 16px; font-weight: 600; margin-bottom: 6px; color: var(--text); }
.empty-state-desc { font-size: 13px; }

/* ══ FAB ══ */
.fab {
  position: fixed;
  bottom: calc(24px + var(--safe-bot));
  right: 24px;
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--accent); color: #fff;
  border: none; cursor: pointer;
  box-shadow: 0 6px 20px rgba(0,0,0,0.4);
  display: grid; place-items: center;
  z-index: 60;
  transition: all 0.15s;
}
.fab:hover { background: var(--accent2); transform: scale(1.05); }
.fab .material-symbols-outlined { font-size: 28px; color: #fff; }
@media (max-width: 700px) {
  .fab { bottom: calc(80px + var(--safe-bot)); right: 16px; }
}

/* ══ MODALS ══ */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(4,12,24,0.75);
  z-index: 200;
  display: none;
  align-items: center; justify-content: center;
  padding: 20px;
  overflow-y: auto;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px;
  width: 100%; max-width: 520px;
  max-height: calc(100vh - 40px);
  display: flex; flex-direction: column;
  box-shadow: 0 30px 80px rgba(0,0,0,0.5);
  overflow: hidden;
}
.modal-wide { max-width: 880px; }
.modal-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.modal-title {
  font-family: 'Gill Sans MT', 'Gill Sans', Calibri, sans-serif;
  font-size: 17px; font-weight: 700; letter-spacing: 0.5px;
}
.modal-close {
  background: transparent; border: none; cursor: pointer;
  color: var(--text-muted); font-size: 20px;
  width: 32px; height: 32px; border-radius: 6px;
  display: grid; place-items: center;
}
.modal-close:hover { background: var(--surface2); color: var(--text); }
.modal-body { padding: 20px; overflow-y: auto; flex: 1; }
.modal-footer {
  display: flex; gap: 8px; justify-content: flex-end;
  padding: 14px 20px; border-top: 1px solid var(--border);
  flex-shrink: 0;
}
@media (max-width: 700px) {
  .modal-backdrop { padding: 0; align-items: stretch; }
  .modal { max-width: 100%; max-height: 100vh; border-radius: 0; }
}

/* ══ ITEM DETAIL MODAL ══ */
.item-detail-grid {
  display: grid; grid-template-columns: 280px 1fr; gap: 24px;
}
@media (max-width: 700px) {
  .item-detail-grid { grid-template-columns: 1fr; gap: 16px; }
}
.photo-carousel {
  position: relative; aspect-ratio: 1 / 1;
  background: var(--surface2); border-radius: 8px;
  overflow: hidden;
}
.photo-carousel img {
  width: 100%; height: 100%; object-fit: cover;
}
.photo-carousel .placeholder {
  display: grid; place-items: center; height: 100%;
  color: var(--text-muted); font-size: 60px; opacity: 0.3;
}
.photo-carousel .photo-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  background: rgba(0,0,0,0.55); color: #fff; border: none;
  width: 36px; height: 36px; border-radius: 50%; cursor: pointer;
  display: grid; place-items: center;
}
.photo-nav.prev { left: 8px; } .photo-nav.next { right: 8px; }
.photo-dots {
  position: absolute; bottom: 8px; left: 0; right: 0;
  display: flex; justify-content: center; gap: 5px;
}
.photo-dots span {
  width: 6px; height: 6px; border-radius: 50%;
  background: rgba(255,255,255,0.5);
}
.photo-dots span.active { background: #fff; }
.photo-actions { display: flex; gap: 6px; margin-top: 8px; }
.photo-actions .btn { flex: 1; }
.photo-actions input[type=file] {
  position: absolute; opacity: 0; pointer-events: none;
}
.photo-upload-label {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: 6px; cursor: pointer;
  font-size: 13px; font-weight: 500;
  background: var(--accent); color: #fff;
  flex: 1; justify-content: center;
  min-height: 36px;
}

.item-form { display: flex; flex-direction: column; gap: 12px; }
.form-row { display: flex; flex-direction: column; gap: 4px; }
.form-row label {
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--text-muted);
}
.form-row input,
.form-row select,
.form-row textarea {
  padding: 8px 10px; border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface2); color: var(--text);
  font-family: inherit; font-size: 14px;
  min-height: 38px;
}
.form-row textarea { min-height: 70px; resize: vertical; }
.form-row input:focus, .form-row select:focus, .form-row textarea:focus {
  outline: none; border-color: var(--accent2);
}
.form-row-inline { display: flex; gap: 10px; }
.form-row-inline > .form-row { flex: 1; }

/* ══ TAG INPUT (Notion-style) ══ */
.tag-input-wrap {
  position: relative;
  border: 1px solid var(--border); border-radius: 6px;
  background: var(--surface2);
  padding: 6px;
  display: flex; flex-wrap: wrap; gap: 4px;
  min-height: 38px; align-items: center;
}
.tag-input-wrap:focus-within { border-color: var(--accent2); }
.tag-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px; border-radius: 12px;
  background: var(--accent-glow); color: var(--accent2);
  font-size: 12px; font-weight: 500;
}
.tag-chip-x {
  cursor: pointer; opacity: 0.6;
  font-size: 14px; line-height: 1;
}
.tag-chip-x:hover { opacity: 1; }
.tag-input {
  flex: 1; min-width: 100px;
  border: none !important; background: transparent !important;
  outline: none; padding: 4px !important;
  min-height: 26px !important;
  font-size: 13px !important; color: var(--text);
}
.tag-suggest {
  position: absolute; top: 100%; left: 0; right: 0;
  background: var(--surface); border: 1px solid var(--border2);
  border-radius: 6px; margin-top: 4px;
  max-height: 220px; overflow-y: auto;
  z-index: 10; box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}
.tag-suggest-item {
  padding: 8px 12px; cursor: pointer; font-size: 13px;
  display: flex; justify-content: space-between; align-items: center;
}
.tag-suggest-item:hover, .tag-suggest-item.highlight {
  background: var(--surface2);
}
.tag-suggest-item .new-badge {
  font-size: 10px; color: var(--green); font-weight: 600;
  text-transform: uppercase;
}

/* ══ STOCK LOTS TABLE ══ */
.stock-lots {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 8px; overflow: hidden;
}
.stock-lots table { width: 100%; border-collapse: collapse; font-size: 13px; }
.stock-lots th {
  text-align: left; padding: 8px 10px;
  background: var(--surface3); color: var(--text-muted);
  font-weight: 600; font-size: 10px; text-transform: uppercase;
  letter-spacing: 0.5px;
}
.stock-lots td {
  padding: 8px 10px; border-top: 1px solid var(--border);
  vertical-align: middle;
}
.stock-lots .lot-qty {
  font-family: 'JetBrains Mono', monospace; font-weight: 600;
  text-align: center; min-width: 36px;
}
.stock-lots .lot-actions {
  display: flex; gap: 4px; justify-content: flex-end;
}
.lot-qty-controls {
  display: inline-flex; align-items: center; gap: 4px;
}
.lot-qty-btn {
  width: 26px; height: 26px; border-radius: 4px;
  background: var(--surface3); border: 1px solid var(--border);
  color: var(--text); cursor: pointer;
  font-weight: 700; line-height: 1;
}
.lot-qty-btn:hover { background: var(--accent); color: #fff; border-color: var(--accent); }
.stock-summary {
  display: flex; gap: 12px; margin-bottom: 8px; flex-wrap: wrap;
}
.stock-summary-pill {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 6px; padding: 6px 12px;
  font-size: 12px;
}
.stock-summary-pill strong {
  font-family: 'JetBrains Mono', monospace; font-size: 14px; margin-left: 6px;
}

/* ══ CHECKOUT SECTION ══ */
.checkout-mode {
  display: flex; gap: 6px; margin-bottom: 8px;
}
.checkout-mode label {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 6px 10px; border-radius: 6px;
  background: var(--surface2); border: 1px solid var(--border);
  cursor: pointer; font-size: 12px;
}
.checkout-mode input { margin: 0; }
.people-picker-results {
  background: var(--surface); border: 1px solid var(--border2);
  border-radius: 6px; max-height: 200px; overflow-y: auto;
  margin-top: 4px;
}
.people-picker-result {
  padding: 8px 12px; cursor: pointer; font-size: 13px;
  border-bottom: 1px solid var(--border);
}
.people-picker-result:hover { background: var(--surface2); }
.people-picker-result .email {
  font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--text-muted);
}

/* ══ DETAIL META PANEL (sidebar) ══ */
.detail-section {
  margin-top: 18px; padding-top: 14px;
  border-top: 1px solid var(--border);
}
.detail-section-title {
  font-family: 'Gill Sans MT', 'Gill Sans', Calibri, sans-serif;
  font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--text-muted); margin-bottom: 8px;
}

/* ══ SCAN VIEW ══ */
.scan-panel { max-width: 480px; margin: 0 auto; }
.qr-reader {
  width: 100%; aspect-ratio: 1 / 1; max-width: 380px;
  margin: 12px auto; background: var(--surface);
  border: 2px dashed var(--border2); border-radius: 12px;
  overflow: hidden;
  display: grid; place-items: center;
  color: var(--text-muted);
}
.qr-reader video { width: 100% !important; height: 100% !important; object-fit: cover; }
.scan-actions { display: flex; gap: 8px; justify-content: center; margin-top: 8px; }
.scan-hint { text-align: center; font-size: 12px; color: var(--text-muted); margin-top: 16px; }
.scan-manual {
  display: flex; gap: 6px; max-width: 340px; margin: 8px auto 0;
}
.scan-manual input {
  flex: 1; padding: 8px 12px;
  border: 1px solid var(--border); border-radius: 6px;
  background: var(--surface2); color: var(--text);
  font-family: 'JetBrains Mono', monospace; font-size: 13px;
  min-height: 38px;
}
.recent-scans {
  display: flex; flex-direction: column; gap: 6px;
}
.recent-scan-row {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: 10px 12px; cursor: pointer;
}
.recent-scan-row:hover { border-color: var(--accent2); }
.recent-scan-row .scan-time {
  font-family: 'JetBrains Mono', monospace; font-size: 11px;
  color: var(--text-muted); margin-left: auto;
}

/* ══ BULK VIEW ══ */
.bulk-header { margin-bottom: 12px; }
.bulk-hint { font-size: 12px; color: var(--text-muted); }
.bulk-actionbar {
  position: sticky; top: 110px; z-index: 30;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 10px 14px;
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 12px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.25);
  flex-wrap: wrap;
}
.bulk-count {
  font-weight: 600; color: var(--accent2);
  font-family: 'JetBrains Mono', monospace;
}
.bulk-buttons { display: flex; gap: 6px; flex-wrap: wrap; }

/* ══ EXPORT CARDS (data tab) ══ */
.section-title {
  font-family: 'Gill Sans MT', 'Gill Sans', Calibri, sans-serif;
  font-size: 18px; font-weight: 700; letter-spacing: 0.5px;
  margin-bottom: 14px;
}
.export-cards {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
}
@media (max-width: 700px) { .export-cards { grid-template-columns: 1fr; } }
.export-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 20px;
  display: flex; flex-direction: column; gap: 10px;
}
.export-card-icon { font-size: 28px !important; line-height: 1; color: var(--accent2); }
.export-card-title {
  font-family: 'Gill Sans MT', 'Gill Sans', Calibri, sans-serif;
  font-size: 14px; font-weight: 700; letter-spacing: 0.5px;
}
.export-card-desc {
  font-size: 12px; color: var(--text-muted); line-height: 1.6; flex: 1;
}
.export-options {
  display: flex; flex-direction: column; gap: 6px;
}
.upload-zone {
  position: relative; background: var(--surface2);
  border: 2px dashed var(--border2); border-radius: 8px;
  padding: 20px; text-align: center; cursor: pointer;
  transition: all 0.15s;
}
.upload-zone.drag-over { border-color: var(--accent2); background: var(--accent-glow); }
.upload-zone-text { font-size: 13px; color: var(--text); }
.upload-status {
  font-size: 12px; color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
  min-height: 16px;
}
.upload-status.error { color: var(--red); }
.upload-status.success { color: var(--green); }

/* ══ ADMIN PANEL ══ */
.admin-panel {
  max-width: 900px; margin: 0 auto;
  display: flex; flex-direction: column; gap: 18px;
}
.admin-section {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 18px 22px;
}
.admin-section-title {
  font-family: 'Gill Sans MT', 'Gill Sans', Calibri, sans-serif;
  font-size: 15px; font-weight: 700; letter-spacing: 0.5px;
  text-transform: uppercase; margin-bottom: 4px;
}
.admin-section-desc {
  font-size: 13px; color: var(--text-muted);
  line-height: 1.6; margin-bottom: 14px;
}
.admin-users-list {
  display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px;
}
.admin-user-row {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface2); border: 1px solid var(--border2);
  border-radius: 6px; padding: 8px 12px;
}
.admin-user-email {
  flex: 1; font-family: 'JetBrains Mono', monospace; font-size: 13px;
}
.admin-user-role {
  font-family: 'JetBrains Mono', monospace; font-size: 11px;
  padding: 2px 8px; border-radius: 4px; font-weight: 600;
}
.admin-user-role.admin { background: rgba(17,84,143,0.18); color: var(--accent2); }
.admin-user-role.readonly { background: var(--grey-bg); color: var(--text-muted); }
.admin-add-user-row {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
}
.admin-add-user-row input,
.admin-add-user-row select {
  font-family: 'JetBrains Mono', monospace; font-size: 13px;
  padding: 7px 10px; border-radius: 6px;
  border: 1px solid var(--border); background: var(--surface2); color: var(--text);
}
.admin-add-user-row input { flex: 1; min-width: 180px; }

.theme-toggle-wrap { display: flex; gap: 8px; }
.theme-btn {
  padding: 8px 18px; border-radius: 6px; cursor: pointer;
  font-size: 13px; font-weight: 500;
  border: 1px solid var(--border);
  background: var(--surface2); color: var(--text-muted);
  transition: all 0.15s;
}
.theme-btn.active {
  background: var(--accent); color: #fff; border-color: var(--accent);
}

/* ══ AUDIT LIST ══ */
.audit-list { display: flex; flex-direction: column; gap: 4px; }
.audit-row {
  display: grid; grid-template-columns: auto 1fr auto auto; gap: 10px;
  align-items: center;
  padding: 8px 12px; background: var(--surface2);
  border-radius: 6px; font-size: 12px;
}
.audit-event {
  font-family: 'JetBrains Mono', monospace; font-size: 10px;
  padding: 2px 6px; border-radius: 3px;
  background: var(--surface3); color: var(--text-muted);
  text-transform: uppercase; font-weight: 600;
}
.audit-actor { color: var(--text); }
.audit-time {
  font-family: 'JetBrains Mono', monospace; font-size: 10px;
  color: var(--text-muted);
}

/* ══ QR SHEET ══ */
.qr-sheet-controls {
  display: flex; gap: 10px; align-items: center;
  flex-wrap: wrap; margin-bottom: 14px;
  padding-bottom: 12px; border-bottom: 1px solid var(--border);
}
.qr-sheet-controls label {
  font-size: 12px; color: var(--text-muted);
  display: inline-flex; align-items: center; gap: 6px;
}
.qr-sheet-controls select {
  padding: 6px 10px; border-radius: 6px;
  border: 1px solid var(--border); background: var(--surface2); color: var(--text);
}
.qr-pick-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 8px;
}
.qr-pick-tile {
  display: flex; align-items: center; gap: 8px;
  padding: 8px; background: var(--surface2);
  border: 1px solid var(--border); border-radius: 6px;
  cursor: pointer; font-size: 12px;
}
.qr-pick-tile.selected { border-color: var(--accent2); background: var(--accent-glow); }
.qr-pick-tile input { flex-shrink: 0; }
.qr-pick-tile-title {
  flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ══ PRINT (QR sheet) ══ */
#print-frame { display: none; }
@media print {
  body * { visibility: hidden; }
  #print-frame, #print-frame * { visibility: visible; }
  #print-frame {
    display: block !important;
    position: fixed; top: 0; left: 0; width: 100%;
    background: #fff; color: #000;
  }
  @page { size: A4; margin: 8mm; }
}

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

#loading-overlay {
  position: fixed; inset: 0;
  background: rgba(4,12,24,0.85);
  display: none; flex-direction: column;
  align-items: center; justify-content: center;
  z-index: 999; gap: 14px;
}
#loading-overlay.open { display: flex; }
#loading-msg {
  font-size: 13px; color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
}

/* ══ TOAST ══ */
.toast {
  position: fixed; bottom: calc(24px + var(--safe-bot)); left: 50%;
  transform: translateX(-50%);
  background: var(--surface3); color: var(--text);
  border: 1px solid var(--border2); border-radius: 8px;
  padding: 10px 18px; font-size: 13px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  z-index: 300; opacity: 0;
  transition: opacity 0.3s, transform 0.3s;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(-4px); }
.toast.success { border-color: var(--green); }
.toast.error { border-color: var(--red); }
@media (max-width: 700px) {
  .toast { bottom: calc(96px + var(--safe-bot)); }
}
