/* =====================================================================
   Foundel Studio design system
   Fonts: Poppins (headings) · Inter (text) · JetBrains Mono (labels, numbers)
   Tokens are documented in docs/DESIGN-SYSTEM.md
   ===================================================================== */

:root {
  /* neutrals */
  --bg: #f1f3ef;
  --grid: rgba(18, 26, 21, 0.045);
  --surface: #ffffff;
  --surface-2: #f6f8f5;
  --line: #e1e6df;
  --line-strong: #cdd5cc;
  --ink: #121a15;
  --ink-2: #434d46;
  --ink-3: #636d66;

  /* brand */
  --brand: #16a34a;
  --brand-ink: #11743a;
  --brand-soft: #e3f6ea;
  --brand-strong: #16833f;   /* fills behind white text (4.8:1) */
  --brand-hover: #12703a;

  /* status: one meaning everywhere */
  --st-planned: #64748b;   --st-planned-bg: #eef2f6;   --st-planned-ink: #3f4b5b;
  --st-progress: #d97706;  --st-progress-bg: #fef3c7;  --st-progress-ink: #8a4b06;
  --st-scheduled: #4f46e5; --st-scheduled-bg: #e9e8fd; --st-scheduled-ink: #3730a3;
  --st-posted: #16a34a;    --st-posted-bg: #dcfce7;    --st-posted-ink: #14612f;
  --st-problem: #dc2626;   --st-problem-bg: #fee2e2;   --st-problem-ink: #9b1c1c;
  --st-neutral: #8a938c;   --st-neutral-bg: #eef0ed;   --st-neutral-ink: #535c56;

  /* formats: seven families */
  --f-explainer: #0d9488; --f-explainer-bg: #d5f5f0; --f-explainer-ink: #0b5d55;
  --f-jargon: #9333ea;    --f-jargon-bg: #f1e6fe;    --f-jargon-ink: #6b21a8;
  --f-step: #0284c7;      --f-step-bg: #dff0fc;      --f-step-ink: #075985;
  --f-myth: #ea580c;      --f-myth-bg: #ffead8;      --f-myth-ink: #9a3412;
  --f-story: #db2777;     --f-story-bg: #fce4ef;     --f-story-ink: #9d174d;
  --f-money: #65a30d;     --f-money-bg: #eaf7d4;     --f-money-ink: #3f6212;
  --f-weekend: #b07d05;   --f-weekend-bg: #fdf3c4;   --f-weekend-ink: #713f12;

  /* series */
  --series-startup: #16833f; --series-startup-ink: #ffffff;
  --series-biz: #1f2a44;     --series-biz-ink: #fcd34d;

  /* type */
  --font-head: 'Poppins', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  /* spacing (4px base) */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px;
  --gutter: 16px; --card-pad: 16px; --gap: 12px; --section: 28px;
  --r-card: 14px; --r-ctl: 10px; --r-pill: 999px;
  --tap: 44px;
  --topbar: 56px; --tabbar: 64px; --sidebar: 240px;
  --shadow: 0 1px 2px rgba(18, 26, 21, .05), 0 1px 1px rgba(18, 26, 21, .03);
  --shadow-lg: 0 18px 50px rgba(18, 26, 21, .18);
}

@media (min-width: 1024px) {
  :root { --gutter: 32px; --card-pad: 22px; --gap: 16px; --section: 40px; }
}

/* ---------- base ---------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; color: var(--ink); font: 400 16px/1.5 var(--font-body);
  background-color: var(--bg);
  background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 24px 24px; background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}
@media (min-width: 1024px) { body { font-size: 15px; } }
h1, h2, h3 { font-family: var(--font-head); font-weight: 600; letter-spacing: -.01em; margin: 0; color: var(--ink); }
h1 { font-size: 26px; line-height: 32px; }
h2 { font-size: 19px; line-height: 26px; }
h3 { font-size: 16px; line-height: 22px; }
@media (min-width: 1024px) { h1 { font-size: 30px; line-height: 38px; } h2 { font-size: 20px; } }
a { color: var(--brand-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
code, .mono, pre { font-family: var(--font-mono); }
code { font-size: .88em; background: var(--surface-2); padding: 1px 5px; border-radius: 5px; overflow-wrap: anywhere; }
pre { font-size: 12.5px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-ctl); padding: var(--s3); overflow-x: auto; white-space: pre-wrap; word-break: break-word; }
img { max-width: 100%; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 45%, transparent); outline-offset: 2px; }
.num, .tnum { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.label { font: 500 12px/16px var(--font-mono); text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3); }
.muted { color: var(--ink-3); }
.ink2 { color: var(--ink-2); }
.small { font-size: 14px; line-height: 20px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* =====================================================================
   SHELL
   ===================================================================== */
.app { min-height: 100vh; }
.topbar {
  position: sticky; top: 0; z-index: 30; height: calc(var(--topbar) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) var(--gutter) 0; display: flex; align-items: center; gap: var(--s3);
  background: rgba(255, 255, 255, .92); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line);
}
.topbar .mark { width: 32px; height: 32px; flex: none; }
.topbar-title { font: 600 18px/24px var(--font-head); flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-actions { display: flex; align-items: center; gap: var(--s1); }
.back-btn { margin-left: -10px; }

.mode-chip { font: 600 11px/1 var(--font-mono); letter-spacing: .06em; padding: 6px 8px; border-radius: var(--r-pill); border: 1.5px dashed var(--line-strong); color: var(--ink-2); background: var(--surface); white-space: nowrap; }
.mode-chip.live { border-style: solid; border-color: var(--st-posted); color: var(--st-posted-ink); background: var(--st-posted-bg); }

.health { width: var(--tap); height: var(--tap); display: grid; place-items: center; border-radius: var(--r-ctl); }
.health i { width: 12px; height: 12px; border-radius: 50%; display: block; box-shadow: 0 0 0 4px var(--surface); }
.health.h-ok i { background: var(--st-posted); }
.health.h-warn i { background: var(--st-progress); }
.health.h-problem i { background: var(--st-problem); animation: pulse 2s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 4px var(--surface), 0 0 0 8px color-mix(in srgb, var(--st-problem) 25%, transparent); } }

.icon-btn { width: var(--tap); height: var(--tap); display: inline-grid; place-items: center; border-radius: var(--r-ctl); color: var(--ink-2); background: none; border: 0; cursor: pointer; padding: 0; }
.icon-btn:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.icon-btn svg, .tab svg, .side-link svg { width: 22px; height: 22px; }

.main { padding: var(--s4) var(--gutter) calc(var(--tabbar) + env(safe-area-inset-bottom) + var(--s6)); max-width: 1040px; margin: 0 auto; }
.main > * + * { margin-top: var(--section); }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: grid; grid-template-columns: repeat(4, 1fr);
  height: calc(var(--tabbar) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: rgba(255, 255, 255, .96); backdrop-filter: blur(10px); border-top: 1px solid var(--line);
}
.tab { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--ink-3); font: 500 11px/14px var(--font-body); min-height: var(--tap); position: relative; }
.tab:hover { text-decoration: none; color: var(--ink); }
.tab.on { color: var(--brand-ink); }
.tab.on::before { content: ""; position: absolute; top: 0; left: 30%; right: 30%; height: 3px; border-radius: 0 0 3px 3px; background: var(--brand); }
.tab .tab-badge { position: absolute; top: 8px; left: calc(50% + 6px); min-width: 8px; height: 8px; border-radius: 50%; background: var(--st-problem); }

.sidebar { display: none; }

@media (min-width: 1024px) {
  .tabbar, .topbar { display: none; }
  /* sidebar is fixed to the window: it never scrolls with the page */
  .app { display: block; }
  .app-main { margin-left: var(--sidebar); }
  .sidebar { display: block; position: fixed; top: 0; left: 0; bottom: 0; width: var(--sidebar); z-index: 20; background: var(--surface); border-right: 1px solid var(--line); overflow-y: auto; overscroll-behavior: contain; }
  .side-inner { display: flex; flex-direction: column; min-height: 100%; padding: var(--s5) var(--s4); }
  .side-brand { display: flex; align-items: center; gap: var(--s3); font: 600 17px/22px var(--font-head); color: var(--ink); padding: 0 var(--s2) var(--s5); }
  .side-brand:hover { text-decoration: none; }
  .side-brand .mark { width: 34px; height: 34px; }
  .side-nav { display: flex; flex-direction: column; gap: 2px; }
  .side-link { display: flex; align-items: center; gap: var(--s3); min-height: var(--tap); padding: 0 var(--s3); border-radius: var(--r-ctl); color: var(--ink-2); font-weight: 500; position: relative; }
  .side-link:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
  .side-link.on { background: var(--brand-soft); color: var(--brand-ink); font-weight: 600; }
  .side-link .count { margin-left: auto; font: 600 12px/1 var(--font-mono); background: var(--st-problem); color: #fff; padding: 4px 7px; border-radius: var(--r-pill); }
  .side-sep { height: 1px; background: var(--line); margin: var(--s3) var(--s2); }
  .side-foot { margin-top: auto; display: flex; flex-direction: column; gap: var(--s2); padding: var(--s3) var(--s2) 0; border-top: 1px solid var(--line); }
  .side-status { display: flex; align-items: center; gap: var(--s2); font-size: 14px; color: var(--ink-2); min-height: var(--tap); }
  .side-status .health { width: 20px; height: 20px; }
  .main { padding: var(--s6) var(--gutter) var(--s7); }
}

/* page header (in content) */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s4); flex-wrap: wrap; }
.page-head .sub { color: var(--ink-3); margin-top: 2px; font-size: 15px; }
@media (max-width: 1023px) { .page-head.hide-phone { display: none; } }

/* =====================================================================
   COMPONENTS
   ===================================================================== */

/* section */
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s3); margin-bottom: var(--s3); }
.section-head h2 { display: flex; align-items: baseline; gap: var(--s2); flex-wrap: wrap; }
.section-head .meta { font: 500 13px/18px var(--font-mono); color: var(--ink-3); }
.link-more { display: inline-flex; align-items: center; justify-content: center; min-height: var(--tap); min-width: var(--tap); padding: 0 6px; font-weight: 500; font-size: 15px; white-space: nowrap; }

/* card */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); padding: var(--card-pad); box-shadow: var(--shadow); min-width: 0; }
.card.flush { padding: 0; overflow: hidden; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2); min-height: var(--tap); padding: 0 18px;
  border-radius: var(--r-ctl); border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  font: 600 15px/1 var(--font-body); cursor: pointer; white-space: nowrap; text-decoration: none; transition: background .12s, border-color .12s;
}
.btn:hover { text-decoration: none; background: var(--surface-2); border-color: var(--ink-3); }
.btn-primary, .btn.primary { background: var(--brand-strong); border-color: var(--brand-strong); color: #fff; }
.btn-primary:hover, .btn.primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); }
.btn-tertiary { border-color: transparent; background: none; color: var(--brand-ink); padding: 0 10px; }
.btn-tertiary:hover { background: var(--brand-soft); border-color: transparent; }
.btn-danger, .btn.danger { color: var(--st-problem-ink); border-color: color-mix(in srgb, var(--st-problem) 45%, white); }
.btn-danger:hover, .btn.danger:hover { background: var(--st-problem-bg); border-color: var(--st-problem); }
.btn-danger-solid { background: var(--st-problem); border-color: var(--st-problem); color: #fff; }
.btn-danger-solid:hover { background: #b91c1c; border-color: #b91c1c; }
.btn.block { width: 100%; }
.btn svg { width: 18px; height: 18px; }
.btn.small { padding: 0 14px; font-size: 14px; }
button.link { background: none; border: 0; color: var(--ink-3); cursor: pointer; font: inherit; min-height: var(--tap); padding: 0; }
.btn-row { display: flex; flex-wrap: wrap; gap: var(--s2); }

/* status chip: dot + mono label */
.status { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px 0 8px; border-radius: var(--r-pill); font: 600 11.5px/1 var(--font-mono); text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; vertical-align: middle; }
.status i { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.s-planned { background: var(--st-planned-bg); color: var(--st-planned-ink); } .s-planned i { background: var(--st-planned); }
.s-progress { background: var(--st-progress-bg); color: var(--st-progress-ink); } .s-progress i { background: var(--st-progress); }
.s-scheduled { background: var(--st-scheduled-bg); color: var(--st-scheduled-ink); } .s-scheduled i { background: var(--st-scheduled); }
.s-posted { background: var(--st-posted-bg); color: var(--st-posted-ink); } .s-posted i { background: var(--st-posted); }
.s-problem { background: var(--st-problem-bg); color: var(--st-problem-ink); } .s-problem i { background: var(--st-problem); }
.s-neutral { background: var(--st-neutral-bg); color: var(--st-neutral-ink); } .s-neutral i { background: var(--st-neutral); }

/* format chip: colour square + label */
.fmt { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 8px; border-radius: 7px; font: 500 13px/1 var(--font-body); white-space: nowrap; vertical-align: middle; background: var(--surface-2); color: var(--ink-2); }
.fmt i { width: 8px; height: 8px; border-radius: 2px; flex: none; background: var(--ink-3); }
.f-explainer { background: var(--f-explainer-bg); color: var(--f-explainer-ink); } .f-explainer i { background: var(--f-explainer); }
.f-jargon { background: var(--f-jargon-bg); color: var(--f-jargon-ink); } .f-jargon i { background: var(--f-jargon); }
.f-step { background: var(--f-step-bg); color: var(--f-step-ink); } .f-step i { background: var(--f-step); }
.f-myth { background: var(--f-myth-bg); color: var(--f-myth-ink); } .f-myth i { background: var(--f-myth); }
.f-story { background: var(--f-story-bg); color: var(--f-story-ink); } .f-story i { background: var(--f-story); }
.f-money { background: var(--f-money-bg); color: var(--f-money-ink); } .f-money i { background: var(--f-money); }
.f-weekend { background: var(--f-weekend-bg); color: var(--f-weekend-ink); } .f-weekend i { background: var(--f-weekend); }

/* series tag */
.series { display: inline-flex; align-items: center; height: 22px; padding: 0 7px; border-radius: 6px; font: 600 11.5px/1 var(--font-mono); letter-spacing: .03em; white-space: nowrap; vertical-align: middle; }
.series-startup { background: var(--series-startup); color: var(--series-startup-ink); }
.series-biz { background: var(--series-biz); color: var(--series-biz-ink); }
.series-other { background: var(--st-neutral-bg); color: var(--st-neutral-ink); }
.chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }

/* alert strip */
.alerts { display: flex; flex-direction: column; gap: var(--s2); }
.alert { display: flex; align-items: center; gap: var(--s3); min-height: 52px; padding: 6px 6px 6px var(--s4); border-radius: var(--r-ctl); border: 1px solid; font-size: 15px; line-height: 20px; }
.alert svg { width: 20px; height: 20px; flex: none; }
.alert .msg { flex: 1; min-width: 0; padding: 6px 0; }
.alert .msg strong { font-weight: 600; }
.alert .btn { min-height: 40px; height: 40px; flex: none; }
.alert .btn, .alert a.btn { min-height: var(--tap); }
.a-warn { background: var(--st-progress-bg); border-color: color-mix(in srgb, var(--st-progress) 35%, white); color: var(--st-progress-ink); }
.a-problem { background: var(--st-problem-bg); border-color: color-mix(in srgb, var(--st-problem) 35%, white); color: var(--st-problem-ink); }
.a-info { background: var(--surface); border-color: var(--line); color: var(--ink-2); }
.a-ok { background: var(--st-posted-bg); border-color: color-mix(in srgb, var(--st-posted) 35%, white); color: var(--st-posted-ink); }
.alert .btn { background: rgba(255,255,255,.75); border-color: currentColor; color: inherit; }

/* problem card */
.problem { background: var(--surface); border: 1px solid color-mix(in srgb, var(--st-problem) 40%, white); border-left: 5px solid var(--st-problem); border-radius: var(--r-card); padding: var(--card-pad); box-shadow: var(--shadow); }
.problem-top { display: flex; align-items: flex-start; gap: var(--s3); }
.problem .p-icon { width: 36px; height: 36px; border-radius: 10px; background: var(--st-problem-bg); color: var(--st-problem); display: grid; place-items: center; flex: none; }
.problem .p-icon svg { width: 20px; height: 20px; }
.problem h3 { font-size: 17px; }
.problem .p-what { margin: 6px 0 0; color: var(--ink-2); font-size: 15px; }
.problem .p-next { margin: var(--s2) 0 0; font-size: 15px; }
.problem .btn-row { margin-top: var(--s4); }
.problem details { margin-top: var(--s3); }
.problem summary { min-height: var(--tap); display: inline-flex; align-items: center; color: var(--ink-3); font-size: 14px; cursor: pointer; list-style: none; }
.problem summary::-webkit-details-marker { display: none; }
.problem summary::after { content: " ▾"; margin-left: 4px; }

/* slot row */
.slot-list { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); box-shadow: var(--shadow); overflow: hidden; }
.slot-row { display: flex; align-items: center; gap: var(--s3); padding: var(--s3) var(--s3) var(--s3) var(--s4); min-height: 72px; color: var(--ink); position: relative; border-top: 1px solid var(--line); }
.slot-row:first-child { border-top: 0; }
a.slot-row:hover { background: var(--surface-2); text-decoration: none; }
.slot-row::before { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 4px; border-radius: 0 4px 4px 0; background: var(--bar, transparent); }
.slot-row.t-planned { --bar: var(--st-planned); }
.slot-row.t-progress { --bar: var(--st-progress); }
.slot-row.t-scheduled { --bar: var(--st-scheduled); }
.slot-row.t-posted { --bar: var(--st-posted); }
.slot-row.t-problem { --bar: var(--st-problem); }
.slot-time { width: 52px; flex: none; font: 600 15px/20px var(--font-mono); color: var(--ink); }
.slot-time small { display: block; font: 500 11px/14px var(--font-mono); color: var(--ink-3); text-transform: uppercase; letter-spacing: .04em; }
.thumb9 { width: 44px; height: 78px; border-radius: 8px; object-fit: cover; flex: none; background: var(--surface-2); border: 1px solid var(--line); }
.thumb9.ph { display: grid; place-items: center; font: 600 11px/1 var(--font-mono); color: var(--ink-3); text-align: center; }
.thumb9.ph.f-explainer, .thumb9.ph.f-jargon, .thumb9.ph.f-step, .thumb9.ph.f-myth, .thumb9.ph.f-story, .thumb9.ph.f-money, .thumb9.ph.f-weekend { border-color: transparent; }
.slot-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.slot-title { font-weight: 600; line-height: 21px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.slot-sub { font-size: 14px; line-height: 19px; color: var(--ink-3); }
.slot-sub .num { color: var(--ink); font-weight: 600; }
.slot-chevron { color: var(--line-strong); flex: none; width: 20px; height: 20px; }
.slot-row.muted-row { min-height: 56px; }
.slot-row.muted-row .slot-title { font-weight: 500; color: var(--ink-3); }

/* stat tile */
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gap); }
@media (min-width: 640px) { .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.stat-tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); padding: var(--s4); box-shadow: var(--shadow); min-width: 0; }
.stat-tile .value { font: 600 28px/34px var(--font-mono); font-variant-numeric: tabular-nums; margin: 6px 0 4px; letter-spacing: -.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-tile .foot { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; font-size: 13px; color: var(--ink-3); }
.stats .stat-tile:nth-child(3):last-child { grid-column: span 2; }
@media (min-width: 640px) { .stats .stat-tile:nth-child(3):last-child { grid-column: auto; } }
.delta { display: inline-flex; align-items: center; height: 22px; padding: 0 7px; border-radius: 6px; font: 600 12px/1 var(--font-mono); font-variant-numeric: tabular-nums; }
.delta.up { background: var(--st-posted-bg); color: var(--st-posted-ink); }
.delta.down { background: var(--st-problem-bg); color: var(--st-problem-ink); }
.delta.flat { background: var(--st-neutral-bg); color: var(--st-neutral-ink); }

/* charts */
.chart-card .chart-box { position: relative; height: 180px; margin-top: var(--s3); }
@media (min-width: 1024px) { .chart-card .chart-box { height: 220px; } }
.charts { display: grid; gap: var(--gap); }
@media (min-width: 760px) { .charts { grid-template-columns: 1fr 1fr; } }

/* empty state */
.empty { text-align: left; padding: var(--s5) var(--card-pad); background: var(--surface); border: 1px dashed var(--line-strong); border-radius: var(--r-card); }
.empty h3 { font-size: 16px; }
.empty p { margin: 6px 0 0; color: var(--ink-2); font-size: 15px; }
.empty .btn-row { margin-top: var(--s4); }

/* toast */
.toast-wrap { position: fixed; left: 0; right: 0; bottom: calc(var(--tabbar) + env(safe-area-inset-bottom) + 12px); z-index: 60; display: flex; justify-content: center; padding: 0 var(--gutter); pointer-events: none; }
@media (min-width: 1024px) { .toast-wrap { bottom: 24px; left: var(--sidebar); } }
.toast { pointer-events: auto; display: flex; align-items: center; gap: var(--s2); max-width: 560px; width: 100%; min-height: 56px; padding: 6px 6px 6px var(--s4); border-radius: 12px; background: #17201a; color: #f3f6f3; box-shadow: var(--shadow-lg); font-size: 15px; line-height: 20px; animation: toast-in .2s ease-out; }
.toast .msg { flex: 1; min-width: 0; padding: 8px 0; white-space: pre-line; }
.toast .msg::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 10px; vertical-align: 1px; background: var(--toast-dot, #4ade80); }
.toast.t-warn { --toast-dot: #fbbf24; } .toast.t-error { --toast-dot: #f87171; }
.toast .undo { min-height: var(--tap); padding: 0 14px; border: 0; border-radius: 8px; background: rgba(255,255,255,.12); color: #86efac; font: 600 15px/1 var(--font-body); cursor: pointer; }
.toast .undo:hover { background: rgba(255,255,255,.2); }
.toast .x { color: #c9d1ca; }
.toast .x:hover { background: rgba(255,255,255,.1); color: #fff; }
.toast.hide { opacity: 0; transform: translateY(8px); transition: .2s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* bottom sheet (phone) / modal (laptop) */
dialog.sheet { border: 0; padding: 0; margin: auto auto 0; width: 100%; max-width: 100%; max-height: 88vh; border-radius: 20px 20px 0 0; background: var(--surface); color: var(--ink); box-shadow: var(--shadow-lg); }
dialog.sheet::backdrop { background: rgba(14, 20, 16, .45); }
dialog.sheet[open] { animation: sheet-up .22s ease-out; display: flex; flex-direction: column; }
@keyframes sheet-up { from { transform: translateY(40px); opacity: 0; } }
.sheet-grab { width: 40px; height: 4px; border-radius: 2px; background: var(--line-strong); margin: 10px auto 0; }
.sheet-head { display: flex; align-items: center; gap: var(--s2); padding: var(--s3) var(--s2) 0 var(--s5); }
.sheet-head h2 { flex: 1; font-size: 19px; }
.sheet-body { padding: var(--s2) var(--s5) var(--s3); overflow-y: auto; color: var(--ink-2); }
.sheet-body p { margin: 0 0 var(--s3); }
.sheet-actions { display: flex; flex-direction: column-reverse; gap: var(--s2); padding: var(--s3) var(--s5) calc(var(--s5) + env(safe-area-inset-bottom)); }
.sheet-actions .btn { width: 100%; min-height: 48px; }
@media (min-width: 640px) {
  dialog.sheet { margin: auto; max-width: 480px; border-radius: 18px; }
  .sheet-grab { display: none; }
  .sheet-head { padding-top: var(--s4); }
  .sheet-actions { flex-direction: row; justify-content: flex-end; padding-bottom: var(--s5); }
  .sheet-actions .btn { width: auto; min-height: var(--tap); }
}
.sheet-list { display: flex; flex-direction: column; margin: 0 calc(-1 * var(--s5)); }
.sheet-list .slot-row { padding-left: var(--s5); }

/* segmented list rows */
.rows { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); box-shadow: var(--shadow); overflow: hidden; }
.row { display: flex; align-items: center; gap: var(--s3); min-height: 56px; padding: var(--s2) var(--s3) var(--s2) var(--s4); border-top: 1px solid var(--line); color: var(--ink); }
.row:first-child { border-top: 0; }
a.row:hover { background: var(--surface-2); text-decoration: none; }
.row .when { font: 600 13px/18px var(--font-mono); color: var(--ink-2); width: 88px; flex: none; }
.row .what { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.row .what .t { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* =====================================================================
   PAGES
   ===================================================================== */

/* Today */
.today-day { display: flex; flex-direction: column; gap: var(--s3); }
.day-label { display: flex; align-items: baseline; gap: var(--s2); }
.day-label .date { font: 500 14px/20px var(--font-mono); color: var(--ink-3); }
@media (min-width: 1024px) {
  .days { display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap); }
  .days > * + * { margin-top: 0; }
}
.days > * + * { margin-top: var(--section); }
@media (min-width: 1024px) { .days > * + * { margin-top: 0; } }

/* login */
.login-page { min-height: 100vh; display: grid; place-items: center; padding: var(--s4); }
.login { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: var(--s4); padding: var(--s5); }
.login-brand { display: flex; align-items: center; justify-content: center; gap: var(--s3); font: 600 22px/28px var(--font-head); margin-bottom: var(--s2); }
.login-brand .mark { width: 40px; height: 40px; }
.login input { width: 100%; }
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 52px; }
.pw-wrap .icon-btn { position: absolute; right: 2px; top: 2px; }

/* =====================================================================
   FORMS
   ===================================================================== */
input, select, textarea { font: 400 16px/22px var(--font-body); color: var(--ink); background: #fff; border: 1px solid var(--line-strong); border-radius: var(--r-ctl); padding: 10px 12px; min-height: var(--tap); max-width: 100%; }
@media (min-width: 1024px) { input, select, textarea { font-size: 15px; } }
input:focus, select:focus, textarea:focus { outline: 3px solid color-mix(in srgb, var(--brand) 25%, transparent); border-color: var(--brand); }
textarea { width: 100%; resize: vertical; }
label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 500; color: var(--ink-2); }
input[type=checkbox], input[type=radio] { min-height: 0; width: 20px; height: 20px; accent-color: var(--brand); }
.stack { display: flex; flex-direction: column; gap: var(--s3); align-items: flex-start; }
.stack textarea, .stack label { width: 100%; }

/* =====================================================================
   LEGACY (pages not yet rebuilt: Plan, Videos, Review, Settings, Log)
   Restyled with the new tokens; replaced phase by phase.
   ===================================================================== */
.page-title { font-size: 24px; }
.flash { display: none; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap); }
.grid2.tight { gap: var(--s3); }
.stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: var(--gap); }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); padding: var(--s4); box-shadow: var(--shadow); min-width: 0; }
.stat .k, .k { font: 500 12px/16px var(--font-mono); text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3); }
.stat .v, .v { font: 600 24px/30px var(--font-mono); margin: 4px 0; font-variant-numeric: tabular-nums; }
.up { color: var(--st-posted-ink) !important; } .down { color: var(--st-problem-ink) !important; }
.center { text-align: center; } .nowrap { white-space: nowrap; } .err { color: var(--st-problem-ink); } .clip { display: inline; } .grow { flex: 1; min-width: 0; }
.note { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-ctl); padding: var(--s3); font-size: 14px; color: var(--ink-2); }
.pill { font: 600 11px/1 var(--font-mono); padding: 5px 8px; border-radius: var(--r-pill); letter-spacing: .05em; }
.pill-mock { border: 1.5px dashed var(--line-strong); color: var(--ink-2); }
.pill-live { background: var(--st-posted-bg); color: var(--st-posted-ink); }
.actions { display: flex; flex-wrap: wrap; gap: var(--s2); margin-top: var(--s3); }
.filters { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; padding: var(--s3); }
.filters label { flex-direction: row; align-items: center; gap: 6px; min-height: var(--tap); }
.inline-form { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; margin-top: var(--s3); font-size: 14px; }
.radio-row { display: flex; gap: var(--s4); flex-wrap: wrap; }
.radio-row label { flex-direction: row; align-items: center; gap: var(--s2); min-height: var(--tap); }
details > summary { cursor: pointer; }
details.card > summary { list-style: none; min-height: var(--tap); display: flex; align-items: center; }
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary h2 { display: inline; }
details.card > summary::after { content: " ▾"; color: var(--ink-3); margin-left: 6px; }
.switch { flex-direction: row; align-items: center; gap: var(--s3); flex-wrap: wrap; min-height: var(--tap); }
.switch input { position: absolute; opacity: 0; }
.switch span:first-of-type { width: 44px; height: 26px; border-radius: 99px; background: var(--line-strong); position: relative; transition: .15s; flex: none; }
.switch span:first-of-type::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + span { background: var(--brand); }
.switch input:checked + span::after { left: 21px; }
.keybox { display: flex; gap: var(--s2); align-items: center; margin: var(--s2) 0; flex-wrap: wrap; }
.keybox code { padding: 10px 12px; border-radius: var(--r-ctl); word-break: break-all; }
.badge { display: none; }
.post { display: flex; gap: var(--s3); align-items: center; padding: var(--s2); border-radius: var(--r-ctl); color: var(--ink); }
.post img, .post .ph { width: 54px; height: 96px; object-fit: cover; border-radius: 8px; background: var(--surface-2); flex: none; }
.post.big img { width: 72px; height: 128px; }
.post.best { border-left: 5px solid var(--st-posted); } .post.worst { border-left: 5px solid var(--st-neutral); }
.row-item { display: flex; justify-content: space-between; align-items: center; gap: var(--s3); padding: var(--s2) 0; border-top: 1px solid var(--line); }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font: 500 11.5px/16px var(--font-mono); text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3); padding: 10px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; white-space: nowrap; font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
table.compact td { padding: 7px 8px; }
tr.clickable { cursor: pointer; } tr.clickable:hover { background: var(--surface-2); }
.thumb { width: 36px; height: 64px; object-fit: cover; border-radius: 6px; display: block; background: var(--surface-2); }
.table-card { padding: 6px; }
.crumbs { font-size: 15px; }
.crumbs a { display: inline-flex; align-items: center; min-height: var(--tap); }
.video-head { display: flex; gap: var(--s5); }
.video-head .cover { width: 150px; aspect-ratio: 9/16; object-fit: cover; border-radius: 10px; flex: none; background: var(--surface-2); }
.lead { font-size: 17px; margin: var(--s2) 0; }
.meta { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; font-size: 14px; margin: var(--s3) 0 0; }
.meta dt { color: var(--ink-3); } .meta dd { margin: 0; overflow-wrap: anywhere; }
.metric-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--s3); }
.caption { margin: 0; font-family: var(--font-body); font-size: 14px; }
.checks { list-style: none; padding: 0; margin: 0 0 var(--s3); }
.checks li { display: flex; gap: var(--s3); padding: var(--s2) 0; border-bottom: 1px solid var(--line); }
.checks .ic { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 12px; flex: none; }
.checks .ok .ic { background: var(--st-posted-bg); color: var(--st-posted-ink); }
.checks .warn .ic { background: var(--st-progress-bg); color: var(--st-progress-ink); }
.checks .bad .ic { background: var(--st-problem-bg); color: var(--st-problem-ink); }
.checks .muted { overflow-wrap: anywhere; }
.chart-box { position: relative; height: 260px; }
.week-nav { display: flex; gap: var(--s2); align-items: center; flex-wrap: wrap; }
.prose p { margin: 0 0 var(--s3); }
.prose h1, .prose h2, .prose h3 { margin: var(--s4) 0 var(--s2); }
.status-counts { display: flex; flex-wrap: wrap; gap: var(--s2); margin-bottom: var(--s2); }
.status-counts a { color: var(--ink); display: flex; align-items: center; gap: 6px; min-height: var(--tap); }
.month-h { margin: var(--s5) 0 var(--s2); }
.week-h { font: 500 12px/16px var(--font-mono); color: var(--ink-3); text-transform: uppercase; margin: var(--s3) 0 var(--s2); letter-spacing: .04em; }
.plan-list { display: flex; flex-direction: column; }
.topic { display: grid; grid-template-columns: 92px 1fr auto auto; gap: var(--s3); align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-ctl); padding: var(--s2) var(--s3); margin-bottom: 6px; scroll-margin-top: 80px; }
.topic.today { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); }
.topic.st-posted { opacity: .75; }
.t-date { font: 500 13px/18px var(--font-mono); color: var(--ink-3); }
.t-meta { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; margin-bottom: 2px; }
.slot { display: none; }
.theme-tag { font-size: 12.5px; color: var(--ink-3); }
.t-topic { font-weight: 500; }
.t-actions { display: flex; gap: 0; }
.icon { background: none; border: 0; cursor: pointer; min-width: var(--tap); min-height: var(--tap); border-radius: 8px; color: var(--ink-3); font-size: 16px; display: inline-grid; place-items: center; }
.icon:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.topic-edit { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.topic-edit .grow { flex: 1 1 260px; }
.missed-tag { font: 600 10.5px/14px var(--font-mono); color: var(--st-problem-ink); text-transform: uppercase; }
.empty-state { border-style: dashed; }
.card.backlog { border-color: var(--line-strong); }
.backlog-item { display: flex; gap: var(--s3); align-items: center; padding: var(--s3) 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.backlog-item:first-of-type { border-top: 0; }
.link-btn { border: 0; background: none; color: var(--ink-3); font-weight: 500; text-decoration: underline; min-height: var(--tap); cursor: pointer; }
.log-line { font-size: 14px; padding: var(--s2) 0; border-bottom: 1px solid var(--line); }
.log-line:last-child { border-bottom: 0; }
.log-line .tag { font: 500 11px/1 var(--font-mono); background: var(--surface-2); padding: 3px 6px; border-radius: 5px; color: var(--ink-3); }
.lvl-warn { color: var(--st-progress-ink); } .lvl-error { color: var(--st-problem-ink); }
@media (max-width: 760px) {
  .grid2 { grid-template-columns: 1fr; }
  .stats-row { grid-template-columns: 1fr 1fr; }
  .video-head { flex-direction: column; }
  .video-head .cover { width: 120px; }
  .topic { grid-template-columns: 1fr auto; gap: 4px 8px; }
  .t-date { grid-column: 1; } .t-status { grid-column: 2; grid-row: 1; }
  .t-main { grid-column: 1 / -1; } .t-actions { grid-column: 1 / -1; justify-content: flex-end; }
  .chart-box { height: 220px; }
}

/* sheet actions with forms */
.sheet-actions form { width: 100%; }
@media (min-width: 640px) { .sheet-actions form { width: auto; } }
.thumb9.ph { white-space: pre-line; line-height: 13px; font-size: 9.5px; letter-spacing: .04em; }
.login .pw-wrap { display: block; }
.login label { color: var(--ink-2); }

/* =====================================================================
   v1.1 refinements (Phase 1 feedback)
   ===================================================================== */
:root {
  /* chart colours: neutral, never reuse status meanings */
  --chart-1: #2f6b5e;   /* pine: primary series (5.9:1 on white) */
  --chart-2: #6e8f85;   /* sage: secondary series (3.6:1) */
  --chart-3: #b9c4bd;   /* light sage: comparison/partial */
}

/* header issue button: warning icon + count badge (no red "record" dot) */
.issue-btn { position: relative; width: var(--tap); height: var(--tap); display: grid; place-items: center; border-radius: var(--r-ctl); }
.issue-btn:hover { background: var(--surface-2); text-decoration: none; }
.issue-btn svg { width: 22px; height: 22px; }
.issue-btn.h-problem { color: var(--st-problem); }
.issue-btn.h-warn { color: var(--st-progress); }
.issue-btn.h-ok { color: var(--st-posted); }
.issue-count { position: absolute; top: 5px; right: 3px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; font: 600 11px/18px var(--font-mono); text-align: center; color: #fff; box-shadow: 0 0 0 2px var(--surface); }
.h-problem .issue-count { background: var(--st-problem); }
.h-warn .issue-count { background: #b45309; }
.side-status svg { width: 18px; height: 18px; flex: none; }
.side-status.ss-problem { color: var(--st-problem-ink); } .side-status.ss-warn { color: var(--st-progress-ink); } .side-status.ss-ok { color: var(--st-posted-ink); }

/* compact alert: one tappable line (max 2 lines) + optional action */
.alert.compact { padding: 4px 4px 4px 14px; min-height: 52px; gap: 10px; }
.alert.compact .msg { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; padding: 4px 0; color: inherit; }
.alert.compact a.msg:hover { text-decoration: none; }
.alert.compact .btn { min-height: var(--tap); height: var(--tap); padding: 0 14px; font-size: 14px; }
.alert.compact .go { width: var(--tap); min-height: var(--tap); display: grid; place-items: center; color: inherit; opacity: .8; }
.alert.compact .go svg { width: 18px; height: 18px; }
.alert .why { font-weight: 400; opacity: .9; }

/* slot row v2: status via left bar + time/status text; one meta line */
.slot-time { width: 64px; }
.slot-time .st { display: block; margin-top: 2px; font: 600 10.5px/14px var(--font-mono); text-transform: uppercase; letter-spacing: .03em; }
.t-planned .slot-time .st { color: var(--st-planned-ink); }
.t-progress .slot-time .st { color: var(--st-progress-ink); }
.t-scheduled .slot-time .st { color: var(--st-scheduled-ink); }
.t-posted .slot-time .st { color: var(--st-posted-ink); }
.t-problem .slot-time .st { color: var(--st-problem-ink); }
.meta-line { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: 13px; line-height: 18px; white-space: nowrap; overflow: hidden; }
.meta-line .ser { font: 600 12px/18px var(--font-mono); letter-spacing: .02em; }
.meta-line .ser-startup { color: var(--brand-ink); }
.meta-line .ser-biz { color: var(--series-biz); }
.meta-line .ser-biz::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 2px; background: #fcd34d; box-shadow: inset 0 0 0 1px #d4a514; margin-right: 5px; vertical-align: 0; }
.meta-line .ser-other { color: var(--ink-3); }
.meta-line .sep { color: var(--line-strong); }
.meta-line .fam { display: inline-flex; align-items: center; gap: 5px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; background: none !important; }
.meta-line .fam i { width: 8px; height: 8px; border-radius: 2px; flex: none; background: var(--ink-3); }
.meta-line .fam.f-explainer { color: var(--f-explainer-ink); } .meta-line .fam.f-explainer i { background: var(--f-explainer); }
.meta-line .fam.f-jargon { color: var(--f-jargon-ink); } .meta-line .fam.f-jargon i { background: var(--f-jargon); }
.meta-line .fam.f-step { color: var(--f-step-ink); } .meta-line .fam.f-step i { background: var(--f-step); }
.meta-line .fam.f-myth { color: var(--f-myth-ink); } .meta-line .fam.f-myth i { background: var(--f-myth); }
.meta-line .fam.f-story { color: var(--f-story-ink); } .meta-line .fam.f-story i { background: var(--f-story); }
.meta-line .fam.f-money { color: var(--f-money-ink); } .meta-line .fam.f-money i { background: var(--f-money); }
.meta-line .fam.f-weekend { color: var(--f-weekend-ink); } .meta-line .fam.f-weekend i { background: var(--f-weekend); }

/* cover placeholders (missing or blank-dark covers) */
.thumb9.ph { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; white-space: normal; text-align: center; border: 0; }
.thumb9.ph span { font: 600 8.5px/1 var(--font-mono); letter-spacing: .06em; opacity: .9; }
.thumb9.ph b { font: 600 13px/1 var(--font-mono); }
.ph-startup { background: linear-gradient(160deg, #1d7a43, #0f4d2a); color: #fff; }
.ph-biz { background: linear-gradient(160deg, #2a3758, #161e33); color: #fcd34d; }
.ph-other { background: var(--st-neutral-bg); color: var(--st-neutral-ink); }
.ph-topic { background: repeating-linear-gradient(135deg, var(--surface-2) 0 6px, #eef1ec 6px 12px); color: var(--ink-3); border: 1px dashed var(--line-strong); }

/* KPI tiles: 3 in one compact row on phone */
.stats.kpi3 { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.stats.kpi3 .stat-tile { padding: 12px 10px 10px; }
.stats.kpi3 .stat-tile .value { font-size: 20px; line-height: 26px; margin: 4px 0 6px; }
.stats.kpi3 .stat-tile .foot { gap: 4px; font-size: 12px; line-height: 16px; }
.stats.kpi3 .label { font-size: 11px; }
.stats.kpi3 .stat-tile:nth-child(3):last-child { grid-column: auto; }
@media (min-width: 640px) {
  .stats.kpi3 { gap: var(--gap); }
  .stats.kpi3 .stat-tile { padding: var(--s4); }
  .stats.kpi3 .stat-tile .value { font-size: 28px; line-height: 34px; }
  .stats.kpi3 .stat-tile .foot { font-size: 13px; gap: var(--s2); }
}
.foot .sub2 { display: block; width: 100%; color: var(--ink-3); }

/* chart legend for "today" */
.chart-note { display: flex; align-items: center; gap: 6px; font: 500 12px/16px var(--font-mono); color: var(--ink-3); margin-top: 6px; }
.chart-note i { width: 12px; height: 12px; border-radius: 3px; background: repeating-linear-gradient(135deg, var(--chart-3) 0 3px, #fff 3px 6px); border: 1px solid var(--chart-3); }
.thumb9.ph.ph-startup { color: #fff; } .thumb9.ph.ph-biz { color: #fcd34d; } .thumb9.ph.ph-other { color: var(--st-neutral-ink); } .thumb9.ph.ph-topic { color: var(--ink-3); }
.slot-time { width: 58px; }
.slot-row { gap: 10px; }
.meta-line .fam { min-width: 0; }
.meta-line .fam span { overflow: hidden; text-overflow: ellipsis; }

/* ---------- Plan ---------- */
@media (max-width: 1023px) { .hide-phone-only { display: none; } }
.page-head .sub { flex: 1; min-width: 0; }
.page-head > .btn { flex: none; }
.seg { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; padding: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); }
.main > .seg { margin-top: var(--s4); }
.seg a { display: flex; align-items: center; justify-content: center; gap: 6px; min-height: var(--tap); border-radius: 9px; color: var(--ink-2); font-weight: 600; font-size: 14px; white-space: nowrap; }
.seg a:hover { background: var(--surface-2); text-decoration: none; }
.seg a.on { background: var(--brand-soft); color: var(--brand-ink); }
.seg-count { font: 600 11px/18px var(--font-mono); min-width: 20px; height: 20px; padding: 1px 6px; border-radius: 10px; background: var(--st-progress-bg); color: var(--st-progress-ink); text-align: center; }
.summary-line { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin: var(--s3) 0 0 !important; font-size: 14px; color: var(--ink-2); }
.main > .summary-line, .main > .jump { margin-top: var(--s3); }
.sum { display: inline-flex; align-items: center; gap: 6px; font-family: var(--font-mono); font-size: 13px; }
.sum i { width: 8px; height: 8px; border-radius: 50%; }
.sum.s-planned i { background: var(--st-planned); } .sum.s-progress i { background: var(--st-progress); } .sum.s-scheduled i { background: var(--st-scheduled); }
.sum.s-posted i { background: var(--st-posted); } .sum.s-problem i { background: var(--st-problem); } .sum.s-neutral i { background: var(--st-neutral); }
.jump select { width: 100%; }
.week-group .week-head { display: flex; flex-direction: column; gap: 0; margin-bottom: var(--s2); position: sticky; top: calc(var(--topbar) + env(safe-area-inset-top)); z-index: 5; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(6px); padding: 8px 0 6px; }
@media (min-width: 1024px) { .week-group .week-head { top: 0; } }
.week-head small { font: 500 12.5px/18px var(--font-mono); color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.main > .week-group + .week-group { margin-top: var(--s5); }
.topic-row .slot-time { width: 64px; font-size: 14px; }
.topic-row .meta-line .ser, .topic-row .meta-line .sep { display: none; }
.topic-row.is-today { box-shadow: inset 0 0 0 2px var(--brand); border-radius: 0; background: var(--brand-soft); }
.topic-row.is-skipped .slot-title { text-decoration: line-through; color: var(--ink-3); }
.topic-row.t-neutral { --bar: var(--st-neutral); }
.slot-row.t-neutral { --bar: var(--st-neutral); }
.t-neutral .slot-time .st { color: var(--st-neutral-ink); }

/* topic sheet + actions */
.topic-info { padding-bottom: var(--s3); }
.topic-title { font-size: 19px; line-height: 26px; margin: 6px 0 10px; }
.action-list { display: flex; flex-direction: column; border-top: 1px solid var(--line); margin: 0 calc(-1 * var(--s5)); }
.card .action-list { margin: 0 calc(-1 * var(--card-pad)); }
.action-list form { margin: 0; }
.action-row { display: flex; align-items: center; gap: var(--s3); width: 100%; min-height: 60px; padding: 8px var(--s5); background: none; border: 0; border-bottom: 1px solid var(--line); text-align: left; cursor: pointer; color: var(--ink); font: inherit; list-style: none; }
.action-row::-webkit-details-marker { display: none; }
.action-row:hover { background: var(--surface-2); }
.action-row svg { width: 20px; height: 20px; color: var(--ink-3); flex: none; }
.action-row span { display: flex; flex-direction: column; min-width: 0; }
.action-row b { font-weight: 600; font-size: 15px; }
.action-row small { color: var(--ink-3); font-size: 13px; line-height: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.action-row.danger, .action-row.danger svg { color: var(--st-problem-ink); }
.action-edit[open] > .action-row { background: var(--surface-2); }
.edit-form, .assign-form { display: flex; flex-direction: column; gap: var(--s3); padding: var(--s4) var(--s5); border-bottom: 1px solid var(--line); }
.edit-form label, .assign-form label, .tools label { width: 100%; }
.edit-form input, .edit-form select, .edit-form textarea, .assign-form input, .tools input:not([type=radio]):not([type=checkbox]), .tools select, .tools textarea { width: 100%; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s3); }
fieldset.choice { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 2px; }
fieldset.choice legend { font-size: 14px; font-weight: 500; color: var(--ink-2); margin-bottom: 4px; }
fieldset.choice label { flex-direction: row; align-items: center; gap: 10px; min-height: var(--tap); font-weight: 400; color: var(--ink); }
.tools details { border-bottom: 1px solid var(--line); margin: 0 calc(-1 * var(--s5)); }
.tools details > form { padding: var(--s2) var(--s5) var(--s4); }
.tools details:last-child { border-bottom: 0; }
.tools .action-row { border-bottom: 0; }

/* ---------- Videos ---------- */
.toolbar { display: flex; gap: var(--s2); align-items: center; }
.main > .toolbar { margin-top: var(--s3); }
.toolbar .sort { flex: 1; min-width: 0; }
.toolbar select { width: 100%; }
.seg-count.bad { background: var(--st-problem-bg); color: var(--st-problem-ink); }
.active-filters { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; }
.main > .active-filters { margin-top: var(--s2); }
.filter-chip { display: inline-flex; align-items: center; gap: 6px; min-height: var(--tap); padding: 0 12px; border-radius: var(--r-pill); background: var(--surface); border: 1px solid var(--line-strong); color: var(--ink); font-size: 14px; font-weight: 500; }
.filter-chip:hover { text-decoration: none; background: var(--surface-2); }
.filter-chip svg { width: 16px; height: 16px; color: var(--ink-3); }
.main > .slot-list, .main > .card.video-table, .main > .empty { margin-top: var(--s4); }
.stat-line { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; font: 500 13px/18px var(--font-mono); color: var(--ink-3); }
.stat-line b { color: var(--ink); font-weight: 600; }
.fresh { display: inline-flex; align-items: center; height: 20px; padding: 0 6px; border-radius: 5px; background: var(--surface-2); border: 1px solid var(--line); font: 600 10.5px/1 var(--font-mono); color: var(--ink-3); text-transform: uppercase; letter-spacing: .03em; }
.fresh.new { background: var(--st-progress-bg); border-color: transparent; color: var(--st-progress-ink); }
.bad-text { color: var(--st-problem-ink); }
.video-table { display: none; }
@media (min-width: 1024px) {
  .video-cards { display: none; }
  .video-table { display: block; }
  .main > .card.video-table + * { margin-top: var(--s4); }
}
.video-table table { font-size: 14px; }
.video-table th { position: sticky; top: 0; background: var(--surface); z-index: 1; padding: 12px 10px; }
.video-table td { padding: 8px 10px; }
.video-table tbody tr:hover { background: var(--surface-2); }
.video-table td.num small { display: block; color: var(--ink-3); font-size: 11.5px; }
.vt-link { display: flex; align-items: center; gap: var(--s3); color: var(--ink); min-height: var(--tap); }
.vt-link:hover { text-decoration: none; }
.vt-link:hover .vt-title { text-decoration: underline; }
.vt-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.vt-title { font-weight: 600; max-width: 380px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thumb9.sm { width: 34px; height: 60px; border-radius: 6px; }
.thumb9.sm.ph span { font-size: 6.5px; } .thumb9.sm.ph b { font-size: 10px; }
.mono-sm { font: 500 13px/18px var(--font-mono); color: var(--ink-2); }
.video-table tr.t-problem td:first-child { box-shadow: inset 4px 0 var(--st-problem); }
.video-table tr.t-scheduled td:first-child { box-shadow: inset 4px 0 var(--st-scheduled); }

/* ---------- Video detail ---------- */
.video-hero { display: flex; gap: var(--s4); align-items: flex-start; position: relative; overflow: hidden; }
.video-hero::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--bar, transparent); }
.video-hero.t-posted { --bar: var(--st-posted); } .video-hero.t-scheduled { --bar: var(--st-scheduled); } .video-hero.t-problem { --bar: var(--st-problem); } .video-hero.t-progress { --bar: var(--st-progress); } .video-hero.t-neutral { --bar: var(--st-neutral); }
.thumb9.lg { width: 72px; height: 128px; border-radius: 10px; }
.thumb9.lg.ph span { font-size: 10px; } .thumb9.lg.ph b { font-size: 17px; }
@media (min-width: 1024px) { .thumb9.lg { width: 96px; height: 170px; } }
.video-title { font-size: 20px; line-height: 27px; margin: 4px 0 6px; }
@media (min-width: 1024px) { .video-title { font-size: 24px; line-height: 32px; } }
.state-line { display: flex; align-items: center; gap: 8px; margin: 0 0 var(--s3); font-size: 14px; font-weight: 500; }
.state-line .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.state-line.sl-posted { color: var(--st-posted-ink); } .state-line.sl-posted .dot { background: var(--st-posted); }
.state-line.sl-scheduled { color: var(--st-scheduled-ink); } .state-line.sl-scheduled .dot { background: var(--st-scheduled); }
.state-line.sl-problem { color: var(--st-problem-ink); } .state-line.sl-problem .dot { background: var(--st-problem); }
.state-line.sl-progress { color: var(--st-progress-ink); } .state-line.sl-progress .dot { background: var(--st-progress); }
.state-line.sl-neutral, .state-line.sl-planned { color: var(--ink-2); } .state-line.sl-neutral .dot { background: var(--st-neutral); }
.stats.kpi4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 760px) { .stats.kpi4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.stats.kpi4 .stat-tile .value { font-size: 24px; }
.legend { display: flex; gap: var(--s4); margin-top: 6px; font: 500 12px/16px var(--font-mono); color: var(--ink-2); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.kv { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s3) var(--s4); margin: var(--s3) 0 0; }
@media (min-width: 760px) { .kv { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.kv dt { font: 500 11.5px/16px var(--font-mono); text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3); }
.kv dd { margin: 2px 0 0; font-weight: 600; }
.kv.kv-wide { grid-template-columns: 1fr; }
.kv.kv-wide > div { display: grid; grid-template-columns: 110px 1fr; gap: var(--s3); align-items: baseline; }
.kv.kv-wide dd { font-weight: 400; overflow-wrap: anywhere; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.snap-table th, .snap-table td { padding: 10px 12px; }
.snap-table .wide, .snap-table .wide-inline { display: none; }
@media (min-width: 760px) { .snap-table .wide { display: table-cell; } .snap-table .wide-inline { display: inline; } }
.caption-text { white-space: pre-line; margin: var(--s2) 0 0; font-size: 15px; color: var(--ink-2); overflow-wrap: anywhere; }
.section-head h3 { margin: 0; }
.card > .section-head { margin-bottom: 0; }
.clamp2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.more-details { margin-top: var(--s2); }
.more-details > summary { min-height: var(--tap); display: inline-flex; align-items: center; color: var(--brand-ink); font-weight: 600; font-size: 15px; list-style: none; }
.more-details > summary::-webkit-details-marker { display: none; }
.more-details > summary::after { content: " ▾"; margin-left: 4px; }
#dry-run .checks.card { padding: 4px var(--card-pad); margin-top: var(--s2); }
#dry-run .alert { margin-bottom: 0; }
.activity { list-style: none; padding: 0; margin: var(--s2) 0 0; }
.activity li { display: grid; grid-template-columns: 96px 1fr; gap: var(--s3); padding: 8px 0; border-top: 1px solid var(--line); font-size: 14px; }
.activity li:first-child { border-top: 0; }
.activity .when { font: 500 12.5px/20px var(--font-mono); color: var(--ink-3); }
.activity .lvl-error { color: var(--st-problem-ink); }
.action-row.disabled { cursor: not-allowed; opacity: .6; }
.sheet .action-list { margin: 0 calc(-1 * var(--s5)); border-top: 0; }
.kv dd a { display: inline-flex; align-items: center; min-height: var(--tap); }
.video-table th { padding: 12px 8px; }
.video-table td { padding: 8px 8px; }
.vt-title { max-width: 300px; }
.video-table td:first-child, .video-table th:first-child { padding-left: 12px; }
.video-table td:last-child, .video-table th:last-child { padding-right: 14px; }
.vt-title { max-width: 250px; }
.alert.compact a.msg { padding: 8px 0; }
.edit-form input[type=radio], .assign-form input[type=radio], .edit-form input[type=checkbox], .assign-form input[type=checkbox] { width: 20px; flex: none; }
.sheet-head h2:focus { outline: none; }
.alert.compact a.msg { padding: 12px 0; min-height: var(--tap); }

/* ---------- Weekly review ---------- */
.week-switch { display: flex; align-items: center; gap: var(--s2); padding: 6px; }
.week-switch select { width: 100%; font-weight: 600; }
.main > .week-title { margin-top: var(--s4); }
.week-title { display: flex; align-items: center; flex-wrap: wrap; gap: var(--s2) var(--s3); }
.week-title h2 { font-size: 22px; }
.week-title .btn { margin-left: auto; }
.verdict { margin: 0; padding: 14px 16px; border-radius: var(--r-card); font: 600 17px/24px var(--font-head); border: 1px solid; }
.verdict.v-up { background: var(--st-posted-bg); color: var(--st-posted-ink); border-color: color-mix(in srgb, var(--st-posted) 30%, white); }
.verdict.v-down { background: var(--st-progress-bg); color: var(--st-progress-ink); border-color: color-mix(in srgb, var(--st-progress) 30%, white); }
.verdict.v-flat { background: var(--surface); color: var(--ink); border-color: var(--line); }
.stats.kpi6 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 760px) { .stats.kpi6 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.stats.kpi6 .stat-tile .value { font-size: 24px; }
.stats.kpi6 .stats .stat-tile:nth-child(3):last-child { grid-column: auto; }
.was { font: 500 12px/16px var(--font-mono); color: var(--ink-3); }
.too-new { display: flex; align-items: flex-start; gap: 8px; margin: var(--s3) 0 0; font-size: 14px; color: var(--ink-2); }
.too-new svg { width: 18px; height: 18px; flex: none; margin-top: 1px; color: var(--ink-3); }
.too-new a { display: inline-flex; align-items: center; min-height: var(--tap); }
.charts-v { display: grid; gap: var(--gap); }
@media (min-width: 1024px) { .charts-v { grid-template-columns: 1fr 1fr; } .charts-v > :first-child { grid-column: 1 / -1; } }
.tables .tbl-title { margin: var(--s4) 0 var(--s2); font-size: 15px; }
.avg-table { font-size: 14px; }
.avg-table th, .avg-table td { padding: 8px 6px; }
.avg-table .wide { display: none; }
@media (min-width: 760px) { .avg-table .wide { display: table-cell; } }
.tables .more-details + .more-details { border-top: 1px solid var(--line); margin-top: var(--s2); padding-top: var(--s2); }
.rows .row .num { font: 600 13px/18px var(--font-mono); }
.prose h2, .prose h3 { font-size: 16px; }

/* ---------- Settings ---------- */
.posting-card { border-left: 5px solid var(--st-posted); }
.posting-card.is-paused { border-left-color: var(--st-progress); background: linear-gradient(0deg, var(--surface), var(--surface)), var(--st-progress-bg); }
.posting-row { display: flex; align-items: center; gap: var(--s4); }
.posting-card h2 { font-size: 24px; line-height: 30px; }
.posting-card.is-on h2 { color: var(--st-posted-ink); }
.posting-card.is-paused h2 { color: var(--st-progress-ink); }
.big-switch { position: relative; width: 64px; height: 38px; min-height: var(--tap); border: 0; padding: 0; border-radius: 999px; background: var(--line-strong); cursor: pointer; flex: none; transition: background .15s; }
.big-switch span { position: absolute; top: 4px; left: 4px; width: 30px; height: 30px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: left .15s; }
.big-switch.on { background: var(--brand-strong); }
.big-switch.on span { left: 30px; }
.big-switch { height: 44px; } .big-switch span { top: 7px; }
.small-switch { width: 56px; } .small-switch.on span { left: 22px; }
.posting-mode { display: flex; align-items: flex-start; gap: 10px; margin-top: var(--s4); padding-top: var(--s3); border-top: 1px solid var(--line); font-size: 14px; color: var(--ink-2); }
.posting-mode > svg { width: 18px; height: 18px; flex: none; margin-top: 1px; color: var(--ink-3); }
.live-row { display: flex; align-items: center; gap: var(--s3); width: 100%; }
.setup-steps { list-style: none; padding: 0; margin: 4px 0 0; counter-reset: s; }
.setup-steps li { display: flex; gap: var(--s3); padding: 10px 0; border-top: 1px solid var(--line); }
.setup-steps li:first-child { border-top: 0; }
.setup-steps .n { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; flex: none; font: 600 13px/1 var(--font-mono); background: var(--surface-2); color: var(--ink-3); border: 1px solid var(--line); }
.setup-steps .n svg { width: 16px; height: 16px; }
.setup-steps li.done .n { background: var(--st-posted-bg); color: var(--st-posted-ink); border-color: transparent; }
.setup-steps li.current .n { background: var(--brand-strong); color: #fff; border-color: transparent; }
.setup-steps li.done b { color: var(--ink-2); }
.setup-steps p { margin: 2px 0 0; font-size: 14px; color: var(--ink-3); }
.setup-steps li.current p { color: var(--ink-2); }
.setup-steps .btn-tertiary { margin-left: -10px; }
code.wrap { overflow-wrap: anywhere; word-break: break-all; }
.kv.tech dd { font-size: 14px; }
.kv.tech > div { grid-template-columns: 120px 1fr; }
@media (max-width: 400px) { .kv.kv-wide > div { grid-template-columns: 1fr; gap: 2px; } }
.link-card { display: flex; align-items: center; gap: var(--s3); color: var(--ink); min-height: 64px; }
.link-card:hover { text-decoration: none; background: var(--surface-2); }
.link-card > svg:first-child { width: 22px; height: 22px; color: var(--ink-3); flex: none; }
.danger h2 { color: var(--st-problem-ink); font-size: 18px; margin-bottom: var(--s3); }
.danger .card { border-color: color-mix(in srgb, var(--st-problem) 30%, white); }
.danger .action-list { margin: 0; border-top: 0; }
.danger .action-row:last-child { border-bottom: 0; }
.keybox .btn svg { width: 18px; height: 18px; }

/* ---------- Activity log ---------- */
.chip-filters { display: flex; flex-wrap: wrap; gap: var(--s2); }
.filter-chip.on { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-ink); font-weight: 600; }
.main > .log-note { margin-top: var(--s2); }
.log-note a { display: inline-flex; align-items: center; min-height: var(--tap); font-weight: 600; }
.main > .log-day { margin-top: var(--s5); }
.log-day-head { font-size: 16px; margin-bottom: var(--s2); }
.log-day-head small { font: 500 12.5px/18px var(--font-mono); color: var(--ink-3); margin-left: 6px; }
.log-list { list-style: none; margin: 0; padding: 0; }
.log-item { display: flex; gap: var(--s3); padding: 10px var(--s4) 10px var(--s3); border-top: 1px solid var(--line); }
.log-item:first-child { border-top: 0; }
.log-item .lv { width: 22px; height: 22px; display: grid; place-items: center; flex: none; margin-top: 1px; }
.log-item .lv i { width: 8px; height: 8px; border-radius: 50%; background: var(--st-neutral); }
.log-item .lv svg { width: 18px; height: 18px; }
.lv-warn .lv { color: var(--st-progress); }
.lv-error .lv { color: var(--st-problem); }
.lv-error { background: color-mix(in srgb, var(--st-problem-bg) 45%, white); }
.log-msg { font-size: 15px; line-height: 21px; color: var(--ink); overflow-wrap: anywhere; }
.log-msg .times { font: 600 12px/1 var(--font-mono); color: var(--ink-3); background: var(--surface-2); border: 1px solid var(--line); padding: 2px 6px; border-radius: 6px; }
.log-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin-top: 2px; }
.log-meta .kind { font: 500 11.5px/16px var(--font-mono); color: var(--ink-3); text-transform: uppercase; letter-spacing: .03em; }
.target-chip { display: inline-flex; align-items: center; gap: 2px; min-height: var(--tap); padding: 0 4px 0 10px; margin: -6px 0; border-radius: 999px; font-size: 13px; font-weight: 600; color: var(--brand-ink); }
.target-chip svg { width: 16px; height: 16px; }
.target-chip:hover { background: var(--brand-soft); text-decoration: none; }
.log-detail summary { min-height: var(--tap); display: inline-flex; align-items: center; font-size: 13px; color: var(--ink-3); list-style: none; }
.log-detail summary::-webkit-details-marker { display: none; }
.log-detail summary::after { content: " ▾"; margin-left: 4px; }
.sr-only { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0 0 0 0) !important; white-space: nowrap !important; border: 0 !important; }
.filter-chip { min-width: 52px; justify-content: center; }
