/* TikWhizz Web — v2 base (revision brief 2026-09-22). One component set; variants A/B/C override tokens + composition in variants/*.css */
@font-face { font-family: "Inter"; src: url("fonts/InterVariable.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }

:root {
  --bg: #0F1117; --surface: #161922; --surface-2: #1C2030; --border: #262A36; --border-2: #303646; --text: #F3F4F6; --text-2: #9CA3AF; --text-3: #6B7280;
  --accent: #F43758; --accent-2: #FF5C78; --accent-soft: rgba(244,55,88,0.14); --accent-text: #FFFFFF; --brand-tik: #F3F4F6;
  --pos: #22C55E; --neg: #EF4444; --warn: #F59E0B; --info: #3B82F6;
  --pos-soft: rgba(34,197,94,0.14); --neg-soft: rgba(239,68,68,0.14); --warn-soft: rgba(245,158,11,0.14); --info-soft: rgba(59,130,246,0.14);
  --ch-video: #F43758; --ch-live: #8B5CF6; --ch-card: #14B8A6;
  --hover: rgba(255,255,255,0.045); --press: rgba(255,255,255,0.08);
  --shadow: 0 1px 2px rgba(0,0,0,0.35), 0 8px 24px -12px rgba(0,0,0,0.55); --shadow-2: 0 2px 4px rgba(0,0,0,0.4), 0 16px 40px -16px rgba(0,0,0,0.7);
  --ring: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent);
  --r-ctl: 8px; --r-card: 12px; --r-pill: 999px; --t: 150ms cubic-bezier(.2,.7,.2,1);
  --fs-12: 12px; --fs-13: 13px; --fs-14: 14px; --fs-16: 16px; --fs-20: 20px; --fs-24: 24px; --fs-32: 32px;
  --sidebar: 240px; --gutter: 32px; --spark-h: 32px;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) { :root:not([data-theme="dark"]) { --light: 1; } }
:root[data-theme="light"], :root:not([data-theme="dark"]):where([data-light]) { --light: 1; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #F6F7F9; --surface: #FFFFFF; --surface-2: #F3F4F7; --border: #E5E7EB; --border-2: #D6DAE1; --text: #111827; --text-2: #6B7280; --text-3: #9CA3AF; --brand-tik: #0E1A25;
    --hover: rgba(17,24,39,0.04); --press: rgba(17,24,39,0.08); --shadow: 0 1px 2px rgba(17,24,39,0.06), 0 8px 24px -12px rgba(17,24,39,0.18); --shadow-2: 0 2px 4px rgba(17,24,39,0.08), 0 16px 40px -16px rgba(17,24,39,0.25);
    --pos: #16A34A; --neg: #DC2626; color-scheme: light;
  }
}
:root[data-theme="light"] {
  --bg: #F6F7F9; --surface: #FFFFFF; --surface-2: #F3F4F7; --border: #E5E7EB; --border-2: #D6DAE1; --text: #111827; --text-2: #6B7280; --text-3: #9CA3AF; --brand-tik: #0E1A25;
  --hover: rgba(17,24,39,0.04); --press: rgba(17,24,39,0.08); --shadow: 0 1px 2px rgba(17,24,39,0.06), 0 8px 24px -12px rgba(17,24,39,0.18); --shadow-2: 0 2px 4px rgba(17,24,39,0.08), 0 16px 40px -16px rgba(17,24,39,0.25);
  --pos: #16A34A; --neg: #DC2626; color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { background: var(--bg); color: var(--text); font: 400 var(--fs-14)/1.45 Inter, system-ui, sans-serif; font-variant-numeric: tabular-nums; font-feature-settings: "cv01", "ss03"; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
h1, h2, h3 { margin: 0; font-weight: 600; line-height: 1.25; letter-spacing: -0.01em; }
h1 { font-size: var(--fs-20); } h2 { font-size: var(--fs-14); } h3 { font-size: var(--fs-14); }
p { margin: 0; }
.num { font-variant-numeric: tabular-nums; }
.t-12 { font-size: var(--fs-12); } .t-13 { font-size: var(--fs-13); }
.muted { color: var(--text-2); }
.pos { color: var(--pos); } .neg { color: var(--neg); } .warn { color: var(--warn); } .info { color: var(--info); }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: var(--r-ctl); }
button, input, select { font: inherit; color: inherit; }
kbd { font: 500 10px/1 Inter, system-ui; color: var(--text-3); border: 1px solid var(--border); border-radius: 4px; padding: 2px 4px; margin-left: 6px; background: var(--surface-2); }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }

/* ---- brand ---- */
.brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; letter-spacing: -0.03em; font-size: var(--fs-16); padding: 6px 8px; border-radius: var(--r-ctl); transition: background var(--t); }
.brand:hover { background: var(--hover); }
.brand .mark { width: 18px; height: 22px; flex: 0 0 auto; }
.brand .tik { color: var(--brand-tik); } .brand .whizz { color: var(--accent); }
.brand.lg { font-size: var(--fs-24); } .brand.lg .mark { width: 26px; height: 32px; }

/* ---- shell ---- */
.shell { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; transition: grid-template-columns var(--t); }
html[data-nav="collapsed"] .shell { --sidebar: 64px; }
.sidebar { background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; padding: 12px; gap: 14px; position: sticky; top: 0; height: 100vh; overflow: hidden; }
.sidebar .top { display: flex; align-items: center; justify-content: space-between; }
.collapse { width: 28px; height: 28px; display: inline-grid; place-items: center; border-radius: var(--r-ctl); color: var(--text-2); border: 0; background: transparent; cursor: pointer; transition: background var(--t), color var(--t), transform var(--t); }
.collapse:hover { background: var(--hover); color: var(--text); } .collapse:active { background: var(--press); }
.collapse svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
html[data-nav="collapsed"] .collapse svg { transform: rotate(180deg); }
html[data-nav="collapsed"] .brand .word, html[data-nav="collapsed"] .switcher .txt, html[data-nav="collapsed"] .switcher .chev, html[data-nav="collapsed"] .nav a span, html[data-nav="collapsed"] .sidebar .user { display: none; }
html[data-nav="collapsed"] .sidebar { padding: 12px 10px; } html[data-nav="collapsed"] .sidebar .top { flex-direction: column; gap: 8px; }
html[data-nav="collapsed"] .switcher { justify-content: center; padding: 10px 0; } html[data-nav="collapsed"] .nav a { justify-content: center; padding: 10px 0; }
.switcher { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--r-ctl); background: var(--bg); width: 100%; text-align: left; cursor: pointer; transition: border-color var(--t), background var(--t), transform var(--t); }
.switcher:hover { border-color: var(--border-2); background: var(--surface-2); } .switcher:active { transform: scale(0.99); }
.switcher .txt { min-width: 0; display: flex; flex-direction: column; }
.switcher .name { font-weight: 600; font-size: var(--fs-13); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .switcher .sub { font-size: var(--fs-12); color: var(--text-2); }
.switcher .chev { margin-left: auto; width: 14px; height: 14px; stroke: var(--text-2); fill: none; stroke-width: 2; flex: 0 0 auto; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); flex: 0 0 auto; }
.dot.ok { background: var(--pos); box-shadow: 0 0 0 3px var(--pos-soft); } .dot.warn { background: var(--warn); } .dot.off { background: var(--neg); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--r-ctl); color: var(--text-2); font-size: var(--fs-13); font-weight: 500; transition: background var(--t), color var(--t); position: relative; }
.nav a:hover { background: var(--hover); color: var(--text); } .nav a:active { background: var(--press); }
.nav a.active { color: var(--text); background: var(--accent-soft); }
.nav a.active svg { stroke: var(--accent); }
.nav svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; flex: 0 0 auto; transition: stroke var(--t); }
.sidebar .user { padding: 10px; border-top: 1px solid var(--border); font-size: var(--fs-13); display: flex; align-items: center; gap: 10px; }
.avatar { width: 26px; height: 26px; border-radius: 50%; display: inline-grid; place-items: center; background: var(--surface-2); border: 1px solid var(--border); font-size: 11px; font-weight: 600; }
.sidebar .user .role { color: var(--text-2); font-size: var(--fs-12); text-transform: capitalize; margin-left: auto; }
.menu { position: relative; }
.menu-list { position: absolute; z-index: 20; top: calc(100% + 6px); left: 0; right: 0; min-width: 220px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-card); box-shadow: var(--shadow-2); padding: 4px; display: none; animation: pop var(--t); }
.menu[open] .menu-list { display: block; }
.menu-list a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--r-ctl); font-size: var(--fs-13); transition: background var(--t); }
.menu-list a:hover { background: var(--hover); } .menu-list a.active { background: var(--accent-soft); }
summary { list-style: none; } summary::-webkit-details-marker { display: none; }
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(0.98); } to { opacity: 1; transform: none; } }

.main { min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px var(--gutter); border-bottom: 1px solid var(--border); position: sticky; top: 0; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px); z-index: 10; }
.topbar .right { display: flex; align-items: center; gap: 8px; }
.content { padding: 24px var(--gutter); max-width: 1440px; margin: 0 auto; display: flex; flex-direction: column; gap: 20px; }
.content.loading .tile, .content.loading .chart { position: relative; pointer-events: none; }
.content.loading .tile::after, .content.loading .chart::after { content: ""; position: absolute; inset: 0; border-radius: inherit; background: linear-gradient(90deg, var(--surface) 0%, var(--surface-2) 50%, var(--surface) 100%); background-size: 200% 100%; animation: shimmer 400ms linear infinite; opacity: 0.92; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---- controls ---- */
.btn { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: var(--r-ctl); border: 1px solid var(--border); background: var(--surface); color: var(--text); font-size: var(--fs-13); font-weight: 500; cursor: pointer; transition: background var(--t), border-color var(--t), color var(--t), transform var(--t), box-shadow var(--t); white-space: nowrap; }
.btn:hover { background: var(--surface-2); border-color: var(--border-2); } .btn:active { transform: scale(0.98); background: var(--press); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); box-shadow: 0 1px 2px rgba(0,0,0,0.2); }
.btn.primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn.destructive { color: var(--neg); border-color: color-mix(in srgb, var(--neg) 40%, var(--border)); }
.btn.destructive:hover { background: var(--neg-soft); }
.btn.sm { height: 28px; padding: 0 10px; font-size: var(--fs-12); }
.btn[disabled], .btn.disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn.loading::after { content: ""; width: 12px; height: 12px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin 600ms linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.input, .select { height: 32px; padding: 0 10px; border-radius: var(--r-ctl); border: 1px solid var(--border); background: var(--surface); color: var(--text); font-size: var(--fs-13); transition: border-color var(--t), box-shadow var(--t); }
.input:hover, .select:hover { border-color: var(--border-2); } .input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input::placeholder { color: var(--text-3); } .input.error { border-color: var(--neg); }
.search { position: relative; } .search svg { position: absolute; left: 9px; top: 9px; width: 14px; height: 14px; stroke: var(--text-3); fill: none; stroke-width: 2; }
.search .input { padding-left: 28px; width: 200px; }
.field { display: flex; flex-direction: column; gap: 4px; } .field label { font-size: var(--fs-12); color: var(--text-2); }
.field .help { font-size: var(--fs-12); color: var(--text-2); } .field .help.error { color: var(--neg); }
.seg { display: inline-flex; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-ctl); padding: 3px; gap: 2px; }
.seg a, .seg button { height: 26px; padding: 0 10px; border-radius: 6px; font-size: var(--fs-13); color: var(--text-2); display: inline-flex; align-items: center; background: transparent; border: 0; cursor: pointer; transition: background var(--t), color var(--t), transform var(--t); font-weight: 500; }
.seg a:hover, .seg button:hover { color: var(--text); background: var(--hover); } .seg a:active { transform: scale(0.97); }
.seg .active { color: var(--text); background: var(--surface-2); box-shadow: 0 1px 2px rgba(0,0,0,0.25), inset 0 0 0 1px var(--border-2); }
.seg kbd { display: none; } @media (min-width: 1200px) { .seg kbd { display: inline-block; } }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: var(--fs-13); cursor: pointer; }
.check input { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); }
.tabs a { padding: 8px 12px; font-size: var(--fs-13); color: var(--text-2); border-bottom: 2px solid transparent; margin-bottom: -1px; transition: color var(--t), border-color var(--t); }
.tabs a:hover { color: var(--text); } .tabs a.active { color: var(--text); border-bottom-color: var(--accent); }

/* ---- panel / tiles ---- */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-card); box-shadow: var(--shadow); overflow: hidden; transition: box-shadow var(--t), border-color var(--t); }
.panel-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.ph-l { display: flex; align-items: baseline; gap: 10px; min-width: 0; } .ph-l .meta { font-size: var(--fs-12); color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ph-r { display: flex; align-items: center; gap: 8px; }
.panel-b { padding: 16px; }
.tiles { display: grid; grid-template-columns: repeat(6, 1fr); }
.tiles.cols-4 { grid-template-columns: repeat(4, 1fr); } .tiles.cols-3 { grid-template-columns: repeat(3, 1fr); }
.tile { display: block; padding: 14px 16px 12px; border-right: 1px solid var(--border); min-width: 0; position: relative; transition: background var(--t); }
.tile:last-child { border-right: 0; }
a.tile:hover { background: var(--hover); }
.tile .label { font-size: var(--fs-12); color: var(--text-2); font-weight: 500; }
.tile .valrow { display: flex; align-items: baseline; gap: 8px; margin-top: 6px; flex-wrap: wrap; }
.tile .value { font-size: var(--fs-32); font-weight: 600; line-height: 1.1; letter-spacing: -0.02em; white-space: nowrap; }
.tile .value.na { color: var(--text-3); font-size: var(--fs-24); }
.tile .window { font-size: var(--fs-12); color: var(--text-3); margin-top: 4px; }
.delta { display: inline-flex; align-items: center; gap: 3px; font-size: var(--fs-13); font-weight: 600; padding: 1px 7px 1px 5px; border-radius: var(--r-pill); }
.delta.pos { color: var(--pos); background: var(--pos-soft); } .delta.neg { color: var(--neg); background: var(--neg-soft); }
.delta.flat, .delta.na { color: var(--text-2); background: var(--hover); }
.spark { display: block; width: 100%; height: var(--spark-h); margin-top: 10px; overflow: visible; }
.spark .line { fill: none; stroke: var(--text-2); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.spark .area { fill: var(--text-2); opacity: 0.08; }
.spark .last { fill: var(--text-2); }
.spark.pos .line, .spark.pos .last { stroke: var(--pos); fill: var(--pos); } .spark.pos .line { fill: none; } .spark.pos .area { fill: var(--pos); }
.spark.neg .line, .spark.neg .last { stroke: var(--neg); fill: var(--neg); } .spark.neg .line { fill: none; } .spark.neg .area { fill: var(--neg); }
.spark .last { r: 2; }

/* ---- charts ---- */
.chart { position: relative; width: 100%; }
.chart canvas { position: absolute; inset: 0; width: 100% !important; height: 100% !important; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: var(--fs-12); color: var(--text-2); padding: 0 16px 12px; }
.legend .lg { display: inline-flex; align-items: center; gap: 6px; } .legend i { width: 10px; height: 10px; border-radius: 3px; background: var(--text-3); display: inline-block; }
.lg.video i { background: var(--ch-video); } .lg.live i { background: var(--ch-live); } .lg.card i { background: var(--ch-card); } .lg.prev i { background: transparent; border: 1.5px dashed var(--text-2); border-radius: 0; height: 0; width: 12px; }
.lg.orders i { background: var(--accent); } .lg.visitors i { background: var(--info); }

/* ---- table ---- */
.table-wrap { overflow: auto; }
table.data { width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--fs-13); }
table.data th, table.data td { height: 40px; padding: 0 12px; border-bottom: 1px solid var(--border); text-align: left; white-space: nowrap; vertical-align: middle; }
table.data th { position: sticky; top: 0; background: var(--surface); color: var(--text-2); font-weight: 500; font-size: var(--fs-12); z-index: 1; }
table.data th.sorted { color: var(--text); }
table.data th.num, table.data td.num { text-align: right; }
table.data tbody tr { transition: background var(--t); } table.data tbody tr:hover { background: var(--hover); }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data td.primary { font-weight: 500; color: var(--text); }
table.data .bar { display: inline-block; height: 6px; border-radius: 3px; background: var(--accent); vertical-align: middle; margin-right: 8px; opacity: 0.9; }
.table-foot { display: flex; justify-content: space-between; align-items: center; padding: 8px 16px; border-top: 1px solid var(--border); font-size: var(--fs-12); color: var(--text-2); }

/* ---- status / chips ---- */
.chip { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 9px; border-radius: var(--r-pill); border: 1px solid var(--border); font-size: var(--fs-12); color: var(--text-2); background: var(--surface-2); transition: border-color var(--t), color var(--t); }
.chip.src:hover { color: var(--text); border-color: var(--border-2); }
.chip.video { color: var(--ch-video); border-color: transparent; background: rgba(244,55,88,0.12); } .chip.live { color: var(--ch-live); border-color: transparent; background: rgba(139,92,246,0.14); } .chip.card { color: var(--ch-card); border-color: transparent; background: rgba(20,184,166,0.14); }
.status { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-12); font-weight: 500; padding: 2px 8px 2px 6px; border-radius: var(--r-pill); }
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status.pending { color: var(--text-2); background: var(--hover); } .status.staged { color: var(--warn); background: var(--warn-soft); } .status.confirmed { color: var(--pos); background: var(--pos-soft); } .status.failed { color: var(--neg); background: var(--neg-soft); } .status.info { color: var(--info); background: var(--info-soft); }

/* ---- approval row ---- */
div.approval { display: grid; grid-template-columns: 24px 1fr auto; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); align-items: start; transition: background var(--t); }
div.approval:hover { background: var(--hover); } div.approval:last-child { border-bottom: 0; }
div.approval .who { font-weight: 500; } div.approval .evidence { display: flex; gap: 16px; flex-wrap: wrap; font-size: var(--fs-13); color: var(--text-2); margin-top: 2px; }
div.approval .evidence b { color: var(--text); font-weight: 500; }
div.approval .actions { display: flex; gap: 6px; align-items: center; }
div.approval .audit { grid-column: 2 / -1; font-size: var(--fs-12); color: var(--text-2); }
div.approval .confirm, .confirm-inline { display: inline-flex; gap: 6px; align-items: center; font-size: var(--fs-13); }
.bulkbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 16px; border-bottom: 1px solid var(--border); font-size: var(--fs-13); }

/* ---- thread ---- */
.thread { display: flex; flex-direction: column; gap: 16px; max-width: 760px; }
.msg { display: flex; flex-direction: column; gap: 6px; } .msg .meta { font-size: var(--fs-12); color: var(--text-2); }
.msg.user .body { align-self: flex-start; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-card); padding: 8px 12px; }
.msg.bot .body { white-space: pre-wrap; } .msg .sources { display: flex; flex-wrap: wrap; gap: 6px; }
.composer { display: flex; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--border); } .composer .input { flex: 1; }

/* ---- pane ---- */
.pane { position: fixed; top: 0; right: 0; width: 520px; height: 100vh; background: var(--surface); border-left: 1px solid var(--border); box-shadow: var(--shadow-2); z-index: 30; display: flex; flex-direction: column; animation: slide var(--t); }
@keyframes slide { from { transform: translateX(12px); opacity: 0; } to { transform: none; opacity: 1; } }
.pane-h { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.pane-b { overflow: auto; padding: 16px; display: flex; flex-direction: column; gap: 16px; }
.pane-scrim { position: fixed; inset: 0; z-index: 29; background: rgba(0,0,0,0.25); }
.kv { display: grid; grid-template-columns: 1fr auto; gap: 6px 16px; font-size: var(--fs-13); } .kv dt { color: var(--text-2); } .kv dd { margin: 0; text-align: right; }

/* ---- states ---- */
.empty, .error-state { padding: 20px 16px; display: flex; align-items: center; justify-content: space-between; gap: 16px; font-size: var(--fs-13); color: var(--text-2); }
.error-state { color: var(--neg); }
.inline-error { font-size: var(--fs-12); color: var(--neg); }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 40; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-card); box-shadow: var(--shadow-2); padding: 10px 14px; font-size: var(--fs-13); display: flex; gap: 10px; align-items: center; animation: toast-in var(--t); }
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.skeleton { background: var(--surface-2); border-radius: 4px; height: 14px; }
.hint { margin-top: auto; padding: 0 10px 8px; font-size: 11px; color: var(--text-3); display: flex; gap: 10px; flex-wrap: wrap; }
html[data-nav="collapsed"] .hint { display: none; }
.hint kbd { margin: 0 2px 0 0; }

/* ---- sign-in ---- */
.signin { min-height: 100vh; display: grid; grid-template-columns: 1fr; align-content: start; padding: 64px var(--gutter); gap: 24px; max-width: 420px; }
.signin .panel-b { display: flex; flex-direction: column; gap: 12px; }

/* ---- style page helpers ---- */
.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.swatch { padding: 12px 16px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); font-size: var(--fs-12); }
.swatch .chipbox { height: 32px; border-radius: var(--r-ctl); border: 1px solid var(--border); margin-bottom: 8px; }
.typerow { display: grid; grid-template-columns: 80px 1fr; gap: 16px; padding: 8px 16px; border-bottom: 1px solid var(--border); align-items: baseline; } .typerow:last-child { border-bottom: 0; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.demo { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.spacer { display: inline-block; background: var(--accent); opacity: 0.6; height: 12px; }

/* ---- mobile ---- */
.tabbar { display: none; }
@media (max-width: 767px) {
  :root { --gutter: 16px; }
  .shell { grid-template-columns: 1fr; } .sidebar { display: none; }
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; bottom: 0; left: 0; right: 0; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(10px); border-top: 1px solid var(--border); z-index: 20; padding-bottom: env(safe-area-inset-bottom); }
  .tabbar a { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 0 10px; font-size: 11px; color: var(--text-2); transition: color var(--t); }
  .tabbar a.active { color: var(--accent); }
  .tabbar svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
  .content { padding-bottom: 84px; }
  .topbar { flex-wrap: wrap; padding: 12px var(--gutter); gap: 10px; }
  .topbar .right { width: 100%; flex-wrap: wrap; }
  .topbar .right .seg { display: flex; width: 100%; } .topbar .right .seg a { flex: 1; justify-content: center; padding: 0 4px; font-size: var(--fs-12); }
  .topbar .right .search { width: 100%; } .topbar .right .search .input { width: 100%; }
  .tiles, .tiles.cols-4, .tiles.cols-3 { grid-template-columns: repeat(2, 1fr); }
  .tile { border-bottom: 1px solid var(--border); } .tile:nth-child(2n) { border-right: 0; }
  .tile .value { font-size: var(--fs-24); } .tile .valrow { gap: 6px; }
  .pane { width: 100%; }
  table.data th:not(.p1):not(.p2), table.data td:not(.p1):not(.p2) { display: none; }
  table.data th.p1, table.data td.p1 { position: sticky; left: 0; background: var(--surface); }
  .approval { grid-template-columns: 24px 1fr; } .approval .actions { grid-column: 2; }
  .signin { padding: 32px var(--gutter); } .hint { display: none; }
}

/* ===== v3 look (JD 2026-09-22: variant B + C's charts, merged into the one component set) ===== */
:root {
  --bg: #0C0E14; --surface: #151824; --surface-2: #1B1F2E; --border: #23283A; --border-2: #323A52;
  --shadow: 0 1px 0 rgba(255,255,255,0.03) inset, 0 2px 6px rgba(0,0,0,0.35), 0 18px 40px -20px rgba(0,0,0,0.75);
  --r-card: 14px; --r-ctl: 9px; --spark-h: 36px;
}
:root[data-theme="light"] { --bg: #F3F4F8; --surface: #FFFFFF; --surface-2: #F5F6FA; --border: #E6E8EF; --border-2: #D5D9E4; --shadow: 0 1px 2px rgba(17,24,39,0.05), 0 18px 40px -22px rgba(17,24,39,0.25); }
@media (prefers-color-scheme: light) { :root:not([data-theme="dark"]) { --bg: #F3F4F8; --surface: #FFFFFF; --surface-2: #F5F6FA; --border: #E6E8EF; --border-2: #D5D9E4; } }
.content { gap: 16px; padding-top: 20px; }
.sidebar { background: color-mix(in srgb, var(--surface) 70%, var(--bg)); }
.nav a.active { background: var(--accent-soft); color: var(--text); font-weight: 600; }
.panel { border-color: var(--border); }
.panel:hover { border-color: var(--border-2); }
/* hero */
/* tiles get more air, dividers softer, accent glow on hover */
.tiles { gap: 0; }
.tile { padding: 16px 20px 14px; }
.tile .label { font-size: var(--fs-13); }
a.tile:hover, .tile:hover { background: var(--hover); }
.tile .value { font-size: 30px; font-weight: 650; }
.spark .area { opacity: 0.12; }
.spark .line { stroke-width: 2; }
.btn.primary { box-shadow: 0 2px 8px rgba(244,55,88,0.35); }
.seg .active { background: var(--accent-soft); color: var(--accent); box-shadow: none; }
.topbar { border-bottom-color: transparent; background: transparent; backdrop-filter: none; position: static; }
.topbar h1 { font-size: var(--fs-24); letter-spacing: -0.02em; }
@media (max-width: 767px) { .hero { grid-template-columns: 1fr; } .hero .kpi .big { font-size: 36px; } .hero .stack { grid-template-rows: auto; grid-template-columns: 1fr 1fr; } }

:root { --r-card: 12px; --spark-h: 28px; }
.content { gap: 16px; }
.grid2 { display: grid; grid-template-columns: 1.5fr 1fr; gap: 16px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.tiles.compact .tile { padding: 12px 16px 10px; }
.tiles.compact .tile .value { font-size: var(--fs-24); }
.tiles.compact .spark { margin-top: 6px; height: 24px; }
.chart-panel .chart { margin: 8px 12px 4px; }
.mixbar { display: flex; height: 10px; border-radius: 5px; overflow: hidden; margin: 12px 16px 0; background: var(--surface-2); }
.mixbar i { display: block; height: 100%; } .mixbar .video { background: var(--ch-video); } .mixbar .live { background: var(--ch-live); } .mixbar .card { background: var(--ch-card); }
.mixlegend { display: flex; gap: 16px; padding: 8px 16px 12px; font-size: var(--fs-12); color: var(--text-2); flex-wrap: wrap; }
.mixlegend b { color: var(--text); font-weight: 600; }
table.data td .bar { background: var(--accent); }
.seg .active { box-shadow: inset 0 0 0 1px var(--border-2), 0 1px 2px rgba(0,0,0,0.25); }
@media (max-width: 767px) { .grid2, .grid3 { grid-template-columns: 1fr; } }

/* ===== Phase 1 additions: sub-tabs, source chips, tables with people/products, approvals table, filters, mobile more-menu ===== */
.tabs { margin: 4px 0 0; }
.tabs a { display: inline-flex; align-items: center; gap: 6px; }
.tabs .count { font-size: var(--fs-12); color: var(--text-3); background: var(--surface-2); border-radius: var(--r-pill); padding: 0 6px; min-width: 18px; text-align: center; }
.tabs a.active .count { color: var(--accent); background: var(--accent-soft); }
.chip.src { height: 18px; padding: 0 6px; font-size: 10.5px; letter-spacing: 0.02em; text-transform: uppercase; font-weight: 600; vertical-align: middle; }
.chip.src.cruva { color: #C084FC; background: rgba(168,85,247,0.14); border-color: transparent; }
.chip.src.tts { color: var(--ch-card); background: rgba(20,184,166,0.14); border-color: transparent; }
.chip.src.kalo { color: var(--info); background: var(--info-soft); border-color: transparent; }
.tile .label .chip.src { margin-left: 6px; }
.dot.bridge { background: #C084FC; }
.avatar.sm { width: 22px; height: 22px; font-size: 10px; margin-right: 8px; vertical-align: middle; overflow: hidden; }
.avatar.sm img { width: 100%; height: 100%; object-fit: cover; }
table.data td.prod { display: flex; align-items: center; gap: 10px; min-height: 44px; }
table.data td.prod .thumb { width: 32px; height: 32px; border-radius: 6px; object-fit: cover; background: var(--surface-2); flex: none; }
table.data td.prod .pname { display: block; line-height: 1.25; }
table.data td.prod .idsub { display: block; font-weight: 400; }
table.data th.chk, table.data td.chk { width: 32px; padding-right: 0; }
table.data td.act { white-space: nowrap; text-align: right; }
table.data td.act .btn + .btn { margin-left: 6px; }
table.data tr.selected td { background: var(--accent-soft); }
table.data tr.busy td { opacity: 0.6; }
table.data tr.approval.staged td { background: color-mix(in srgb, var(--warn-soft) 40%, transparent); }
table.data tr.audit-row td { padding: 0 16px 10px 56px; border-top: 0; }
table.data tr.audit-row .audit { font-size: var(--fs-12); color: var(--text-2); }
table.data tr.audit-row .audit::before { content: "↳ "; color: var(--text-3); }
.ful { font-weight: 600; } .ful.good { color: var(--pos); } .ful.warn { color: var(--warn); } .ful.bad { color: var(--neg); }
.filters { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.filters .input.num { width: 130px; }
.bulk { display: flex; gap: 8px; align-items: center; }
.tabbar .more { position: relative; }
.tabbar .more summary { list-style: none; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 10.5px; color: var(--text-3); padding: 6px 0; cursor: pointer; }
.tabbar .more summary::-webkit-details-marker { display: none; }
.tabbar .more summary svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.8; }
.tabbar .more summary.active { color: var(--accent); }
.tabbar .more .more-list { position: absolute; bottom: 52px; right: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-card); box-shadow: var(--shadow-2); padding: 6px; display: grid; grid-template-columns: 1fr 1fr; gap: 2px; min-width: 240px; }
.tabbar .more .more-list a { flex-direction: row; gap: 8px; padding: 8px 10px; font-size: var(--fs-13); border-radius: var(--r-ctl); }
.tabbar .more .more-list a svg { width: 16px; height: 16px; }
@media (max-width: 767px) {
  .filters { width: 100%; } .filters .search, .filters .search .input { width: 100%; } .filters .input.num { flex: 1; }
  table.data td.prod { min-height: 0; }
  .bulk { width: 100%; justify-content: space-between; }
  table.data td.act { text-align: left; }
}

/* ===== Creators + CRM ===== */
.grid2.narrow { grid-template-columns: 320px 1fr; }
.tiles.cols-5 { grid-template-columns: repeat(5, 1fr); }
.tiles.panel { padding: 0; }
.list { display: flex; flex-direction: column; }
.list .row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--border); font-size: var(--fs-13); color: var(--text); transition: background var(--t); }
.list .row:hover { background: var(--hover); } .list .row.active { background: var(--accent-soft); box-shadow: inset 2px 0 0 var(--accent); }
.list .row:last-child { border-bottom: 0; }
.stackform .fields { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 16px 16px; align-items: center; }
.stackform .fields .input { width: 140px; } .stackform .fields .input[name=name] { width: 200px; }
select.input { appearance: none; padding-right: 26px; background-image: linear-gradient(45deg, transparent 50%, var(--text-3) 50%), linear-gradient(135deg, var(--text-3) 50%, transparent 50%); background-position: calc(100% - 13px) 55%, calc(100% - 9px) 55%; background-size: 4px 4px; background-repeat: no-repeat; }
table.data th a { color: inherit; } table.data th a.sorted { color: var(--accent); }
.check { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); }
.check input { accent-color: var(--accent); }
@media (max-width: 767px) { .grid2.narrow { grid-template-columns: 1fr; } .tiles.cols-5 { grid-template-columns: 1fr 1fr; } .stackform .fields .input, .stackform .fields .input[name=name] { width: 100%; } }

/* ===== Analytics ===== */
table.data.cohort td.cell { background: color-mix(in srgb, var(--accent) calc(var(--h) * 70%), transparent); color: var(--text); }
.tiles.cols-6.panel { padding: 0; }
.pad { padding: 12px 16px; } .row-gap { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }

/* ===== Content + public brief ===== */
.stackform .fields.col { flex-direction: column; align-items: stretch; } .stackform .fields.col .input { width: 100%; }
textarea.input { height: auto; padding: 10px 12px; line-height: 1.45; resize: vertical; font-family: inherit; }
body.public { display: block; }
.public-wrap { max-width: 760px; margin: 0 auto; padding: 32px 16px; }
.public-h { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.brief-body { white-space: pre-wrap; line-height: 1.55; margin-top: 12px; }
.brief-videos { display: flex; gap: 8px; flex-wrap: wrap; }

/* ===== Outreach ===== */
.thread { display: flex; flex-direction: column; gap: 10px; padding: 12px 16px; max-height: 480px; overflow: auto; }
.msg { max-width: 78%; } .msg.out { align-self: flex-end; text-align: right; } .msg.in { align-self: flex-start; }
.msg .bubble { display: inline-block; padding: 8px 12px; border-radius: 12px; background: var(--surface-2); text-align: left; }
.msg.out .bubble { background: var(--accent-soft); }
.msg.staged .bubble { border: 1px dashed var(--warn); background: var(--warn-soft); }
.msg .audit { font-size: var(--fs-12); color: var(--text-2); margin-top: 2px; }
.tiles.cols-3 { grid-template-columns: repeat(3, 1fr); }
.neg { color: var(--neg); }

/* wide tables scroll inside their panel instead of pushing the page */
.table-wrap { overflow-x: auto; max-width: 100%; }
.panel { min-width: 0; }
.content { min-width: 0; }

/* ===== Ask / Expert / Reports ===== */
.ask-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
@media (max-width: 1000px) { .ask-grid { grid-template-columns: 1fr; } }
.askform textarea.input { width: 100%; resize: vertical; font: inherit; line-height: 1.45; padding: 10px 12px; }
.answer { margin-top: 16px; padding: 16px; border-radius: var(--r); background: var(--bg-2); border: 1px solid var(--line); }
.answer-q { margin-bottom: 8px; }
.answer-body p { margin: 0 0 10px; line-height: 1.55; font-size: 14px; }
.answer-meta { margin: 8px 0 12px; }
.sources { border-top: 1px solid var(--line); padding-top: 10px; }
.sources ol { margin: 0; padding-left: 18px; font-size: 13px; }
.sources li { margin: 0 0 10px; }
.sources .quote { color: var(--fg-2); font-size: 12.5px; margin-top: 2px; line-height: 1.45; }
.tool-out { white-space: pre-wrap; font-size: 12px; background: var(--bg-3); padding: 10px; border-radius: 8px; max-height: 360px; overflow: auto; }
.hist { list-style: none; margin: 0; padding: 0; }
.hist li { padding: 8px 0; border-bottom: 1px solid var(--line); }
.linklike { background: none; border: 0; padding: 0; color: var(--fg); font: inherit; text-align: left; cursor: pointer; }
.linklike:hover { color: var(--accent); }
.knowhow { list-style: none; margin: 0; padding: 0; }
.knowhow li { padding: 12px 0; border-bottom: 1px solid var(--line); }
.knowhow li strong { display: block; margin: 6px 0 2px; font-size: 14px; }
.knowhow li p { margin: 0; font-size: 13.5px; line-height: 1.5; color: var(--fg-2); }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 6px 12px; margin: 0; font-size: 13px; }
.kv dt { color: var(--fg-3); } .kv dd { margin: 0; }
.public-head { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.public-wrap.wide { max-width: 960px; }
/* ===== JD pick 2026-09-23: variant A (refined) folded into the base ===== */
:root { --r-card: 12px; --r-ctl: 8px; --shadow: 0 1px 2px rgba(0,0,0,0.18); --spark-h: 28px; }
:root[data-theme="light"] { --shadow: 0 1px 2px rgba(17,24,39,0.06); }
.content { gap: 14px; }
.panel:hover { border-color: var(--border); transform: none; }
.tile { padding: 14px 16px 12px; }
.tile .value { font-size: var(--fs-32); font-weight: 600; letter-spacing: -0.02em; }
.tile .label { font-size: var(--fs-12); }
.spark .area { opacity: 0.06; }
.grid2.even { grid-template-columns: 1fr 1fr; }
.chart-panel .chart { margin: 6px 12px 2px; }
table.data td .bar { display: none; }
.tabs a.active { border-bottom-color: var(--text); }
.nav a.active { background: transparent; color: var(--text); box-shadow: inset 2px 0 0 var(--accent); border-radius: 0; }
.nav a.active svg { stroke: var(--text); }
/* 390 nit from the variant review: two-column tiles let long values touch the neighbour */
@media (max-width: 767px) {
  .grid2.even { grid-template-columns: 1fr; }
  .tiles, .tiles.cols-4, .tiles.cols-6, .tiles.cols-5, .tiles.cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tile { padding: 12px 12px 10px; }
  .tile .value { font-size: 24px; }
  .tile .valrow { gap: 6px; }
  .tile:nth-child(odd) { border-right: 1px solid var(--border); } .tile:nth-child(even) { border-right: 0; }
}

/* ===== public legal/help pages ===== */
.public-nav { margin-left: auto; display: flex; gap: 14px; font-size: var(--fs-13); }
.public-nav a { color: var(--text-2); text-decoration: none; } .public-nav a.active, .public-nav a:hover { color: var(--text); }
.legal .panel-b { padding: 24px 28px 28px; }
.legal h1 { font-size: 24px; font-weight: 650; letter-spacing: -0.02em; margin: 0 0 4px; }
.legal h2 { font-size: var(--fs-14); font-weight: 600; margin: 22px 0 6px; }
.legal p { font-size: var(--fs-14); line-height: 1.6; margin: 0 0 10px; color: var(--text); max-width: 72ch; }

.panel.confirm { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft), var(--shadow); }
.panel.confirm .panel-b { padding: 16px 20px 18px; }
.panel.confirm h2 { margin: 0 0 6px; }
