/* GSX — tenant app design system. Navy sidebar, emerald accent, dense tables that scan fast.
   Light and dark. Class names are shared by every page, so change tokens here, not per page. */
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap");

:root {
  --bg: #f5f7fa;
  --panel: #ffffff;
  --panel-2: #f7f9fc;
  --border: #e3e8ef;
  --border-strong: #cfd7e3;
  --text: #0f1b2d;
  --muted: #64748b;
  --accent: #059669;
  --accent-dark: #047857;
  --accent-soft: #e3f6ee;
  --brand: #0a2e5c;
  --brand-2: #0d3a73;
  --side: #0a2e5c;
  --side-text: #c9d6ea;
  --side-muted: #7f93b4;
  --side-hover: rgba(255,255,255,0.07);
  --side-active: rgba(16,185,129,0.16);
  --good: #047857;
  --good-soft: #e3f6ee;
  --warn: #b45309;
  --warn-soft: #fdf1dc;
  --bad: #b42318;
  --bad-soft: #fdecea;
  --info: #1d4ed8;
  --info-soft: #e8efff;
  --hold: #6d28d9;
  --hold-soft: #f1eafe;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(15, 27, 45, 0.05), 0 4px 16px rgba(15, 27, 45, 0.04);
  --shadow-lg: 0 12px 40px rgba(15, 27, 45, 0.18);
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1220; --panel: #111a2b; --panel-2: #0e1626; --border: #1f2b40; --border-strong: #2b3a55;
    --text: #e6edf6; --muted: #94a3b8; --accent: #34d399; --accent-dark: #6ee7b7; --accent-soft: rgba(52,211,153,0.13);
    --brand: #93b4e6; --side: #070d19; --side-text: #c3cfe2; --side-muted: #6b7e9e; --side-hover: rgba(255,255,255,0.05); --side-active: rgba(52,211,153,0.14);
    --good: #34d399; --good-soft: rgba(52,211,153,0.13); --warn: #fbbf24; --warn-soft: rgba(251,191,36,0.13);
    --bad: #f87171; --bad-soft: rgba(248,113,113,0.13); --info: #93b4ff; --info-soft: rgba(147,180,255,0.13);
    --hold: #c4b5fd; --hold-soft: rgba(196,181,253,0.14);
    --shadow: 0 1px 2px rgba(0,0,0,0.3), 0 8px 24px rgba(0,0,0,0.35); --shadow-lg: 0 16px 48px rgba(0,0,0,0.55);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b1220; --panel: #111a2b; --panel-2: #0e1626; --border: #1f2b40; --border-strong: #2b3a55;
  --text: #e6edf6; --muted: #94a3b8; --accent: #34d399; --accent-dark: #6ee7b7; --accent-soft: rgba(52,211,153,0.13);
  --brand: #93b4e6; --side: #070d19; --side-text: #c3cfe2; --side-muted: #6b7e9e; --side-hover: rgba(255,255,255,0.05); --side-active: rgba(52,211,153,0.14);
  --good: #34d399; --good-soft: rgba(52,211,153,0.13); --warn: #fbbf24; --warn-soft: rgba(251,191,36,0.13);
  --bad: #f87171; --bad-soft: rgba(248,113,113,0.13); --info: #93b4ff; --info-soft: rgba(147,180,255,0.13);
  --hold: #c4b5fd; --hold-soft: rgba(196,181,253,0.14);
  --shadow: 0 1px 2px rgba(0,0,0,0.3), 0 8px 24px rgba(0,0,0,0.35); --shadow-lg: 0 16px 48px rgba(0,0,0,0.55);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { background: var(--bg); }
body {
  margin: 0; font-family: var(--sans); color: var(--text);
  font-size: 14.5px; line-height: 1.5; -webkit-font-smoothing: antialiased;
  font-feature-settings: "cv11", "ss01";
}
a { color: var(--accent-dark); text-underline-offset: 2px; }
.hidden { display: none !important; }
.mono { font-family: var(--mono); font-size: 0.92em; }
.tnum { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }

/* ---- Shell: a navy sidebar on desktop, a scrolling top strip on phones ---- */
.topbar {
  display: flex; align-items: center; gap: 14px;
  padding: 0 14px; height: 56px;
  background: var(--side); color: var(--side-text);
  position: sticky; top: 0; z-index: 30;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: -0.01em; color: #fff; font-size: 1.05rem; }
.brand-mark {
  width: 28px; height: 28px; border-radius: 8px;
  background: linear-gradient(135deg, #10b981, #059669); color: #fff;
  display: grid; place-items: center; font-size: 0.92rem; font-weight: 800;
  box-shadow: 0 2px 8px rgba(16,185,129,0.35);
}
.nav { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a {
  padding: 7px 11px; border-radius: var(--radius-sm); color: var(--side-text);
  text-decoration: none; font-weight: 500; font-size: 0.9rem; white-space: nowrap;
  display: flex; align-items: center; gap: 10px;
}
.nav a svg { width: 17px; height: 17px; flex: none; opacity: 0.8; }
.nav a:hover { background: var(--side-hover); color: #fff; }
.nav a.active { background: var(--side-active); color: #fff; font-weight: 600; }
.nav a.active svg { opacity: 1; color: #34d399; }
.nav-group { display: none; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.whoami { font-size: 0.8rem; color: var(--side-muted); line-height: 1.3; }
.whoami strong { color: #fff; display: block; font-weight: 600; }
.topbar .btn.ghost { color: var(--side-text); border-color: rgba(255,255,255,0.14); }
.topbar .btn.ghost:hover { background: var(--side-hover); color: #fff; }

@media (min-width: 960px) {
  body:has(> .topbar) { padding-left: 236px; }
  .topbar {
    position: fixed; left: 0; top: 0; bottom: 0; width: 236px; height: auto;
    flex-direction: column; align-items: stretch; gap: 0; padding: 18px 12px 14px;
    border-right: 1px solid rgba(255,255,255,0.04);
  }
  .brand { padding: 2px 8px 6px; }
  .nav { flex-direction: column; overflow-y: auto; margin: 14px 0 0; flex: 1; }
  .nav a { padding: 8px 10px; }
  .nav-group { display: block; font-size: 0.66rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.09em; color: var(--side-muted); padding: 16px 10px 5px; }
  .topbar-right { margin: 10px 0 0; flex-direction: column; align-items: stretch; gap: 8px; padding: 12px 8px 0; border-top: 1px solid rgba(255,255,255,0.08); }
  .whoami { text-align: left; }
}
@media (max-width: 959px) { .whoami { display: none; } }

/* ---- Layout ---- */
.wrap { max-width: 1320px; margin: 0 auto; padding: 26px 26px 90px; }
@media (max-width: 640px) { .wrap { padding: 18px 16px 90px; } }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
h1 { font-size: 1.55rem; letter-spacing: -0.025em; margin: 0; font-weight: 750; }
h2 { font-size: 1.02rem; margin: 0 0 12px; letter-spacing: -0.01em; }
h3 { font-size: 0.9rem; margin: 0 0 8px; }
.sub { color: var(--muted); margin: 4px 0 0; font-size: 0.9rem; }
.eyebrow { font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }

.panel { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel-pad { padding: 20px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.panel-head h2 { margin: 0; }

/* ---- Buttons ---- */
.btn {
  appearance: none; border: 1px solid var(--border-strong); background: var(--panel);
  color: var(--text); font: inherit; font-weight: 600; font-size: 0.875rem;
  padding: 8px 14px; border-radius: var(--radius-sm); cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; white-space: nowrap;
  transition: background 0.12s, border-color 0.12s, box-shadow 0.12s, transform 0.05s;
}
.btn:hover { background: var(--panel-2); border-color: var(--muted); }
.btn:active { transform: translateY(1px); }
.btn svg { width: 16px; height: 16px; }
/* Filled buttons keep the same solid brand colours in both themes: the dark theme's accent tokens are
   light tints made for text on dark, and white on them is unreadable. */
.btn.primary { background: #059669; border-color: #059669; color: #fff; box-shadow: 0 1px 2px rgba(5,150,105,0.3); }
.btn.primary:hover { background: #047857; border-color: #047857; }
.btn.dark { background: #0a2e5c; border-color: #0a2e5c; color: #fff; }
.btn.hold { background: #6d28d9; border-color: #6d28d9; color: #fff; }
.btn.hold:hover { background: #5b21b6; border-color: #5b21b6; }
.btn.danger { color: var(--bad); }
.btn.sm { padding: 5px 10px; font-size: 0.8rem; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--panel-2); border-color: var(--border); }
.btn:disabled { opacity: 0.5; cursor: default; transform: none; }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---- Forms ---- */
label { display: block; font-size: 0.82rem; font-weight: 600; color: var(--muted); margin: 14px 0 5px; }
input, select, textarea {
  width: 100%; padding: 9px 12px; font: inherit; font-size: 0.9rem;
  color: var(--text); background: var(--panel-2);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
/* Checkboxes and radios are not text fields: the width:100% above stretches them across their
   container and pushes the label onto its own line, which is why they looked unaligned. */
input[type="checkbox"], input[type="radio"] {
  width: auto; padding: 0; margin: 0; accent-color: var(--accent); flex: 0 0 auto;
}

/* ---- Banners ---- */
.banner { border-radius: var(--radius-sm); padding: 11px 14px; font-size: 0.9rem; margin: 12px 0; }
.banner.err { background: var(--bad-soft); color: var(--bad); }
.banner.ok { background: var(--good-soft); color: var(--good); }

/* ---- Pills ---- */
.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 0.74rem; font-weight: 700; letter-spacing: 0.02em; }
.pill.in_stock { background: var(--good-soft); color: var(--good); }
.pill.reserved { background: var(--warn-soft); color: var(--warn); }
.pill.sold { background: var(--panel-2); color: var(--muted); }
.pill.held { background: var(--hold-soft); color: var(--hold); }
.pill.info { background: var(--info-soft); color: var(--info); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.muted { background: var(--panel-2); color: var(--muted); border: 1px solid var(--border); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }

/* ---- Tables ---- */
.table-scroll { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
table.data th {
  text-align: left; font-size: 0.72rem; letter-spacing: 0.05em; text-transform: uppercase;
  color: var(--muted); font-weight: 700; padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
table.data td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tr.sel td { background: var(--accent-soft); }
table.data th.chk, table.data td.chk { width: 34px; padding-right: 0; }
table.data tr:hover td { background: var(--panel-2); }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---- Login ---- */
.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: 100%; max-width: 380px; }
.login-card .brand { justify-content: center; margin-bottom: 6px; font-size: 1.15rem; }
.login-card p.sub { text-align: center; margin-bottom: 8px; }

/* ---- KPI tiles ---- */
.kpi { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
button.kpi { text-align: left; font: inherit; color: inherit; cursor: pointer; }
button.kpi:hover { border-color: var(--border-strong); }
button.kpi.on { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.kpi .v { font-size: 1.5rem; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.kpi .l { font-size: 0.78rem; color: var(--muted); margin-top: 2px; }

/* ---- Modal ---- */
.modal-back { position: fixed; inset: 0; background: rgba(12,17,22,0.5); display: grid; place-items: start center; padding: 40px 16px; z-index: 50; overflow-y: auto; }
.modal { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); width: 100%; max-width: 640px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-head h2 { margin: 0; }
.modal-body { padding: 20px; }
.form-grid { display: grid; gap: 10px 14px; grid-template-columns: 1fr 1fr; }
@media (min-width: 560px) { .form-grid { grid-template-columns: 1fr 1fr 1fr; } }
.form-grid label { margin-top: 6px; }

/* ---- Lock/blacklist chips ---- */
.lock-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.lock-chip { font-size: 0.78rem; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--border); background: var(--panel-2); }
.lock-chip b { font-weight: 700; }
.lock-chip.ok { background: var(--good-soft); color: var(--good); border-color: transparent; }
.lock-chip.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.lock-chip.unknown { color: var(--muted); }

.row-model { font-weight: 600; }
.row-sub { color: var(--muted); font-size: 0.82rem; }

/* ---- Market lookup: type-ahead + competitor filter ------------------------------- */

/* The suggestion list replaces a native <datalist>, which only matches on prefix — so typing
   "15" would never offer "apple iphone 15 128gb", which is the way people actually search. */
.suggest {
  position: absolute;
  z-index: 40;
  left: 0; right: 0;
  top: 100%;
  margin-top: 4px;
  max-height: 300px;
  overflow-y: auto;
  background: var(--card, #fff);
  border: 1px solid var(--line, #e2e6ea);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}
.suggest-item {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 8px 10px;
  cursor: pointer;
  font-size: 0.85rem;
}
.suggest-item:hover,
.suggest-item[aria-selected="true"] { background: var(--soft, #f3f5f7); }
.suggest-item .q { font-size: 0.75rem; color: var(--muted, #6b7580); white-space: nowrap; }
.suggest-empty { padding: 10px; font-size: 0.82rem; color: var(--muted, #6b7580); }

.source-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 4px 14px;
}
/* width:100% on inputs is a global rule here and it swallows checkboxes, which then render as a
   full-width smear rather than a box. */
.source-grid label { display: flex; align-items: center; gap: 7px; font-size: 0.82rem; font-weight: 400; }
.source-grid input[type="checkbox"] { width: auto; margin: 0; flex: none; }
.source-grid .frozen { font-size: 0.7rem; color: var(--muted, #6b7580); }

/* Per-competitor prices under the headline. */
.quote-table { width: 100%; border-collapse: collapse; margin-top: 12px; font-size: 0.85rem; }
.quote-table th, .quote-table td { padding: 5px 8px; border-bottom: 1px solid var(--line, #e9edf1); text-align: left; }
.quote-table th { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted, #6b7580); font-weight: 600; }
.quote-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.quote-table tr.is-top td { font-weight: 700; }

/* ======================================================================================
   Trader workspace components (stock, purchases, holds, marketplaces)
   ====================================================================================== */

.kpi-row { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin-bottom: 18px; }
.kpi .v small { font-size: 0.8rem; color: var(--muted); font-weight: 600; margin-left: 4px; }
.kpi .l { display: flex; align-items: center; gap: 6px; }
.kpi .dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }

.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar .grow { flex: 1 1 280px; }
.search { position: relative; }
.search input { padding-left: 36px; height: 40px; background: var(--panel); }
.search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; color: var(--muted); }

.seg { display: inline-flex; background: var(--panel-2); border: 1px solid var(--border); border-radius: 10px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { appearance: none; border: 0; background: transparent; font: inherit; font-size: 0.83rem; font-weight: 600; color: var(--muted); padding: 6px 11px; border-radius: 7px; cursor: pointer; display: inline-flex; gap: 6px; align-items: center; }
.seg button .n { font-size: 0.72rem; background: var(--border); color: var(--text); border-radius: 999px; padding: 0 6px; font-weight: 700; }
.seg button.on { background: var(--panel); color: var(--text); box-shadow: var(--shadow); }
.seg button.on .n { background: var(--accent-soft); color: var(--accent-dark); }

/* Device cell: thumbnail + name + sub line */
.dev { display: flex; align-items: center; gap: 11px; min-width: 220px; }
.thumb { width: 56px; height: 56px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--border); display: grid; place-items: center; overflow: hidden; flex: none; }
.thumb img { width: 100%; height: 100%; object-fit: contain; }
.thumb svg { width: 30px; height: 30px; color: var(--muted); }
/* Product pictures are shot on white: show them on their own light tile, so in dark theme the picture
   area is "light" while the page stays dark (no white box floating on navy). Drawn icons keep the theme. */
.thumb:has(img) { background: #fff; padding: 2px; }
:root[data-theme="dark"] .thumb:has(img) { background: #fff; border-color: rgba(255,255,255,.18); box-shadow: inset 0 0 0 1px rgba(0,0,0,.04); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .thumb:has(img) { background: #fff; border-color: rgba(255,255,255,.18); box-shadow: inset 0 0 0 1px rgba(0,0,0,.04); } }
.dev .t { font-weight: 600; line-height: 1.25; }
.dev .s { font-size: 0.78rem; color: var(--muted); }

.grade { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 6px; font-weight: 800; font-size: 0.78rem; background: var(--panel-2); border: 1px solid var(--border); }
.grade.A { background: #e3f6ee; color: #047857; border-color: transparent; }
.grade.B { background: #e8efff; color: #1d4ed8; border-color: transparent; }
.grade.C { background: #fdf1dc; color: #b45309; border-color: transparent; }
.grade.D, .grade.E { background: #fdecea; color: #b42318; border-color: transparent; }
.grade.ASIS { width: auto; padding: 0 6px; background: #efe9fb; color: #6d28d9; border-color: transparent; font-size: 0.7rem; letter-spacing: .02em; }
.faulty-tag { display: inline-block; padding: 1px 7px; border-radius: 999px; font-size: 0.7rem; font-weight: 700; background: #fdecea; color: #b42318; vertical-align: middle; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .grade.A, :root:not([data-theme="light"]) .grade.B, :root:not([data-theme="light"]) .grade.C, :root:not([data-theme="light"]) .grade.D, :root:not([data-theme="light"]) .grade.E { filter: saturate(0.9) brightness(0.9); } }

.batt { display: inline-flex; align-items: center; gap: 6px; font-variant-numeric: tabular-nums; font-size: 0.85rem; }
.batt i { width: 26px; height: 8px; border-radius: 3px; background: var(--border); position: relative; overflow: hidden; display: inline-block; }
.batt i b { position: absolute; inset: 0 auto 0 0; background: var(--good); border-radius: 3px; }
.batt.low i b { background: var(--warn); }
.batt.bad i b { background: var(--bad); }

.chip { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 999px; font-size: 0.74rem; font-weight: 600; background: var(--panel-2); border: 1px solid var(--border); color: var(--muted); white-space: nowrap; }
.chip.imei { background: var(--good-soft); color: var(--good); border-color: transparent; }
.chip.model { background: var(--info-soft); color: var(--info); border-color: transparent; }
.chip.manual { background: var(--panel-2); }
.chip.buyback { background: var(--hold-soft); color: var(--hold); border-color: transparent; }
.chip.need { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.chip.hold { background: var(--hold-soft); color: var(--hold); border-color: transparent; }
.chip svg { width: 12px; height: 12px; }

.margin-up { color: var(--good); font-weight: 600; }
.margin-down { color: var(--bad); font-weight: 600; }
.mkt { font-size: 0.78rem; color: var(--muted); }
.mkt b { color: var(--text); font-weight: 600; }

input.inline { width: 92px; padding: 5px 8px; text-align: right; background: transparent; border-color: transparent; font-variant-numeric: tabular-nums; }
input.inline:hover { border-color: var(--border); background: var(--panel); }
input.inline:focus { background: var(--panel); }
input.inline.saved { box-shadow: 0 0 0 3px var(--accent-soft); border-color: var(--accent); }

/* Selection action bar */
.actionbar {
  position: fixed; left: 50%; bottom: 22px; transform: translate(-50%, 140%);
  background: var(--brand); color: #fff; border-radius: 14px; box-shadow: var(--shadow-lg);
  display: flex; align-items: center; gap: 10px; padding: 9px 10px 9px 18px; z-index: 40;
  transition: transform 0.22s cubic-bezier(.2,.8,.2,1); max-width: calc(100vw - 24px); flex-wrap: wrap;
}
@media (min-width: 960px) { .actionbar { left: calc(50% + 118px); } }
.actionbar.show { transform: translate(-50%, 0); }
.actionbar .count { font-weight: 700; margin-right: 6px; }
.actionbar .btn { border-color: rgba(255,255,255,0.18); background: rgba(255,255,255,0.08); color: #fff; }
.actionbar .btn:hover { background: rgba(255,255,255,0.16); }
.actionbar .btn.primary { background: #10b981; border-color: #10b981; }
.actionbar .btn.hold { background: #7c3aed; border-color: #7c3aed; }
:root[data-theme="dark"] .actionbar { background: #1b2a44; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .actionbar { background: #1b2a44; } }

/* Side drawer */
.drawer-back { position: fixed; inset: 0; background: rgba(8, 15, 28, 0.42); z-index: 60; opacity: 0; pointer-events: none; transition: opacity 0.18s; }
.drawer-back.show { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100vw); background: var(--panel);
  box-shadow: var(--shadow-lg); z-index: 61; transform: translateX(102%); transition: transform 0.22s cubic-bezier(.2,.8,.2,1);
  display: flex; flex-direction: column;
}
.drawer.show { transform: none; }
.drawer-head { padding: 18px 20px 14px; border-bottom: 1px solid var(--border); display: flex; gap: 14px; align-items: flex-start; }
.drawer-head .thumb { width: 96px; height: 96px; border-radius: 14px; }
.drawer-body { padding: 18px 20px 40px; overflow-y: auto; flex: 1; }
.drawer-foot { padding: 12px 20px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
/* dl.dl only: the market page uses .dl on its download buttons. */
dl.dl { display: grid; grid-template-columns: 130px 1fr; gap: 7px 12px; font-size: 0.88rem; margin: 0; }
dl.dl dt { color: var(--muted); }
dl.dl dd { margin: 0; font-weight: 500; }
.section { margin-top: 22px; }
.section > h3 { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin-bottom: 10px; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 12px 18px; font-size: 0.85rem; }
.timeline li::before { content: ""; position: absolute; left: 3px; top: 7px; width: 7px; height: 7px; border-radius: 50%; background: var(--border-strong); }
.timeline li::after { content: ""; position: absolute; left: 6px; top: 16px; bottom: 0; width: 1px; background: var(--border); }
.timeline li:last-child::after { display: none; }
.timeline .when { color: var(--muted); font-size: 0.76rem; }
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.photos img, .photos label { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; border: 1px solid var(--border); }
.photos label { display: grid; place-items: center; margin: 0; cursor: pointer; color: var(--muted); border-style: dashed; font-size: 0.78rem; text-align: center; }

.mgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.mcard { border: 1px solid var(--border); border-radius: 10px; padding: 11px 12px; background: var(--panel-2); }
.mcard .k { font-size: 0.72rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 700; }
.mcard .v { font-size: 1.15rem; font-weight: 750; font-variant-numeric: tabular-nums; margin-top: 2px; }
.mcard .s { font-size: 0.76rem; color: var(--muted); }

/* Upload dropzone + steps */
.drop { border: 2px dashed var(--border-strong); border-radius: var(--radius); padding: 34px 20px; text-align: center; background: var(--panel); cursor: pointer; transition: border-color 0.12s, background 0.12s; }
.drop:hover, .drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop svg { width: 34px; height: 34px; color: var(--accent); }
.drop .big { font-weight: 700; font-size: 1.02rem; margin-top: 8px; }
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-bottom: 18px; }
.step { display: flex; gap: 12px; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel); }
.step .n { width: 28px; height: 28px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-dark); display: grid; place-items: center; font-weight: 800; flex: none; font-size: 0.85rem; }
.step b { display: block; font-size: 0.9rem; }
.step span { font-size: 0.8rem; color: var(--muted); }
.progress { height: 6px; border-radius: 999px; background: var(--border); overflow: hidden; min-width: 90px; }
.progress b { display: block; height: 100%; background: var(--accent); border-radius: 999px; }

/* Channel tiles */
.channels { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.ch { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; background: var(--panel); display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.ch:hover { border-color: var(--border-strong); }
.ch.on { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.ch .logo { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; font-weight: 800; font-size: 0.8rem; color: #fff; flex: none; }
.ch .nm { font-weight: 700; font-size: 0.9rem; }
.ch .st { font-size: 0.74rem; color: var(--muted); }
.ch input[type="checkbox"] { margin-left: auto; margin-top: 4px; }

.toast { position: fixed; top: 18px; right: 18px; z-index: 90; background: #0a2e5c; color: #fff; padding: 11px 16px; border-radius: 10px; box-shadow: var(--shadow-lg); font-size: 0.88rem; font-weight: 500; max-width: 420px; opacity: 0; transform: translateY(-8px); transition: all 0.2s; pointer-events: none; }
.toast.show { opacity: 1; transform: none; }
.toast.err { background: var(--bad); }

.empty { text-align: center; padding: 46px 20px; color: var(--muted); }
.empty svg { width: 40px; height: 40px; color: var(--border-strong); }
.empty b { display: block; color: var(--text); font-size: 1rem; margin: 8px 0 4px; }

.countdown { font-variant-numeric: tabular-nums; }
.countdown.soon { color: var(--warn); font-weight: 600; }
.split { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 1100px) { .split.two { grid-template-columns: 1.4fr 1fr; } }
textarea.paste { font-family: var(--mono); font-size: 0.8rem; min-height: 150px; }
.note { font-size: 0.8rem; color: var(--muted); }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }

#pTable .seg { flex-wrap: nowrap; }
#pTable .seg button { padding: 5px 8px; font-size: .78rem; }

/* Theme switch (theme.js) — sits with the account block in the sidebar. */
.theme-toggle { justify-content: flex-start; font-weight: 500; font-size: .84rem; }
.theme-toggle svg { width: 16px; height: 16px; }
@media (max-width: 959px) { .theme-toggle span { display: none; } }

/* Colour swatches + colour filter chips */
.swatch { display: inline-block; border-radius: 50%; background: var(--sw); border: 1px solid rgba(0,0,0,.18); box-shadow: inset 0 0 0 1px rgba(255,255,255,.25); vertical-align: -1px; margin-right: 5px; flex: none; }
.swatches { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.swatches .lbl { font-size: 0.78rem; font-weight: 600; color: var(--muted); margin-right: 2px; }
.sw-chip { appearance: none; font: inherit; font-size: 0.78rem; font-weight: 600; display: inline-flex; align-items: center; gap: 2px; padding: 4px 9px 4px 7px; border-radius: 999px; border: 1px solid var(--border); background: var(--panel); color: var(--text); cursor: pointer; }
.sw-chip .swatch { width: 14px; height: 14px; }
.sw-chip .n { color: var(--muted); font-weight: 500; margin-left: 4px; }
.sw-chip:hover { border-color: var(--accent); }
.sw-chip.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.shot-url { display: flex; gap: 8px; margin: 10px 0; }
.shot-url input { font-family: ui-monospace, Menlo, monospace; font-size: 0.8rem; }
.shot-prev { max-height: 300px; overflow: auto; border: 1px solid var(--border); border-radius: 10px; margin-top: 10px; }
.shot-prev table { width: 100%; }
.recips { max-height: 220px; overflow: auto; border: 1px solid var(--border); border-radius: 10px; padding: 6px 10px; margin: 8px 0; }
.recips label { display: flex; gap: 8px; align-items: center; margin: 4px 0; font-weight: 500; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .swatch { border-color: rgba(255,255,255,.35); } }
:root[data-theme="dark"] .swatch { border-color: rgba(255,255,255,.35); }

.pc-notes { font-size: 0.8rem; color: var(--text); max-width: 200px; line-height: 1.35; }

/* Phonecheck report QR codes (invoice, pro forma) */
.qr-sec { margin-top: 26px; break-inside: avoid; }
.qr-sec h4 { font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin: 0 0 2px; }
.qr-sec p { font-size: 0.8rem; color: var(--muted); margin: 0 0 10px; }
.qr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; }
.qr-tile { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2px; padding: 8px; border: 1px solid var(--border); border-radius: 8px; text-decoration: none; color: inherit; break-inside: avoid; }
.qr-img { display: block; width: 96px; height: 96px; background: #fff; padding: 3px; border-radius: 4px; }
.qr-img svg { width: 100%; height: 100%; display: block; }
.qr-lbl { font-size: 0.72rem; font-weight: 600; line-height: 1.25; margin-top: 4px; }
.qr-sub { font-family: ui-monospace, Menlo, monospace; font-size: 0.66rem; color: var(--muted); }
@media print { .qr-tile { border-color: #ccc; } .qr-sub { color: #555; } }
