/* Evidence gap prioritization survey — tokens and layouts follow the design handoff
   (1a rating desktop, 1e rating mobile, 2a playback desktop, 2b playback mobile).
   Desktop is ≥768px; below that the mobile structures take over. */

:root {
  --accent: oklch(0.50 0.11 248);
  --accent-deep: oklch(0.44 0.12 248);
  --accent-tint: oklch(0.975 0.015 248);
  --accent-row-tint: oklch(0.98 0.012 248);
  --medium: oklch(0.80 0.05 248);
  --medium-ink: oklch(0.32 0.08 248);
  --pill-ink: oklch(0.46 0.09 168);
  --pill-ink-row: oklch(0.42 0.08 168);
  --pill-bg: oklch(0.95 0.03 168);
  --timing-bg: oklch(0.94 0.035 60);
  --timing-ink: oklch(0.38 0.09 60);
  --timing-missing-border: oklch(0.70 0.08 60);
  --timing-missing-ink: oklch(0.40 0.09 60);
  --warn-bg: oklch(0.97 0.025 75);
  --warn-border: oklch(0.86 0.06 75);
  --warn-dot: oklch(0.62 0.13 60);
  --warn-ink: oklch(0.36 0.08 60);
  --warn-body: oklch(0.38 0.05 60);
  --warn-btn-border: oklch(0.72 0.09 60);

  --ink: #15140f;
  --surface: #fff;
  --surface-alt: #fcfbf9;
  --surface-sunken: #faf9f6;
  --page: #eeece7;
  --page-mobile: #f7f6f3;

  --hairline: rgba(0, 0, 0, .07);
  --hairline-card: rgba(0, 0, 0, .09);
  --control: rgba(0, 0, 0, .13);
  --control-2: rgba(0, 0, 0, .14);
  --muted: rgba(0, 0, 0, .55);
  --muted-2: rgba(0, 0, 0, .58);
  --muted-strong: rgba(0, 0, 0, .65);
  --faint: rgba(0, 0, 0, .45);
  --low: rgba(0, 0, 0, .14);
  --skip-stripes: repeating-linear-gradient(135deg, rgba(0, 0, 0, .1) 0 4px, rgba(0, 0, 0, .04) 4px 8px);
  --skip-swatch: repeating-linear-gradient(135deg, rgba(0, 0, 0, .22) 0 3px, transparent 3px 6px);

  --sans: 'Instrument Sans', Helvetica, system-ui, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;
  --card-shadow: 0 1px 3px rgba(0, 0, 0, .06), 0 14px 34px -20px rgba(0, 0, 0, .3);
  --focus: 0 0 0 3px oklch(0.50 0.11 248 / .35);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--page);
  color: var(--ink);
  font: 400 15px/1.45 var(--sans);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, p { margin: 0; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
legend { padding: 0; }
:focus-visible { outline: none; box-shadow: var(--focus); }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (min-width: 768px) { .m-only { display: none !important; } }
@media (max-width: 767px) { .d-only { display: none !important; } }
@media (hover: none) and (pointer: coarse) { .kbd, .enter-hint { display: none !important; } }

.loading { padding: 80px 24px; text-align: center; color: var(--muted); }

/* ------------------------------------------------------------------ shared primitives */
.page { padding: 48px 16px 40px; display: flex; flex-direction: column; align-items: center; }
.card {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--hairline-card);
  border-radius: 10px;
  box-shadow: var(--card-shadow);
  overflow: hidden;
}
.eyebrow { font: 500 10px var(--mono); letter-spacing: .07em; text-transform: uppercase; color: var(--muted-2); }
.band { background: var(--surface-alt); }
.band--head { border-bottom: 1px solid var(--hairline); }
.band--foot { border-top: 1px solid var(--hairline); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 7px; text-decoration: none; white-space: nowrap;
}
.btn--primary { background: var(--ink); color: #fff; font: 600 14px var(--sans); padding: 11px 22px; }
.btn--primary:hover { background: #2b2a24; }
.btn--primary[disabled] { opacity: .6; cursor: progress; }
.btn--secondary {
  background: var(--surface); color: var(--muted-strong); font: 500 14px var(--sans);
  padding: 12px 18px; border: 1px solid rgba(0, 0, 0, .18);
}
.btn--secondary:hover { background: var(--surface-alt); color: var(--ink); }
.btn--small { font-size: 13px; padding: 8px 14px; }
.link-btn { background: none; border: 0; padding: 0; color: var(--accent); font: 500 13px var(--sans); border-radius: 4px; }
.link-btn:hover { color: oklch(0.42 0.12 248); text-decoration: underline; text-underline-offset: 2px; }
.link-btn--quiet { color: var(--muted-2); font-weight: 400; }
.link-btn--quiet:hover { color: var(--ink); }

.kbd {
  font: 500 11px var(--mono); color: rgba(0, 0, 0, .35);
  border: 1px solid var(--control-2); border-radius: 4px; padding: 2px 6px; flex: none;
}

.progress { height: 4px; border-radius: 2px; background: rgba(0, 0, 0, .09); overflow: hidden; }
.progress__fill { height: 100%; background: var(--accent); transition: width .2s ease-out; }

.theme-pill {
  display: inline-block; font: 500 10px var(--mono); letter-spacing: .06em; text-transform: uppercase;
  color: var(--pill-ink); background: var(--pill-bg); padding: 4px 9px; border-radius: 4px;
}

/* ------------------------------------------------------------------ brand footer (every page) */
/* Bottom-aligned so the Coactuate wordmark sits on the Biogen baseline (the Biogen image has a descender below it). */
.brand-foot {
  margin-top: auto; padding: 20px 16px 28px; display: flex; align-items: flex-end; justify-content: center; gap: 14px;
}
.brand-foot img { display: block; width: auto; }
.brand-foot__coactuate { height: 17px; margin-bottom: 5px; }
.brand-foot__x { font: 400 15px/1 var(--sans); color: var(--faint); margin-bottom: 6px; }
.brand-foot__partner { height: 30px; }

/* ------------------------------------------------------------------ hub (coactuate.live) */
.page--hub { flex: 1; justify-content: center; }
.hub { max-width: 560px; padding: 34px 32px 30px; }
.hub__welcome { margin-top: 12px; font: 400 14.5px/1.5 var(--sans); color: var(--muted-strong); }
.hub__title { margin-top: 10px; font: 500 27px/1.28 var(--sans); text-wrap: balance; }
.hub__about { margin-top: 14px; font: 400 14px/1.55 var(--sans); color: var(--muted-2); text-wrap: pretty; }
.hub__more { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--hairline); font: 400 13px var(--sans); color: var(--muted-2); }
.hub a, .welcome__intro a, .welcome__foot .note a { color: var(--accent); text-underline-offset: 2px; }

/* ------------------------------------------------------------------ welcome */
.page--welcome .card { max-width: 580px; }
.welcome__body { padding: 30px 28px 26px; }
.welcome__title { margin-top: 10px; font: 400 25px/1.28 var(--sans); text-wrap: pretty; }
.welcome__intro { margin-top: 11px; font: 400 14px/1.55 var(--sans); color: var(--muted-2); text-wrap: pretty; }
.welcome__intro strong { font-weight: 600; color: var(--ink); }
.welcome__facts { list-style: none; margin: 18px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.welcome__facts li { font: 400 12px var(--sans); color: var(--muted-strong); background: rgba(0, 0, 0, .05); border-radius: 99px; padding: 5px 11px; }
.welcome__form { margin-top: 24px; display: grid; gap: 16px; }
.field label { display: block; font: 500 14px var(--sans); margin-bottom: 7px; }
.field input, .field select {
  width: 100%; min-height: 46px; padding: 10px 13px; border-radius: 8px; background: var(--surface);
  border: 1px solid var(--control); font-size: 15px;
}
.field select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, rgba(0,0,0,.5) 50%), linear-gradient(135deg, rgba(0,0,0,.5) 50%, transparent 50%);
  background-position: calc(100% - 19px) 50%, calc(100% - 14px) 50%;
  background-size: 5px 5px; background-repeat: no-repeat; padding-right: 36px;
}
.field input:focus, .field select:focus { border-color: var(--accent); outline: none; box-shadow: var(--focus); }
.form-error { font: 400 13px/1.5 var(--sans); color: oklch(0.48 0.15 30); }
.welcome__foot { padding: 14px 28px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.welcome__foot .note { font: 400 12.5px/1.4 var(--sans); color: var(--muted-2); }
.welcome__closed { margin-top: 16px; padding: 14px 16px; border-radius: 8px; background: var(--warn-bg); border: 1px solid var(--warn-border); color: var(--warn-ink); font: 400 13.5px/1.5 var(--sans); }

/* ------------------------------------------------------------------ rating screen (1a) */
.page--gap .card { max-width: 520px; }
.gap-head { padding: 16px 24px; display: grid; grid-template-columns: 1fr auto; column-gap: 16px; align-items: center; }
.gap-head .progress { grid-column: 1; margin-top: 8px; }
.gap-head .time-left { grid-column: 2; grid-row: 1 / span 2; }
.time-left { font: 400 11.5px var(--sans); color: var(--faint); white-space: nowrap; }

.gap-body { padding: 26px 24px 22px; position: relative; }
.gap-statement { margin-top: 16px; font: 400 23px/1.32 var(--sans); text-wrap: pretty; overflow-wrap: anywhere; }
.gap-statement:focus { outline: none; box-shadow: none; }
.stem { margin-top: 11px; font: 400 13.5px/1.5 var(--sans); color: rgba(0, 0, 0, .52); }

.options { margin-top: 22px; display: flex; flex-direction: column; gap: 8px; }
.opt {
  position: relative; display: flex; align-items: center; gap: 13px; padding: 14px 16px;
  border: 1px solid var(--control); border-radius: 8px; background: var(--surface); cursor: pointer;
  font: 400 15px var(--sans); user-select: none;
}
.opt:hover { border-color: rgba(0, 0, 0, .24); }
.opt input, .seg input, .pill input, .hml__seg input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; pointer-events: none; }
.opt__label { flex: 1; }
.dot { width: 18px; height: 18px; border-radius: 50%; flex: none; box-sizing: border-box; border: 1.5px solid rgba(0, 0, 0, .2); }
.opt:has(input:checked) { border: 1.5px solid var(--accent); padding: 13.5px 15.5px; background: var(--accent-tint); font-weight: 600; }
.opt:has(input:checked) .dot { border: 0; background: var(--accent); box-shadow: inset 0 0 0 3px #fff; }
.opt:has(input:focus-visible), .seg:has(input:focus-visible), .pill:has(input:focus-visible), .hml__seg:has(input:focus-visible) { box-shadow: var(--focus); }
.opt__chev { display: none; }
.opt--skip { padding: 11px 16px; border: 1px dashed rgba(0, 0, 0, .16); font-size: 13.5px; color: var(--faint); }
.opt--skip:has(input:checked) { border: 1.5px dashed var(--accent); padding: 10.5px 15.5px; background: var(--accent-tint); color: var(--ink); font-weight: 500; }
.closing__q { margin-top: 0; }
.closing__text {
  display: block; width: 100%; margin-top: 18px; min-height: 180px; resize: vertical; padding: 12px 14px;
  border-radius: 8px; border: 1px solid var(--control); background: var(--surface); font: 400 15px/1.5 var(--sans);
}
.closing__text:focus { border-color: var(--accent); outline: none; box-shadow: var(--focus); }
.rate-hint { margin-top: 12px; font: 400 13px/1.5 var(--sans); color: oklch(0.48 0.15 30); }

/* "Show this category on one page" switch, on both rating layouts */
.layout-bar { padding: 10px 24px; border-bottom: 1px solid var(--hairline); display: flex; justify-content: flex-end; }
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; font: 400 13px var(--sans); color: var(--muted-strong); cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.switch__track { position: relative; flex: none; width: 34px; height: 20px; border-radius: 99px; background: rgba(0, 0, 0, .2); transition: background .15s; }
.switch__track::after {
  content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .25); transition: transform .15s;
}
.switch:has(input:checked) .switch__track { background: var(--accent); }
.switch:has(input:checked) .switch__track::after { transform: translateX(14px); }
.switch:has(input:focus-visible) .switch__track { box-shadow: var(--focus); }
.switch:hover { color: var(--ink); }

/* category page (1a's rating, repeated for every gap in a category) */
.page--category .card { max-width: 680px; }
.cat-body { padding: 24px 24px 18px; }
.cat-stem { margin-top: 10px; }
.cat-items { list-style: none; margin: 14px 0 0; padding: 0; }
.cat-item { padding: 20px 0; border-top: 1px solid var(--hairline); scroll-margin-top: 16px; }
.cat-item:last-child { padding-bottom: 6px; }
.cat-item--attn { box-shadow: -24px 0 0 var(--warn-bg), 24px 0 0 var(--warn-bg); background: var(--warn-bg); }
.cat-item__text { display: flex; gap: 12px; font: 400 17px/1.4 var(--sans); overflow-wrap: anywhere; text-wrap: pretty; }
.cat-item__num { flex: none; min-width: 22px; padding-top: 3px; font: 500 11px var(--mono); color: var(--faint); }
.copts { margin: 12px 0 0 34px; display: grid; grid-template-columns: repeat(3, 1fr) auto; gap: 7px; }
.copt {
  position: relative; display: flex; align-items: center; justify-content: center; min-height: 40px; padding: 0 12px;
  border: 1px solid var(--control); border-radius: 8px; background: var(--surface); cursor: pointer; user-select: none;
  font: 400 14px var(--sans); text-align: center;
}
.copt:hover { border-color: rgba(0, 0, 0, .24); }
.copt input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; pointer-events: none; }
.copt:has(input:checked) { border: 1.5px solid var(--accent); background: var(--accent-tint); font-weight: 600; }
.copt:has(input:focus-visible) { box-shadow: var(--focus); }
.copt--skip { border-style: dashed; color: var(--faint); font-size: 13px; }
.copt--skip:has(input:checked) { border-style: dashed; color: var(--ink); font-weight: 500; }
.cat-item .followup-slot { margin-left: 34px; }

/* follow-up block, shared by rating screen and playback rows */
.followup { margin-top: 16px; padding: 18px; border-radius: 9px; background: var(--surface-sunken); border: 1px solid var(--hairline-card); }
.followup.reveal { animation: reveal .16s ease-out; }
@keyframes reveal { from { opacity: 0; transform: translateY(-6px); } }
@media (prefers-reduced-motion: reduce) { .followup.reveal { animation: none; } .progress__fill { transition: none; } }
.followup__prov { font: 500 13.5px/1.45 var(--sans); color: var(--accent-deep); }
.fq { margin-top: 18px; }
.followup__prov + .fq { margin-top: 12px; }
.fq__q { display: block; font: 500 14.5px/1.45 var(--sans); }
.fq__hint { display: block; margin-top: 1px; font-weight: 400; color: var(--muted-2); font-size: 12.5px; }
.pills { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 7px; }
.pill {
  position: relative; font: 400 13px var(--sans); padding: 8px 14px; border-radius: 99px; background: var(--surface);
  border: 1px solid var(--control-2); cursor: pointer; user-select: none; display: inline-flex; align-items: center; gap: 6px;
}
.pill::before { content: ''; width: 0; transition: width .12s; }
.pill:has(input:checked) { border: 1.5px solid var(--accent); padding: 7.5px 13.5px; background: var(--accent-tint); font-weight: 500; }
.pill:has(input:checked)::before { content: '✓'; width: auto; color: var(--accent); font-weight: 600; }
.segs { margin-top: 10px; display: flex; gap: 7px; }
.seg {
  position: relative; flex: 1; text-align: center; font: 400 13px var(--sans); padding: 9px 6px; border-radius: 7px;
  background: var(--surface); border: 1px solid var(--control-2); cursor: pointer; user-select: none;
}
.seg:has(input:checked) { border: 1.5px solid var(--accent); padding: 8.5px 5.5px; font-weight: 500; }
.fq textarea {
  display: block; width: 100%; margin-top: 10px; min-height: 64px; resize: vertical; padding: 10px 12px;
  border-radius: 7px; border: 1px solid var(--control-2); background: var(--surface); font: 400 14px/1.45 var(--sans);
}
.fq textarea:focus { border-color: var(--accent); outline: none; box-shadow: var(--focus); }
.fq__disclose { display: none; }
.followup__done { margin-top: 16px; display: flex; justify-content: flex-end; }

.gap-foot { padding: 14px 24px; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.gap-foot__right { display: flex; align-items: center; gap: 14px; }
.gap-foot .back { color: var(--muted-2); font: 400 13px var(--sans); }
.gap-foot .back:hover { color: var(--ink); }
.enter-hint { font: 400 12px var(--mono); color: rgba(0, 0, 0, .35); }
.save-note { font: 400 13px var(--sans); color: rgba(0, 0, 0, .4); text-align: center; }
.save-note.is-offline { color: var(--warn-ink); }

/* ------------------------------------------------------------------ playback (2a) */
.page--pb .card { max-width: 720px; }
.pb-head { padding: 26px 28px 22px; border-bottom: 1px solid var(--hairline); }
.pb-head .back-link { margin-bottom: 14px; display: inline-block; }
.pb-title { margin-top: 9px; font: 400 25px/1.28 var(--sans); text-wrap: pretty; }
.pb-sub { margin-top: 9px; font: 400 13.5px/1.55 var(--sans); color: var(--muted-2); text-wrap: pretty; }
.pb-actions { margin-top: 18px; display: flex; flex-wrap: wrap; gap: 10px; }

.dist { margin-top: 20px; display: flex; height: 34px; border-radius: 7px; overflow: hidden; border: 1px solid rgba(0, 0, 0, .08); }
.dist__seg { display: flex; align-items: center; justify-content: center; font: 600 12px var(--sans); white-space: nowrap; overflow: hidden; transition: width .2s ease-out; }
.dist__seg--high { background: var(--accent); color: #fff; }
.dist__seg--medium { background: var(--medium); color: var(--medium-ink); }
.dist__seg--low { background: var(--low); color: rgba(0, 0, 0, .74); }
.dist__seg--skipped { background: var(--skip-stripes); }
.dist__seg.is-narrow .dist__label { display: none; }
.dist-meta { margin-top: 8px; display: flex; justify-content: space-between; gap: 12px; font: 400 11.5px var(--sans); color: var(--muted); }
.dist-legend { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 4px 12px; font: 400 11px var(--sans); color: var(--muted-2); }

.nudge { margin-top: 18px; padding: 14px 16px; border-radius: 8px; background: var(--warn-bg); border: 1px solid var(--warn-border); display: flex; gap: 13px; align-items: flex-start; }
.nudge__dot { width: 7px; height: 7px; border-radius: 50%; background: var(--warn-dot); margin-top: 6px; flex: none; }
.nudge__title { font: 600 13px/1.4 var(--sans); color: var(--warn-ink); }
.nudge__body { margin-top: 4px; font: 400 12.5px/1.5 var(--sans); color: var(--warn-body); }
.nudge__btn {
  margin-top: 11px; font: 600 12.5px var(--sans); color: var(--warn-ink); border: 1px solid var(--warn-btn-border);
  border-radius: 6px; padding: 8px 13px; background: #fff;
}
.nudge__btn:hover { background: var(--warn-bg); }

.bucket-head { padding: 20px 28px 10px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.bucket-head h2 { font: 600 15px var(--sans); }
.bucket-head__meta { font: 400 12.5px var(--sans); color: var(--muted); }
.swatch { width: 12px; height: 12px; border-radius: 3px; flex: none; }
.swatch--high { background: var(--accent); }
.swatch--medium { background: var(--medium); }
.swatch--low { background: rgba(0, 0, 0, .2); }
.swatch--skipped { background: var(--skip-swatch); }
.bucket-rows { padding: 0 28px; }
.bucket-empty { padding: 4px 28px 18px; font: 400 13px var(--sans); color: var(--muted-2); }

.pb-row { padding: 16px 0; border-top: 1px solid var(--hairline); display: flex; gap: 18px; }
.pb-row--attn { background: var(--accent-row-tint); box-shadow: -28px 0 0 var(--accent-row-tint), 28px 0 0 var(--accent-row-tint); }
.pb-row__main { flex: 1; min-width: 0; }
.pb-row__cat { font: 500 9.5px var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--pill-ink-row); }
.pb-row__text { margin-top: 6px; font: 400 15px/1.4 var(--sans); overflow-wrap: anywhere; }
.pb-row__moved { margin-left: 6px; font: 500 10px var(--mono); letter-spacing: .04em; text-transform: uppercase; color: var(--muted-2); }
.meta { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chip-time { font: 500 11px var(--mono); padding: 5px 9px; border-radius: 5px; background: var(--timing-bg); color: var(--timing-ink); }
.chip-time--missing { background: transparent; border: 1px dashed var(--timing-missing-border); color: var(--timing-missing-ink); padding: 4px 8px; }
.chip-stk { font: 400 11.5px var(--sans); padding: 5px 10px; border-radius: 99px; background: rgba(0, 0, 0, .05); color: var(--muted-strong); }
.meta .link-btn { font: 400 11.5px var(--sans); }
.meta .link-btn--strong { font-weight: 600; color: var(--accent-deep); }
.pb-note { margin: 10px 0 0; padding: 11px 13px; border-left: 2px solid var(--control-2); background: var(--surface-sunken); font: 400 12.5px/1.5 var(--sans); color: var(--muted-strong); overflow-wrap: anywhere; }
.pb-note .link-btn { font-size: 12.5px; font-weight: 400; margin-left: 2px; }

.hml { width: 150px; flex: none; display: flex; gap: 4px; align-items: flex-start; }
.hml__seg {
  position: relative; flex: 1; text-align: center; padding: 8px 0; border-radius: 6px; cursor: pointer; user-select: none;
  font: 500 11.5px var(--mono); border: 1px solid var(--control-2); color: var(--muted);
}
.hml__seg:hover { border-color: rgba(0, 0, 0, .28); color: var(--ink); }
.hml__seg:has(input:checked) { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }

.more { display: block; width: 100%; padding: 15px 0; border: 0; border-top: 1px solid var(--hairline); background: none; text-align: center; font: 500 13px var(--sans); color: var(--accent); }
.more:hover { color: oklch(0.42 0.12 248); }

.bucket-sum {
  display: flex; width: 100%; align-items: center; gap: 12px; padding: 17px 28px; text-align: left;
  border: 0; border-top: 1px solid rgba(0, 0, 0, .06); background: var(--surface-alt);
}
.bucket-sum:hover .bucket-sum__cta { text-decoration: underline; text-underline-offset: 2px; }
.bucket-sum--first { margin-top: 6px; border-top-color: var(--hairline); }
.bucket-sum__text { flex: 1; }
.bucket-sum__name { font: 600 14.5px var(--sans); }
.bucket-sum__meta { margin-top: 3px; font: 400 12.5px var(--sans); color: var(--muted-2); }
.bucket-sum__cta { font: 500 13px var(--sans); color: var(--accent); }
.bucket-sum__chev { font-size: 17px; color: var(--muted); }
.bucket-open { background: var(--surface); }
.bucket-open .bucket-rows { padding-bottom: 6px; }

.extra { border-top: 1px solid var(--hairline); margin-top: 6px; }
.extra .bucket-head h2 { flex: none; }
.extra__edit { margin-left: auto; }
.extra__list { margin: 0; padding: 0 28px 20px 46px; display: grid; gap: 6px; font: 400 14px/1.45 var(--sans); overflow-wrap: anywhere; }

.pb-foot { padding: 20px 28px; border-top: 1px solid var(--hairline-card); }
.pb-foot__advisory { margin-bottom: 14px; font: 400 12.5px/1.5 var(--sans); color: var(--warn-ink); display: flex; gap: 9px; align-items: baseline; }
.pb-foot__advisory::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--warn-dot); flex: none; transform: translateY(-1px); }
.pb-foot__row { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.pb-foot__note { font: 400 12.5px/1.5 var(--sans); color: var(--muted-2); max-width: 330px; }
.pb-foot__btns { display: flex; gap: 10px; flex: none; }
.pb-foot .btn--primary { padding: 12px 24px; }

/* ------------------------------------------------------------------ ticket page (after submitting) */
body.is-dark { background: radial-gradient(120% 80% at 50% 30%, #1d1b2e 0%, #0b0a10 60%, #050507 100%) fixed #050507; color: #f3f2ee; }
body.is-dark .brand-foot img { filter: brightness(0) invert(1); opacity: .7; }
body.is-dark .brand-foot__x { color: rgba(255, 255, 255, .5); }
.page--ticket { padding: 44px 16px 8px; }
.tk-head { max-width: 760px; text-align: center; }
.tk-eyebrow { font: 500 11px var(--mono); letter-spacing: .12em; text-transform: uppercase; color: rgba(255, 255, 255, .55); }
.tk-title { margin-top: 10px; font: 700 clamp(22px, 3vw, 32px)/1.25 var(--sans); letter-spacing: -.005em; text-wrap: balance; }
.tk-title span { display: block; }
.tk-stage { position: relative; width: 100%; max-width: 1100px; height: min(72vh, 740px); margin-top: 0; }
.tk-stage.is-flat { height: auto; aspect-ratio: 4.4 / 4.47; max-height: min(66vh, 660px); margin-top: 24px; }
.tk-stage canvas { display: block; width: 100%; height: 100%; }
.tk-status { position: absolute; inset: 45% 0 auto; text-align: center; font: 400 14px var(--sans); color: rgba(255, 255, 255, .6); }
.tk-foot { margin-top: 10px; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 12px 28px; font: 400 14px var(--sans); color: rgba(255, 255, 255, .8); }
.tk-check { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; min-height: 36px; }
.tk-check input { width: 17px; height: 17px; margin: 0; accent-color: #8b8cf5; }
.tk-foot .link-btn { display: inline-flex; align-items: center; color: #b9baff; font-size: 14px; min-height: 36px; } /* inline-flex: the admin preview uses an <a>, the survey a <button> */
.tk-foot .link-btn:hover { color: #d6d7ff; }

/* ------------------------------------------------------------------ toast + dialog */
.toast {
  position: fixed; top: 14px; left: 50%; transform: translateX(-50%); z-index: 20; max-width: calc(100vw - 32px);
  background: var(--ink); color: #fff; font: 400 13px/1.4 var(--sans); padding: 10px 16px; border-radius: 99px;
  box-shadow: 0 10px 24px -12px rgba(0, 0, 0, .5); display: flex; gap: 12px; align-items: center;
  animation: reveal .16s ease-out;
}
.toast .link-btn { color: oklch(0.82 0.06 248); font-size: 13px; }

.dialog {
  width: min(460px, calc(100vw - 32px)); padding: 0; border: 0; border-radius: 12px; box-shadow: var(--card-shadow), 0 30px 60px -30px rgba(0,0,0,.45);
  color: var(--ink);
}
.dialog::backdrop { background: rgba(21, 20, 15, .38); }
.dialog__body { padding: 24px 24px 20px; }
.dialog__title { font: 400 21px/1.3 var(--sans); }
.dialog__text { margin-top: 9px; font: 400 14px/1.55 var(--sans); color: var(--muted-2); }
.dialog__foot { padding: 14px 24px; background: var(--surface-alt); border-top: 1px solid var(--hairline); display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.copy-row { margin-top: 14px; display: flex; gap: 8px; }
.copy-row input { flex: 1; min-width: 0; min-height: 42px; padding: 8px 11px; border-radius: 7px; border: 1px solid var(--control); background: var(--surface-sunken); font: 400 12.5px var(--mono); color: var(--muted-strong); }

/* ================================================================== mobile (1e, 2b) */
@media (max-width: 767px) {
  body { background: var(--page-mobile); }
  .page { padding: 0 0 32px; }
  .card { border: 0; border-radius: 0; box-shadow: none; background: transparent; overflow: visible; }

  /* welcome */
  .welcome__body { padding: 28px 16px 8px; }
  .welcome__title { font-size: 23px; }
  .welcome__foot { padding: 16px; flex-direction: column-reverse; align-items: stretch; background: transparent; border: 0; }
  .welcome__foot .btn { min-height: 50px; border-radius: 11px; font-size: 15px; }
  .welcome__foot .note { text-align: center; }
  /* iOS Safari zooms the page into any focused field under 16px */
  .field input, .field select, .fq textarea, .copy-row input { font-size: 16px; }

  /* hub + brand footer */
  .page--hub { justify-content: flex-start; }
  .hub { padding: 32px 16px 8px; }
  .hub__title { font-size: 23px; }
  .brand-foot { padding: 16px 16px calc(24px + env(safe-area-inset-bottom)); }

  /* rating screen */
  .gap-head { padding: 16px 20px 12px; background: transparent; border: 0; grid-template-columns: 1fr auto; }
  .gap-head .time-left { grid-row: 1; }
  .gap-head .progress { grid-column: 1 / span 2; margin-top: 9px; }

  .gap-body {
    margin: 0 12px; padding: 20px; background: var(--surface); border-radius: 16px;
    border: 1px solid var(--hairline); box-shadow: 0 8px 20px -14px rgba(0, 0, 0, .35); isolation: isolate;
  }
  .gap-body::after {
    content: ''; position: absolute; left: 14px; right: 14px; bottom: -7px; height: 12px; z-index: -1;
    background: var(--surface); border: 1px solid var(--hairline); border-top: 0; border-radius: 0 0 14px 14px;
  }
  .theme-pill { font-size: 9.5px; padding: 4px 8px; }
  .gap-statement { margin-top: 14px; font-size: 19px; line-height: 1.35; }
  .stem { font-size: 13px; }
  .options { margin-top: 20px; gap: 9px; }
  .opt { min-height: 48px; padding: 0 16px; gap: 11px; border-radius: 10px; }
  .opt:has(input:checked) { padding: 0 15.5px; }
  .dot { width: 17px; height: 17px; }
  .opt__chev { display: none; font-size: 19px; color: var(--accent); transform: rotate(90deg); line-height: 1; }
  .opt:has(input[value="high"]:checked) .opt__chev,
  .opt:has(input[value="medium"]:checked) .opt__chev { display: block; }
  .opt--skip { min-height: 44px; }
  .opt--skip:has(input:checked) { padding: 0 15.5px; }

  .followup { margin-top: 14px; padding: 15px; border-radius: 10px; }
  .fq__q { font-size: 14px; }
  .pills--stk { display: grid; grid-template-columns: 1fr 1fr; }
  .pill { min-height: 44px; justify-content: center; border-radius: 8px; font-size: 14px; }
  .segs { flex-direction: column; }
  .seg { min-height: 44px; display: flex; align-items: center; padding: 0 14px; text-align: left; font-size: 14px; border-radius: 8px; }
  .seg:has(input:checked) { padding: 0 13.5px; }
  .fq--driver .fq__q, .fq--driver textarea { display: none; }
  .fq--driver.is-open .fq__q, .fq--driver.is-open textarea { display: block; }
  .fq--driver.is-open .fq__disclose { display: none; }
  .fq__disclose {
    display: flex; width: 100%; min-height: 44px; align-items: center; gap: 8px; padding: 0 14px; border-radius: 8px;
    border: 1px dashed rgba(0, 0, 0, .18); background: transparent; color: var(--accent-deep); font: 500 14px var(--sans);
  }

  .gap-foot { padding: 18px 12px 20px; flex-direction: column; align-items: stretch; background: transparent; border: 0; gap: 12px; }
  .gap-foot__right .btn--primary { width: 100%; min-height: 50px; border-radius: 11px; font-size: 15px; }
  .gap-foot__right { order: 1; }
  .gap-foot .save-note { order: 2; }
  .gap-foot .back { order: 3; align-self: center; min-height: 44px; padding: 0 12px; }

  /* layout switch + category page */
  .layout-bar { padding: 0 20px 10px; border: 0; justify-content: flex-start; }
  .switch { font-size: 14px; min-height: 36px; }
  .cat-body {
    margin: 0 12px; padding: 18px 16px 8px; background: var(--surface); border-radius: 16px;
    border: 1px solid var(--hairline); box-shadow: 0 8px 20px -14px rgba(0, 0, 0, .35);
  }
  .cat-item__text { font-size: 16px; gap: 10px; }
  .cat-item__num { min-width: 18px; }
  .copts { margin-left: 0; grid-template-columns: repeat(3, 1fr); }
  .copt { min-height: 44px; }
  .copt--skip { grid-column: 1 / -1; }
  .cat-item .followup-slot { margin-left: 0; }
  .cat-item--attn { box-shadow: -16px 0 0 var(--warn-bg), 16px 0 0 var(--warn-bg); }

  /* ticket page */
  .page--ticket { padding: 28px 16px 0; }
  body.is-dark { background: #07070b; }
  .tk-stage { height: 64vh; }

  /* playback */
  .pb-head { padding: 22px 20px 16px; background: var(--surface); }
  .pb-title { margin-top: 8px; font-size: 21px; line-height: 1.3; }
  .dist { margin-top: 16px; height: 30px; }
  .dist__seg { font-size: 11.5px; }
  .nudge { margin-top: 14px; padding: 13px 14px; border-radius: 9px; display: block; }
  .nudge__dot { display: none; }
  .nudge__title { font-size: 12.5px; }
  .nudge__body { font-size: 12px; }
  .nudge__btn { width: 100%; min-height: 44px; border-radius: 8px; }
  .pb-actions .btn { flex: 1; min-height: 44px; }

  .bucket-head { padding: 16px 20px 8px; gap: 9px; }
  .bucket-head h2 { font-size: 14px; }
  .bucket-head__meta { font-size: 12px; }
  .swatch { width: 11px; height: 11px; }
  .bucket-rows { padding: 0; }
  .bucket-empty { padding: 4px 20px 12px; }

  .pb-row {
    margin: 6px 12px; padding: 16px; background: var(--surface); border-radius: 14px; border: 1px solid var(--hairline);
    flex-direction: column; gap: 13px;
  }
  .pb-row--attn { background: var(--surface); box-shadow: inset 3px 0 0 var(--timing-missing-border); }
  .pb-row__text { margin-top: 7px; }
  .meta { margin-top: 11px; }
  .chip-time { font-size: 10.5px; }
  .chip-stk { font-size: 11px; }
  .hml { width: 100%; gap: 6px; }
  .hml__seg { min-height: 44px; display: flex; align-items: center; justify-content: center; border-radius: 9px; font: 400 13px var(--sans); color: rgba(0, 0, 0, .62); }
  .hml__seg:has(input:checked) { font-weight: 600; }
  .more { margin: 10px 12px 6px; width: calc(100% - 24px); min-height: 44px; border: 0; color: var(--accent-deep); }

  .bucket-sum { margin: 6px 12px; width: calc(100% - 24px); padding: 15px 16px; background: var(--surface); border-radius: 14px; border: 1px solid var(--hairline); gap: 11px; min-height: 52px; }
  .bucket-sum--first { margin-top: 10px; }
  .bucket-sum__name { font-size: 14px; }
  .bucket-open { background: transparent; }
  .extra { margin: 10px 12px 6px; background: var(--surface); border-radius: 14px; border: 1px solid var(--hairline); }
  .extra .bucket-head { padding: 14px 16px 8px; }
  .extra__edit { min-height: 36px; }
  .extra__list { padding: 0 16px 14px 34px; }
  .closing__text { min-height: 200px; font-size: 16px; }

  .pb-foot {
    position: sticky; bottom: 0; margin-top: 14px; padding: 16px 12px calc(16px + env(safe-area-inset-bottom));
    background: var(--surface); border-top: 1px solid rgba(0, 0, 0, .08); z-index: 5;
  }
  .pb-foot__advisory { margin-bottom: 12px; padding: 0 4px; }
  .pb-foot__row { flex-direction: column; align-items: stretch; gap: 8px; }
  .pb-foot__btns { flex-direction: column; }
  .pb-foot .btn--primary { width: 100%; min-height: 50px; border-radius: 11px; font-size: 15px; }
  .pb-foot__later { align-self: center; min-height: 36px; font: 400 12.5px var(--sans); color: var(--muted); }
  .page--pb { padding-bottom: 0; }
}
