/*
 * Merlin — application chrome.
 *
 * This palette is MERLIN's, and it is the only place it lives. The colours a
 * customer's artwork is drawn in come from the Brand record and never from
 * here (docs/ROADMAP.md §0). Nothing in this file should ever be read by the
 * canvas renderer.
 *
 * Light ground, violet primary, near-black text. Dark is used deliberately in
 * two places — the editor stage and the auth panel — not as a theme.
 */

:root {
  /* light */
  --bg: #FFFFFF;
  --surface: #F5F5F7;
  --surface-2: #FAFAFA;
  --border: #E3E3E8;
  --border-strong: #D2D2D8;
  --fg: #1D1D1F;
  --muted: #6E6E73;

  /* violet */
  --primary: #6D28D9;
  --primary-hover: #5B21B6;
  --primary-soft: #F3EDFF;
  --accent: #A78BFA;

  /* dark sections — violet-tinted, so they read as the same family */
  --ink: #16131C;
  --ink-surface: #201B2A;
  --ink-border: #322B40;
  --ink-fg: #F5F3F7;
  --ink-muted: #8E86A0;

  /* The editor stage is its own, lighter and neutral. Near-black next to a
     white panel is a hard edge that reads as a seam rather than a surface,
     and the violet cast fought the artwork sitting on it. */
  --stage: #26262B;
  --stage-border: #34343B;
  --stage-fg: #EDEDF0;
  --stage-muted: #9A9AA4;

  --danger: #C0392B;

  --radius: 12px;
  --radius-sm: 9px;
  --topbar-h: 60px;

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
}

* { box-sizing: border-box; }
html { color-scheme: light; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  letter-spacing: -0.005em;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 4px; }

/* ============================================================== topbar / nav */

.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 22px;
  height: var(--topbar-h); padding: 0 28px;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--border);
}

.mark {
  font-weight: 600; font-size: 17px; letter-spacing: -0.02em; color: var(--fg);
  display: inline-flex; align-items: center; gap: 8px;
}
.mark:hover { text-decoration: none; }
.mark .mark-dot { border-radius: 50%; background: var(--primary); display: inline-block; }
.mark .mark-glyph { color: var(--primary); display: block; }
.auth-panel .mark .mark-glyph, .drawer .mark .mark-glyph { color: var(--accent); }
.auth-panel .mark .mark-dot, .drawer .mark .mark-dot { background: var(--accent); }

.topbar nav { display: flex; align-items: center; gap: 22px; margin-left: auto; }
.topbar nav a, .topbar nav .linkish {
  color: var(--muted); font-size: 14px; background: none; border: 0; padding: 0;
  font: inherit; font-size: 14px; cursor: pointer;
}
.topbar nav a:hover, .topbar nav .linkish:hover { color: var(--fg); text-decoration: none; }
.topbar nav .who { color: var(--muted); font-size: 13.5px; }

/* the hamburger is the ONE mobile navigation affordance (docs/ROADMAP.md A3) */
.burger {
  display: none; margin-left: auto;
  width: 38px; height: 38px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--bg); cursor: pointer; padding: 0; place-items: center;
}
.burger span, .burger span::before, .burger span::after {
  display: block; width: 15px; height: 1.5px; background: var(--fg); border-radius: 2px;
  transition: transform .18s ease, opacity .18s ease;
}
.burger span { position: relative; }
.burger span::before, .burger span::after { content: ""; position: absolute; left: 0; }
.burger span::before { top: -5px; }
.burger span::after { top: 5px; }
.burger[aria-expanded="true"] span { background: transparent; }
.burger[aria-expanded="true"] span::before { transform: translateY(5px) rotate(45deg); }
.burger[aria-expanded="true"] span::after { transform: translateY(-5px) rotate(-45deg); }

.drawer-scrim {
  position: fixed; inset: 0; z-index: 45;
  background: rgba(29, 29, 31, 0.32); backdrop-filter: blur(2px);
}
.drawer {
  position: fixed; inset: 0 auto 0 0; z-index: 50;
  width: min(78vw, 290px); background: var(--bg);
  border-right: 1px solid var(--border);
  padding: 18px 22px; display: flex; flex-direction: column; gap: 4px;
  animation: drawer-in .2s cubic-bezier(.32, .72, 0, 1);
}
@keyframes drawer-in { from { transform: translateX(-100%); } }
.drawer .head { display: flex; align-items: center; margin-bottom: 18px; }
.drawer a, .drawer .linkish {
  display: block; padding: 11px 0; color: var(--fg); font-size: 16px;
  border-bottom: 1px solid var(--border);
  background: none; border-left: 0; border-right: 0; border-top: 0;
  width: 100%; text-align: left; font-family: inherit; cursor: pointer;
}
.drawer a:hover { text-decoration: none; color: var(--primary); }
.drawer .who { color: var(--muted); font-size: 13px; padding: 14px 0 0; }

/* ================================================================== layout */

.container { max-width: 1080px; margin: 0 auto; padding: 44px 28px 96px; }
.container.wide { max-width: 1440px; }
.bleed { padding: 0; max-width: none; }

/* =================================================================== type */

h1 { font-size: 30px; font-weight: 600; letter-spacing: -0.025em; margin: 0 0 8px; }
h2 { font-size: 17px; font-weight: 600; letter-spacing: -0.015em; margin: 44px 0 16px; }
.lede { color: var(--muted); font-size: 16px; margin: 0 0 34px; max-width: 60ch; }
.eyebrow {
  font-size: 12px; font-weight: 600; letter-spacing: 0.02em;
  color: var(--muted); margin: 0 0 8px;
}
.mono { font-family: var(--mono); font-size: 12.5px; }

/* ================================================================== forms */

label { display: block; font-size: 13px; font-weight: 500; color: var(--fg); margin: 0 0 7px; }
.field { margin-bottom: 18px; }
.field-hint { color: var(--muted); font-size: 13px; margin: 7px 0 0; }

input[type=text], input[type=email], input[type=password], input[type=url],
textarea, select {
  width: 100%; background: var(--bg); color: var(--fg);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  padding: 11px 13px; font: inherit; font-size: 15px; line-height: 1.45;
  transition: border-color .12s, box-shadow .12s;
}
textarea { min-height: 84px; resize: vertical; }
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3.5px var(--primary-soft);
}
input:disabled, textarea:disabled, select:disabled {
  background: var(--surface); color: var(--muted); cursor: not-allowed;
}
select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5l5-5' stroke='%236E6E73' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 13px center; padding-right: 34px;
}
input[type=file] { font: inherit; font-size: 14px; color: var(--muted); }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 14px; }

/* colour token editor */
.tokens { display: grid; grid-template-columns: repeat(auto-fill, minmax(184px, 1fr)); gap: 14px; }
.token { border: 1px solid var(--border); border-radius: var(--radius); padding: 13px 14px; background: var(--surface-2); }
.token .row { display: flex; gap: 9px; align-items: center; }
.token input[type=color] {
  width: 42px; height: 36px; padding: 0; border: 1px solid var(--border-strong);
  border-radius: 8px; background: var(--bg); cursor: pointer; flex: 0 0 auto;
}
.token input[type=text] { font-family: var(--mono); font-size: 12.5px; padding: 9px 10px; }
.tokens-core .token { background: var(--surface); border-color: var(--border-strong); }
.token.is-derived label { color: var(--muted); }
.token-state { margin: 8px 0 0; font-size: 11.5px; text-transform: lowercase; }
.swatch-chip {
  width: 42px; height: 36px; flex: 0 0 auto; border-radius: 8px;
  border: 1px solid var(--border-strong);
}
.linkish {
  background: none; border: 0; padding: 0; font: inherit; color: var(--primary);
  cursor: pointer; text-decoration: underline; text-underline-offset: 2px;
}

.section-lead { color: var(--muted); max-width: 62ch; margin: -4px 0 16px; }

/* ---------------------------------------------------------------- channels */

.channels { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 18px; margin-bottom: 8px; }
.channel-group .picker-group-name { margin: 0 0 7px; }
.channel {
  display: flex; align-items: flex-start; gap: 10px; cursor: pointer;
  padding: 8px 2px; border-top: 1px solid var(--border);
}
.channel:first-of-type { border-top: 0; }
.channel input { accent-color: var(--primary); margin-top: 3px; }
.channel-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.channel-name { font-size: 13.5px; display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.channel-body .meta { font-size: 12px; }

/* ------------------------------------------------------------------ ground */

.ground-choices { display: flex; gap: 12px; flex-wrap: wrap; }
.ground-choice {
  display: flex; align-items: center; gap: 11px; cursor: pointer;
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px 15px 12px 13px; background: var(--surface-2); flex: 1 1 240px;
}
.ground-choice:has(input:checked) { border-color: var(--primary); background: var(--surface); }
.ground-choice input { accent-color: var(--primary); }
.ground-text { display: flex; flex-direction: column; gap: 2px; }
.ground-text .meta { font-size: 12px; }
.ground-preview {
  width: 46px; height: 34px; flex: 0 0 auto; border-radius: 6px;
  border: 1px solid var(--border-strong); background: var(--ground-bg);
}
.ground-preview-grid {
  background-image: linear-gradient(var(--ground-line) 1px, transparent 1px),
                    linear-gradient(90deg, var(--ground-line) 1px, transparent 1px);
  background-size: 11px 11px;
}
.grid-only { display: none; margin-top: 14px; max-width: 260px; }
.ground:has(input[value=grid]:checked) .grid-only { display: block; }

/* ----------------------------------------------------------------- derived */

.derived { margin-top: 18px; }
.derived > summary {
  cursor: pointer; padding: 10px 0; font-weight: 500;
  list-style-position: inside;
}
.derived > summary::marker { color: var(--muted); }
.derived[open] > summary { margin-bottom: 6px; }

/* ----------------------------------------------------------------- palette */

.palette-rows { display: flex; flex-direction: column; gap: 9px; margin-bottom: 12px; }
.palette-row .row { display: flex; gap: 9px; align-items: center; }
.palette-row input[type=color] {
  width: 42px; height: 38px; padding: 0; border: 1px solid var(--border-strong);
  border-radius: 8px; background: var(--bg); cursor: pointer; flex: 0 0 auto;
}
.palette-hex { font-family: var(--mono); font-size: 12.5px; max-width: 120px; }
.palette-name { max-width: 260px; }
.palette-remove {
  background: none; border: 1px solid transparent; border-radius: 8px;
  width: 32px; height: 32px; font-size: 19px; line-height: 1; color: var(--muted);
  cursor: pointer; flex: 0 0 auto;
}
.palette-remove:hover { border-color: var(--border); color: var(--fg); }

.card.is-off { opacity: .62; }
.card.is-off:hover { opacity: 1; }
.pill.quiet { background: var(--surface-2); color: var(--muted); border-color: var(--border); }
form.adopt { display: inline-flex; gap: 7px; align-items: center; }
.adopt-format { padding: 7px 9px; font-size: 13px; width: auto; }

/* -------------------------------------------------------------- onboarding */

.steps { list-style: none; display: flex; gap: 10px; margin: 0 0 26px; padding: 0; flex-wrap: wrap; }
.steps li {
  display: flex; align-items: center; gap: 9px; font-size: 13.5px; color: var(--muted);
  border: 1px solid var(--border); border-radius: 999px; padding: 7px 15px 7px 8px;
}
.steps li span {
  width: 21px; height: 21px; border-radius: 50%; display: grid; place-items: center;
  background: var(--border); color: var(--bg); font-size: 11.5px; font-weight: 600;
}
.steps li.on { color: var(--fg); border-color: var(--primary); }
.steps li.on span { background: var(--primary); }
.steps li.passed span { background: var(--fg); }

.link-form .link-row, .link-row { display: flex; gap: 9px; align-items: center; flex-wrap: wrap; }
.link-row input[type=url], .link-row input[type=text] { flex: 1 1 200px; }
.link-row input[type=file] { flex: 1 1 240px; }
.link-label { max-width: 190px; }

ul.links { list-style: none; margin: 14px 0 0; padding: 0; }
ul.links li {
  display: flex; align-items: center; gap: 9px; flex-wrap: wrap;
  padding: 8px 0; border-top: 1px solid var(--border); font-size: 13.5px;
}

.prepare, .notice-card {
  display: flex; gap: 20px; align-items: center; justify-content: space-between;
  flex-wrap: wrap; margin-top: 22px;
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 20px; background: var(--surface-2);
}
.notice-card { display: block; }
.prepare .meta { max-width: 66ch; margin: 4px 0 0; }
.prepare-actions { display: flex; gap: 9px; flex: 0 0 auto; flex-wrap: wrap; }

.working-panel { border-color: var(--primary); }
.working-steps { margin: 12px 0; padding-left: 20px; color: var(--muted); font-size: 13.5px; }
.working-steps li { padding: 2px 0; }

.logo-slots { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 10px; }
.logo-slot { text-align: center; }
.logo-preview {
  height: 92px; border: 1px solid var(--border); border-radius: var(--radius);
  display: grid; place-items: center; padding: 14px; margin-bottom: 8px;
}
.logo-preview img { max-height: 60px; max-width: 100%; }
.logo-name { margin: 0; font-size: 13.5px; font-weight: 500; }

.proposed-colours { display: flex; flex-direction: column; gap: 8px; }
.proposed-colour {
  display: flex; align-items: center; gap: 11px; cursor: pointer;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 10px 13px; background: var(--surface-2);
}
.proposed-colour input[type=checkbox] { accent-color: var(--primary); }
.proposed-body { display: flex; align-items: center; gap: 11px; flex: 1 1 auto; flex-wrap: wrap; }
.colour-name { max-width: 190px; }
.colour-role { max-width: 220px; font-size: 13px; }

.stage-choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 8px; }
.stage-choice {
  display: flex; align-items: flex-start; gap: 10px; cursor: pointer;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 11px 13px; background: var(--surface-2);
}
.stage-choice:has(input:checked) { border-color: var(--primary); background: var(--surface); }
.stage-choice input { accent-color: var(--primary); margin-top: 3px; }
.stage-text { display: flex; flex-direction: column; gap: 1px; }
.stage-text .meta { font-size: 12px; }

.pressure-choices { display: flex; flex-wrap: wrap; gap: 7px; }
.pressure {
  display: inline-flex; align-items: center; gap: 7px; cursor: pointer;
  border: 1px solid var(--border); border-radius: 999px;
  padding: 7px 14px; font-size: 13px; background: var(--surface-2);
}
.pressure:has(input:checked) { border-color: var(--primary); background: var(--surface); }
.pressure input { accent-color: var(--primary); }

/* ------------------------------------------------------------------- marks */

/* Not `.mark` — that is Merlin's own logo in the header. */
.mark-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; }
.mark-option { text-align: center; }
.mark-option-grounds { display: flex; gap: 8px; align-items: stretch; margin-bottom: 9px; }
.mark-option-ground {
  flex: 1 1 auto; border: 1px solid var(--border); border-radius: var(--radius);
  display: grid; place-items: center; padding: 14px; min-height: 96px;
}
.mark-option-ground svg { width: 62px; height: 62px; }
.mark-option-ground.small { flex: 0 0 48px; padding: 8px; }
.mark-option-ground.small svg { width: 24px; height: 24px; }
.mark-option-name { margin: 0 0 8px; font-size: 13.5px; font-weight: 500; }

/* -------------------------------------------------------------- situations */

.situations { list-style: none; margin: 18px 0 0; padding: 0; }
.situation { display: flex; gap: 18px; align-items: flex-start; padding: 15px 0; border-top: 1px solid var(--border); }
.situation-when {
  flex: 0 0 150px; font-size: 12.5px; color: var(--muted);
  display: flex; flex-direction: column; gap: 4px;
}
.movement { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; }
.moved-up .movement { color: var(--primary); }
.moved-down .movement { color: var(--danger); }
.situation-body { flex: 1 1 auto; min-width: 0; }
.situation-body .title { margin: 0 0 6px; font-weight: 500; }
.pressures { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 7px; }

/* ------------------------------------------------------------------- ideas */

.ideas { display: flex; flex-direction: column; gap: 11px; margin: 14px 0 26px; }
.idea {
  border: 1px solid var(--border); border-left-width: 3px; border-radius: var(--radius);
  padding: 14px 16px; background: var(--surface-2);
}
.idea.is-good { border-left-color: var(--primary); }
.idea.is-bad { border-left-color: var(--danger); }
.idea.is-dormant { opacity: .6; }
.idea.is-dormant:hover { opacity: 1; }
.idea-head { display: flex; justify-content: space-between; gap: 14px; align-items: flex-start; }
.idea-head .title { margin: 0 0 3px; font-weight: 500; }
.idea-detail { margin: 9px 0 0; font-size: 13.5px; }
.idea-evidence { margin: 5px 0 0; font-style: italic; }
.idea-statuses { display: flex; flex-wrap: wrap; gap: 0; margin-top: 11px; }
.idea-statuses form { display: inline; }
.idea-statuses .state {
  border: 1px solid var(--border); background: var(--bg); color: var(--muted);
  font: inherit; font-size: 11.5px; padding: 5px 10px; cursor: pointer;
  margin-left: -1px; white-space: nowrap;
}
.idea-statuses form:first-child .state { border-radius: 7px 0 0 7px; margin-left: 0; }
.idea-statuses form:last-child .state { border-radius: 0 7px 7px 0; }
.idea-statuses .state:hover { color: var(--fg); }
.idea-statuses .state.on { color: #fff; background: var(--muted); border-color: var(--muted); }
.idea-statuses .state.standing-good.on { background: var(--primary); border-color: var(--primary); }
.idea-statuses .state.standing-bad.on { background: var(--danger); border-color: var(--danger); }

.verdicts { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; margin-bottom: 8px; }
.verdict {
  border: 1px solid var(--border); border-top-width: 3px; border-radius: var(--radius);
  padding: 14px 16px; background: var(--surface-2);
}
.verdict.standing-good { border-top-color: var(--primary); }
.verdict.standing-bad { border-top-color: var(--danger); }
.verdict ul { list-style: none; margin: 8px 0 0; padding: 0; }
.verdict li { padding: 6px 0; border-top: 1px solid var(--border); font-size: 13.5px; }
.verdict li:first-child { border-top: 0; }
.verdict li .meta { display: block; font-size: 11px; }

/* --------------------------------------------------------------- workspace */

.workspace { display: grid; grid-template-columns: 224px minmax(0, 1fr); gap: 40px; align-items: start; }
.workspace-main { min-width: 0; }

.workspace-nav { position: sticky; top: 84px; }
.workspace-brand {
  display: flex; align-items: center; gap: 11px; padding: 4px 10px 16px;
  color: inherit; text-decoration: none;
}
.workspace-brand:hover { text-decoration: none; }
.workspace-brand span { display: flex; flex-direction: column; min-width: 0; }
.workspace-brand strong { font-size: 14.5px; font-weight: 600; }
.workspace-brand .meta { font-size: 11.5px; }
.workspace-group {
  margin: 16px 0 5px; padding: 0 10px; font-size: 10.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .07em; color: var(--muted);
}
.workspace-nav ul { list-style: none; margin: 0; padding: 0; }
.workspace-link {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 7px 10px; border-radius: var(--radius-sm); font-size: 13.5px;
  color: var(--fg); text-decoration: none; opacity: .78;
}
.workspace-link:hover { background: var(--surface-2); text-decoration: none; opacity: 1; }
.workspace-link.on { background: var(--surface); opacity: 1; font-weight: 500; box-shadow: inset 2px 0 0 var(--primary); }
.workspace-badge {
  flex: 0 0 auto; min-width: 19px; text-align: center; font-size: 11px;
  padding: 1px 6px; border-radius: 999px; background: var(--border); color: var(--fg);
}
.workspace-link.on .workspace-badge { background: var(--primary); color: #fff; }

.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; flex-wrap: wrap; }
.page-head h1 { margin-bottom: 6px; }
.page-head .lede { max-width: 66ch; }
.page-head-actions { display: flex; gap: 8px; flex: 0 0 auto; }

@media (max-width: 900px) {
  .workspace { grid-template-columns: 1fr; gap: 16px; }

  /* One scrolling row, not a wrapped block. Eleven links and three headings
     stacked ate the whole first screen before any content appeared, which on
     a phone means the page opens on its own table of contents. */
  .workspace-nav {
    position: sticky; top: 56px; z-index: 30;
    margin: 0 -18px; padding: 0 18px;
    background: var(--bg); border-bottom: 1px solid var(--border);
    display: flex; align-items: center; gap: 6px;
    overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch;
  }
  .workspace-nav::-webkit-scrollbar { display: none; }
  .workspace-nav ul { display: flex; gap: 2px; }
  .workspace-group { display: none; }

  .workspace-brand { padding: 8px 10px 8px 0; border-right: 1px solid var(--border); margin-right: 4px; }
  .workspace-brand .meta { display: none; }
  .workspace-brand strong { white-space: nowrap; }

  .workspace-link { white-space: nowrap; padding: 12px 10px; border-radius: 0; }
  .workspace-link.on { background: none; box-shadow: inset 0 -2px 0 var(--primary); }
  .workspace-link:hover { background: none; }
}

/* ----------------------------------------------------------- brand identity */

.identity-mark { border-radius: 11px; display: block; flex: 0 0 auto; }
.brand-face {
  display: inline-flex; align-items: center; justify-content: center;
  background: #fff; border: 1px solid var(--border); border-radius: 11px;
  overflow: hidden; flex: 0 0 auto;
}
.brand-face img { max-width: 78%; max-height: 78%; object-fit: contain; }

.card.brand-card { display: flex; gap: 15px; align-items: flex-start; }
.brand-card-face { flex: 0 0 auto; }
.brand-card-body { min-width: 0; flex: 1 1 auto; }
.brand-card .title { margin: 2px 0 3px; }
.brand-swatches { display: flex; gap: 5px; margin-top: 10px; }
.brand-swatch {
  width: 26px; height: 14px; border-radius: 4px;
  border: 1px solid rgba(0, 0, 0, .1);
}

/* ----------------------------------------------------------------- desktop */

.desk-section { margin-bottom: 34px; }
.desk-head { display: flex; align-items: baseline; gap: 9px; margin-bottom: 11px; }
.desk-head h2 { margin: 0; font-size: 14px; font-weight: 600; letter-spacing: .01em; }
.desk-count { font-size: 12px; color: var(--muted); }
.desk-edit {
  border: 0; background: none; padding: 2px 5px; cursor: pointer; font-size: 12px;
  color: var(--muted); opacity: 0; transition: opacity .12s; line-height: 1;
}
.desk-section:hover .desk-edit, .desk-edit:focus-visible { opacity: 1; }
.desk-edit:hover { color: var(--fg); }

.desk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.tile-wrap { position: relative; display: flex; }
.dialog-holder { display: contents; }

.tile {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  width: 100%; text-align: left; font: inherit; color: inherit;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface-2); padding: 12px 14px; text-decoration: none;
  min-height: 58px; cursor: pointer;
}
.tile:hover { border-color: var(--border-strong); background: var(--surface); text-decoration: none; }
.tile-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tile-title {
  font-size: 13.5px; font-weight: 500; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}
.tile-meta { font-size: 11.5px; color: var(--muted); }
.tile-go { color: var(--muted); font-size: 13px; opacity: 0; transition: opacity .12s; }
.tile:hover .tile-go { opacity: 1; }

/* A note reads as a note before it is read at all: the warm ground of a legal
   pad, and the word itself. Everything else on the desk is a link to somewhere
   else — this is the one thing that is the thing. */
.tile.is-note {
  flex-direction: column; align-items: flex-start; gap: 2px;
  background: #FDF8EC; border-color: #EBDFC4;
}
.tile.is-note:hover { background: #FCF4E0; border-color: #DFCEA6; }
.tile-kind {
  font-size: 9.5px; font-weight: 600; letter-spacing: .09em; text-transform: uppercase;
  color: #8A6D26; margin-bottom: 1px;
}
.tile.is-image { flex-direction: column; align-items: stretch; gap: 8px; padding: 8px; cursor: default; }
.tile.is-image img { width: 100%; height: 104px; object-fit: cover; border-radius: 7px; display: block; }
.tile.is-image .tile-title { padding: 0 4px 2px; }
.tile.is-new {
  border-style: dashed; background: none; color: var(--muted);
  justify-content: center; font-size: 17px;
}
.tile.is-new:hover { color: var(--fg); }

.tile-tools { position: absolute; top: 6px; right: 6px; opacity: 0; transition: opacity .12s; }
.tile-wrap:hover .tile-tools, .tile-tools:focus-within { opacity: 1; }
.tile-tool {
  width: 22px; height: 22px; border-radius: 6px; border: 1px solid var(--border);
  background: var(--bg); color: var(--muted); font-size: 11px; line-height: 1; cursor: pointer;
}
.tile-tool:hover { color: var(--fg); border-color: var(--border-strong); }

.desk-add { display: flex; gap: 8px; align-items: center; margin-top: 10px; max-width: 380px; }

/* ------------------------------------------------------------------ dialog */

dialog {
  border: 0; padding: 0; background: none; max-width: min(560px, calc(100vw - 32px));
  color: var(--fg);
}
dialog::backdrop { background: rgba(16, 16, 20, .42); backdrop-filter: blur(2px); }
.dialog-frame {
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 18px 48px rgba(16, 16, 20, .18); padding: 20px 22px 22px;
  max-height: min(78vh, 720px); overflow: auto;
}
.dialog-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 4px; }
.dialog-head h2 { margin: 0; font-size: 16.5px; }
.dialog-close {
  border: 0; background: none; font-size: 21px; line-height: 1; cursor: pointer;
  color: var(--muted); padding: 0 2px;
}
.dialog-close:hover { color: var(--fg); }
.dialog-doc {
  font-size: 14.5px; line-height: 1.62; padding: 10px 0 4px;
  border-bottom: 1px solid var(--border); margin-bottom: 6px;
}
.dialog-doc p { margin: 0 0 10px; }
.dialog-actions { display: flex; gap: 8px; align-items: center; margin-top: 16px; }

.tile-form .field { margin: 12px 0; }
.tile-form .field[hidden] { display: none; }
.kind-choice { display: flex; gap: 14px; margin: 12px 0 4px; }
.kind-choice label { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; }
.kind-choice input { accent-color: var(--primary); }
/* Which fields matter follows the choice, with no JavaScript to keep in step. */
.tile-form .for-link, .tile-form .for-note, .tile-form .for-image { display: none; }
.tile-form:has(input[value=link]:checked) .for-link,
.tile-form:has(input[value=note]:checked) .for-note,
.tile-form:has(input[value=image]:checked) .for-image { display: block; }

/* --------------------------------------------------------------- workspace */

.workspace { display: grid; grid-template-columns: 224px minmax(0, 1fr); gap: 40px; align-items: start; }
.workspace-main { min-width: 0; }

.workspace-nav { position: sticky; top: 84px; }
.workspace-brand {
  display: flex; align-items: center; gap: 11px; padding: 4px 10px 16px;
  color: inherit; text-decoration: none;
}
.workspace-brand:hover { text-decoration: none; }
.workspace-brand span { display: flex; flex-direction: column; min-width: 0; }
.workspace-brand strong { font-size: 14.5px; font-weight: 600; }
.workspace-brand .meta { font-size: 11.5px; }
.workspace-group {
  margin: 16px 0 5px; padding: 0 10px; font-size: 10.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .07em; color: var(--muted);
}
.workspace-nav ul { list-style: none; margin: 0; padding: 0; }
.workspace-link {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 7px 10px; border-radius: var(--radius-sm); font-size: 13.5px;
  color: var(--fg); text-decoration: none; opacity: .78;
}
.workspace-link:hover { background: var(--surface-2); text-decoration: none; opacity: 1; }
.workspace-link.on { background: var(--surface); opacity: 1; font-weight: 500; box-shadow: inset 2px 0 0 var(--primary); }
.workspace-badge {
  flex: 0 0 auto; min-width: 19px; text-align: center; font-size: 11px;
  padding: 1px 6px; border-radius: 999px; background: var(--border); color: var(--fg);
}
.workspace-link.on .workspace-badge { background: var(--primary); color: #fff; }

.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; flex-wrap: wrap; }
.page-head h1 { margin-bottom: 6px; }
.page-head .lede { max-width: 66ch; }
.page-head-actions { display: flex; gap: 8px; flex: 0 0 auto; }

@media (max-width: 900px) {
  .workspace { grid-template-columns: 1fr; gap: 16px; }

  /* One scrolling row, not a wrapped block. Eleven links and three headings
     stacked ate the whole first screen before any content appeared, which on
     a phone means the page opens on its own table of contents. */
  .workspace-nav {
    position: sticky; top: 56px; z-index: 30;
    margin: 0 -18px; padding: 0 18px;
    background: var(--bg); border-bottom: 1px solid var(--border);
    display: flex; align-items: center; gap: 6px;
    overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch;
  }
  .workspace-nav::-webkit-scrollbar { display: none; }
  .workspace-nav ul { display: flex; gap: 2px; }
  .workspace-group { display: none; }

  .workspace-brand { padding: 8px 10px 8px 0; border-right: 1px solid var(--border); margin-right: 4px; }
  .workspace-brand .meta { display: none; }
  .workspace-brand strong { white-space: nowrap; }

  .workspace-link { white-space: nowrap; padding: 12px 10px; border-radius: 0; }
  .workspace-link.on { background: none; box-shadow: inset 0 -2px 0 var(--primary); }
  .workspace-link:hover { background: none; }
}

/* ----------------------------------------------------------- brand identity */

.identity-mark { border-radius: 11px; display: block; flex: 0 0 auto; }
.brand-face {
  display: inline-flex; align-items: center; justify-content: center;
  background: #fff; border: 1px solid var(--border); border-radius: 11px;
  overflow: hidden; flex: 0 0 auto;
}
.brand-face img { max-width: 78%; max-height: 78%; object-fit: contain; }

.card.brand-card { display: flex; gap: 15px; align-items: flex-start; }
.brand-card-face { flex: 0 0 auto; }
.brand-card-body { min-width: 0; flex: 1 1 auto; }
.brand-card .title { margin: 2px 0 3px; }
.brand-swatches { display: flex; gap: 5px; margin-top: 10px; }
.brand-swatch {
  width: 26px; height: 14px; border-radius: 4px;
  border: 1px solid rgba(0, 0, 0, .1);
}

/* ---------------------------------------------------------------- overview */

/* One rhythm for the whole page, so nothing has to remember its own spacing. */
.left-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 16px; margin: 40px 0 12px;
}
.left-head h2 { margin: 0; }

.standing-bar {
  display: flex; align-items: center; gap: 22px; flex-wrap: wrap;
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 22px; background: var(--surface-2);
}

.standing-next { flex: 1 1 300px; min-width: 0; }
.standing-kicker {
  margin: 0 0 3px; font-size: 10.5px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .07em; color: var(--muted);
}
.standing-label { margin: 0 0 2px; font-size: 16px; font-weight: 500; }
.standing-next .meta { margin: 0; }

.tally { display: flex; gap: 24px; flex-wrap: wrap; align-items: baseline; margin: 14px 2px 0; font-size: 13px; color: var(--muted); }
.tally strong { color: var(--fg); font-weight: 600; font-size: 16px; margin-right: 3px; }
.tally-change { font-size: 11.5px; font-weight: 600; margin-left: 3px; }
.tally-change.up { color: var(--primary); }
.tally-change.down { color: var(--danger); }

/* Twelve weeks, two bars each. Totals stop meaning anything once they are
   large; the shape of the weeks says whether anything is happening now. */
.rhythm {
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  gap: 5px; height: 74px; align-items: end;
  border-bottom: 1px solid var(--border); padding-bottom: 1px;
}
.rhythm-week { display: flex; gap: 2px; align-items: flex-end; justify-content: center; height: 100%; }
.rhythm-made, .rhythm-out { flex: 1 1 0; max-width: 12px; border-radius: 2px 2px 0 0; min-height: 3px; }
.rhythm-made { background: var(--border-strong); }
.rhythm-out { background: var(--primary); }
.rhythm-week:hover .rhythm-made { background: var(--muted); }
.rhythm-key { display: flex; align-items: center; gap: 7px; margin: 8px 2px 0; font-size: 11.5px; color: var(--muted); }
.key-made, .key-out { width: 9px; height: 9px; border-radius: 2px; display: inline-block; }
.key-made { background: var(--border-strong); }
.key-out { background: var(--primary); margin-left: 10px; }

/* What is left. One row each, one line of why, and where to go. */
.left-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--border); }
.left-item {
  display: flex; align-items: baseline; gap: 13px;
  padding: 12px 2px; border-bottom: 1px solid var(--border);
}
.left-dot {
  flex: 0 0 auto; width: 8px; height: 8px; border-radius: 50%;
  background: var(--border-strong); transform: translateY(-1px);
}
.left-item.is-warn .left-dot { background: var(--warning, #F59F0A); }
.left-item.is-urgent .left-dot { background: var(--danger); }
.left-item.is-idle .left-dot { background: var(--border-strong); }
.left-body { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.left-label { font-size: 14.5px; }
.left-body .meta { font-size: 12.5px; }
.left-group {
  flex: 0 0 78px; font-size: 11px; color: var(--muted);
  text-transform: uppercase; letter-spacing: .05em;
}
.left-action { flex: 0 0 auto; font-size: 13px; white-space: nowrap; }

.done-note { margin: 14px 2px 0; font-size: 13px; color: var(--muted); }
.done-note span { color: var(--primary); margin-right: 6px; }
.ask-line { margin: 16px 2px 0; }

@media (max-width: 720px) {
  /* Wrapped, but in the order it is read: what it is, then where it belongs,
     then what to do. Letting the action float up ahead of the label put the
     answer before the question. */
  .left-item { flex-wrap: wrap; gap: 8px 11px; }
  .left-body { flex: 1 1 100%; order: 1; }
  .left-group { flex: 0 0 auto; order: 2; }
  .left-action { order: 3; margin-left: auto; }
}

/* ---------------------------------------------------------------- coverage */

.coverage { margin: 0 0 26px; }

.coverage-verdict { margin: 0 0 12px; font-size: 14.5px; }
.stage-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; }
.stage-chip {
  border: 1px solid var(--border); border-left-width: 3px; border-radius: var(--radius-sm);
  padding: 10px 12px; background: var(--surface-2);
  display: flex; flex-direction: column; gap: 2px;
}
.stage-chip-name { font-size: 13.5px; font-weight: 500; }
.stage-chip-counts { font-size: 11.5px; color: var(--muted); }
.stage-chip.gap-none { border-left-color: var(--primary); }
.stage-chip.gap-nothing_made { border-left-color: var(--danger); }
.stage-chip.gap-nothing_published,
.stage-chip.gap-nothing_measured { border-left-color: var(--warning, #F59F0A); }
.coverage-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 14px; }
.stages { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.stage {
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 12px 14px; background: var(--bg);
}
.stage-name { margin: 0 0 3px; font-weight: 500; font-size: 14px; }
.stage-question { margin: 0 0 9px; font-size: 11.5px; color: var(--muted); }
.stage-counts { display: flex; flex-wrap: wrap; gap: 3px 10px; font-size: 11.5px; color: var(--muted); }
.stage-gap { margin: 9px 0 0; font-size: 12px; }
.stage.gap-none { border-color: var(--primary); }
.stage.gap-none .stage-gap { color: var(--muted); }
.stage.gap-nothing_made { border-color: var(--danger); }
.stage.gap-nothing_made .stage-gap { color: var(--danger); }
.stage.gap-nothing_published .stage-gap,
.stage.gap-nothing_measured .stage-gap { color: var(--warning, #B4700A); }

/* ------------------------------------------------------------ publications */

.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.metric { margin: 0; }
.publications { display: flex; flex-direction: column; gap: 12px; margin-top: 14px; }
.publication { border: 1px solid var(--border); border-radius: var(--radius); padding: 15px 17px; background: var(--surface-2); }
.publication.no-results { border-style: dashed; }
.publication-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; }
.publication-head .title { margin: 0 0 3px; font-weight: 500; }
.results { display: flex; gap: 26px; margin-top: 11px; flex-wrap: wrap; }
.results div { display: flex; flex-direction: column; gap: 1px; }
.results strong { font-size: 18px; font-weight: 600; }
.results span { font-size: 11.5px; color: var(--muted); }
.results-form { margin-top: 11px; }
.results-form > summary { cursor: pointer; font-size: 12.5px; color: var(--muted); padding: 4px 0; }
.results-form > summary:hover { color: var(--fg); }

/* ----------------------------------------------------------------- context */

.question label { font-weight: 500; }
.question.answered label::after {
  content: "answered"; margin-left: 9px; font-size: 10.5px; font-weight: 400;
  color: var(--muted); text-transform: uppercase; letter-spacing: .06em;
}
.warn-text { color: var(--danger); }

.scope { margin: 16px 0 4px; }
.scope-choice {
  display: flex; align-items: flex-start; gap: 10px; cursor: pointer;
  padding: 8px 2px;
}
.scope-choice input { accent-color: var(--primary); margin-top: 3px; }
.scope-text { display: flex; flex-direction: column; gap: 1px; }
.scope-text .meta { font-size: 12px; }

/* Only the dates the chosen shape actually uses. One invalid selector in a
   comma-separated group throws the whole group away, so these stay simple. */
.scope-dates { display: none; gap: 14px; margin-top: 6px; padding-left: 26px; }
.scope-date { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.scope-date input { width: 170px; }
.scope:has(input[value="until"]:checked) .scope-dates { display: flex; }
.scope:has(input[value="between"]:checked) .scope-dates { display: flex; }
.scope:has(input[value="until"]:checked) .scope-date.from { display: none; }

.documents { display: flex; flex-direction: column; gap: 12px; margin: 18px 0 8px; }
.document { border: 1px solid var(--border); border-radius: var(--radius); padding: 15px 17px; background: var(--surface-2); }
.document.is-expired, .document.is-pending { opacity: .6; }
.document.is-expired:hover, .document.is-pending:hover { opacity: 1; }
.document-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; }
.document-head .title { margin: 0 0 4px; font-weight: 500; }
.document-window, .document-body { margin-top: 10px; }
.document-window > summary, .document-body > summary {
  cursor: pointer; font-size: 12.5px; color: var(--muted); padding: 4px 0;
}
.document-window > summary:hover, .document-body > summary:hover { color: var(--fg); }
.document-body pre {
  white-space: pre-wrap; word-break: break-word; max-height: 260px; overflow: auto;
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 12px 14px; font-size: 12px; margin: 8px 0 0;
}

.timeline { list-style: none; margin: 18px 0 0; padding: 0; }
.moment {
  display: flex; gap: 18px; align-items: flex-start;
  padding: 14px 0; border-top: 1px solid var(--border);
}
.moment-when {
  flex: 0 0 168px; font-size: 12.5px; color: var(--muted);
  display: flex; flex-direction: column; gap: 5px; align-items: flex-start;
}
.moment-body { flex: 1 1 auto; min-width: 0; }
.moment-body .title { margin: 0 0 3px; font-weight: 500; }
.moment .outcome { margin: 6px 0 0; font-size: 13.5px; }
.moment.running .moment-body .title { color: var(--primary); }

/* ------------------------------------------------------------------ topics */

.brief-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.brief-help { display: flex; gap: 2px; }
.brief-help .btn { padding: 4px 9px; font-size: 12.5px; }

.suggestions { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.suggestions .picker-group-name { margin: 8px 0 2px; }
.suggestion {
  display: flex; flex-direction: column; gap: 3px; text-align: left;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface-2); padding: 10px 13px; cursor: pointer; font: inherit;
}
.suggestion:hover { border-color: var(--primary); background: var(--surface); }
.suggestion-topic { font-size: 14px; }
.suggestion-why { font-size: 12px; color: var(--muted); }

/* -------------------------------------------------------------------- plan */

.standing { margin-bottom: 22px; }
.standing-figures { display: flex; gap: 34px; flex-wrap: wrap; margin-top: 10px; }
.standing-figures div { display: flex; flex-direction: column; gap: 2px; }
.standing-figures strong { font-size: 21px; font-weight: 600; }
.standing-figures span { font-size: 12px; color: var(--muted); }

.phases { display: flex; flex-direction: column; gap: 18px; margin: 22px 0; }
.phase { border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; background: var(--surface-2); }
.phase-head { display: flex; align-items: center; gap: 16px; }
.phase-titles { display: flex; gap: 10px; align-items: baseline; flex: 1 1 auto; min-width: 0; }
.phase-name { font-size: 17px; font-weight: 600; border-color: transparent; background: none; padding: 4px 6px; flex: 1 1 auto; }
.phase-when { width: 130px; font-size: 12.5px; color: var(--muted); border-color: transparent; background: none; padding: 4px 6px; }
.phase-name:hover, .phase-when:hover, .phase-intent:hover { border-color: var(--border); }
.phase-name:focus, .phase-when:focus, .phase-intent:focus { background: var(--bg); }
.phase-progress { width: 96px; height: 5px; border-radius: 3px; background: var(--border); overflow: hidden; flex: 0 0 auto; }
.phase-progress span { display: block; height: 100%; background: var(--primary); }
.phase-intent { border-color: transparent; background: none; padding: 4px 6px; resize: vertical; margin-top: 4px; }

.items { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 7px; }
.item { display: flex; align-items: flex-start; gap: 13px; padding: 9px 4px; border-top: 1px solid var(--border); }
.item-body { flex: 1 1 auto; min-width: 0; }
.item-title { margin: 0; font-size: 14.5px; }
.item.is-done .item-title { color: var(--muted); text-decoration: line-through; }
.item-states { display: flex; gap: 0; flex: 0 0 auto; }
.item-states form { display: inline; }
.item-states .state {
  border: 1px solid var(--border); background: var(--bg); color: var(--muted);
  font: inherit; font-size: 11.5px; padding: 5px 9px; cursor: pointer;
  margin-left: -1px; white-space: nowrap;
}
.item-states form:first-child .state { border-radius: 7px 0 0 7px; margin-left: 0; }
.item-states form:last-child .state { border-radius: 0 7px 7px 0; }
.item-states .state:hover { color: var(--fg); }
.item-states .state.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.phase-save { margin-top: 8px; }
.phase-save .btn, .phase-remove .btn { padding-left: 0; }
.phase-remove { display: inline-block; }
.new-item { margin-top: 11px; }
.new-item-title { font-size: 13.5px; }

.danger-zone { margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--border); }

/* ================================================================ buttons */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--primary); color: #fff; border: 1px solid transparent;
  border-radius: var(--radius-sm); padding: 11px 20px;
  font: inherit; font-size: 15px; font-weight: 500; cursor: pointer;
  text-decoration: none; transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--primary-hover); text-decoration: none; }
.btn:disabled { opacity: .45; cursor: progress; }
.btn.ghost { background: var(--bg); color: var(--fg); border-color: var(--border-strong); }
.btn.ghost:hover { background: var(--surface); border-color: var(--muted); }
.btn.quiet { background: none; color: var(--muted); border-color: transparent; padding-left: 0; padding-right: 0; }
.btn.quiet:hover { background: none; color: var(--fg); }
.btn.danger { background: var(--bg); color: var(--danger); border-color: var(--border-strong); }
.btn.danger:hover { background: var(--bg); border-color: var(--danger); }
.btn.small { padding: 8px 14px; font-size: 14px; }
.btn.block { width: 100%; }

.actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 24px; }

/* ================================================================== cards */

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(262px, 1fr)); gap: 16px; }
.card {
  display: block; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--bg); padding: 20px; color: inherit;
  transition: border-color .12s, transform .12s;
}
a.card:hover, button.card:hover {
  border-color: var(--border-strong); text-decoration: none; transform: translateY(-1px);
}
.card .title { font-weight: 600; font-size: 15.5px; margin: 0 0 5px; letter-spacing: -0.01em; }
.card .meta { color: var(--muted); font-size: 13.5px; margin: 0; }

.swatches { display: flex; gap: 5px; margin-top: 15px; }
.swatch { width: 22px; height: 22px; border-radius: 6px; border: 1px solid rgba(0, 0, 0, .08); }

.empty {
  border: 1px dashed var(--border-strong); border-radius: var(--radius);
  padding: 52px 28px; text-align: center; color: var(--muted); background: var(--surface-2);
}
.empty p { margin: 0 0 20px; }

.pill {
  display: inline-block; font-size: 12px; font-weight: 500; padding: 3px 9px;
  border-radius: 999px; background: var(--primary-soft); color: var(--primary);
}

/* ======================================================== flash and errors */

.flash {
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 12px 15px; margin: 0 0 24px; font-size: 14.5px; background: var(--surface-2);
}
.flash.notice { border-left: 3px solid var(--primary); }
.flash.alert { border-left: 3px solid var(--danger); }

.errors {
  border: 1px solid var(--danger); border-radius: var(--radius-sm);
  padding: 13px 15px; margin: 0 0 24px; font-size: 14.5px;
}
.errors ul { margin: 7px 0 0; padding-left: 20px; color: var(--muted); }

[hidden] { display: none !important; }

/* ============================================================ auth split */
/*
 * Desktop: brand panel left, form right. The panel is drawn in CSS — the same
 * 68px grid the canvas renderer uses — so there is no image asset to keep in
 * sync with the palette (docs/ROADMAP.md A2).
 */

.auth { display: grid; grid-template-columns: 1.05fr 1fr; min-height: 100vh; }

.auth-panel {
  position: relative; overflow: hidden;
  background: var(--ink); color: var(--ink-fg);
  display: flex; flex-direction: column; justify-content: space-between;
  padding: 44px 52px;
}
.auth-panel::before {
  content: ""; position: absolute; inset: 0;
  background-image:
    linear-gradient(to right, var(--ink-border) 1px, transparent 1px),
    linear-gradient(to bottom, var(--ink-border) 1px, transparent 1px);
  background-size: 68px 68px;
  opacity: .5;
  mask-image: radial-gradient(120% 90% at 22% 32%, #000 20%, transparent 78%);
}
.auth-panel::after {
  content: ""; position: absolute; width: 620px; height: 620px;
  left: -140px; top: 32%; border-radius: 50%;
  background: radial-gradient(circle, rgba(109, 40, 217, .55), transparent 62%);
  filter: blur(28px);
}
.auth-panel > * { position: relative; z-index: 1; }
.auth-panel .mark { color: var(--ink-fg); }
.auth-panel .claim {
  font-size: 34px; font-weight: 600; letter-spacing: -0.03em; line-height: 1.18;
  margin: 0 0 14px; max-width: 15ch;
}
.auth-panel .sub { color: var(--ink-muted); font-size: 16px; margin: 0; max-width: 40ch; }
.auth-panel .foot { color: var(--ink-muted); font-size: 13px; }

.auth-form { display: flex; align-items: center; justify-content: center; padding: 44px 28px; }
.auth-form .inner { width: 100%; max-width: 372px; }
.auth-form h1 { font-size: 26px; }
.auth-form .lede { font-size: 15px; margin-bottom: 30px; }
.auth-alt { margin-top: 26px; font-size: 14.5px; color: var(--muted); text-align: center; }

@media (max-width: 900px) {
  /* A decorative half-screen above a login form is wasted space on a phone. */
  .auth { grid-template-columns: 1fr; min-height: 100dvh; }
  .auth-panel { padding: 26px 24px 30px; }
  .auth-panel .claim { font-size: 24px; margin-bottom: 8px; }
  .auth-panel .sub, .auth-panel .foot { display: none; }
  .auth-panel .mark { margin-bottom: 20px; }
  .auth-form { align-items: flex-start; padding: 32px 24px 60px; }
}

/* ============================================================== editor */
/*
 * Light controls, dark stage. The canvas ground is dark; surrounding it with
 * white makes simultaneous contrast read it as lighter and flatter than it
 * will be on a phone. A dark stage removes the illusion (docs/ROADMAP.md A1).
 */

.editor {
  display: grid; grid-template-columns: minmax(360px, 460px) 1fr;
  min-height: calc(100vh - var(--topbar-h));
}

.editor-panel { padding: 30px 30px 90px; min-width: 0; }
.editor-panel .switcher { border-bottom: 1px solid var(--border); padding-bottom: 6px; margin-bottom: 24px; }
.editor-panel .panel-block { border-top: 1px solid var(--border); margin-top: 30px; padding-top: 24px; }
.editor-panel h2 { margin-top: 0; font-size: 15px; }

/* Inset and rounded, so it reads as a panel the artwork sits on rather than a
   slab butted against the header — which is what made the top-left corner
   look like a notch. */
.editor-stage {
  background: var(--stage); color: var(--stage-fg);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 28px; gap: 16px; position: sticky; top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h) - 28px);
  margin: 14px 14px 14px 0; border-radius: 16px;
  border: 1px solid var(--stage-border);
}
.canvas-frame {
  display: flex; align-items: center; justify-content: center;
  width: 100%; flex: 1 1 0; min-height: 0;
}
.canvas-frame canvas {
  /* Belt and braces — the renderer sets these too. Inherited text properties
     leak into canvas text metrics and would alter the exported artwork. */
  letter-spacing: normal; word-spacing: normal; font-kerning: auto;
  display: block; max-width: 100%; height: auto;
  border-radius: 14px; border: 1px solid var(--ink-border);
  box-shadow: 0 24px 60px rgba(0, 0, 0, .45);
}

.stage-bar {
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap; justify-content: center;
  color: var(--stage-muted); font-size: 13px;
}
.stage-bar label { display: inline-flex; align-items: center; gap: 8px; margin: 0; color: var(--stage-muted); font-weight: 400; }
.stage-bar input[type=checkbox] { accent-color: var(--accent); width: auto; }

.thumbs { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.thumb {
  width: 50px; height: 89px; border-radius: 8px; border: 1px solid var(--border-strong);
  background: var(--surface) center/cover no-repeat; cursor: pointer; padding: 0;
}
.thumb:hover { border-color: var(--muted); }
.thumb.on { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.thumb.none { display: grid; place-items: center; color: var(--muted); font-size: 10.5px; }

.variants { display: grid; gap: 10px; margin-top: 14px; }
.variant {
  text-align: left; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 13px 15px; font: inherit; color: var(--fg); cursor: pointer;
}
.variant:hover { border-color: var(--primary); }
.variant dl { margin: 0; }
.variant dt { font-size: 11.5px; color: var(--muted); margin-bottom: 2px; }
.variant dd { margin: 0 0 9px; font-size: 14.5px; }
.variant dd:last-child { margin-bottom: 0; }

.spinner { color: var(--muted); font-size: 13px; }

/* Editor on mobile: a segmented control, not a second hamburger. Both panes
   are content, so the choice between them stays visible. */
.editor-tabs { display: none; }
.editor-actions-bar { display: none; }

@media (max-width: 940px) {
  .editor { grid-template-columns: 1fr; min-height: 0; }
  .editor-panel { padding: 20px 22px 96px; }
  .editor-stage {
    position: static; height: auto; padding: 22px 18px 96px;
    min-height: 60vh; justify-content: flex-start;
    margin: 0 14px 14px; border-radius: 14px;
  }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .container { padding: 30px 22px 90px; }
  h1 { font-size: 25px; }

  .editor-tabs {
    display: grid; grid-template-columns: 1fr 1fr; gap: 3px;
    position: sticky; top: var(--topbar-h); z-index: 30;
    background: var(--surface); padding: 3px; margin: 0;
    border-bottom: 1px solid var(--border);
  }
  .editor-tabs button {
    border: 0; background: none; border-radius: 8px; padding: 9px;
    font: inherit; font-size: 14px; font-weight: 500; color: var(--muted); cursor: pointer;
  }
  .editor-tabs button[aria-selected="true"] { background: var(--bg); color: var(--fg); }

  /* Primary actions sit at thumb height rather than at the end of a long form. */
  .editor-actions-bar {
    display: flex; gap: 10px; align-items: center;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 35;
    padding: 12px 22px calc(12px + env(safe-area-inset-bottom));
    background: rgba(255, 255, 255, .9); backdrop-filter: saturate(180%) blur(20px);
    border-top: 1px solid var(--border);
  }
  .editor-panel .actions.desktop-only { display: none; }

  /* One pane at a time on a phone; the segmented control chooses. */
  .editor.show-preview .editor-panel { display: none; }
  .editor.show-edit .editor-stage { display: none; }

  /* Give the preview a definite height so the canvas can be fitted to it:
     viewport, less the topbar, the segmented control and the action bar. */
  .editor.show-preview .editor-stage {
    height: calc(100dvh - var(--topbar-h) - 44px - 66px - 28px);
    min-height: 340px; justify-content: center; padding: 16px 18px 10px;
  }
}

@media (max-width: 620px) {
  .topbar { padding: 0 18px; }
  .topbar nav { display: none; }
  .burger { display: grid; }
  .container { padding: 26px 18px 80px; }
}

/* ================================================================= tables */

.table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.table td, .table th { padding: 13px 20px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table th { font-size: 12.5px; font-weight: 500; color: var(--muted); }
.table .meta { color: var(--muted); font-size: 13.5px; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.inline-form { display: inline; }
.inline-form select { width: auto; min-width: 118px; padding: 7px 30px 7px 11px; font-size: 13.5px; }

.share-form { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
@media (max-width: 620px) {
  .share-form { align-items: stretch; }
  .share-form .btn { width: 100%; }
  .table td, .table th { padding: 11px 14px; }
}

/* ================================================================== admin */

.admin-nav { display: flex; gap: 6px; margin: 0 0 30px; border-bottom: 1px solid var(--border); }
.admin-nav a {
  padding: 9px 14px; color: var(--muted); font-size: 14.5px;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.admin-nav a:hover { color: var(--fg); text-decoration: none; }
.admin-nav a.on { color: var(--primary); border-bottom-color: var(--primary); }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(184px, 1fr)); gap: 14px; margin-bottom: 12px; }
.stat { border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; background: var(--surface-2); }
.stat .k { margin: 0 0 8px; font-size: 12.5px; color: var(--muted); }
.stat .v { margin: 0; font-size: 27px; font-weight: 600; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.stat .s { margin: 6px 0 0; font-size: 12.5px; color: var(--muted); }

/* A plain CSS bar chart — 30 columns needs no charting library. */
.bars { display: flex; align-items: flex-end; gap: 3px; height: 168px; }
.bar-col { flex: 1; height: 100%; display: flex; align-items: flex-end; }
.bar { width: 100%; background: var(--primary); border-radius: 3px 3px 0 0; min-height: 2px; }
.bar-col:hover .bar { background: var(--primary-hover); }
.bars-axis { display: flex; justify-content: space-between; margin-top: 10px; font-size: 12px; color: var(--muted); }

.marks { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 240px)); gap: 16px; }
.mark-choice {
  display: grid; justify-items: center; gap: 14px; cursor: pointer;
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 28px 20px 20px; background: var(--bg); margin: 0;
  font-weight: 400; transition: border-color .12s;
}
.mark-choice:hover { border-color: var(--border-strong); }
.mark-choice.on { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.mark-choice input { position: absolute; opacity: 0; pointer-events: none; }
.mark-choice .preview { color: var(--primary); }
.mark-choice .preview .mark-dot { background: var(--primary); border-radius: 50%; display: block; }
.mark-choice .lockup-sample {
  display: inline-flex; align-items: center; gap: 9px;
  font-size: 17px; font-weight: 600; letter-spacing: -0.02em; color: var(--fg);
}
.mark-choice .lockup-sample .mark-glyph { color: var(--primary); }
.mark-choice .lockup-sample .mark-dot { background: var(--primary); border-radius: 50%; display: inline-block; }
.mark-choice .name { font-size: 13px; color: var(--muted); }

/* ============================================================ format picker */

.picker-formats { display: flex; gap: 34px; flex-wrap: wrap; margin-bottom: 22px; }
.picker-group-name {
  margin: 0 0 9px; font-size: 12px; font-weight: 600; color: var(--muted);
  letter-spacing: 0.02em;
}
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  display: flex; flex-direction: column; gap: 2px; align-items: flex-start;
  background: var(--bg); border: 1px solid var(--border-strong);
  border-radius: 10px; padding: 8px 14px; font: inherit; font-size: 14px;
  color: var(--fg); cursor: pointer; transition: border-color .12s, background .12s;
}
.chip:hover { border-color: var(--muted); }
.chip.on { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
.chip .dims { font-family: var(--mono); font-size: 10.5px; color: var(--muted); }
.chip.on .dims { color: var(--primary); opacity: .75; }

/* =============================================================== sequences */

.title-form { display: flex; gap: 10px; align-items: center; margin-bottom: 6px; }
.title-input {
  font-size: 28px; font-weight: 600; letter-spacing: -0.025em;
  border: 1px solid transparent; border-radius: 8px; padding: 4px 8px;
  margin-left: -8px; background: transparent; max-width: 640px;
}
.title-input:hover { border-color: var(--border); }

.pages {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px; margin-top: 28px; align-items: start;
}
.page {
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--bg); overflow: hidden;
}
.page-stage {
  background: var(--stage); padding: 14px; display: flex;
  align-items: center; justify-content: center; min-height: 150px;
}
.page-stage canvas {
  max-width: 100%; max-height: 300px; width: auto; height: auto; display: block;
  border-radius: 5px; letter-spacing: normal; word-spacing: normal;
}
.page-meta { padding: 12px 14px 0; }
.page-n { margin: 0; font-size: 11.5px; color: var(--muted); font-weight: 500; }
.page-title { margin: 3px 0 0; font-size: 14px; font-weight: 500; }
.page-actions { display: flex; gap: 5px; padding: 12px 14px 14px; flex-wrap: wrap; align-items: center; }
.page-actions .btn { padding: 6px 10px; font-size: 12.5px; }
.page-actions form { display: inline; }

.add-page { padding: 16px; display: grid; gap: 7px; align-content: start; background: var(--surface-2); }
.add-page .page-n { margin-bottom: 6px; }
.add-page form { display: block; }
.btn.block { width: 100%; }

.presets { margin-top: 26px; }
.presets .picker-group-name { margin-bottom: 12px; }

.page-strip { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 20px; }
.page-chip {
  min-width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--border-strong); border-radius: 8px; padding: 0 9px;
  font-size: 13px; font-weight: 500; color: var(--muted); text-decoration: none;
}
.page-chip:hover { color: var(--fg); border-color: var(--muted); text-decoration: none; }
.page-chip.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.page-chip.all { color: var(--primary); border-style: dashed; }

.photo-form { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.photo-current { display: flex; gap: 14px; align-items: center; margin-bottom: 18px; }
.photo-current img {
  width: 96px; height: 96px; object-fit: cover; border-radius: 9px;
  border: 1px solid var(--border);
}
input[type=range] { width: 100%; accent-color: var(--primary); }

/* ================================================================= gallery */

.filters { margin: 0 0 26px; }
.chip.small { padding: 6px 12px; font-size: 13px; flex-direction: row; gap: 7px; align-items: center; }
.chip.small .dims { font-size: 11px; }

.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 18px; }
.shot { margin: 0; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--bg); }
.shot > a { display: block; background: var(--stage); }
.shot img { display: block; width: 100%; height: auto; max-height: 340px; object-fit: contain; }
.shot figcaption { padding: 13px 15px 15px; }
.shot-title { margin: 0 0 4px; font-size: 14.5px; font-weight: 500; }
.shot-actions { display: flex; gap: 6px; align-items: center; margin-top: 11px; }
.shot-actions form { display: inline; }

/* =========================================================== meters, models */

.meter { margin-bottom: 18px; }
.meter:last-child { margin-bottom: 0; }
.meter-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 7px; font-size: 13.5px; }
.meter-value { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 13px; }
.meter-track { height: 7px; background: var(--surface); border-radius: 4px; overflow: hidden; }
.meter-fill { height: 100%; background: var(--primary); border-radius: 4px; }
.meter-note { margin: 6px 0 0; font-size: 12px; color: var(--muted); }

.models { display: grid; gap: 6px; }
.model-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(232px, 1fr)); gap: 12px; margin-bottom: 18px; }
.model-choice {
  display: grid; gap: 5px; align-content: start; cursor: pointer; margin: 0;
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 15px 16px; background: var(--bg); font-weight: 400;
  transition: border-color .12s;
}
.model-choice:hover { border-color: var(--border-strong); }
.model-choice.on { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.model-choice.locked { opacity: .55; cursor: not-allowed; }
.model-choice input { position: absolute; opacity: 0; pointer-events: none; }
.model-name { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
.model-price { font-size: 12.5px; color: var(--fg); font-variant-numeric: tabular-nums; }
.model-price .per { color: var(--muted); display: block; font-size: 11.5px; }
.model-asset { font-size: 12.5px; color: var(--primary); font-weight: 500; }
.model-note { font-size: 12.5px; color: var(--muted); line-height: 1.45; margin-top: 3px; }

/* ================================================== avatar / account menu */

.avatar {
  display: inline-grid; place-items: center; border-radius: 50%;
  object-fit: cover; flex: 0 0 auto; overflow: hidden;
}
.avatar-initials { color: #fff; font-weight: 600; letter-spacing: 0.01em; line-height: 1; }

.account { position: relative; }
.account-button {
  display: grid; place-items: center; padding: 0; border: 0; background: none;
  cursor: pointer; border-radius: 50%;
}
.account-button:hover .avatar { box-shadow: 0 0 0 3px var(--primary-soft); }
.account-button[aria-expanded="true"] .avatar { box-shadow: 0 0 0 3px var(--primary-soft); }

.account-menu {
  position: absolute; right: 0; top: calc(100% + 10px); z-index: 60;
  width: 252px; background: var(--bg);
  border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 14px 38px rgba(16, 16, 20, .14); padding: 0; overflow: hidden;
}

.account-head { display: flex; gap: 11px; align-items: center; padding: 13px 14px; }
.account-who { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.account-name { font-size: 14px; font-weight: 600; }
/* Truncated rather than broken mid-word: a padded panel is not the place to
   discover how long somebody's address is. The whole of it is in the title. */
.account-email {
  font-size: 12.5px; color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Groups, divided edge to edge. A rule that stops short of the sides reads as
   a mistake rather than as a separation. */
.account-group { border-top: 1px solid var(--border); padding: 5px; }

.account-menu a, .account-menu .menu-signout {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  width: 100%; text-align: left; padding: 8px 9px; border-radius: 8px;
  font: inherit; font-size: 13.5px; color: var(--fg);
  background: none; border: 0; cursor: pointer; text-decoration: none;
}
.account-menu a:hover, .account-menu .menu-signout:hover {
  background: var(--surface); text-decoration: none;
}
.account-menu a:focus-visible, .account-menu .menu-signout:focus-visible {
  outline: 2px solid var(--primary); outline-offset: -2px;
}
/* Signing out is a normal thing to do, not a disabled one — grey text read as
   unavailable. It gets its own group instead. */
.account-menu .menu-signout:hover { background: var(--surface); color: var(--danger); }

.account-badge {
  font-size: 9.5px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase;
  color: var(--muted); background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 999px; padding: 2px 7px;
}

.drawer-who { display: flex; gap: 10px; align-items: center; padding: 16px 0 0; color: var(--muted); font-size: 13px; }

.profile-row { display: flex; gap: 22px; align-items: flex-start; flex-wrap: wrap; }
.profile-fields { flex: 1 1 320px; }
.profile-row .avatar { border: 1px solid var(--border); }

/* ================================================= sequence: write and edit */

.brief-card { border-color: var(--border-strong); }
.brief-row { display: flex; gap: 12px; align-items: flex-start; }
.brief-row textarea { flex: 1; min-height: 58px; }
.brief-row .btn { flex: 0 0 auto; }

.proposal { margin-top: 18px; border-top: 1px solid var(--border); padding-top: 16px; }
.proposal-head { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.proposal-head p { margin: 0; font-size: 13.5px; color: var(--muted); }
.proposal-head div { display: flex; gap: 8px; }
.proposal-pages { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.proposal-page { background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; }
.proposal-line { margin: 5px 0 0; font-size: 13.5px; line-height: 1.45; }
.proposal-page .page-n { margin-bottom: 4px; }

.reformat { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 14px; }
.reformat label { margin: 0; font-size: 13px; color: var(--muted); }
.reformat select { width: auto; min-width: 170px; padding: 8px 30px 8px 11px; font-size: 13.5px; }

.pages { grid-template-columns: repeat(auto-fill, minmax(268px, 1fr)); }
.page-body { padding: 13px 15px 0; }
.page-body .field.compact { margin-bottom: 11px; }
.page-body .field.compact label { font-size: 12px; margin-bottom: 5px; }
.page-body .field.compact input, .page-body .field.compact textarea {
  padding: 8px 10px; font-size: 13.5px; border-radius: 8px;
}
.page-body .field.compact textarea { min-height: 52px; }
.page-status { min-height: 16px; margin: 0 0 4px; font-size: 11.5px; }

.chip.small.toggle { cursor: pointer; font-weight: 400; margin: 0; gap: 8px; }
.chip.small.toggle input { width: auto; accent-color: var(--primary); margin: 0; }
.chip.small.toggle:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
.reformat { display: block; }
.reformat .chips { margin-bottom: 12px; }

.contrast { margin-top: 26px; }
.contrast-table { font-size: 13.5px; }
.contrast-table td { padding: 9px 0; border-color: var(--border); }
.contrast-table tr.warn td { color: var(--danger); }
.contrast-table tr.warn td.meta { color: var(--danger); }
.contrast-swatch {
  display: inline-grid; place-items: center; width: 34px; height: 24px;
  border-radius: 6px; font-size: 12px; font-weight: 600; margin-right: 11px;
  vertical-align: middle; border: 1px solid rgba(0,0,0,.08);
}
.contrast.has-warning .picker-group-name { color: var(--danger); }

@media (max-width: 620px) {
  .brief-row { flex-direction: column; }
  .brief-row .btn { width: 100%; }
  .proposal-head { align-items: flex-start; }
  .proposal-head div { width: 100%; }
  .proposal-head .btn { flex: 1; }
}

/* =========================================================== brand switcher */

.brand-switch { position: relative; }
.brand-button {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid transparent; border-radius: 9px;
  padding: 6px 11px; font: inherit; font-size: 13.5px; font-weight: 500;
  color: var(--fg); cursor: pointer; max-width: 260px;
}
.brand-button:hover { border-color: var(--border-strong); }
.brand-button[aria-expanded="true"] { border-color: var(--primary); background: var(--primary-soft); }
.brand-current { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand-caret { color: var(--muted); font-size: 10px; }
.brand-dot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto; }

.brand-menu {
  position: absolute; left: 0; top: calc(100% + 9px); z-index: 60;
  min-width: 248px; background: var(--bg);
  border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 12px 34px rgba(0, 0, 0, .12); padding: 6px;
}
.menu-label {
  margin: 4px 10px 6px; font-size: 11.5px; font-weight: 600;
  color: var(--muted); letter-spacing: 0.02em;
}
.menu-divider { height: 1px; background: var(--border); margin: 6px 0; }
.brand-menu a {
  display: flex; align-items: center; gap: 9px; padding: 9px 10px;
  border-radius: 8px; font-size: 14px; color: var(--fg);
}
.brand-menu a:hover { background: var(--surface); text-decoration: none; }
.brand-option.on { background: var(--primary-soft); color: var(--primary); font-weight: 500; }
.brand-option-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand-option-note { margin-left: auto; font-size: 11.5px; color: var(--muted); }

@media (max-width: 860px) { .brand-current { display: none; } .brand-button { padding: 7px 9px; } }

/* ============================================================ image library */

.asset-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(62px, 1fr)); gap: 7px; }
.asset-thumb {
  padding: 0; border: 1px solid var(--border); border-radius: 8px; overflow: hidden;
  background: var(--surface); cursor: pointer; aspect-ratio: 1; display: block;
}
.asset-thumb:hover { border-color: var(--primary); }
.asset-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-current > div { min-width: 0; }

/* ============================================================ explore layouts */

.explore { border-color: var(--border-strong); }
.explore-controls { display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap; }

.candidates {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 18px; margin-top: 22px;
}
.candidate { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--bg); }
.candidate-stage {
  background: var(--stage); padding: 14px; display: flex;
  align-items: center; justify-content: center; min-height: 160px;
}
.candidate-stage canvas {
  max-width: 100%; max-height: 320px; width: auto; height: auto; display: block;
  border-radius: 5px; letter-spacing: normal; word-spacing: normal;
}
.candidate-body { padding: 13px 15px 15px; }
.candidate-name {
  width: 100%; font-size: 14.5px; font-weight: 600; padding: 7px 9px;
  border: 1px solid transparent; border-radius: 8px; background: transparent; margin-left: -9px;
}
.candidate-name:hover { border-color: var(--border); }
.candidate-actions { display: flex; gap: 8px; align-items: center; margin-top: 11px; }
.candidate-role { width: auto; flex: 1; padding: 7px 28px 7px 10px; font-size: 13px; }
.candidate-status { min-height: 16px; margin: 8px 0 0; font-size: 12px; }

@media (max-width: 620px) {
  .explore-controls { flex-direction: column; align-items: stretch; }
  .explore-controls .btn { width: 100%; }
}

/* Choosing images for a brand out of the library. */
.asset-pick { position: relative; display: block; margin: 0; cursor: pointer; aspect-ratio: 1; }
.asset-pick input { position: absolute; top: 6px; left: 6px; z-index: 1; accent-color: var(--primary); width: auto; }
.asset-pick img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  border: 1px solid var(--border); border-radius: 8px; transition: border-color .12s, opacity .12s;
  opacity: .72;
}
.asset-pick:hover img { opacity: 1; }
.asset-pick:has(input:checked) img { border-color: var(--primary); opacity: 1; box-shadow: 0 0 0 3px var(--primary-soft); }

/* "All brands" is a state, not an absence — it gets its own mark. */
.brand-dot.all {
  background: none;
  border: 1.5px dashed var(--muted);
  box-sizing: border-box;
}
.brand-option.on .brand-dot.all { border-color: var(--primary); }

/* ================================================================== toasts */

.toasts {
  position: fixed; top: calc(var(--topbar-h) + 14px); right: 20px; z-index: 80;
  display: flex; flex-direction: column; gap: 9px;
  pointer-events: none; max-width: min(380px, calc(100vw - 40px));
}
.toast {
  display: flex; align-items: flex-start; gap: 12px;
  background: var(--bg); border: 1px solid var(--border);
  border-left: 3px solid var(--primary); border-radius: 10px;
  padding: 12px 12px 12px 14px; font-size: 14px; line-height: 1.45;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .13);
  pointer-events: auto;
  opacity: 0; transform: translateY(-6px) scale(.98);
  transition: opacity .18s ease, transform .18s cubic-bezier(.32, .72, 0, 1);
}
.toast.in { opacity: 1; transform: none; }
.toast.alert { border-left-color: var(--danger); }
.toast-text { flex: 1; min-width: 0; }
.toast-close {
  flex: 0 0 auto; background: none; border: 0; padding: 0 2px; margin: -2px 0 0;
  font-size: 19px; line-height: 1; color: var(--muted); cursor: pointer;
}
.toast-close:hover { color: var(--fg); }

@media (prefers-reduced-motion: reduce) {
  .toast { transition: opacity .18s ease; transform: none; }
  .toast.in { transform: none; }
}

@media (max-width: 620px) {
  .toasts { left: 14px; right: 14px; max-width: none; top: calc(var(--topbar-h) + 10px); }
}

/* ================================================================ feedback */

.rater {
  border-top: 1px solid var(--border); margin-top: 14px; padding-top: 12px;
}
.rater-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.rater-question { font-size: 12.5px; color: var(--muted); }
.rater-scale { display: inline-flex; gap: 2px; }
.rater-dot {
  width: 22px; height: 22px; padding: 0; border-radius: 6px;
  border: 1px solid var(--border); background: var(--bg);
  font: inherit; font-size: 10.5px; color: var(--muted); cursor: pointer;
  font-variant-numeric: tabular-nums; transition: background .1s, border-color .1s, color .1s;
}
.rater-dot:hover { border-color: var(--muted); color: var(--fg); }
.rater-dot.zero { color: var(--muted); }
.rater-dot.within { background: var(--primary-soft); border-color: var(--primary-soft); color: var(--primary); }
.rater-dot.on { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }
.rater-body { margin-top: 10px; }
.rater-body textarea { min-height: 58px; font-size: 14px; }
.rater-actions { display: flex; gap: 8px; align-items: center; margin-top: 8px; }
.rater-done { font-size: 12.5px; color: var(--primary); font-weight: 500; }

.score { font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }
.score.up { color: var(--primary); }
.score.down { color: var(--danger); }
.score.flat { color: var(--muted); }

/* ================================================================ composer */

.composer { border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; background: var(--surface-2); }
.composer-kinds { margin-bottom: 20px; }
.kind-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 9px; margin-bottom: 16px; }
.kind {
  display: grid; gap: 3px; text-align: left;
  background: var(--bg); border: 1px solid var(--border-strong); border-radius: 10px;
  padding: 11px 13px; color: var(--fg);
  transition: border-color .12s, background .12s;
}
.kind:hover { border-color: var(--muted); }
.kind.on { border-color: var(--primary); background: var(--primary-soft); }
.kind-hit {
  background: none; border: 0; padding: 0; margin: 0; font: inherit;
  color: inherit; text-align: left; cursor: pointer; width: 100%;
}
/* The count is the decision, so it is edited where the decision is read. */
.kind-count {
  width: 2.6em; padding: 1px 3px; margin: 0 1px 0 0;
  border: 1px solid transparent; border-radius: 5px; background: transparent;
  font: inherit; font-size: 11.5px; font-variant-numeric: tabular-nums;
  color: var(--fg); text-align: center; -moz-appearance: textfield;
}
.kind-count::-webkit-outer-spin-button,
.kind-count::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.kind-count:hover { border-color: var(--border-strong); }
.kind-count:focus { outline: none; border-color: var(--primary); background: var(--bg); }
.kind.on .kind-count { color: var(--primary); font-weight: 600; }
.kind-name { font-size: 14.5px; font-weight: 600; letter-spacing: -0.01em; }
.kind-meta {
  font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums;
  display: flex; align-items: center; gap: 3px;
}
.kind.on .kind-meta { color: var(--primary); opacity: .8; }

.from-scratch { margin-top: 20px; }
.from-scratch summary {
  cursor: pointer; font-size: 14px; color: var(--muted); padding: 6px 0;
  list-style: none;
}
.from-scratch summary::-webkit-details-marker { display: none; }
.from-scratch summary::before { content: "▸ "; font-size: 11px; }
.from-scratch[open] summary::before { content: "▾ "; }
.from-scratch summary:hover { color: var(--fg); }
.from-scratch > *:not(summary) { margin-top: 16px; }

/* ================================================================ reformat */

.reformat { border-top: 1px solid var(--border); margin-top: 20px; padding-top: 18px; }
.reformat-options { display: grid; grid-template-columns: repeat(auto-fill, minmax(268px, 1fr)); gap: 10px; }
.reformat-option {
  display: flex; gap: 10px; align-items: flex-start; margin: 0; cursor: pointer;
  border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px;
  background: var(--bg); font-weight: 400; transition: border-color .12s;
}
.reformat-option:hover { border-color: var(--border-strong); }
.reformat-option:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.reformat-option input { width: auto; margin: 2px 0 0; accent-color: var(--primary); flex: 0 0 auto; }
.reformat-body { display: grid; gap: 2px; min-width: 0; }
.reformat-name { font-size: 14.5px; font-weight: 600; letter-spacing: -0.01em; }
.reformat-meta { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.reformat-warn { font-size: 12px; color: var(--danger); margin-top: 2px; }

/* =================================================================== guide */

.stage-map { list-style: none; margin: 0 0 30px; padding: 0; display: grid; gap: 2px; }
.stage-map a {
  display: grid; grid-template-columns: 26px 1fr 110px 44px; gap: 14px; align-items: center;
  padding: 11px 12px; border-radius: 9px; color: var(--fg); font-size: 14.5px;
}
.stage-map a:hover { background: var(--surface); text-decoration: none; }
.stage-map-num {
  width: 24px; height: 24px; border-radius: 50%; background: var(--surface);
  display: grid; place-items: center; font-size: 12px; font-weight: 600; color: var(--muted);
}
.stage-map-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stage-map-bar { height: 5px; background: var(--surface); border-radius: 3px; overflow: hidden; }
.stage-map-bar span { display: block; height: 100%; background: var(--primary); border-radius: 3px; }
.stage-map-score { font-size: 12.5px; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }

.callout {
  border: 1px solid var(--border); border-left: 3px solid var(--primary);
  border-radius: 10px; padding: 15px 18px; background: var(--surface-2); margin-bottom: 38px;
}
.callout p { margin: 0; font-size: 14.5px; line-height: 1.55; }

.stage { border-top: 1px solid var(--border); padding-top: 30px; margin-top: 38px; scroll-margin-top: 80px; }
.stage-number {
  margin: 0 0 6px; font-size: 11.5px; font-weight: 600; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--primary);
}
.stage-name { font-size: 23px; font-weight: 600; letter-spacing: -0.02em; margin: 0 0 8px; }
.stage-goal { margin: 0 0 20px; color: var(--muted); font-size: 15.5px; }
.stage h3 { font-size: 13px; font-weight: 600; margin: 28px 0 12px; color: var(--muted); }

.stage-why p { margin: 0 0 14px; font-size: 15px; line-height: 1.62; max-width: 66ch; }
.stage-why p:last-child { margin-bottom: 0; }

.stage-actions { margin: 0; padding-left: 20px; max-width: 66ch; }
.stage-actions li { margin-bottom: 7px; font-size: 14.5px; line-height: 1.5; }

.checks, .gaps { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.check, .gap {
  display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: start;
  padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg);
}
.check-mark {
  width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center;
  font-size: 12px; font-weight: 700; flex: 0 0 auto;
}
.check.done .check-mark { background: var(--primary-soft); color: var(--primary); }
.check.warn .check-mark { background: #FDF0E6; color: #A85B18; }
.check.todo .check-mark { background: var(--surface); color: var(--muted); }
.check.unknown .check-mark { background: var(--surface); color: var(--muted); }
.check.done { border-color: var(--border); }
.check.warn { border-color: #F0DCC8; }
.check-body { display: grid; gap: 3px; min-width: 0; }
.check-label { font-size: 14.5px; }
.check-detail { font-size: 13px; color: var(--muted); line-height: 1.5; }

.gap-severity {
  font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
  /* Sized to its content: this holds "medium" in one list and "4" in another. */
  min-width: 22px; height: 20px; padding: 0 6px; border-radius: 6px;
  display: inline-grid; place-items: center; white-space: nowrap;
}
.gap.high .gap-severity { background: #FBE9E7; color: var(--danger); }
.gap.medium .gap-severity { background: #FDF0E6; color: #A85B18; }
.gap.low .gap-severity { background: var(--surface); color: var(--muted); }
.gap.high { border-color: #F3D6D2; }
.gap-body { display: grid; gap: 4px; min-width: 0; }
.gap-title { font-size: 14.5px; font-weight: 500; }
.gap-detail { font-size: 13.5px; color: var(--muted); line-height: 1.55; max-width: 68ch; }

@media (max-width: 620px) {
  .stage-map a { grid-template-columns: 24px 1fr 44px; }
  .stage-map-bar { display: none; }
  .stage-name { font-size: 20px; }
}

.guide-brand { display: flex; align-items: center; gap: 10px; margin: -12px 0 26px; }
.guide-brand .field-hint { margin: 0; }

.composer-row { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; align-items: flex-start; }
.composer-row .field-hint { margin-top: 6px; }
@media (max-width: 620px) { .composer-row { flex-direction: column; } .composer-row .field { width: 100%; flex: none !important; } }

/* ==================================================================== looks */

.look-block { border-top: 1px solid var(--border); margin-top: 20px; padding-top: 18px; }
.look-picker .picker-group-name { display: block; margin-bottom: 9px; }
.looks { display: flex; gap: 8px; flex-wrap: wrap; }
.look {
  display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto;
  gap: 1px 8px; align-items: center; text-align: left;
  background: var(--bg); border: 1px solid var(--border-strong); border-radius: 10px;
  padding: 8px 12px; font: inherit; cursor: pointer; color: var(--fg);
  transition: border-color .12s, background .12s;
}
.look:hover { border-color: var(--muted); }
.look.on { border-color: var(--primary); background: var(--primary-soft); }
.look-swatch { grid-row: span 2; width: 14px; height: 14px; border-radius: 4px; border: 1px solid rgba(0,0,0,.1); }
.look-name { font-size: 13.5px; font-weight: 500; }
.look-ground { font-size: 10.5px; color: var(--muted); }
.look.on .look-ground { color: var(--primary); opacity: .8; }

.stock-search { display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap; }
@media (max-width: 620px) { .stock-search { align-items: stretch; } .stock-search .btn { width: 100%; } }

/* ================================================================= working */

.working-bar {
  display: flex; align-items: center; gap: 10px;
  border: 1px solid var(--border); border-left: 3px solid var(--primary);
  border-radius: 10px; padding: 11px 14px; margin-bottom: 18px;
  background: var(--surface-2); font-size: 14px;
}
.working-bar.failed { border-left-color: var(--danger); }
.working-dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--primary);
  flex: 0 0 auto; animation: pulse 1.1s ease-in-out infinite;
}
.working-bar.failed .working-dot { background: var(--danger); animation: none; }
@keyframes pulse { 0%, 100% { opacity: .3; } 50% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .working-dot { animation: none; } }

/* A page that is waiting shows its own placeholders rather than nothing. */
.page.pending .page-stage, .candidate.pending .candidate-stage { position: relative; }
.page.pending .page-stage::after, .candidate.pending .candidate-stage::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit;
  background: linear-gradient(100deg, transparent 20%, rgba(255,255,255,.05) 50%, transparent 80%);
  background-size: 220% 100%; animation: sweep 1.4s linear infinite;
}
@keyframes sweep { to { background-position: -220% 0; } }
@media (prefers-reduced-motion: reduce) { .page.pending .page-stage::after { animation: none; } }


/* ---------------------------------------------------------------- coaching */

.notes { display: flex; flex-direction: column; gap: 12px; margin-top: 14px; }
.note {
  border: 1px solid var(--border); border-left-width: 3px; border-left-color: var(--primary);
  border-radius: var(--radius); padding: 15px 17px; background: var(--surface-2);
}
.note-head { display: flex; justify-content: space-between; gap: 14px; align-items: baseline; }
.note-head .title { margin: 0; font-size: 15px; font-weight: 600; }
/* The numbers, then what to do about them. Never one without the other: an
   observation with no change attached is a complaint. */
.note-evidence { margin: 8px 0 0; font-size: 13.5px; color: var(--muted); }
.note-change { margin: 9px 0 0; font-size: 14px; max-width: 76ch; }
.note .left-action { display: inline-block; margin-top: 10px; }

/* ---------------------------------------------------------------- playbook */

.playbook-versions { display: flex; gap: 4px; flex: 0 0 auto; }
.playbook-version {
  padding: 6px 13px; border: 1px solid var(--border); border-radius: 999px;
  font-size: 13px; color: var(--muted); text-decoration: none;
}
.playbook-version:hover { color: var(--fg); text-decoration: none; }
.playbook-version.on { background: var(--primary); border-color: var(--primary); color: #fff; }

.chapter { margin-bottom: 12px; }
.chapter-number {
  display: inline-grid; place-items: center; width: 26px; height: 26px;
  border-radius: 50%; background: var(--surface); color: var(--muted);
  font-size: 13px; font-weight: 600; margin-right: 8px; vertical-align: 2px;
}
.chapter-body { max-width: 74ch; font-size: 15px; line-height: 1.68; }
.chapter-body p { margin: 0 0 14px; }
.chapter-body ul, .chapter-body ol { margin: 0 0 14px; padding-left: 22px; }
.chapter-body li { margin-bottom: 7px; }
.chapter-body blockquote {
  margin: 0 0 14px; padding: 12px 18px; border-left: 3px solid var(--primary);
  background: var(--surface-2); border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-style: italic;
}

.shot { margin: 6px 0 26px; }
.shot img {
  width: 100%; display: block; border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: 0 6px 20px rgba(16, 16, 20, .06);
}
.shot figcaption {
  margin-top: 9px; font-size: 12.5px; color: var(--muted);
  display: flex; gap: 10px; justify-content: space-between; flex-wrap: wrap;
}
.shot-missing {
  border: 1px dashed var(--border-strong); border-radius: var(--radius);
  padding: 26px; text-align: center; color: var(--muted); font-size: 13px;
}

.gaps { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.gap {
  border: 1px solid var(--border); border-left-width: 3px;
  border-radius: var(--radius); padding: 14px 16px; background: var(--surface-2);
}
.gap.is-blocks { border-left-color: var(--danger); }
.gap.is-worth_doing { border-left-color: var(--warning, #F59F0A); }
.gap.is-nice { border-left-color: var(--border-strong); }
.gap.done { opacity: .55; }
.gap.done .title { text-decoration: line-through; }
.gap-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; }
.gap-head .title { margin: 0 0 2px; font-weight: 500; }
.gap-detail { margin: 9px 0 0; font-size: 13.5px; max-width: 76ch; }
.gap-states { display: flex; flex: 0 0 auto; }
.gap-states form { display: inline; }
.gap-states .state {
  border: 1px solid var(--border); background: var(--bg); color: var(--muted);
  font: inherit; font-size: 11.5px; padding: 5px 10px; cursor: pointer;
  margin-left: -1px; white-space: nowrap;
}
.gap-states form:first-child .state { border-radius: 7px 0 0 7px; margin-left: 0; }
.gap-states form:last-child .state { border-radius: 0 7px 7px 0; }
.gap-states .state.on { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ------------------------------------------------------------------ offers */

.offers { display: grid; gap: 12px; }
.offer {
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 15px 17px; background: var(--bg);
}
.offer.is-paused, .offer.is-retired { background: var(--surface-2); }
.offer.is-retired .title, .offer.is-retired .offer-promise { color: var(--muted); }
.offer-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; }
.offer-head .title { margin: 0; font-weight: 600; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.offer-head .meta { margin: 3px 0 0; }
.offer-price { color: var(--muted); font-weight: 400; font-size: 13px; }
.offer-promise { margin: 9px 0 0; max-width: 62ch; }
.offer-results { display: flex; gap: 22px; margin-top: 13px; }
.offer-results div { display: flex; align-items: baseline; gap: 6px; }
.offer-results strong { font-size: 15px; font-variant-numeric: tabular-nums; }
.offer-results span { color: var(--muted); font-size: 12.5px; }
.offer .warn-text { margin-top: 10px; max-width: 60ch; }

.offer-items { border: 0; border-top: 1px solid var(--border); padding: 14px 0 0; margin: 16px 0 0; }
.offer-items legend { padding: 0; font-size: 13px; color: var(--muted); }
.offer-item-row { display: flex; gap: 8px; align-items: center; margin-bottom: 7px; }
.offer-item-row input[type=text] { margin: 0; }
.offer-item-row input[type=text]:nth-child(2) { flex: 2 1 0; }
.offer-item-row input[type=text]:nth-child(1),
.offer-item-row input[type=text]:nth-child(3) { flex: 1 1 0; }
.offer-item-drop { display: flex; align-items: center; gap: 4px; color: var(--muted); font-size: 12px; white-space: nowrap; }

@media (max-width: 720px) {
  .offer-item-row { flex-wrap: wrap; }
  .offer-results { gap: 14px; flex-wrap: wrap; }
}

/* --------------------------------------------------------- backlog verdicts */

.verdict { font-weight: 600; }
.verdict.is-filled { color: var(--good, #2E7D32); }
.verdict.is-partial { color: #8A6D26; }
.verdict.is-open { color: var(--muted); }
.verdict.is-unchecked, .verdict.is-unknown { color: var(--muted); font-weight: 400; font-style: italic; }
.gap-verdict { margin: 6px 0 0; color: var(--muted); font-size: 13px; max-width: 72ch; }

/* ---------------------------------------------------------------- calendar */

.calendar { margin-top: 22px; }
.cal-head, .cal-week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-head { margin-bottom: 6px; }
.cal-head span { color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; padding-left: 2px; }
.cal-week { margin-bottom: 6px; }
.cal-week.is-now .cal-day { border-color: var(--border-strong); }
.cal-day {
  border: 1px solid var(--border); border-radius: 9px; padding: 6px 7px 8px;
  min-height: 92px; background: var(--bg); display: flex; flex-direction: column; gap: 5px;
}
.cal-day.is-past { background: var(--surface-2); }
.cal-day.is-today { outline: 2px solid var(--primary); outline-offset: -1px; }
.cal-date { margin: 0; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.cal-date span { text-transform: uppercase; letter-spacing: .05em; font-size: 10.5px; }
.cal-entry {
  border-radius: 7px; padding: 5px 6px; font-size: 11.5px; line-height: 1.35;
  border: 1px solid var(--border); position: relative;
}
.cal-entry.is-planned { border-style: dashed; background: none; }
.cal-entry.is-published { background: var(--surface-2); }
.cal-entry.is-late { border-color: var(--danger); border-style: solid; }
.cal-channel { display: block; color: var(--muted); font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; }
.cal-title { display: block; font-weight: 500; }
.cal-offer { display: block; color: var(--muted); }
.cal-done {
  margin-top: 4px; border: 0; background: none; padding: 0; cursor: pointer;
  color: var(--muted); font-size: 11px; text-decoration: underline;
}
.cal-done:hover { color: var(--fg); }

.overdue-list { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 7px; }
.overdue-list li { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.overdue-actions { display: flex; gap: 6px; }
.later { margin-top: 26px; }
.publication.is-planned { border-style: dashed; }
.publication.is-planned.is-late { border-color: var(--danger); border-style: solid; }

@media (max-width: 760px) {
  .cal-head { display: none; }
  .cal-week { grid-template-columns: 1fr; gap: 4px; }
  .cal-day { min-height: 0; flex-direction: row; align-items: baseline; gap: 10px; flex-wrap: wrap; }
  .cal-day:not(:has(.cal-entry)) { display: none; }
  .cal-date::after { content: " " attr(data-weekday); }
}

/* ------------------------------------------------------------------ import */

.import { margin: 22px 0 26px; border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.import > summary { cursor: pointer; font-weight: 500; }
.import > summary::marker { color: var(--muted); }
.import-form textarea { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; white-space: pre; }
.import-form .field { margin: 12px 0; }
.import-result { width: 100%; border-collapse: collapse; margin-top: 14px; font-size: 13px; }
.import-result th { text-align: left; color: var(--muted); font-weight: 500; font-size: 11.5px;
  text-transform: uppercase; letter-spacing: .05em; padding: 0 8px 6px 0; }
.import-result td { padding: 6px 8px 6px 0; border-top: 1px solid var(--border); vertical-align: top; }
.import-result .meta { display: block; font-size: 12px; }
.import-result tr.is-updated td:first-child { color: var(--good, #2E7D32); }
.import-result tr.is-unmatched td, .import-result tr.is-no_numbers td { color: var(--muted); }

/* --------------------------------------------------------- idea promotions */

.proposals { margin: 24px 0; }
.proposals h2 { margin-bottom: 4px; }
.proposal {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 16px;
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px 14px; margin-top: 10px;
}
.proposal .title { margin: 0; font-weight: 500; }
.proposal .meta { margin: 3px 0 0; }
.proposal .gap-verdict { margin-top: 5px; }

/* ------------------------------------------------------------ rhythm target */

.rhythm.has-target { position: relative; }
.rhythm-target {
  position: absolute; left: 0; right: 0; height: 0;
  border-top: 1px dashed var(--border-strong); z-index: 1; pointer-events: none;
}
.rhythm-week.is-missed { background: color-mix(in srgb, var(--danger) 7%, transparent); border-radius: 3px; }
.key-target { display: inline-block; width: 14px; border-top: 1px dashed var(--border-strong); margin: 0 4px 4px 12px; }

/* ------------------------------------------------------ dates and what cost */

.item.is-late { border-left: 2px solid var(--danger); padding-left: 10px; }
.item-due { display: flex; align-items: center; gap: 8px; margin-top: 5px; }
.item-due input[type=date] { font-size: 12px; padding: 3px 6px; width: auto; margin: 0;
  border: 1px solid var(--border); border-radius: 6px; background: var(--bg); color: var(--muted); }
.item-due input[type=date]:hover { color: var(--fg); border-color: var(--border-strong); }
.item-due span { font-size: 12px; color: var(--muted); }
.publication-spend { color: var(--muted); font-size: 12.5px; }

/* ------------------------------------------------------------- attribution */

.offer-attribution { margin: 12px 0 0; max-width: 66ch; }
.offer-reading { margin-top: 12px; }
.offer-reading > summary { cursor: pointer; color: var(--muted); font-size: 13px; }
.offer-reading > summary:hover { color: var(--fg); }
.reading-form { margin-top: 10px; max-width: 460px; }
.tagged { display: flex; gap: 8px; align-items: center; margin-top: 12px; }
.tagged input {
  flex: 1 1 auto; margin: 0; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px; color: var(--muted);
}
.tagged input:focus { color: var(--fg); }

/* ------------------------------------------------------------ side by side */

.compare-scroll { overflow-x: auto; margin-top: 20px; }
.compare { width: 100%; border-collapse: collapse; font-size: 13.5px; white-space: nowrap; }
.compare th {
  text-align: left; color: var(--muted); font-weight: 500; font-size: 11.5px;
  text-transform: uppercase; letter-spacing: .05em; padding: 0 14px 8px 0;
}
.compare td { padding: 10px 14px 10px 0; border-top: 1px solid var(--border); font-variant-numeric: tabular-nums; }
.compare tbody tr:hover { background: var(--surface-2); }
.compare .compare-name { white-space: normal; min-width: 160px; font-variant-numeric: normal; }
.compare .compare-name a { font-weight: 600; }
.compare .compare-name .meta { display: block; font-size: 11.5px; }
.compare tr.is-stalled td { background: color-mix(in srgb, var(--danger) 5%, transparent); }

/* -------------------------------------------------------------- capabilities */

.capabilities { display: grid; gap: 12px; margin: 22px 0; }
.capability { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.capability.is-broken { border-color: var(--danger); }
.capability.is-off { background: var(--surface-2); }
.capability .title { margin: 0; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.capability .meta { margin: 3px 0 0; }
.capability .gap-verdict { margin-top: 8px; }
.capability.is-broken .gap-verdict { color: var(--danger); }

/* ------------------------------------------------------- image provenance */

.asset-pick { position: relative; }
.asset-pick-where {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 3px 5px;
  font-size: 10px; line-height: 1.25; color: #fff; background: rgba(16, 16, 20, .62);
  border-radius: 0 0 7px 7px; opacity: 0; transition: opacity .12s;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.asset-pick:hover .asset-pick-where { opacity: 1; }

/* --------------------------------------------------------------- logo pick */

.logo-pick { margin-top: 8px; }
.logo-pick select { font-size: 12px; padding: 4px 6px; }

/* ---------------------------------------------------------------- post text */

.post-text textarea { font-size: 13.5px; }
.counter-line.is-folded span:first-child { color: #8A6D26; font-weight: 600; }
.counter-line.is-over span:first-child { color: var(--danger); font-weight: 600; }
.post-text-form { margin-bottom: 8px; }
.proposal-text { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--border); }
.variant {
  display: flex; gap: 10px; width: 100%; text-align: left; border: 1px solid var(--border);
  border-radius: 9px; padding: 9px 11px; background: var(--bg); cursor: pointer; margin-top: 8px;
}
.variant:hover { border-color: var(--border-strong); }
.variant-n { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.variant-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.variant-line { font-size: 13px; }
.variant-text { font-size: 12px; color: var(--muted); margin-top: 3px; }

/* ------------------------------------------------------------- objective */

.objective-bar { margin-bottom: 18px; }
.objective-bar.is-behind { border-color: var(--danger); }
.objective-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 10px; }
.objective-track { height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; margin: 4px 0 10px; }
.objective-track span { display: block; height: 100%; background: var(--primary); border-radius: 4px; }
.objective-bar.is-behind .objective-track span { background: var(--danger); }

/* ---------------------------------------------------------------- knowledge */

.knowledge-fields { display: grid; gap: 14px; margin: 22px 0; }
.knowledge-field { display: block; text-decoration: none; color: inherit; }
.knowledge-field:hover { border-color: var(--border-strong); text-decoration: none; }
.knowledge-field h2 { margin: 0 0 6px; font-size: 17px; }
.knowledge-field p { margin: 0 0 6px; }
.claims { display: grid; gap: 14px; margin-top: 16px; }
.claim { border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; border-left-width: 3px; }
.claim.is-strong { border-left-color: var(--good, #2E7D32); }
.claim.is-mixed { border-left-color: #8A6D26; }
.claim.is-weak { border-left-color: var(--muted); }
.claim.is-contested { border-left-color: var(--danger); }
.claim-head { display: flex; justify-content: space-between; align-items: baseline; gap: 14px; flex-wrap: wrap; }
.claim-head h3 { margin: 0; font-size: 15.5px; }
.claim p { margin: 8px 0 0; max-width: 72ch; }
.claim-practice { color: var(--fg); }
.claim-sources { margin: 10px 0 0; padding-left: 18px; color: var(--muted); font-size: 12.5px; }
.evidence { font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--border); white-space: nowrap; }
.evidence.is-strong { color: var(--good, #2E7D32); }
.evidence.is-mixed { color: #8A6D26; }
.evidence.is-weak { color: var(--muted); }
.evidence.is-contested { color: var(--danger); }

/* ------------------------------------------------------------------ advisor */

.advisor { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 32px; align-items: start; }
.advisor-threads ul { list-style: none; margin: 0 0 12px; padding: 0; }
.advisor-thread { display: block; padding: 8px 10px; border-radius: 8px; text-decoration: none; color: inherit; }
.advisor-thread:hover { background: var(--surface-2); text-decoration: none; }
.advisor-thread.on { background: var(--surface); box-shadow: inset 2px 0 0 var(--primary); }
.advisor-thread-title { display: block; font-size: 13.5px; font-weight: 500; }
.advisor-thread .meta { display: block; font-size: 11.5px; }
.advisor-messages { display: grid; gap: 14px; margin-bottom: 22px; }
.advisor-message { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; max-width: 72ch; }
.advisor-message.is-user { background: var(--surface-2); margin-left: 40px; }
.advisor-message.is-assistant { background: var(--bg); margin-right: 40px; }
.advisor-message p { margin: 0 0 10px; }
.advisor-message p:last-child { margin-bottom: 0; }
.advisor-who { font-size: 12px; font-weight: 600; color: var(--muted); }
.advisor-sources { list-style: none; margin: 10px 0 0; padding: 10px 0 0; border-top: 1px dashed var(--border); font-size: 12.5px; color: var(--muted); }
.advisor-sources li { margin: 4px 0; }
.advisor-ask { max-width: 72ch; }
.advisor-ask-row { display: flex; align-items: flex-end; gap: 12px; margin-top: 4px; }
@media (max-width: 760px) { .advisor { grid-template-columns: 1fr; } .advisor-message.is-user, .advisor-message.is-assistant { margin: 0; } }

/* ------------------------------------------------------------------- video */

.video-card { display: block; text-decoration: none; color: inherit; }
.video-card:hover { border-color: var(--border-strong); text-decoration: none; }
.storyboard { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; counter-reset: shot; }
.shot-row { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 16px; border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; position: relative; }
.shot-row::before { counter-increment: shot; content: counter(shot); position: absolute; top: 8px; left: 10px; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.shot-frame { border: 1px solid var(--border-strong); border-radius: 6px; background: var(--surface-2); display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); }
.shot-frame.is-16-9 { width: 96px; height: 54px; }
.shot-frame.is-9-16 { width: 54px; height: 96px; margin-left: 21px; }
.shot-size { font-weight: 700; }
.shot-what { margin: 0 0 4px; font-weight: 500; }
.shot-dialogue { margin: 4px 0; font-style: italic; }
.shot-body .meta { margin: 3px 0 0; }
.shot-tools { position: absolute; top: 8px; right: 8px; display: flex; gap: 4px; }
.cast { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin-top: 12px; }
.cast-member { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; }
.cast-member .title { margin: 8px 0 2px; font-weight: 600; }
.cast-images { display: flex; gap: 4px; height: 64px; align-items: center; }
.cast-images img { width: 64px; height: 64px; object-fit: cover; border-radius: 6px; }
.cast-none { font-size: 12px; color: var(--muted); }

/* ------------------------------------------------------------- video phases */

.phases { list-style: none; margin: 14px 0 6px; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.phase-step { border: 1px solid var(--border); border-radius: 9px; padding: 9px 11px; display: flex; flex-direction: column; gap: 2px; opacity: .7; }
.phase-step.passed { opacity: 1; background: var(--surface-2); }
.phase-step.on { opacity: 1; border-color: var(--primary); box-shadow: inset 0 2px 0 var(--primary); }
.phase-n { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.phase-name { font-weight: 600; font-size: 13.5px; }
.phase-does { font-size: 12px; color: var(--muted); }
.phase-actions { display: flex; gap: 10px; align-items: center; margin: 6px 0 22px; flex-wrap: wrap; }
.cast-add { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin: 10px 0 26px; }
.cast-pick { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.cast-pick-one { display: inline-flex; gap: 5px; align-items: center; font-size: 13px; }
.film { width: 100%; max-height: 520px; border-radius: 9px; background: #000; display: block; margin-bottom: 8px; }
.film.is-9-16 { max-width: 300px; }
.film-form { margin-top: 12px; }
@media (max-width: 760px) { .phases { grid-template-columns: 1fr 1fr; } }

/* ---------------------------------------------------- working modal, usage */

.working-modal { border: 0; padding: 0; background: none; max-width: min(480px, calc(100vw - 32px)); color: var(--fg); }
.working-modal::backdrop { background: rgba(16, 16, 20, .42); backdrop-filter: blur(2px); }
.working-modal-frame { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 18px 48px rgba(16, 16, 20, .18); padding: 22px 24px; text-align: center; }
.working-modal-frame h2 { margin: 10px 0 6px; font-size: 17px; }
.working-modal-frame .working-text { margin: 0 0 8px; font-weight: 500; }
.working-modal-frame .meta { margin: 4px 0; }
.working-modal-frame .working-dot { display: inline-block; width: 12px; height: 12px; }
.working-modal-close { margin-top: 14px; }
.working-modal.failed .working-dot { background: var(--danger); animation: none; }
.working-modal.failed .working-text { color: var(--danger); }
.usage-pill { font-size: 12.5px; color: var(--muted); text-decoration: none; white-space: nowrap; padding: 4px 10px; border: 1px solid var(--border); border-radius: 999px; margin-right: 10px; }
.usage-pill:hover { color: var(--fg); border-color: var(--border-strong); text-decoration: none; }
.usage-bolt { color: var(--primary); }
@media (max-width: 760px) { .usage-pill { display: none; } }

/* ------------------------------------------------------------- allowance */

.allowance { text-align: center; }
.allowance-figure { margin: 0; font-size: 40px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.1; }
.allowance-label { margin: 2px 0 14px; color: var(--muted); }
.allowance .objective-track { max-width: 420px; margin: 0 auto 10px; }
.allowance.is-low .objective-track span { background: #8A6D26; }
.allowance.is-out { border-color: var(--danger); }
.allowance.is-out .objective-track span { background: var(--danger); }
.usage-pill.is-low { color: #8A6D26; border-color: #8A6D26; }
.usage-pill.is-out { color: var(--danger); border-color: var(--danger); font-weight: 600; }
.top-up .actions { margin-top: 4px; }

/* ------------------------------------------------------------ case studies */

.case-steps { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 14px; }
.case-step { border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; }
.case-step-head { display: flex; gap: 14px; align-items: flex-start; }
.case-step-head h3 { margin: 0; font-size: 15.5px; }
.case-step-head .meta { margin: 2px 0 0; }
.case-step-n { width: 26px; height: 26px; flex: none; border-radius: 999px; background: var(--surface-2);
  color: var(--muted); font-size: 12.5px; display: flex; align-items: center; justify-content: center; font-variant-numeric: tabular-nums; }
.case-step-body { margin: 12px 0 0 40px; display: grid; grid-template-columns: 90px minmax(0, 1fr); gap: 6px 14px; }
.case-step-body dt { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; padding-top: 2px; }
.case-step-body dd { margin: 0; max-width: 74ch; }
.case-step-body dt.is-value { color: var(--primary); }
.case-step-body dd.is-value { font-weight: 500; }
@media (max-width: 720px) {
  .case-step-body { margin-left: 0; grid-template-columns: 1fr; gap: 2px; }
  .case-step-body dt { margin-top: 8px; }
}
