/* KIKI Console — desktop-first founders' admin. Colours, radii and shadows come from tokens.css (copied from webapp/ at
   deploy); the sidebar is the one dark (#1A1918) in both themes, gold is the accent. */
:root {
  --font: "Figtree", "Zen Kaku Gothic New", system-ui, -apple-system, "Hiragino Sans", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, monospace;
  --c1: var(--gold-ink); --c2: var(--copper); --c3: var(--good); --c4: var(--ink-2); --c5: var(--warn);
  --side: #1A1918; --side-ink: #EDE8DD; --side-muted: #9B958A;
  color-scheme: light;
}
html[data-theme="dark"] { color-scheme: dark; --c1: var(--gold); --c4: #B9B2A6; }
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 14px; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
a { color: var(--gold-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
html[data-theme="dark"] a { color: var(--gold); }
h1, h2, h3 { margin: 0; letter-spacing: -.01em; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: var(--mono); font-size: 12px; }
.r { text-align: right; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.center { justify-content: center; }

/* buttons + segmented */
.btn { border: 1px solid var(--line); background: var(--card); height: 34px; padding: 0 14px; border-radius: 10px; font-weight: 600;
  font-size: 13px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; color: var(--ink); white-space: nowrap; }
.btn:hover { border-color: var(--border-strong); text-decoration: none; }
.btn.primary { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn.gold { background: var(--gold); color: var(--on-gold); border-color: var(--gold); }
.btn.danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn.ghost { background: transparent; }
.btn.link { background: transparent; border-color: transparent; color: var(--gold-ink); }
.btn.wide { width: 100%; justify-content: center; height: 42px; }
.btn:disabled { opacity: .45; cursor: default; }
.link-btn { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 12px; padding: 0; }
.link-btn:hover { color: var(--danger); }
.seg { display: inline-flex; background: var(--soft); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; height: 28px; padding: 0 12px; border-radius: 8px; font-size: 12.5px; font-weight: 600; color: var(--muted); cursor: pointer; }
.seg button.on { background: var(--card); color: var(--ink); box-shadow: var(--shadow-seg); }
.seg.dark { background: rgba(255,255,255,.06); }
.seg.dark button { color: var(--side-muted); }
.seg.dark button.on { background: rgba(255,255,255,.12); color: var(--side-ink); box-shadow: none; }

/* sign-in gate */
.gate { min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(1200px 600px at 50% -10%, var(--gold-soft), transparent 60%), var(--bg); }
.gate-card { width: min(400px, 100%); background: var(--card); border: 1px solid var(--line); border-radius: 22px; padding: 36px 32px;
  box-shadow: var(--shadow-pop); text-align: center; display: grid; gap: 14px; }
.gate-logo { height: 44px; margin: 0 auto 6px; }
.gate-card h1 { font-size: 20px; }
.gate-card .or { font-size: 12px; color: var(--muted); margin: 6px 0 -4px; }
.gate-card input { flex: 1; height: 38px; border: 1px solid var(--line); border-radius: 10px; padding: 0 12px; background: var(--bg); min-width: 0; }
.line-btn { background: #06C755; color: #fff; border-color: #06C755; }
.gate-msg { font-size: 13px; color: var(--gold-ink); }

/* shell */
.shell { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100vh; }
html[data-theme="dark"] .side { background: #121110; border-right: 1px solid rgba(255,255,255,.06); }
.side { position: sticky; top: 0; height: 100vh; background: var(--side); color: var(--side-ink); display: flex; flex-direction: column; padding: 20px 14px; gap: 18px; }
.side-brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 10px; font-weight: 700; font-size: 15px; letter-spacing: .01em; }
.side-brand img { width: 30px; height: 30px; }
.nav { display: grid; gap: 4px; }
.nav-i { display: flex; align-items: center; gap: 12px; border: 0; background: transparent; color: var(--side-muted); height: 42px; padding: 0 12px;
  border-radius: 12px; cursor: pointer; font-weight: 600; font-size: 14px; text-align: left; position: relative; }
.nav-i svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.nav-i span { flex: 1; }
.nav-i:hover { background: rgba(255,255,255,.05); color: var(--side-ink); }
.nav-i.on { background: rgba(238,216,166,.12); color: #EED8A6; }
.nav-i.on::before { content: ""; position: absolute; left: -14px; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0; background: #EED8A6; }
.nav-n { font-style: normal; min-width: 22px; height: 20px; padding: 0 6px; border-radius: 10px; background: rgba(255,255,255,.12); color: var(--side-ink);
  font-size: 11px; font-weight: 700; display: grid; place-items: center; }
.nav-n.amber { background: #C9A457; color: #1A1918; }
.nav-n.red { background: #D2543F; color: #fff; }
.side-foot { margin-top: auto; display: grid; gap: 10px; }
.who { display: grid; gap: 4px; font-size: 12px; color: var(--side-muted); padding: 8px 4px 0; border-top: 1px solid rgba(255,255,255,.08); word-break: break-all; }
.who .link-btn { justify-self: start; color: var(--side-muted); }
.main { min-width: 0; padding: 28px 36px 60px; }
.top { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.top h1 { font-size: 26px; font-weight: 800; }
.top p { margin: 4px 0 0; color: var(--muted); }
.top-acts { display: flex; gap: 10px; align-items: center; }

/* layout */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 16px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 18px 20px; box-shadow: var(--shadow-card); min-width: 0; }
section.panel { margin-bottom: 16px; }
.grid2 > .panel, .grid3 > .panel { margin-bottom: 0; }
.panel-h { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.panel-h h2 { font-size: 15px; font-weight: 700; }
.panel h3 { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin: 18px 0 8px; }
.section-h { font-size: 18px; font-weight: 800; margin: 28px 0 12px; }
.big { font-size: 22px; font-weight: 800; font-family: var(--font); }
.empty-state { text-align: center; padding: 48px 20px; color: var(--muted); }

/* KPI cards */
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 16px 18px 14px; box-shadow: var(--shadow-card);
  display: grid; gap: 6px; position: relative; overflow: hidden; }
.kpi::after { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: linear-gradient(90deg, var(--gold), transparent); opacity: .7; }
.kpi-h { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.kpi-h small { color: var(--muted); font-weight: 600; font-size: 12.5px; }
.kpi > b { font-size: 30px; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; }
.kpi-f { display: flex; justify-content: space-between; align-items: flex-end; gap: 8px; min-height: 32px; }
.kpi-f span { font-size: 12px; color: var(--muted); }
.delta { font-size: 11.5px; font-weight: 700; padding: 2px 7px; border-radius: 999px; background: var(--soft); color: var(--muted); white-space: nowrap; }
.delta.up { background: var(--ok-soft); color: var(--good); }
.delta.down { background: var(--danger-soft); color: var(--danger); }
.spark { width: 110px; height: 32px; flex: none; }
.spark polyline { fill: none; stroke: var(--c1); stroke-width: 2; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.spark.c2 polyline { stroke: var(--c2); } .spark.c3 polyline { stroke: var(--c3); } .spark.c4 polyline { stroke: var(--c4); }

/* charts */
.chart-wrap { position: relative; }
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart.bars { height: 90px; }
.chart .grid { stroke: var(--line); stroke-width: 1; vector-effect: non-scaling-stroke; }
.chart .ax { font-size: 11px; fill: var(--muted); font-family: var(--font); }
.chart .ln { fill: none; stroke-width: 2.2; vector-effect: non-scaling-stroke; stroke-linejoin: round; stroke-linecap: round; }
.chart .area { opacity: .12; stroke: none; }
.chart .hover-x { stroke: var(--border-strong); stroke-dasharray: 3 3; vector-effect: non-scaling-stroke; }
.ln.c1 { stroke: var(--c1); } .ln.c2 { stroke: var(--c2); } .ln.c3 { stroke: var(--c3); } .ln.c4 { stroke: var(--c4); } .ln.c5 { stroke: var(--c5); }
.area.c1, rect.c1 { fill: var(--c1); } .area.c2, rect.c2 { fill: var(--c2); } rect.c3 { fill: var(--c3); } rect.c4 { fill: var(--c4); } rect.c5 { fill: var(--c5); }
.chart rect { rx: 2; opacity: .85; } .chart rect:hover { opacity: 1; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 8px; font-size: 12px; color: var(--muted); }
.legend i, .tip i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
i.c1 { background: var(--c1); } i.c2 { background: var(--c2); } i.c3 { background: var(--c3); } i.c4 { background: var(--c4); } i.c5 { background: var(--c5); }
.tip { position: fixed; z-index: 50; pointer-events: none; background: var(--side); color: var(--side-ink); border-radius: 12px; padding: 10px 12px;
  font-size: 12px; display: grid; gap: 4px; box-shadow: var(--shadow-pop); min-width: 160px; }
.tip span { display: flex; align-items: center; } .tip span b { margin-left: auto; padding-left: 12px; }
.empty-chart { height: 120px; display: grid; place-items: center; color: var(--muted); background: var(--soft); border-radius: 12px; }

/* horizontal bars, stats, tables */
.hbars { display: grid; gap: 8px; }
.hb { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) auto; gap: 10px; align-items: center; font-size: 13px; }
.hb-l { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hb-bar { height: 8px; background: var(--soft); border-radius: 4px; overflow: hidden; }
.hb-bar i { display: block; height: 100%; border-radius: 4px; background: var(--c1); }
.hb-bar i.c2 { background: var(--c2); } .hb-bar i.c3 { background: var(--c3); } .hb-bar i.c4 { background: var(--c4); }
.hb small { grid-column: 1 / -1; margin-top: -6px; font-size: 11px; color: var(--muted); }
.stat-list { display: grid; gap: 2px; }
.stat-list > div { display: flex; align-items: baseline; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.stat-list > div:last-child { border-bottom: 0; }
.pm-via-h { margin: 14px 0 4px; font-size: .8125rem; color: var(--muted); font-weight: 600; }   /* trial-02: trials per door */
.stat-list span { flex: 1; color: var(--muted); } .stat-list b { font-size: 15px; } .stat-list small { color: var(--muted); font-size: 11.5px; }
.warn-t { color: var(--warn); }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; margin-bottom: 12px; }
.stat { background: var(--soft); border-radius: 12px; padding: 10px 12px; display: grid; gap: 2px; }
.stat small { color: var(--muted); font-size: 11.5px; font-weight: 600; } .stat b { font-size: 20px; font-weight: 800; } .stat span { font-size: 11px; color: var(--muted); }
.stat.warn { background: var(--warn-soft); } .stat.warn b { color: var(--warn); }
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; font-size: 11.5px; color: var(--muted); font-weight: 700; padding: 6px 8px; border-bottom: 1px solid var(--line); text-transform: uppercase; letter-spacing: .04em; }
.tbl td { padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl.compact td { padding: 6px 8px; }
.tbl td { line-height: 1.35; } .tbl .delta { padding: 1px 6px; font-size: 11px; }
.pill { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--soft); color: var(--muted); }
.pill.ok { background: var(--ok-soft); color: var(--good); } .pill.bad { background: var(--danger-soft); color: var(--danger); }
.pill.warn { background: var(--warn-soft); color: var(--warn); } .pill.gold { background: var(--gold-soft); color: var(--gold-ink); }
.funnel { display: grid; gap: 10px; }
.funnel div { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; font-size: 13px; }
.funnel i { grid-column: 1 / -1; height: 10px; border-radius: 5px; background: var(--c2); opacity: .85; }
.funnel i.bad { background: var(--danger); opacity: .5; }
.meter { margin: 6px 0 12px; }
.meter-h { display: flex; justify-content: space-between; font-size: 12.5px; margin-bottom: 6px; } .meter-h span { color: var(--muted); }
.meter-bar { height: 10px; border-radius: 5px; background: var(--soft); overflow: hidden; }
.meter-bar i { display: block; height: 100%; border-radius: 5px; background: linear-gradient(90deg, var(--good), var(--gold)); }
.meter-bar.warn i { background: linear-gradient(90deg, var(--gold), var(--danger)); }
.form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; align-items: end; margin-bottom: 14px; }
.form-grid label { display: grid; gap: 4px; font-size: 12px; color: var(--muted); font-weight: 600; }
.form-grid .span2 { grid-column: span 2; }
.form-grid input, .form-grid select { height: 36px; border: 1px solid var(--line); border-radius: 10px; padding: 0 10px; background: var(--bg); color: var(--ink); }

/* control center */
.status { display: flex; gap: 16px; align-items: flex-start; border-radius: 18px; padding: 18px 22px; margin-bottom: 16px; border: 1px solid; }
.status b { font-size: 17px; }
.status ul { margin: 8px 0 0; padding-left: 18px; display: grid; gap: 4px; font-size: 13px; }
.status li.red { color: var(--danger); font-weight: 600; }
.status li .inc-ack { margin-left: 8px; padding: 1px 8px; min-height: 0; font-size: 12px; font-weight: 600; vertical-align: 1px; }
.status.green { background: var(--ok-soft); border-color: color-mix(in srgb, var(--good) 30%, transparent); }
.status.amber { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 35%, transparent); }
.status.red { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.pulse { width: 14px; height: 14px; border-radius: 50%; flex: none; margin-top: 4px; position: relative; }
.status.green .pulse { background: var(--good); } .status.amber .pulse { background: var(--warn); } .status.red .pulse { background: var(--danger); }
.pulse::after { content: ""; position: absolute; inset: -6px; border-radius: 50%; border: 2px solid currentColor; opacity: 0; animation: ping 2s infinite; }
.status.green .pulse::after { color: var(--good); } .status.amber .pulse::after { color: var(--warn); } .status.red .pulse::after { color: var(--danger); }
@keyframes ping { 0% { transform: scale(.5); opacity: .7; } 100% { transform: scale(1.4); opacity: 0; } }
.dot-live { width: 8px; height: 8px; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 4px var(--ok-soft); animation: blink 2s infinite; }
@keyframes blink { 50% { opacity: .35; } }
.uptime { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.up { display: flex; gap: 10px; align-items: center; padding: 12px; border-radius: 14px; background: var(--soft); }
.up i { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.up.ok i { background: var(--good); box-shadow: 0 0 0 3px var(--ok-soft); } .up.bad i { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }
.up b { display: block; font-size: 13px; } .up small { color: var(--muted); font-size: 11.5px; }
.up.bad { background: var(--danger-soft); }

/* cards (feedback + moderation) */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 14px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 16px; display: grid; gap: 10px; align-content: start;
  box-shadow: var(--shadow-card); transition: opacity .2s, transform .2s; }
.card.leaving { opacity: 0; transform: scale(.98); }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.card .text { margin: 0; line-height: 1.6; white-space: pre-wrap; }
.card .quote { margin: 0; color: var(--muted); font-size: 13px; border-left: 3px solid var(--gold-line); padding-left: 10px; }
.meta { display: flex; flex-wrap: wrap; gap: 6px 12px; font-size: 12px; color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.acts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 2px; }
.photos { display: flex; gap: 8px; flex-wrap: wrap; }
.photos img, .photos .ph { width: 120px; height: 120px; object-fit: cover; border-radius: 10px; background: var(--soft); display: grid; place-items: center; font-size: 11px; color: var(--muted); }
.photos.big img, .photos.big .ph { width: 100%; max-width: 320px; height: 220px; object-fit: contain; }
figure { margin: 0; } figcaption { font-size: 11px; color: var(--muted); margin-top: 4px; }
.person { display: flex; gap: 10px; align-items: center; }
.avatar { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; background: var(--soft); display: grid; place-items: center; font-weight: 700; }
.dup { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.dup-side { background: var(--soft); border-radius: 12px; padding: 10px; display: grid; gap: 4px; }
.dup-pic img { width: 100%; height: 120px; object-fit: contain; }
.ctx summary { font-size: 12px; color: var(--muted); cursor: pointer; }
.ctx dl { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; font-size: 12px; margin: 8px 0 0; }
.ctx dt { color: var(--muted); } .ctx dd { margin: 0; word-break: break-all; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.tab { border: 1px solid var(--line); background: var(--card); height: 34px; padding: 0 12px; border-radius: 10px; cursor: pointer; font-weight: 600; font-size: 13px;
  display: inline-flex; align-items: center; gap: 8px; color: var(--muted); }
.tab.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.tab .n { font-size: 11px; padding: 0 6px; border-radius: 8px; background: var(--soft); color: var(--muted); }
.tab .n.has { background: var(--gold); color: var(--on-gold); }

/* settings */
.setting { display: flex; gap: 16px; align-items: center; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--line); }
.setting:last-child { border-bottom: 0; }
.set-t { display: grid; gap: 3px; min-width: 0; }
.set-t b { font-size: 14px; } .set-t code { font-family: var(--mono); font-size: 11px; color: var(--muted); }
.set-t p { margin: 0; font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.set-t .json { display: block; font-family: var(--mono); font-size: 11px; color: var(--ink-2); background: var(--soft); border-radius: 8px; padding: 6px 8px; overflow-x: auto; white-space: nowrap; }
.setting.danger .set-t b::after { content: " ●"; color: var(--danger); font-size: 10px; vertical-align: 2px; }
.set-c { flex: none; }
.switch { position: relative; display: inline-block; width: 46px; height: 26px; cursor: pointer; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch i { position: absolute; inset: 0; border-radius: 13px; background: var(--border-strong); transition: background .2s; }
.switch i::before { content: ""; position: absolute; width: 20px; height: 20px; left: 3px; top: 3px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .2s; }
.switch input:checked + i { background: var(--good); }
.switch input:checked + i::before { transform: translateX(20px); }

/* dialog, toast, skeleton */
.dlg { border: 0; border-radius: 18px; padding: 0; background: var(--card); color: var(--ink); box-shadow: var(--shadow-pop); width: min(520px, 92vw); }
.dlg::backdrop { background: rgba(10, 9, 8, .45); backdrop-filter: blur(3px); }
.dlg-in { padding: 22px; display: grid; gap: 12px; }
.dlg-in h3 { font-size: 17px; } .dlg-in p { margin: 0; color: var(--muted); line-height: 1.55; }
.dlg-err { color: var(--danger) !important; font-size: 13px; }
.dlg-acts { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
.json-ed { width: 100%; min-height: 220px; font-family: var(--mono); font-size: 12.5px; border: 1px solid var(--line); border-radius: 10px; padding: 10px; background: var(--bg); color: var(--ink); }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 60; background: var(--side); color: var(--side-ink);
  padding: 11px 18px; border-radius: 12px; font-weight: 600; box-shadow: var(--shadow-pop); }
.skel-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.skel { height: 140px; border-radius: 18px; background: linear-gradient(90deg, var(--soft), var(--card-2), var(--soft)); background-size: 200% 100%; animation: shimmer 1.3s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* smaller screens: the sidebar becomes a top bar */
@media (max-width: 1180px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid3 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 10px 12px; gap: 10px; }
  .nav { display: flex; overflow-x: auto; } .nav-i { height: 36px; } .nav-i span { display: none; } .nav-i.on::before { display: none; }
  .side-foot { margin: 0 0 0 auto; display: flex; } .who { display: none; }
  .main { padding: 18px 16px 40px; }
  .grid2, .grid3, .kpis, .form-grid { grid-template-columns: 1fr; }
  .cards { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { .pulse::after, .dot-live, .skel { animation: none; } }

/* waitlist (0130) */
.wl-find { grid-template-columns: minmax(0, 360px) auto auto; justify-content: start; margin-bottom: 6px; }
/* purchases-01: the Premium page's "also ended" box beside the search */
.pm-ended { display: inline-flex; align-items: center; gap: 6px; font-size: .8125rem; color: var(--muted); }
.pm-ended input { width: auto; height: auto; min-height: 0; margin: 0; padding: 0; }
.wl-note { margin: 0 0 12px; font-size: 12px; }
.btn.ghost.danger { background: none; color: var(--danger); border-color: var(--line); }
.btn.ghost.danger:hover { border-color: var(--danger); }

/* website page (0138) */
.kpis.six { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.scroll { max-height: 440px; overflow: auto; }
.tbl td.ell { max-width: 0; width: 60%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbars-row { margin-top: 12px; max-width: 520px; }
.section-h small { font-size: 12px; font-weight: 600; margin-left: 8px; }
.src-list { display: grid; gap: 10px; }
.src { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 12px; background: var(--soft); }
.src i { width: 10px; height: 10px; border-radius: 50%; flex: none; margin-top: 4px; background: var(--border-strong); }
.src.ok i { background: var(--good); box-shadow: 0 0 0 3px var(--ok-soft); } .src.bad i { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }
.src.bad { background: var(--danger-soft); }
.src b { display: block; font-size: 13px; } .src small { display: block; font-size: 11.5px; color: var(--muted); word-break: break-word; }
@media (max-width: 860px) { .kpis.six { grid-template-columns: 1fr; } }
/* costs page: short columns stay on one line, the note takes the rest */
.tbl .nw { white-space: nowrap; }
.xscroll { overflow-x: auto; }

/* console-v2 (2026-10-17): grouped navigation, Jobs, AI spend, Catalogue, Data inbox, Inspector */
.nav { gap: 2px; overflow-y: auto; min-height: 0; }
.side { overflow: hidden; }
.nav-g { display: block; font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--side-muted); opacity: .7; padding: 12px 12px 4px; }
.nav-g:first-child { padding-top: 0; }
.nav-i { height: 38px; }
.status.slim { padding: 12px 18px; align-items: center; } .status.slim .pulse { margin-top: 0; } .status.slim b { font-size: 15px; }
.tbl.jobs td { vertical-align: top; } .tbl.jobs td:first-child { min-width: 260px; max-width: 420px; }
.tbl.jobs tr.job.failed td, .tbl.jobs tr.job.logerr td { background: color-mix(in srgb, var(--danger-soft) 55%, transparent); }
.tbl.jobs tr.job.late td { background: color-mix(in srgb, var(--warn-soft) 55%, transparent); }
.tbl.jobs tr.job.paused td, .tbl.jobs tr.job.off td { opacity: .65; }
.tbl.jobs tr.job:has(+ tr.job-det:not([hidden])) td { border-bottom: 0; }
.tbl .small { font-size: 12px; line-height: 1.4; margin-top: 3px; }
.job-det td { background: var(--soft); }
.det-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 18px; padding: 4px 0; }
.det-grid small { display: block; color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; margin-bottom: 2px; }
.det-grid .span2 { grid-column: 1 / -1; }
.wrap { white-space: pre-wrap; word-break: break-word; }
code.wrap { display: block; background: var(--card); border-radius: 8px; padding: 6px 8px; max-height: 160px; overflow: auto; }
.kpi-f.wide span { white-space: normal; }
.kpi .meter { margin: 2px 0 0; }
.pct-cell { display: inline-flex; align-items: center; gap: 8px; justify-content: flex-end; }
.pct-cell b { min-width: 46px; text-align: right; font-size: 13px; }
.pbar { width: 70px; height: 6px; border-radius: 3px; background: var(--soft); overflow: hidden; display: inline-block; }
.pbar i { display: block; height: 100%; background: var(--c1); border-radius: 3px; }
.tbl.cov td:first-child { white-space: nowrap; }
.card-kind { margin-bottom: -4px; }
.card .facts { gap: 4px 14px; } .card .facts span { display: inline-flex; gap: 5px; align-items: baseline; }
.tab.ghost-tab { border-style: dashed; color: var(--gold-ink); }
html[data-theme="dark"] .tab.ghost-tab { color: var(--gold); }
.dlg-input { width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; background: var(--bg); color: var(--ink); font: inherit; resize: vertical; min-height: 38px; }
.insp-top { margin-bottom: 14px; } .grow { flex: 1; }
.insp-search input { flex: 1; min-width: 0; height: 40px; border: 1px solid var(--line); border-radius: 10px; padding: 0 12px; background: var(--bg); color: var(--ink); font-size: 15px; }
.insp-head { display: flex; gap: 18px; align-items: flex-start; }
.insp-pic { width: 110px; height: 150px; flex: none; border-radius: 12px; background: var(--soft); display: grid; place-items: center; overflow: hidden; }
.insp-pic img { width: 100%; height: 100%; object-fit: contain; }
.insp-id { display: grid; gap: 8px; min-width: 0; } .insp-id h2 { font-size: 20px; font-weight: 800; }
.facts-list > div { align-items: center; } .facts-list b { font-weight: 600; font-size: 14px; text-align: right; }
.stat-list .src-badge, .src-badge { flex: 0 0 auto; font-size: 10.5px; font-weight: 700; padding: 1px 7px; border-radius: 999px; background: var(--gold-soft); color: var(--gold-ink); white-space: nowrap; }
html[data-theme="dark"] .src-badge { color: var(--gold); }
.src-filter { margin-bottom: 8px; } .src-filter select { height: 32px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--ink); padding: 0 8px; }
.bottle-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 6px; }
.bottle-list a { display: grid; gap: 1px; padding: 8px 10px; border-radius: 10px; background: var(--soft); color: var(--ink); }
.bottle-list a:hover { text-decoration: none; background: var(--card-2); }
.bottle-list a small { font-size: 11.5px; }
.ell2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; max-width: 420px; }
@media (max-width: 860px) {
  .nav-g { display: none; }
  .insp-head { flex-direction: column; } .det-grid { grid-template-columns: 1fr; }
  .tbl.jobs td:first-child { min-width: 200px; }
  .top-acts { flex-wrap: wrap; }
}
/* the Jobs table becomes one card per job on a phone */
@media (max-width: 860px) {
  .tbl.jobs, .tbl.jobs tbody { display: block; }
  .tbl.jobs thead { display: none; }
  .tbl.jobs tr.job { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
  .tbl.jobs tr.job td { display: block; border: 0; padding: 0; min-width: 0 !important; max-width: none; white-space: normal; text-align: left; background: none; }
  .tbl.jobs tr.job .j-name { grid-column: 1; grid-row: 1; }
  .tbl.jobs tr.job .j-sw { grid-column: 2; grid-row: 1; text-align: right; }
  .tbl.jobs tr.job .j-det { grid-column: 2; grid-row: 2; text-align: right; }
  .tbl.jobs tr.job .j-when, .tbl.jobs tr.job .j-last, .tbl.jobs tr.job .j-res, .tbl.jobs tr.job .j-week { grid-column: 1; }
  .tbl.jobs tr.job-det { display: block; } .tbl.jobs tr.job-det[hidden] { display: none; } .tbl.jobs tr.job-det td { display: block; }
  .tbl.jobs tr.job.failed, .tbl.jobs tr.job.logerr { background: color-mix(in srgb, var(--danger-soft) 55%, transparent); }
  .tbl.jobs tr.job.late { background: color-mix(in srgb, var(--warn-soft) 55%, transparent); }
}
@media (min-width: 861px) {
  .tbl.jobs { table-layout: fixed; }
  .tbl.jobs th:nth-child(1) { width: 33%; } .tbl.jobs th:nth-child(2) { width: 15%; } .tbl.jobs th:nth-child(3) { width: 9%; }
  .tbl.jobs th:nth-child(4) { width: 25%; } .tbl.jobs th:nth-child(5) { width: 9%; } .tbl.jobs th:nth-child(6) { width: 5%; } .tbl.jobs th:nth-child(7) { width: 4%; }
  .tbl.jobs td:first-child { min-width: 0; max-width: none; }
  .tbl.jobs td.nw { white-space: normal; }
}

/* console-04: the AI assistant page's askers table: headings on one line (the table scrolls sideways on a phone) */
#asTop th { white-space: nowrap; }

/* console-04: inside the app (html[data-in-app], scripts/build_console_app.py): the way back to the app before the logo,
   room for the phone's status bar and home bar (the store apps draw under both) */
.app-back { display: grid; place-items: center; width: 32px; height: 32px; margin-left: -6px; border-radius: 10px; color: inherit; }
.app-back:hover { text-decoration: none; background: rgba(255, 255, 255, .08); }
.app-back svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
html[data-in-app] .side { padding-top: calc(20px + env(safe-area-inset-top)); }
html[data-in-app] .main { padding-bottom: calc(60px + env(safe-area-inset-bottom)); }
@media (max-width: 860px) {
  html[data-in-app] .side { padding-top: calc(10px + env(safe-area-inset-top)); }
  html[data-in-app] .main { padding-bottom: calc(40px + env(safe-area-inset-bottom)); }
}

/* console-04 phone pass (375 px, every page, the in-app console and admin.kiki-sake.com on a phone): tables scroll sideways
   inside their panel (core.js wraps each .tbl in .xscroll) with their cells on one line instead of letters stacked under
   each other; a form field that spans two columns doesn't make a second column; a card's two halves (duplicates) shrink */
@media (max-width: 860px) {
  :is(.xscroll, .scroll) > .tbl:not(.jobs) :is(th, td) { white-space: nowrap; }
  :is(.xscroll, .scroll) > .tbl :is(.ell2, .wrap) { white-space: normal; min-width: 200px; }
  .form-grid .span2 { grid-column: auto; }
  .cards { grid-template-columns: minmax(0, 1fr); }
  .card, .dup-side { min-width: 0; }
  .card { grid-template-columns: minmax(0, 1fr); overflow-wrap: anywhere; }   /* a long error or URL in an intake card */
  .dup { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .dup-side { overflow-wrap: anywhere; }
}

/* jobs-01 Knowledge page: kind + status side by side, the "ending soon" box on one line */
.kb-pills { display: inline-flex; gap: 6px; }
.kb-exp { display: inline-flex; gap: 6px; align-items: center; white-space: nowrap; }

/* announce-01: Announcements — compose beside a ja / en preview of the app's own row */
.an-rare { margin: 0 0 14px; max-width: 760px; }
.an-compose { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(280px, 1fr); gap: 18px; align-items: start; margin-bottom: 16px; }
@media (max-width: 900px) { .an-compose { grid-template-columns: minmax(0, 1fr); } }
.an-form .span3 { grid-column: 1 / -1; }
.an-form input:not([type=checkbox]), .an-form select { min-width: 0; width: 100%; box-sizing: border-box; }
.an-form textarea { width: 100%; resize: vertical; font: inherit; color: var(--ink); background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.an-form .chk { display: flex; align-items: center; gap: 6px; font-weight: 500; color: var(--ink); }
.an-form .an-plat { display: flex; gap: 12px; align-items: center; border: 0; padding: 0; margin: 0; font-size: 12px; color: var(--muted); }
.an-form .an-plat legend { font-weight: 600; padding: 0; margin-bottom: 4px; }
.an-form p { margin: -4px 0 0; }
.an-acts { display: flex; gap: 8px; }
.an-prev h3 { font-size: 12px; color: var(--muted); margin: 0 0 8px; }
.an-phone { width: 340px; max-width: 100%; padding: 10px; margin-bottom: 10px; border: 1px solid var(--line); border-radius: 20px; background: var(--card); }
.an-nt, .an-fd { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 12px; align-items: start; padding: 8px; border-radius: 16px; background: var(--gold-soft); color: var(--ink); font-size: 14px; line-height: 1.45; }
.an-fd { background: none; }
.an-nt.out { background: none; box-shadow: inset 0 0 0 1.5px var(--warn); }
.an-mark { width: 44px; height: 44px; border-radius: 50%; background: var(--kiki-dark); display: grid; place-items: center; overflow: hidden; }
.an-mark img { width: 30px; height: 30px; }
.an-nt.out .an-mark { background: var(--warn-soft); color: var(--warn); }
.an-mark svg { width: 24px; height: 24px; }
.an-t { display: grid; gap: 2px; } .an-t small { color: var(--muted); font-size: 12px; } .an-nt.out .an-t small { color: var(--warn); }
.an-who { display: flex; align-items: center; gap: 6px; } .an-who time { margin-left: auto; color: var(--muted); font-size: 12px; }
.an-tag { font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 4px; background: var(--soft); color: var(--muted); }
.an-tag.gold { background: var(--gold-soft); color: var(--gold-ink); }
.an-fb p { margin: 6px 0; white-space: pre-wrap; }
.an-ph { width: 100%; border-radius: 12px; margin: 4px 0; display: block; }
.an-link { margin-top: 6px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 12px; font-weight: 600; display: flex; justify-content: space-between; }
.an-acts-row { margin-top: 6px; color: var(--muted); font-size: 13px; }
.an-thumb { float: left; width: 44px; height: 44px; object-fit: cover; border-radius: 8px; margin-right: 10px; }
.link-btn.danger { color: var(--danger); }
/* scanmiss-01: Missed scans page + the console-wide "Show everyone" switch */
.ms-fld { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
.ms-tbl td { vertical-align: top; }
.ms-acts { white-space: nowrap; text-align: right; }
.ms-acts .btn + .btn { margin-left: 4px; }
.ms-text { display: inline-block; max-width: 34ch; }
.who-seg { display: flex; } .who-seg button { flex: 1; white-space: nowrap; padding: 0 8px; }
.ms-tbl .pill, .ms-tbl td.r small { white-space: nowrap; }
#pageTitle[data-all]::after { content: attr(data-all); margin-left: 10px; vertical-align: middle; font-size: 12px; font-weight: 700; letter-spacing: 0;
  padding: 3px 9px; border-radius: 999px; background: var(--gold-soft); color: var(--gold-ink); }

/* marketing-reviews-01: Marketing + Reviews pages */
.mk-dates { display: inline-flex; align-items: center; gap: 6px; }
.mk-dates input { height: 32px; border: 1px solid var(--line); border-radius: 10px; padding: 0 8px; background: var(--bg); color: var(--ink); font: inherit; font-size: 12.5px; }
.mk-tbl i.dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 8px; vertical-align: -1px; }
.tbl tfoot tr.tot td { font-weight: 700; border-top: 1px solid var(--line); }
.tbl tfoot tr.tot + tr.tot td { border-top: 0; font-weight: 600; color: var(--muted); }
.mk-warn { color: var(--warn); }
.mk-auto { margin: 10px 0 0; }
.rv-list { display: grid; gap: 12px; }
.rv { border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; background: var(--card); }
.rv-h { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.rv-stars { color: var(--gold-ink); font-size: 14px; letter-spacing: 1px; }
.rv-stars.low { color: var(--danger); }
.rv-t { font-weight: 700; margin: 6px 0 2px; }
.rv-b { white-space: pre-wrap; margin: 0; }
.rv-en { margin: 8px 0 0; padding: 8px 10px; border-radius: 10px; background: var(--soft); white-space: pre-wrap; font-size: 13px; }
.rv-en b { font-size: 11px; color: var(--muted); margin-right: 6px; }
.rv-reply { margin: 8px 0 0 14px; padding-left: 10px; border-left: 2px solid var(--gold); font-size: 13px; color: var(--muted); white-space: pre-wrap; }
.rv-run { margin: 0 0 8px; display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; }
.rv-setup { border: 1px dashed var(--line); border-radius: 12px; padding: 10px 14px; margin-top: 10px; }
.rv-setup ol { margin: 6px 0 0 18px; padding: 0; }
