/* IP Copilot — LATTICE visual system.
   System font, quiet translucent sidebar, compact controls, zero decoration.
   All tokens live in tokens.css — loaded as its own <link> in index.html
   (before this file), NOT via @import. @import-ed custom properties have a
   known WebKit repaint bug: elements rendered by Alpine's x-for *after*
   initial paint (like table rows) can come up with unresolved var() values
   — invisible text/backgrounds until something forces a repaint (hover,
   scroll). A plain sibling <link> is parsed synchronously with the page,
   so this never happens. Do not reintroduce @import here. */

:root {
  /* legacy aliases kept for old markup — all resolve to tokens.css values */
  --sans: var(--font-sans);
  --serif: var(--font-sans);
  --num: var(--font-num);
  --bg: var(--color-soft); --surface: var(--gray-0); --surface-2: var(--gray-2);
  --muted: var(--color-muted); --line: var(--color-line); --ph-fill: var(--gray-2);
  --space-8: var(--space-7);

  /* Buttons/controls/badges/data-bars stay strict grayscale — only "new item"
     indicators and brand/platform marks are allowed real color. */
  --green: #34c759; --green-soft: rgba(52,199,89,.12);
  --gold:  #ff9500; --gold-soft: rgba(255,149,0,.14);
  --red: var(--color-danger);    --red-soft: var(--color-danger-soft);
  --ok: var(--green); --warn: var(--gold);

  /* platform brand colors — icons/logos only, never buttons */
  --brand-youtube: #ff0000; --brand-youtube-soft: rgba(255,0,0,.10);
  --brand-rss: #ee802f;     --brand-rss-soft: rgba(238,128,47,.12);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-sans); font-weight: var(--weight-regular); font-size: var(--text-base);
  line-height: 1.5; color: var(--color-ink);
  background: var(--color-soft);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
a { color: inherit; }
[x-cloak] { display: none !important; }

.eyebrow {
  margin: 0 0 var(--space-1); color: var(--label-ink);
  font-family: var(--font-label); font-size: var(--text-xs); font-weight: var(--weight-semibold);
  letter-spacing: .14em; text-transform: uppercase;
}
h1 { margin: 0; font-size: var(--text-2xl); font-weight: var(--weight-semibold); letter-spacing: -.008em; }
h2 { margin: 0 0 var(--space-3); font-size: var(--text-lg); font-weight: var(--weight-semibold); }
h3 { margin: 0 0 var(--space-2); font-size: var(--text-base); font-weight: var(--weight-semibold); }
.muted { color: var(--color-muted); }
.page-note { margin: var(--space-1) 0 0; color: var(--color-muted); font-size: var(--text-sm); max-width: 620px; }

/* ── shell ── */
.shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0,1fr); min-height: 100vh; min-width: 0; }

/* ── sidebar ── */
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
  padding: var(--space-4) var(--space-3) var(--space-3); background: var(--color-sidebar);
  border-right: 1px solid var(--color-line); min-width: 0;
}
.brand { display: flex; gap: var(--space-3); align-items: center; padding: 0 var(--space-2); min-width: 0; }
.brand .brand-mark {
  display: grid; flex: 0 0 34px; width: 34px; height: 34px; place-items: center;
  color: var(--gray-0); background: var(--ink); border-radius: var(--radius);
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", var(--font-sans);
  font-size: var(--text-2xl); font-weight: var(--weight-semibold); overflow: hidden;
  box-shadow: var(--shadow-flat);
}
.brand .brand-copy { min-width: 0; }
.brand .logo  { font-size: var(--text-base); font-weight: var(--weight-semibold); letter-spacing: -.008em; line-height: 1.2; }
.brand .tag   { margin: 0 0 var(--space-1); font-family: var(--font-label); font-size: var(--text-xs); font-weight: var(--weight-semibold); letter-spacing: .14em; text-transform: uppercase; color: var(--label-ink); }

.logo-setting {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: var(--space-3);
  align-items: center;
  margin: var(--space-2) 0 var(--space-4);
  padding: var(--space-3);
  background: var(--color-surface-strong);
  border: 1px solid var(--color-line);
  border-radius: var(--radius);
}
.logo-setting .logo-preview {
  width: 48px;
  height: 48px;
  flex-basis: 48px;
  font-size: 24px;
}
.logo-setting .user-avatar.logo-preview {
  width: 48px;
  height: 48px;
  font-size: 24px;
  border-radius: var(--radius);
}
.logo-setting.compact { margin-bottom: 0; }

.nav { display: grid; gap: var(--space-1); margin-top: var(--space-8); min-width: 0; max-width: 100%; }
.nav-divider { height: 1px; background: var(--color-line); margin: var(--space-2) var(--space-3) var(--space-1); }
.nav button {
  display: flex; gap: var(--space-2); align-items: center; width: 100%; min-height: var(--control-h);
  padding: 0 var(--space-3); color: var(--color-muted); background: transparent;
  border: 1px solid transparent; border-radius: var(--radius); cursor: pointer;
  font-family: var(--font-sans); font-size: var(--text-base); font-weight: var(--weight-medium); text-decoration: none;
  transition: color var(--duration-hover) var(--ease), background var(--duration-hover) var(--ease), border-color var(--duration-hover) var(--ease);
}
.nav button:hover { color: var(--color-ink); background: var(--gray-0); }
.nav button.active { color: var(--color-ink); background: var(--color-pressed); border-color: var(--color-pressed); font-weight: var(--weight-medium); }
.nav button.active .nav-icon { color: var(--color-ink); }
.nav button:focus-visible,
.creator-row:focus-visible,
.tabs button:focus-visible,
button.btn:focus-visible,
.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--gray-0), 0 0 0 4px var(--color-sidebar-accent-soft);
}
.nav button .nav-icon { display: inline-grid; width: 18px; height: 18px; place-items: center; flex: 0 0 18px; }
.nav button .nav-icon svg { width: 15px; height: 15px; }
.nav-emoji { width: 20px; height: 20px; display: inline-grid; place-items: center; flex: 0 0 20px; font-size: var(--text-lg); }
.nav .badge {
  margin-left: auto; font-family: var(--font-num); font-size: var(--text-xs);
  background: var(--color-ink); color: var(--gray-0); padding: 1px var(--space-1); border-radius: var(--radius-pill);
}

.sidebar .foot {
  margin-top: auto; display: grid; gap: var(--space-2); padding: var(--space-3) var(--space-1) 0;
  font-size: var(--text-sm); color: var(--color-muted);
}
.user-card {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: var(--space-2);
  align-items: center;
  width: 100%;
  min-width: 0;
  padding: var(--space-2);
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--color-ink);
  cursor: pointer;
  text-align: left;
  font-family: var(--font-sans);
}
.user-card:hover,
.user-card.active {
  background: var(--gray-0);
  border-color: var(--gray-0);
}
.user-menu {
  position: absolute; bottom: calc(100% + 6px); left: 0; right: 0;
  background: var(--gray-0); border: 1px solid var(--color-line); border-radius: var(--radius);
  box-shadow: var(--shadow-float); padding: var(--space-1); z-index: 40;
}
.user-menu button {
  display: flex; align-items: center; gap: var(--space-2); width: 100%; padding: var(--space-2) var(--space-2);
  border: none; background: transparent; border-radius: var(--radius); cursor: pointer;
  font-family: var(--font-sans); font-size: var(--text-sm); font-weight: var(--weight-medium); color: var(--color-ink);
  text-align: left;
}
.user-menu button:hover { background: var(--color-soft); }
.user-menu button svg { width: 15px; height: 15px; flex-shrink: 0; color: var(--color-muted); }
.user-avatar {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  background: var(--ink);
  color: var(--gray-0);
  font-size: var(--text-lg);
  overflow: hidden;
}
.user-avatar img,
.account-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.user-copy { min-width: 0; display: grid; gap: 1px; }
.user-copy strong {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-copy small {
  color: var(--color-muted);
  font-size: var(--text-xs);
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dot { width: 6px; height: 6px; display: inline-block; border-radius: 50%; background: var(--warn); margin-right: var(--space-1); vertical-align: 1px; }
.dot.on { background: var(--ok); }

/* ── workspace ── */
.main { min-width: 0; padding: var(--space-4) var(--space-6) var(--space-7); }
.page-head { display: flex; gap: var(--space-3); align-items: flex-start; justify-content: space-between; min-height: 46px; margin-bottom: var(--space-4); }
.page-head > .flex,
.page-head > .save-cluster { padding-top: 3px; }
.page-note { font-size: var(--text-sm); }

/* ── grid / panels ── */
.grid { display: grid; gap: var(--space-3); }
.cols-2 { grid-template-columns: 1fr 1fr; }
.cols-3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.cols-4 { grid-template-columns: repeat(4, minmax(0,1fr)); }

.account-layout {
  display: block;
  max-width: 980px;
}
.account-avatar {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  background: var(--ink);
  color: var(--gray-0);
  font-size: 26px;
  overflow: hidden;
}
.account-avatar.lg { width: 72px; height: 72px; font-size: 32px; }
.avatar-upload {
  position: relative;
  width: 72px;
  height: 72px;
  display: block;
  cursor: pointer;
}
.avatar-upload .account-avatar {
  transition: transform var(--duration-hover) var(--ease), box-shadow var(--duration-hover) var(--ease), filter var(--duration-hover) var(--ease);
}
.avatar-upload:hover .account-avatar {
  transform: translateY(-1px);
  box-shadow: var(--shadow-card);
  filter: brightness(.96);
}
.avatar-camera {
  position: absolute;
  right: -5px;
  bottom: -5px;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--gray-0);
  box-shadow: var(--shadow-float);
  font-size: var(--text-lg);
  line-height: 1;
}
.account-main { display: grid; gap: var(--space-3); min-width: 0; }
.settings-section {
  padding: var(--space-4);
  border: 0;
  border-radius: var(--radius);
  background: var(--gray-0);
  box-shadow: var(--shadow-card);
}
.settings-section-head {
  display: flex;
  gap: var(--space-3);
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: var(--space-3);
}
.settings-section-head span { font-size: var(--text-lg); font-weight: var(--weight-semibold); }
.settings-section-head small { color: var(--color-muted); font-size: var(--text-sm); text-align: right; }
.profile-editor {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: var(--space-3);
  align-items: start;
}
.storage-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-2);
}
.storage-grid > div {
  min-width: 0;
  padding: var(--space-2);
  border-radius: var(--radius);
  background: var(--color-surface-strong);
}
.storage-grid small {
  display: block;
  color: var(--color-muted);
  font-size: var(--text-xs);
  margin-bottom: 3px;
}
.storage-grid strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: var(--text-sm);
}
.check-row {
  text-transform: none;
  letter-spacing: 0;
  color: var(--color-ink);
  font-size: var(--text-sm);
  margin-top: var(--space-3);
  cursor: pointer;
}
.check-row input { width: auto; margin-right: var(--space-2); }

.card, .panel {
  background: var(--color-surface); border: var(--border-w) solid var(--color-line);
  border-radius: var(--radius); padding: var(--space-4); min-width: 0;
  box-shadow: var(--shadow-card);
}
.card + .card, .panel + .panel,
.card + .kpi-grid, .kpi-grid + .card {
  margin-top: var(--space-5);
}

/* ── KPI stat tiles ── */
.kpi-grid { display: grid; grid-template-columns: repeat(6, minmax(0,1fr)); gap: var(--space-4); margin-bottom: var(--space-4); }
.kpi-grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: var(--space-4); }

.stat {
  min-height: 100px; padding: var(--space-4) var(--space-4); overflow: hidden;
  background: var(--color-surface); border: 1px solid var(--color-line);
  border-radius: var(--radius); cursor: pointer; transition: background var(--duration-hover);
}
.stat:hover { background: var(--gray-1); }

/* label on top — matches .kpi-card span */
.stat > span:first-child {
  display: block; color: var(--color-muted); font-size: var(--text-xs);
  font-family: var(--font-num); font-weight: var(--weight-semibold); letter-spacing: .04em;
  text-transform: uppercase;
}
/* value — matches .kpi-card strong */
.stat > strong {
  display: block; margin-top: var(--space-2);
  font-family: var(--font-num);
  font-size: var(--text-2xl);
  font-weight: var(--weight-semibold); line-height: 1.1;
  letter-spacing: 0; color: var(--color-ink);
  font-variant-numeric: tabular-nums;
}
/* note below — matches .kpi-card small */
.stat > small {
  display: block; margin-top: var(--space-1);
  color: var(--color-muted); font-size: var(--text-xs);
}
.stat > small.new { color: var(--green); }

/* ── funnel — same kpi-card structure, unified border ── */
.funnel {
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  overflow: hidden; background: var(--color-surface);
  border: 1px solid var(--color-line); border-radius: var(--radius);
  margin-bottom: var(--space-5);
}
.funnel .step { padding: var(--space-3) var(--space-4); border-right: 1px solid var(--color-line); }
.funnel .step:last-child { border-right: 0; }
.funnel .step > span:first-child {
  display: block; color: var(--color-muted); font-size: var(--text-xs);
  font-family: var(--font-num); font-weight: var(--weight-semibold); letter-spacing: .04em;
  text-transform: uppercase;
}
.funnel .step > strong {
  display: block; margin-top: var(--space-2);
  font-family: var(--font-num);
  font-size: var(--text-2xl);
  font-weight: var(--weight-semibold); line-height: 1.1;
  letter-spacing: 0; color: var(--color-ink);
  font-variant-numeric: tabular-nums;
}
.funnel .step > small { display: block; margin-top: var(--space-1); color: var(--color-muted); font-size: var(--text-xs); }
.funnel .arrow { display: none; }

/* keep old .n / .l / .s aliases so nothing else breaks */
.stat .n, .funnel .step .n {
  font-family: var(--font-num); font-size: var(--text-2xl);
  font-weight: var(--weight-semibold); line-height: 1.1; letter-spacing: 0;
  font-variant-numeric: tabular-nums;
}
.stat .l, .funnel .step .l { font-size: var(--text-xs); color: var(--color-muted); margin-top: var(--space-1); }

/* ── creator watchlist ── */
.creator-row {
  display: flex; align-items: center; gap: var(--space-2); min-width: 0;
  padding: var(--space-2) var(--space-2);
  background: var(--color-surface); border: 1px solid var(--color-line);
  border-radius: var(--radius); cursor: pointer;
  transition: background var(--duration-hover), border-color var(--duration-hover);
}
.creator-row:hover { background: var(--gray-0); }
.creator-row.active { border-color: var(--color-line-strong); background: var(--gray-0); }
.creator-row .c-icon {
  width: 24px; height: 24px; border-radius: var(--radius); display: grid; place-items: center;
  flex: 0 0 24px; background: var(--color-surface-strong); font-size: var(--text-sm);
}
.creator-row .c-icon.yt  { background: var(--brand-youtube-soft); color: var(--brand-youtube); }
.creator-row .c-icon.tw  { background: var(--gray-2); color: var(--color-ink); }
.creator-row .c-icon.rss { background: var(--brand-rss-soft); color: var(--brand-rss); }
.creator-row .c-name  { font-weight: var(--weight-semibold); font-size: var(--text-sm); line-height: 1.25; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.creator-row .c-handle { margin-top: 1px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--text-xs); line-height: 1.2; color: var(--color-muted); }
.creator-row .c-badge {
  flex: 0 0 auto; font-family: var(--font-num); font-size: var(--text-xs); background: var(--color-surface-strong);
  color: var(--color-muted); padding: 1px var(--space-1); border-radius: var(--radius-pill); white-space: nowrap;
}
.creator-row .c-badge.has-new { background: var(--green-soft); color: var(--green); }
.icon-btn {
  flex: 0 0 var(--control-h);
  width: var(--control-h);
  height: var(--control-h);
  min-height: var(--control-h);
  padding: 0;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  border: 1px solid transparent;
  background: transparent;
  color: var(--color-muted);
  cursor: pointer;
  opacity: .58;
  transition: background var(--duration-hover), border-color var(--duration-hover), color var(--duration-hover), opacity var(--duration-hover);
}
.icon-btn svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.icon-btn:hover,
.icon-btn:focus-visible,
.icon-btn.active {
  opacity: 1;
  background: var(--color-hover);
  border-color: var(--color-line);
  color: var(--color-ink);
}
.icon-btn.danger:hover,
.icon-btn.danger:focus-visible,
.icon-btn.danger.active {
  color: var(--red);
  background: var(--red-soft);
  border-color: rgba(224,50,42,.18);
}

/* Global processing progress bar */
.top-progress {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 3px;
  z-index: 2000;
  background: var(--gray-3);
}
.top-progress-fill {
  height: 100%;
  background: var(--color-ink);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  transition: width var(--duration-enter) var(--ease);
}
.top-progress-label {
  position: fixed;
  top: 8px; right: 16px;
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--color-ink);
  background: var(--color-surface-solid);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-pill);
  padding: 3px var(--space-2);
  box-shadow: var(--shadow-float);
}
/* interactive angle picker in summary detail */
.angles-block { grid-column: 1 / -1; margin-top: var(--space-3); padding-top: var(--space-3); border-top: 1px dashed var(--color-line); }
.angle-pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--space-2); margin-top: var(--space-2); }
.angle-pick {
  display: flex; align-items: center; gap: var(--space-2);
  padding: var(--space-2) var(--space-3); text-align: left;
  border: 1px solid var(--color-line); border-radius: var(--radius);
  background: var(--color-surface-solid); cursor: pointer;
  transition: border-color var(--duration-hover), background var(--duration-hover);
}
.angle-pick:hover { border-color: var(--color-ink); background: var(--color-hover); }
.angle-pick-plus { display: grid; place-items: center; width: 18px; height: 18px; flex: 0 0 18px;
  color: var(--color-ink); }
.angle-pick-plus svg { width: 14px; height: 14px; }
.angle-pick-text { flex: 1; font-size: var(--text-sm); line-height: 1.45; }

.vid-check { display: flex; align-items: center; padding: 2px; cursor: pointer; }
.vid-check input { width: 16px; height: 16px; cursor: pointer; accent-color: var(--color-ink); }
.video-card.selected { outline: 1.5px solid var(--color-ink); outline-offset: -1px; }

/* Uniform always-visible action icon bar (inbox / video cards) */
.act-icons { display: flex; gap: var(--space-1); align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.act-icons .icon-btn {
  opacity: 1;
  border-color: var(--color-line);
  background: var(--color-surface-solid);
  color: var(--color-muted);
}
.act-icons .icon-btn:hover,
.act-icons .icon-btn:focus-visible {
  background: var(--color-hover);
  color: var(--color-ink);
}
.act-icons .icon-btn.primary {
  background: var(--color-ink);
  border-color: var(--color-ink);
  color: var(--gray-0);
  opacity: 1;
}
.act-icons .icon-btn.primary:hover { background: var(--ink); color: var(--gray-0); }
.act-icons .icon-btn.primary[disabled] { opacity: .5; }
.act-icons .icon-btn .spin { width: 13px; height: 13px; }
.confirm-actions {
  display: flex;
  gap: var(--space-1);
  align-items: center;
}

/* ── tables / lists ── */
table { width: 100%; border-collapse: collapse; font-size: var(--text-base); }
th { text-align: left; font-weight: var(--weight-medium); font-size: var(--text-xs); letter-spacing: .02em; color: var(--color-muted); padding: var(--space-2) var(--space-3); border-bottom: 1px solid var(--color-line); }
td { padding: 10px var(--space-3); border-bottom: 1px solid var(--color-line); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--color-hover); }
.list-row { display: flex; justify-content: space-between; gap: var(--space-2); padding: var(--space-2) 0; border-bottom: 1px solid var(--color-line); align-items: center; }
.list-row:last-child { border-bottom: none; }

/* ── segmented control ── */
.tabs { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px; background: var(--color-segment); border: var(--border-w) solid var(--color-line); border-radius: var(--radius); margin-bottom: var(--space-4); }
.tabs button { min-height: var(--control-h); height: var(--control-h); padding: 0 var(--space-3); color: var(--color-muted); background: transparent; border: 0; border-radius: var(--radius-sm); cursor: pointer; font-family: inherit; font-size: var(--text-sm); font-weight: var(--weight-medium); transition: background var(--duration-hover) var(--ease), color var(--duration-hover) var(--ease); }
.tabs button:hover { color: var(--color-ink); }
.tabs button.active { color: var(--color-ink); background: var(--gray-0); box-shadow: var(--shadow-flat); }

/* ── buttons — 3 tiers, 28px, no more no less ──
   secondary (default .btn): white fill, 1px gray border, flat shadow
   primary (.btn.primary):   ink solid, white text
   ghost (.btn.ghost):       transparent, gray text, hover = gray-1 fill        */
button.btn, .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-1);
  min-height: var(--control-h); height: var(--control-h);
  font-family: var(--font-sans); font-size: var(--text-base); font-weight: var(--weight-medium); line-height: 1;
  padding: 0 var(--space-3); border: var(--border-w) solid var(--color-line);
  background: var(--gray-0); color: var(--color-ink); cursor: pointer;
  border-radius: var(--radius); transition: border-color var(--duration-hover) var(--ease), background var(--duration-hover) var(--ease), color var(--duration-hover) var(--ease);
  white-space: nowrap;
  box-shadow: var(--shadow-flat);
}
button.btn:hover { background: var(--color-hover); }
button.btn:active { background: var(--color-pressed); }
/* primary = ink (monochrome) */
button.btn.primary, .btn.primary {
  background: var(--color-ink);
  color: var(--gray-0);
  border-color: var(--color-ink);
  box-shadow: var(--shadow-flat);
}
button.btn.primary:hover, .btn.primary:hover { background: #000000; }
button.btn.ghost, .btn.ghost {
  background: transparent;
  color: var(--color-muted);
  border-color: transparent;
  box-shadow: none;
}
button.btn.ghost:hover, .btn.ghost:hover {
  background: var(--color-hover);
  color: var(--color-ink);
  border-color: transparent;
}
button.btn.danger-btn,
.btn.danger-btn {
  color: var(--color-danger);
  background: var(--color-danger-soft);
  border-color: rgba(224,50,42,.22);
}
button.btn.danger-btn:hover,
.btn.danger-btn:hover {
  background: rgba(224,50,42,.15);
  border-color: rgba(224,50,42,.32);
}
button.btn.sm,
button.btn.xs { min-height: var(--control-h); height: var(--control-h); padding: 0 var(--space-3); font-size: var(--text-sm); }
button:disabled { opacity: .4; cursor: not-allowed; }

/* ── form controls ── */
input, textarea, select {
  font-family: var(--font-sans); font-size: var(--text-base); color: var(--color-ink);
  background: var(--gray-0); border: var(--border-w) solid var(--color-line);
  padding: 0 var(--space-2); width: 100%; resize: vertical; border-radius: var(--radius-ctl);
  transition: border-color var(--duration-hover) var(--ease), box-shadow var(--duration-hover) var(--ease);
}
input, select { height: var(--control-h); min-height: var(--control-h); }
textarea { min-height: 92px; padding-top: var(--space-2); padding-bottom: var(--space-2); }
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--gray-5);
  box-shadow: var(--shadow-focus-ring);
}
label { display: block; font-size: var(--text-sm); font-weight: var(--weight-medium); color: var(--color-muted); margin: var(--space-3) 0 var(--space-1); letter-spacing: 0; }
.field-row { display: flex; align-items: stretch; gap: var(--space-2); }
.field-row > div { flex: 1; }
.helper { margin: var(--space-1) 0 0; color: var(--color-muted); font-size: var(--text-sm); line-height: 1.45; }
.choice-group {
  display: inline-grid;
  grid-auto-flow: column;
  grid-auto-columns: max-content;
  gap: 3px;
  align-items: center;
  min-width: 0;
  padding: 3px;
  background: var(--color-segment);
  border: var(--border-w) solid var(--color-line);
  border-radius: var(--radius);
}
.choice-group.wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
}
.choice-group.compact { width: max-content; }
.choice-group button {
  min-height: var(--control-h);
  height: var(--control-h);
  padding: 0 var(--space-3);
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-muted);
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  white-space: nowrap;
}
.choice-group button:hover { color: var(--color-ink); background: var(--color-hover); }
.choice-group button.active {
  color: var(--color-ink);
  background: var(--gray-0);
  box-shadow: var(--shadow-flat);
}
.source-filter {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  width: 100%;
  margin-bottom: var(--space-2);
}
.source-filter button { width: 100%; min-height: var(--control-h); height: var(--control-h); padding: 0 var(--space-2); font-size: var(--text-sm); }

/* ── pills / chips — same rectangular-badge shape as LATTICE's .badge:
   mono font, small radius, 1px border. One shape everywhere a tag/status/
   count chip shows up, so nothing reads as a different design language. ── */
.pill {
  display: inline-flex; gap: 3px; align-items: center;
  font-family: var(--font-num); font-size: var(--text-xs); font-weight: var(--weight-medium); line-height: 1;
  padding: 3px var(--space-2); border: var(--border-w) solid var(--color-line); border-radius: var(--radius-sm);
  background: var(--gray-0); color: var(--color-muted);
  margin-right: var(--space-1); vertical-align: middle; white-space: nowrap; flex-shrink: 0;
}
.pill.ink { background: var(--ink); color: var(--gray-0); border-color: var(--ink); }
.pill.blue { background: var(--gray-1); color: var(--color-ink); border-color: var(--color-line); }
.pill.red  { background: var(--red-soft); color: var(--red); border-color: rgba(224,50,42,.22); }
/* compact, non-wrapping tag for dense table cells — same shape as .pill */
.cell-tag { display: inline-block; max-width: 100%; padding: 1px var(--space-2); border: var(--border-w) solid var(--color-line); border-radius: var(--radius-sm); font-family: var(--font-num); font-size: var(--text-xs); line-height: 1.5; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; background: var(--gray-0); color: var(--color-muted); }
.cell-tag.on { background: var(--ink); color: var(--gray-0); border-color: var(--ink); }

/* ── status badge — grayscale progression, never color.
   Label text is monospace (one of the two allowed uses, alongside numerals).
   Levels ladder from lightest (draft) to solid ink (published); pick whichever
   subset a given status field actually has — skipping levels is fine. ── */
.status-badge {
  display: inline-flex; align-items: center; gap: var(--space-1);
  height: 18px; padding: 0 var(--space-1);
  border-radius: var(--radius-sm);
  font-family: var(--font-num); font-size: var(--text-xs); font-weight: var(--weight-semibold);
  font-variant-numeric: tabular-nums;
  letter-spacing: .01em; white-space: nowrap; vertical-align: middle;
  border: var(--border-w) solid transparent;
}
.status-badge.draft {     color: var(--gray-4); background: var(--gray-0); border-color: var(--gray-3); }
.status-badge.pending {   color: var(--gray-5); background: var(--gray-1); }
.status-badge.approved {  color: var(--ink);     background: var(--gray-3); }
.status-badge.scheduled { color: var(--gray-0);  background: var(--gray-5); }
.status-badge.published { color: var(--gray-0);  background: var(--ink); }
/* library tabs + manage button row */
.lib-tabs-row { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); margin-bottom: var(--space-3); }
.lib-tabs-row .tabs { margin-bottom: 0; flex: 1; min-width: 0; }

/* source-type manager modal */
.st-list { display: flex; flex-direction: column; gap: var(--space-1); margin: var(--space-3) 0 var(--space-4); max-height: 50vh; overflow: auto; }
.st-row { display: flex; align-items: center; gap: var(--space-2); padding: var(--space-1) var(--space-2); border: 1px solid var(--color-line); border-radius: var(--radius); background: var(--color-surface-solid); }
.st-row.off { opacity: .5; }
.st-row .st-label { flex: 1; min-width: 0; height: 28px; min-height: 28px; border-color: transparent; background: transparent; font-weight: var(--weight-semibold); padding: 0 var(--space-1); }
.st-row .st-label:hover { border-color: var(--color-line); background: var(--gray-0); }
.st-row .st-label:focus { border-color: var(--color-line-strong); background: var(--gray-0); }
.st-row .cell-tag { flex: 0 0 auto; }
.st-lock { width: 28px; text-align: center; color: var(--color-muted); flex: 0 0 28px; }
.st-add { display: flex; gap: var(--space-2); align-items: center; }
.st-add input { flex: 1; }

/* ── modal ── */
.overlay { position: fixed; inset: 0; background: var(--overlay); display: flex; align-items: flex-start; justify-content: center; padding: var(--space-7) var(--space-4); z-index: 50; overflow: auto; }
.modal { position: relative; background: var(--gray-0); border: var(--border-w) solid var(--color-line); border-radius: var(--radius); max-width: 620px; width: 100%; padding: var(--space-5) var(--space-5) var(--space-4); box-shadow: var(--shadow-modal); }
.modal.wide { max-width: 860px; }
.settings-modal { max-width: 900px; }
.settings-modal-body { display: flex; gap: var(--space-4); min-height: 420px; max-height: 62vh; }
.settings-tab-list { flex: 0 0 168px; display: flex; flex-direction: column; gap: 2px; border-right: 1px solid var(--color-line); padding-right: var(--space-3); overflow-y: auto; }
.settings-tab-list button { text-align: left; padding: var(--space-2) var(--space-2); border: none; background: transparent; border-radius: var(--radius); font-family: var(--font-sans); font-size: var(--text-sm); font-weight: var(--weight-medium); color: var(--color-muted); cursor: pointer; }
.settings-tab-list button:hover { background: var(--color-soft); color: var(--color-ink); }
.settings-tab-list button.active { background: var(--color-ink); color: var(--gray-0); }
.settings-tab-content { flex: 1; min-width: 0; overflow-y: auto; padding-right: var(--space-1); }
.settings-tab-content .settings-section { box-shadow: none; padding: 0; }
.modal h2 { margin: 2px 0 var(--space-3); font-size: var(--text-2xl); font-weight: var(--weight-semibold); letter-spacing: -.01em; }
.modal label { margin-top: var(--space-3); }
.modal label:first-of-type { margin-top: var(--space-1); }
/* primary action sits flush, full-feel at the bottom */
.modal > .btn.primary.mt, .modal > .btn.mt.primary { margin-top: var(--space-4); min-width: 96px; }
.close { float: right; cursor: pointer; font-size: var(--text-2xl); color: var(--color-muted); line-height: 1; }
.modal-close {
  position: absolute; top: 14px; right: 14px;
  width: 28px; height: 28px; padding: 0;
  display: grid; place-items: center;
  border-radius: var(--radius); border: 1px solid transparent;
  background: transparent; color: var(--color-muted);
  cursor: pointer; transition: background var(--duration-hover), color var(--duration-hover), border-color var(--duration-hover);
}
.modal-close:hover { background: var(--color-hover); border-color: var(--color-line); color: var(--color-ink); }
.modal-close svg { width: 14px; height: 14px; stroke: currentColor; stroke-width: 2; fill: none; stroke-linecap: round; stroke-linejoin: round; }

/* ── drawer — right-edge side panel for record detail, as an alternative to
   a centered .modal when the content is a single record being inspected/edited
   rather than a focused prompt/confirmation. ── */
.drawer-overlay {
  position: fixed; inset: 0; background: var(--overlay);
  z-index: 50;
  display: flex; justify-content: flex-end;
}
.drawer {
  width: min(440px, 100%); height: 100%;
  background: var(--color-surface-solid);
  border-left: var(--border-w) solid var(--color-line);
  box-shadow: var(--shadow-modal);
  display: flex; flex-direction: column;
  animation: drawer-in var(--duration-enter) var(--ease);
}
@keyframes drawer-in { from { transform: translateX(24px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
.drawer-head {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-bottom: var(--border-w) solid var(--color-line);
  flex: 0 0 auto;
}
.drawer-head h2 { margin: 0; font-size: var(--text-lg); font-weight: var(--weight-semibold); }
.drawer-body { flex: 1; min-height: 0; overflow-y: auto; padding: var(--space-5); }
.drawer-foot {
  flex: 0 0 auto; display: flex; justify-content: flex-end; gap: var(--space-2);
  padding: var(--space-4) var(--space-5);
  border-top: var(--border-w) solid var(--color-line);
}
.voice-modal { max-width: 560px; }
.note-mode { margin-top: var(--space-2); }
.voice-capture {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: var(--space-3);
  align-items: center;
  margin-top: var(--space-3);
  padding: var(--space-3);
  border: 1px solid var(--color-line);
  border-radius: var(--radius);
  background: var(--gray-1);
}
.voice-orb {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--ink);
  color: var(--gray-0);
  font-weight: var(--weight-semibold);
}
.voice-capture.listening .voice-orb {
  background: var(--color-danger);
  box-shadow: 0 0 0 6px var(--color-danger-soft);
  animation: pulse-ring 1.4s var(--ease) infinite;
}
@keyframes pulse-ring {
  0%, 100% { box-shadow: 0 0 0 6px var(--color-danger-soft); }
  50%      { box-shadow: 0 0 0 9px rgba(224,50,42,.05); }
}
.voice-capture strong { display: block; font-size: var(--text-base); }
.voice-capture small { display: block; margin-top: 2px; color: var(--color-muted); font-size: var(--text-sm); }
.note-editor {
  width: 100%;
  min-height: 168px;
  margin-top: var(--space-2);
  padding: var(--space-3);
  border: 1px solid var(--color-line);
  border-radius: var(--radius);
  background: var(--gray-0);
  color: var(--color-ink);
  resize: vertical;
  line-height: 1.65;
}
.note-editor:focus {
  outline: none;
  border-color: var(--gray-4);
  box-shadow: 0 0 0 3px var(--color-sidebar-accent-soft);
}
.voice-actions {
  display: flex;
  gap: var(--space-2);
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  margin-top: var(--space-3);
}

/* ── misc ── */
.toast {
  position: fixed; bottom: var(--space-5); left: 50%; transform: translateX(-50%);
  background: var(--ink); color: var(--gray-0); padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm); z-index: 100; border-radius: var(--radius);
  white-space: nowrap; box-shadow: var(--shadow-float);
  animation: toast-in var(--duration-enter) var(--ease);
}
@keyframes toast-in { from { transform: translate(-50%, 8px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }
.spin { display: inline-block; width: 12px; height: 12px; border: 2px solid var(--color-line); border-top-color: var(--color-ink); border-radius: 50%; animation: r .7s linear infinite; vertical-align: -2px; }
@keyframes r { to { transform: rotate(360deg); } }
/* empty state — hollow 45°-rotated square mark + muted copy, no illustration */
.empty {
  color: var(--color-muted); padding: var(--space-5) 0; text-align: center; font-size: var(--text-base);
  display: flex; flex-direction: column; align-items: center; gap: var(--space-2);
}
.empty::before {
  content: ""; width: 9px; height: 9px; border: var(--border-w) solid var(--gray-4);
  transform: rotate(45deg); border-radius: var(--radius-sm);
}
.kpts { margin: var(--space-1) 0 0; padding-left: var(--space-4); }
.kpts li { margin-bottom: var(--space-1); line-height: 1.55; }
.banner {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) var(--control-h);
  gap: var(--space-2);
  align-items: start;
  background: var(--gray-1);
  border: var(--border-w) solid var(--color-line);
  color: var(--gray-5);
  padding: var(--space-3);
  font-size: var(--text-base);
  margin-bottom: var(--space-4);
  border-radius: var(--radius);
}
.banner a { text-decoration: underline; cursor: pointer; }
/* the one deliberate exception to grayscale-only: a failed action, not a status */
.error-banner {
  background: var(--color-danger-soft);
  border-color: rgba(224,50,42,.34);
  color: var(--color-danger);
}
.banner-icon {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  background: var(--color-danger-soft);
  color: var(--red);
  font-family: var(--font-num);
  font-weight: var(--weight-semibold);
}
.banner-copy {
  min-width: 0;
  display: grid;
  gap: 3px;
  line-height: 1.45;
}
.banner-copy strong {
  display: block;
  color: var(--color-ink);
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
}
.banner-copy span,
.banner-copy small {
  overflow-wrap: anywhere;
}
.banner-copy small {
  display: block;
  color: var(--color-danger);
  font-size: var(--text-sm);
}
.banner-close {
  align-self: start;
  justify-self: end;
  background: var(--gray-0);
  border-color: rgba(224,50,42,.16);
  color: var(--color-danger);
  opacity: 1;
}
.banner-close:hover,
.banner-close:focus-visible {
  color: var(--red);
  background: var(--gray-0);
}
.right { text-align: right; }
.mt { margin-top: var(--space-3); }
.mt-lg { margin-top: var(--space-4); }
.flex { display: flex; gap: var(--space-2); align-items: center; }
.between { display: flex; justify-content: space-between; align-items: center; }
pre.body { white-space: pre-wrap; font-family: var(--font-sans); font-size: var(--text-base); line-height: 1.65; background: var(--gray-1); border: 1px solid var(--color-line); padding: var(--space-3); max-height: 300px; overflow: auto; border-radius: var(--radius-ctl); }
.quick-analyze-card { margin-bottom: var(--space-3); }
.inbox-tabs { display: flex; }
/* one shared card frame + hairline-divided rows, same rhythm as .table —
   a flowing list of homogeneous rows shouldn't read as a stack of separate boxes */
.inbox-list {
  display: grid; gap: 0;
  background: var(--color-surface); border: var(--border-w) solid var(--color-line);
  border-radius: var(--radius); box-shadow: var(--shadow-card); overflow: hidden;
}
.inbox-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--space-4);
  align-items: center;
  padding: var(--space-3) var(--space-4);
  border-bottom: var(--border-w) solid var(--color-line);
}
.inbox-list .inbox-card:last-child { border-bottom: 0; }
.inbox-main { display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: var(--space-2); min-width: 0; align-items: start; }
.inbox-source .c-icon {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  background: var(--color-surface-strong); color: var(--color-muted);
}
.inbox-source .c-icon.yt { background: var(--brand-youtube-soft); color: var(--brand-youtube); }
.inbox-source .c-icon.tw { background: var(--gray-2); color: var(--color-ink); }
.inbox-source .c-icon.rss { background: var(--brand-rss-soft); color: var(--brand-rss); }
.inbox-source .c-icon svg { width: 16px; height: 16px; }
.inbox-title { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inbox-snippet { margin: 3px 0 0; font-size: var(--text-sm); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.inbox-actions { display: flex; gap: var(--space-1); align-items: center; justify-content: flex-end; flex-wrap: wrap; }
.item-progress {
  display: grid;
  grid-template-columns: repeat(5, minmax(18px, 1fr));
  gap: var(--space-1);
  width: min(260px, 100%);
  margin-top: var(--space-2);
}
.item-progress.compact { width: min(210px, 100%); margin-top: var(--space-2); }
.item-progress span {
  height: 4px;
  border-radius: var(--radius-pill);
  background: var(--gray-3);
}
.item-progress span.done {
  background: var(--green);
}
.inline-detail {
  grid-column: 1 / -1;
  border-top: 1px solid var(--color-line);
  padding-top: var(--space-3);
  min-width: 0;
}
.detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-2);
}
.detail-head strong {
  display: block;
  margin-top: 2px;
  font-size: var(--text-base);
  line-height: 1.35;
}
.detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--space-3);
  min-width: 0;
}
.inline-text {
  white-space: pre-wrap;
  overflow: auto;
  max-height: min(72vh, 760px);
  min-height: 320px;
  margin: var(--space-1) 0 0;
  padding: var(--space-3) var(--space-3);
  border: 1px solid var(--color-line);
  border-radius: var(--radius);
  background: var(--gray-1);
  color: var(--color-ink);
  font: 13px/1.7 var(--font-sans);
}
.summary-inline {
  max-height: min(72vh, 760px);
  min-height: 320px;
  overflow: auto;
  margin-top: var(--space-1);
  padding-right: var(--space-1);
  font-size: var(--text-sm);
  line-height: 1.6;
}
.summary-inline .kpts { margin-bottom: 0; }
.next-action {
  display: grid;
  justify-items: end;
}
.next-action .btn {
  justify-self: end;
}
.trash-list {
  display: grid; gap: 0;
  background: var(--color-surface); border: var(--border-w) solid var(--color-line);
  border-radius: var(--radius); box-shadow: var(--shadow-card); overflow: hidden;
}
.trash-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--space-4);
  align-items: center;
  padding: var(--space-3) var(--space-4);
  border-bottom: var(--border-w) solid var(--color-line);
}
.trash-list .trash-card:last-child { border-bottom: 0; }
.trash-actions {
  display: flex;
  gap: var(--space-1);
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
}
.queue-panel {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr)) minmax(260px, auto);
  gap: var(--space-3);
  align-items: center;
  margin-bottom: var(--space-3);
  box-shadow: none;
}
.queue-stat { display: grid; gap: 2px; padding-right: var(--space-3); border-right: 1px solid var(--color-line); }
.queue-stat span { color: var(--color-muted); font-size: var(--text-xs); font-family: var(--font-num); font-weight: var(--weight-semibold); letter-spacing: .04em; text-transform: uppercase; }
.queue-stat strong { font-family: var(--font-num); font-size: var(--text-2xl); line-height: 1; }
.queue-action { display: flex; gap: var(--space-2); align-items: center; justify-content: flex-end; min-width: 0; }
.batch-guide {
  margin: -2px 0 var(--space-3);
  color: var(--color-muted);
  font-size: var(--text-sm);
}
.batch-guide > summary {
  width: max-content;
  cursor: pointer;
  font-weight: var(--weight-semibold);
  color: var(--color-ink);
  list-style: none;
}
.batch-guide > summary::-webkit-details-marker { display: none; }
.batch-guide > summary::after {
  content: "+";
  margin-left: var(--space-1);
  font-family: var(--font-num);
  color: var(--color-muted);
}
.batch-guide[open] > summary::after { content: "-"; }
.batch-dim-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-2);
  margin-top: var(--space-2);
}
.batch-dim-grid > div {
  min-width: 0;
  padding: var(--space-2) var(--space-2);
  border: 1px solid var(--color-line);
  border-radius: var(--radius);
  background: var(--gray-0);
}
.batch-dim-grid span {
  display: block;
  margin-bottom: 3px;
  font-family: var(--font-num);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  letter-spacing: .04em;
  color: var(--color-muted);
  text-transform: uppercase;
}
.batch-dim-grid strong {
  display: block;
  color: var(--color-ink);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  line-height: 1.45;
}
.batch-result {
  display: grid;
  gap: var(--space-1);
  margin: calc(var(--space-1) * -1) 0 var(--space-3);
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--color-line);
  border-radius: var(--radius);
  background: var(--gray-0);
}
.batch-result strong { font-size: var(--text-sm); font-weight: var(--weight-semibold); }
.batch-result ul {
  margin: 0;
  padding-left: var(--space-4);
  color: var(--color-muted);
  font-size: var(--text-sm);
}
.batch-result li { margin-top: var(--space-1); }
.batch-result li span { color: var(--color-ink); }
.batch-result li small {
  display: block;
  overflow-wrap: anywhere;
}
.watchlist-layout {
  display: grid;
  grid-template-columns: minmax(200px, 244px) minmax(0, 1fr);
  gap: var(--space-3);
  align-items: start;
  width: 100%;
  min-width: 0;
}
.watchlist-layout > * { min-width: 0; }
.source-pane, .content-pane { min-width: 0; overflow: hidden; }
.source-list {
  display: grid;
  gap: var(--space-1);
  max-height: calc(100vh - 370px);
  min-height: 220px;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 2px;
}
.video-feed {
  display: grid; gap: 2px;
  background: var(--color-surface); border: var(--border-w) solid var(--color-line);
  border-radius: var(--radius); box-shadow: var(--shadow-card); overflow: hidden;
}
.video-card { padding: var(--space-2) var(--space-3); border-bottom: var(--border-w) solid var(--color-line); overflow: hidden; }
.video-feed .video-card:last-child { border-bottom: 0; }
.video-main {
  display: grid;
  grid-template-columns: auto 92px minmax(0, 1fr) minmax(184px, auto);
  gap: var(--space-3);
  align-items: center;
  min-width: 0;
}
.video-thumb { flex: 0 0 92px; height: 52px; border-radius: var(--radius); overflow: hidden; background: var(--ph-fill); background-size: cover; background-position: center; }
.video-actions {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: var(--space-1);
  align-items: center;
  justify-content: flex-end;
  min-width: 184px;
}
.video-actions .btn,
.video-actions .icon-btn { flex: 0 0 auto; }
.draft-grid { grid-template-columns: minmax(0, 760px); }
.draft-card { max-width: 760px; }
.draft-body { max-height: 56vh; background: var(--gray-1); }

/* content calendar — month grid */
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 1px; background: var(--color-line); border: 1px solid var(--color-line); border-radius: var(--radius); overflow: hidden; }
.cal-grid-head { border-radius: var(--radius) 10px 0 0; margin-bottom: 0; border-bottom: none; }
.cal-grid + .cal-grid { border-radius: 0 0 var(--radius) var(--radius); }
.cal-dow { background: var(--color-surface-solid); text-align: center; font-size: var(--text-xs); color: var(--color-muted); padding: var(--space-1) 0; }
.cal-cell { background: var(--color-surface-solid); min-height: 84px; padding: var(--space-1) var(--space-1) var(--space-1); display: flex; flex-direction: column; gap: 3px; }
.cal-cell-out { background: var(--ph-fill); }
.cal-cell-out .cal-daynum { color: var(--color-muted); }
.cal-cell-today .cal-daynum { color: var(--gray-0); background: var(--color-ink); border-radius: 50%; width: 18px; height: 18px; display: flex; align-items: center; justify-content: center; }
.cal-daynum { font-size: var(--text-sm); font-weight: var(--weight-semibold); }
.cal-chip { display: flex; gap: var(--space-1); align-items: center; font-size: var(--text-xs); text-align: left; padding: 2px var(--space-1); border-radius: var(--radius-sm); background: var(--color-soft); border: none; cursor: pointer; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: var(--color-ink); }
.cal-chip span:first-child { flex: 0 0 auto; font-weight: var(--weight-semibold); opacity: .6; }
.cal-chip span:last-child { overflow: hidden; text-overflow: ellipsis; }
.cal-chip-posted { opacity: .55; }

/* collapsed draft strips */
.draft-list {
  display: flex; flex-direction: column; gap: 0; max-width: 820px;
  background: var(--color-surface); border: var(--border-w) solid var(--color-line);
  border-radius: var(--radius); box-shadow: var(--shadow-card); overflow: hidden;
}
.draft-strip { padding: 0; overflow: hidden; border-bottom: var(--border-w) solid var(--color-line); }
.draft-list .draft-strip:last-child { border-bottom: 0; }
.draft-strip-head {
  display: flex; align-items: center; gap: var(--space-2);
  width: 100%; padding: var(--space-3) var(--space-3);
  background: none; border: none; cursor: pointer; text-align: left;
}
.draft-strip-head:hover { background: var(--color-hover); }
.draft-strip-title { flex: 1; min-width: 0; font-weight: var(--weight-semibold); font-size: var(--text-base);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.draft-strip-meta { font-size: var(--text-xs); white-space: nowrap; }
.draft-strip .chev { display: grid; place-items: center; width: 16px; height: 16px; color: var(--color-muted);
  transform: rotate(90deg); transition: transform var(--duration-hover); }
.draft-strip .chev svg { width: 14px; height: 14px; }
.draft-strip .chev.open { transform: rotate(-90deg); }
.draft-strip-body { padding: 0 var(--space-3) var(--space-3); border-top: 1px solid var(--color-line); }
.draft-account-row { display: flex; align-items: center; gap: var(--space-2); margin-top: var(--space-2); }

/* publish account manager */
.account-panel { margin-bottom: var(--space-4); }
.account-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--space-2); }
.account-chip {
  display: flex; align-items: center; gap: var(--space-2);
  padding: var(--space-2) var(--space-3); border: 1px solid var(--color-line); border-radius: var(--radius);
  background: var(--color-surface-solid);
}
.account-chip strong { font-size: var(--text-base); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.draft-meta { margin-top: var(--space-2); padding-top: var(--space-2); border-top: 1px solid var(--color-line); }
.save-cluster { display: flex; gap: var(--space-2); align-items: center; }
.save-cluster .helper { margin: 0; }
.studio-brief { display: grid; grid-template-columns: minmax(0, 1fr) 210px; gap: var(--space-2); }

/* ── section divider ── */
.section-band { margin-bottom: var(--space-4); }
.section-head { display: flex; gap: var(--space-3); align-items: center; justify-content: space-between; margin-bottom: var(--space-3); }

/* ════ dashboard blocks ════ */
.dash-block { margin-bottom: var(--space-4); }
.log-details > summary { cursor: pointer; list-style: none; }
.log-details > summary::-webkit-details-marker { display: none; }
.dash-block > .section-head { margin-bottom: var(--space-2); }
.dash-block .section-head h2 { margin: 0; font-size: var(--text-lg); font-weight: var(--weight-semibold); }
.dash-block .section-head .eyebrow { margin: 0; }

/* action center — standalone cards, no nested panel shell */
.panel, .action-wrap { overflow: hidden; }
.action-wrap { background: transparent; border: 0; padding: 0; box-shadow: none; backdrop-filter: none; }
.action-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: var(--space-3); align-items: stretch; }
.action-col { padding: var(--space-3); min-width: 0; min-height: 132px; overflow: hidden; border: 0; border-radius: var(--radius); background: var(--gray-0); box-shadow: var(--shadow-card); }
.action-col:first-child { padding-left: var(--space-3); }
.action-col:last-child { border-right: 0; padding-right: var(--space-3); }
.ac-head { display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-2); margin-bottom: var(--space-2); min-width: 0; }
.ac-num { font-family: var(--font-num); font-size: var(--text-2xl); font-weight: var(--weight-semibold); letter-spacing: 0; line-height: 1; font-variant-numeric: tabular-nums; }
.ac-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--text-sm); color: var(--color-muted); font-weight: var(--weight-medium); }
.ac-item { display: block; width: 100%; text-align: left; font-size: var(--text-sm); padding: var(--space-2) 0; border: 0; border-bottom: 1px solid var(--color-line); background: none; color: var(--color-ink); cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ac-item:last-child { border-bottom: 0; }
.ac-item:hover { color: var(--color-ink); background: var(--color-hover); }
.ac-empty { font-size: var(--text-sm); color: var(--color-muted); padding: var(--space-1) 0; }
.ac-cta { margin-top: var(--space-2); }

/* pipeline flow */
.flow { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); align-items: stretch; gap: var(--space-3); }
.flow .node { position: relative; min-width: 0; overflow: hidden; padding: var(--space-3); border: 1px solid var(--color-line); border-radius: var(--radius); background: var(--gray-0); }
.flow .node:not(:last-child)::after { content: none; }
.flow .node > span { display: block; overflow-wrap: anywhere; font-size: var(--text-xs); color: var(--color-muted); font-family: var(--font-num); font-weight: var(--weight-semibold); letter-spacing: .04em; text-transform: uppercase; }
.flow .node > strong { display: block; margin-top: var(--space-2); font-family: var(--font-num); font-size: var(--text-2xl); font-weight: var(--weight-semibold); line-height: 1.1; letter-spacing: 0; font-variant-numeric: tabular-nums; }
.flow .node > small { display: block; margin-top: var(--space-1); overflow-wrap: anywhere; font-size: var(--text-xs); color: var(--color-muted); }

/* pillar balance bars */
.pbar { display: grid; grid-template-columns: 76px 1fr 38px; gap: var(--space-2); align-items: center; margin-bottom: var(--space-3); }
.pbar:last-child { margin-bottom: 0; }
.pbar .pl { font-size: var(--text-sm); }
.pbar .track { height: 7px; background: var(--color-surface-strong); border-radius: var(--radius-pill); overflow: hidden; }
.pbar .fill { height: 100%; background: var(--color-ink); border-radius: var(--radius-pill); transition: width var(--duration-enter) var(--ease); }
.pbar .pv { font-family: var(--font-num); font-size: var(--text-sm); text-align: right; color: var(--color-muted); }

/* idea bank */
.idea-item { display: block; width: 100%; text-align: left; padding: var(--space-2) 0; border: 0; border-bottom: 1px solid var(--color-line); background: none; cursor: pointer; }
.idea-item:last-child { border-bottom: 0; }
.idea-item .ia-angle { font-size: var(--text-sm); color: var(--color-ink); line-height: 1.45; }
.idea-item:hover .ia-angle { color: var(--color-ink); font-weight: var(--weight-semibold); }
.idea-item .ia-from { font-size: var(--text-xs); color: var(--color-muted); margin-top: 2px; }

/* channel logo badge — brand-native colors are a sanctioned exception (identity
   mark, not a UI control), reused across dashboard + analytics */
.chan-logo { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: var(--radius-sm); flex-shrink: 0; }
.chan-logo svg { width: 13px; height: 13px; }
.chan-cell { display: inline-flex; align-items: center; gap: var(--space-2); font-size: var(--text-sm); }

/* content-format icon row — a compact, icon-first dimension (vs the card-first
   KPI/action blocks elsewhere on the dashboard) */
.dash-type-row { display: flex; justify-content: space-around; align-items: center; padding: var(--space-2) 0; }
.dash-type-item { display: flex; flex-direction: column; align-items: center; gap: var(--space-1); }
.dash-type-icon { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--color-soft); color: var(--color-muted); }
.dash-type-icon svg { width: 16px; height: 16px; }
.dash-type-num { font-family: var(--font-num); font-size: var(--text-lg); font-weight: var(--weight-semibold); font-variant-numeric: tabular-nums; }
.dash-type-label { font-size: var(--text-xs); color: var(--color-muted); }

/* channel board — compact row, logo replaces the plain text name */
.chan-row { display: grid; grid-template-columns: 1fr auto auto auto; gap: var(--space-2); align-items: center; padding: var(--space-2) 0; border-bottom: 1px solid var(--color-line); }
.chan-row:last-child { border-bottom: 0; }
.chan-row .cb-name { display: flex; align-items: center; gap: var(--space-2); font-weight: var(--weight-medium); font-size: var(--text-sm); }
.chan-row .cb-stat { font-family: var(--font-num); font-size: var(--text-base); font-weight: var(--weight-semibold); text-align: center; min-width: 32px; }
.chan-row .cb-stat small { display: block; font-family: var(--font-sans); font-size: 10px; color: var(--color-muted); font-weight: var(--weight-regular); margin-top: 0; }
.chan-row .cb-last { font-size: var(--text-xs); color: var(--color-faint); min-width: 76px; text-align: right; }

/* cadence sparkline */
.cad-head { display: flex; align-items: baseline; gap: var(--space-2); margin-bottom: var(--space-1); }
.cad-num { font-family: var(--font-num); font-size: var(--text-2xl); font-weight: var(--weight-semibold); letter-spacing: 0; line-height: 1; font-variant-numeric: tabular-nums; }
.cad-label { font-size: var(--text-sm); color: var(--color-muted); }
.spark { display: flex; align-items: flex-end; gap: 3px; height: 56px; margin-top: var(--space-2); }
.spark .bar { flex: 1; background: var(--color-surface-strong); border-radius: var(--radius-sm) 2px 0 0; min-height: 3px; }
.spark .bar.has { background: var(--color-ink); }

/* ── Idea Bank ─────────────────────────────────────────────── */
.idea-stats-bar { display: flex; gap: var(--space-2); flex-wrap: wrap; margin-bottom: var(--space-4); }
.is-pill { display: flex; align-items: center; gap: var(--space-1); padding: var(--space-1) var(--space-3); background: var(--color-surface); border: 1px solid var(--color-line); border-radius: var(--radius); font-size: var(--text-sm); }
.is-pill.blue { background: var(--gray-1); border-color: var(--color-line-strong); color: var(--color-ink); }
.is-pill.ink { background: var(--ink); border-color: var(--ink); color: var(--gray-0); }
.is-pill.green { background: var(--gray-1); border-color: var(--color-line-strong); color: var(--color-ink); }
.is-pill strong { font-size: var(--text-lg); font-weight: var(--weight-semibold); }

.idea-kanban { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-3); align-items: start; }
.idea-col { background: var(--color-surface); border: 1px solid var(--color-line); border-radius: var(--radius); padding: var(--space-3); }
.idea-col-head { display: flex; justify-content: space-between; align-items: center; font-size: var(--text-sm); font-weight: var(--weight-semibold); letter-spacing: .04em; text-transform: uppercase; color: var(--color-muted); margin-bottom: var(--space-2); }
.idea-empty { font-size: var(--text-sm); color: var(--color-muted); padding: var(--space-2) 0; text-align: center; }

.idea-card { background: var(--color-surface-solid); border: 1px solid var(--color-line); border-radius: var(--radius); padding: var(--space-2) var(--space-2); margin-bottom: var(--space-2); }
.idea-card-top { display: flex; align-items: center; justify-content: space-between; gap: var(--space-1); margin-bottom: var(--space-1); }
.idea-card-top .pill { font-size: var(--text-xs); padding: 1px var(--space-2); margin: 0; }
.idea-card-date { font-family: var(--font-num); font-size: var(--text-xs); color: var(--color-muted); white-space: nowrap; }
.idea-card-angle {
  font-size: var(--text-sm); font-weight: var(--weight-semibold); line-height: 1.4; margin-bottom: var(--space-2); color: var(--color-ink);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.idea-card-src { display: flex; align-items: center; gap: var(--space-1); margin-bottom: var(--space-2); }
.idea-card-thumb { flex: 0 0 28px; width: 28px; height: 18px; border-radius: var(--radius-sm); background: var(--ph-fill); background-size: cover; background-position: center; }
.idea-card-srctext { font-size: var(--text-xs); color: var(--color-muted); line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.idea-card-meta { display: flex; gap: var(--space-1); align-items: center; flex-wrap: wrap; margin-bottom: var(--space-2); }
.idea-card-actions { display: flex; gap: var(--space-1); align-items: center; justify-content: space-between; }
.idea-status-sel { font-size: var(--text-xs); border: 1px solid var(--color-line); border-radius: var(--radius); padding: 2px var(--space-1); background: var(--color-soft); color: var(--color-muted); cursor: pointer; }

/* 创造中心 image / video creation blocks */
.create-block { max-width: none; }
.create-block h3 { font-size: var(--text-base); margin: 0; }
.slide-queue { display: flex; flex-wrap: wrap; gap: var(--space-2); margin: var(--space-1) 0 var(--space-1); }
.slide-thumb { position: relative; width: 76px; height: 76px; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--color-line); background: var(--ph-fill); }
.slide-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.slide-idx { position: absolute; left: 4px; top: 4px; min-width: 16px; height: 16px; padding: 0 var(--space-1);
  display: grid; place-items: center; border-radius: var(--radius-sm); background: var(--ink); color: var(--gray-0);
  font-family: var(--font-num); font-size: var(--text-xs); }
.slide-del { position: absolute; right: 3px; top: 3px; width: 18px; height: 18px; padding: 0;
  display: grid; place-items: center; border: none; border-radius: var(--radius-sm); cursor: pointer;
  background: var(--ink); color: var(--gray-0); }
.slide-del svg { width: 11px; height: 11px; fill: none; stroke: currentColor; stroke-width: 2.4; }
/* upload buttons / 垫图 */
.upload-btn { cursor: pointer; display: inline-flex; align-items: center; }
.base-img-row { display: flex; align-items: center; gap: var(--space-2); }
.base-img-chip { display: flex; align-items: center; gap: var(--space-2); padding: var(--space-1) var(--space-1) var(--space-1) var(--space-1); border: 1px solid var(--color-line); border-radius: var(--radius); background: var(--color-surface-solid); }
.base-img-chip img { width: 40px; height: 40px; object-fit: cover; border-radius: var(--radius); display: block; }
.slide-audio { margin-top: var(--space-3); padding: var(--space-3); border: 1px solid var(--color-line); border-radius: var(--radius); background: var(--color-surface-strong); }

/* 二创台 preview + history */
.studio-preview { display: flex; flex-direction: column; }
.studio-preview-empty { min-height: 300px; display: flex; align-items: center; justify-content: center; text-align: center; line-height: 1.7; }
.studio-title-input { font-size: var(--text-2xl); font-weight: var(--weight-semibold); letter-spacing: -.01em; margin-bottom: var(--space-2); }
.studio-body-input { font: 13px/1.7 var(--font-sans); }
.studio-history { max-width: none; }
.studio-history-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: var(--space-2); }
.studio-history-item {
  text-align: left; padding: var(--space-2) var(--space-3); border: 1px solid var(--color-line);
  border-radius: var(--radius); background: var(--color-surface-solid); cursor: pointer;
}
.studio-history-item:hover { border-color: var(--color-line-strong); }
.studio-history-item.active { border-color: var(--color-ink); background: var(--color-hover); }
.studio-history-item strong { font-size: var(--text-base); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* pending review queue */
.review-queue { border: 1px solid var(--color-line-strong); background: var(--color-surface-strong); border-radius: var(--radius); padding: var(--space-3) var(--space-4); margin-bottom: var(--space-4); }
.review-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: var(--space-2); }
.review-list { display: flex; flex-direction: column; gap: var(--space-1); }
.review-item { display: flex; align-items: center; gap: var(--space-2); padding: var(--space-2) var(--space-2); background: var(--color-surface-solid); border: 1px solid var(--color-line); border-radius: var(--radius); }
.review-thumb { flex: 0 0 56px; height: 34px; border-radius: var(--radius-sm); background: var(--ph-fill); background-size: cover; background-position: center; }
.review-angle { font-size: var(--text-sm); font-weight: var(--weight-semibold); line-height: 1.4; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* idea toolbar */
.idea-toolbar { display: flex; gap: var(--space-2); flex-wrap: wrap; align-items: center; margin-bottom: var(--space-3); }

/* idea list view */
.idea-listview { display: flex; flex-direction: column; gap: var(--space-1); max-width: 940px; }
.idea-strip { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-2) var(--space-3); background: var(--color-surface-solid); border: 1px solid var(--color-line); border-radius: var(--radius); }
.idea-strip:hover { border-color: var(--color-line-strong); }
.idea-strip-thumb { flex: 0 0 56px; height: 34px; border-radius: var(--radius-sm); background: var(--ph-fill); background-size: cover; background-position: center; }
.idea-strip-body { flex: 1; min-width: 0; }
.idea-strip-angle { font-size: var(--text-base); font-weight: var(--weight-semibold); line-height: 1.4; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.idea-strip-meta { display: flex; gap: var(--space-1); align-items: center; flex-wrap: wrap; margin-top: var(--space-1); }
.idea-strip-src { font-size: var(--text-xs); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px; }
.idea-strip-actions { display: flex; align-items: center; gap: var(--space-2); flex: 0 0 auto; }
.idea-strip-actions .idea-status-sel { margin: 0; }
.row-check { width: 15px !important; height: 15px !important; min-height: 0 !important; padding: 0 !important; flex: 0 0 auto; }

/* kanban drag states */
.idea-col { transition: background var(--duration-hover), border-color var(--duration-hover); }
.idea-col.drop-target { background: var(--color-hover); border-color: var(--color-ink); }
.idea-card { cursor: grab; position: relative; }
.idea-card[draggable="true"]:active { cursor: grabbing; }
.idea-card.dragging { opacity: .4; }
.idea-card-grip { position: absolute; top: 8px; right: 10px; color: var(--color-muted); font-size: var(--text-sm); line-height: 1; letter-spacing: -1px; opacity: .5; }

/* ── Structured Summary Cards ───────────────────────────────── */
.sum-tldr { font-size: var(--text-lg); font-weight: var(--weight-semibold); line-height: 1.5; margin-bottom: var(--space-1); padding: var(--space-2) var(--space-3); background: var(--color-soft); border-radius: var(--radius); }
.sum-takeaway { color: var(--color-ink); font-weight: var(--weight-semibold); font-size: var(--text-base); margin-bottom: var(--space-2); padding: var(--space-1) 0; }
.sum-section { margin-top: var(--space-3); }
.sum-section-head { font-size: var(--text-xs); font-weight: var(--weight-semibold); letter-spacing: .06em; text-transform: uppercase; color: var(--color-muted); margin-bottom: var(--space-1); }
.sum-quote { margin: var(--space-1) 0; padding: var(--space-1) var(--space-2); border-left: 2px solid var(--color-line-strong); background: var(--color-soft); border-radius: 0 var(--radius) var(--radius) 0; font-size: var(--text-sm); font-style: italic; }
.sum-angles { display: flex; flex-direction: column; gap: var(--space-1); }
.sum-angle-card { background: var(--color-soft); border: 1px solid var(--color-line); border-radius: var(--radius); padding: var(--space-2) var(--space-2); display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-2); }
.sum-angle-text { font-size: var(--text-base); line-height: 1.4; flex: 1; }

/* ── Analytics ──────────────────────────────────────────────── */
.ana-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-3); margin-bottom: var(--space-4); }
.ana-card { background: var(--color-surface); border: 1px solid var(--color-line); border-radius: var(--radius); padding: var(--space-4) var(--space-4); text-align: center; }
.ana-num { font-family: var(--font-num); font-size: var(--text-2xl); font-weight: var(--weight-semibold); letter-spacing: -.01em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.ana-label { font-size: var(--text-sm); color: var(--color-muted); margin-top: var(--space-1); }

/* ── Dashboard KPI row (pipeline funnel, same card language as .ana-card
   plus a week-over-week delta line) ───────────────────────────── */
.dash-kpi-grid { display: grid; grid-template-columns: repeat(5, minmax(0,1fr)); gap: var(--space-3); }
.dash-kpi { background: var(--color-surface); border: var(--border-w) solid var(--color-line); border-radius: var(--radius); padding: var(--space-4); }
.dash-kpi-label { font-size: var(--text-sm); color: var(--color-muted); }
.dash-kpi-num { font-family: var(--font-num); font-size: var(--text-2xl); font-weight: var(--weight-semibold); letter-spacing: -.01em; line-height: 1.1; margin-top: var(--space-1); font-variant-numeric: tabular-nums; }
.dash-kpi-hint { font-size: var(--text-xs); color: var(--color-faint); margin-top: var(--space-1); }
.dash-kpi-delta { font-family: var(--font-num); font-size: var(--text-xs); font-weight: var(--weight-semibold); margin-left: var(--space-1); font-variant-numeric: tabular-nums; }
.dash-kpi-delta.up { color: var(--color-ink); }
.dash-kpi-delta.down { color: var(--color-faint); }
.dash-kpi-delta.flat { color: var(--color-faint); }

/* condensed action tiles — count + one preview line + a link, not a full list */
.dash-action-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: var(--space-3); }
.dash-action-tile { background: var(--color-surface); border: var(--border-w) solid var(--color-line); border-radius: var(--radius); padding: var(--space-4); display: flex; flex-direction: column; gap: var(--space-1); }
.dash-action-num { font-family: var(--font-num); font-size: var(--text-2xl); font-weight: var(--weight-semibold); line-height: 1.1; font-variant-numeric: tabular-nums; }
.dash-action-label { font-size: var(--text-sm); color: var(--color-muted); }
.dash-action-preview { font-size: var(--text-xs); color: var(--color-faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: var(--space-1); }
.dash-action-cta { margin-top: auto; padding-top: var(--space-2); font-size: var(--text-xs); color: var(--color-ink); font-weight: var(--weight-medium); background: none; border: none; text-align: left; cursor: pointer; }
.dash-action-cta:hover { text-decoration: underline; }

/* cadence bar chart — 14-day, week-over-week delta in the header */
.dash-cadence-head { display: flex; align-items: baseline; gap: var(--space-2); margin-bottom: var(--space-3); }
.dash-cadence-bars { display: flex; align-items: flex-end; gap: 3px; height: 64px; }
.dash-cadence-bars .bar { flex: 1; background: var(--gray-3); border-radius: var(--radius-sm) var(--radius-sm) 0 0; min-height: 2px; transition: background var(--duration-hover); }
.dash-cadence-bars .bar.has { background: var(--ink); }

/* ── Persona ─────────────────────────────────────────────────── */
.score-result { margin-top: var(--space-4); padding: var(--space-3); background: var(--color-soft); border-radius: var(--radius); }
.score-total { display: flex; align-items: baseline; gap: var(--space-2); margin-bottom: var(--space-3); }
.score-num { font-family: var(--font-num); font-size: var(--text-2xl); font-weight: var(--weight-semibold); letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.score-label { font-size: var(--text-lg); color: var(--color-muted); }
.score-dim { display: grid; grid-template-columns: 90px 1fr 24px; gap: var(--space-2); align-items: center; font-size: var(--text-sm); margin-bottom: var(--space-1); }
.score-bar { height: 6px; background: var(--color-line); border-radius: var(--radius-sm); overflow: hidden; }
.score-bar span { display: block; height: 100%; background: var(--color-ink); border-radius: var(--radius-sm); transition: width .3s; }

@media (max-width: 920px) {
  .shell { grid-template-columns: minmax(0, 1fr); max-width: 100vw; overflow-x: hidden; }
  .sidebar {
    position: static; height: auto; padding: var(--space-3) var(--space-3);
    border-right: 0; border-bottom: 1px solid var(--color-line);
    width: 100%; max-width: 100vw; overflow: hidden;
  }
  .sidebar .brand { padding: 0; max-width: 100%; }
  .nav {
    display: flex; gap: var(--space-1); margin-top: var(--space-3); overflow-x: auto;
    width: 100%; max-width: 100%; min-width: 0;
    padding-bottom: 2px; scrollbar-width: thin;
  }
  .nav button { flex: 0 0 auto; width: auto; padding: 0 var(--space-2); }
  .sidebar .foot { display: none; }
  .main { padding: var(--space-4) var(--space-4) var(--space-6); width: 100%; max-width: 100vw; overflow-x: hidden; }
  .cols-2, .cols-3, .cols-4, .draft-grid, .studio-brief { grid-template-columns: 1fr; }
  .source-list { max-height: 360px; }
  .storage-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .queue-panel { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .queue-action { grid-column: 1 / -1; justify-content: flex-start; flex-wrap: wrap; }
  .batch-dim-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .action-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3); }
  .action-col { padding: var(--space-3); border: 0; border-radius: var(--radius); min-height: 132px; }
  .action-col:first-child { padding-left: var(--space-3); }
  .action-col:last-child { padding-right: var(--space-3); border-bottom: 0; }
  .flow { grid-template-columns: 1fr; gap: var(--space-3); }
  .flow .node { padding: var(--space-3); border: 1px solid var(--color-line); border-radius: var(--radius); }
  .flow .node:last-child { padding-bottom: var(--space-3); border-bottom: 1px solid var(--color-line); }
  .flow .node:not(:last-child)::after { content: none; }
  .draft-card { max-width: none; }
  .settings-modal { max-width: 100%; }
  .settings-modal-body { flex-direction: column; max-height: none; }
  .settings-tab-list {
    flex-direction: row; flex: 0 0 auto; overflow-x: auto; white-space: nowrap;
    border-right: 0; border-bottom: 1px solid var(--color-line);
    padding-right: 0; padding-bottom: var(--space-2); gap: var(--space-1);
  }
  .settings-tab-list button { flex: 0 0 auto; }
  .settings-tab-content { max-height: 46vh; }
}

@media (max-width: 560px) {
  body { font-size: var(--text-base); }
  h1 { font-size: var(--text-lg); }
  .page-head { flex-direction: column; align-items: stretch; gap: var(--space-2); }
  .page-head > .flex, .save-cluster { justify-content: flex-start; flex-wrap: wrap; }
  .page-head > .flex { width: 100%; }
  .page-head .btn { flex: 1 1 140px; }
  .stack-sm { align-items: flex-start; flex-direction: column; gap: var(--space-1); }
  .field-row { flex-direction: column; }
  .banner { grid-template-columns: 24px minmax(0, 1fr) var(--control-h); gap: var(--space-2); padding: var(--space-2); }
  .banner-icon { width: 24px; height: 24px; border-radius: var(--radius); }
  .inbox-card { grid-template-columns: 1fr; align-items: stretch; }
  .inbox-actions { justify-content: flex-start; }
  .next-action { justify-items: start; max-width: none; }
  .detail-grid { grid-template-columns: 1fr; }
  .inline-text, .summary-inline { max-height: 240px; }
  .trash-card { grid-template-columns: 1fr; align-items: stretch; }
  .trash-actions { justify-content: flex-start; }
  .queue-panel { grid-template-columns: 1fr 1fr; }
  .queue-stat { border-right: 0; padding-right: 0; }
  .queue-action { flex-direction: column; align-items: stretch; }
  .queue-action select { width: 100%; }
  .watchlist-layout { grid-template-columns: 1fr; }
  .profile-editor { grid-template-columns: 1fr; }
  .settings-section-head { align-items: flex-start; flex-direction: column; gap: 3px; }
  .settings-section-head small { text-align: left; }
  .storage-grid { grid-template-columns: 1fr; }
  .action-grid { grid-template-columns: 1fr; gap: var(--space-2); }
  .pbar { grid-template-columns: 64px minmax(0, 1fr) 34px; gap: var(--space-2); }
  .chan-row { grid-template-columns: 1fr auto auto; }
  .chan-row .cb-last { grid-column: 1 / -1; text-align: left; min-width: 0; }
  .video-main { display: grid; grid-template-columns: 72px minmax(0, 1fr); }
  .video-thumb { width: 72px; height: 42px; flex-basis: auto; }
  .video-actions { grid-column: 1 / -1; min-width: 0; align-items: center; justify-content: flex-start; }
  .choice-group.compact { width: 100%; grid-auto-flow: row; grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .choice-group.compact button { width: 100%; }
  .batch-dim-grid { grid-template-columns: 1fr; }
  .tabs { display: flex; width: 100%; overflow-x: auto; flex-wrap: nowrap; }
  .tabs button { flex: 0 0 auto; }
  table { display: block; overflow-x: auto; white-space: nowrap; }
  .overlay { padding: var(--space-4) var(--space-3); }
  .modal { padding: var(--space-4); }
  .logo-setting { grid-template-columns: 40px minmax(0, 1fr); }
  .logo-setting .logo-preview { width: 40px; height: 40px; flex-basis: 40px; font-size: 21px; }
  .idea-kanban { grid-template-columns: 1fr; }
  .ana-summary { grid-template-columns: repeat(3, 1fr); }
  .grid.cols-2 { grid-template-columns: 1fr; }
}
