/* Thinkreel control panel: tonal surfaces, no divider lines, its own identity (ADR-0021, ADR-0024). */
:root {
  /* Thinkreel's own look: the "Frames" identity (ADR-0024). Violet leads; tangerine, teal and pink are
     accents for the logo, status and marketing. The app stays calm. Slides never use these colours:
     they use each brand's own (ADR-0021). Every colour is a named token so a dark theme can follow. */
  --surface: #f4f4f8;            /* Mist: the app background behind panels */
  --surface-lowest: #ffffff;     /* panels and cards */
  --surface-low: #ededf3;
  --surface-container: #e9e9f0;
  --surface-high: #dedee7;
  --primary: #6644eb;            /* violet: the logo, the one main action, selection. White text on it is 5.9:1 */
  --primary-container: #5133c7;  /* deeper violet: hover */
  --tertiary: #5133c7;           /* violet 700: links, focus, small accents on white */
  --accent-rgb: 81 51 199;
  --accent-wash: #f3f0ff;
  --spark: #ff8a3d;              /* tangerine: decorative only (logo, badges with ink text) */
  --tangerine: #ff8a3d;
  --teal: #12b5a5;
  --pink: #ff4d8d;
  --ink: #111318;
  --danger: #c2272d;
  --ok: #157a40;
  --warn: #8a5a00;
  --on-surface: #111318;
  --muted: #5b5e6b;
  --icon: #9a9ca8;
  --icon-accent: #b19cff;
  --line: #dedee7;
  --radius: 10px;                /* buttons and fields */
  --radius-card: 14px;           /* cards and panels */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --shadow: 0px 24px 48px -12px rgba(17, 19, 24, 0.09);
  --display: 'Plus Jakarta Sans', 'Inter', system-ui, sans-serif; /* headings */
  --serif: var(--display);       /* older name for the heading face */
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--surface); color: var(--on-surface); font: 15px/1.6 var(--sans); display: flex; flex-direction: column; }
button, input, select, textarea { font: inherit; color: inherit; }
code { font-family: var(--mono); font-size: .85em; background: var(--surface-container); padding: .05em .35em; border-radius: .375rem; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
:focus-visible { outline: 2px solid var(--tertiary); outline-offset: 2px; }

/* Top bar */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 32px; background: rgb(255 255 255 / .7); backdrop-filter: blur(24px); position: sticky; top: 0; z-index: 5; }
.brand { display: flex; align-items: center; gap: 18px; }
.brand-mark { font-family: var(--serif); font-size: 1.35rem; letter-spacing: -0.02em; }
.brand-pick select {
  border: 0; background: var(--surface-low); border-radius: .375rem; padding: 6px 30px 6px 12px;
  font-size: .72rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--tertiary); cursor: pointer;
}
.top-actions { display: flex; align-items: center; gap: 16px; }

/* Layout */
.workspace { flex: 1; display: grid; grid-template-columns: minmax(360px, 5fr) 7fr; gap: 24px; padding: 8px 32px 32px; min-height: 0; }
.panel { min-height: 0; display: flex; flex-direction: column; }
.editor-panel { background: var(--surface-low); border-radius: .5rem; padding: 24px 28px 28px; }
.preview-panel { padding-top: 4px; min-width: 0; }

/* Tabs */
.tabs { display: flex; gap: 4px; margin-bottom: 16px; flex-wrap: wrap; }
.tab, .stab { border: 0; background: transparent; cursor: pointer; padding: 8px 14px; border-radius: .375rem; font-size: .82rem; font-weight: 600; color: var(--muted); transition: background 300ms var(--ease), color 300ms var(--ease); }
.tab:hover, .stab:hover { background: var(--surface-container); }
.tab.active, .stab.active { background: var(--surface-lowest); color: var(--on-surface); }
.tab-pane, .stab-pane { display: none; flex-direction: column; min-height: 0; }
.tab-pane.active { display: flex; flex: 1; }
.stab-pane.active { display: block; }

.hint { margin: 0 0 12px; font-size: .82rem; color: var(--muted); }
.hint.center { text-align: center; margin-top: 12px; }

textarea { flex: 1; width: 100%; min-height: 160px; resize: vertical; border: 0; border-radius: .5rem; background: var(--surface-lowest); padding: 18px 20px; line-height: 1.6; outline: 1px solid rgb(195 198 216 / .15); transition: outline-color 300ms var(--ease); }
textarea:focus { outline: 2px solid var(--primary); }
textarea.short { flex: 0 0 auto; min-height: 110px; }
textarea.code { font-family: var(--mono); font-size: .8rem; line-height: 1.5; }
textarea.tall { min-height: 220px; }
.row { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }

/* Buttons */
.primary { border: 0; cursor: pointer; background: linear-gradient(135deg, var(--primary), var(--primary-container)); color: #fff; padding: 12px 22px; border-radius: .375rem; font-weight: 600; transition: filter 300ms var(--ease), opacity 300ms var(--ease); }
.primary:hover { filter: brightness(1.12); }
.primary:disabled { opacity: .5; cursor: default; }
.primary.small { padding: 7px 14px; font-size: .78rem; }
.ghost { cursor: pointer; background: transparent; border: 1px solid rgb(195 198 216 / .5); padding: 9px 16px; border-radius: .375rem; font-size: .82rem; font-weight: 600; color: var(--on-surface); transition: border-color 300ms var(--ease); }
.ghost:hover { border-color: var(--primary); }
.ghost.small { padding: 6px 12px; font-size: .75rem; }
.ghost:disabled { opacity: .45; cursor: default; }
.link { border: 0; background: none; cursor: pointer; color: var(--tertiary); font-size: .8rem; font-weight: 600; padding: 0; }
.link.danger { margin: -6px 0 18px; }

/* Actions */
.actions { margin-top: 20px; display: flex; flex-direction: column; gap: 12px; }
.for-format { margin: 0; font-size: .8rem; color: var(--muted); }
.for-row { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; }
.for-row .link { font-size: .8rem; color: var(--primary); text-decoration: underline; text-underline-offset: 2px; }
.progress { display: flex; align-items: center; gap: 12px; font-size: .82rem; color: var(--muted); }
.progress[hidden] { display: none; }
.bar { flex: 1; height: 3px; background: var(--surface-container); border-radius: 2px; overflow: hidden; }
.bar-fill { height: 100%; width: 30%; background: var(--tertiary); animation: slide 1.4s var(--ease) infinite; }
@keyframes slide { from { transform: translateX(-100%); } to { transform: translateX(340%); } }
.message { margin: 0; font-size: .85rem; min-height: 1.4em; }
.message.error { color: var(--danger); }
.message.ok { color: var(--primary); }

/* Preview */
.preview-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.preview-actions { display: flex; gap: 8px; }
.seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: .5rem; background: var(--surface-low); }
.seg button { border: 0; background: transparent; cursor: pointer; padding: 6px 12px; border-radius: .375rem; display: flex; gap: 6px; align-items: baseline; font-size: .8rem; color: var(--muted); }
.seg button b { font-weight: 600; }
.seg button small { font-size: .72rem; opacity: .8; }
.seg button[aria-pressed="true"] { background: var(--surface-lowest); color: var(--on-surface); box-shadow: 0 1px 2px rgb(0 0 0 / .06); }
.format-desc { margin: 0 0 10px; font-size: .78rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.notice { margin: 0 0 10px; font-size: .8rem; background: rgb(var(--accent-rgb) / .07); color: var(--tertiary); padding: 8px 12px; border-radius: .375rem; }
.notice[hidden] { display: none; }
.frame-wrap { position: relative; width: 100%; max-height: calc(100vh - 380px); margin: 0 auto; background: var(--surface-lowest); border-radius: .5rem; overflow: hidden; box-shadow: var(--shadow); cursor: pointer; }
.frame-wrap[data-shape="tall"], .frame-wrap[data-shape="square"] { width: auto; height: calc(100vh - 380px); min-height: 300px; max-width: 100%; }
#deck { position: absolute; inset: 0; }
.nav { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 12px; }
.nav .pos { font-size: .8rem; color: var(--muted); min-width: 170px; text-align: center; font-variant-numeric: tabular-nums; }

/* Slide editor */
.slide-list { display: flex; flex-direction: column; gap: 8px; overflow: auto; min-height: 0; flex: 1; padding-right: 4px; }
.slide-card { background: var(--surface-lowest); border-radius: .5rem; }
.slide-card.current { box-shadow: inset 3px 0 0 var(--tertiary); }
.sc-head { display: flex; align-items: center; gap: 6px; padding: 8px 10px; }
.sc-toggle { flex: 1; min-width: 0; display: flex; gap: 10px; align-items: baseline; border: 0; background: none; cursor: pointer; text-align: left; padding: 4px; }
.sc-toggle .sn { font-family: var(--serif); color: var(--tertiary); font-size: .9rem; }
.sc-toggle .st { font-weight: 600; font-size: .85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sc-head select { border: 0; background: var(--surface-low); border-radius: .375rem; padding: 4px 6px; font-size: .75rem; }
.icon { border: 0; background: none; cursor: pointer; width: 26px; height: 26px; border-radius: .375rem; color: var(--muted); }
.icon:hover:not(:disabled) { background: var(--surface-low); color: var(--on-surface); }
.icon:disabled { opacity: .3; cursor: default; }
.sc-body { display: none; padding: 4px 16px 16px; gap: 10px; flex-direction: column; }
.slide-card.open .sc-body { display: flex; }
.f { display: flex; flex-direction: column; gap: 4px; }
.f > span { font-size: .68rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.f input, .f select { border: 0; border-bottom: 1px solid rgb(195 198 216 / .5); background: transparent; padding: 6px 0; outline: none; }
.f input:focus { border-bottom: 2px solid var(--primary); }
.f textarea { min-height: 0; flex: none; padding: 10px 12px; background: var(--surface-low); font-size: .9rem; }
.col-edit { display: flex; flex-direction: column; gap: 8px; padding: 10px 0; }

/* Dialogs */
dialog { border: 0; padding: 0; border-radius: .5rem; width: min(760px, calc(100vw - 32px)); max-height: calc(100vh - 48px); background: var(--surface-lowest); box-shadow: var(--shadow), 0 0 0 1px rgb(195 198 216 / .15); }
dialog::backdrop { background: rgb(22 22 29 / .3); backdrop-filter: blur(4px); }
.dialog { padding: 32px 36px; display: flex; flex-direction: column; }
.dialog h2 { font-family: var(--serif); font-weight: 400; font-size: 1.7rem; letter-spacing: -0.02em; margin: 0 0 18px; }
.settings-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.settings-head h2 { margin: 0; }
.field { display: flex; flex-direction: column; gap: 6px; margin: 0 0 20px; border: 0; padding: 0; }
.field > span, .field > legend, .choice > legend { font-size: .72rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); padding: 0; margin-bottom: 6px; }
.field small { color: var(--muted); font-size: .78rem; }
.field input:not([type="color"]), .field select { border: 0; background: transparent; border-bottom: 1px solid rgb(195 198 216 / .4); padding: 8px 0; outline: none; }
.field input:focus, .field select:focus { border-bottom: 2px solid var(--primary); }
/* Set elsewhere (for example by the server's settings) and so not editable here. */
.field input:disabled, .field select:disabled { color: var(--muted); border-bottom-style: dashed; cursor: not-allowed; }
.field textarea { background: var(--surface-low); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px 16px; }
.sw { display: flex; align-items: center; gap: 10px; font-size: .82rem; cursor: pointer; }
.sw input { width: 34px; height: 34px; padding: 0; border: 0; border-radius: .375rem; background: none; cursor: pointer; }
.choice { border: 0; padding: 0; margin: 0 0 20px; }
.options { display: grid; gap: 8px; }
#exportFormats { grid-template-columns: 1fr 1fr; }
.opt { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: .5rem; background: var(--surface-low); cursor: pointer; }
.opt:has(input:checked) { background: var(--surface-lowest); box-shadow: inset 0 0 0 2px var(--primary); }
.opt input { margin-top: .3em; accent-color: var(--tertiary); }
.opt b { display: block; font-size: .9rem; }
.opt small { display: block; color: var(--muted); font-size: .78rem; line-height: 1.45; }
.opt.disabled { opacity: .55; cursor: default; }
.dialog-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }

@media (max-width: 960px) {
  .workspace { grid-template-columns: 1fr; padding: 8px 16px 24px; }
  .topbar { padding: 12px 16px; }
  .editor-panel { padding: 20px; }
  textarea { min-height: 220px; }
  .two, #exportFormats { grid-template-columns: 1fr; }
  .frame-wrap[data-shape="tall"], .frame-wrap[data-shape="square"] { height: 70vh; }
}

.f.check { flex-direction: row; align-items: center; gap: 8px; }
.f.check span { text-transform: none; letter-spacing: 0; font-size: .85rem; font-weight: 600; color: var(--on-surface); }
.sc-head select { max-width: 130px; }

.video-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 0 24px; }
.video-opts[hidden], .video-progress[hidden] { display: none; }
.video-progress { display: flex; align-items: center; gap: 12px; font-size: .82rem; color: var(--muted); margin: 0 0 12px; font-variant-numeric: tabular-nums; }
.bar.determinate .bar-fill { width: 0; animation: none; transition: width 400ms var(--ease); }
.f.num input { max-width: 120px; }
@media (max-width: 960px) { .video-opts { grid-template-columns: 1fr; } }

/* Images tab */
.tab-pane[data-pane="images"].active { overflow: auto; }
.libs { display: flex; flex-direction: column; gap: 22px; }
.lib-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.lib-head h2, .lib-head h3 { margin: 0; font-size: .78rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.file-btn { cursor: pointer; }
.drop { border-radius: .5rem; background: var(--surface-lowest); padding: 12px; min-height: 110px; outline: 2px dashed transparent; transition: outline-color 200ms var(--ease), background 200ms var(--ease); }
.drop.over { outline-color: var(--tertiary); background: var(--accent-wash); }
.drop-hint { margin: 6px 0 0; text-align: center; font-size: .78rem; color: var(--muted); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 10px; }
.img-card { display: flex; flex-direction: column; gap: 6px; background: var(--surface-low); border-radius: .5rem; padding: 8px; min-width: 0; }
.img-card .thumb { aspect-ratio: 1; border-radius: .375rem; background: var(--surface-container) center / contain no-repeat; }
.img-card.busy .thumb { opacity: .5; }
.img-card textarea { min-height: 0; flex: none; font-size: .75rem; line-height: 1.4; padding: 6px 8px; background: var(--surface-lowest); }
.img-card select { border: 0; background: var(--surface-lowest); border-radius: .375rem; font-size: .72rem; padding: 3px 4px; }
.img-card .row2 { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.img-card .tag { font-size: .65rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--tertiary); }
.img-card .mini { border: 0; background: none; cursor: pointer; font-size: .72rem; font-weight: 600; color: var(--muted); padding: 2px 4px; border-radius: .25rem; }
.img-card .mini:hover { background: var(--surface-container); color: var(--on-surface); }
.img-card .status { font-size: .72rem; color: var(--muted); }
.three { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.check-field { flex-direction: row; align-items: flex-start; gap: 10px; }
.check-field input { margin-top: .3em; accent-color: var(--tertiary); }
.check-field span { text-transform: none !important; letter-spacing: 0 !important; font-size: .9rem !important; font-weight: 600 !important; color: var(--on-surface) !important; }
.check-field small { display: block; font-weight: 400; color: var(--muted); }
.img-field { display: flex; gap: 8px; align-items: flex-end; }
.img-field .f { flex: 1; }
.img-field .pv { width: 40px; height: 40px; border-radius: .375rem; background: var(--surface-container) center / cover no-repeat; flex: none; }
.pick-grid { max-height: 60vh; overflow: auto; }
.pick-grid button { border: 0; padding: 0; cursor: pointer; border-radius: .5rem; background: var(--surface-low); display: flex; flex-direction: column; gap: 4px; padding: 6px; text-align: left; font-size: .72rem; color: var(--muted); }
.pick-grid button .thumb { aspect-ratio: 1; border-radius: .375rem; background: var(--surface-container) center / contain no-repeat; }
.pick-grid button:hover { box-shadow: inset 0 0 0 2px var(--primary); }
@media (max-width: 960px) { .three { grid-template-columns: 1fr; } }

/* ---------- Create tab ---------- */
.create { gap: 10px; overflow-y: auto; }
/* Show that there's more below when the tab scrolls */
.create.more-below { -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 48px), transparent); mask-image: linear-gradient(to bottom, #000 calc(100% - 48px), transparent); }
/* Focus rings drawn inside, so the scrolling area can't clip them */
.create textarea:focus, .create input.text:focus { outline: none; box-shadow: inset 0 0 0 2px var(--primary); }
.brief-label { margin: 0; font-family: var(--serif); font-size: 1.3rem; letter-spacing: -0.02em; line-height: 1.2; }
textarea.brief { flex: 0 0 auto; min-height: 84px; font-size: .98rem; padding: 12px 14px; }
.examples { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: -2px; }
.ex-label { font-size: .75rem; color: var(--muted); margin-right: 2px; }
.example { border: 0; cursor: pointer; background: var(--surface-container); color: var(--on-surface); padding: 4px 10px; border-radius: 999px; font-size: .74rem; font-weight: 600; transition: background 300ms var(--ease); }
.example:hover { background: var(--surface-high); }
.picks { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 10px; }
.pick { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.pick > span { font-size: .66rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.pick select, .pick input { width: 100%; min-width: 0; border: 0; border-radius: .375rem; background: var(--surface-lowest); padding: 7px 10px; font-size: .84rem; outline: 1px solid rgb(195 198 216 / .25); }
.pick select { appearance: none; cursor: pointer; padding-right: 28px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%235c5e5d' stroke-width='1.5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; }
.create .pick select:focus, .create .pick input:focus { outline: none; box-shadow: inset 0 0 0 2px var(--primary); }
@media (max-width: 420px) { .picks { grid-template-columns: 1fr; } }
.notes-box { border-radius: .5rem; background: var(--surface-lowest); padding: 10px 14px; flex: 0 0 auto; }
.notes-box summary { cursor: pointer; font-size: .85rem; font-weight: 600; }
.notes-box .optional { font-weight: 400; color: var(--muted); }
.notes-box[open] summary { margin-bottom: 10px; }
.notes-box textarea { min-height: 140px; background: var(--surface-low); }
.notes-mode { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; font-size: .82rem; }
.notes-mode label { display: flex; gap: 8px; align-items: center; cursor: pointer; }

/* A [placeholder] Claude left for the user to fill in */
.to-fill { outline: 2px dashed var(--tertiary) !important; outline-offset: 1px; }

/* ---------- Create steps: brief, then questions (ADR-0015) ---------- */
.create > .step { display: flex; flex-direction: column; gap: 10px; }
.create > .step[hidden] { display: none; }
.create > .step.enter-fwd { animation: stepFwd 240ms var(--ease); }
.create > .step.enter-back { animation: stepBack 240ms var(--ease); }
@keyframes stepFwd { from { opacity: 0; transform: translateX(14px); } }
@keyframes stepBack { from { opacity: 0; transform: translateX(-14px); } }
@media (prefers-reduced-motion: reduce) { .create > .step.enter-fwd, .create > .step.enter-back { animation: none; } .ol-row, .outline.sorting .ol-row { transition: none; } }
/* Brief · Questions · Outline (THI-469) */
.stepper ol { list-style: none; margin: 0 0 14px; padding: 0; display: flex; gap: 4px; align-items: center; }
.stepper li { display: flex; align-items: center; gap: 4px; }
.stepper li + li::before { content: ''; width: 18px; height: 1px; background: var(--surface-high); }
.stepper button { display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; padding: 4px 8px 4px 4px; border-radius: 999px; font: inherit; font-size: .78rem; font-weight: 600; color: var(--muted); cursor: pointer; }
.stepper button:hover:not(:disabled) { background: var(--surface-low); color: var(--on-surface); }
.stepper button:disabled { cursor: default; opacity: .6; }
.stepper .st-num { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--surface-container); font-size: .7rem; font-variant-numeric: tabular-nums; }
.stepper button.current { color: var(--on-surface); }
.stepper button.current .st-num { background: var(--primary); color: var(--surface-lowest); }
.stepper button.done .st-num { background: var(--surface-container); color: var(--primary); }
#generate[data-kbd]::after { content: attr(data-kbd); content: attr(data-kbd) / ""; margin-left: 10px; font-size: .72rem; font-weight: 500; opacity: .75; }
@media (hover: none) { #generate[data-kbd]::after { content: none; } }
.go { display: flex; flex-direction: column; gap: 8px; align-items: stretch; }
.go .link { align-self: center; color: var(--muted); font-weight: 500; }
.go .link:hover { color: var(--tertiary); }
.back { align-self: flex-start; border: 0; background: none; cursor: pointer; padding: 0; font-size: .8rem; font-weight: 600; color: var(--muted); }
.back:hover { color: var(--on-surface); }
.q-intro { margin: -4px 0 0; }
.q-brief { margin: 0; padding: 10px 14px; border-radius: .375rem; background: var(--surface-container); font-size: .82rem; color: var(--muted); }
.questions { display: flex; flex-direction: column; gap: 10px; }
.question { display: flex; flex-direction: column; gap: 8px; padding: 14px 16px; border-radius: .5rem; background: var(--surface-lowest); }
.question label { font-size: .9rem; font-weight: 600; line-height: 1.4; }
.question .num { color: var(--tertiary); margin-right: 6px; font-variant-numeric: tabular-nums; }
.question textarea { flex: 0 0 auto; min-height: 0; height: 2.6em; padding: 8px 12px; font-size: .88rem; background: var(--surface-low); resize: none; overflow: hidden; }
.question.answered { box-shadow: inset 3px 0 0 var(--primary); }
.suggest { display: flex; flex-wrap: wrap; gap: 5px; }
.suggest button { border: 1px dashed rgb(195 198 216 / .9); background: transparent; cursor: pointer; padding: 3px 10px; border-radius: 999px; font-size: .74rem; color: var(--muted); transition: all 200ms var(--ease); text-align: left; }
.suggest button:hover { border-style: solid; border-color: var(--primary); color: var(--on-surface); }
.q-loading { display: flex; flex-direction: column; gap: 10px; }
.q-loading div { height: 92px; border-radius: .5rem; background: linear-gradient(90deg, var(--surface-lowest), var(--surface-container), var(--surface-lowest)); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .q-loading div { animation: none; } }

/* ---------- Outline step (THI-455) ---------- */
.ol-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.ol-head .link { color: var(--primary); text-decoration: underline; text-underline-offset: 2px; }
.outline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; counter-reset: ol; }
.ol-row { display: grid; grid-template-columns: 22px 40px minmax(0, 1fr) 96px; grid-template-rows: auto auto; gap: 0 6px; align-items: center; padding: 6px 8px 6px 4px; border-radius: .5rem; background: var(--surface-lowest); counter-increment: ol; position: relative; transition: transform 160ms var(--ease), box-shadow 160ms var(--ease); }
.ol-grip { grid-row: 1 / span 2; grid-column: 1; align-self: stretch; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 2px; padding: 4px 0 0; border: 0; background: none; border-radius: .25rem; cursor: grab; touch-action: none; color: var(--muted); }
.ol-grip::before { content: counter(ol); font-family: var(--serif); font-size: .95rem; color: var(--tertiary); font-variant-numeric: tabular-nums; }
.ol-grip span { font-size: .8rem; line-height: 1; opacity: .5; }
.ol-grip:hover span, .ol-grip:focus-visible span { opacity: 1; }
.ol-grip:hover { background: var(--surface-low); }
.ol-sketch { grid-row: 1 / span 2; grid-column: 2; display: flex; align-items: center; }
.ol-sketch svg { width: 40px; height: 22.5px; border-radius: 3px; box-shadow: inset 0 0 0 1px var(--surface-high); background: var(--surface-low); }
.ol-row .ol-title { grid-column: 3; grid-row: 1; }
.ol-row .ol-tools { grid-column: 4; grid-row: 1; }
.ol-row .ol-point { grid-column: 3; grid-row: 2; }
.ol-row > select { grid-column: 4; grid-row: 2; }
.outline.sorting .ol-row:not(.dragging) { transition: transform 160ms var(--ease); }
.outline.sorting, .outline.sorting * { cursor: grabbing; user-select: none; }
.ol-row.dragging { z-index: 2; transition: none; box-shadow: var(--shadow); }
.ol-stale { padding: 10px 14px; border-radius: .5rem; background: var(--surface-container); font-size: .82rem; }
.ol-stale p { margin: 0 0 8px; }
.ol-stale .row { display: flex; gap: 8px; flex-wrap: wrap; }
.ol-row select { width: 100%; border: 0; border-radius: 999px; background: var(--surface-container); padding: 3px 20px 3px 9px; font-size: .68rem; font-weight: 700; letter-spacing: .03em; color: var(--muted); cursor: pointer; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='5'%3E%3Cpath d='M1 1l3 3 3-3' fill='none' stroke='%235c5e5d' stroke-width='1.3'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 7px center; text-overflow: ellipsis; }
.ol-row input { width: 100%; min-width: 0; border: 0; background: transparent; padding: 4px 6px; border-radius: .25rem; }
.ol-row input.ol-title { font-weight: 600; font-size: .9rem; }
.ol-row input.ol-point { font-size: .8rem; color: var(--muted); }
.ol-row input:hover { background: var(--surface-low); }
.create .ol-row input:focus, .create .ol-row select:focus { outline: none; box-shadow: inset 0 0 0 2px var(--primary); background: var(--surface-low); }
.ol-tools { display: flex; gap: 2px; justify-content: flex-end; opacity: .35; transition: opacity 200ms var(--ease); }
.ol-row:hover .ol-tools, .ol-row:focus-within .ol-tools { opacity: 1; }
.ol-tools button { border: 0; background: none; cursor: pointer; width: 24px; height: 24px; border-radius: .25rem; color: var(--muted); font-size: .8rem; }
.ol-tools button:hover:not(:disabled) { background: var(--surface-container); color: var(--on-surface); }
.ol-tools button:disabled { opacity: .3; cursor: default; }
#addOutlineSlide { align-self: flex-start; }
.ol-loading { display: flex; flex-direction: column; gap: 6px; }
.ol-loading div { height: 58px; border-radius: .5rem; background: linear-gradient(90deg, var(--surface-lowest), var(--surface-container), var(--surface-lowest)); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
@media (prefers-reduced-motion: reduce) { .ol-loading div { animation: none; } }

/* ---------- Sources (THI-456) ---------- */
.src-add { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.src-link { display: flex; flex: 1 1 220px; gap: 6px; min-width: 0; }
.src-link input { flex: 1; min-width: 0; border: 0; border-radius: .375rem; background: var(--surface-low); padding: 6px 10px; font-size: .8rem; outline: none; }
.create .src-link input:focus { box-shadow: inset 0 0 0 2px var(--primary); }
.src-types { margin: 6px 0 0; font-size: .72rem; color: var(--muted); }
.src-list { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.src-list:empty { display: none; }
.src-item { display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 8px; border-radius: .375rem; background: var(--surface-low); font-size: .8rem; min-width: 0; }
.src-kind { flex: 0 0 auto; padding: 1px 6px; border-radius: .25rem; background: var(--surface-container); font-size: .62rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.src-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--on-surface); text-decoration: none; }
a.src-name:hover { text-decoration: underline; }
.src-size { flex: 0 0 auto; font-size: .7rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.src-item button { flex: 0 0 auto; border: 0; background: none; cursor: pointer; width: 22px; height: 22px; border-radius: .25rem; color: var(--muted); }
.src-item button:hover { background: var(--surface-container); color: var(--on-surface); }
.src-item.busy { color: var(--muted); }
.src-item.busy .src-name { color: var(--muted); font-style: italic; }
.notes-label { display: block; margin: 12px 0 6px; font-size: .66rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.notes-box.dragging { box-shadow: inset 0 0 0 2px var(--tertiary); }

/* ---------- Editor (THI-458) ---------- */
/* Click-to-edit on the slide */
#deck [data-edit] { cursor: text; border-radius: 4px; transition: outline-color 150ms var(--ease); outline: 2px dashed transparent; outline-offset: 4px; }
#deck [data-edit]:hover { outline-color: rgb(var(--accent-rgb) / .45); }
#deck [data-edit].editing { outline: 3px solid var(--tertiary); outline-offset: 6px; background: rgb(255 255 255 / .35); cursor: text; caret-color: var(--tertiary); white-space: pre-wrap; }
#deck [data-edit].editing:hover { outline-color: var(--tertiary); }

/* Filmstrip */
.filmstrip { display: flex; gap: 10px; align-items: flex-start; margin-top: 14px; padding: 8px 4px 10px; overflow-x: auto; scrollbar-width: thin; }
.fs-item { position: relative; flex: 0 0 auto; display: flex; flex-direction: column; gap: 4px; cursor: pointer; outline: none; }
.fs-n { font-size: .68rem; color: var(--muted); font-variant-numeric: tabular-nums; padding-left: 2px; }
.fs-thumb { position: relative; overflow: hidden; border-radius: .3rem; background: var(--surface-lowest); box-shadow: 0 1px 3px rgb(0 0 0 / .08), 0 0 0 1px rgb(195 198 216 / .35); pointer-events: none; transition: box-shadow 200ms var(--ease); }
.fs-page { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.fs-item:hover .fs-thumb { box-shadow: 0 2px 8px rgb(0 0 0 / .12), 0 0 0 1px var(--primary); }
.fs-item.current .fs-thumb { box-shadow: 0 0 0 2px var(--tertiary), 0 2px 8px rgb(0 0 0 / .1); }
.fs-item.current .fs-n { color: var(--tertiary); font-weight: 700; }
.fs-item.dragging { opacity: .4; }
.fs-item.drop-before::before, .fs-item.drop-after::after { content: ''; position: absolute; top: 18px; bottom: 0; width: 3px; border-radius: 2px; background: var(--tertiary); }
.fs-item.drop-before::before { left: -7px; }
.fs-item.drop-after::after { right: -7px; }
.fs-tools { position: absolute; z-index: 2; top: 18px; right: 3px; display: flex; gap: 2px; opacity: 0; transition: opacity 150ms var(--ease); }
.fs-item:hover .fs-tools, .fs-item:focus-within .fs-tools { opacity: 1; }
.fs-tools button { width: 20px; height: 20px; border: 0; border-radius: .25rem; background: rgb(255 255 255 / .92); box-shadow: 0 1px 2px rgb(0 0 0 / .15); cursor: pointer; font-size: .72rem; line-height: 1; color: var(--on-surface); }
.fs-tools button:hover:not(:disabled) { background: #fff; color: var(--tertiary); }
.fs-tools button:disabled { display: none; }
.fs-add { flex: 0 0 auto; align-self: flex-end; width: 44px; height: 54px; border: 1px dashed rgb(195 198 216 / .9); border-radius: .3rem; background: transparent; cursor: pointer; font-size: 1.2rem; color: var(--muted); }
.fs-add:hover { border-color: var(--primary); color: var(--on-surface); }

/* Inspector (Slides tab) */
.insp { display: flex; flex-direction: column; gap: 14px; overflow-y: auto; min-height: 0; flex: 1; padding-right: 4px; }
.insp-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.insp-head h2, .insp-head h3 { margin: 0; font-family: var(--serif); font-size: 1.3rem; font-weight: 400; letter-spacing: -0.01em; }
.insp-head h2 small, .insp-head h3 small { font-family: var(--sans); font-size: .8rem; color: var(--muted); }
.insp-tools { display: flex; gap: 4px; flex-wrap: wrap; }
.insp .hint { margin: -8px 0 0; }
.insp-sec { display: flex; flex-direction: column; gap: 8px; }
.insp-label { font-size: .66rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.insp-fields { gap: 10px; padding: 14px 16px; border-radius: .5rem; background: var(--surface-lowest); }
.layout-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 6px; }
.layout-opt { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 7px 4px 6px; border: 0; border-radius: .375rem; background: var(--surface-lowest); cursor: pointer; font-size: .68rem; font-weight: 600; color: var(--muted); box-shadow: inset 0 0 0 1px rgb(195 198 216 / .35); transition: box-shadow 150ms var(--ease), color 150ms var(--ease); }
.layout-opt svg { width: 52px; height: 29px; border-radius: 2px; background: var(--surface-low); }
.layout-opt svg rect, .layout-opt svg circle { fill: var(--icon); }
.layout-opt svg .m { fill: #c4c6c5; }
.layout-opt svg .a { fill: var(--icon-accent); }
.layout-opt svg .p { fill: #e6e6e4; }
.layout-opt svg .p2 { fill: none; stroke: var(--icon); stroke-width: .9; }
.layout-opt svg .l { fill: none; stroke: #b0b2b1; stroke-width: .8; }
.layout-opt svg .d { fill: var(--primary); }
.layout-opt svg .w { fill: #fff; }
.layout-opt svg .wm { fill: #a9a9a8; }
.layout-opt svg text { font: 700 8px var(--serif); fill: var(--icon-accent); }
.layout-opt svg text.q { font-size: 12px; }
.layout-opt:hover { box-shadow: inset 0 0 0 1px var(--primary); color: var(--on-surface); }
.layout-opt[aria-checked="true"] { box-shadow: inset 0 0 0 2px var(--tertiary); color: var(--on-surface); }
body:not([data-tab="create"]) .actions .for-row, body:not([data-tab="create"]) .actions .go { display: none; }
body:not([data-tab="create"]) .actions { margin-top: 8px; }
.sw-def { font-size: .68rem; color: var(--muted); font-weight: 400; }

/* ---------- Deck header (ADR-0016) ---------- */
.brand { min-width: 0; }
a.brand-mark { color: inherit; text-decoration: none; }
.back-decks { font-size: .8rem; font-weight: 600; color: var(--muted); text-decoration: none; white-space: nowrap; padding: 6px 8px; border-radius: .375rem; }
.back-decks:hover { background: var(--surface-low); color: var(--on-surface); }
.deck-title { min-width: 120px; width: 22ch; max-width: 34vw; border: 0; background: transparent; border-radius: .375rem; padding: 6px 10px; font: 600 .95rem var(--sans); color: var(--on-surface); text-overflow: ellipsis; }
.deck-title:hover { background: var(--surface-low); }
.deck-title:focus { outline: none; background: var(--surface-lowest); box-shadow: inset 0 0 0 2px var(--primary); }
.saved { font-size: .75rem; color: var(--muted); white-space: nowrap; min-width: 56px; }
.saved[data-state="saving"] { color: var(--muted); font-style: italic; }
.saved[data-state="error"] { color: var(--danger); font-weight: 600; }
@media (max-width: 900px) { .back-decks { display: none; } .deck-title { width: 14ch; } }

/* ---------- My decks (ADR-0016) ---------- */
body.decks-page { min-height: 100vh; }
.decks-main { padding: 24px 32px 48px; max-width: 1280px; width: 100%; margin: 0 auto; box-sizing: border-box; }
.decks-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 8px; }
.decks-head h1 { margin: 0; font-family: var(--serif); font-weight: 400; font-size: 2rem; letter-spacing: -0.02em; }
.decks-tools { display: flex; gap: 16px; }
.bin-note { margin: 0 0 8px; }
.deck-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 18px; margin-top: 12px; }
.dk-card { display: flex; flex-direction: column; border-radius: .5rem; background: var(--surface-lowest); box-shadow: 0 1px 3px rgb(0 0 0 / .06), 0 0 0 1px rgb(195 198 216 / .3); overflow: hidden; transition: box-shadow 200ms var(--ease); }
.dk-card:hover { box-shadow: var(--shadow), 0 0 0 1px rgb(195 198 216 / .5); }
.dk-cover { position: relative; }
.dk-open { position: absolute; inset: 0; width: 100%; padding: 0; border: 0; background: none; cursor: pointer; }
.dk-open:focus-visible { outline: 2px solid var(--tertiary); outline-offset: -2px; }
.dk-thumb { height: 195px; display: grid; place-items: center; background: var(--surface-low); }
.dk-frame { position: relative; overflow: hidden; border-radius: .25rem; background: var(--surface-lowest); box-shadow: 0 1px 4px rgb(0 0 0 / .1); }
.dk-frame.empty { display: grid; place-items: center; color: var(--muted); font-size: .8rem; box-shadow: inset 0 0 0 1px rgb(195 198 216 / .6); }
.dk-page { position: absolute; left: 0; top: 0; transform-origin: 0 0; pointer-events: none; }
.dk-body { padding: 12px 16px 4px; min-width: 0; }
.dk-title { margin: 0; font-size: 1rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dk-rename { width: 100%; box-sizing: border-box; border: 0; border-radius: .25rem; padding: 2px 6px; margin: -2px -6px; font: 600 1rem var(--sans); box-shadow: inset 0 0 0 2px var(--primary); outline: none; }
.dk-meta, .dk-when { margin: 3px 0 0; font-size: .78rem; color: var(--muted); }
.dk-actions { display: flex; gap: 6px; padding: 10px 16px 14px; flex-wrap: wrap; }
.ghost.danger { color: var(--danger); }
.dk-new { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; min-height: 300px; border: 1px dashed rgb(195 198 216 / .9); border-radius: .5rem; background: transparent; cursor: pointer; font-weight: 600; color: var(--muted); }
.dk-new .plus { font-size: 2rem; line-height: 1; font-weight: 300; }
.dk-new:hover { border-color: var(--primary); color: var(--on-surface); }
.dk-empty { grid-column: 1 / -1; text-align: center; padding: 64px 16px; color: var(--muted); }
.dk-empty h2 { font-family: var(--serif); font-weight: 400; color: var(--on-surface); }
dialog.new-deck { width: min(520px, calc(100vw - 32px)); }
dialog.new-deck form { padding: 28px 32px; }
dialog.new-deck h2 { margin: 0 0 20px; font-family: var(--serif); font-weight: 400; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
@media (max-width: 600px) { .decks-main { padding: 16px; } .deck-grid { grid-template-columns: 1fr; } }

/* ---------- Library: Brands › Campaigns › Decks (ADR-0017) ---------- */
.crumbs { display: flex; gap: 8px; align-items: center; font-size: .82rem; min-height: 1.4em; margin-bottom: 6px; }
.crumbs a { color: var(--muted); text-decoration: none; font-weight: 600; }
.crumbs a:hover { color: var(--on-surface); text-decoration: underline; }
.crumbs .sep { color: var(--muted); opacity: .6; }
.head-text { min-width: 0; }
.page-sub { margin: 4px 0 0; font-size: .85rem; color: var(--muted); }
#pageTitle.editable { cursor: text; border-radius: .375rem; padding: 0 6px; margin-left: -6px; }
#pageTitle.editable:hover { background: var(--surface-low); }
.title-rename { font: 400 2rem var(--serif); letter-spacing: -0.02em; border: 0; border-radius: .375rem; padding: 0 6px; margin-left: -6px; box-shadow: inset 0 0 0 2px var(--primary); outline: none; width: min(640px, 100%); }
.lib-sec { margin-top: 32px; }
.lib-sec > h2, .cp-panel h2 { margin: 0 0 4px; font-size: .72rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.lib-sec > .hint { margin: 0 0 12px; }
.brand-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; margin-top: 16px; }
.br-card { display: flex; flex-direction: column; border-radius: .5rem; overflow: hidden; background: var(--surface-lowest); text-decoration: none; color: inherit; box-shadow: 0 1px 3px rgb(0 0 0 / .06), 0 0 0 1px rgb(195 198 216 / .3); transition: box-shadow 200ms var(--ease), transform 200ms var(--ease); }
.br-card:hover { box-shadow: var(--shadow), 0 0 0 1px rgb(195 198 216 / .5); transform: translateY(-2px); }
.br-swatch { position: relative; height: 140px; padding: 20px; display: flex; flex-direction: column; justify-content: flex-end; gap: 4px; }
.br-name { font: 400 1.5rem var(--serif); letter-spacing: -0.02em; }
.br-tag { font-size: .78rem; opacity: .75; }
.br-dots { position: absolute; top: 16px; right: 16px; display: flex; gap: 6px; }
.br-dots i { width: 14px; height: 14px; border-radius: 50%; box-shadow: 0 0 0 1px rgb(0 0 0 / .08); }
.br-body { padding: 12px 16px 16px; }
.br-body h3 { margin: 0; font-size: 1rem; }
.camp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 18px; }
.cp-card { display: flex; flex-direction: column; border-radius: .5rem; background: var(--surface-lowest); text-decoration: none; color: inherit; box-shadow: 0 1px 3px rgb(0 0 0 / .06), 0 0 0 1px rgb(195 198 216 / .3); overflow: hidden; transition: box-shadow 200ms var(--ease); }
a.cp-card:hover { box-shadow: var(--shadow), 0 0 0 1px rgb(195 198 216 / .5); }
.cp-covers { display: flex; gap: 8px; align-items: center; justify-content: center; height: 110px; padding: 0 12px; background: var(--surface-low); }
.cp-cover { flex: 0 0 auto; }
.cp-none { font-size: .8rem; color: var(--muted); }
.cp-body { padding: 12px 16px 14px; }
.cp-body h3 { margin: 0; font-size: 1rem; }
.cp-brief { margin: 4px 0 0; font-size: .82rem; color: var(--on-surface); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cp-card.bin .dk-actions { padding-top: 0; }
.camp-grid .dk-new { min-height: 200px; }
.cp-top { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 16px; }
.cp-panel { padding: 18px 20px; border-radius: .5rem; background: var(--surface-lowest); box-shadow: 0 0 0 1px rgb(195 198 216 / .3); display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.cp-panel-head { display: flex; align-items: baseline; justify-content: space-between; }
.cp-panel .hint { margin: 0; }
.cp-brief-edit { min-height: 120px; flex: 0 0 auto; background: var(--surface-low); }
.cp-panel .src-link input:focus { box-shadow: inset 0 0 0 2px var(--primary); }
.src-empty { font-size: .8rem; color: var(--muted); list-style: none; }
@media (max-width: 900px) { .cp-top { grid-template-columns: 1fr; } }

/* Editor header breadcrumb and campaign sources (ADR-0017) */
.head-crumbs { margin: 0; gap: 6px; min-width: 0; }
.head-crumbs a { max-width: 22ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.head-crumbs a[hidden], .head-crumbs .sep[hidden] { display: none; }
.topbar .brand { gap: 12px; }
.camp-src { margin-top: 10px; padding: 8px 10px; border-radius: .375rem; background: var(--surface-low); }
.camp-src-head { margin: 0; font-size: .78rem; color: var(--muted); }
.camp-src-head a { color: var(--on-surface); font-weight: 600; }
.src-list.camp { margin-top: 6px; }
.src-list.camp .src-item { background: var(--surface-lowest); }
@media (max-width: 1100px) { .head-crumbs a { max-width: 12ch; } }
.field[hidden] { display: none; }

/* ---------- Channels (THI-475) ---------- */
.sec-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 4px; }
.sec-head h2 { margin: 0; font-size: .72rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.ch-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; margin-top: 10px; }
.ch-tile { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 14px 16px; border-radius: .5rem; background: var(--surface-lowest); box-shadow: inset 0 0 0 1px rgb(195 198 216 / .4); min-width: 0; }
.ch-tile.has { box-shadow: inset 0 0 0 1px rgb(195 198 216 / .4), inset 3px 0 0 var(--tertiary); }
.ch-tile b { font-size: .9rem; }
.ch-tile small { font-size: .75rem; color: var(--muted); }
.ch-tile .ghost { margin-top: 6px; }
.ch-decks { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; margin-top: 6px; min-width: 0; max-width: 100%; }
.ch-decks .link { text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.ch-decks .ch-more { color: var(--muted); font-weight: 500; }
.make-progress { margin: 10px 0 4px; padding: 14px 16px; border-radius: .5rem; background: var(--surface-lowest); box-shadow: inset 0 0 0 1px rgb(195 198 216 / .4); }
.make-progress[hidden] { display: none; }
.mp-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.make-progress ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.make-progress li { display: grid; grid-template-columns: 200px 1fr auto; gap: 10px; font-size: .84rem; align-items: baseline; }
.mp-label { font-weight: 600; }
.mp-status { color: var(--muted); }
.mp-writing .mp-status { color: var(--on-surface); font-style: italic; }
.mp-done .mp-status { color: var(--primary); }
.mp-failed .mp-status { color: var(--tertiary); }
.make-progress a { font-weight: 600; color: var(--tertiary); font-size: .82rem; }
.mk-list { display: flex; flex-direction: column; gap: 6px; margin: 12px 0; }
.mk-opt { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: .375rem; background: var(--surface-low); cursor: pointer; }
.mk-opt:has(input:checked) { box-shadow: inset 0 0 0 2px var(--primary); background: var(--surface-lowest); }
.mk-opt b { display: block; font-size: .9rem; }
.mk-opt small { display: block; font-size: .76rem; color: var(--muted); }
.export-suggest { margin: 8px 0 0; }
.ch-add select { margin-top: 6px; width: 100%; border: 0; border-radius: .375rem; background: var(--surface-low); padding: 7px 10px; font-size: .82rem; cursor: pointer; }
.ch-add { box-shadow: inset 0 0 0 1px rgb(195 198 216 / .6); background: transparent; border: 1px dashed rgb(195 198 216 / .9); }
.mk-list { max-height: 52vh; overflow-y: auto; padding-right: 4px; }
.mk-group { border: 0; margin: 0 0 8px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.mk-group legend { font-size: .66rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }

/* ---------- undo and version history (THI-460) ---------- */
.undo-group { display: inline-flex; align-items: center; gap: 2px; margin-left: 4px; }
.ghost.small.icon { min-width: 30px; padding-inline: 6px; font-size: 1rem; line-height: 1; }
.ghost.small.icon:disabled { opacity: .35; cursor: default; }
dialog.history-dialog { width: min(1080px, calc(100vw - 32px)); }
.history-body { display: grid; grid-template-columns: 280px 1fr; gap: 24px; min-height: 0; margin-top: 8px; }
.history-list { list-style: none; margin: 0; padding: 0; max-height: 60vh; overflow: auto; display: flex; flex-direction: column; gap: 2px; }
.history-list .hv { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; text-align: left; padding: 10px 12px; border: 0; border-radius: .375rem; background: transparent; color: inherit; font: inherit; cursor: pointer; }
.history-list .hv:hover { background: var(--surface-low); }
.history-list .hv[aria-pressed="true"] { background: var(--surface-container); box-shadow: inset 3px 0 0 var(--primary); }
.history-list .hv b { font-weight: 600; font-size: .875rem; }
.history-list .hv small { color: var(--muted); font-size: .75rem; }
.history-preview { display: flex; flex-direction: column; align-items: center; min-width: 0; }
.history-frame { position: relative; background: var(--surface-lowest); border-radius: .5rem; overflow: hidden; box-shadow: var(--shadow); }
@media (max-width: 760px) {
  .history-body { grid-template-columns: 1fr; }
  .history-list { max-height: 30vh; }
}

/* ---------- refine with Claude (THI-459) ---------- */
.ask { padding: 12px 14px; border-radius: .5rem; background: var(--surface-low); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid rgb(195 198 216 / .9); background: var(--surface-lowest); cursor: pointer; padding: 4px 11px; border-radius: 999px; font: inherit; font-size: .76rem; color: var(--on-surface); transition: all 200ms var(--ease); }
.chip:hover:not(:disabled) { border-color: var(--primary); }
.chip:disabled { opacity: .45; cursor: default; }
.ask-row { display: flex; gap: 6px; }
.ask-input { flex: 1; min-width: 0; font: inherit; font-size: .82rem; padding: 6px 10px; border: 1px solid rgb(195 198 216 / .9); border-radius: .375rem; background: var(--surface-lowest); color: var(--on-surface); }
.refine-status { display: flex; align-items: center; gap: 10px; padding: 10px 14px; margin-bottom: 12px; border-radius: .5rem; background: var(--surface-container); font-size: .82rem; }
.refine-status[hidden] { display: none; }
.refine-status #refineText { flex: 1; }
.refine-status .spinner { width: 14px; height: 14px; border-radius: 50%; border: 2px solid rgb(0 0 0 / .12); border-top-color: var(--primary); animation: rf-spin .8s linear infinite; }
@keyframes rf-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .refine-status .spinner { animation: none; } }
.deck-ask { margin-top: 14px; flex-shrink: 0; }
.deck-ask summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 6px; }
.deck-ask summary::-webkit-details-marker { display: none; }
.deck-ask summary::before { content: '▸'; font-size: .8rem; transition: transform 200ms var(--ease); }
.deck-ask[open] summary::before { transform: rotate(90deg); }
.deck-ask[open] summary { margin-bottom: 10px; }

/* ---------- brand setup (THI-461) ---------- */
dialog#settings.wide { width: min(1180px, calc(100vw - 32px)); }
.brand-setup { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 28px; align-items: start; }
.brand-form { min-width: 0; }
.brand-preview { position: sticky; top: 0; display: flex; flex-direction: column; gap: 10px; }
.bp-frame { position: relative; width: 100%; aspect-ratio: 16 / 9; border-radius: .5rem; overflow: hidden; box-shadow: var(--shadow); background: var(--surface-lowest); }
.bp-nav { display: flex; gap: 8px; justify-content: center; }
.bp-dot { width: 10px; height: 10px; padding: 0; border-radius: 50%; border: 0; background: rgb(0 0 0 / .18); cursor: pointer; }
.bp-dot[aria-pressed="true"] { background: var(--primary); }
.logo-row { display: flex; gap: 16px; align-items: center; margin-bottom: 12px; }
.logo-thumb { width: 120px; height: 72px; flex-shrink: 0; border-radius: .375rem; background: var(--surface-low) center / contain no-repeat; border: 1px solid rgb(195 198 216 / .6); }
.logo-thumb.empty { background-image: repeating-linear-gradient(45deg, transparent 0 8px, rgb(0 0 0 / .03) 8px 16px); }
.logo-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.logo-actions .hint { flex-basis: 100%; margin: 0; }
.file-btn { cursor: pointer; display: inline-flex; align-items: center; }
.logo-suggest { margin-top: 12px; padding: 10px 12px; border-radius: .5rem; background: var(--surface-low); display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.logo-suggest[hidden] { display: none; }
.sugg-swatches { display: flex; gap: 14px; flex: 1; flex-wrap: wrap; }
.sugg { display: inline-flex; align-items: center; gap: 6px; font-size: .78rem; }
.sugg i { width: 20px; height: 20px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgb(0 0 0 / .12); }
.basic-colours { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 20px; }
.bc { display: flex; gap: 10px; align-items: center; }
.bc input[type="color"] { width: 44px; height: 44px; flex-shrink: 0; padding: 0; border: 0; border-radius: .5rem; background: none; cursor: pointer; }
.bc label { display: flex; flex-direction: column; gap: 1px; min-width: 0; font-size: .82rem; }
.bc small { color: var(--muted); font-size: .72rem; }
.bc .hex { width: 90px; font: inherit; font-family: var(--mono); font-size: .76rem; padding: 2px 6px; margin-top: 3px; border: 1px solid rgb(195 198 216 / .9); border-radius: .25rem; background: var(--surface-lowest); color: var(--on-surface); }
.contrast { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 4px; font-size: .76rem; color: var(--muted); }
.contrast li { display: flex; gap: 8px; align-items: center; }
.contrast .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); flex-shrink: 0; }
.contrast li[data-ok="fair"] .dot { background: var(--warn); }
.contrast li[data-ok="poor"] .dot { background: var(--danger); }
.contrast li[data-ok="poor"] { color: var(--danger); font-weight: 600; }
details.more { margin-top: 12px; }
details.more > summary { cursor: pointer; font-size: .8rem; font-weight: 600; color: var(--muted); }
details.more[open] > summary { margin-bottom: 10px; }
.font-pick { position: relative; }
.font-pick input { width: 100%; }
.font-list { position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + 4px); max-height: 280px; overflow: auto; margin: 0; padding: 6px; list-style: none; background: var(--surface-lowest); border-radius: .5rem; box-shadow: var(--shadow), 0 0 0 1px rgb(195 198 216 / .4); }
.font-list[hidden] { display: none; }
.font-kind { padding: 8px 8px 4px; font-size: .64rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.font-opt { padding: 6px 8px; border-radius: .25rem; cursor: pointer; font-size: 1.05rem; }
.font-opt:hover, .font-opt.active { background: var(--surface-container); }
@media (max-width: 900px) {
  .brand-setup { grid-template-columns: minmax(0, 1fr); }
  .brand-preview { position: static; order: -1; min-width: 0; }
}

/* ---------- first run (THI-463) ---------- */
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.welcome { margin: 8px 0 28px; padding: 24px 28px; border-radius: .75rem; background: var(--surface-lowest); box-shadow: var(--shadow); }
.wl-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.wl-head h2 { margin: 0; font-family: var(--serif); font-weight: 400; font-size: 1.6rem; }
.wl-head .page-sub { margin: 4px 0 0; }
.wl-steps { list-style: none; margin: 20px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.wl-steps li { display: grid; grid-template-columns: auto 1fr; grid-template-rows: 1fr auto; gap: 6px 12px; padding: 16px; border-radius: .5rem; background: var(--surface-low); }
.wl-steps li > div { min-width: 0; }
.wl-steps li > button { grid-column: 2; justify-self: start; }
.wl-steps b { font-size: .92rem; }
.wl-steps p { margin: 4px 0 0; font-size: .8rem; color: var(--muted); }
.wl-num { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: .82rem; background: var(--surface-lowest); color: var(--on-surface); box-shadow: inset 0 0 0 1px rgb(195 198 216 / .8); }
.wl-steps li.done .wl-num { background: var(--primary); color: #fff; box-shadow: none; }
.wl-steps li.done b { color: var(--muted); }
.wl-ex { margin: 24px 0 10px; font-size: .72rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.ex-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.ex-card { display: flex; flex-direction: column; text-align: left; padding: 0; border: 0; border-radius: .5rem; overflow: hidden; background: var(--surface-lowest); box-shadow: var(--shadow), 0 0 0 1px rgb(195 198 216 / .3); cursor: pointer; font: inherit; color: inherit; transition: transform 200ms var(--ease); }
.ex-card:hover { transform: translateY(-2px); }
.ex-card .dk-thumb { height: 150px; overflow: hidden; }
.ex-body { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px 12px; }
.ex-body b { font-size: .88rem; }
.ex-body small { font-size: .74rem; color: var(--muted); }
.lib-sec.start { padding: 22px 24px; border-radius: .75rem; background: var(--surface-lowest); box-shadow: var(--shadow); }
.lib-sec.start > h2 { font-family: var(--serif); font-size: 1.4rem; font-weight: 400; letter-spacing: 0; text-transform: none; color: var(--on-surface); }
.start-actions { display: flex; gap: 10px; margin: 6px 0 18px; flex-wrap: wrap; }
@media (max-width: 640px) { .welcome { padding: 18px; } .wl-head { flex-direction: column; } }
.frame-empty { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: center; padding: 8% 10%; background: var(--surface-lowest); cursor: default; }
.frame-empty[hidden] { display: none; }
.frame-empty h3 { margin: 0 0 14px; font-family: var(--serif); font-weight: 400; font-size: 1.5rem; }
.frame-empty ol { margin: 0; padding-left: 1.2em; display: grid; gap: 8px; font-size: .9rem; color: var(--muted); max-width: 520px; }

/* ---------- export and share (THI-464) ---------- */
dialog#exportDialog { width: min(820px, calc(100vw - 32px)); }
.goals { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.goal { display: flex; flex-direction: column; gap: 4px; text-align: left; padding: 12px 14px; border-radius: .5rem; border: 1px solid rgb(195 198 216 / .7); background: var(--surface-lowest); font: inherit; color: inherit; cursor: pointer; transition: border-color 200ms var(--ease), background 200ms var(--ease); }
.goal:hover { border-color: var(--primary); }
.goal[aria-checked="true"] { border-color: var(--primary); background: var(--surface-low); box-shadow: inset 0 0 0 1px var(--primary); }
.goal b { font-size: .88rem; }
.goal small { font-size: .74rem; color: var(--muted); line-height: 1.35; }
.export-plan { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: baseline; margin: 16px 0 4px; padding: 12px 14px; border-radius: .5rem; background: var(--surface-low); font-size: .84rem; }
.export-plan .ep-time { color: var(--muted); }
.share-panel { margin-top: 16px; }
.share-row { display: flex; gap: 8px; align-items: center; margin: 10px 0; }
.share-row input { flex: 1; min-width: 0; font: inherit; font-size: .82rem; padding: 8px 10px; border: 1px solid rgb(195 198 216 / .9); border-radius: .375rem; background: var(--surface-lowest); color: var(--on-surface); }
a.ghost.button { display: inline-flex; align-items: center; text-decoration: none; }
#exportFileBox[hidden], #sharePanel[hidden], #exportPresent[hidden], #doExport[hidden] { display: none; }
@media (max-width: 700px) { .goals { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---------- settings at the top level (THI-478) ---------- */
.settings-brand { display: flex; align-items: flex-end; gap: 14px; margin-bottom: 18px; }
.settings-brand .f { display: flex; flex-direction: column; gap: 4px; }
.settings-brand select { min-width: 260px; font: inherit; font-size: .95rem; font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--on-surface); padding: 8px 10px; border: 1px solid rgb(195 198 216 / .9); border-radius: .375rem; background: var(--surface-lowest); }

/* ---------- account menu (THI-479) ---------- */
.account { position: relative; }
.account-btn { padding: 0; border: 0; background: none; cursor: pointer; border-radius: 50%; display: grid; }
.account-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.avatar { display: inline-grid; place-items: center; flex-shrink: 0; border-radius: 50%; background: var(--surface-container) center / cover no-repeat; color: var(--on-surface); font-weight: 700; letter-spacing: .02em; box-shadow: inset 0 0 0 1px rgb(0 0 0 / .06); overflow: hidden; }
.avatar.small { width: 36px; height: 36px; font-size: .8rem; }
.avatar.large { width: 56px; height: 56px; font-size: 1.1rem; }
.avatar-blank { width: 42%; height: 42%; border-radius: 50%; background: var(--muted); opacity: .45; box-shadow: 0 0.55em 0 0.28em color-mix(in srgb, var(--muted) 45%, transparent); transform: translateY(-18%); }
.account-menu { position: absolute; right: 0; top: calc(100% + 8px); z-index: 30; min-width: 250px; padding: 8px; border-radius: .5rem; background: var(--surface-lowest); box-shadow: var(--shadow), 0 0 0 1px rgb(195 198 216 / .4); display: flex; flex-direction: column; }
.account-menu[hidden] { display: none; }
.am-head { display: flex; gap: 12px; align-items: center; padding: 8px 8px 12px; margin-bottom: 4px; border-bottom: 1px solid rgb(195 198 216 / .4); }
.am-head b { display: block; font-size: .9rem; }
.am-head small { color: var(--muted); font-size: .76rem; }
.account-menu [role=menuitem] { text-align: left; border: 0; background: none; font: inherit; font-size: .86rem; color: var(--on-surface); padding: 9px 10px; border-radius: .375rem; cursor: pointer; }
.account-menu [role=menuitem]:hover, .account-menu [role=menuitem]:focus-visible { background: var(--surface-low); outline: none; }
.pf-photo { display: flex; gap: 16px; align-items: center; margin-bottom: 16px; }
.pf-photo-actions { display: flex; gap: 12px; align-items: center; }
.help-h { margin: 18px 0 8px; font-size: .72rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.help-steps { margin: 0; padding-left: 1.2em; display: grid; gap: 6px; font-size: .88rem; }
.help-keys { border-collapse: collapse; font-size: .86rem; width: 100%; }
.help-keys th { text-align: left; font-weight: 400; padding: 5px 16px 5px 0; white-space: nowrap; width: 1%; }
.help-keys td { padding: 5px 0; color: var(--muted); }
kbd { font-family: var(--mono); font-size: .78rem; padding: 2px 7px; border-radius: .25rem; background: var(--surface-low); box-shadow: inset 0 -1px 0 rgb(0 0 0 / .12); }


/* ---------- accessibility (THI-466) ---------- */
/* A clear focus ring on everything you can reach with the keyboard. */
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible { outline: 2px solid var(--tertiary); outline-offset: 2px; }
:where(input, select, textarea):focus-visible { outline-offset: 0; }
/* Filmstrip: each slide is a button inside its list item. */
.fs-pick { position: absolute; inset: 0; z-index: 1; width: 100%; padding: 0; border: 0; background: none; cursor: pointer; }
.fs-pick:focus-visible { outline: none; }
.fs-item:has(.fs-pick:focus-visible) .fs-thumb { box-shadow: 0 0 0 2px var(--tertiary), 0 0 0 5px rgb(var(--accent-rgb) / .2); }
.fs-add-item { display: flex; align-items: flex-end; flex: 0 0 auto; }
/* Less motion when the system asks for it: the app's own transitions and spinners stop. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
}

/* ---------- phones and small screens (THI-466) ---------- */
@media (max-width: 960px) {
  /* The editor stops fitting one screen: the page scrolls, and nothing is squeezed. */
  html, body { height: auto; }
  .workspace { flex: none; }
  .panel { min-height: auto; }
  .frame-wrap { flex-shrink: 0; max-height: none; }
}
@media (max-width: 700px) {
  .topbar { flex-wrap: wrap; gap: 6px 10px; padding: 10px 16px; }
  .topbar { align-items: flex-start; }
  .topbar .brand { flex: 1 1 0; flex-wrap: wrap; gap: 4px 8px; min-width: 0; }
  .head-crumbs { display: none; }
  .deck-title { flex: 1 1 140px; width: auto; max-width: none; min-width: 0; }
  .top-actions { flex: 0 0 auto; gap: 8px; }
  /* Settings is in the account menu, so phones keep just the avatar. */
  .top-actions #openSettings { display: none; }
  /* Check the slides first; the tools follow. */
  .preview-panel { order: -1; }
  .preview-bar { gap: 8px; }
  .seg.formats { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
  .seg.formats::-webkit-scrollbar { display: none; }
  .seg.formats button { flex: 0 0 auto; }
  .frame-wrap[data-shape="tall"], .frame-wrap[data-shape="square"] { width: 100%; height: auto; min-height: 0; max-width: 100%; }
  .nav { flex-wrap: wrap; }
  .hint.center { display: none; }
  .editor-panel { padding: 16px; }
  .decks-head { flex-wrap: wrap; gap: 12px; }
  .decks-tools { flex-wrap: wrap; }
  dialog { width: calc(100vw - 16px); max-height: calc(100vh - 16px); }
  .dialog { padding: 20px 18px; }
  .settings-head { flex-wrap: wrap; gap: 8px; }
  .settings-brand { flex-wrap: wrap; }
  .settings-brand select { min-width: 0; width: 100%; }
}

/* ---------- brand library on the brand page (THI-480) ---------- */
.bl-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.bl-head .hint { margin: 0 0 12px; max-width: 60ch; }
.bl-filters { margin: 0 0 12px; }
.bl-filters[hidden] { display: none; }
.chip[aria-pressed="true"] { border-color: var(--primary); background: var(--surface-low); font-weight: 600; }
.bl-drop { min-height: 140px; }
.bl-empty { margin: 0 0 8px; color: var(--muted); font-size: .88rem; }
.bl-empty[hidden] { display: none; }
.img-card.is-logo { box-shadow: 0 0 0 2px var(--tertiary); }
.img-card .thumb { position: relative; }
.logo-badge { position: absolute; top: 6px; left: 6px; padding: 2px 8px; border-radius: 999px; font-size: .68rem; font-weight: 700; background: var(--tertiary); color: #fff; }
@media (max-width: 700px) { .bl-head { flex-direction: column; } }
.brand-lib .grid { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.bl-head h2 { margin: 0 0 4px; font-size: .72rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }


/* ---------- Thinkreel identity: "Frames" (THI-492, ADR-0024) ---------- */
.brand-mark { display: inline-flex; align-items: center; gap: 9px; font-family: var(--display); font-weight: 800; font-size: 1.3rem; letter-spacing: -0.045em; color: var(--ink); text-decoration: none; }
.brand-mark svg { width: 30px; height: 30px; flex-shrink: 0; }
.wm-think { color: var(--primary); }
/* Headings: Plus Jakarta Sans ExtraBold, tight. */
.dialog h2, .decks-head h1, .wl-head h2, dialog.new-deck h2, .frame-empty h3, .insp-head h2, .brief-label, .lib-sec.start > h2, .dk-empty h2 { font-weight: 800; letter-spacing: -0.03em; }
.decks-head h1 { font-size: 2.5rem; line-height: 1.1; }
.primary { background: var(--primary); border-radius: var(--radius); }
.primary:hover:not(:disabled) { background: var(--primary-container); filter: none; }
/* Strong: ink, for important actions that aren't the main one (Export). */
.primary.strong { background: var(--ink); }
.primary.strong:hover:not(:disabled) { background: #23252d; }
.ghost { border: 1.5px solid var(--line); border-radius: var(--radius); }
.ghost:hover:not(:disabled) { border-color: var(--primary); }
:focus-visible { outline: 2px solid var(--tertiary); outline-offset: 2px; }
a { color: inherit; }
.link { color: var(--tertiary); }
.link.danger { color: var(--danger); }

/* Home: the welcome banner (S1a) */
.hello { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin: 0 0 28px; padding: 24px 28px; border-radius: 16px; background: var(--ink); color: #fff; }
.hello-text { flex: 1 1 280px; min-width: 0; }
.hello h2 { margin: 0; font-family: var(--display); font-weight: 800; font-size: 1.6rem; letter-spacing: -0.035em; line-height: 1.15; }
.hello p { margin: 4px 0 0; color: #c9cad3; }
.hello .ghost { color: #fff; border-color: #3a3d48; background: #23252d; }
.hello .ghost:hover:not(:disabled) { border-color: #b19cff; }
.hello .primary { padding: 11px 18px; }

/* ---------- brand from a website (THI-451) ---------- */
.site-fill { display: flex; align-items: flex-end; gap: 10px; margin: 0 0 18px; padding: 12px 14px; border-radius: .5rem; background: var(--surface-low); }
.site-fill .f { flex: 1; min-width: 0; }
.site-fill input { width: 100%; }
#brandFromField[hidden] { display: none; }

/* ---------- brand facts (THI-473) ---------- */
.src-note { display: flex; gap: 8px; align-items: flex-end; margin: 10px 0 4px; }
.src-note textarea { flex: 1; min-width: 0; min-height: 0; font: inherit; font-size: .84rem; padding: 8px 10px; border: 1px solid rgb(195 198 216 / .9); border-radius: .375rem; background: var(--surface-lowest); color: var(--on-surface); resize: vertical; }
.brand-facts .cp-panel { max-width: none; }
.facts-toggle { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.facts-toggle input { width: 16px; height: 16px; }

/* ---------- editor top bar (THI-493): where you are · this deck · you ---------- */
.editor-bar .brand { flex: 1 1 auto; min-width: 0; flex-wrap: nowrap; gap: 10px; }
.editor-bar .brand-mark .wm { display: none; }  /* the mark alone; the library header keeps the wordmark */
.bar-div { width: 1px; height: 24px; background: var(--line); flex-shrink: 0; }
.editor-bar .head-crumbs { flex: 0 10 auto; min-width: 0; margin: 0; overflow: hidden; white-space: nowrap; }
.editor-bar .head-crumbs a { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.deck-name { display: flex; align-items: center; gap: 2px; flex: 0 1 auto; min-width: 0; padding: 2px; border-radius: var(--radius); background: var(--surface); }
.editor-bar .deck-title { max-width: 100%; min-width: 8ch; font: 700 .95rem var(--sans); padding: 6px 8px; }
.deck-menu-wrap { position: relative; flex-shrink: 0; }
.deck-menu { left: auto; right: 0; min-width: 280px; }
.deck-menu .danger { color: var(--danger); }
.menu-sep { height: 1px; margin: 4px 6px; background: var(--surface-container); }
.phone-only { display: none; }
.icon-btn { display: inline-grid; place-items: center; width: 34px; height: 34px; padding: 0; border: 0; border-radius: 8px; background: none; color: var(--on-surface); cursor: pointer; flex-shrink: 0; }
.icon-btn:hover:not(:disabled) { background: var(--surface-low); }
.icon-btn:disabled { color: var(--icon); cursor: default; }
.icon-btn[aria-expanded="true"] { background: var(--surface-container); }
.editor-bar .undo-group { gap: 0; margin-left: 0; flex-shrink: 0; }
.editor-bar .saved { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; flex-shrink: 0; margin-left: 6px; }
.editor-bar .saved[data-state="saved"]::before { content: '✓'; color: var(--ok); font-weight: 700; }
@media (max-width: 700px) {
  .editor-bar { flex-wrap: nowrap; align-items: center; }
  .editor-bar .brand { flex-wrap: nowrap; gap: 6px; }
  .editor-bar .bar-div, .editor-bar .head-crumbs, .editor-bar #redo, .editor-bar #openHistory, .editor-bar .saved { display: none; }
  .editor-bar .deck-title { flex: 1 1 auto; width: auto !important; min-width: 0; }
  .deck-name { flex: 1 1 auto; }
  .phone-only { display: block; }
}
