/* Q-Commerce Consultant — brand themes.
   Brand: primary #5A189A (buttons, header), tint #F3EBFA (backgrounds, selected rows),
   dark-mode primary #B794F4, text #1F1F1F, borders #E5E5E5.
   Royal (default): purple header/sidebar, white canvas. Daylight: light lavender sidebar. Dusk: dark mode.
   Data colours (blue sequential / blue-red diverging) stay on the validated chart palette and
   are independent of the brand purple, so the brand never competes with the data. */
:root, :root[data-theme="midnight"] {
  color-scheme: light;
  --bg: #faf8fc;
  --surface: #ffffff;
  --surface-2: #fbf9fd;
  --glass: rgba(255, 255, 255, 0.92);
  --glass-strong: rgba(255, 255, 255, 0.97);
  --acc-50: #F3EBFA;
  --acc-100: #E8D9F6;
  --acc-200: #D3B6EE;
  --acc-300: #B48AE0;
  --acc-500: #7B2CBF;
  --acc-600: #6A1FAD;
  --acc-700: #5A189A;
  --acc-900: #3C096C;
  --acc-solid: #5A189A;
  --on-acc: #ffffff;
  --ink: #1F1F1F;
  --ink-2: #3a3a3a;
  --ink-3: #5f5f66;
  --muted: #94949c;
  --line: #E5E5E5;
  --line-2: #F0EEF2;
  --good: #1d7a43;
  --good-bg: #eaf7ef;
  --good-line: #c6ebd3;
  --warn: #a4560c;
  --warn-bg: #fdf5e8;
  --bad: #a3261f;
  --bad-bg: #fdf1f0;
  --bad-line: #f5d0cc;
  --track: #dcd6e2;
  --scroll: #dcd6e2;
  --log-bg: #24113a;
  --log-ink: #ece3f7;
  --tip-bg: #24113a;
  --tip-ink: #f7f2fc;
  --tip-ink-2: #c9b8dc;
  --map-bg: #efedf2;
  --marker-ring: #ffffff;
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --data-1: #2a78d6;
  --deemph: #c3c2b7;
  --radius: 14px;
  --ring: 0 0 0 3px rgba(90, 24, 154, 0.18);
  --shadow: 0 1px 2px rgba(31, 31, 31, 0.04), 0 8px 24px rgba(60, 9, 108, 0.05);
  --shadow-lg: 0 2px 6px rgba(31, 31, 31, 0.06), 0 18px 48px rgba(60, 9, 108, 0.12);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --nav-w: 244px;
  /* sidebar = header colour */
  --side-bg: linear-gradient(185deg, #3C096C 0%, #5A189A 70%, #63209F 100%);
  --side-border: rgba(255, 255, 255, 0.10);
  --side-ink: #ffffff;
  --side-ink-2: #e6d8f5;
  --side-muted: #c3a8e3;
  --side-hover: rgba(255, 255, 255, 0.10);
  --side-active-bg: rgba(255, 255, 255, 0.18);
  --side-active-ink: #ffffff;
  --side-active-line: rgba(255, 255, 255, 0.28);
  --side-card: rgba(255, 255, 255, 0.08);
  --brand-mark: linear-gradient(135deg, #B794F4, #F3EBFA);
  --brand-mark-ink: #3C096C;
}

:root[data-theme="daylight"] {
  --side-bg: linear-gradient(180deg, #F3EBFA 0%, #f7f1fc 60%, #faf8fc 100%);
  --side-border: #E5E5E5;
  --side-ink: #1F1F1F;
  --side-ink-2: #3a3a3a;
  --side-muted: #8a7f96;
  --side-hover: rgba(255, 255, 255, 0.75);
  --side-active-bg: #ffffff;
  --side-active-ink: #5A189A;
  --side-active-line: #E8D9F6;
  --side-card: rgba(255, 255, 255, 0.7);
  --brand-mark: linear-gradient(135deg, #7B2CBF, #5A189A);
  --brand-mark-ink: #ffffff;
}

:root[data-theme="dusk"] {
  color-scheme: dark;
  --bg: #120d18;
  --surface: #1b1524;
  --surface-2: #211a2c;
  --glass: rgba(27, 21, 36, 0.92);
  --glass-strong: rgba(33, 26, 44, 0.97);
  --acc-50: #261a35;
  --acc-100: #322246;
  --acc-200: #4b3369;
  --acc-300: #7a5aa8;
  --acc-500: #a582e6;
  --acc-600: #B794F4;
  --acc-700: #c8adf7;
  --acc-900: #ece0fd;
  --acc-solid: #B794F4;
  --on-acc: #1b0d2e;
  --ink: #f2eef6;
  --ink-2: #d4cce0;
  --ink-3: #a79cb8;
  --muted: #7a6f8c;
  --line: #2f2640;
  --line-2: #261e34;
  --good: #5bd58c;
  --good-bg: #13301f;
  --good-line: #1f4d32;
  --warn: #f1b45c;
  --warn-bg: #3a2b12;
  --bad: #f19a92;
  --bad-bg: #3a1916;
  --bad-line: #5c2822;
  --track: #3d3250;
  --scroll: #3d3250;
  --log-bg: #0c0812;
  --log-ink: #ddd2ec;
  --tip-bg: #2c2140;
  --tip-ink: #f6f1fc;
  --tip-ink-2: #b9a9d0;
  --map-bg: #1d1a24;
  --marker-ring: #f2eef6;
  --data-1: #3987e5;
  --deemph: #4f4762;
  --ring: 0 0 0 3px rgba(183, 148, 244, 0.3);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 2px 6px rgba(0, 0, 0, 0.35), 0 18px 48px rgba(0, 0, 0, 0.45);
  --side-bg: linear-gradient(185deg, #0d0814 0%, #150d22 100%);
  --side-border: rgba(255, 255, 255, 0.06);
  --side-ink: #f2eef6;
  --side-ink-2: #c7b9da;
  --side-muted: #85799a;
  --side-hover: rgba(183, 148, 244, 0.10);
  --side-active-bg: rgba(183, 148, 244, 0.18);
  --side-active-ink: #ffffff;
  --side-active-line: rgba(183, 148, 244, 0.32);
  --side-card: rgba(255, 255, 255, 0.04);
  --brand-mark: linear-gradient(135deg, #B794F4, #7B2CBF);
  --brand-mark-ink: #ffffff;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  font-size: 14px;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--acc-700); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select { font: inherit; color: inherit; }

/* ---------- layout ---------- */
.app { display: grid; grid-template-columns: var(--nav-w) 1fr; min-height: 100vh; transition: grid-template-columns .22s ease; }
.app.nav-collapsed { --nav-w: 72px; }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  background: var(--side-bg); color: var(--side-ink);
  border-right: 1px solid var(--side-border);
  padding: 22px 16px; display: flex; flex-direction: column; gap: 22px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 0 6px; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; flex: none;
  background: var(--brand-mark); color: var(--brand-mark-ink);
  box-shadow: 0 4px 14px rgba(60, 9, 108, 0.35);
}
.brand-name { font-weight: 700; font-size: 15px; letter-spacing: -0.01em; color: var(--side-ink); }
.brand-sub { font-size: 12px; color: var(--side-muted); }
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-title { font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--side-muted); padding: 0 10px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px;
  color: var(--side-ink-2); font-weight: 500; cursor: pointer; border: 1px solid transparent;
  text-decoration: none !important; transition: background .15s, color .15s;
}
.nav-item:hover { background: var(--side-hover); color: var(--side-ink); }
.nav-item.active { background: var(--side-active-bg); color: var(--side-active-ink); border-color: var(--side-active-line); }
.nav-item svg { flex: none; }
.sidebar-foot { margin-top: auto; font-size: 12px; color: var(--side-muted); padding: 12px 10px;
  background: var(--side-card); border-radius: 12px; border: 1px solid var(--side-border); line-height: 1.6; }
.sidebar-foot b { color: var(--side-ink); }
.theme-pick { display: flex; align-items: center; gap: 8px; padding: 0 4px; }
.theme-pick .tp-label { font-size: 11px; color: var(--side-muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; flex: 1; }
.theme-dot { width: 22px; height: 22px; border-radius: 50%; cursor: pointer; border: 2px solid var(--side-border); padding: 0;
  position: relative; overflow: hidden; transition: transform .12s; }
.theme-dot:hover { transform: scale(1.1); }
.theme-dot.on { border-color: #B794F4; box-shadow: 0 0 0 2px rgba(183, 148, 244, 0.45); }
.theme-dot i { position: absolute; inset: 0; }
.app.nav-collapsed .theme-pick { flex-direction: column; }
.app.nav-collapsed .theme-pick .tp-label { display: none; }

.main { min-width: 0; display: flex; flex-direction: column; }
.content { padding: 24px 32px 48px; max-width: 1480px; width: 100%; }

/* ---------- scope bar ---------- */
.scopebar {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  padding: 12px 32px; display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 12px;
}
.scopebar .field { min-width: 0; }
.scopebar .spacer { flex: 1; }
.scope-summary { font-size: 12px; color: var(--ink-3); padding-bottom: 8px; white-space: nowrap; }
.scope-summary b { color: var(--acc-700); }

/* ---------- page header ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px;
  margin: 6px 0 20px; flex-wrap: wrap; }
.page-head h1 { font-size: 26px; letter-spacing: -0.02em; margin: 0 0 4px; font-weight: 700; }
.page-head p { margin: 0; color: var(--ink-3); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; padding: 4px 10px;
  border-radius: 999px; background: var(--acc-50); color: var(--acc-700); border: 1px solid var(--acc-100); }

/* ---------- cards & grids ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px 20px; min-width: 0; }
.card + .card, .grid + .card, .card + .grid, .grid + .grid { margin-top: 16px; }
.grid > .card { margin-top: 0; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-title { font-size: 15px; font-weight: 650; margin: 0; letter-spacing: -0.01em; }
.card-sub { font-size: 12.5px; color: var(--ink-3); margin: 3px 0 0; line-height: 1.5; }
.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.split { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); }
@media (max-width: 1200px) {
  .grid.cols-6 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid.split, .grid.cols-2 { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; padding: 12px 16px; }
  .sidebar-foot { display: none; }
  .content, .scopebar { padding-left: 16px; padding-right: 16px; }
  .grid.cols-3, .grid.cols-4, .grid.cols-6 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---------- KPI ---------- */
.kpi { padding: 14px 16px; }
.kpi-label { font-size: 12px; color: var(--ink-3); font-weight: 500; display: flex; gap: 4px; align-items: center; }
.kpi-value { font-size: 26px; font-weight: 650; letter-spacing: -0.02em; margin-top: 6px; color: var(--ink); }
.kpi-hint { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ---------- form controls ---------- */
.field { display: flex; flex-direction: column; gap: 5px; }
.field > label { font-size: 11.5px; font-weight: 600; color: var(--ink-3); letter-spacing: 0.01em; }
.input, .select-btn, select.input {
  height: 36px; border: 1px solid var(--line); background: var(--surface); border-radius: 10px;
  padding: 0 12px; outline: none; transition: border-color .15s, box-shadow .15s; min-width: 0;
}
.input:focus, .select-btn:focus, .select-btn.open {
  border-color: var(--acc-300); box-shadow: var(--ring);
}
.input.sm { width: 104px; }
.select-btn { display: flex; align-items: center; gap: 8px; cursor: pointer; text-align: left; width: 100%; }
.select-btn .val { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.select-btn .placeholder { color: var(--muted); }
.select-btn .count { background: var(--acc-100); color: var(--acc-700); border-radius: 999px;
  font-size: 11px; font-weight: 600; padding: 1px 7px; }
.dropdown { position: relative; }
.dropdown-panel {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 50; min-width: 100%; width: max-content; max-width: 340px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow-lg); padding: 6px;
}
.dropdown-panel .search { width: 100%; margin-bottom: 4px; height: 32px; }
.dropdown-list { max-height: 280px; overflow-y: auto; }
.option { display: flex; align-items: center; gap: 8px; padding: 7px 9px; border-radius: 8px; cursor: pointer;
  font-size: 13px; }
.option:hover { background: var(--acc-50); }
.option.selected { color: var(--acc-700); font-weight: 600; }
.option .meta { margin-left: auto; color: var(--muted); font-size: 11.5px; font-weight: 400; padding-left: 12px; }
.checkbox { width: 16px; height: 16px; border-radius: 5px; border: 1.5px solid var(--line); flex: none;
  display: grid; place-items: center; background: var(--surface); }
.option.selected .checkbox { background: var(--acc-solid); border-color: var(--acc-solid); color: var(--on-acc); }
.dropdown-foot { display: flex; justify-content: space-between; padding: 6px 8px 2px; border-top: 1px solid var(--line-2); margin-top: 4px; }

.segmented { display: inline-flex; background: var(--line-2); border-radius: 10px; padding: 3px; gap: 2px; height: 36px; }
.segmented button { border: 0; background: transparent; padding: 0 12px; border-radius: 8px; cursor: pointer;
  color: var(--ink-3); font-weight: 500; font-size: 13px; white-space: nowrap; }
.segmented button.on { background: var(--surface); color: var(--acc-700); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); }

.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pill { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 6px 13px;
  cursor: pointer; font-size: 13px; color: var(--ink-2); }
.pill:hover { border-color: var(--acc-200); }
.pill.on { background: var(--acc-solid); border-color: var(--acc-solid); color: var(--on-acc); }

.btn { height: 36px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface);
  cursor: pointer; font-weight: 550; display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.btn:hover { border-color: var(--acc-200); background: var(--acc-50); }
.btn.primary { background: var(--acc-solid); border-color: var(--acc-solid); color: var(--on-acc); }
.btn.primary:hover { filter: brightness(0.92); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--acc-700); }
.btn:disabled { opacity: .5; cursor: default; }
.linkbtn { border: 0; background: none; color: var(--acc-700); cursor: pointer; font-size: 12.5px; padding: 0; }

.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; height: 36px; font-size: 13px; color: var(--ink-2); user-select: none; }
.switch .track { width: 34px; height: 20px; border-radius: 999px; background: var(--track); position: relative; transition: background .15s; }
.switch .track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%;
  background: white; box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: left .15s; }
.switch.on .track { background: var(--acc-solid); }
.switch.on .track::after { left: 16px; }

input[type=range] { accent-color: var(--acc-600); width: 100%; }

/* ---------- tables ---------- */
.table-wrap { overflow: auto; border: 1px solid var(--line-2); border-radius: 10px; }
table.data { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
table.data th { position: sticky; top: 0; z-index: 1; background: var(--surface-2); text-align: left; font-weight: 600;
  color: var(--ink-3); font-size: 12px; padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap;
  cursor: pointer; user-select: none; }
table.data th.num, table.data td.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data th .arrow { color: var(--acc-600); margin-left: 3px; }
table.data td { padding: 9px 12px; border-bottom: 1px solid var(--line-2); vertical-align: middle; white-space: nowrap; }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tbody tr.clickable { cursor: pointer; }
table.data tbody tr:hover td { background: var(--acc-50); }
table.data tbody tr.selected td { background: var(--acc-100); }
td .thumb { width: 36px; height: 36px; object-fit: contain; border-radius: 8px; background: var(--surface-2); display: block; }
td.wrap { white-space: normal; min-width: 260px; color: var(--ink-3); font-size: 12.5px; line-height: 1.45; }
td.name { min-width: 220px; font-weight: 500; white-space: normal; }

.scorebar { display: flex; align-items: center; gap: 8px; min-width: 120px; }
.scorebar .bar { flex: 1; height: 6px; border-radius: 99px; background: var(--line-2); overflow: hidden; }
.scorebar .fill { height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--acc-300), var(--acc-600)); }
.scorebar .v { width: 26px; text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; color: var(--ink-2); }
.minibar { display: inline-block; width: 40px; height: 4px; border-radius: 99px; background: var(--line-2); margin-left: 6px; vertical-align: middle; overflow: hidden; }
.minibar > i { display: block; height: 100%; background: var(--acc-300); }

.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 600; padding: 2px 8px;
  border-radius: 999px; background: var(--line-2); color: var(--ink-3); white-space: nowrap; }
.badge.good { background: var(--good-bg); color: var(--good); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.sky { background: var(--acc-100); color: var(--acc-700); }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.tab { border: 0; background: none; padding: 10px 14px; cursor: pointer; color: var(--ink-3); font-weight: 550;
  border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab.on { color: var(--acc-700); border-bottom-color: var(--acc-600); }

/* ---------- callouts ---------- */
.callout { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: 12px;
  background: var(--acc-50); border: 1px solid var(--acc-100); color: var(--ink-2); line-height: 1.55; }
.callout.good { background: var(--good-bg); border-color: var(--good-line); }
.callout svg { flex: none; margin-top: 2px; color: var(--acc-600); }
.callout.good svg { color: var(--good); }
.dots { display: inline-flex; gap: 3px; vertical-align: middle; }
.dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--line); display: inline-block; }
.dots i.on { background: var(--acc-500); }

/* ---------- recommendation cards ---------- */
.reco { position: relative; overflow: hidden; }
.reco::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 4px;
  background: linear-gradient(90deg, var(--acc-300), var(--acc-600)); }
.reco-role { font-size: 11px; letter-spacing: 0.07em; text-transform: uppercase; color: var(--acc-700); font-weight: 700; }
.reco-pack { font-size: 30px; font-weight: 700; letter-spacing: -0.02em; margin: 6px 0 12px; }
.price-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.price-cell { background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 10px; padding: 8px 10px; }
.price-cell span { display: block; font-size: 11px; color: var(--ink-3); }
.price-cell b { font-size: 18px; font-weight: 650; }
.price-cell.mid { background: var(--acc-50); border-color: var(--acc-100); }
.price-cell.mid b { color: var(--acc-700); }
.reco-meta { margin-top: 12px; font-size: 13px; color: var(--ink-2); }
.reco-reason { margin-top: 6px; font-size: 12.5px; color: var(--ink-3); line-height: 1.5; }

/* ---------- top picks ---------- */
.pick { display: grid; grid-template-columns: 30px 1fr; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line-2); cursor: pointer; }
.pick:last-child { border-bottom: 0; }
.pick:hover .pick-title { color: var(--acc-700); }
.rank { width: 26px; height: 26px; border-radius: 8px; background: var(--acc-100); color: var(--acc-700);
  display: grid; place-items: center; font-weight: 700; font-size: 12.5px; }
.pick-title { font-weight: 600; display: flex; justify-content: space-between; gap: 8px; }
.pick-why { font-size: 12px; color: var(--ink-3); margin-top: 3px; line-height: 1.45; }

/* ---------- misc ---------- */
.muted { color: var(--ink-3); }
.small { font-size: 12.5px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack > * + * { margin-top: 10px; }
.empty { text-align: center; padding: 48px 20px; color: var(--ink-3); }
.empty h3 { color: var(--ink-2); margin: 10px 0 6px; font-size: 16px; }
.loading-veil { transition: opacity .2s; }
.loading-veil.busy { opacity: .55; pointer-events: none; }
.spinner { width: 18px; height: 18px; border: 2px solid var(--acc-100); border-top-color: var(--acc-600);
  border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--ink-3); flex-wrap: wrap; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
pre.log { background: var(--log-bg); color: var(--log-ink); border-radius: 10px; padding: 12px 14px; font-size: 12px;
  overflow-x: auto; margin: 8px 0 0; line-height: 1.5; }
.map { height: 420px; border-radius: 12px; overflow: hidden; border: 1px solid var(--line-2); }
.error { background: var(--bad-bg); border: 1px solid var(--bad-line); color: var(--bad); padding: 12px 14px; border-radius: 10px; }
code.cmd { background: var(--acc-50); border: 1px solid var(--acc-100); padding: 1px 6px; border-radius: 6px; font-size: 12.5px; }

/* ---------- collapsible sidebar ---------- */
.sidebar { transition: padding .22s ease; }
.nav-toggle { display: flex; align-items: center; gap: 10px; border: 1px solid var(--side-border); background: var(--side-card);
  border-radius: 10px; padding: 8px 10px; cursor: pointer; color: var(--side-ink-2); font-size: 13px; }
.nav-toggle:hover { color: var(--side-ink); background: var(--side-hover); }
.app.nav-collapsed .sidebar { padding: 22px 12px; align-items: center; }
.app.nav-collapsed .brand-text, .app.nav-collapsed .nav-title, .app.nav-collapsed .nav-label,
.app.nav-collapsed .sidebar-foot { display: none; }
.app.nav-collapsed .nav-item { justify-content: center; padding: 10px; }
.app.nav-collapsed .nav-toggle { justify-content: center; margin-top: auto; }
.content.full { padding: 0; max-width: none; height: 100vh; }

/* ---------- market map ---------- */
.mapshell { position: relative; height: 100vh; overflow: hidden; background: var(--map-bg); }
.mapcanvas { position: absolute; inset: 0; z-index: 0; }
.mstack { position: absolute; right: 14px; bottom: 112px; z-index: 30; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; transition: right .2s ease; }
.tbtn.fullbtn { background: var(--acc-solid); color: var(--on-acc); border-color: var(--acc-solid); }
.tbtn.fullbtn:hover { background: var(--acc-solid); color: var(--on-acc); filter: brightness(0.93); }
.mapshell.right-open .mstack { right: 404px; }
.osm-soft { filter: saturate(0.6) brightness(1.03); }

.mtoolbar { position: absolute; top: 14px; left: 14px; right: 14px; z-index: 30; display: flex; align-items: center; gap: 8px;
  pointer-events: none; }
.mtoolbar > * { pointer-events: auto; }
.mtoolbar .spacer { flex: 1; pointer-events: none; }
.mapshell.left-open .mtoolbar { left: 350px; }
.mapshell.right-open .mtoolbar { right: 404px; }
.tbtn { height: 40px; padding: 0 13px; border-radius: 12px; border: 1px solid var(--line); background: var(--glass);
  backdrop-filter: blur(10px); box-shadow: var(--shadow); cursor: pointer; display: inline-flex; align-items: center; gap: 7px;
  font-weight: 550; color: var(--ink-2); white-space: nowrap; transition: background .15s, border-color .15s; }
.tbtn:hover { border-color: var(--acc-200); color: var(--acc-700); background: var(--glass-strong); }
.tbtn.icon { width: 40px; padding: 0; justify-content: center; }
.place-search { position: relative; flex: 1 1 380px; max-width: 420px; min-width: 200px; height: 40px; display: flex; align-items: center; gap: 8px;
  padding: 0 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--glass); backdrop-filter: blur(10px);
  box-shadow: var(--shadow); color: var(--ink-3); }
.place-search:focus-within { border-color: var(--acc-300); box-shadow: var(--ring), var(--shadow); }
.place-search input { border: 0; outline: 0; background: transparent; flex: 1; min-width: 0; color: var(--ink); }
.place-results { width: 100%; max-width: none; }
.dd-head { font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; padding: 8px 9px 3px; }
.radius-box { height: 40px; display: flex; align-items: center; gap: 10px; padding: 0 14px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--glass); backdrop-filter: blur(10px); box-shadow: var(--shadow); }
.radius-box input { width: 96px; accent-color: var(--acc-600); }
.radius-box b { font-variant-numeric: tabular-nums; min-width: 46px; font-size: 13px; }

.mpanel { position: absolute; top: 14px; bottom: 14px; z-index: 40; display: flex; flex-direction: column;
  background: var(--glass); backdrop-filter: blur(14px); border: 1px solid var(--line); border-radius: 18px;
  box-shadow: var(--shadow-lg); animation: panel-in .2s ease; min-height: 0; }
.mpanel.left { left: 14px; width: 324px; }
.mpanel.right { right: 14px; width: 378px; }
@keyframes panel-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.mpanel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px 12px;
  border-bottom: 1px solid var(--line-2); }
.mpanel-body { overflow-y: auto; padding: 12px 16px 18px; flex: 1; min-height: 0; transition: opacity .2s; }
.mpanel-body.busy { opacity: .6; }
.mpanel-body::-webkit-scrollbar { width: 8px; }
.mpanel-body::-webkit-scrollbar-thumb { background: var(--scroll); border-radius: 99px; }
.iconbtn { width: 30px; height: 30px; border-radius: 9px; border: 0; background: transparent; cursor: pointer; color: var(--ink-3);
  display: grid; place-items: center; flex: none; }
.iconbtn:hover { background: var(--acc-50); color: var(--acc-700); }
.grow { flex: 1; min-width: 0; }

.fsec { padding: 12px 0 14px; border-bottom: 1px solid var(--line-2); display: flex; flex-direction: column; gap: 11px; }
.fsec:last-child { border-bottom: 0; }
.fsec-title { font-size: 11px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--acc-700); }
.chips-row { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-btn { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 5px 11px; cursor: pointer;
  font-size: 12.5px; color: var(--ink-2); transition: all .12s; }
.chip-btn:hover { border-color: var(--acc-200); }
.chip-btn.on { background: var(--acc-solid); border-color: var(--acc-solid); color: var(--on-acc); }
.hint { font-size: 12px; color: var(--ink-3); line-height: 1.5; margin: 0; }
.metric-list { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.metric-opt { display: flex; align-items: center; gap: 7px; padding: 7px 9px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface); cursor: pointer; font-size: 12.5px; color: var(--ink-2); }
.metric-opt input { display: none; }
.metric-opt::before { content: ""; width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--line); flex: none; }
.metric-opt.on { border-color: var(--acc-300); background: var(--acc-50); color: var(--acc-900); font-weight: 600; }
.metric-opt.on::before { border-color: var(--acc-solid); background: var(--acc-solid); box-shadow: inset 0 0 0 2px var(--surface); }
.mpanel .segmented { width: 100%; }
.mpanel .segmented button { flex: 1; }

.product-chip, .prow, .product-opt { display: flex; align-items: center; gap: 10px; }
.product-chip { border: 1px solid var(--acc-200); background: var(--acc-50); border-radius: 12px; padding: 8px 8px 8px 10px; }
.product-chip img, .prow img, .product-opt img, .img-ph { width: 38px; height: 38px; object-fit: contain; border-radius: 9px;
  background: #ffffff; border: 1px solid var(--line-2); flex: none; }
.pc-name { font-weight: 550; font-size: 13px; line-height: 1.35; overflow: hidden; text-overflow: ellipsis;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.prow { padding: 9px 0; border-bottom: 1px solid var(--line-2); }
.prow.clickable { cursor: pointer; border-radius: 10px; }
.prow.clickable:hover { background: var(--acc-50); }
.prow .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }

.ip-title { font-weight: 650; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ip-tabs { display: flex; gap: 4px; padding: 8px 12px 0; border-bottom: 1px solid var(--line-2); }
.ip-tabs button { border: 0; background: none; padding: 8px 10px; cursor: pointer; color: var(--ink-3); font-weight: 550;
  border-bottom: 2px solid transparent; margin-bottom: -1px; font-size: 13px; }
.ip-tabs button.on { color: var(--acc-700); border-bottom-color: var(--acc-600); }
.kpi-grid, .kv-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.kpi-grid > div, .kv-grid > div { background: var(--surface); border: 1px solid var(--line-2); border-radius: 12px; padding: 9px 11px;
  display: flex; flex-direction: column; gap: 2px; }
.kpi-grid > div.wide { grid-column: 1 / -1; }
.kpi-grid span, .kv-grid span:first-child { font-size: 11.5px; color: var(--ink-3); }
.kpi-grid b, .kv-grid b { font-size: 17px; font-weight: 650; font-variant-numeric: tabular-nums; }
.kpi-grid em { font-style: normal; font-size: 11px; color: var(--muted); }
.kv-grid .badge { align-self: flex-start; }
.sub-title { font-size: 12px; font-weight: 700; color: var(--ink-2); margin: 16px 0 6px; }
.crow { display: flex; align-items: center; gap: 10px; padding: 8px 6px; border-radius: 10px; cursor: pointer; }
.crow:hover { background: var(--acc-50); }
.meter { display: inline-block; width: 64px; height: 6px; border-radius: 99px; background: var(--line-2); overflow: hidden; flex: none; vertical-align: middle; }
.meter > i { display: block; height: 100%; border-radius: 99px; background: var(--data-1); }
.ctable { display: flex; flex-direction: column; }
.ct-head, .ct-row { display: grid; grid-template-columns: minmax(0, 1.25fr) 70px minmax(0, 1.5fr) 62px; gap: 8px; align-items: center; }
.ct-head { font-size: 11px; color: var(--muted); font-weight: 600; padding: 0 6px 6px; border-bottom: 1px solid var(--line-2); }
.ct-row { padding: 8px 6px; border-bottom: 1px solid var(--line-2); cursor: pointer; border-radius: 8px; }
.ct-row:hover { background: var(--acc-50); }
.ct-row.on { background: var(--acc-100); }
.ct-row .pc-name { font-size: 12.5px; }
.range-cell { font-size: 12px; font-variant-numeric: tabular-nums; line-height: 1.35; }
.range-cell .rc-full { display: block; font-size: 11px; }
.store-head { margin: 10px 0 12px; }
.sh-title { font-size: 16px; font-weight: 650; }

.mlegend { position: absolute; left: 14px; bottom: 14px; z-index: 30; background: var(--glass); backdrop-filter: blur(12px);
  border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-lg); padding: 10px 12px; max-width: 520px;
  transition: left .2s ease; }
.mapshell.left-open .mlegend { left: 350px; }
.lg-title { font-size: 12px; font-weight: 650; margin-bottom: 7px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lg-scale { display: flex; gap: 2px; }
.lg-step { display: flex; flex-direction: column; gap: 4px; min-width: 70px; }
.lg-step i { height: 8px; border-radius: 4px; display: block; }
.lg-step span { font-size: 10.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; white-space: nowrap; }
.lg-foot { display: flex; gap: 14px; margin-top: 7px; font-size: 11px; color: var(--ink-3); }
.lg-foot:empty { display: none; }
.lg-foot .dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 5px; vertical-align: -1px; }

.map-hint, .map-loading, .map-empty { position: absolute; left: 50%; transform: translateX(-50%); z-index: 30; background: var(--glass);
  backdrop-filter: blur(10px); border: 1px solid var(--line); border-radius: 999px; padding: 7px 14px; font-size: 12.5px;
  color: var(--ink-2); box-shadow: var(--shadow); display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.map-hint { top: 66px; color: var(--ink-3); }
.map-loading { bottom: 18px; }
.map-empty { top: 45%; border-radius: 14px; padding: 12px 18px; }

.map-tip .tt-title { font-weight: 650; font-size: 13px; }
.map-tip .tt-sub { color: var(--tip-ink-2); font-size: 11.5px; margin-bottom: 6px; }
.map-tip .tt-row { display: flex; justify-content: space-between; gap: 14px; font-size: 12px; padding: 1px 0; }
.map-tip .tt-row span { color: var(--tip-ink-2); }
.center-pin span { display: block; width: 22px; height: 22px; border-radius: 50%; background: var(--acc-solid); border: 3px solid #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,.3); animation: pin-pulse 2.2s infinite; cursor: grab; }
@keyframes pin-pulse {
  0% { box-shadow: 0 0 0 0 rgba(90,24,154,.45), 0 2px 8px rgba(0,0,0,.3); }
  70% { box-shadow: 0 0 0 14px rgba(90,24,154,0), 0 2px 8px rgba(0,0,0,.3); }
  100% { box-shadow: 0 0 0 0 rgba(90,24,154,0), 0 2px 8px rgba(0,0,0,.3); }
}

@media (max-width: 1100px) {
  .mpanel.left, .mpanel.right { width: min(360px, calc(100% - 28px)); }
  .mapshell.left-open .mtoolbar, .mapshell.right-open .mtoolbar { left: 14px; right: 14px; }
  .mapshell.left-open .mlegend { left: 14px; }
  .radius-box input { width: 80px; }
}
.pc-name .pack { font-weight: 500; color: var(--ink-3); font-size: 11.5px; background: var(--line-2); border-radius: 6px; padding: 0 5px; white-space: nowrap; }

/* ---------- MapLibre ---------- */
.mapcanvas, .map { background: var(--map-bg); }
.mapcanvas .maplibregl-canvas { outline: none; }
.maplibregl-ctrl-bottom-right { transition: right .2s ease; }
.mapshell.right-open .maplibregl-ctrl-bottom-right { right: 404px; }
.maplibregl-ctrl-group { border-radius: 12px !important; overflow: hidden; box-shadow: var(--shadow-lg) !important;
  background: var(--glass-strong) !important; border: 1px solid var(--line); }
.maplibregl-ctrl-group button { width: 36px !important; height: 36px !important; }
.maplibregl-ctrl-group button + button { border-top: 1px solid var(--line-2) !important; }
.maplibregl-ctrl-scale { border-color: var(--ink-3) !important; color: var(--ink-3) !important; background: var(--glass) !important; font-family: var(--font); }
.maplibregl-ctrl-attrib { background: var(--glass) !important; color: var(--ink-3); font-size: 10.5px; }
.maplibregl-ctrl-attrib a { color: var(--acc-700) !important; }
.maplibregl-ctrl-attrib-button { background-color: transparent; }
:root[data-theme="dusk"] .maplibregl-ctrl-group button .maplibregl-ctrl-icon,
:root[data-theme="dusk"] .maplibregl-ctrl-attrib-button { filter: invert(1) brightness(1.4); }

.maplibregl-popup.map-tip { z-index: 5; pointer-events: none; }
.maplibregl-popup.map-tip .maplibregl-popup-content { background: var(--tip-bg); color: var(--tip-ink); border-radius: 10px;
  padding: 9px 11px; box-shadow: 0 10px 30px rgba(0, 0, 0, .25); font-family: var(--font); min-width: 190px; }
.maplibregl-popup.map-tip.maplibregl-popup-anchor-bottom .maplibregl-popup-tip,
.maplibregl-popup.map-tip.maplibregl-popup-anchor-bottom-left .maplibregl-popup-tip,
.maplibregl-popup.map-tip.maplibregl-popup-anchor-bottom-right .maplibregl-popup-tip { border-top-color: var(--tip-bg); }
.maplibregl-popup.map-tip.maplibregl-popup-anchor-top .maplibregl-popup-tip,
.maplibregl-popup.map-tip.maplibregl-popup-anchor-top-left .maplibregl-popup-tip,
.maplibregl-popup.map-tip.maplibregl-popup-anchor-top-right .maplibregl-popup-tip { border-bottom-color: var(--tip-bg); }
.maplibregl-popup.map-tip.maplibregl-popup-anchor-left .maplibregl-popup-tip { border-right-color: var(--tip-bg); }
.maplibregl-popup.map-tip.maplibregl-popup-anchor-right .maplibregl-popup-tip { border-left-color: var(--tip-bg); }
.map-tip .tt-title { font-weight: 650; font-size: 13px; }
.map-tip .tt-sub { color: var(--tip-ink-2); font-size: 11.5px; margin-bottom: 6px; }
.map-tip .tt-row { display: flex; justify-content: space-between; gap: 14px; font-size: 12px; padding: 1px 0; }
.map-tip .tt-row span { color: var(--tip-ink-2); }
.map-tip .tt-hint { color: var(--tip-ink-2); font-size: 11px; margin-top: 6px; opacity: .8; }
.center-pin { width: 22px; height: 22px; }

@media (max-width: 1100px) {
  .mapshell.right-open .maplibregl-ctrl-bottom-right { right: 0; }
}

/* ---------- store explorer + full screen ---------- */
.mpanel.left.wide { width: 396px; }
.mapshell.left-open.left-wide .mtoolbar { left: 422px; }
.mapshell.left-open.left-wide .mlegend { left: 422px; }
.mapshell.is-full { height: 100vh; width: 100vw; }
.ltabs { display: flex; gap: 4px; padding: 8px 8px 0; border-bottom: 1px solid var(--line-2); }
.ltabs button { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 0; background: none;
  padding: 9px 8px; cursor: pointer; color: var(--ink-3); font-weight: 600; font-size: 12.5px; border-bottom: 2px solid transparent;
  margin-bottom: -1px; position: relative; }
.ltabs button:hover { color: var(--ink); }
.ltabs button.on { color: var(--acc-700); border-bottom-color: var(--acc-600); }
.ltabs .dot-on { width: 7px; height: 7px; border-radius: 50%; background: var(--acc-solid); }
.explorer-empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 40px 12px; color: var(--ink-3); }
.explorer-empty.small { padding: 24px 12px; }
.explorer-empty b { color: var(--ink); font-size: 14px; }
.explorer-filters { display: flex; flex-direction: column; gap: 12px; padding-bottom: 14px; border-bottom: 1px solid var(--line-2); }
.explorer-filters .two { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.search-in { display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 6px 0 11px; border: 1px solid var(--line);
  border-radius: 11px; background: var(--surface); color: var(--ink-3); }
.search-in:focus-within { border-color: var(--acc-300); box-shadow: var(--ring); }
.search-in input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--ink); }
.price-inputs { gap: 6px; flex-wrap: nowrap; margin-top: 6px; }
.price-inputs .input { flex: 1; width: 0; height: 32px; }
.results-head { display: flex; align-items: center; gap: 6px; padding: 12px 0 6px; position: sticky; top: -12px; z-index: 2;
  background: var(--glass-strong); }
.results-head select { margin-left: auto; height: 30px; font-size: 12.5px; }
.results.busy { opacity: .55; transition: opacity .15s; }
.results .prow { align-items: flex-start; padding: 10px 6px; }
.results .prow .num b { font-size: 14px; }
.stars { color: #b7791f; font-weight: 600; }
:root[data-theme="dusk"] .stars { color: #f1b45c; }
.oos { color: var(--bad); font-weight: 600; }
.disc { font-size: 11px; font-weight: 700; color: var(--good); }
.btn.more { width: 100%; justify-content: center; margin-top: 10px; }
@media (max-width: 1100px) {
  .mpanel.left.wide { width: min(396px, calc(100% - 28px)); }
  .mapshell.left-open.left-wide .mtoolbar, .mapshell.left-open.left-wide .mlegend { left: 14px; }
}

/* ---------- batched tables ---------- */
tr.sentinel td { padding: 0; height: 1px; border: 0; }
td.loading-row { text-align: center; color: var(--ink-3); font-size: 12.5px; padding: 12px; }

/* ---------- business modules (gaps, launch, competitors, alerts, assistant, settings) ---------- */
.grid.cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.scope-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 12px; width: 100%; }
.scope-row.more { padding-top: 10px; border-top: 1px dashed var(--line); }
.count-pill { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 999px; background: var(--acc-solid); color: var(--on-acc); font-size: 11px; font-weight: 700; }
.btn.on { background: var(--acc-50); border-color: var(--acc-300); color: var(--acc-700); }
.btn.xs { height: 26px; padding: 0 8px; font-size: 11.5px; border-radius: 8px; gap: 4px; }
.input.xs { width: 64px; height: 28px; padding: 0 6px; }
.iconbtn.xs { width: 18px; height: 18px; border-radius: 6px; }
.linkbtn.side { color: var(--side-ink-2); display: inline-flex; align-items: center; gap: 4px; margin-top: 6px; font-size: 12px; }
.linkbtn.side:hover { color: var(--side-ink); }
.export-btns { display: flex; justify-content: flex-end; gap: 4px; margin: -4px 0 6px; }

.nav-badge { margin-left: auto; min-width: 20px; height: 18px; padding: 0 6px; border-radius: 999px; background: #e0457b;
  color: #fff; font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.app.nav-collapsed .nav-item { position: relative; }
.app.nav-collapsed .nav-badge { position: absolute; top: 2px; right: 2px; min-width: 16px; height: 16px; font-size: 10px; padding: 0 4px; }
.ws-switch { margin: 0 0 12px; }
.ws-switch select { width: 100%; height: 32px; border-radius: 9px; border: 1px solid var(--side-border); background: var(--side-card);
  color: var(--side-ink); padding: 0 8px; font: inherit; font-size: 12.5px; }
.ws-switch option { color: #1F1F1F; }
.app.nav-collapsed .ws-switch { display: none; }

.kv { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; padding: 7px 0; border-bottom: 1px solid var(--line-2); font-size: 13px; }
.kv:last-child { border-bottom: 0; }
.kv > span:first-child { color: var(--ink-3); min-width: 140px; }
.kv > b { font-variant-numeric: tabular-nums; }
.conf-bar { display: flex; height: 8px; border-radius: 999px; overflow: hidden; gap: 2px; margin: 12px 0 6px; background: var(--line-2); }
.conf-bar span { min-width: 4px; }
.conf-high { background: var(--good); }
.conf-medium { background: var(--acc-300); }
.conf-low { background: var(--deemph); }
.rank-num { flex: none; width: 18px; text-align: right; font-size: 12px; font-weight: 700; color: var(--ink-3); }

.drawer-backdrop { position: fixed; inset: 0; z-index: 60; background: rgba(20, 8, 34, 0.32); display: flex; justify-content: flex-end; }
.drawer { height: 100%; max-width: 100vw; background: var(--surface); box-shadow: var(--shadow-lg); display: flex; flex-direction: column;
  animation: drawer-in .18s ease-out; }
@keyframes drawer-in { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.drawer-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.drawer-head h3 { margin: 0; font-size: 16px; }
.drawer-body { flex: 1; overflow: auto; padding: 16px 20px 28px; }
.dropdown-panel.right { left: auto; right: 0; }

.alert-row { padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line-2); margin-bottom: 8px; }
.alert-row.unread { background: var(--acc-50); border-color: var(--acc-200); }
.alert-row.unread .alert-title::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: var(--acc-solid); margin-right: 7px; vertical-align: middle; }
.alert-title { font-weight: 650; font-size: 13.5px; margin-bottom: 2px; }
.rule-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 12px 0; border-bottom: 1px solid var(--line-2); }
.rule-row:last-child { border-bottom: 0; }
.rule-row label { display: inline-flex; align-items: center; gap: 6px; }

.chat-card { display: flex; flex-direction: column; min-height: 60vh; }
.chat-empty { display: flex; flex-direction: column; gap: 8px; }
.chat-empty .chip-btn { text-align: left; }
.chat-turn { padding: 14px 0; border-bottom: 1px solid var(--line-2); }
.chat-q { align-self: flex-end; margin-left: auto; max-width: 80%; width: fit-content; background: var(--acc-solid); color: var(--on-acc);
  padding: 8px 12px; border-radius: 14px 14px 4px 14px; font-size: 13.5px; }
.chat-a { margin-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.chat-a.muted { flex-direction: row; align-items: center; }
.chat-text { white-space: pre-wrap; line-height: 1.55; font-size: 13.5px; }
.chat-input { display: flex; gap: 8px; margin-top: auto; padding-top: 14px; }
.chat-input .input, .chat-input textarea { flex: 1; }

.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: var(--bg); }
.login-card { width: 100%; max-width: 400px; padding: 28px; display: flex; flex-direction: column; gap: 12px; }
.brand-mark.big { width: 52px; height: 52px; border-radius: 16px; }

@media (max-width: 1200px) { .grid.cols-5 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 860px) {
  .grid.cols-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sidebar { gap: 8px; }
  .sidebar .brand { width: 100%; }
  .nav-group { display: flex; flex-direction: row; flex-wrap: nowrap; overflow-x: auto; width: 100%; gap: 4px; scrollbar-width: none; }
  .nav-group .nav-title { display: none; }
  .nav-item { white-space: nowrap; flex: none; }
  .nav-toggle { display: none; }
  .drawer { width: 100vw !important; }
  .kv > span:first-child { min-width: 0; }
}
@media (max-width: 560px) {
  .grid.cols-2, .grid.cols-3, .grid.cols-4, .grid.cols-5, .grid.cols-6 { grid-template-columns: minmax(0, 1fr); }
  .scope-row { gap: 8px 10px; }
  .scope-row > .field { flex: 1 1 calc(50% - 5px); }
  .scope-row > .field:first-child, .scope-row.more > .field { flex-basis: 100%; }
  .scope-row .select-btn, .scope-row .dropdown, .scope-row select.input { width: 100% !important; }
  .theme-pick { display: none; }
  .page-head { margin-bottom: 14px; }
  .chat-q { max-width: 95%; }
}

/* ---- platforms: picker chips, tags, compare page ------------------------------------------ */
.pick-platforms { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.pchip { --pc: #868e96; display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--surface);
  color: var(--ink-3); border-radius: 999px; padding: 5px 11px; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
  transition: background .15s, border-color .15s, color .15s; }
.pchip i { width: 9px; height: 9px; border-radius: 50%; background: var(--pc); flex: none; }
.pchip:hover { border-color: var(--pc); color: var(--ink); }
.pchip.on { border-color: var(--pc); background: color-mix(in srgb, var(--pc) 13%, var(--surface)); color: var(--ink); }
.pchip:focus-visible { outline: none; box-shadow: var(--ring); }
.pchip-n { font-weight: 500; font-size: 11.5px; color: var(--muted); }
.pick-note { font-size: 12px; color: var(--muted); margin-left: 2px; }
.pick-platforms.compact .pchip { padding: 3px 9px; font-size: 12px; }
.ptag { --pc: #868e96; display: inline-flex; align-items: center; gap: 5px; font-weight: 600; font-size: 12.5px; white-space: nowrap; }
.ptag i { width: 8px; height: 8px; border-radius: 50%; background: var(--pc); flex: none; }
table.data.compare td.best { color: var(--good); font-weight: 700; background: var(--good-bg); }
.best-cell { color: var(--good); font-weight: 700; }
.winners { margin-bottom: 14px; }
.winner { border: 1px solid var(--line); border-top: 3px solid var(--pc); border-radius: 12px; padding: 12px 14px; background: var(--surface-2); }
.winner-big { font-size: 26px; font-weight: 750; margin-top: 6px; color: var(--ink); }
.prod { display: flex; gap: 10px; align-items: center; white-space: normal; min-width: 240px; }
.prod img { width: 36px; height: 36px; object-fit: contain; border-radius: 6px; background: #fff; border: 1px solid var(--line-2); flex: none; }
.mpanel .pick-platforms { margin-bottom: 4px; }

/* ---- accounts: add-user form, sign-in messages, one-time password ---------------------------- */
.team-row { margin: 16px 0; }
.add-user { display: grid; grid-template-columns: 2fr 1.3fr 1.3fr 110px 2fr auto; gap: 8px; align-items: center; }
select.input.role-select { width: 104px; height: 30px; padding: 0 8px; }
.login-msg { margin-top: 12px; color: var(--ink-2); }
.callout.secret code { font-size: 15px; letter-spacing: .04em; user-select: all; }
.login-card form.stack, .login-card .stack { width: 100%; }
@media (max-width: 1100px) { .add-user { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .add-user { grid-template-columns: 1fr; } }
