/* ===========================================================================
   Structural stylesheet.
   Every page uses ONLY the class names defined here (LH23 reskin convention):
   the Claude Design pass restyles these selectors and the token files, and must
   never need to rename a class or touch a template's form fields or scripts.

   The look (2026-09-22) follows Billy's reference screens: a white one-row header
   with icon navigation and a soft active pill; segmented tabs; filled search
   fields; grey-headed tables with small-caps column labels; status badges as
   small caps on soft fills; KPI cards with trend lines; quiet borders and one
   confident blue. docs/design-system.md says what each device means.
   =========================================================================== */
/* Tokens are NOT @imported here. base.njk links tokens/base.css and tokens/colors.css directly,
   each with a content version. An @import would pull an unversioned copy in after them and could
   override the fresh tokens with stale ones. Any page not extending base.njk must link them too. */

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { font-synthesis-weight: none; }
body {
  font-family: var(--font-sans);
  font-size: var(--text-md);
  line-height: var(--leading-normal);
  color: var(--ink);
  background: var(--paper-2);
  accent-color: var(--brand);
  -webkit-font-smoothing: antialiased;
  /* Long unbroken strings — URLs, emails, ids — must break rather than widen the page. */
  overflow-wrap: break-word;
}

/* ---- overflow containment ------------------------------------------------
   Grid and flex children default to `min-width: auto`, which refuses to shrink
   below their content and pushes long text outside its box. This one rule is
   the fix for most "text escaping the card" bugs; everything below is the
   per-component follow-through. */
.grid > *, .stack > *, .flex > * { min-width: 0; }
.card, .kpi, .chart-card, .table-wrap { min-width: 0; max-width: 100%; }
.card p, .card li { overflow-wrap: anywhere; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
/* One focus ring everywhere, visible in every theme. */
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--focus); outline-offset: 2px; }
h1, h2, h3 { margin: 0; line-height: var(--leading-tight); font-weight: var(--weight-bold); color: var(--ink); }
h1 { font-size: var(--text-xl); letter-spacing: -.01em; }
h2 { font-size: var(--text-lg); }
h3 { font-size: var(--text-md); }

/* Inline icons come from one sprite (icons/sprite.svg) and take the text colour. */
.nav__icon { width: var(--icon); height: var(--icon); flex: none; display: inline-block; vertical-align: middle; }

/* ---- app shell --------------------------------------------------------- */
.app { min-height: 100vh; display: flex; flex-direction: column; }
/* ONE ROW: brand | navigation | theme, help, account. It sticks, so navigation is always one move
   away; below 1400px the navigation takes a second row of its own rather than being clipped. */
.topbar {
  display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap;
  min-height: var(--header-h); padding: 0 var(--space-5);
  background: var(--bar); color: var(--bar-ink); border-bottom: var(--stroke) solid var(--bar-line);
  position: sticky; top: 0; z-index: 20;
}
.topbar__brand { display: flex; align-items: center; gap: var(--space-3); flex: none;
  height: var(--nav-link-h); padding-right: var(--space-4); margin-right: var(--space-1);
  border-right: var(--stroke) solid var(--bar-line); color: var(--bar-ink); text-decoration: none; }
.topbar__brand:hover { text-decoration: none; }
.topbar__logo { display: block; height: 24px; width: auto; filter: var(--logo-filter); }
/* Nudged down: the logo's lettering sits low in its image, under the mark. */
.topbar__product { font-size: var(--text-sm); font-weight: var(--weight-medium); color: var(--bar-ink-2); position: relative; top: 2px; }
.topbar__spacer { flex: 1; }
.topbar__icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px;
  border-radius: var(--radius-md); color: var(--bar-ink-2); }
.topbar__icon-btn:hover { background: var(--bar-hover); color: var(--bar-ink); text-decoration: none; }
.topbar__user { display: flex; align-items: center; gap: var(--space-2); padding-left: var(--space-3);
  border-left: var(--stroke) solid var(--bar-line); height: var(--nav-link-h); color: var(--bar-ink-2); font-size: var(--text-sm); }
.topbar__avatar { width: 28px; height: 28px; border-radius: var(--radius-pill); display: inline-flex;
  align-items: center; justify-content: center; background: var(--avatar); color: var(--avatar-ink);
  font-size: var(--text-xs); font-weight: var(--weight-bold); flex: none; }
.topbar__email { white-space: nowrap; }
.topbar__signout { gap: 6px; }
.topbar__signout .nav__icon { width: 16px; height: 16px; }

.nav { display: flex; align-items: center; gap: 2px; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav__link {
  display: inline-flex; align-items: center; gap: var(--space-2); flex: none;
  height: var(--nav-link-h); padding: 0 10px; border-radius: var(--radius-md);
  color: var(--bar-ink-2); font-size: var(--text-md); font-weight: var(--weight-medium);
  line-height: 1; white-space: nowrap; text-decoration: none;
}
.nav__link:hover { color: var(--bar-ink); background: var(--bar-hover); text-decoration: none; }
.nav__link--active, .nav__link--active:hover {
  background: var(--bar-active); color: var(--bar-active-ink); font-weight: var(--weight-bold); }
.nav__link:focus-visible { outline-offset: -2px; }

main { flex: 1; }
.page { max-width: 1240px; margin: 0 auto; padding: var(--space-6) var(--space-5) var(--space-7); }

/* ---- page head --------------------------------------------------------- */
.page-head { display: flex; align-items: flex-start; gap: var(--space-4); margin-bottom: var(--space-5); flex-wrap: wrap; }
.page-head__titles { flex: 1; min-width: 260px; }
.page-head__titles p { margin: 6px 0 0; color: var(--ink-2); max-width: 76ch; }
.page-head__actions { display: flex; gap: var(--space-2); align-items: center; flex-wrap: wrap; }
/* It encodes where the page sits (section, trade, tier), so it stays — quietly. */
.u-eyebrow { font-size: var(--text-sm); color: var(--ink-3); font-weight: var(--weight-medium); margin-bottom: var(--space-1); }

/* ---- layout primitives ------------------------------------------------- */
.grid { display: grid; gap: var(--space-4); }
.grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }
.stack { display: flex; flex-direction: column; gap: var(--space-4); }
.stack--sm { gap: var(--space-2); }
.flex { display: flex; gap: var(--space-3); align-items: center; flex-wrap: wrap; }
.between { justify-content: space-between; }
.divider { height: var(--stroke); background: var(--line); border: 0; margin: var(--space-4) 0; }
.section { margin-bottom: var(--space-6); }
.section__head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: var(--space-3); gap: var(--space-3); flex-wrap: wrap; }
.section__head h2 { font-size: var(--text-lg); }

/* ---- cards ------------------------------------------------------------- */
.card, .chart-card { background: var(--paper); border: var(--stroke) solid var(--line); border-radius: var(--radius-lg);
  padding: var(--space-5); box-shadow: var(--shadow-card); }
.card--lifted { box-shadow: var(--shadow-md); }
.card--flush { padding: 0; overflow: hidden; }
.card__head { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--space-3);
  margin-bottom: var(--space-4); flex-wrap: wrap; }
.card__title { font-weight: var(--weight-bold); font-size: 15px; color: var(--ink); }
.card__sub { color: var(--ink-3); font-size: var(--text-sm); margin-top: 2px; }
.card__foot { margin-top: var(--space-4); padding-top: var(--space-3); border-top: var(--stroke) solid var(--line); font-size: var(--text-sm); color: var(--ink-3); }
.chart-box { position: relative; height: 260px; }
.chart-box--tall { height: 360px; }

/* ---- KPI --------------------------------------------------------------- */
/* Each figure is its own card: label, value, what the value is measured against, and — where a
   real weekly series exists — a trend line of it. */
.grid--kpi { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.grid--kpi:not(:has(> .kpi)) { display: none; }
/* Four wide cards, as in the reference, where the figures and their pills are long (money, counts). */
.grid--kpi-wide { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.kpi { position: relative; background: var(--paper); border: var(--stroke) solid var(--line); border-radius: var(--radius-lg);
  padding: var(--space-4) var(--space-4) var(--space-3); box-shadow: var(--shadow-card);
  display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "label trend" "value spark" "delta delta";
  column-gap: var(--space-3); align-content: start; }
.kpi__label { grid-area: label; font-size: var(--text-sm); color: var(--ink-2); font-weight: var(--weight-medium); }
.kpi__value { grid-area: value; font-size: var(--text-2xl); font-weight: var(--weight-bold); line-height: 1.15; white-space: nowrap;
  margin-top: var(--space-2); letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.kpi__delta { grid-area: delta; font-size: var(--text-xs); color: var(--ink-3); margin-top: 6px; }
/* The pill sits over the trend-line column, which is fixed at the line's width, and overhangs to
   the left when it is wider — so a long pill never narrows the column the value is printed in. */
.kpi__trend { grid-area: trend; justify-self: end; white-space: nowrap; }
.kpi:has(> .kpi__spark) { grid-template-columns: minmax(0, 1fr) 104px; }
.kpi__spark { grid-area: spark; align-self: end; width: 104px; height: 36px; position: relative; margin-top: var(--space-2); }
/* Direction is a shape as well as a colour: an arrow drawn from the icon set. */
.kpi__delta--up, .kpi__delta--down, .delta { display: inline-flex; align-items: center; gap: 4px; width: fit-content;
  padding: 1px 8px; border-radius: var(--radius-pill); font-weight: var(--weight-bold); font-size: var(--text-xs);
  background: var(--state-ok-soft); color: var(--state-ok);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, currentColor 22%, transparent); }
.kpi__delta--down, .delta--down { background: var(--state-error-soft); color: var(--state-error); }
.kpi__delta--up::before, .kpi__delta--down::before, .delta::before { content: ""; width: 12px; height: 12px; flex: none;
  background: currentColor; -webkit-mask: url("/assets/icons/trending-up.svg") center / contain no-repeat;
  mask: url("/assets/icons/trending-up.svg") center / contain no-repeat; }
.kpi__delta--down::before, .delta--down::before { -webkit-mask-image: url("/assets/icons/trending-down.svg"); mask-image: url("/assets/icons/trending-down.svg"); }
.kpi--warn { box-shadow: var(--shadow-card), inset 3px 0 0 var(--state-warn); }
.kpi--alert { box-shadow: var(--shadow-card), inset 3px 0 0 var(--state-error); }

/* ---- buttons ----------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 36px; padding: 0 16px; border-radius: var(--radius-md);
  background: var(--brand); color: var(--brand-ink); border: var(--stroke) solid var(--brand);
  font-size: var(--text-md); font-weight: var(--weight-bold); font-family: inherit; line-height: 1.2;
  cursor: pointer; text-decoration: none; white-space: nowrap; box-shadow: var(--shadow-sm);
}
.btn:hover { text-decoration: none; background: var(--brand-hover); border-color: var(--brand-hover); color: var(--brand-ink); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn .nav__icon { width: 16px; height: 16px; }
.btn--ghost { background: var(--paper); color: var(--ink); border-color: var(--line-input); font-weight: var(--weight-medium); }
.btn--ghost:hover { background: var(--paper-2); border-color: var(--line-strong); color: var(--ink); }
.btn--danger { background: var(--state-error); border-color: var(--state-error); color: var(--state-ink); }
.btn--danger:hover { background: var(--state-error); border-color: var(--state-error); color: var(--state-ink); filter: brightness(.94); }
.btn--sm { min-height: 30px; padding: 0 10px; font-size: var(--text-sm); }
.btn--lg { min-height: 42px; padding: 0 20px; font-size: 15px; }
.btn--block { width: 100%; }
.btn-row { display: flex; gap: var(--space-2); flex-wrap: wrap; }

/* ---- status badges ------------------------------------------------------
   Small capitals on a soft fill, ink text — the fill carries the state, the text stays readable. */
.pill { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: var(--radius-sm); line-height: 16px;
  font-size: var(--text-2xs); font-weight: var(--weight-bold); letter-spacing: var(--tracking-caps); text-transform: uppercase;
  background: var(--state-muted-soft); color: var(--ink); white-space: nowrap; vertical-align: middle; }
.pill + .pill { margin-left: 4px; }
.pill--new, .pill--approved           { background: var(--state-info-soft); }
.pill--qualified, .pill--replied, .pill--meeting, .pill--won,
.pill--active, .pill--sent, .pill--running { background: var(--state-ok-soft); }
.pill--queued, .pill--contacted, .pill--ready { background: var(--brand-soft); }
.pill--quoted, .pill--paused, .pill--simulated, .pill--seeded, .pill--held { background: var(--state-warn-soft); }
.pill--lost, .pill--suppressed        { background: var(--state-error-soft); }
.pill--rejected, .pill--draft, .pill--ended { background: var(--state-muted-soft); }
/* Tiers are ranks, not states — Tier 3 is not a warning. A neutral tag with the tier chart's swatch. */
.pill--tier1, .pill--tier2, .pill--tier3, .pill--tier4 { background: var(--paper-3); }
.pill--tier1::before, .pill--tier2::before, .pill--tier3::before, .pill--tier4::before {
  content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; }
.pill--tier1::before { background: var(--tier-1); }
.pill--tier2::before { background: var(--tier-2); }
.pill--tier3::before { background: var(--tier-3); }
.pill--tier4::before { background: var(--tier-4); }

/* ---- tables ------------------------------------------------------------ */
.table-wrap { overflow-x: auto; background: var(--paper); border: var(--stroke) solid var(--line);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-card); }
/* A table standing on the page keeps its distance from whatever follows it. */
.table-wrap + .card, .table-wrap + .disclosure-card, .table-wrap + .section, .table-wrap + .table-wrap { margin-top: var(--space-4); }
/* A table already inside a .card needs the scroll container but not a second border. */
.table-wrap--bare { border: 0; border-radius: 0; background: transparent; box-shadow: none; }
.card > .table-wrap--bare { margin: 0 calc(-1 * var(--space-5)); max-width: none; }
/* Leading the card, the table's grey header row becomes the card's top edge. */
.card > .table-wrap--bare:first-child { margin-top: calc(-1 * var(--space-5)); border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
.card > .table-wrap--bare + .card__foot { margin-top: 0; }
table.data { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
table.data th {
  text-align: left; padding: 10px 14px; font-size: var(--text-2xs); font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-caps); text-transform: uppercase;
  color: var(--ink-2); background: var(--paper-2); border-bottom: var(--stroke) solid var(--line); white-space: nowrap;
}
table.data td {
  padding: 12px 14px; border-bottom: var(--stroke) solid var(--line);
  vertical-align: middle; overflow-wrap: anywhere; font-variant-numeric: tabular-nums;
}
/* Alignment utilities must win inside a table. `table.data th` is specificity (0,1,1) and was
   silently beating `.u-right` (0,1,0), so every numeric header rendered left-aligned above
   right-aligned data. Scoped overrides fix it for both th and td at once. */
table.data th.u-right,  table.data td.u-right  { text-align: right; }
table.data th.u-center, table.data td.u-center { text-align: center; }
table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover { background: var(--paper-2); }
.cell-primary { font-weight: var(--weight-medium); color: var(--ink); }
.cell-sub { color: var(--ink-3); font-size: var(--text-xs); margin-top: 2px; }
.td-actions { text-align: right; white-space: nowrap; }
.row-muted td { color: var(--ink-3); }
/* Progress: a thin rule on a pale track, as in the reference. */
.bar { height: 4px; background: var(--paper-3); border-radius: var(--radius-pill); overflow: hidden; min-width: 60px; }
.bar--wide { min-width: 140px; height: 6px; }
/* The width arrives as a custom property (style="--fill: 40%"), the one inline style the reskin
   rules allow; an older inline `width:` still wins where a template sets one. */
.bar__fill { height: 100%; width: var(--fill, 0); background: var(--brand); border-radius: var(--radius-pill); }
.meter-row { display: flex; align-items: center; gap: var(--space-3); }
.meter-row .bar { flex: 1 1 auto; max-width: 260px; }
.bar__fill--success { background: var(--state-ok); }
.bar__fill--warn { background: var(--state-warn); }
.bar__fill--error { background: var(--state-error); }

/* ---- forms ------------------------------------------------------------- */
.field { margin-bottom: var(--space-4); display: block; }
.field > label, .field__label { display: block; font-size: var(--text-sm); font-weight: var(--weight-medium); color: var(--ink); margin-bottom: 6px; }
.field__hint { display: block; font-size: var(--text-xs); color: var(--ink-3); margin-top: 6px; }
.input {
  width: 100%; min-height: 38px; padding: 8px 12px; font-family: inherit; font-size: var(--text-md);
  color: var(--ink); background: var(--paper);
  border: var(--stroke) solid var(--line-input); border-radius: var(--radius-md); box-shadow: var(--shadow-sm);
}
.input::placeholder { color: var(--ink-3); }
.input:focus { outline: 0; border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 22%, transparent); }
select.input { appearance: none; -webkit-appearance: none; padding-right: 36px; cursor: pointer;
  background-image: var(--icon-select); background-repeat: no-repeat; background-position: right 10px center; background-size: 16px; }
select.input[multiple] { background-image: none; padding-right: 12px; }
textarea.input { min-height: 96px; line-height: 1.55; resize: vertical; }
/* The Liquid editor is code, so it is set in mono. */
textarea.input--tall { min-height: 340px; font-family: var(--font-mono); font-size: var(--text-sm); line-height: 1.6; }
/* Search fields are filled, with the magnifier inside, as in the reference. */
input[type="search"].input, .toolbar input[type="text"].input { background-color: var(--paper-2); border-color: var(--line); box-shadow: none; }
input[type="search"].input { padding-left: 38px; background-image: var(--icon-search); background-repeat: no-repeat;
  background-position: 12px center; background-size: 16px; }
input[type="search"].input:focus, .toolbar input[type="text"].input:focus { background-color: var(--paper); }
input[type="checkbox"], input[type="radio"] { width: 16px; height: 16px; accent-color: var(--brand); }
.hint { font-size: var(--text-xs); color: var(--ink-3); margin-top: var(--space-1); }
.field--error .input { border-color: var(--state-error); }
.error-msg { font-size: var(--text-xs); color: var(--state-error); margin-top: var(--space-1); }
.field-inline { display: flex; gap: var(--space-2); align-items: flex-end; flex-wrap: wrap; }
.toolbar { display: flex; gap: var(--space-2); align-items: center; flex-wrap: wrap; margin-bottom: var(--space-4); }
.toolbar .input { width: auto; min-width: 150px; }
.toolbar input[type="search"].input { flex: 1 1 260px; }

/* ---- segmented tabs ------------------------------------------------------
   A pale track with the current tab as a raised white segment, as in the reference. Used by the
   prospect list (review queue / approved / rejected), campaign status, and campaign sections. */
.tabs { display: flex; width: fit-content; max-width: 100%; overflow-x: auto; gap: 2px; padding: 3px;
  background: var(--paper-2); border: var(--stroke) solid var(--line); border-radius: var(--radius-lg);
  margin-bottom: var(--space-4); scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs__tab, .tab {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; border-radius: var(--radius-md);
  border: var(--stroke) solid transparent; color: var(--ink-2); font-size: var(--text-sm); font-weight: var(--weight-medium);
  text-decoration: none; white-space: nowrap; cursor: pointer;
}
.tabs__tab:hover, .tab:hover { color: var(--ink); text-decoration: none; }
.tabs__tab--active, .tab--active, .tabs__tab--active:hover {
  background: var(--paper); color: var(--ink); font-weight: var(--weight-bold);
  border-color: var(--line); box-shadow: var(--shadow-tab); }
.tabs__count { color: var(--ink-2); font-size: var(--text-2xs); font-weight: var(--weight-bold); background: var(--paper-3);
  border-radius: var(--radius-pill); padding: 0 7px; line-height: 18px; font-variant-numeric: tabular-nums; }
.tabs__tab--active .tabs__count { color: var(--brand); background: var(--brand-soft); }
.tabs__blurb { margin: 0 0 var(--space-4); }

/* ---- feedback ---------------------------------------------------------- */
/* A note: soft fill, a hairline in its own colour, and an icon — never a heavy bar. */
.callout { position: relative; padding: 12px 16px 12px 44px; border-radius: var(--radius-lg);
  border: var(--stroke) solid var(--line); background: var(--paper); color: var(--ink);
  margin-bottom: var(--space-4); font-size: var(--text-sm); }
.callout::before { content: ""; position: absolute; left: 16px; top: 13px; width: 18px; height: 18px;
  background: var(--ink-3); -webkit-mask: url("/assets/icons/info.svg") center / contain no-repeat;
  mask: url("/assets/icons/info.svg") center / contain no-repeat; }
.callout--info    { background: var(--state-info-soft);  border-color: color-mix(in srgb, var(--state-info) 25%, transparent); }
.callout--success { background: var(--state-ok-soft);    border-color: color-mix(in srgb, var(--state-ok) 25%, transparent); }
.callout--warn    { background: var(--note-bg);          border-color: var(--note-line); }
.callout--error   { background: var(--state-error-soft); border-color: color-mix(in srgb, var(--state-error) 25%, transparent); }
.callout--info::before    { background: var(--state-info); }
.callout--success::before { background: var(--state-ok);
  -webkit-mask-image: url("/assets/icons/circle-check.svg"); mask-image: url("/assets/icons/circle-check.svg"); }
.callout--warn::before    { background: var(--note-ink);
  -webkit-mask-image: url("/assets/icons/circle-alert.svg"); mask-image: url("/assets/icons/circle-alert.svg"); }
.callout--error::before   { background: var(--state-error);
  -webkit-mask-image: url("/assets/icons/triangle-alert.svg"); mask-image: url("/assets/icons/triangle-alert.svg"); }
.callout strong { color: var(--ink); font-weight: var(--weight-bold); }
.empty { padding: var(--space-7) var(--space-4); text-align: center; color: var(--ink-3);
  border: var(--stroke) dashed var(--line-input); border-radius: var(--radius-lg); background: var(--paper); }
.chart-card .empty, .card .empty { border-color: var(--line); background: var(--paper-2); }
.empty p { margin: 0; }
.empty h3 { color: var(--ink); margin-bottom: var(--space-2); }

/* ---- provenance: the house style for "where did this come from?" -------
   Used on every competitor event and every prospect signal. Never hide it. */
.source {
  font-size: var(--text-xs); color: var(--ink-3);
  display: inline-flex; gap: var(--space-1); align-items: center;
  flex-wrap: wrap; min-width: 0; max-width: 100%; overflow-wrap: anywhere;
}
.source__kind { font-weight: var(--weight-bold); font-size: var(--text-2xs); letter-spacing: var(--tracking-caps);
  text-transform: uppercase; color: var(--ink-2); background: var(--paper-3); padding: 0 6px; border-radius: var(--radius-sm); }
.signal-list { list-style: none; margin: 0; padding: 0; }
.signal-list li {
  padding: 12px 0; border-bottom: var(--stroke) solid var(--line);
  font-size: var(--text-sm); min-width: 0; overflow-wrap: anywhere;
}
.signal-list li:last-child { border-bottom: 0; }
.signal__value { display: block; }
.quote {
  border-left: 3px solid var(--line-input); padding-left: var(--space-3);
  color: var(--ink-2); overflow-wrap: anywhere;
}

/* ---- login ------------------------------------------------------------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: var(--space-5); background: var(--paper-2); }
.login-card { width: 100%; max-width: 400px; background: var(--paper); border: var(--stroke) solid var(--line);
  border-radius: var(--radius-xl); padding: var(--space-6); box-shadow: var(--shadow-md); }
.login-card__logo { display: block; height: 30px; width: auto; margin-bottom: var(--space-5); filter: var(--logo-filter); }
.login-card h1 { margin-bottom: var(--space-1); }
.login-card .sub { color: var(--ink-3); margin: 0 0 var(--space-5); font-size: var(--text-sm); }
.login-card__hint { margin: var(--space-5) 0 0; }

/* ---- utilities --------------------------------------------------------- */
.u-muted { color: var(--ink-3); }
.u-mono { font-weight: var(--weight-medium); font-size: var(--text-sm); overflow-wrap: anywhere; }
.u-num { font-variant-numeric: tabular-nums; }
.u-right { text-align: right; }
.u-center { text-align: center; }
.u-nowrap { white-space: nowrap; }
.u-small { font-size: var(--text-sm); }
.count-hero { font-size: var(--text-2xl); font-weight: var(--weight-bold); line-height: 1; font-variant-numeric: tabular-nums; }

/* ---- prose (rendered digest markdown) ---------------------------------- */
.prose { overflow-wrap: anywhere; }
.prose h2 { font-size: var(--text-lg); margin: var(--space-5) 0 var(--space-2); }
.prose h3 { font-size: var(--text-md); margin: var(--space-4) 0 var(--space-2); }
.prose p { margin: 0 0 var(--space-3); }
.prose ul { margin: 0 0 var(--space-3); padding-left: var(--space-5); }
.prose li { margin-bottom: var(--space-1); }
.prose strong { font-weight: var(--weight-bold); }
.prose > :first-child { margin-top: 0; }
.prose hr { margin: var(--space-4) 0; border: 0; border-top: var(--stroke) solid var(--line); }

/* ---- progressive disclosure ----------------------------------------------
   Detail that matters when you go looking but is noise at a glance: run ids,
   raw payloads, score arithmetic. */
.disclosure { margin-top: var(--space-2); }
.disclosure > summary {
  cursor: pointer; font-size: var(--text-xs); color: var(--ink-2); font-weight: var(--weight-medium);
  list-style: none; display: inline-flex; align-items: center; gap: var(--space-1);
  padding: 3px 10px; border: var(--stroke) solid var(--line-input);
  border-radius: var(--radius-md); background: var(--paper); user-select: none;
}
.disclosure > summary:hover { color: var(--ink); border-color: var(--line-strong); }
.disclosure > summary::-webkit-details-marker { display: none; }
.disclosure > summary::after { content: ""; width: 12px; height: 12px; background: currentColor;
  -webkit-mask: url("/assets/icons/chevron-down.svg") center / contain no-repeat; mask: url("/assets/icons/chevron-down.svg") center / contain no-repeat; }
.disclosure[open] > summary::after { transform: rotate(180deg); }
.disclosure__body {
  margin-top: var(--space-2); padding: var(--space-3);
  background: var(--paper-2); border: var(--stroke) solid var(--line); border-radius: var(--radius-md);
  font-size: var(--text-xs); overflow-wrap: anywhere;
}
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px var(--space-4); margin: 0; }
.kv dt { color: var(--ink-3); white-space: nowrap; }
.kv dd { margin: 0; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }

/* A run's headline numbers, readable at a glance without reading JSON. */
.run-line { display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-3); align-items: baseline; }
.run-stat { font-size: var(--text-sm); white-space: nowrap; }
.run-stat strong { font-variant-numeric: tabular-nums; }
.htmx-request .htmx-indicator { display: inline; }
.htmx-indicator { display: none; }

/* ---- template editor + message preview ---------------------------------
   The preview is an iframe so message CSS and portal CSS can never contaminate
   each other: what the editor shows is what a mail client would lay out. */
.inline-form { display: inline; }

.preview__head { display: flex; justify-content: space-between; align-items: flex-start;
  gap: var(--space-3); margin-bottom: var(--space-3); flex-wrap: wrap; }
.preview__subject { padding: var(--space-2) var(--space-3); background: var(--paper-2);
  border: var(--stroke) solid var(--line); border-radius: var(--radius-md); margin-bottom: var(--space-3); }
.preview__stage { background: var(--paper-3); border-radius: var(--radius-lg);
  padding: var(--space-4); display: flex; justify-content: center; overflow-x: auto; }
.preview__frame { width: 100%; max-width: 640px; height: 420px; border: var(--stroke) solid var(--line);
  border-radius: var(--radius-md); background: var(--paper); box-shadow: var(--shadow-card); }
.preview__stage--phone .preview__frame { width: 390px; max-width: 390px; flex: 0 0 390px; }
.preview__meta { margin-top: var(--space-3); }

/* ---- chips and checks --------------------------------------------------- */
.chip-row, .check-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: var(--space-2); }
.chip { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: var(--radius-pill);
  background: var(--paper); border: var(--stroke) solid var(--line-input); color: var(--ink-2);
  font-size: var(--text-xs); font-weight: var(--weight-medium); white-space: nowrap; }
.chip--ok  { background: var(--state-ok-soft);    border-color: transparent; color: var(--state-ok); }
.chip--bad { background: var(--state-error-soft); border-color: transparent; color: var(--state-error); }
.chip--on  { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }

.check-list { display: grid; gap: var(--space-2); margin-top: var(--space-3); }
.check { display: flex; gap: var(--space-2); align-items: flex-start; font-size: var(--text-sm); }
.check__mark { flex: 0 0 18px; height: 18px; line-height: 18px; text-align: center;
  border-radius: var(--radius-pill); font-size: var(--text-xs); font-weight: var(--weight-bold); }
.check--ok  .check__mark { background: var(--state-ok-soft);    color: var(--state-ok); }
.check--bad .check__mark { background: var(--state-error-soft); color: var(--state-error); }

.numbered { padding-left: var(--space-5); margin: 0; }
.numbered li { margin-bottom: var(--space-2); }

/* ---- ad creative previews ----------------------------------------------
   The iframe is the asset at its real pixel size; the wrapper crops it and a
   scale transform fits it on screen. Nothing here resizes the asset itself. */
.ad-row { display: flex; flex-wrap: wrap; gap: var(--space-5); align-items: flex-start;
  margin: var(--space-3) 0; }
.ad-card { display: flex; flex-direction: column; gap: var(--space-1); }
.ad-preview { overflow: hidden; border-radius: var(--radius-lg);
  border: var(--stroke) solid var(--line); background: var(--paper-3); }
.ad-preview__frame { border: 0; transform-origin: top left; display: block; }
/* Every format sizes itself from three token variables set on the element: --w and --h (the
   asset's real pixels) and --s (the preview scale). The frame stays at the real size and is scaled. */
.ad-preview { width: calc(var(--w) * var(--s) * 1px); height: calc(var(--h) * var(--s) * 1px); max-width: 100%; }
.ad-preview .ad-preview__frame { width: calc(var(--w) * 1px); height: calc(var(--h) * 1px); transform: scale(var(--s)); }

.u-h2 { font-size: var(--text-lg); margin: var(--space-3) 0 var(--space-1); }

/* ---- disclosure card + explanatory blocks ------------------------------- */
.disclosure-card { padding: 0; margin-bottom: var(--space-4); }
.disclosure-card__summary { display: flex; justify-content: flex-start; align-items: center;
  gap: var(--space-3); flex-wrap: wrap; padding: 14px var(--space-5); cursor: pointer; list-style: none; }
.disclosure-card__summary > :last-child { margin-left: auto; text-align: right; }
.disclosure-card__summary::-webkit-details-marker { display: none; }
.disclosure-card__summary::before { content: ""; width: 16px; height: 16px; flex: none; background: var(--ink-3);
  -webkit-mask: url("/assets/icons/chevron-right.svg") center / contain no-repeat; mask: url("/assets/icons/chevron-right.svg") center / contain no-repeat;
  transition: transform .15s ease; }
.disclosure-card[open] .disclosure-card__summary::before { transform: rotate(90deg); }
.disclosure-card__body { padding: var(--space-4) var(--space-5) var(--space-5); border-top: var(--stroke) solid var(--line); }

.tier-note h4 { font-size: var(--text-md); margin: var(--space-2) 0 var(--space-1); }
.tier-note p { font-size: var(--text-sm); color: var(--ink-2); margin: 0 0 var(--space-2); }

/* Tier picker — the primary discovery control. */
.tier-pick { display: flex; gap: var(--space-3); align-items: flex-start; padding: var(--space-3) var(--space-4);
  border: var(--stroke) solid var(--line); border-radius: var(--radius-lg); margin-bottom: var(--space-2);
  cursor: pointer; background: var(--paper); }
.tier-pick:hover { background: var(--paper-2); }
.tier-pick:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.tier-pick input { margin-top: 3px; }
.tier-pick strong { margin-left: var(--space-1); }

/* Grouped checkbox picker (discovery industries). */
.picker-group { margin-bottom: var(--space-3); }
.picker-group__head { font-size: var(--text-2xs); letter-spacing: var(--tracking-caps); text-transform: uppercase;
  color: var(--ink-2); font-weight: var(--weight-bold); margin-bottom: var(--space-2); }
.picker-group__items { display: grid; grid-template-columns: 1fr 1fr; gap: 6px var(--space-3); }

/* ---- workflow diagram ---------------------------------------------------
   Inline SVG so it needs no library and scales with the page. Colours come
   from tokens via currentColor and CSS fills, never hardcoded in the markup. */
/* Below ~720px the diagram would shrink to illegibility, so it scrolls instead. */
.flow-scroll { overflow-x: auto; }
.flow { width: 100%; min-width: 720px; height: auto; display: block; }
.flow__box { fill: var(--paper); stroke: var(--line-input); stroke-width: 1; }
.flow__step--accent .flow__box { fill: var(--brand-soft); stroke: var(--brand); }
.flow__step--muted .flow__box { fill: var(--paper-2); stroke-dasharray: 4 3; }
.flow__num { fill: var(--ink-3); font-size: 12px; font-weight: 600; font-family: var(--font-sans); }
.flow__title { fill: var(--ink); font-size: 15px; font-weight: 600; font-family: var(--font-sans); }
.flow__sub { fill: var(--ink-2); font-size: 12px; font-family: var(--font-sans); }
.flow__caption { fill: var(--ink-3); font-size: 12px; font-weight: 600; font-family: var(--font-sans); }
.flow__link { stroke: var(--line-strong); stroke-width: 2; }
.flow__arrowhead { fill: var(--line-strong); }

@media (max-width: 900px) {
  .grid--2, .grid--3, .grid--4 { grid-template-columns: 1fr; }
  .picker-group__items { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .page { padding: var(--space-5) var(--space-4) var(--space-6); }
}

/* ---- outreach board ---------------------------------------------------- */
/* Stages are full-width rows inside labelled bands, not a grid of equal tiles. The old grid gave a
   follow-up that needs working today the same weight as an empty stage, which is exactly the
   distinction a board exists to make. */
.band { margin-bottom: var(--space-6); }
.band__head { display: grid; grid-template-columns: auto auto 1fr; align-items: baseline;
  gap: var(--space-3); padding-bottom: var(--space-2); margin-bottom: var(--space-3); }
.band__title { font-size: var(--text-lg); font-weight: var(--weight-bold); margin: 0; }
.band__total { font-size: var(--text-2xs); font-weight: var(--weight-bold); color: var(--ink-2); background: var(--paper-3);
  border-radius: var(--radius-pill); padding: 0 8px; line-height: 18px; font-variant-numeric: tabular-nums; }
.band__note { grid-column: 1 / -1; margin: 0; font-size: var(--text-sm); color: var(--ink-3); }
.band__stages { display: grid; gap: var(--space-3); }

.stage-row { display: grid; grid-template-columns: 72px 1fr auto; align-items: center;
  gap: var(--space-4); padding: var(--space-4) var(--space-5);
  background: var(--paper); border: var(--stroke) solid var(--line);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-card); }
.stage-row--followup { box-shadow: var(--shadow-card), inset 3px 0 0 var(--state-warn); }
/* Empty is shown by form (a dashed outline), not by fading the text below legibility. The warn edge
   of a follow-up only appears when there is work waiting in it. */
.stage-row--empty { background: transparent; border: var(--stroke) dashed var(--line-input); box-shadow: none; }
.stage-row--followup.stage-row--empty { box-shadow: none; }
.stage-row--empty .stage-row__count, .stage-row--empty .stage-row__blurb { color: var(--ink-3); }
.stage-row__count { font-size: var(--text-2xl); font-weight: var(--weight-bold); line-height: 1; text-align: center; font-variant-numeric: tabular-nums; }
.stage-row__label { font-weight: var(--weight-bold); }
.stage-row__blurb { margin: 2px 0 0; font-size: var(--text-sm); color: var(--ink-3); }
.stage-row__action { margin: var(--space-1) 0 0; font-size: var(--text-sm); color: var(--ink-2); }
.stage-row__go { white-space: nowrap; }

@media (max-width: 640px) {
  .stage-row { grid-template-columns: 56px 1fr; }
  .stage-row__go { grid-column: 2; justify-self: start; }
}

.stage-nav { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: var(--space-4); }
.stage-nav .chip { text-decoration: none; }
.stage-nav .chip:hover { border-color: var(--line-strong); color: var(--ink); }

.engagement { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2);
  margin-top: var(--space-2); }

.steps { margin: 0; padding-left: var(--space-5); display: grid; gap: var(--space-2); }
.steps li { font-size: var(--text-sm); }

/* ---- review and send --------------------------------------------------- */
.send-bar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap;
  gap: var(--space-4); padding: var(--space-4) var(--space-5); margin-bottom: var(--space-4);
  background: var(--paper); border: var(--stroke) solid var(--line);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-card); }
.card .send-bar { margin: var(--space-4) 0 0; box-shadow: none; background: var(--paper-2); }
.send-bar__n { font-size: var(--text-xl); font-weight: var(--weight-bold); margin-right: var(--space-1); font-variant-numeric: tabular-nums; }
.send-bar__counts { display: grid; gap: 2px; }
.sending { margin-left: var(--space-3); color: var(--ink-3); font-size: var(--text-sm); }

.spinner { display: inline-block; width: 14px; height: 14px; vertical-align: -2px;
  border: 2px solid var(--line-input); border-top-color: var(--brand); border-radius: 50%;
  animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
/* Respect a reduced-motion preference: the label still says what is happening. */
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } }

.sent-result { display: flex; align-items: flex-start; gap: var(--space-4);
  padding: var(--space-5); margin-bottom: var(--space-4);
  background: var(--state-ok-soft); border: var(--stroke) solid color-mix(in srgb, var(--state-ok) 25%, transparent);
  border-radius: var(--radius-lg); }
.sent-result__mark { flex: none; width: 36px; height: 36px; border-radius: var(--radius-pill);
  background: var(--state-ok); color: var(--state-ink); font-size: 18px; font-weight: var(--weight-bold);
  display: flex; align-items: center; justify-content: center; }
.sent-result__headline { font-size: var(--text-lg); font-weight: var(--weight-bold);
  color: var(--ink); margin-bottom: var(--space-1); }
.sent-result .flex { display: flex; gap: var(--space-2); margin-top: var(--space-3); flex-wrap: wrap; }

.msg--blocked { border-style: dashed; color: var(--ink-3); }

/* ---- inline review ----------------------------------------------------- */
/* Approve/reject live in the table so a queue can be worked without opening every record. The
   buttons wrap rather than forcing the column wider — this table already carries a lot. */
.review-cell { display: flex; flex-wrap: wrap; gap: var(--space-1); justify-content: center; }
.review-cell__no:hover { border-color: var(--state-error); color: var(--state-error); }
.send-bar__go { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; }

/* ---- back link ---------------------------------------------------------
   Drawn by layout.njk on every page below the dashboard, to the page you came from. */
.backlink {
  /* Inline, not flex: a flex gap added itself to the literal space and read "Back to  Review". */
  display: inline-block;
  margin-bottom: var(--space-3);
  color: var(--ink-3);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  text-decoration: none;
}
.backlink:hover { color: var(--link); text-decoration: none; }
/* overflow:hidden puts an inline-block's baseline at its bottom edge; without it the hidden arrow
   glyph's empty line box set the baseline at the top and the chevron hung a line below the text. */
.backlink__arrow { display: inline-block; width: 14px; height: 14px; vertical-align: -2px; font-size: 0; overflow: hidden;
  margin-right: 2px; background: currentColor;
  -webkit-mask: url("/assets/icons/chevron-left.svg") center / contain no-repeat; mask: url("/assets/icons/chevron-left.svg") center / contain no-repeat; }

/* ---- theme switcher ----------------------------------------------------
   Lives in the header (layout.njk). Each swatch previews its own theme: accent over ground. */
.themebar { display: flex; align-items: center; gap: 6px; margin-right: var(--space-1); }
.themebar__label { color: var(--bar-ink-2); font-size: var(--text-sm); margin-right: 2px; }
.themebar__swatch {
  width: 18px; height: 18px; padding: 0;
  border: 1px solid var(--line-input); border-radius: var(--radius-pill);
  cursor: pointer;
  background: linear-gradient(135deg, var(--swatch-brand) 50%, var(--swatch-paper) 50%);
}
.themebar__swatch:hover { border-color: var(--bar-ink-2); }
.themebar__swatch--on { outline: 2px solid var(--brand); outline-offset: 2px; }
/* Literal hexes on purpose: each swatch previews ANOTHER theme — its accent and its ground. */
.themebar__swatch--light  { --swatch-brand: #065EB3; --swatch-paper: #F8F9FA; }
.themebar__swatch--dark   { --swatch-brand: #7FB2F0; --swatch-paper: #0A1330; }
.themebar__swatch--steel  { --swatch-brand: #2E3640; --swatch-paper: #F5F6F7; }
.themebar__swatch--copper { --swatch-brand: #8A4A1F; --swatch-paper: #FAF8F6; }

.u-visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---- dashboard customiser ---------------------------------------------- */
.customise__group { margin-bottom: var(--space-4); }
.customise__group h4 { margin: 0 0 var(--space-2); font-size: var(--text-2xs); letter-spacing: var(--tracking-caps);
  text-transform: uppercase; color: var(--ink-2); font-weight: var(--weight-bold); }
.customise__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: var(--space-2); }
.customise__item { display: flex; align-items: center; gap: var(--space-2); font-size: var(--text-sm);
  padding: 8px 10px; border: var(--stroke) solid var(--line); border-radius: var(--radius-md); background: var(--paper); cursor: pointer; }
.customise__item:hover { border-color: var(--line-input); }
.customise__item:has(input:checked) { border-color: color-mix(in srgb, var(--brand) 40%, transparent); background: var(--brand-soft); }
.customise__name { flex: 1; }

/* ---- ad gallery --------------------------------------------------------
   Images are referenced from the live catalogue CDN, never copied, so a tile
   shows whatever is current. Tiles are fluid so the grid reflows on a phone. */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: var(--space-4); }
.gallery__item { margin: 0; background: var(--paper); border: var(--stroke) solid var(--line);
  border-radius: var(--radius-lg); overflow: hidden; display: flex; flex-direction: column; box-shadow: var(--shadow-card); }
.gallery__item:hover { border-color: var(--line-input); }
.gallery__img { width: 100%; aspect-ratio: 1 / 1; object-fit: contain; display: block; background: var(--paper-3); }
.gallery__img--placeholder { display: flex; align-items: center; justify-content: center;
  color: var(--ink-3); font-size: var(--text-sm); }
.gallery__cap { padding: var(--space-3); display: grid; gap: var(--space-2); }
.gallery__title { font-size: var(--text-sm); font-weight: var(--weight-bold); line-height: 1.35;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; }

.u-inline { display: inline; }
.u-mt { margin-top: var(--space-4); }

/* Short label columns opt out of `overflow-wrap: anywhere`, which table.data sets so that long
   URLs and addresses cannot blow a column out. Applied to a word like "Universities" it breaks
   mid-word instead, which reads as a rendering fault. These columns wrap between words or not at
   all, and carry enough width for the longest label they hold. */
table.data .col-trade { min-width: 132px; overflow-wrap: normal; word-break: keep-all; }
table.data .col-fleet { white-space: nowrap; overflow-wrap: normal; }

/* A registered-fleet figure: pickups are the number that matters, the total is context. */
.fleet-figures { display: flex; gap: var(--space-6); flex-wrap: wrap; margin-bottom: var(--space-3); }
.fleet-figures__n { font-size: var(--text-2xl); font-weight: 600; line-height: 1.1; font-variant-numeric: tabular-nums; }
.fleet-figures__label { color: var(--ink-3); font-size: var(--text-sm); }

/* A title with its status badge beside it, as on the campaign page. */
.title-row { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; }

/* An ad platform: its mark in the platform's own colour, and its name. */
.platform { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px 2px 6px; margin: 2px 4px 2px 0;
  border: var(--stroke) solid var(--line); border-radius: var(--radius-pill); background: var(--paper);
  font-size: var(--text-xs); font-weight: var(--weight-medium); color: var(--ink-2); white-space: nowrap; vertical-align: middle; }
.platform__mark { width: 14px; height: 14px; flex: none; }
.platform--meta .platform__mark { color: var(--platform-meta); }
.platform--google .platform__mark { color: var(--platform-google); }
.platform--tiktok .platform__mark { color: var(--platform-tiktok); }
.platform--linkedin .platform__mark { color: var(--platform-linkedin); }
.platform-row { display: flex; flex-wrap: wrap; }

/* Four creative thumbnails on the campaign overview. */
.thumb-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-2); }
.thumb-grid__img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; border-radius: var(--radius-md);
  border: var(--stroke) solid var(--line); background: var(--paper-3); display: flex; }

/* The last tile of a creative grid: a dashed "add" target, as in the reference. */
.gallery__add { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  min-height: 240px; padding: var(--space-4); text-align: center; border: 1.5px dashed var(--line-input);
  border-radius: var(--radius-lg); color: var(--ink); font-weight: var(--weight-medium); background: var(--paper); }
.gallery__add:hover { border-color: var(--brand); color: var(--brand); text-decoration: none; background: var(--brand-soft); }
.gallery__add-icon { width: 32px; height: 32px; padding: 6px; border-radius: var(--radius-md);
  border: var(--stroke) solid var(--line-input); color: var(--brand); background: var(--paper); }

/* ---- compose: a form on the left, what it will look like on the right ------
   The publish screen (and the new-campaign screen) follow the reference's "create post" layout. */
.compose { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 440px); gap: var(--space-5); align-items: start; }
.compose__main { display: grid; gap: var(--space-4); min-width: 0; }
.compose__aside { position: sticky; top: calc(var(--header-h) + var(--space-4)); min-width: 0; }
@media (max-width: 1000px) {
  .compose { grid-template-columns: 1fr; }
  .compose__aside { position: static; }
}

/* Creative as small tiles, ending in a dashed "add" tile. */
.tile-row { display: flex; flex-wrap: wrap; gap: var(--space-3); }
.tile { margin: 0; width: 112px; display: grid; gap: 6px; }
.tile__img { width: 112px; height: 112px; object-fit: cover; border-radius: var(--radius-lg);
  border: var(--stroke) solid var(--line); background: var(--paper-3); display: flex; }
.tile__cap { font-size: var(--text-2xs); color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile--add { height: 112px; align-self: start; display: flex; align-items: center; justify-content: center;
  border: 1.5px dashed var(--line-input); border-radius: var(--radius-lg); background: var(--paper); }
.tile--add:hover { border-color: var(--brand); background: var(--brand-soft); }

/* Platforms to publish to: one row each, with the platform's mark. */
.platform-picks { display: grid; gap: var(--space-2); }
.platform-pick { display: flex; align-items: center; gap: var(--space-3); padding: 10px var(--space-3);
  border: var(--stroke) solid var(--line); border-radius: var(--radius-md); cursor: pointer; font-size: var(--text-md); }
.platform-pick:hover { border-color: var(--line-input); }
.platform-pick:has(input:checked) { border-color: color-mix(in srgb, var(--brand) 45%, transparent); background: var(--brand-soft); }
.platform-pick__mark { width: 20px; height: 20px; }
.platform-pick .cell-sub { display: block; }

/* ---- network preview ------------------------------------------------------
   Radio buttons (visually hidden, still keyboard-operable) choose which feed card shows. */
.netpreview__note { margin-bottom: var(--space-4); }
.netpreview__tabs { display: flex; gap: var(--space-4); border-bottom: var(--stroke) solid var(--line); margin-bottom: var(--space-4); overflow-x: auto; }
.netpreview__tab { padding: 8px 2px; margin-bottom: -1px; border-bottom: 2px solid transparent; color: var(--ink-2);
  font-size: var(--text-sm); font-weight: var(--weight-medium); cursor: pointer; white-space: nowrap; }
.netpreview__tab:hover { color: var(--ink); }
#np-facebook:checked ~ .netpreview__tabs [for="np-facebook"], #np-instagram:checked ~ .netpreview__tabs [for="np-instagram"],
#np-linkedin:checked ~ .netpreview__tabs [for="np-linkedin"], #np-google:checked ~ .netpreview__tabs [for="np-google"],
#np-tiktok:checked ~ .netpreview__tabs [for="np-tiktok"] { color: var(--brand); border-bottom-color: var(--brand); font-weight: var(--weight-bold); }
#np-facebook:focus-visible ~ .netpreview__tabs [for="np-facebook"], #np-instagram:focus-visible ~ .netpreview__tabs [for="np-instagram"],
#np-linkedin:focus-visible ~ .netpreview__tabs [for="np-linkedin"], #np-google:focus-visible ~ .netpreview__tabs [for="np-google"],
#np-tiktok:focus-visible ~ .netpreview__tabs [for="np-tiktok"] { outline: 2px solid var(--focus); outline-offset: 2px; }
.feedcard { display: none; }
#np-facebook:checked ~ .netpreview__cards .feedcard--facebook, #np-instagram:checked ~ .netpreview__cards .feedcard--instagram,
#np-linkedin:checked ~ .netpreview__cards .feedcard--linkedin, #np-google:checked ~ .netpreview__cards .feedcard--google,
#np-tiktok:checked ~ .netpreview__cards .feedcard--tiktok { display: block; }

/* A feed post. It follows the theme, as each network's own light and dark modes do. */
.feedcard { background: var(--paper); border: var(--stroke) solid var(--line); border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md); overflow: hidden; font-size: var(--text-sm); color: var(--ink); }
.feedcard__head { display: flex; align-items: center; gap: var(--space-2); padding: var(--space-3); }
.feedcard__avatar { width: 36px; height: 36px; border-radius: var(--radius-pill); flex: none; display: inline-flex;
  align-items: center; justify-content: center; background: var(--brand); color: var(--brand-ink); font-weight: var(--weight-bold); }
.feedcard__who { flex: 1; min-width: 0; }
.feedcard__name { font-weight: var(--weight-bold); line-height: 1.2; }
.feedcard__meta { color: var(--ink-3); font-size: var(--text-xs); display: flex; align-items: center; gap: 4px; }
.feedcard__globe { width: 12px; height: 12px; }
.feedcard__more { width: 18px; height: 18px; color: var(--ink-3); }
.feedcard__text { margin: 0; padding: 0 var(--space-3) var(--space-3); line-height: 1.45; }
.feedcard__img { display: block; width: 100%; aspect-ratio: 1 / 1; object-fit: cover; background: var(--paper-3); }
.feedcard__link { display: flex; align-items: center; gap: var(--space-3); padding: 10px var(--space-3);
  background: var(--paper-2); border-bottom: var(--stroke) solid var(--line); }
.feedcard__linktext { flex: 1; min-width: 0; }
.feedcard__host { font-size: var(--text-2xs); color: var(--ink-3); text-transform: uppercase; letter-spacing: var(--tracking-caps); }
.feedcard__headline { font-weight: var(--weight-bold); line-height: 1.3; display: -webkit-box; -webkit-box-orient: vertical;
  -webkit-line-clamp: 2; overflow: hidden; }
.feedcard__price { font-size: var(--text-xs); color: var(--ink-2); margin-top: 2px; }
.feedcard__cta { flex: none; padding: 6px 12px; border-radius: var(--radius-md); background: var(--paper-3);
  font-size: var(--text-xs); font-weight: var(--weight-bold); white-space: nowrap; }
.feedcard__actions { display: flex; justify-content: space-around; padding: 8px var(--space-3); color: var(--ink-2); font-size: var(--text-xs); font-weight: var(--weight-medium); }
.feedcard__actions span { display: inline-flex; align-items: center; gap: 6px; }
.feedcard__actions .nav__icon { width: 16px; height: 16px; }
/* Per network: Instagram and TikTok put the call to action in a bar, Google shows a wide display
   ad with no social actions, and TikTok is a tall vertical frame. */
.feedcard--instagram .feedcard__cta, .feedcard--tiktok .feedcard__cta { background: var(--brand); color: var(--brand-ink); }
.feedcard--google .feedcard__img { aspect-ratio: 1.91 / 1; }
.feedcard--google .feedcard__actions { display: none; }
.feedcard--tiktok .feedcard__img { aspect-ratio: 9 / 16; max-height: 420px; }
.feedcard--linkedin .feedcard__cta { border: var(--stroke) solid var(--brand); background: transparent; color: var(--brand); border-radius: var(--radius-pill); }

/* Creative thumbnails on the campaign list. A campaign is recognised by its pictures. */
.thumbs { display: inline-flex; align-items: center; gap: 0; text-decoration: none; }
.thumbs__img { width: 34px; height: 34px; object-fit: cover; border-radius: var(--radius-md);
  border: 2px solid var(--paper); background: var(--paper-3); box-shadow: 0 0 0 1px var(--line); }
.thumbs__img + .thumbs__img { margin-left: -8px; }
.thumbs__more { font-size: var(--text-xs); color: var(--ink-3); margin-left: var(--space-2); }

/* ---- discovery run progress --------------------------------------------- */
.run-progress { display: grid; gap: var(--space-3); padding: var(--space-5); margin-bottom: var(--space-4);
  background: var(--paper); border: var(--stroke) solid var(--line); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card), inset 3px 0 0 var(--brand); }
.run-progress--done { box-shadow: var(--shadow-card), inset 3px 0 0 var(--state-ok); }
.run-progress--failed { box-shadow: var(--shadow-card), inset 3px 0 0 var(--state-error); background: var(--state-error-soft); }
.run-progress__status { font-size: var(--text-md); }
.run-progress__warning { font-size: var(--text-sm); color: var(--state-warn); }
.meter { width: 100%; height: 6px; appearance: none; border: 0; border-radius: var(--radius-pill);
  background: var(--paper-3); overflow: hidden; accent-color: var(--brand); }
/* Separate rules per engine: a browser drops a whole rule that names a pseudo-element it does not know. */
.meter::-webkit-progress-bar { background: var(--paper-3); border-radius: var(--radius-pill); }
.meter::-webkit-progress-value { background: var(--brand); border-radius: var(--radius-pill); transition: width .4s ease; }
.meter::-moz-progress-bar { background: var(--brand); border-radius: var(--radius-pill); }
/* While OpenStreetMap is being asked, the total is unknown: a slow diagonal crawl, the only motion
   in the app. (With appearance:none, WebKit and Blink draw no native indeterminate state at all.) */
.meter:indeterminate { background-color: var(--paper-3);
  background-image: repeating-linear-gradient(135deg, var(--brand) 0 6px, transparent 6px 12px);
  background-size: 16.97px 16.97px; animation: meter-crawl .8s linear infinite; }
.meter:indeterminate::-webkit-progress-bar { background: transparent; }
.meter:indeterminate::-moz-progress-bar { background: transparent; }
@keyframes meter-crawl { to { background-position: 16.97px 0; } }
@media (prefers-reduced-motion: reduce) { .meter:indeterminate { animation: none; } }
.run-added { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.run-added li { display: flex; align-items: baseline; gap: var(--space-2); flex-wrap: wrap; font-size: var(--text-sm);
  padding: 8px 0; border-bottom: var(--stroke) solid var(--line); }
.run-added__score { margin-left: auto; color: var(--ink-3); font-variant-numeric: tabular-nums; }

/* ---- review decision on a prospect -------------------------------------- */
.review-bar { display: flex; align-items: center; gap: var(--space-4); flex-wrap: wrap;
  padding: var(--space-4) var(--space-5); margin-bottom: var(--space-4);
  border: var(--stroke) solid var(--line); border-radius: var(--radius-lg); background: var(--paper);
  box-shadow: var(--shadow-card), inset 3px 0 0 var(--brand); }
.review-bar--approved { background: var(--state-ok-soft); border-color: color-mix(in srgb, var(--state-ok) 25%, transparent);
  box-shadow: inset 3px 0 0 var(--state-ok); }
.review-bar--rejected { background: var(--paper-2); box-shadow: inset 3px 0 0 var(--state-muted); }
.review-bar__text { flex: 1 1 280px; }
.review-bar__actions { display: flex; gap: var(--space-2); flex-wrap: wrap; }
.review-bar__next { font-size: var(--text-sm); margin-left: auto; }
/* A decision still waiting stays in reach while the evidence below is read. */
@media (min-width: 900px) {
  .review-bar--pending { position: sticky; top: calc(var(--header-h) + var(--space-2)); z-index: 18;
    box-shadow: var(--shadow-md), inset 3px 0 0 var(--brand); }
}
/* A secondary destructive action: outlined, so it never competes with the primary one. */
.btn--ghost.btn--danger { background: var(--paper); color: var(--state-error); border-color: color-mix(in srgb, var(--state-error) 45%, transparent); }
.btn--ghost.btn--danger:hover { background: var(--state-error-soft); color: var(--state-error); filter: none; }

/* A form mid-submit: the pressed button shows the busy label; nothing is clickable twice. */
form.is-busy [type="submit"] { opacity: .7; cursor: progress; }

/* ---- the header at narrower widths ----------------------------------------
   Everything fits one row from ~1772px (measured with the Media item, 2026-09-22). Down to 1440px
   the account email and button words give way to their icons and the nav tightens, so it stays one
   row on a 1440px laptop (1407px needed, room for a scrollbar); below 1440px the navigation takes a second
   row of its own (still inside the sticky header) instead of being scrolled out of sight — and
   row one then has room for the words again. */
@media (max-width: 1799px) {
  .topbar__email, .themebar__label, .topbar__signout-label { display: none; }
  .nav { gap: 0; }
  .nav__link { padding: 0 5px; }
}
@media (max-width: 1439px) {
  :root { --header-h: 106px; }
  .topbar { row-gap: 0; padding-top: 10px; }
  .nav { order: 10; flex: 1 0 100%; gap: 2px; margin: 10px calc(-1 * var(--space-5)) 0; padding: 6px var(--space-5);
    border-top: var(--stroke) solid var(--bar-line); }
  .nav__link { padding: 0 10px; }
  .topbar__email, .topbar__signout-label { display: inline; }
}
@media (max-width: 900px) {
  .topbar { position: static; }
  .topbar__email, .topbar__signout-label { display: none; }
  .review-bar--pending { position: static; }
}
@media (max-width: 640px) {
  .topbar { padding: 10px var(--space-4) 0; gap: var(--space-2); }
  .nav { margin: 10px calc(-1 * var(--space-4)) 0; padding: 6px var(--space-4); }
  .topbar__product, .topbar__icon-btn { display: none; }
  .topbar__brand { padding-right: 0; margin-right: 0; border-right: 0; }
  .topbar__logo { height: 20px; }
  .topbar__user { padding-left: 0; border-left: 0; }
  .themebar { gap: 4px; margin-right: 0; }
}

/* ---- forced colours: keep the current section and state visible when the OS repaints everything ---- */
@media (forced-colors: active) {
  .nav__link--active, .tabs__tab--active { outline: 2px solid CanvasText; outline-offset: -2px; }
  .kpi__delta--up::before, .kpi__delta--down::before, .delta::before, .callout::before,
  .backlink__arrow, .disclosure > summary::after, .disclosure-card__summary::before { forced-color-adjust: none; background: CanvasText; }
  .meter:indeterminate { forced-color-adjust: none; background-image: none; background-color: Highlight; }
  .pill { border: 1px solid CanvasText; }
}

/* ---- status tray: long jobs, in the corner of every page ----
   Fixed bottom-right above the page, so it follows every screen while a prospect search or a
   competitor scan runs. Empty, it takes no space and catches no clicks. On a phone it spans the
   bottom edge instead. */
.jobs-tray {
  position: fixed; right: var(--space-5); bottom: calc(var(--space-5) + env(safe-area-inset-bottom, 0px));
  z-index: 50; display: flex; flex-direction: column; gap: var(--space-2);
  width: min(340px, calc(100vw - 2 * var(--space-4))); pointer-events: none;
}
.jobs-tray:empty { display: none; }
.jobs-tray__job {
  pointer-events: auto; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md); padding: var(--space-3) var(--space-4); border-left: 3px solid var(--brand);
}
.jobs-tray__job--ok { border-left-color: var(--state-ok); }
.jobs-tray__job--error { border-left-color: var(--state-error); }
.jobs-tray__head { display: flex; align-items: center; gap: var(--space-2); }
.jobs-tray__icon { display: inline-flex; color: var(--brand); }
.jobs-tray__job--ok .jobs-tray__icon { color: var(--state-ok); }
.jobs-tray__job--error .jobs-tray__icon { color: var(--state-error); }
.jobs-tray__title { flex: 1 1 auto; font-weight: 600; color: var(--ink); text-decoration: none; }
.jobs-tray__title:hover { text-decoration: underline; }
.jobs-tray__close { border: 0; background: none; padding: 2px; color: var(--ink-3); cursor: pointer; border-radius: var(--radius-sm); display: inline-flex; }
.jobs-tray__close:hover { color: var(--ink); background: var(--paper-2); }
.jobs-tray__detail { color: var(--ink-2); font-size: var(--text-sm); margin: 2px 0 0 calc(18px + var(--space-2)); }
.jobs-tray .meter { margin-top: var(--space-2); }
.meter--thin { height: 4px; }
@media (max-width: 640px) {
  .jobs-tray { left: var(--space-4); right: var(--space-4); bottom: calc(var(--space-4) + env(safe-area-inset-bottom, 0px)); width: auto; }
}
@media print { .jobs-tray { display: none; } }

/* ---- media bank ----
   A picture tile: square frame, title, the custom tags it carries. The same tile is a link in the
   library and a selectable card (checkbox or radio inside) in the campaign picker and the Studio.
   Selection shows as a brand ring and a tick; the input itself stays in the tab order. */
.btn__icon { width: 16px; height: 16px; margin-right: 6px; vertical-align: -3px; flex: none; }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: var(--space-3); }
.media-grid--compact { grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); }
.media-tile { position: relative; display: flex; flex-direction: column; background: var(--paper);
  border: var(--stroke) solid var(--line); border-radius: var(--radius-lg); overflow: hidden;
  color: inherit; text-decoration: none; transition: border-color .12s ease, box-shadow .12s ease; }
a.media-tile:hover, .media-tile--pick:hover { border-color: var(--line-strong); box-shadow: var(--shadow-sm); }
.media-tile__frame { display: block; aspect-ratio: 1 / 1; background: var(--paper-3); }
/* contain, not cover: a 1200x628 banner cropped to a square loses its words. */
.media-tile__img { width: 100%; height: 100%; object-fit: contain; display: block; }
.media-tile__cap { display: grid; gap: 4px; padding: var(--space-2) var(--space-3) var(--space-3); min-width: 0; }
.media-tile__title { font-size: var(--text-sm); font-weight: var(--weight-medium); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.media-tile__tags { display: flex; flex-wrap: wrap; gap: 4px; min-height: 0; }
.media-tile--pick { cursor: pointer; }
.media-tile__check { position: absolute; top: 8px; left: 8px; width: 20px; height: 20px; margin: 0; z-index: 1;
  accent-color: var(--brand); }
.media-tile--pick:has(.media-tile__check:checked) { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand); }
.media-tile--pick:has(.media-tile__check:focus-visible) { outline: 2px solid var(--brand); outline-offset: 2px; }
.media-tile[hidden] { display: none; }
.tag { display: inline-block; padding: 1px 7px; border-radius: var(--radius-pill); background: var(--paper-2);
  border: var(--stroke) solid var(--line); color: var(--ink-2); font-size: 11px; line-height: 16px; white-space: nowrap; }

.tag-filter { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0 0 var(--space-4); }
.tag-filter__label { font-size: var(--text-xs); color: var(--ink-3); margin-right: var(--space-1); }
a.chip, button.chip { text-decoration: none; cursor: pointer; }
a.chip:hover, button.chip:hover { border-color: var(--line-strong); color: var(--ink); }
.chip--on:hover { color: var(--brand-ink) !important; }
.chip__n { opacity: .7; margin-left: 4px; font-variant-numeric: tabular-nums; }
.chip--toggle { cursor: pointer; gap: 6px; }
.chip--toggle input { margin: 0; accent-color: var(--brand); }
.chip--toggle:has(input:checked) { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.chip--removable { gap: 6px; font-family: inherit; }
.chip--product { background: var(--paper-2); }
.chip__x { width: 12px; height: 12px; }

.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: var(--space-3); }
.product-card { display: grid; grid-template-rows: auto auto auto; gap: 4px; padding: var(--space-3); background: var(--paper);
  border: var(--stroke) solid var(--line); border-radius: var(--radius-lg); color: inherit; text-decoration: none; }
.product-card:hover { border-color: var(--line-strong); box-shadow: var(--shadow-sm); }
.product-card--on { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand); }
.product-card__img { width: 100%; aspect-ratio: 4 / 3; object-fit: contain; background: var(--paper-2); border-radius: var(--radius-md); display: block; }
.product-card__title { font-size: var(--text-sm); font-weight: var(--weight-medium); line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.product-card__meta { font-size: var(--text-xs); color: var(--ink-3); }
.product-head { display: flex; align-items: center; gap: var(--space-4); flex-wrap: wrap; margin-bottom: var(--space-4); }
.product-head__img { width: 72px; height: 72px; object-fit: contain; background: var(--paper-2); border-radius: var(--radius-md); }
.product-head__text { flex: 1 1 220px; min-width: 0; }

.media-view { padding: var(--space-3); display: flex; justify-content: center; background: var(--paper-2); }
.media-view__img { max-width: 100%; max-height: 70vh; object-fit: contain; border-radius: var(--radius-md); }

/* A Studio ad, drawn by its own document at 1080px and scaled into a square tile. */
/* app.js sets --adthumb-scale from the tile's width. */
.adthumb { position: relative; display: block; aspect-ratio: 1 / 1; overflow: hidden; background: var(--paper-3); }
.adthumb__frame { position: absolute; top: 0; left: 0; width: 1080px; height: 1080px; border: 0;
  transform-origin: 0 0; transform: scale(var(--adthumb-scale, .155)); pointer-events: none; }

/* A picker with a sticky action bar, so "Add selected" is in reach however far the grid scrolls. */
.pick-bar { position: sticky; bottom: calc(var(--space-3) + env(safe-area-inset-bottom, 0px)); z-index: 5; margin-top: var(--space-4);
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); flex-wrap: wrap;
  background: var(--paper); border: var(--stroke) solid var(--line); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md); padding: var(--space-3) var(--space-4); }
.media-tile--in .media-tile__frame, .media-tile--in .media-tile__cap { opacity: .6; }
.media-tile__badge { position: absolute; top: 8px; left: 8px; z-index: 2; padding: 2px 8px; border-radius: var(--radius-pill);
  background: var(--state-ok-soft); color: var(--ink); font-size: 11px; font-weight: var(--weight-bold); }
.media-grid--scroll { max-height: 440px; overflow-y: auto; padding: 2px; }
.media-tile__frame--none { display: flex; align-items: center; justify-content: center; text-align: center; padding: var(--space-3);
  color: var(--ink-3); font-size: var(--text-xs); background: var(--paper-2); }
.toolbar--tight { margin-bottom: var(--space-2); }
.media-video { position: relative; display: block; width: 100%; height: 100%; }
.media-video video { width: 100%; height: 100%; object-fit: contain; display: block; background: #000; }
.media-video__mark { position: absolute; right: 8px; bottom: 8px; width: 28px; height: 28px; border-radius: 50%;
  background: rgba(0,0,0,.6); color: #fff; font-size: 12px; display: flex; align-items: center; justify-content: center; }

/* ---- the picture chooser: "Chosen" (ordered) above, browse (products / images by tag / videos) below */
.chooser { display: grid; gap: var(--space-3); border: var(--stroke) solid var(--line); border-radius: var(--radius-lg); padding: var(--space-3); background: var(--paper-2); }
.chooser__selected { background: var(--paper); border: var(--stroke) solid var(--line); border-radius: var(--radius-md); padding: var(--space-3); }
.chooser__selected-head { display: flex; justify-content: space-between; gap: var(--space-3); flex-wrap: wrap; align-items: baseline; margin-bottom: var(--space-2); }
.chooser__list { list-style: none; margin: 0; padding: 0; display: flex; gap: var(--space-2); overflow-x: auto; counter-reset: pick; }
.chooser__pick { position: relative; flex: 0 0 112px; display: grid; gap: 4px; counter-increment: pick; }
.chooser__pick::before { content: counter(pick); position: absolute; top: 4px; left: 4px; z-index: 1; min-width: 20px; height: 20px; border-radius: 10px;
  background: var(--brand); color: var(--brand-ink); font-size: 11px; font-weight: var(--weight-bold); display: flex; align-items: center; justify-content: center; padding: 0 5px; }
.chooser__pick-img { display: block; aspect-ratio: 1 / 1; background: var(--paper-3); border-radius: var(--radius-sm); overflow: hidden; }
.chooser__pick-media { width: 100%; height: 100%; object-fit: contain; display: block; }
.chooser__pick-title { font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink-2); }
.chooser__pick-actions { display: flex; gap: 2px; }
.chooser__btn { flex: 1; border: var(--stroke) solid var(--line); background: var(--paper); color: var(--ink-2); border-radius: var(--radius-sm); cursor: pointer; font: inherit; font-size: 12px; line-height: 20px; padding: 0; }
.chooser__btn:hover { border-color: var(--line-strong); color: var(--ink); }
.chooser__browse { display: grid; gap: var(--space-2); }
.chooser__results { max-height: 460px; overflow-y: auto; padding: 2px; }
.chooser__pane { display: grid; gap: var(--space-2); }
.chooser__crumb { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }
.chooser__crumb-title { font-weight: var(--weight-bold); font-size: var(--text-sm); }
.tabs--sm .tabs__tab { font-size: var(--text-sm); padding-block: 4px; }
.product-grid--compact { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
button.product-card { font: inherit; text-align: left; cursor: pointer; }
.media-tile--choose { font: inherit; text-align: left; cursor: pointer; padding: 0; }
.media-tile--choose.is-picked { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand); }
.media-tile__tick { position: absolute; top: 6px; right: 6px; width: 22px; height: 22px; border-radius: 50%; display: none;
  background: var(--brand); color: var(--brand-ink); font-size: 13px; align-items: center; justify-content: center; z-index: 2; }
.media-tile--choose.is-picked .media-tile__tick { display: flex; }
.media-tile--choose.is-refused { animation: refuse .3s ease 2; }
@keyframes refuse { 50% { transform: translateX(3px); } }
@media (prefers-reduced-motion: reduce) { .media-tile--choose.is-refused { animation: none; outline: 2px solid var(--state-error); } }

/* ---- Studio asset tools: edit copy, pictures, prompt, history ---- */
.gen { margin-bottom: var(--space-5); scroll-margin-top: calc(var(--header-h) + var(--space-4)); }
.gen__tools { display: grid; gap: var(--space-2); margin-top: var(--space-4); }
.gen__tool { border: var(--stroke) solid var(--line); border-radius: var(--radius-md); background: var(--paper); }
.gen__tool[open] { border-color: var(--line-strong); }
.gen__tool-summary { display: flex; align-items: center; gap: var(--space-2); padding: 10px var(--space-4); cursor: pointer; list-style: none; font-weight: var(--weight-bold); font-size: var(--text-sm); }
.gen__tool-summary::-webkit-details-marker { display: none; }
.gen__tool-summary::after { content: ""; margin-left: auto; width: 12px; height: 12px; background: var(--ink-3);
  -webkit-mask: url("/assets/icons/chevron-down.svg") center / contain no-repeat; mask: url("/assets/icons/chevron-down.svg") center / contain no-repeat; transition: transform .15s ease; }
.gen__tool[open] > .gen__tool-summary::after { transform: rotate(180deg); }
.gen__tool > form, .gen__tool > .table-wrap, .gen__tool > .disclosure { padding: 0 var(--space-4) var(--space-4); }
.gen__tool > .table-wrap { margin: 0; }
.gen__edit { display: grid; gap: var(--space-3); }
.field-group { border: var(--stroke) solid var(--line); border-radius: var(--radius-md); padding: var(--space-3); margin: 0; display: grid; gap: var(--space-2); }
.field-group legend { font-size: var(--text-xs); font-weight: var(--weight-bold); color: var(--ink-2); padding: 0 4px; }
.input--mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; line-height: 1.5; }
.prompt-view { white-space: pre-wrap; font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--paper-2);
  border: var(--stroke) solid var(--line); border-radius: var(--radius-md); padding: var(--space-3); max-height: 320px; overflow: auto; margin: 4px 0 var(--space-3); }
.ad-row--scroll { flex-wrap: nowrap; overflow-x: auto; padding-bottom: var(--space-2); }
.ad-row--scroll .ad-card { flex: 0 0 auto; }
.gen__post-text { margin: 0 0 var(--space-3); padding: var(--space-3) var(--space-4); background: var(--paper-2); border-radius: var(--radius-md); font-size: var(--text-sm); }
.kind-picks { gap: var(--space-1); }
/* Chooser tabs are buttons (they fetch a pane, not a page): drop the button chrome so they read as
   the same segmented tabs as the links elsewhere. */
button.tabs__tab { border: 0; background: none; font: inherit; color: var(--ink-2); cursor: pointer; }
button.tabs__tab.tabs__tab--active { background: var(--paper); color: var(--ink); box-shadow: var(--shadow-tab); }
/* A grid column grows to fit its widest child unless told otherwise, and the chosen strip is a
   scrolling row: without these the chooser pushed a phone-width page 200px wide. */
.chooser { grid-template-columns: minmax(0, 1fr); min-width: 0; }
.chooser__selected, .chooser__browse, .chooser__results { min-width: 0; }
.field:has(> .chooser) { min-width: 0; }
.ad-card { max-width: 100%; min-width: 0; }
/* A carousel post in the network preview: cards side by side, scrolled sideways like the feed. */
.feedcard__carousel { display: flex; gap: 8px; overflow-x: auto; padding: 0 12px 12px; scroll-snap-type: x mandatory; }
.feedcard__slide { flex: 0 0 72%; scroll-snap-align: start; border: 1px solid var(--line); border-radius: 8px; overflow: hidden;
  display: grid; grid-template-rows: auto 1fr auto; background: var(--paper); }
.feedcard__slide-img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; display: block; background: var(--paper-3); }
.feedcard__slide-text { padding: 8px 10px 4px; min-width: 0; }
.feedcard__slide .feedcard__cta { margin: 4px 10px 10px; justify-self: start; }
.feedcard__slide-desc { font-size: 12px; color: var(--ink-3); line-height: 1.35; margin-top: 2px; }
