﻿/* SwipeStats: dark purple theme. Pages should use these classes and variables, not their own colours.
   MOBILE RULES (hard requirement, every page): the site must work on a 375px phone with no zooming and no sideways page scrolling.
   - Never set fixed pixel widths on layout; use ui.grid, .cols-2, .form, minmax(0, 1fr) and min-width: 0.
   - Wide content (tables, long codes) goes inside .tbl-wrap (ui.table already does this) so it scrolls inside its panel.
   - Inputs are 16px on phones and tap targets at least 40px; use .btn / .input, which handle this below 768px.
   - No hover-only information: put meaning in visible text; ui badges, card hints and chart tooltips work on tap.
   - Charts: use ui.chart / ui.barChart; they go full width and about 180px tall on phones.
   - Check each page at 375x812 and 390x844: document.documentElement.scrollWidth must not exceed innerWidth.
   The phone rules themselves are in the "Responsive" section at the end of this file. */
:root {
  color-scheme: dark;
  --bg: #0d0b14;
  --panel: #15121f;
  --panel-2: #1b1728;
  --hover: #211c31;
  --line: #272238;
  --line-2: #352e4b;
  --text: #f1eef8;
  --muted: #9a93b0;
  --faint: #6c6582;
  --accent: #8b5cf6;
  --accent-soft: rgba(139, 92, 246, 0.14);
  --accent-text: #c4b5fd;
  --good: #53c556;
  --bad: #f07071;
  --warn: #fbb315;
  --grid: #241f33;
  --axis: #3a3350;
  --radius: 12px;
  --sidebar: 228px;
  --top: 56px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { overflow-x: hidden; background: var(--bg); color: var(--text); font: 13.5px/1.45 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.num, .tnum { font-variant-numeric: tabular-nums; }
.good { color: var(--good); }
.bad { color: var(--bad); }
.warn { color: var(--warn); }
.hidden { display: none !important; }
.boot { padding: 40px; color: var(--muted); }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.spacer { flex: 1; }
.stack > * + * { margin-top: 12px; }
.small { font-size: 12px; }
.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 12px; }

/* -- Controls -- */
.btn { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 11px; border-radius: 7px; border: 1px solid var(--line-2); background: var(--panel-2); color: var(--text); cursor: pointer; font-size: 13px; white-space: nowrap; }
.btn:hover { background: var(--hover); border-color: #463d63; }
.btn:focus-visible, .input:focus-visible, select:focus-visible, .nav a:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: #7c4ee8; }
.btn.danger { color: #ffb4b4; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--text); background: var(--hover); }
.btn.sm { height: 26px; padding: 0 8px; font-size: 12px; }
.btn.icon { width: 30px; padding: 0; justify-content: center; }
.btn.sm.icon { width: 26px; }
.btn:disabled { opacity: 0.5; cursor: default; }
.input, select.input, textarea.input { height: 30px; padding: 0 9px; border-radius: 7px; border: 1px solid var(--line-2); background: #110e1a; color: var(--text); min-width: 0; }
textarea.input { width: 100%; height: auto; padding: 8px 9px; resize: vertical; font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 12px; }
select.input { padding-right: 4px; }
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: 7px; overflow: hidden; height: 30px; }
.seg button { border: 0; background: transparent; padding: 0 9px; color: var(--muted); cursor: pointer; font-size: 12.5px; }
.seg button + button { border-left: 1px solid var(--line-2); }
.seg button.on { background: var(--accent-soft); color: var(--text); }
label.field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
label.field .hint { color: var(--faint); font-size: 11.5px; }
label.check { display: inline-flex; gap: 6px; align-items: center; font-size: 13px; }
.form { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(200px, 100%), 1fr)); gap: 10px 12px; }
.form .wide { grid-column: 1 / -1; }

/* -- Shell -- */
.ico { display: block; flex: none; }
.shell { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); grid-template-rows: var(--top) 1fr; min-height: 100vh; }
.topbar { grid-column: 1 / -1; position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px; padding: 0 14px; height: var(--top); background: rgba(13, 11, 20, 0.94); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; width: calc(var(--sidebar) - 24px); flex: none; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand img, .brand .ph { width: 32px; height: 32px; border-radius: 9px; background: var(--panel-2); flex: none; object-fit: cover; overflow: hidden; display: block; }
.brand .ph svg { width: 32px; height: 32px; display: block; }
.brand .name { font-weight: 650; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand .sub { color: var(--muted); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-tabs { display: flex; align-items: stretch; align-self: stretch; gap: 2px; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.top-tabs::-webkit-scrollbar { display: none; }
.top-tabs a { display: flex; align-items: center; padding: 0 11px; color: var(--muted); font-size: 13px; white-space: nowrap; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.top-tabs a:hover { color: var(--text); text-decoration: none; }
.top-tabs a.on { color: var(--text); border-bottom-color: var(--accent); }
.top-right { display: flex; align-items: center; gap: 10px; flex: none; margin-left: auto; }
.last-upd { color: var(--muted); font-size: 12px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.bell { position: relative; color: var(--muted); }
.bell:hover { text-decoration: none; }
.bell-count { position: absolute; top: 1px; right: 0; min-width: 15px; height: 15px; padding: 0 4px; border-radius: 99px; background: var(--bad); color: #fff; font-size: 10px; line-height: 15px; text-align: center; font-weight: 600; }
.avatar { width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--line-2); background: var(--accent-soft); color: var(--accent-text); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; }
.avatar:hover { border-color: var(--accent); }
.burger { display: none; }
.pill { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: 99px; border: 1px solid var(--line-2); font-size: 12px; color: var(--muted); white-space: nowrap; }
.pill.fresh { background: transparent; cursor: pointer; font: inherit; font-size: 12px; }
.pill.fresh.is-live { color: #86e08a; border-color: #24452b; background: rgba(83, 197, 86, 0.08); font-weight: 500; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); flex: none; }
.dot.ok { background: var(--good); box-shadow: 0 0 0 3px rgba(83, 197, 86, 0.15); }
.dot.stale { background: var(--warn); }
.dot.down { background: var(--bad); }
.sidebar { grid-row: 2; position: sticky; top: var(--top); height: calc(100vh - var(--top)); overflow-y: auto; border-right: 1px solid var(--line); padding: 8px 8px 24px; background: var(--bg); }
.nav-group { display: flex; align-items: center; justify-content: space-between; width: 100%; height: 22px; margin: 12px 0 3px; padding: 0 10px; border: 0; background: transparent; cursor: pointer; font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--faint); }
.nav-sec:first-child .nav-group { margin-top: 2px; }
.nav-group:hover { color: var(--muted); }
.nav-group .ico { transform: rotate(90deg); transition: transform 0.15s; }
.nav-sec.collapsed .nav-group .ico { transform: none; }
.nav-sec.collapsed .nav-items { display: none; }
.nav a { display: flex; align-items: center; gap: 10px; height: 31px; padding: 0 10px; border-radius: 8px; color: var(--muted); font-size: 13px; }
.nav a span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav a .ico { opacity: 0.85; }
.nav a:hover { background: var(--hover); color: var(--text); text-decoration: none; }
.nav a.on { background: var(--accent); color: #fff; }
.nav a.on .ico { opacity: 1; }
.main { grid-row: 2; min-width: 0; padding: 16px 20px 40px; }
.page-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.page-head h1 { font-size: 17px; }
.scrim { display: none; }
.top-title, .drawer-tools { display: none; }
/* range + currency bar (shell, above each page) and the same controls in the dashboard hero */
.page-bar { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.range-ctl { display: flex; align-items: center; gap: 6px; min-width: 0; }
.range-seg button { min-width: 40px; font-variant-numeric: tabular-nums; }
.range-seg button.on, .seg.sm button.on { background: var(--accent); color: #fff; }
.cal-btn { padding: 0 8px; }
.cal-btn.on { border-color: var(--accent); background: var(--accent-soft); }
.cal-btn .cal-text { font-size: 12px; max-width: 190px; overflow: hidden; text-overflow: ellipsis; }
.cur-select { width: auto; }
.seg.sm { height: 26px; }
.seg.sm button { font-size: 12px; padding: 0 9px; white-space: nowrap; }

/* menus (range, account) */
.menu-wrap { position: relative; }
.menu { position: absolute; top: calc(100% + 6px); left: 0; z-index: 50; min-width: 230px; background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 10px; padding: 6px; box-shadow: 0 14px 40px rgba(0, 0, 0, 0.5); }
.menu.right { left: auto; right: 0; }
.menu .item { display: flex; align-items: center; gap: 8px; width: 100%; height: 30px; padding: 0 10px; border: 0; background: transparent; border-radius: 6px; cursor: pointer; text-align: left; font-size: 13px; color: var(--text); }
.menu .item:hover { background: var(--hover); text-decoration: none; }
.menu .item .chk { width: 16px; font-weight: 700; color: var(--accent-text); }
.menu .foot { border-top: 1px solid var(--line); margin-top: 6px; padding: 8px 4px 2px; display: grid; gap: 6px; }
.acc-menu { min-width: 250px; }
.acc-menu .foot { margin: 6px 0; padding-bottom: 8px; border-bottom: 1px solid var(--line); }

/* -- Panels, sections -- */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; min-width: 0; }
.section { margin-bottom: 14px; }
.section-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; min-height: 26px; }
.section-head h2 { font-size: 13.5px; font-weight: 600; }
.section-head .actions { margin-left: auto; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(min(var(--min, 180px), 100%), 1fr)); }
.cols-2 { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(min(420px, 100%), 1fr)); }
.unavail { border-style: dashed; }
.unavail .why { color: var(--muted); margin-top: 6px; }
.unavail .fix { color: var(--faint); margin-top: 4px; font-size: 12.5px; }
.building { padding: 26px; text-align: center; color: var(--muted); }
.err-panel { border-color: #5a2a36; }
.err-panel pre { white-space: pre-wrap; color: #ffb4b4; font-size: 12px; margin: 8px 0 0; }
.empty { color: var(--muted); padding: 18px; text-align: center; font-size: 13px; }

/* -- Badges -- */
.badge { display: inline-flex; align-items: center; height: 18px; padding: 0 7px; border-radius: 99px; font-size: 10.5px; font-weight: 500; letter-spacing: 0.02em; border: 1px solid var(--line-2); color: var(--muted); white-space: nowrap; cursor: help; vertical-align: middle; }
.badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; margin-right: 5px; background: currentColor; opacity: 0.8; }
.badge.live { color: #86e08a; border-color: #24452b; }
.badge.delayed { color: #f5c86a; border-color: #4a3c1c; }
.badge.verified { color: #9fd2ff; border-color: #1f3a55; }
.badge.calculated { color: var(--accent-text); border-color: #3a2e5c; }
.badge.estimated { color: #f3a77f; border-color: #4d3022; }
.badge.imported { color: #c9c3d9; border-color: #3a3448; }
.badge.unavailable { color: var(--faint); border-style: dashed; }

/* -- Cards -- */
.card { position: relative; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 11px 12px 10px; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.card.click { cursor: pointer; }
.card.click:hover { border-color: var(--line-2); background: #181424; }
.card .c-top { display: flex; align-items: flex-start; gap: 6px; min-height: 18px; }
.card .c-title { color: var(--muted); font-size: 12px; line-height: 1.35; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; min-width: 0; }
.card .c-title[title] { cursor: help; text-decoration: underline dotted var(--faint); text-underline-offset: 3px; }
.card .c-top .badge { margin-left: auto; }
.card .c-val { font-size: 21px; font-weight: 600; line-height: 1.2; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .c-val.na { color: var(--faint); font-weight: 500; }
.card .c-foot { display: flex; align-items: flex-end; gap: 8px; min-height: 18px; }
.card .c-sub { color: var(--muted); font-size: 11.5px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card .spark { margin-left: auto; flex: none; }
.delta { font-size: 11.5px; font-weight: 500; white-space: nowrap; font-variant-numeric: tabular-nums; }
.delta.up { color: var(--good); }
.delta.down { color: var(--bad); }
.delta.flat { color: var(--muted); }
.card .edit-bar { position: absolute; top: 6px; right: 6px; display: flex; gap: 3px; background: var(--panel-2); border-radius: 6px; padding: 2px; }

/* -- Charts -- */
.chart { position: relative; min-width: 0; }
.chart .ch-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; min-height: 26px; }
.chart .ch-title { font-size: 13px; font-weight: 600; }
.chart .ch-tools { margin-left: auto; display: flex; gap: 2px; }
.chart .ch-tools .btn { height: 24px; width: 24px; padding: 0; justify-content: center; font-size: 12px; color: var(--muted); background: transparent; border-color: transparent; }
.chart .ch-tools .btn:hover { color: var(--text); background: var(--hover); }
.chart .plot { position: relative; user-select: none; touch-action: pan-y; }
.chart svg { display: block; overflow: visible; }
.chart svg:focus { outline: none; }
.chart svg:focus-visible { outline: 1px solid var(--accent); }
.chart .tick { fill: var(--muted); font-size: 10.5px; font-variant-numeric: tabular-nums; }
.chart .gridline { stroke: var(--grid); stroke-width: 1; shape-rendering: crispEdges; }
.chart .baseline { stroke: var(--axis); stroke-width: 1; shape-rendering: crispEdges; }
.chart .xhair { stroke: #6f6590; stroke-width: 1; shape-rendering: crispEdges; pointer-events: none; }
.chart .sel { fill: rgba(139, 92, 246, 0.12); stroke: rgba(139, 92, 246, 0.5); }
.chart .annot line { stroke: #6f6590; stroke-width: 1; shape-rendering: crispEdges; }
.chart .annot text { fill: var(--muted); font-size: 10px; }
.chart .nodata { fill: var(--faint); font-size: 12px; }
.chart.loading .plot { opacity: 0.55; transition: opacity 0.2s; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 6px; font-size: 12px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { display: inline-block; width: 12px; height: 2px; border-radius: 1px; }
.legend i.rect { height: 9px; width: 9px; border-radius: 2px; }
.tip { position: absolute; z-index: 20; pointer-events: none; background: #221d33; border: 1px solid var(--line-2); border-radius: 8px; padding: 7px 9px; font-size: 12px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45); min-width: 120px; max-width: 280px; }
.tip .t-head { color: var(--muted); font-size: 11px; margin-bottom: 4px; white-space: nowrap; }
.tip .t-row { display: flex; align-items: center; gap: 7px; white-space: nowrap; line-height: 1.6; }
.tip .t-row i { width: 10px; height: 2px; border-radius: 1px; flex: none; }
.tip .t-row b { font-weight: 600; font-variant-numeric: tabular-nums; }
.tip .t-row span { color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.chart:fullscreen, .fs-target:fullscreen { background: var(--bg); padding: 20px; overflow: auto; }
.chart-table { margin-top: 8px; max-height: 260px; overflow: auto; }

/* heatmap */
.heat { display: grid; gap: 2px; font-size: 11px; }
.heat .hc { height: 22px; border-radius: 3px; background: var(--panel-2); position: relative; }
.heat .hc.null { background: transparent; border: 1px dashed var(--line-2); }
.heat .hl { color: var(--muted); display: flex; align-items: center; white-space: nowrap; overflow: hidden; padding-right: 6px; }
.heat .hh { color: var(--muted); text-align: center; overflow: hidden; white-space: nowrap; }
.heat-scale { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--muted); margin-top: 8px; }
.heat-scale i { width: 120px; height: 8px; border-radius: 4px; }

/* funnel */
.funnel { display: grid; gap: 8px; }
.fn-row { display: grid; grid-template-columns: minmax(90px, 180px) 1fr auto; gap: 10px; align-items: center; }
.fn-label { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fn-label small { display: block; color: var(--faint); font-size: 11px; }
.fn-bar { height: 20px; background: var(--panel-2); border-radius: 4px; position: relative; overflow: hidden; }
.fn-bar i { position: absolute; inset: 0 auto 0 0; background: var(--accent); border-radius: 0 4px 4px 0; opacity: 0.85; }
.fn-num { text-align: right; font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.fn-num small { display: block; color: var(--muted); font-size: 11px; }

/* tables */
.tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.tbl th { text-align: left; font-weight: 500; color: var(--muted); font-size: 11.5px; padding: 6px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; position: sticky; top: 0; background: var(--panel); }
.tbl th.sort { cursor: pointer; }
.tbl th.sort:hover { color: var(--text); }
.tbl td { padding: 6px 8px; border-bottom: 1px solid var(--grid); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover td { background: #191526; }
.tbl .r { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl .c { text-align: center; }
.tbl-foot { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.tbl-tools { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.tbl-tools .input { width: 200px; max-width: 100%; }
table.cohort td.cell { text-align: center; font-variant-numeric: tabular-nums; font-size: 11.5px; padding: 5px 4px; border-bottom: 2px solid var(--panel); }
table.cohort td.cell.imm { color: var(--faint); background: repeating-linear-gradient(135deg, transparent 0 4px, rgba(255, 255, 255, 0.03) 4px 8px); }
table.cohort tr.small td:first-child::after { content: " small"; color: var(--warn); font-size: 10.5px; }

/* tabs */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 12px; overflow-x: auto; }
.tabs button { border: 0; background: transparent; padding: 7px 12px; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; font-size: 13px; }
.tabs button:hover { color: var(--text); }
.tabs button.on { color: var(--text); border-bottom-color: var(--accent); }

/* toast + dialog */
.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 100; display: grid; gap: 8px; }
.toast { background: var(--panel-2); border: 1px solid var(--line-2); border-left: 3px solid var(--accent); padding: 9px 12px; border-radius: 8px; font-size: 13px; max-width: 360px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45); }
.toast.ok { border-left-color: var(--good); }
.toast.error { border-left-color: var(--bad); }
.toast.warn { border-left-color: var(--warn); }
.modal-bg { position: fixed; inset: 0; z-index: 90; background: rgba(5, 4, 10, 0.65); display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal { background: var(--panel); border: 1px solid var(--line-2); border-radius: 12px; padding: 16px; width: 100%; max-width: 560px; max-height: calc(100vh - 32px); overflow: auto; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6); }
.modal h3 { font-size: 15px; margin-bottom: 12px; }
.modal .m-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }

/* login */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; background: radial-gradient(600px 400px at 50% 30%, rgba(139, 92, 246, 0.08), transparent 70%), var(--bg); }
.login .panel { width: 100%; max-width: 380px; padding: 28px 26px 20px; border-radius: 14px; box-shadow: 0 24px 70px rgba(0, 0, 0, 0.45); }
.login-brand { display: flex; justify-content: center; margin-bottom: 14px; }
.login h1 { font-size: 19px; margin-bottom: 4px; text-align: center; letter-spacing: -0.01em; }
.login p { color: var(--muted); margin: 0 0 18px; text-align: center; }
.login p.muted { text-align: left; }
.login form { display: grid; gap: 12px; }
.login .input { height: 36px; }
.login .err { color: var(--bad); font-size: 12.5px; min-height: 18px; }
.login .err:empty { min-height: 0; }
.btn.block { width: 100%; justify-content: center; height: 36px; font-weight: 600; }
.passkey-slot:empty { display: none; }
.passkey-slot { display: grid; gap: 10px; }
.or { display: flex; align-items: center; gap: 10px; color: var(--faint); font-size: 11.5px; }
.or::before, .or::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.login-foot { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); color: var(--faint); font-size: 11.5px; text-align: center; }

/* dashboard specifics shared with the live page */
.hero-val { font-size: 52px; font-weight: 650; line-height: 1; letter-spacing: -0.02em; }
.game-head { display: flex; gap: 14px; align-items: stretch; }
.game-head .thumb { width: 220px; aspect-ratio: 16 / 9; border-radius: 8px; object-fit: cover; background: var(--panel-2); flex: none; }
.game-head .icon { width: 64px; height: 64px; border-radius: 12px; object-fit: cover; background: var(--panel-2); flex: none; }
.summary-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.summary-list li { display: flex; gap: 9px; align-items: baseline; font-size: 13px; line-height: 1.5; }
.summary-list li::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); flex: none; transform: translateY(-1px); }
.summary-list li.s-good::before { background: var(--good); }
.summary-list li.s-bad::before { background: var(--bad); }
.summary-list li.s-warn::before { background: var(--warn); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; font-size: 12.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-variant-numeric: tabular-nums; }
.checklist { margin: 0; padding-left: 20px; display: grid; gap: 8px; }
hr.sep { border: 0; border-top: 1px solid var(--line); margin: 14px 0; }
.notes { margin: 8px 0 0; padding-left: 18px; color: var(--muted); font-size: 12px; display: grid; gap: 2px; }

/* -- Dashboard (hero, KPI row, panels) -- */
.dash-hero { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.dash-hero .g-icon { width: 56px; height: 56px; border-radius: 14px; object-fit: cover; background: var(--panel-2); flex: none; }
.dash-hero .g-main { flex: 1; min-width: 200px; }
.dash-hero h1 { font-size: 21px; letter-spacing: -0.01em; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.dash-hero .g-sub { color: var(--muted); font-size: 12.5px; margin-top: 3px; }
.dash-hero .g-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.live-badge { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px; border-radius: 99px; font-size: 11.5px; font-weight: 500; border: 1px solid var(--line-2); color: var(--muted); white-space: nowrap; }
.live-badge i { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); }
.live-badge.on { color: #86e08a; border-color: #24452b; background: rgba(83, 197, 86, 0.08); }
.live-badge.on i { background: var(--good); box-shadow: 0 0 0 3px rgba(83, 197, 86, 0.18); }
.live-badge.stale { color: #f5c86a; border-color: #4a3c1c; }
.live-badge.stale i { background: var(--warn); }
.kpis { display: grid; gap: 12px; grid-template-columns: repeat(6, minmax(0, 1fr)); margin-bottom: 14px; }
.kpi { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 142px; padding: 12px 14px 0; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.kpi.click { cursor: pointer; }
.kpi.click:hover { border-color: var(--line-2); background: #181424; }
.kpi .k-head { display: flex; align-items: center; gap: 8px; min-width: 0; color: var(--muted); font-size: 12.5px; }
.kpi .k-head { min-height: 30px; }
.kpi .k-title { min-width: 0; overflow: hidden; line-height: 1.2; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow-wrap: break-word; } /* wraps to two lines rather than cutting the title */
.kpi .k-head .badge { margin-left: auto; }
.k-ico { width: 28px; height: 28px; border-radius: 8px; background: var(--accent-soft); color: var(--accent-text); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.kpi .k-val { margin-top: 9px; font-size: 24px; font-weight: 650; line-height: 1.15; letter-spacing: -0.015em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.kpi .k-val.na { color: var(--faint); font-weight: 500; }
.kpi .k-foot { display: flex; align-items: baseline; gap: 4px 8px; flex-wrap: wrap; min-height: 17px; margin-top: 3px; font-size: 11.5px; color: var(--muted); }
.kpi .k-reason { color: var(--faint); }
.kpi .k-sub { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.k-spark { display: block; width: calc(100% + 28px); height: 40px; margin: auto -14px 0; padding-top: 6px; }
.k-spark .k-area { fill: var(--accent); fill-opacity: 0.16; stroke: none; }
.k-spark .k-line { fill: none; stroke: var(--accent); stroke-width: 1.6; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.delta .vs, .d-none { color: var(--muted); font-weight: 400; }
.d-none { color: var(--faint); }
.dash-row { display: grid; gap: 14px; margin-bottom: 14px; }
.dash-row.r2 { grid-template-columns: minmax(0, 2.3fr) minmax(0, 1fr); }
.dash-row.r3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.dash-row.r4 { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); }
.dpanel { display: flex; flex-direction: column; min-width: 0; }
.dpanel .section-head { flex-wrap: wrap; }
.dpanel .p-sub { color: var(--muted); font-size: 12px; }
.dpanel .more { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; }
.p-foot { margin-top: auto; padding-top: 10px; display: flex; justify-content: flex-end; }
.p-note { margin-bottom: 10px; }
.chart-note { margin-top: 6px; }
.stack-charts > div + div:not(.hidden) { margin-top: 6px; }
.main-chart:fullscreen { padding: 20px; }
.live-dot { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); white-space: nowrap; }
.live-dot i { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); }
.live-dot i.on { background: var(--good); box-shadow: 0 0 0 3px rgba(83, 197, 86, 0.15); }
.tx-list { list-style: none; margin: 0; padding: 0; }
.tx-list li { display: flex; align-items: center; gap: 10px; padding: 9px 2px; border-bottom: 1px solid var(--grid); min-width: 0; }
.tx-list li:last-child { border-bottom: 0; }
.tx-av { width: 32px; height: 32px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-text); display: inline-flex; align-items: center; justify-content: center; font-weight: 600; font-size: 13px; flex: none; }
.tx-main { flex: 1; min-width: 0; }
.tx-main b, .tx-main small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tx-main b { font-weight: 500; font-size: 13px; }
.tx-main small, .tx-amt small { color: var(--muted); font-size: 11.5px; }
.tx-amt { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tx-amt b { display: block; font-weight: 600; }
.na-block { display: grid; gap: 4px; justify-items: start; color: var(--muted); padding: 6px 0; }
.na-block .na-dash { font-size: 24px; color: var(--faint); line-height: 1; }
.donut-wrap { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.donut { flex: none; }
.donut .d-total { fill: var(--text); font-size: 19px; font-weight: 650; }
.donut .d-cap { fill: var(--muted); font-size: 10.5px; }
.legend-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; flex: 1; min-width: 160px; font-size: 12.5px; }
.legend-list li { display: flex; align-items: center; gap: 8px; min-width: 0; }
.legend-list i { width: 9px; height: 9px; border-radius: 2px; flex: none; }
.legend-list .l { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.legend-list .v { margin-left: auto; font-variant-numeric: tabular-nums; white-space: nowrap; }
.legend-list .v small { color: var(--muted); }
.tiles { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(min(122px, 100%), 1fr)); }
.tile { min-width: 0; padding: 9px 10px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 9px; }
.tile .t-l { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 11.5px; min-width: 0; }
.tile .t-l > span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile .t-l .badge { margin-left: auto; height: 16px; padding: 0 5px; font-size: 0; }
.tile .t-l .badge::before { margin-right: 0; }
.tile .t-v { margin-top: 3px; font-size: 17px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.tile .t-v.na { color: var(--faint); font-weight: 500; }
.tile .t-d { font-size: 11px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sum-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 9px; }
.sum-list li { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; line-height: 1.45; }
.sum-ic { width: 20px; height: 20px; border-radius: 50%; flex: none; display: inline-flex; align-items: center; justify-content: center; font-size: 9px; background: var(--panel-2); color: var(--muted); }
.sum-list li.s-good .sum-ic { background: rgba(83, 197, 86, 0.14); color: var(--good); }
.sum-list li.s-bad .sum-ic { background: rgba(240, 112, 113, 0.14); color: var(--bad); }
.sum-list li.s-warn .sum-ic { background: rgba(251, 179, 21, 0.14); color: var(--warn); font-weight: 700; font-size: 11px; }
.total-pill { display: inline-flex; align-items: center; height: 24px; padding: 0 10px; border-radius: 99px; background: var(--accent-soft); color: var(--accent-text); font-size: 12px; font-weight: 500; white-space: nowrap; font-variant-numeric: tabular-nums; }
.total-pill:empty { display: none; }
.all-head { margin-top: 8px; padding-top: 14px; border-top: 1px solid var(--line); }

/* -- Responsive -- */
/* Six KPI cards in one row leave little room: the source badge shrinks to its coloured dot (tap or hover still names it)
   so titles like "Net Revenue (Today)" are not cut off. */
@media (min-width: 1400.02px) and (max-width: 1799.98px), (max-width: 767.98px) {
  .kpi .k-head .badge { height: 16px; padding: 0 5px; font-size: 0; }
  .kpi .k-head .badge::before { margin-right: 0; }
}
@media (max-width: 1400px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1100px) {
  .opt-wide { display: none; }
  .dash-row.r2, .dash-row.r3, .dash-row.r4 { grid-template-columns: minmax(0, 1fr); }
  .brand { width: auto; max-width: 210px; }
}
/* Phones and small tablets (under 768px). Rules every page must follow:
   1. No sideways page scrolling: document.documentElement.scrollWidth must equal innerWidth. Use min-width: 0 on flex/grid children,
      minmax(0, 1fr) columns, and wrap wide content (tables, code) in .tbl-wrap so it scrolls inside its own panel.
   2. Inputs are at least 16px (stops iOS zooming on focus). Tap targets are at least 40px tall.
   3. Nothing is hover-only: badges and card hints show their text on tap; chart tooltips appear on tap and drag.
   4. Charts are full width and about 180px tall (ui.chart does this). Zoom uses the toolbar buttons on touch.
   5. Card grids are 2 per row; give a card { wide: true } to span the row. Use ui.grid / .cols-2, never fixed pixel widths.
   6. Respect safe areas: the shell already pads for env(safe-area-inset-*). */
@media (max-width: 767.98px) {
  .shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }
  .topbar { flex-wrap: wrap; height: auto; padding: calc(6px + env(safe-area-inset-top)) calc(10px + env(safe-area-inset-right)) 6px calc(10px + env(safe-area-inset-left)); gap: 6px 8px; }
  .burger { display: inline-flex; }
  .brand { display: none; }
  .top-title { display: block; flex: 1; min-width: 0; font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .top-right { gap: 4px; }
  .fresh { height: 32px; padding: 0 10px; }
  .bell, .avatar { width: 40px; height: 40px; }
  .top-tabs { order: 5; flex: 0 0 calc(100% + 20px); margin: 0 -10px -6px; padding: 0 4px; height: 40px; border-top: 1px solid var(--line); }
  .top-tabs a { padding: 0 12px; font-size: 13.5px; }
  .menu { left: 0; right: auto; width: min(320px, calc(100vw - 20px)); }
  .menu.right { left: auto; right: 0; }
  .menu .item { height: 40px; }
  .page-bar { flex-wrap: nowrap; }
  .page-bar .range-ctl, .g-tools .range-ctl { flex: 1; }
  .range-seg { flex: 1; min-width: 0; }
  .range-ctl .range-seg button { flex: 1; min-width: 0; padding: 0 2px; font-size: 13px; }
  .cal-btn .cal-text { display: none; }
  .cur-select { flex: none; padding-right: 0; }
  .dash-hero { gap: 10px; }
  .dash-hero .g-icon { width: 46px; height: 46px; border-radius: 12px; }
  .dash-hero .g-main { min-width: 0; flex: 1 1 calc(100% - 60px); }
  .dash-hero h1 { font-size: 17px; gap: 8px; }
  .dash-hero .g-tools { flex: 1 1 100%; flex-wrap: nowrap; min-width: 0; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .kpi { min-height: 128px; padding: 10px 11px 0; }
  .kpi .k-val { font-size: 19px; }
  .k-spark { width: calc(100% + 22px); margin: auto -11px 0; height: 34px; }
  .k-ico { width: 24px; height: 24px; }
  .seg.sm { height: 36px; }
  .seg.sm button, .dpanel .seg.sm button { min-width: 0; font-size: 12px; padding: 0 7px; }
  .sidebar { position: fixed; top: 0; left: 0; bottom: 0; height: 100%; width: min(280px, 86vw); z-index: 60; transform: translateX(-105%); transition: transform 0.2s ease; box-shadow: 10px 0 40px rgba(0, 0, 0, 0.5); padding: calc(10px + env(safe-area-inset-top)) 8px calc(24px + env(safe-area-inset-bottom)) calc(8px + env(safe-area-inset-left)); display: flex; flex-direction: column; }
  .shell.drawer .sidebar { transform: none; }
  .shell.drawer .scrim { display: block; position: fixed; inset: 0; z-index: 55; background: rgba(5, 4, 10, 0.6); }
  .nav a { height: 40px; font-size: 14.5px; }
  .drawer-tools { display: grid; gap: 10px; margin-top: 16px; padding: 14px 10px 0; border-top: 1px solid var(--line); }
  .main { grid-row: auto; padding: 12px calc(10px + env(safe-area-inset-right)) calc(32px + env(safe-area-inset-bottom)) calc(10px + env(safe-area-inset-left)); }
  .btn { min-height: 40px; }
  .btn.sm { min-height: 36px; padding: 0 10px; }
  .btn.icon, .btn.sm.icon { min-width: 40px; }
  .seg { height: 40px; }
  .tabs { flex-wrap: wrap; overflow-x: visible; } /* page tabs wrap instead of running past the screen edge */
  .tabs button { min-height: 42px; }
  .seg button { min-width: 44px; font-size: 14px; }
  .input, select.input, textarea.input { font-size: 16px; min-height: 40px; }
  .tbl-tools .input { width: 100%; }
  .page-head h1 { font-size: 16px; }
  .grid.cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .grid.cards > .card.wide { grid-column: 1 / -1; }
  .card { padding: 10px; }
  .card .c-val { font-size: 18px; }
  .card .spark { display: none; }
  .card .c-sub { white-space: normal; }
  .card .edit-bar .btn { min-height: 32px; min-width: 32px; }
  .chart .ch-head { flex-wrap: wrap; }
  .chart .ch-tools { margin-left: auto; }
  .chart .ch-tools .btn { width: 36px; height: 36px; min-height: 36px; }
  .chart .ch-tools .opt-desk { display: none; }
  .game-head .thumb { display: none; }
  .game-head .icon { width: 52px; height: 52px; }
  .hero-val { font-size: 40px; }
  .fn-row { grid-template-columns: 1fr auto; }
  .fn-row .fn-bar { grid-column: 1 / -1; grid-row: 2; }
  .panel { padding: 12px; }
  .cols-2 { grid-template-columns: minmax(0, 1fr); }
  .modal-bg { align-items: flex-end; padding: 0; }
  .modal { border-radius: 14px 14px 0 0; max-height: 90vh; padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
  .toasts { left: 10px; right: 10px; bottom: calc(10px + env(safe-area-inset-bottom)); }
  .toast { max-width: none; }
  .kv { grid-template-columns: minmax(0, auto) minmax(0, 1fr); }
  .kv dd { overflow-wrap: anywhere; }
}

/* -- "Demo Â· Big Game" mode (app.js adds .demo to the shell). Amber accent, a striped banner on every page and a frame,
   so a screenshot of projected numbers can never pass for the real site. -- */
.demo-banner, .mode-seg.in-drawer { display: none; }
.mode-seg { height: 28px; flex: none; }
.mode-seg button { padding: 0 9px; font-size: 12px; }
.mode-seg button.on[data-mode="real"] { background: var(--accent-soft); color: var(--text); }
.mode-seg button.on[data-mode="demo"] { background: #f59e0b; color: #1a1200; font-weight: 600; }
.shell.demo { --accent: #f59e0b; --accent-soft: rgba(245, 158, 11, 0.16); --accent-text: #fcd34d; --demo-h: 30px; grid-template-rows: var(--demo-h) var(--top) 1fr; }
.shell.demo::after { content: ""; position: fixed; inset: 0; border: 2px solid #f59e0b; pointer-events: none; z-index: 80; }
.shell.demo .demo-banner { display: flex; grid-column: 1 / -1; grid-row: 1; position: sticky; top: 0; z-index: 31; height: var(--demo-h); align-items: center; justify-content: center; gap: 10px; padding: 0 12px; min-width: 0;
  background: repeating-linear-gradient(-45deg, #f59e0b 0 14px, #e69500 14px 28px); color: #1a1200; font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; }
.demo-banner strong { background: #1a1200; color: #fbbf24; padding: 1px 7px; border-radius: 5px; letter-spacing: 0.08em; flex: none; }
.demo-banner .db-text { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.demo-banner .db-short { display: none; }
.demo-banner .db-state { font-weight: 500; flex: none; }
.demo-banner .db-off { flex: none; height: 22px; padding: 0 8px; border: 1px solid rgba(26, 18, 0, 0.45); border-radius: 6px; background: rgba(255, 255, 255, 0.3); color: #1a1200; font: inherit; font-size: 12px; cursor: pointer; }
.demo-banner .db-off:hover { background: rgba(255, 255, 255, 0.5); }
.shell.demo .topbar { grid-row: 2; top: var(--demo-h); border-bottom-color: #5a4512; }
.shell.demo .sidebar { grid-row: 3; top: calc(var(--top) + var(--demo-h)); height: calc(100vh - var(--top) - var(--demo-h)); }
.shell.demo .main { grid-row: 3; }
.shell.demo .btn.primary:hover { background: #d97706; }
.shell.demo .nav a.on { color: #1a1200; }
.shell.demo .range-seg button.on, .shell.demo .seg.sm button.on { color: #1a1200; }
.badge.demo { color: #fbbf24; border-color: #5a4512; }
@media (max-width: 767.98px) {
  .shell.demo { --demo-h: 28px; grid-template-rows: var(--demo-h) auto 1fr; }
  .shell.demo .demo-banner { font-size: 12px; gap: 8px; padding: 0 calc(8px + env(safe-area-inset-right)) 0 calc(8px + env(safe-area-inset-left)); justify-content: flex-start; }
  .demo-banner .db-long { display: none; }
  .demo-banner .db-short { display: inline; }
  .demo-banner .db-off { display: none; } /* too small a tap target on phones; the switch is in the menu drawer */
  .shell.demo .sidebar { top: 0; height: 100%; }
  .mode-seg.in-top { display: none; }
  .mode-seg.in-drawer { display: inline-flex; align-self: flex-start; }
  .mode-seg.in-drawer button { min-width: 72px; }
}

/* Verified badge goal (dashboard) */
.verified-goal { margin-bottom: 14px; }
.verified-goal .vg-top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 4px 0 8px; }
.verified-goal .vg-num b { font-size: 26px; font-weight: 700; letter-spacing: -0.01em; }
.verified-goal .vg-num span { color: var(--muted); font-size: 14px; }
.verified-goal .vg-pct { font-weight: 600; color: var(--accent); font-variant-numeric: tabular-nums; }
.verified-goal .vg-bar { height: 12px; border-radius: 6px; background: var(--panel-2); overflow: hidden; border: 1px solid var(--line); }
.verified-goal .vg-bar i { display: block; height: 100%; border-radius: 6px; background: var(--accent); }
.verified-goal .vg-facts { margin: 12px 0 8px; }
@media (max-width: 600px) { .verified-goal .vg-num b { font-size: 22px; } }
