/* ===== MJR Admin v2 — Dark warm, amber accent ===== */

/* Restore [hidden] — author display: flex/grid overrides UA display: none */
[hidden] { display: none !important; }

:root {
  /* Surfaces */
  --bg:          #0a0907;
  --panel:       #1c1612;
  --panel-2:     #261e18;
  --panel-3:     #2e251e;
  --field:       #2a2018;
  --row-alt:     #1f1814;
  --row-hover:   #312619;

  /* Borders */
  --border:        #352a22;
  --border-strong: #4a3a2c;
  --field-bd:      #463629;

  /* Text */
  --text:    #f5ede0;
  --muted:   #b8a991;
  --muted-2: #7c6f5e;

  /* Primary action */
  --amber:      #b45309;
  --amber-hover:#c2620e;
  --amber-soft: rgba(180,83,9,0.14);

  /* Brand accent */
  --gold: #d7b070;

  /* Status */
  --green:      #15803d; --green-fg: #86efac; --green-soft: rgba(21,128,61,0.16);
  --red:        #b91c1c; --red-fg:   #fca5a5; --red-soft:   rgba(185,28,28,0.16);
  --blue:       #1d4ed8; --blue-fg:  #93c5fd; --blue-soft:  rgba(29,78,216,0.16);

  /* Typography */
  --sans:  'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --serif: 'Cormorant Garamond', Georgia, serif;
  --mono:  ui-monospace, 'JetBrains Mono', Menlo, monospace;

  /* Radii */
  --r-sm:   6px;
  --r-md:   8px;
  --r-lg:   12px;
  --r-pill: 999px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { font-family: var(--sans); background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }

/* ===== User selector screen ===== */
.user-selector-screen {
  position: fixed; inset: 0;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  z-index: 200;
}
.user-selector-card {
  width: min(400px, 92vw);
  background: var(--panel);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-lg);
  padding: 32px;
  display: flex; flex-direction: column; align-items: center;
  gap: 16px; text-align: center;
  box-shadow: 0 4px 32px rgba(0,0,0,0.4);
}
.user-selector-brand {
  display: flex; align-items: center; gap: 12px; margin-bottom: 4px;
}
.user-selector-name { font-family: var(--serif); font-style: italic; font-size: 20px; font-weight: 600; color: var(--gold); }
.user-selector-sub { font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted-2); margin-top: 2px; }
.user-selector-card h2 { font-size: 20px; font-weight: 700; }
.user-selector-hint { font-size: 13px; color: var(--muted); margin-top: -8px; }
.user-btns { display: flex; gap: 12px; width: 100%; }
.user-btn {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 20px 16px; border-radius: var(--r-lg);
  background: var(--panel-2); border: 1px solid var(--border);
  color: var(--text); font-size: 15px; font-weight: 600;
  transition: border-color 0.15s, background 0.15s;
}
.user-btn:hover { border-color: var(--amber); background: var(--panel-3); }
.user-btn-avatar {
  width: 44px; height: 44px; border-radius: 50%;
  background: linear-gradient(135deg, var(--amber), #c2620e);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 700; color: white;
}

/* ===== Admin key banner ===== */
.admin-banner {
  position: fixed; top: 0; left: 0; right: 0; z-index: 150;
  background: var(--amber); color: white;
  padding: 10px 16px; text-align: center; font-size: 13px;
}

/* ===== App layout ===== */
.app {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

/* ===== Sidebar ===== */
.sidebar {
  background: var(--panel);
  border-right: 1px solid var(--border-strong);
  box-shadow: 1px 0 0 rgba(255,255,255,0.02);
  padding: 16px 12px;
  display: flex; flex-direction: column; gap: 2px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.brand-row {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 8px 14px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 10px;
}
.brand-name { font-family: var(--serif); font-style: italic; font-size: 18px; font-weight: 600; color: var(--gold); line-height: 1; }
.brand-sub { font-size: 10px; letter-spacing: 0.14em; color: var(--muted-2); text-transform: uppercase; margin-top: 2px; }
.nav-section {
  display: block; font-size: 10px; text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--muted-2); font-weight: 600; padding: 12px 8px 4px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: var(--r-md);
  color: var(--muted); font-size: 13px; font-weight: 500;
  border: none; background: transparent; width: 100%; text-align: left;
  transition: background 0.12s, color 0.12s;
}
.nav-item:hover { background: var(--panel-2); color: var(--text); }
.nav-item.active { background: var(--amber-soft); color: var(--text); font-weight: 600; }
.nav-item.active svg { color: var(--amber); }
.nav-item svg { color: var(--muted-2); flex-shrink: 0; }
.nav-item .badge {
  margin-left: auto; background: var(--field); color: var(--muted);
  font-size: 10px; font-weight: 600; padding: 1px 6px; border-radius: 4px;
}
.sidebar-footer { margin-top: auto; border-top: 1px solid var(--border); padding-top: 10px; }
.user-chip {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: var(--r-md); cursor: pointer;
}
.user-chip:hover { background: var(--panel-2); }
.user-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: linear-gradient(135deg, var(--amber), #c2620e);
  display: flex; align-items: center; justify-content: center;
  color: white; font-weight: 700; font-size: 12px; flex-shrink: 0;
}
.user-name { font-size: 13px; font-weight: 600; line-height: 1.1; }
.user-role { font-size: 11px; color: var(--muted-2); }

/* ===== Main ===== */
.main { display: flex; flex-direction: column; min-width: 0; }

/* ===== Topbar ===== */
.topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 24px;
  border-bottom: 1px solid var(--border-strong);
  background: rgba(10,9,7,0.9);
  backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 5;
}
.topbar-left h1 { font-size: 16px; font-weight: 600; }
.topbar-left .crumb { font-size: 12px; color: var(--muted-2); margin-left: 4px; }
.search {
  position: relative; flex: 1; max-width: 460px; margin-left: 16px;
}
.search input {
  width: 100%; background: var(--field); border: 1px solid var(--field-bd);
  border-radius: var(--r-md); padding: 7px 40px 7px 32px;
  color: var(--text); font-size: 13px;
}
.search input:focus { outline: none; border-color: var(--amber); box-shadow: 0 0 0 3px var(--amber-soft); }
.search > svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--muted-2); pointer-events: none; }
.search .kbd {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  font-size: 10px; color: var(--muted-2); font-family: var(--mono);
  border: 1px solid var(--field-bd); border-radius: 4px; padding: 1px 5px;
  background: var(--panel); pointer-events: none;
}
.topbar-spacer { flex: 1; }
.icon-btn {
  background: transparent; border: 1px solid var(--field-bd); color: var(--muted);
  width: 32px; height: 32px; border-radius: var(--r-md);
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.icon-btn:hover { color: var(--text); border-color: var(--border-strong); }

/* ===== Buttons ===== */
.btn {
  border: 1px solid transparent; border-radius: var(--r-md);
  padding: 7px 14px; font-size: 13px; font-weight: 600;
  display: inline-flex; align-items: center; gap: 6px;
  transition: background 0.12s, border-color 0.12s; white-space: nowrap;
}
.btn-primary { background: var(--amber); color: white; box-shadow: 0 1px 0 rgba(255,255,255,0.1) inset, 0 1px 2px rgba(0,0,0,0.4); }
.btn-primary:hover { background: var(--amber-hover); }
.btn-secondary { background: var(--field); color: var(--text); border-color: var(--field-bd); }
.btn-secondary:hover { background: var(--panel-2); border-color: var(--border-strong); }
.btn-ghost { background: transparent; color: var(--muted); border-color: transparent; }
.btn-ghost:hover { background: var(--panel-2); color: var(--text); }
.btn-danger { background: transparent; color: var(--red-fg); border-color: var(--red); }
.btn-danger:hover { background: var(--red-soft); }
.btn-sm { padding: 4px 10px; font-size: 12px; }

/* ===== Pages ===== */
.page { padding: 28px 32px 56px; }
.page-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 20px; gap: 16px; flex-wrap: wrap;
}
.page-header h2 { font-size: 22px; font-weight: 700; letter-spacing: -0.01em; margin-bottom: 2px; }
.page-header p { font-size: 13px; color: var(--muted); }
.page-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ===== Stat grid ===== */
.stat-grid {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 12px; margin-bottom: 20px;
}
.stat-card {
  background: var(--panel); border: 1px solid var(--border-strong);
  border-radius: var(--r-lg); padding: 16px;
  display: flex; flex-direction: column; gap: 4px;
  box-shadow: 0 1px 0 rgba(255,255,255,0.03) inset, 0 1px 2px rgba(0,0,0,0.3);
}
.stat-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600; color: var(--muted); }
.stat-value { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-delta { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; }
.stat-delta.up { color: var(--green-fg); }
.stat-delta.down { color: var(--red-fg); }
.stat-delta .ago { color: var(--muted-2); font-weight: 400; }

/* ===== Section cards ===== */
.section-card {
  background: var(--panel); border: 1px solid var(--border-strong);
  border-radius: var(--r-lg); overflow: hidden; margin-bottom: 16px;
  box-shadow: 0 1px 0 rgba(255,255,255,0.03) inset, 0 4px 12px rgba(0,0,0,0.25);
}
.section-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 18px; border-bottom: 1px solid var(--border-strong);
  background: var(--panel-2); gap: 12px;
}
.section-head h3 { font-size: 13px; font-weight: 600; }
.section-head .meta { font-size: 12px; color: var(--muted); }
.section-body { padding: 16px 18px; }
.section-body.flush { padding: 0; }

/* ===== Table ===== */
.table-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 600px; }
.tbl thead th {
  text-align: left; padding: 10px 16px;
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--muted); border-bottom: 1px solid var(--border-strong);
  background: var(--panel-3); white-space: nowrap; cursor: default;
}
.tbl thead th + th { border-left: 1px solid var(--border); }
.tbl thead th.sortable { cursor: pointer; user-select: none; }
.tbl thead th.sortable:hover { color: var(--text); }
.tbl thead th.sort-active { color: var(--text); }
.tbl thead th .sort-arrow { color: var(--muted-2); margin-left: 4px; font-size: 10px; }
.tbl thead th.sort-active .sort-arrow { color: var(--amber); }
.tbl tbody td { padding: 13px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl tbody tr { background: var(--panel); }
.tbl tbody tr:nth-child(even) { background: var(--row-alt); }
.tbl tbody tr:hover { background: var(--row-hover) !important; cursor: pointer; }
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl tbody td + td { border-left: 1px solid rgba(53,42,34,0.5); }
.tbl .id { font-family: var(--mono); font-size: 12px; color: var(--gold); }
.tbl .price { font-variant-numeric: tabular-nums; font-weight: 600; }
.tbl .thumb {
  width: 36px; height: 36px; border-radius: 6px;
  background: linear-gradient(135deg, #4a3527, #2a1f17);
  border: 1px solid var(--border);
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--muted-2); overflow: hidden; flex-shrink: 0;
}
.tbl .thumb img { width: 100%; height: 100%; object-fit: cover; border-radius: 5px; }
.row-actions { display: flex; gap: 4px; opacity: 0; transition: opacity 0.12s; }
.tbl tbody tr:hover .row-actions { opacity: 1; }
.row-action-btn {
  background: var(--field); border: 1px solid var(--field-bd); color: var(--muted);
  width: 26px; height: 26px; border-radius: var(--r-sm);
  display: inline-flex; align-items: center; justify-content: center;
}
.row-action-btn:hover { color: var(--text); background: var(--panel-2); }
.row-action-btn.danger:hover { color: var(--red-fg); border-color: var(--red); }

/* ===== Badges ===== */
.badge-pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px; border-radius: var(--r-pill);
  font-size: 11px; font-weight: 600; border: 1px solid;
}
.badge-pill .dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.badge-available { background: var(--green-soft); color: var(--green-fg); border-color: rgba(21,128,61,0.4); }
.badge-available .dot { background: var(--green-fg); }
.badge-sold { background: rgba(124,111,94,0.15); color: var(--muted); border-color: var(--field-bd); }
.badge-sold .dot { background: var(--muted-2); }
.badge-hold { background: var(--amber-soft); color: #fcd34d; border-color: rgba(180,83,9,0.45); }
.badge-hold .dot { background: #fcd34d; }

/* ===== Toolbar ===== */
.toolbar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 12px 16px; border-bottom: 1px solid var(--border-strong);
  background: var(--panel-2);
}
.toolbar .search { margin: 0; max-width: 280px; }
.filter-pill {
  background: var(--field); border: 1px solid var(--field-bd); color: var(--muted);
  padding: 5px 10px; border-radius: var(--r-md); font-size: 12px; font-weight: 500;
  display: inline-flex; align-items: center; gap: 5px; white-space: nowrap;
}
.filter-pill:hover { color: var(--text); border-color: var(--border-strong); }
.filter-pill.active { background: var(--amber-soft); color: var(--text); border-color: rgba(180,83,9,0.5); }
.filter-pill span { background: var(--panel-2); border-radius: 3px; padding: 0 4px; font-size: 10px; }
.filter-pill.active span { background: rgba(180,83,9,0.2); }

/* ===== Slide-over sheet ===== */
.sheet-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 90;
  opacity: 0; pointer-events: none; transition: opacity 0.2s;
}
.sheet-overlay.open { opacity: 1; pointer-events: auto; }
.sheet {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100vw);
  background: var(--panel); border-left: 1px solid var(--border);
  z-index: 100; transform: translateX(100%);
  transition: transform 0.25s cubic-bezier(0.32, 0.72, 0, 1);
  display: flex; flex-direction: column;
  box-shadow: -8px 0 24px rgba(0,0,0,0.4);
}
.sheet.open { transform: translateX(0); }
.sheet-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px; border-bottom: 1px solid var(--border);
}
.sheet-head h3 { font-size: 15px; font-weight: 600; }
.sheet-body { flex: 1; overflow-y: auto; padding: 20px; }
.sheet-foot {
  display: flex; gap: 8px; justify-content: flex-end;
  padding: 12px 20px; border-top: 1px solid var(--border);
  background: var(--panel-2);
}

/* ===== Sheet form ===== */
.form-section {
  border-bottom: 1px solid var(--border);
  padding-bottom: 18px; margin-bottom: 18px;
}
.form-section:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.form-section h4 {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em;
  font-weight: 600; color: var(--muted); margin-bottom: 12px;
}
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.form-grid.cols-1 { grid-template-columns: 1fr; }
.form-field { display: flex; flex-direction: column; gap: 4px; }
.form-field.col-span-2 { grid-column: span 2; }
.form-field > label { font-size: 12px; font-weight: 500; color: var(--text); }
.form-field .hint { font-size: 11px; color: var(--muted-2); }
.form-field input, .form-field select, .form-field textarea {
  background: var(--field); border: 1px solid var(--field-bd);
  border-radius: var(--r-md); padding: 7px 10px;
  color: var(--text); font-size: 13px;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.form-field input:focus, .form-field select:focus, .form-field textarea:focus {
  outline: none; border-color: var(--amber); box-shadow: 0 0 0 3px var(--amber-soft);
}
.form-field input::placeholder { color: var(--muted-2); }
.form-field textarea { resize: vertical; min-height: 64px; }
.form-field select option { background: var(--panel-2); }

/* ===== Drop zone ===== */
.drop-zone {
  border: 1.5px dashed var(--field-bd); border-radius: var(--r-lg);
  padding: 24px; text-align: center; background: var(--field);
  transition: border-color 0.15s, background 0.15s; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.drop-zone:hover, .drop-zone.drag { border-color: var(--amber); background: var(--amber-soft); }
.drop-zone-icon { color: var(--muted-2); margin-bottom: 2px; }
.drop-zone .title { font-size: 13px; font-weight: 600; color: var(--text); }
.drop-zone .hint { font-size: 11px; color: var(--muted-2); }
.drop-zone-text { display: flex; flex-direction: column; gap: 2px; }

/* Drop zone preview */
.photo-preview-wrap { position: relative; margin-top: 10px; }
.photo-preview-wrap img {
  width: 100%; max-height: 200px; object-fit: cover;
  border-radius: var(--r-md); border: 1px solid var(--border);
}
.photo-preview-wrap .remove-photo {
  position: absolute; top: 6px; right: 6px;
  background: rgba(0,0,0,0.6); border: none; color: white;
  border-radius: 50%; width: 24px; height: 24px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 14px;
}
.photo-uploading { font-size: 12px; color: var(--muted); margin-top: 6px; }

/* ===== Activity feed ===== */
.activity { display: flex; flex-direction: column; }
.activity-item {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 10px 18px; border-bottom: 1px solid var(--border); font-size: 13px;
}
.activity-item:last-child { border-bottom: none; }
.activity-icon {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--panel-2); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.activity-icon.green { background: var(--green-soft); border-color: rgba(21,128,61,0.4); color: var(--green-fg); }
.activity-icon.amber { background: var(--amber-soft); border-color: rgba(180,83,9,0.4); color: #fcd34d; }
.activity-icon.blue  { background: var(--blue-soft);  border-color: rgba(29,78,216,0.4);  color: var(--blue-fg); }
.activity-body { flex: 1; }
.activity-body .muted { color: var(--muted); }
.activity-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.activity-time { color: var(--muted-2); font-size: 11px; white-space: nowrap; margin-left: auto; }

/* ===== Dashboard 2-col grid ===== */
.dash-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; }
.dash-right { display: flex; flex-direction: column; gap: 12px; }

/* ===== Quick actions ===== */
.quickadd-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.quickadd {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 14px;
  display: flex; align-items: center; gap: 12px; text-align: left; color: var(--text);
  transition: border-color 0.12s, background 0.12s;
}
.quickadd:hover { border-color: var(--amber); background: var(--panel-2); }
.qa-icon {
  width: 36px; height: 36px; border-radius: var(--r-md);
  background: var(--amber-soft); color: var(--amber);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.qa-title { font-size: 13px; font-weight: 600; }
.qa-sub { font-size: 11px; color: var(--muted-2); }

/* ===== Quick links (dashboard) ===== */
.quick-link {
  display: flex; align-items: center; gap: 8px;
  color: var(--muted); font-size: 13px;
  padding: 6px 8px; border-radius: var(--r-sm);
  transition: background 0.12s, color 0.12s;
}
.quick-link:hover { background: var(--panel-2); color: var(--text); }

/* ===== Inventory summary bar ===== */
.inv-summary-bar {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 10px; margin-bottom: 16px;
}
.inv-summary-card {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 12px 14px;
}
.inv-summary-label { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin-bottom: 2px; }
.inv-summary-card strong { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }

/* ===== Source summary ===== */
.source-stat-row { display: flex; gap: 12px; flex-wrap: wrap; }
.source-stat { background: var(--panel-2); border-radius: var(--r-sm); padding: 10px 14px; flex: 1; min-width: 100px; }
.source-stat span { display: block; font-size: 11px; color: var(--muted); margin-bottom: 2px; }
.source-stat strong { font-size: 16px; }

/* ===== Category grid (expenses) ===== */
.category-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.category-card {
  background: var(--panel-2); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 12px 14px;
}
.category-card span { display: block; font-size: 12px; color: var(--muted); }
.category-card strong { display: block; margin-top: 4px; font-size: 16px; font-weight: 600; }

/* ===== Mobile card list ===== */
.card-list { display: none; flex-direction: column; gap: 12px; padding: 12px; }
.data-card {
  background: var(--panel-2); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 14px; display: flex; flex-direction: column; gap: 10px;
}
.data-card-title { font-size: 14px; font-weight: 600; color: var(--gold); font-family: var(--mono); }
.data-card .meta { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px 12px; font-size: 12px; color: var(--muted); }
.data-card .meta div { display: flex; flex-direction: column; }
.data-card .meta div span { color: var(--text); font-weight: 500; margin-top: 1px; }
.card-actions { display: flex; gap: 8px; }

/* ===== Settings ===== */
.toggle-switch { position: relative; display: inline-block; width: 44px; height: 24px; flex-shrink: 0; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider { position: absolute; cursor: pointer; inset: 0; background: var(--border); border-radius: 24px; transition: background 0.2s; }
.toggle-slider::before { content: ''; position: absolute; height: 18px; width: 18px; left: 3px; bottom: 3px; background: #fff; border-radius: 50%; transition: transform 0.2s; }
.toggle-switch input:checked + .toggle-slider { background: var(--amber); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(20px); }

/* ===== Mini select ===== */
.mini-select {
  background: var(--field); border: 1px solid var(--field-bd);
  border-radius: var(--r-md); padding: 5px 8px; color: var(--text);
  font-size: 12px; font-family: var(--sans);
}
.mini-select:focus { outline: none; border-color: var(--amber); }

/* ===== Bulk upload ===== */
.bulk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; margin-top: 14px; }
.bulk-card { background: var(--panel-2); border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; }
.bulk-card img { width: 100%; height: 120px; object-fit: cover; display: block; }
.bulk-card-body { padding: 8px 10px; display: flex; flex-direction: column; gap: 6px; }
.bulk-card input { background: var(--field); border: 1px solid var(--field-bd); border-radius: var(--r-sm); padding: 4px 8px; color: var(--text); font-size: 12px; width: 100%; }
.bulk-card-status { font-size: 11px; min-height: 1em; }
.bulk-card-status.success { color: var(--green-fg); }
.bulk-card-status.error { color: var(--red-fg); }

/* ===== Report table ===== */
.report-tbl { min-width: 300px; }

/* ===== Legacy / iOS banners ===== */
.legacy-banner {
  position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%);
  background: var(--panel); border: 1px solid var(--border-strong);
  border-radius: var(--r-lg); padding: 12px 16px;
  display: flex; align-items: center; gap: 12px; z-index: 80;
  font-size: 13px; color: var(--muted); box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}
.add-to-home {
  position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%);
  background: var(--panel); border: 1px solid var(--gold);
  border-radius: var(--r-lg); padding: 10px 16px;
  font-size: 12px; color: var(--muted); z-index: 80; text-align: center;
}

/* ===== Helpers ===== */
.muted { color: var(--muted); }
.muted-2 { color: var(--muted-2); }
.mono { font-family: var(--mono); }
.hint { font-size: 12px; color: var(--muted-2); }
.hstack { display: flex; align-items: center; gap: 8px; }

/* ===== Responsive ===== */
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; top: 0; left: 0; right: 0; height: auto;
    flex-direction: row; overflow-x: auto; padding: 8px 12px; gap: 4px; z-index: 10;
  }
  .sidebar .nav-section, .sidebar-footer, .brand-row .brand-sub { display: none; }
  .brand-row { border: none; padding: 4px 8px; margin: 0 8px 0 0; }
  .nav-item { white-space: nowrap; padding: 6px 10px; }
  .nav-item > span:not(.badge) { display: none; }
  .main { padding-top: 56px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .inv-summary-bar { grid-template-columns: repeat(2, 1fr); }
  .dash-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .form-field.col-span-2 { grid-column: auto; }
  .page { padding: 16px 16px 40px; }
  .table-wrap .tbl { display: none; }
  .card-list { display: flex; }
}
@media (max-width: 600px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .quickadd-grid { grid-template-columns: 1fr; }
}
