/* Peak Medium for Shops — demo. Same design system as the agency dashboard (agency-dashboard/frontend/styles.css):
   ink/paper/greys everywhere, ember is the one focal point per view. Every colour is a token; light = one swap. */
:root, [data-theme="dark"] {
  color-scheme: dark;
  --bg: #0A0A0C;
  --fg: #F2EFEA;
  --surface: #141417;
  --surface-2: #1C1C20;
  --surface-3: #232328;
  --line: #26262B;
  --muted: #8E8A84;
  --faint: #7A7670;
  --bar: #4A4A52;
  --bar-hot: var(--fg);
  --ember: #FF6B1F;
  --ember-hot: #FFB46A;
  --ember-glow: rgba(255, 107, 31, .35);
  --focal-line: rgba(255, 107, 31, .45);
  --topbar-bg: rgba(10, 10, 12, .9);
  --up: #2FBF71;
  --down: #E5484D;
  --warn: #F5A524;
  --up-bg: rgba(47, 191, 113, .12);
  --down-bg: rgba(229, 72, 77, .12);
  --warn-bg: rgba(245, 165, 36, .12);
  --area: rgba(242, 239, 234, .07);
  --heat: #FF6B1F;
  --heat-empty: #222227;
  --scrim: rgba(0, 0, 0, .55);
  --shadow: 0 24px 64px -24px rgba(0, 0, 0, .7);
}
[data-theme="light"] {
  color-scheme: light;
  --bg: #F2EFEA;
  --fg: #0A0A0C;
  --surface: #FAF8F4;
  --surface-2: #EFEBE4;
  --surface-3: #E7E2DA;
  --line: #E2DDD5;
  --muted: #6B665F;
  --faint: #736D65;
  --bar: #BDB6AB;
  --ember: #C2410C;
  --ember-hot: #9A3412;
  --ember-glow: rgba(255, 107, 31, .30);
  --focal-line: rgba(194, 65, 12, .45);
  --topbar-bg: rgba(242, 239, 234, .9);
  --up: #136B3E;
  --down: #C62A2F;
  --warn: #9A5400;
  --up-bg: rgba(19, 107, 62, .1);
  --down-bg: rgba(198, 42, 47, .1);
  --warn-bg: rgba(154, 84, 0, .1);
  --area: rgba(10, 10, 12, .06);
  --heat: #E8590C;
  --heat-empty: #E9E4DC;
  --scrim: rgba(10, 10, 12, .35);
  --shadow: 0 24px 64px -24px rgba(10, 10, 12, .35);
}
:root { --radius: 16px; --side: 256px; font-family: "Archivo", system-ui, -apple-system, "Segoe UI", sans-serif; }
* { box-sizing: border-box; }
html { background: var(--bg); }
body { margin: 0; background: var(--bg); color: var(--fg); font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: var(--fg); text-decoration: none; }
a:hover { color: var(--ember-hot); }
button { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; }
.num, td.num, .delta, .tabular { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 13px; }
.mobile-only { display: none !important; }
:focus-visible { outline: 2px solid var(--ember); outline-offset: 2px; border-radius: 6px; }
[data-theme="dark"] .logo-light, [data-theme="light"] .logo-dark { display: none; }

/* ---------- sidebar (desktop) */
.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--side); display: flex; flex-direction: column; gap: 32px;
  padding: 28px 20px 24px; background: var(--bg); z-index: 6; }
.brand { display: flex; align-items: center; gap: 12px; color: var(--fg); padding: 0 12px; }
.brand:hover { color: var(--fg); }
.brand img { display: block; width: 36px; height: auto; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.wordmark { font-weight: 800; font-stretch: 125%; font-size: 15px; letter-spacing: .01em; text-transform: uppercase; }
.product { color: var(--muted); font-size: 13px; }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav a { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-radius: 12px; color: var(--muted);
  font-weight: 600; font-size: 14px; transition: background .15s, color .15s; }
.nav a svg, .tabbar a svg { width: 20px; height: 20px; flex: none; }
.nav a:hover { background: var(--surface); color: var(--fg); }
.nav a[aria-current="page"] { background: var(--surface-2); color: var(--fg); }
.nav a[aria-current="page"] svg { color: var(--ember); }
.nav .soon { margin-left: auto; font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--faint);
  border: 1px solid var(--line); border-radius: 999px; padding: 2px 8px; }
.shop-card { margin-top: auto; display: flex; gap: 12px; align-items: center; padding: 16px; border: 1px solid var(--line);
  border-radius: 14px; background: var(--surface); }
.shop-card strong { display: block; font-size: 14px; }
.shop-card .small { display: block; font-size: 12px; }
.shop-avatar { width: 36px; height: 36px; border-radius: 10px; background: var(--surface-3); display: grid; place-items: center;
  font-weight: 800; font-stretch: 120%; }

/* ---------- top bar */
.shell { margin-left: var(--side); min-height: 100vh; border-left: 1px solid var(--line); }
.topbar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 24px;
  padding: 18px 48px; background: var(--topbar-bg); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line); }
.crumbs { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--muted); min-width: 0; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--fg); }
.crumbs strong { color: var(--fg); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crumbs .sep { color: var(--faint); }
.controls { display: flex; align-items: center; gap: 16px; flex: none; }
.badge { white-space: nowrap; padding: 6px 12px; border-radius: 999px; font-size: 11px; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; border: 1px solid var(--line); color: var(--muted); }
.badge.demo { color: var(--warn); border-color: color-mix(in oklab, var(--warn) 45%, transparent); background: var(--warn-bg); }
.as-of { color: var(--faint); font-size: 13px; white-space: nowrap; }
.icon-btn { width: 40px; height: 40px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface);
  display: grid; place-items: center; cursor: pointer; color: var(--muted); transition: color .15s, border-color .15s; }
.icon-btn:hover { color: var(--fg); border-color: var(--faint); }
.icon-btn svg { width: 18px; height: 18px; }

/* ---------- page */
main { max-width: 1360px; margin: 0 auto; padding: 40px 48px 96px; display: grid; gap: 32px; outline: none; }
main > *, .split > *, .kpis > *, .grid-3 > * { min-width: 0; }
main.enter > * { animation: rise .32s cubic-bezier(.2, .7, .2, 1) both; }
main.enter > *:nth-child(2) { animation-delay: .03s; }
main.enter > *:nth-child(3) { animation-delay: .06s; }
main.enter > *:nth-child(n+4) { animation-delay: .09s; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { main.enter > * { animation: none; } }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.page-head h1 { font-size: 34px; line-height: 1.1; font-weight: 800; font-stretch: 112%; letter-spacing: -.01em; }
.page-head .meta { color: var(--muted); font-size: 14px; margin-top: 8px; max-width: 70ch; }
.back { display: inline-flex; gap: 6px; align-items: center; color: var(--muted); font-size: 14px; margin-bottom: 14px; }
.split { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 32px; }
.split.even { grid-template-columns: 1fr 1fr; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; }

/* Cards: >= 32px padding. */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 32px; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 28px; flex-wrap: wrap; }
.card h2 { font-size: 18px; font-weight: 700; font-stretch: 105%; }
.card h3 { font-size: 15px; font-weight: 700; }
.card .sub { color: var(--muted); font-size: 13px; margin: 6px 0 0; max-width: 62ch; }
.card.flush { padding: 32px 0 0; }
.card.flush > .card-head, .card.flush > .filters { padding: 0 32px; }

/* ---------- KPIs */
.kpis { display: grid; grid-template-columns: 1.3fr repeat(4, minmax(0, 1fr)); gap: 24px; }
.kpis.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 32px;
  display: flex; flex-direction: column; gap: 8px; }
.kpi .label { color: var(--muted); font-size: 13px; font-weight: 500; }
.kpi .value { font-size: 30px; font-weight: 700; font-stretch: 110%; line-height: 1.15; letter-spacing: -.01em; }
.kpi .hint { color: var(--faint); font-size: 12px; }
.kpi.focal { border-color: var(--focal-line); box-shadow: 0 0 48px -24px var(--ember-glow); }
.kpi.focal .label { color: var(--fg); }
.kpi.focal .value { color: var(--ember); font-size: 40px; }
.delta { display: inline-flex; align-items: baseline; flex-wrap: wrap; column-gap: 8px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.delta.up { color: var(--up); }
.delta.down { color: var(--down); }
.delta.flat { color: var(--muted); font-weight: 500; }
.delta .vs { color: var(--faint); font-weight: 400; white-space: normal; }

/* ---------- segmented + chips + buttons + inputs */
.segmented { display: inline-flex; padding: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; }
.card .segmented { background: var(--bg); }
.segmented button { border: 0; background: none; padding: 8px 16px; border-radius: 999px; font-size: 13px; font-weight: 600;
  color: var(--muted); cursor: pointer; transition: background .15s, color .15s; white-space: nowrap; }
.segmented button:hover { color: var(--fg); }
.segmented button[aria-checked="true"] { background: var(--fg); color: var(--bg); }
.filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: 24px; }
.chip { border: 1px solid var(--line); background: transparent; border-radius: 999px; padding: 8px 16px; font-size: 13px;
  font-weight: 600; color: var(--muted); cursor: pointer; transition: all .15s; white-space: nowrap; display: inline-flex; gap: 8px; align-items: center; }
.chip:hover { color: var(--fg); border-color: var(--faint); }
.chip[aria-pressed="true"] { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.chip .count { font-size: 12px; opacity: .7; font-variant-numeric: tabular-nums; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: 999px; padding: 10px 20px;
  font-size: 14px; font-weight: 700; border: 1px solid var(--line); background: var(--surface-2); color: var(--fg); cursor: pointer;
  transition: background .15s, border-color .15s, transform .1s; white-space: nowrap; }
.btn:hover { border-color: var(--faint); color: var(--fg); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--ember); border-color: var(--ember); color: #0A0A0C; }
[data-theme="light"] .btn.primary { color: #FAF8F4; }
.btn.primary:hover { background: var(--ember-hot); border-color: var(--ember-hot); }
.btn.small { padding: 7px 14px; font-size: 13px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.field { display: flex; flex-direction: column; gap: 8px; font-size: 13px; color: var(--muted); font-weight: 500; }
.input, select.input, textarea.input { font: inherit; font-size: 14px; color: var(--fg); background: var(--bg); border: 1px solid var(--line);
  border-radius: 12px; padding: 11px 14px; outline: none; transition: border-color .15s; width: 100%; }
.input:focus { border-color: var(--faint); }
textarea.input { resize: vertical; min-height: 140px; line-height: 1.55; }
.search { position: relative; flex: 1 1 260px; max-width: 360px; }
.search svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--faint); }
.search .input { padding-left: 40px; border-radius: 999px; }
select.input { appearance: none; -webkit-appearance: none; padding-right: 36px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238E8A84' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; }
.filters select.input { width: auto; border-radius: 999px; padding-top: 8px; padding-bottom: 8px; font-size: 13px; font-weight: 600; }

/* ---------- tables: cells >= 32px horizontal / 24px vertical */
.table-wrap { overflow-x: auto; margin: 0 -32px -32px; -webkit-overflow-scrolling: touch; }
.card.flush .table-wrap { margin: 0; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 24px 32px; text-align: left; border-top: 1px solid var(--line); white-space: nowrap; vertical-align: middle; }
th { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; border-top: none; padding-top: 0; }
th.num, td.num { text-align: right; }
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--fg); }
th[aria-sort] { color: var(--fg); }
th[aria-sort="descending"]::after { content: " ↓"; }
th[aria-sort="ascending"]::after { content: " ↑"; }
td .sub-line { color: var(--muted); font-size: 13px; margin-top: 2px; }
tbody tr { transition: background .12s; }
tr.clickable { cursor: pointer; }
tr.clickable:hover { background: var(--surface-2); }
.who { display: flex; align-items: center; gap: 14px; min-width: 0; }
.who .names { min-width: 0; }
.who strong { display: block; font-weight: 700; }
.avatar { width: 40px; height: 40px; border-radius: 999px; flex: none; display: grid; place-items: center; font-weight: 700; font-size: 14px;
  background: var(--surface-3); color: var(--fg); text-transform: uppercase; }
.avatar.lg { width: 72px; height: 72px; font-size: 24px; }
.empty { padding: 48px 32px; text-align: center; color: var(--muted); }
.more-row { display: flex; justify-content: center; padding: 24px; border-top: 1px solid var(--line); }

/* status pills — colour always paired with a word + symbol */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 600;
  border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 999px; background: currentColor; }
.pill.good { color: var(--up); background: var(--up-bg); border-color: transparent; }
.pill.bad { color: var(--down); background: var(--down-bg); border-color: transparent; }
.pill.warn { color: var(--warn); background: var(--warn-bg); border-color: transparent; }
.pill.neutral { color: var(--fg); }
.pill.plain::before { display: none; }
.tag { display: inline-block; padding: 3px 9px; border-radius: 8px; font-size: 12px; font-weight: 600; background: var(--surface-2); color: var(--muted); }

/* ---------- charts */
.chart { position: relative; }
.chart svg { display: block; width: 100%; overflow: visible; }
.card.fill { display: flex; flex-direction: column; }
.chart.fill { flex: 1; min-height: 280px; position: relative; }
.chart.fill > svg { position: absolute; inset: 0; height: 100%; }
td.wrap { white-space: normal; min-width: 220px; }
td.wrap strong { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.chart .axis { fill: var(--faint); font-size: 11px; font-family: inherit; font-variant-numeric: tabular-nums; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .base { stroke: var(--faint); stroke-width: 1; opacity: .6; }
.chart .area { fill: var(--area); }
.chart .line { fill: none; stroke: var(--fg); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .line.soft { stroke: var(--muted); }
.chart .crosshair { stroke: var(--faint); stroke-width: 1; }
.chart .dot { fill: var(--fg); stroke: var(--surface); stroke-width: 2; }
.chart .bar { fill: var(--bar); transition: fill .12s; }
.chart .bar.hot, .chart .bar:hover { fill: var(--bar-hot); }
.chart .bar.focal { fill: var(--ember); }
.chart .hit { fill: transparent; cursor: crosshair; }
.chart .end-label { fill: var(--fg); font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; }
.legend { display: flex; gap: 20px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.legend i { display: inline-block; width: 14px; height: 2px; border-radius: 2px; background: var(--fg); vertical-align: middle; margin-right: 8px; }
.tooltip { position: fixed; pointer-events: none; background: var(--fg); color: var(--bg); padding: 12px 14px; border-radius: 12px;
  font-size: 12px; font-weight: 500; display: none; z-index: 30; font-variant-numeric: tabular-nums; max-width: 280px; line-height: 1.55;
  box-shadow: var(--shadow); }
.tooltip b { font-weight: 700; display: block; margin-bottom: 2px; font-size: 13px; }
.tooltip .row { display: flex; justify-content: space-between; gap: 18px; }
.tooltip .row span:first-child { opacity: .7; }

/* meters (plan progress) */
.meter { height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.meter > span { display: block; height: 100%; border-radius: 999px; background: var(--fg); transition: width .6s cubic-bezier(.2, .7, .2, 1); }
.meter.ember > span { background: var(--ember); }
.meter.good > span { background: var(--up); } .meter.bad > span { background: var(--down); } .meter.warn > span { background: var(--warn); } .meter.neutral > span { background: var(--muted); }

/* heat steps (map) — one ember ramp mixed into the card surface */
.hm-0 { fill: var(--heat-empty); background: var(--heat-empty); }
.hm-1 { fill: color-mix(in oklab, var(--heat) 26%, var(--surface)); background: color-mix(in oklab, var(--heat) 26%, var(--surface)); }
.hm-2 { fill: color-mix(in oklab, var(--heat) 48%, var(--surface)); background: color-mix(in oklab, var(--heat) 48%, var(--surface)); }
.hm-3 { fill: color-mix(in oklab, var(--heat) 72%, var(--surface)); background: color-mix(in oklab, var(--heat) 72%, var(--surface)); }
.hm-4 { fill: var(--heat); background: var(--heat); }

/* video thumbnail placeholder (9:16) */
.thumb { width: 40px; aspect-ratio: 9 / 16; border-radius: 8px; background: var(--surface-3); flex: none; position: relative;
  display: grid; place-items: center; overflow: hidden; }
.thumb::after { content: ""; position: absolute; inset: auto 0 0 0; height: 40%; background: linear-gradient(transparent, rgba(0,0,0,.35)); }
.thumb svg { width: 16px; height: 16px; color: var(--fg); opacity: .85; position: relative; z-index: 1; }
.thumb:not(.lg) .t-label { display: none; }
.thumb .t-label { position: absolute; left: 4px; right: 4px; bottom: 4px; font-size: 8px; line-height: 1.1; font-weight: 700; color: #F2EFEA;
  z-index: 1; text-align: center; letter-spacing: .02em; }
.thumb.lg { width: 100%; border-radius: 12px; }
.thumb.lg svg { width: 28px; height: 28px; }
.thumb.lg .t-label { font-size: 11px; bottom: 10px; }

/* drawer + toast */
.scrim { position: fixed; inset: 0; background: var(--scrim); z-index: 20; opacity: 0; transition: opacity .2s; }
.scrim.open { opacity: 1; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(520px, 100vw); background: var(--surface); border-left: 1px solid var(--line);
  z-index: 21; transform: translateX(100%); transition: transform .28s cubic-bezier(.2, .7, .2, 1); display: flex; flex-direction: column;
  box-shadow: var(--shadow); }
.drawer.open { transform: none; }
.drawer-head { padding: 32px 32px 24px; border-bottom: 1px solid var(--line); display: flex; gap: 16px; align-items: flex-start; justify-content: space-between; }
.drawer-body { padding: 28px 32px; overflow-y: auto; display: grid; gap: 22px; align-content: start; flex: 1; }
.drawer-foot { padding: 20px 32px calc(20px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); display: flex; gap: 12px; justify-content: flex-end; align-items: center; }
.check { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; font-size: 14px; color: var(--fg); }
.check input { accent-color: var(--ember); width: 16px; height: 16px; }
.check .muted { margin-left: auto; font-size: 13px; }
.toast { position: fixed; left: 50%; bottom: 32px; transform: translate(-50%, 20px); background: var(--fg); color: var(--bg); padding: 14px 20px;
  border-radius: 14px; font-size: 14px; font-weight: 600; opacity: 0; pointer-events: none; transition: all .25s; z-index: 40; box-shadow: var(--shadow);
  max-width: calc(100vw - 32px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* misc */
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 24px; margin: 0; }
.facts dt { color: var(--muted); font-size: 12px; margin-bottom: 6px; }
.facts dd { margin: 0; font-size: 20px; font-weight: 700; font-stretch: 108%; }
.rank-list { list-style: none; margin: 0; padding: 0; display: grid; }
.rank-list li { display: flex; align-items: center; gap: 16px; padding: 16px 0; border-top: 1px solid var(--line); }
.rank-list li:first-child { border-top: 0; padding-top: 0; }
.rank-list .r { color: var(--faint); width: 20px; font-size: 13px; font-variant-numeric: tabular-nums; }
.rank-list .grow { flex: 1; min-width: 0; }
.rank-list .grow strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-list .val { text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; }
.rank-list .val .sub-line { font-weight: 400; color: var(--muted); font-size: 12px; }
.note { font-size: 13px; color: var(--faint); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- tab bar (phone) */
.tabbar { display: none; }

@media (max-width: 1280px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .kpis .kpi.focal { grid-column: span 3; }
  .kpis.four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1100px) {
  :root { --side: 216px; }
  .split, .split.even { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr; }
  main { padding: 32px 32px 96px; }
  .topbar { padding: 16px 32px; }
}
@media (max-width: 860px) {
  .sidebar { display: none; }
  .shell { margin-left: 0; border-left: 0; }
  .mobile-only { display: flex !important; }
  .desktop-only { display: none !important; }
  body { font-size: 14px; }
  .topbar { padding: calc(12px + env(safe-area-inset-top)) 16px 12px; gap: 12px; }
  .crumbs { font-size: 14px; flex: 1; }
  .crumbs .crumb-parent, .crumbs .sep { display: none; }
  .badge { padding: 5px 10px; font-size: 10px; }
  .icon-btn { width: 36px; height: 36px; }
  main { padding: 24px 16px calc(112px + env(safe-area-inset-bottom)); gap: 20px; }
  .page-head h1 { font-size: 28px; }
  .kpis, .kpis.four { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .kpis .kpi.focal { grid-column: span 2; }
  .kpi { padding: 24px; }
  .kpi.focal { padding: 28px; }
  .kpi .value { font-size: 22px; }
  .kpi.focal .value { font-size: 36px; }
  .card { padding: 28px 24px; }
  .card.flush { padding: 28px 0 0; }
  .card.flush > .card-head, .card.flush > .filters { padding: 0 24px; }
  .table-wrap { margin: 0 -24px -28px; }
  th, td { padding: 20px 24px; }
  .hide-m { display: none; }
  .filters { flex-wrap: nowrap; overflow-x: auto; margin-left: -24px; margin-right: -24px; padding-left: 24px; padding-right: 24px;
    scrollbar-width: none; }
  .filters::-webkit-scrollbar { display: none; }
  .card.flush > .filters { margin-left: 0; margin-right: 0; }
  td.wrap { min-width: 0; }
  .m-pill { margin-top: 10px; }
  th + th, td + td { padding-left: 8px; }
  td.wrap .who .names { white-space: normal; }
  .search { flex: 1 1 100%; max-width: none; }
  /* With a search box the bar wraps (search on its own row) instead of scrolling sideways and clipping it. */
  .filters:has(.search) { flex-wrap: wrap; overflow: visible; }
  .drawer { top: auto; left: 0; width: 100%; max-height: 92vh; border-left: 0; border-top: 1px solid var(--line);
    border-radius: 20px 20px 0 0; transform: translateY(100%); }
  .drawer.open { transform: none; }
  .drawer-head { padding: 24px 24px 20px; }
  .drawer-body { padding: 24px; }
  .drawer-foot { padding: 16px 24px calc(16px + env(safe-area-inset-bottom)); }
  .toast { bottom: calc(96px + env(safe-area-inset-bottom)); }
  .tabbar { display: grid; grid-template-columns: repeat(7, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 8;
    background: var(--topbar-bg); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-top: 1px solid var(--line);
    padding: 8px 4px calc(8px + env(safe-area-inset-bottom)); }
  .tabbar a { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px 0; color: var(--faint);
    font-size: 10px; font-weight: 600; letter-spacing: .01em; border-radius: 10px; }
  .tabbar a[aria-current="page"] { color: var(--fg); }
  .tabbar a[aria-current="page"] svg { color: var(--ember); }
}

/* ---------- plan card (0 -> 1K affiliates) */
.plan-grid { display: grid; grid-template-columns: minmax(240px, 1fr) 3fr; gap: 48px; align-items: start; }
.plan .plan-total { display: flex; align-items: baseline; gap: 10px; margin: 28px 0 14px; }
.plan .plan-total .big { font-size: 44px; font-weight: 700; font-stretch: 110%; line-height: 1; letter-spacing: -.01em; }
.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; }
.step { position: relative; padding: 0 28px; border-left: 1px solid var(--line); }
.step-n { width: 36px; height: 36px; border-radius: 999px; display: grid; place-items: center; font-weight: 700; font-size: 14px;
  border: 2px solid var(--line); color: var(--muted); background: var(--surface); margin-bottom: 16px; }
.step-n svg { width: 18px; height: 18px; }
.step.done .step-n { background: var(--fg); border-color: var(--fg); color: var(--bg); }
.step.now .step-n { border-color: var(--fg); color: var(--fg); }
.step-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.step-title strong { font-size: 16px; }
.step p { margin: 8px 0 14px; color: var(--muted); font-size: 14px; }
.step.next p { color: var(--faint); }
.step-progress { display: grid; gap: 8px; }
.nowrap { white-space: nowrap; }
td.w50 { width: 50%; }
@media (max-width: 1100px) {
  .plan-grid { grid-template-columns: 1fr; gap: 32px; }
}
@media (max-width: 860px) {
  .steps { grid-template-columns: 1fr; gap: 0; }
  .step { display: grid; grid-template-columns: 36px 1fr; column-gap: 16px; padding: 0 0 24px; border-left: 0; }
  .step:last-child { padding-bottom: 0; }
  .step-n { margin-bottom: 0; }
  .step:not(:last-child)::before { content: ""; position: absolute; left: 17px; top: 40px; bottom: 4px; width: 2px; background: var(--line); border-radius: 2px; }
  .step-title { min-height: 36px; }
}

/* ---------- find creators */
.results-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: -8px; font-size: 14px; }
.creator-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 24px; }
.card.creator { display: flex; flex-direction: column; gap: 20px; transition: border-color .15s; }
.card.creator:hover { border-color: var(--faint); }
.creator-top { display: flex; gap: 14px; align-items: center; min-width: 0; }
.creator-top .names { flex: 1; min-width: 0; }
.creator-top strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.creator-top .sub-line { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.match { display: flex; flex-direction: column; align-items: center; font-size: 20px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.match small { font-size: 10px; font-weight: 600; color: var(--faint); text-transform: uppercase; letter-spacing: .08em; margin-top: 4px; }
.creator-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.creator-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px 16px; margin: 0; }
.creator-stats dt { color: var(--faint); font-size: 12px; margin-bottom: 4px; }
.creator-stats dd { margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; }
.creator-aud { margin: 0; }
.card.creator .btn { margin-top: auto; }
@media (max-width: 860px) { .creator-grid { grid-template-columns: 1fr; gap: 16px; } }

/* ---------- campaigns / samples / map / ads (v2: workspace-12) */
.facts.list { grid-template-columns: 1fr; gap: 0; margin-top: 28px; border-top: 1px solid var(--line); }
.facts.list > div { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.facts.list > div:last-child { border-bottom: 0; padding-bottom: 0; }
.facts.list dt { margin: 0; font-size: 13px; }
.facts.list dd { font-size: 14px; font-weight: 500; font-stretch: 100%; line-height: 1.5; }
.rank-list.funnel .meter { margin-top: 10px; }
.rank-list.funnel strong { font-weight: 600; font-size: 14px; }
.cell-title strong { display: block; }
.cell-title .sub-line { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 6px; }
.mobile-inline { display: none; }
.page-head .meta .tag, .page-head .meta .pill { margin-right: 6px; }
.approval { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px; font-size: 12px; font-weight: 600;
  color: var(--warn); border: 1px solid var(--warn-line); white-space: nowrap; }
.approval svg { width: 13px; height: 13px; }
.footnote { color: var(--faint); font-size: 12px; margin: 20px 0 0; max-width: 80ch; }
.card.flush > .footnote { padding: 0 32px 28px; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 13px; letter-spacing: .02em; }
/* samples */
.month-table td, .month-table th { white-space: nowrap; }
.month-table td + td, .month-table th + th { padding-left: 12px; padding-right: 12px; }
.month-table td + td:last-child, .month-table th + th:last-child { padding-right: 32px; }
.partial { color: var(--faint); font-size: 12px; font-weight: 500; margin-left: 6px; }
/* orders map */
.map-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(320px, 1fr); gap: 32px; align-items: start; }
.map-wrap { position: relative; }
.map-wrap svg { width: 100%; height: auto; display: block; }
.map-wrap path { stroke: var(--surface); stroke-width: 1; stroke-linejoin: round; cursor: pointer; transition: opacity .15s; }
.map-wrap path:hover, .map-wrap path.sel { stroke: var(--fg); stroke-width: 1.6; }
.map-wrap svg:hover path:not(:hover):not(.sel) { opacity: .82; }
.scale { display: flex; align-items: center; gap: 10px; margin-top: 24px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.scale .steps { display: flex; gap: 2px; }
.map-sum { margin: 32px 0 0 !important; padding-top: 24px; border-top: 1px solid var(--line); }
.scale .steps i { width: 36px; height: 10px; display: block; }
.scale .steps i:first-child { border-radius: 4px 0 0 4px; } .scale .steps i:last-child { border-radius: 0 4px 4px 0; }
.state-panel h2 { font-size: 22px; }
.state-panel .kv, .map-sum { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin: 24px 0 28px; }
.state-panel .kv dt, .map-sum dt { color: var(--muted); font-size: 12px; margin-bottom: 4px; }
.state-panel .kv dd, .map-sum dd { margin: 0; font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.state-panel h3 { margin: 28px 0 12px; font-size: 13px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.state-panel .rank-list li { padding: 12px 0; }
.state-panel .rank-list li:first-child { padding-top: 0; }
.state-panel .who { gap: 12px; }
/* ads */
.soon-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 32px; }
.soon-card { position: relative; overflow: hidden; }
.soon-card .pill { margin-bottom: 20px; }
.soon-card h2 { font-size: 22px; margin-bottom: 12px; }
.soon-card p { color: var(--muted); margin: 0 0 16px; max-width: 60ch; }
.soon-card ul { margin: 8px 0 0; padding-left: 18px; color: var(--muted); }
.soon-card li { margin: 6px 0; }
.soon-card .why { border-top: 1px solid var(--line); margin-top: 24px; padding-top: 20px; font-size: 13px; color: var(--faint); }
@media (max-width: 1100px) { .map-grid, .soon-grid { grid-template-columns: 1fr; } }
@media (max-width: 860px) {
  .mobile-inline { display: block; }
  .facts.list > div { grid-template-columns: 96px minmax(0, 1fr); }
  .card.flush > .footnote { padding: 0 24px 24px; }
  .state-panel .kv dd, .map-sum dd { font-size: 17px; }
  .scale .steps i { width: 28px; }
}
.back svg { width: 16px; height: 16px; flex: none; }
.split.top { align-items: start; }
.rank-list.funnel .meter { display: block; }
.rank-list.funnel .grow strong { white-space: normal; }
.rank-list.funnel .val { min-width: 56px; }
@media (max-width: 720px) {
  .month-table td + td, .month-table th + th { padding-left: 8px; padding-right: 8px; }
  .month-table td + td:last-child, .month-table th + th:last-child { padding-right: 24px; }
}
/* Orders map: let long video titles ellipsize inside the state panel instead of pushing it wider */
.state-panel, .state-panel .rank-list li, .state-panel .who, .state-panel .names { min-width: 0; }
.state-panel .names strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
