/* "New template" flow — start (four doors), describe (Anaya drafts), import (Anaya reads a paper form).
 * Every class here is prefixed st-. Colours are tokens only (see app.css). */

.st-page { container: st / inline-size; }
.st-start { max-width: 940px; }
.st-narrow { max-width: 1080px; }
.st-wide { max-width: 1320px; }
.st-h2 { font-size: 15.5px; line-height: 1.3; font-weight: 650; margin: 0; letter-spacing: -0.005em; }
.st-h2 label { cursor: text; }
.st-hint { margin: 0; font-size: 12.5px; line-height: 1.45; color: hsl(var(--muted-foreground)); }
.st-center { text-align: center; }
.st-focus:focus { outline: none; }
.st-dot-sep { color: hsl(var(--muted-foreground) / 0.7); padding: 0 2px; }
.st-group-label { margin: 0 0 10px; font-size: 12px; font-weight: 650; letter-spacing: 0.06em; text-transform: uppercase; color: hsl(var(--muted-foreground)); }
.st-meta-text { font-size: 12px; color: hsl(var(--muted-foreground)); }
.st-link {
  display: inline-flex; align-items: center; gap: 4px; align-self: flex-start; min-height: 24px; padding: 2px 0;
  border: 0; background: none; color: hsl(var(--primary-soft-foreground)); font-size: 12.5px; font-weight: 600;
}
.st-link:hover { text-decoration: underline; text-underline-offset: 2px; }
.st-link .icon { width: 14px; height: 14px; }
.st-keys { display: inline-flex; align-items: center; gap: 4px; margin: 0; font-size: 12px; color: hsl(var(--muted-foreground)); flex-wrap: wrap; }
@media (pointer: coarse), (max-width: 640px) { .st-keys { display: none; } }

/* ── Wizard rail ───────────────────────────────────────── */
.st-rail { margin-bottom: 18px; }
.st-start .st-rail { margin-bottom: 0; }
.st-rail ol { list-style: none; margin: 0; padding: 0; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.st-rail-step { display: flex; align-items: center; gap: 10px; min-width: 0; }
.st-rail-line { width: 36px; height: 2px; border-radius: 2px; background: hsl(var(--border-strong)); flex: none; }
.st-rail-step.is-done + .st-rail-step > .st-rail-line { background: hsl(var(--primary) / 0.6); }
.st-rail-btn {
  display: inline-flex; align-items: center; gap: 10px; min-height: 40px; padding: 4px 12px 4px 4px;
  border: 0; border-radius: 999px; background: none; text-align: left; min-width: 0;
}
button.st-rail-btn:hover { background: hsl(var(--muted)); }
.st-rail-num {
  width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; flex: none;
  font-size: 12.5px; font-weight: 650; font-variant-numeric: tabular-nums;
  border: 1.5px solid hsl(var(--border-strong)); color: hsl(var(--muted-foreground)); background: hsl(var(--card));
}
.st-rail-num .icon { width: 14px; height: 14px; stroke-width: 2.4; }
.is-current .st-rail-num { background: hsl(var(--primary)); border-color: hsl(var(--primary)); color: hsl(var(--primary-foreground)); }
.is-done .st-rail-num { background: hsl(var(--primary-soft)); border-color: hsl(var(--primary) / 0.4); color: hsl(var(--primary-soft-foreground)); }
.st-rail-text { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.st-rail-label { font-size: 13px; font-weight: 650; }
.is-upcoming .st-rail-label { color: hsl(var(--muted-foreground)); }
.st-rail-sub { font-size: 12px; color: hsl(var(--muted-foreground)); }

.st-pagehead { margin-bottom: 18px; }
.st-pagehead h1 { font-size: 22px; letter-spacing: -0.01em; }

/* ── Start: the four doors ─────────────────────────────── */
.st-panel {
  display: flex; flex-direction: column; gap: 22px; padding: 28px; margin-top: 8px;
  box-shadow: 0 1px 2px hsl(var(--shadow) / 0.04), 0 18px 40px -26px hsl(var(--shadow) / 0.28);
}
.st-head h1 { font-size: 22px; line-height: 1.2; margin: 0 0 6px; letter-spacing: -0.01em; }
.st-head p { margin: 0; color: hsl(var(--muted-foreground)); max-width: 60ch; font-size: 14.5px; }
.st-doors { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.st-door {
  position: relative; display: flex; align-items: flex-start; gap: 14px; min-height: 140px; padding: 18px 18px 16px;
  text-align: left; background: hsl(var(--card)); border: 1px solid hsl(var(--border-strong)); border-radius: 14px;
  transition: border-color 140ms, box-shadow 140ms, background 140ms;
}
.st-door:hover { border-color: hsl(var(--primary) / 0.55); background: hsl(var(--surface)); }
.st-door.is-on {
  border-color: hsl(var(--primary)); background: hsl(var(--primary-soft) / 0.55);
  box-shadow: 0 0 0 1px hsl(var(--primary)), 0 12px 28px -20px hsl(var(--primary) / 0.7);
}
.st-door-icon { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; flex: none; }
.st-door-icon .icon { width: 22px; height: 22px; }
.tone-ai .st-door-icon { background: hsl(var(--ai-soft)); color: hsl(var(--ai)); box-shadow: inset 0 0 0 1px hsl(var(--ai-border)); }
.tone-teal .st-door-icon { background: hsl(var(--secondary-soft)); color: hsl(var(--secondary)); box-shadow: inset 0 0 0 1px hsl(var(--secondary) / 0.25); }
.tone-primary .st-door-icon { background: hsl(var(--primary-soft)); color: hsl(var(--primary-soft-foreground)); box-shadow: inset 0 0 0 1px hsl(var(--primary) / 0.2); }
.tone-muted .st-door-icon { background: hsl(var(--muted)); color: hsl(var(--foreground) / 0.75); box-shadow: inset 0 0 0 1px hsl(var(--border)); }
.st-door-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; padding-right: 26px; }
.st-door-title { font-size: 16px; font-weight: 650; line-height: 1.3; }
.st-door-text { font-size: 13.5px; line-height: 1.5; color: hsl(var(--muted-foreground)); }
.st-door-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 8px; }
.st-door-check {
  position: absolute; top: 16px; right: 16px; width: 22px; height: 22px; border-radius: 50%;
  display: grid; place-items: center; border: 1.5px solid hsl(var(--border-strong)); color: transparent; background: hsl(var(--card));
}
.st-door-check .icon { width: 13px; height: 13px; stroke-width: 2.8; }
.st-door.is-on .st-door-check { background: hsl(var(--primary)); border-color: hsl(var(--primary)); color: hsl(var(--primary-foreground)); }
.st-door-key {
  position: absolute; right: 16px; bottom: 14px; font-family: var(--font-mono); font-size: 11px; line-height: 1;
  padding: 3px 5px; border-radius: 4px; border: 1px solid hsl(var(--border-strong)); color: hsl(var(--muted-foreground));
  opacity: 0; transition: opacity 140ms;
}
.st-doors:focus-within .st-door-key { opacity: 1; }
.st-caption { display: flex; align-items: center; justify-content: center; gap: 8px; margin: -4px 0 0; text-align: center; font-size: 13.5px; color: hsl(var(--muted-foreground)); }
.st-caption .icon { color: hsl(var(--ai)); }
.st-panel-foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding-top: 18px; border-top: 1px solid hsl(var(--border)); }
.st-privacy { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 16px 0 8px; font-size: 12.5px; color: hsl(var(--muted-foreground)); text-align: center; }
.st-privacy .icon { width: 14px; height: 14px; }

@container st (max-width: 640px) {
  .st-panel { padding: 18px 16px; gap: 18px; }
  .st-head h1 { font-size: 22px; }
  .st-head p { font-size: 13.5px; }
  .st-doors { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .st-door { min-height: 0; padding: 14px; gap: 12px; }
  .st-door-icon { width: 40px; height: 40px; border-radius: 10px; }
  .st-door-check { top: 14px; right: 14px; }
  .st-door-key { display: none; }
  .st-caption { justify-content: flex-start; text-align: left; align-items: flex-start; }
  .st-caption .icon { margin-top: 2px; }
  .st-panel-foot .btn { flex: 1 1 auto; }
  .st-panel-foot .grow { display: none; }
  .st-panel-foot .btn-primary { order: -1; flex-basis: 100%; height: 44px; }
}

/* ── Describe ──────────────────────────────────────────── */
.st-describe-grid { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); align-items: start; }
@container st (min-width: 880px) { .st-describe-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .st-textarea { min-height: 200px; } }
.st-card { container: stcard / inline-size; padding: 20px; display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.st-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.st-textarea-wrap { position: relative; }
.st-textarea { display: block; min-height: 156px; padding: 12px 52px 12px 14px; font-size: 14.5px; line-height: 1.6; }
.st-textarea.is-error { border-color: hsl(var(--danger)); }
.st-mic { position: absolute; right: 8px; bottom: 8px; width: 36px; height: 36px; border: 1px solid hsl(var(--border)); background: hsl(var(--card)); }
.st-hint-row { display: flex; gap: 12px; justify-content: space-between; margin-top: -8px; }
.st-count { white-space: nowrap; }
.st-error { display: flex; align-items: center; gap: 6px; margin: -8px 0 0; font-size: 13px; font-weight: 550; color: hsl(var(--danger)); }
.st-examples .st-group-label { margin-bottom: 8px; }
.st-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.st-chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 12px; border-radius: 999px;
  border: 1px solid hsl(var(--border-strong)); background: hsl(var(--card)); font-size: 13px; font-weight: 500; text-align: left;
}
.st-chip:hover { border-color: hsl(var(--primary) / 0.55); background: hsl(var(--surface)); }
.st-chip .icon { width: 14px; height: 14px; color: hsl(var(--muted-foreground)); }
.st-next { list-style: none; margin: 0; padding: 14px 0 0; border-top: 1px solid hsl(var(--border)); display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.st-next li { display: flex; gap: 8px; align-items: flex-start; font-size: 12.5px; line-height: 1.4; color: hsl(var(--muted-foreground)); }
.st-next-n {
  width: 20px; height: 20px; border-radius: 50%; flex: none; display: grid; place-items: center; font-size: 11px; font-weight: 700;
  background: hsl(var(--ai-soft)); color: hsl(var(--ai)); box-shadow: inset 0 0 0 1px hsl(var(--ai-border));
}
@container stcard (max-width: 460px) { .st-next { grid-template-columns: minmax(0, 1fr); gap: 8px; } }

.st-fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.st-legend { display: block; padding: 0; margin: 0 0 8px; font-size: 13px; font-weight: 650; }
.st-field-block { display: flex; flex-direction: column; min-width: 0; }
.st-field-block .st-hint { margin-top: 8px; }
.st-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
@container stcard (max-width: 420px) { .st-tiles { grid-template-columns: minmax(0, 1fr); } }
.st-tile {
  position: relative; display: flex; align-items: flex-start; gap: 10px; min-height: 60px; padding: 11px 36px 11px 11px;
  border: 1px solid hsl(var(--border-strong)); border-radius: 10px; background: hsl(var(--card)); cursor: pointer;
  transition: border-color 120ms, background 120ms;
}
.st-tile:hover { border-color: hsl(var(--primary) / 0.55); }
.st-tile.is-on { border-color: hsl(var(--primary)); background: hsl(var(--primary-soft) / 0.55); box-shadow: 0 0 0 1px hsl(var(--primary)); }
.st-tile:has(.st-tile-input:focus-visible) { outline: 2px solid hsl(var(--ring)); outline-offset: 2px; }
.st-tile-input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; pointer-events: none; }
.st-tile-icon { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; flex: none; background: hsl(var(--muted)); color: hsl(var(--foreground) / 0.75); }
.st-tile.is-on .st-tile-icon { background: hsl(var(--primary)); color: hsl(var(--primary-foreground)); }
.st-tile-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.st-tile-label { font-size: 13.5px; font-weight: 600; line-height: 1.3; }
.st-tile-sub { font-size: 12px; line-height: 1.35; color: hsl(var(--muted-foreground)); }
.st-tile-dot { position: absolute; top: 12px; right: 12px; width: 16px; height: 16px; border-radius: 50%; border: 1.5px solid hsl(var(--border-strong)); background: hsl(var(--card)); }
.st-tile.is-on .st-tile-dot { border-color: hsl(var(--primary)); box-shadow: inset 0 0 0 3px hsl(var(--card)); background: hsl(var(--primary)); }

.st-adv { border: 1px solid hsl(var(--border)); border-radius: 10px; overflow: hidden; }
.st-adv-toggle {
  display: flex; align-items: center; gap: 8px; width: 100%; min-height: 44px; padding: 0 12px;
  border: 0; background: hsl(var(--card)); font-size: 13.5px; font-weight: 600; text-align: left;
}
.st-adv-toggle:hover { background: hsl(var(--muted)); }
.st-adv-toggle .icon { color: hsl(var(--muted-foreground)); }
.st-adv-banner { display: flex; align-items: flex-start; gap: 8px; padding: 9px 12px; font-size: 12.5px; color: hsl(var(--muted-foreground)); background: hsl(var(--surface)); border-top: 1px solid hsl(var(--border)); }
.st-adv-banner .icon { width: 14px; height: 14px; margin-top: 1px; }
.st-adv-banner.is-custom { color: hsl(var(--foreground)); background: hsl(var(--warning-soft)); }
.st-adv-banner.is-custom .icon { color: hsl(var(--warning)); }
.st-adv-panel { display: flex; flex-direction: column; gap: 16px; padding: 14px 12px; border-top: 1px solid hsl(var(--border)); }
.st-adv-panel[hidden] { display: none; }
.st-switch-row { display: flex; align-items: flex-start; gap: 12px; }
.st-switch-row .switch { margin-top: 2px; }
.st-switch-label { font-size: 13px; font-weight: 600; }
.st-adv-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }

/* Action bar: floats at the bottom of the scrolling content */
.st-actionbar {
  position: sticky; bottom: 12px; z-index: 6; margin-top: 16px;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 10px 10px 16px;
  background: hsl(var(--card)); border: 1px solid hsl(var(--border)); border-radius: 14px;
  box-shadow: 0 1px 2px hsl(var(--shadow) / 0.05), 0 14px 34px -18px hsl(var(--shadow) / 0.4);
}
.st-actionbar-note { flex: 1 1 260px; min-width: 0; margin: 0; display: flex; align-items: center; gap: 6px; flex-wrap: nowrap; font-size: 13px; color: hsl(var(--muted-foreground)); }
.st-actionbar-note strong { color: hsl(var(--foreground)); font-weight: 650; }
.st-actionbar-note > span { min-width: 0; }
.st-actionbar-note strong { flex: none; }
.st-actionbar-note strong + span::before { content: "·"; padding-right: 6px; color: hsl(var(--muted-foreground) / 0.7); }
.st-actionbar-note .icon { width: 15px; height: 15px; }
.st-btn-kbd { margin-left: 4px; padding: 1px 6px; border-radius: 5px; font-size: 11.5px; font-weight: 600; background: hsl(var(--ai) / 0.12); }
@media (pointer: coarse) { .st-btn-kbd { display: none; } }
.st-show-sm { display: none; }
@container st (max-width: 600px) {
  .st-actionbar { padding: 10px; gap: 8px; bottom: 8px; }
  .st-actionbar-note { flex-basis: 100%; font-size: 12.5px; }
  .st-actionbar .btn { height: 44px; }
  .st-actionbar .btn-primary, .st-actionbar .btn-ai { flex: 1 1 auto; }
  .st-actionbar.is-flow { position: static; box-shadow: none; }
  .st-actionbar.is-flow .st-actionbar-note, .st-actionbar.is-flow .st-privacy-note { flex-basis: 100%; }
  .st-actionbar.is-flow .btn-primary, .st-actionbar.is-flow .btn-ai { flex-basis: 100%; order: 5; }
  .st-actionbar.is-flow .btn-ghost { flex: 1 1 auto; }
  .st-btn-kbd { display: none; }
  .st-hide-sm { display: none; }
  .st-show-sm { display: inline; }
  .st-rail-sub { display: none; }
  .st-rail ol { flex-wrap: nowrap; gap: 6px; }
  .st-rail-step { gap: 6px; }
  .st-rail-line { width: 22px; }
  .st-rail-btn { padding-right: 8px; }
  .st-actionbar.is-paused { position: static; box-shadow: none; }
  .st-actionbar-note:has(strong) { display: block; }
  .st-qpane :is(input, select, button, .st-qcard, .st-fix) { scroll-margin-bottom: 150px; }
  .st-banner { gap: 10px; padding: 10px 12px; top: 8px; }
  .st-banner-icon { display: none; }
  .st-banner-sub { display: none; }
  .st-banner .btn { width: 100%; }
}

/* Request summary, clarify card */
.st-flow { gap: 16px; }
.st-summary { padding: 16px 18px; display: flex; flex-direction: column; gap: 8px; }
.st-summary-head { display: flex; align-items: center; gap: 8px; min-height: 30px; }
.st-summary-head .st-group-label { margin: 0; }
.st-summary-text { margin: 0; font-size: 14px; line-height: 1.55; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.st-summary-text.is-open { display: block; -webkit-line-clamp: unset; }
.st-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; }
.st-tags .badge { font-weight: 550; height: 24px; }
.st-clarify { display: flex; flex-direction: column; gap: 12px; padding: 20px; }
.st-clarify-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.st-clarify .st-h2 { font-size: 17px; }
.st-clarify-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 4px; padding-top: 12px; border-top: 1px solid hsl(var(--ai-border)); }
.st-clarify-actions .grow { flex: 1 1 240px; }

/* Drafting banner + skeleton outline */
.st-banner {
  position: sticky; top: 12px; z-index: 7; display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-bottom: 16px; padding: 12px 12px 12px 14px; border-radius: 14px;
  border: 1px solid hsl(var(--ai-border)); background: hsl(var(--ai-soft));
  box-shadow: 0 14px 30px -22px hsl(var(--ai) / 0.8);
}
.st-banner-static { position: static; box-shadow: none; }
.st-banner-icon { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; flex: none; background: hsl(var(--card)); color: hsl(var(--ai)); box-shadow: inset 0 0 0 1px hsl(var(--ai-border)); }
.st-banner-icon .icon { width: 18px; height: 18px; animation: st-pulse 1.6s ease-in-out infinite; }
.st-banner-main { flex: 1 1 240px; min-width: 0; }
.st-banner-title { font-weight: 650; font-size: 14.5px; color: hsl(var(--ai)); }
.st-banner-sub { font-size: 12.5px; color: hsl(var(--muted-foreground)); margin-top: 1px; }
.st-ticks { display: flex; gap: 4px; margin-top: 8px; max-width: 320px; }
.st-tick { flex: 1; height: 4px; border-radius: 4px; background: hsl(var(--ai) / 0.16); }
.st-tick.is-done { background: hsl(var(--ai)); }
.st-tick.is-now { background: hsl(var(--ai) / 0.45); animation: st-pulse 1.2s ease-in-out infinite; }
@keyframes st-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }

.st-outline { padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.st-outline-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.st-rows { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.st-row { display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; border: 1px solid hsl(var(--border)); border-radius: 10px; background: hsl(var(--card)); min-height: 62px; }
.st-row.is-arrived { border-left: 3px solid hsl(var(--ai)); animation: st-arrive 420ms ease-out both; }
.st-row.is-arrived.is-flagged { border-left-color: hsl(var(--warning)); }
.st-row.is-skel { background: hsl(var(--surface)); border-style: dashed; }
.st-row.is-skel.is-now { border-style: solid; border-color: hsl(var(--ai-border)); }
.st-row-num { width: 24px; height: 24px; border-radius: 50%; flex: none; display: grid; place-items: center; font-size: 12px; font-weight: 650; background: hsl(var(--muted)); color: hsl(var(--muted-foreground)); font-variant-numeric: tabular-nums; }
.st-row.is-arrived .st-row-num { background: hsl(var(--ai-soft)); color: hsl(var(--ai)); }
.st-row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.st-row-title { font-weight: 600; }
.st-row-why { font-size: 13px; color: hsl(var(--muted-foreground)); }
.st-skel { display: block; height: 11px; }
.st-skel-title { height: 14px; }
.st-skel-line { width: 78%; }
.st-writing { font-size: 12px; font-weight: 600; color: hsl(var(--ai)); white-space: nowrap; }
@keyframes st-arrive { from { opacity: 0; transform: translateY(8px); background: hsl(var(--ai-soft)); } to { opacity: 1; transform: none; background: hsl(var(--card)); } }

/* Proposal */
.st-proposal { padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.st-prop-head { display: flex; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.st-prop-head .st-h2 { font-size: 17px; margin-top: 4px; }
.st-name { max-width: 520px; }
.st-name .input { font-size: 14.5px; font-weight: 600; min-height: 40px; }
.st-inline-note { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 12px; border-radius: 10px; background: hsl(var(--muted)); font-size: 13px; }
.st-inline-note .icon { color: hsl(var(--muted-foreground)); }
.st-prop-cols { display: flex; gap: 14px; padding: 0 14px; font-size: 11px; font-weight: 650; letter-spacing: 0.06em; text-transform: uppercase; color: hsl(var(--muted-foreground)); }
.st-prop-cols span:first-child { width: 36px; }
.st-prop-list { list-style: none; margin: -6px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.st-prop-row {
  display: flex; flex-direction: column; gap: 4px; padding: 11px 12px 11px 14px; border-radius: 10px;
  border: 1px solid hsl(var(--border)); border-left: 3px solid hsl(var(--ai)); background: hsl(var(--card));
  transition: background 120ms, border-color 120ms;
}
.st-prop-row:not(.is-kept) { background: hsl(var(--surface)); border-left-color: hsl(var(--border-strong)); }
.st-prop-row:not(.is-kept) .st-prop-title { color: hsl(var(--muted-foreground)); }
.st-prop-row.is-flagged { border-left-color: hsl(var(--warning)); }
.st-prop-top { display: flex; align-items: center; gap: 8px 10px; flex-wrap: wrap; }
.st-check { position: relative; display: inline-flex; align-items: center; gap: 12px; flex: 1 1 150px; min-width: 0; min-height: 30px; cursor: pointer; }
.st-check input { position: absolute; left: 0; top: 50%; opacity: 0; width: 1px; height: 1px; margin: 0; }
.st-check-box {
  width: 24px; height: 24px; border-radius: 6px; flex: none; display: grid; place-items: center;
  border: 1.5px solid hsl(var(--border-strong)); background: hsl(var(--card)); color: transparent; transition: background 120ms, border-color 120ms;
}
.st-check-box .icon { width: 15px; height: 15px; stroke-width: 2.8; }
.st-check:hover .st-check-box { border-color: hsl(var(--primary)); }
.st-check input:checked + .st-check-box { background: hsl(var(--primary)); border-color: hsl(var(--primary)); color: hsl(var(--primary-foreground)); }
.st-check input:focus-visible + .st-check-box { outline: 2px solid hsl(var(--ring)); outline-offset: 2px; }
.st-prop-title { font-weight: 600; font-size: 14.5px; min-width: 0; }
.st-prop-n { color: hsl(var(--muted-foreground)); font-variant-numeric: tabular-nums; font-weight: 550; }
.st-qtoggle {
  margin-left: auto; display: inline-flex; align-items: center; gap: 4px; min-height: 30px; padding: 0 8px 0 10px; border-radius: 999px;
  border: 1px solid hsl(var(--border)); background: hsl(var(--muted)); color: hsl(var(--muted-foreground)); font-size: 12px; font-weight: 600; white-space: nowrap;
}
.st-qtoggle:hover { color: hsl(var(--foreground)); border-color: hsl(var(--border-strong)); }
.st-qtoggle[aria-expanded="true"] { background: hsl(var(--card)); color: hsl(var(--foreground)); border-color: hsl(var(--border-strong)); }
.st-qtoggle .icon { width: 14px; height: 14px; }
.st-prop-why, .st-flag { margin: 0 0 0 36px; font-size: 13px; line-height: 1.5; }
.st-prop-why { color: hsl(var(--muted-foreground)); }
.st-flag { display: flex; align-items: flex-start; gap: 8px; margin-top: 4px; padding: 8px 10px; border-radius: 8px; background: hsl(var(--warning-soft)); color: hsl(var(--foreground)); }
.st-flag .icon { color: hsl(var(--warning)); margin-top: 2px; }
.st-prop-qs { list-style: none; margin: 6px 0 2px 36px; padding: 10px 0 0; border-top: 1px dashed hsl(var(--border)); display: flex; flex-direction: column; gap: 6px; }
.st-prop-qs[hidden] { display: none; }
.st-prop-qs li { display: flex; align-items: center; gap: 10px; font-size: 13px; min-width: 0; }
.st-qtype-icon { width: 24px; height: 24px; border-radius: 6px; display: grid; place-items: center; flex: none; background: hsl(var(--muted)); color: hsl(var(--muted-foreground)); }
.st-qtype-icon .icon { width: 14px; height: 14px; }
@container st (max-width: 600px) {
  .st-proposal, .st-outline, .st-clarify { padding: 16px; }
  .st-prop-why, .st-flag, .st-prop-qs { margin-left: 0; }
  .st-prop-cols { display: none; }
  .st-prop-list { margin-top: 0; }
  .st-prop-qs .st-meta-text { display: none; }
}

/* ── Import: upload ────────────────────────────────────── */
.st-drop {
  display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 28px 20px; text-align: center;
  border: 1.5px dashed hsl(var(--border-strong)); border-radius: 14px; background: hsl(var(--card));
  transition: border-color 140ms, background 140ms;
}
.st-drop.is-over { border-color: hsl(var(--primary)); background: hsl(var(--primary-soft) / 0.6); }
.st-drop-icon { width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center; margin-bottom: 4px; background: hsl(var(--secondary-soft)); color: hsl(var(--secondary)); }
.st-drop-icon .icon { width: 22px; height: 22px; }
.st-drop-title { margin: 0; font-size: 15.5px; font-weight: 650; text-wrap: balance; }
.st-drop-text { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.st-drop-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-top: 8px; }
.st-drop-actions .btn { min-height: 40px; }
@container st (min-width: 700px) {
  .st-drop { flex-direction: row; align-items: center; gap: 16px; padding: 22px 22px 22px 24px; text-align: left; }
  .st-drop-icon { margin: 0; }
  .st-drop-text { flex: 1; }
  .st-drop-actions { margin: 0; flex-wrap: nowrap; }
}

.st-pages { margin-top: 20px; }
.st-pages-head { display: flex; align-items: baseline; justify-content: space-between; gap: 6px 12px; flex-wrap: wrap; margin-bottom: 12px; }
.st-thumbs { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(176px, 1fr)); gap: 12px; }
.st-thumb { display: flex; flex-direction: column; gap: 8px; padding: 10px; min-width: 0; border: 1px solid hsl(var(--border)); border-radius: 12px; background: hsl(var(--card)); transition: border-color 140ms, opacity 140ms; }
.st-thumb-img { position: relative; height: 196px; border-radius: 8px; overflow: hidden; display: grid; place-items: center; background: hsl(var(--muted)); }
.st-paper-mini { zoom: 0.25; pointer-events: none; }
.st-thumb-meta { min-width: 0; }
.st-thumb-title { font-size: 13px; font-weight: 650; }
.st-thumb-file { display: flex; gap: 4px; min-width: 0; font-size: 12px; color: hsl(var(--muted-foreground)); white-space: nowrap; }
.st-thumb-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.st-thumb-size { flex: none; }
.st-thumb-actions { display: flex; align-items: center; gap: 2px; margin: 0 -4px -4px; }
.st-thumb-actions .icon-btn { width: 36px; height: 36px; }
.st-thumb-actions .icon-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.st-thumb-actions .icon-btn:disabled:hover { background: none; color: hsl(var(--muted-foreground)); }
.st-remove:hover { color: hsl(var(--danger)); }
.st-thumb-add { padding: 0; border-style: dashed; border-color: hsl(var(--border-strong)); background: transparent; }
.st-thumb-add button {
  flex: 1; min-height: 120px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  border: 0; border-radius: 12px; background: none; font-size: 13px; font-weight: 600; color: hsl(var(--muted-foreground));
}
.st-thumb-add button:hover { background: hsl(var(--muted)); color: hsl(var(--foreground)); }
.st-thumb-add .icon { width: 20px; height: 20px; }
.st-thumb.is-reading { border-color: hsl(var(--ai)); box-shadow: 0 0 0 1px hsl(var(--ai)); }
.st-thumb.is-waiting { opacity: 0.6; }
.st-scanline { position: absolute; left: 0; right: 0; top: 0; height: 32%; background: linear-gradient(180deg, transparent, hsl(var(--ai) / 0.22)); border-bottom: 2px solid hsl(var(--ai)); animation: st-scan 1s ease-in-out infinite alternate; }
@keyframes st-scan { from { transform: translateY(-40%); } to { transform: translateY(240%); } }
.st-thumb-done { position: absolute; top: 8px; right: 8px; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: hsl(var(--success)); color: hsl(var(--card)); }
.st-thumb-done .icon { width: 14px; height: 14px; stroke-width: 2.6; }
.st-empty { padding: 28px 16px; }

.st-privacy-note { flex: 1 1 320px; min-width: 0; display: flex; align-items: center; gap: 10px; margin-right: auto; padding: 8px 12px 8px 8px; border-radius: 10px; background: hsl(var(--secondary-soft)); }
.st-privacy-note p { margin: 0; font-size: 13px; line-height: 1.45; }
.st-privacy-note strong { font-weight: 650; }
.st-privacy-icon { width: 30px; height: 30px; border-radius: 8px; flex: none; display: grid; place-items: center; background: hsl(var(--card)); color: hsl(var(--secondary)); box-shadow: inset 0 0 0 1px hsl(var(--secondary) / 0.25); }
@container st (max-width: 600px) {
  .st-thumbs { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .st-thumb-img { height: 176px; }
  .st-paper-mini { zoom: 0.22; }
  .st-drop { padding: 22px 16px; }
}

/* ── Import: review ────────────────────────────────────── */
.st-review { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); align-items: start; }
@container st (min-width: 720px) {
  .st-review { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .st-viewer-pane { position: sticky; top: 12px; max-height: calc(100dvh - 218px); }
}
@container st (min-width: 1100px) { .st-review { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 20px; } }
.st-viewer-pane { display: flex; flex-direction: column; min-width: 0; min-height: 0; border: 1px solid hsl(var(--border)); border-radius: 14px; background: hsl(var(--muted)); overflow: hidden; }
.st-viewer-bar { display: flex; align-items: center; justify-content: space-between; gap: 4px 10px; flex-wrap: wrap; padding: 4px 8px 4px 6px; background: hsl(var(--card)); border-bottom: 1px solid hsl(var(--border)); }
.st-viewer-bar .tabs { border-bottom: 0; min-width: 0; }
.st-viewer-bar .tabs button { padding: 10px 10px; }
.st-viewer-bar .seg { gap: 4px; flex-wrap: nowrap; }
.st-viewer-bar .seg button { min-height: 32px; padding: 4px 9px; font-size: 12px; }
.st-viewer-note { display: flex; align-items: center; gap: 8px; margin: 0; padding: 8px 12px; font-size: 12.5px; color: hsl(var(--muted-foreground)); background: hsl(var(--card)); border-bottom: 1px solid hsl(var(--border)); }
.st-viewer { flex: 1; min-height: 0; overflow: auto; scrollbar-gutter: stable; padding: 20px 16px 24px; }
.st-viewer:focus-visible { outline-offset: -2px; }
.st-paper-zoom { width: max-content; margin: 0 auto; }

/* The scanned page: fixed US Letter proportions, scaled with zoom so it reads like an image */
.st-paper {
  position: relative; width: 560px; min-height: 725px; padding: 40px 40px 56px 58px;
  background-color: hsl(var(--card));
  background-image:
    repeating-linear-gradient(0deg, hsl(var(--foreground) / 0.018) 0 1px, transparent 1px 4px),
    radial-gradient(ellipse at 12% 0%, hsl(var(--foreground) / 0.045), transparent 55%),
    radial-gradient(ellipse at 100% 100%, hsl(var(--foreground) / 0.06), transparent 50%);
  color: hsl(var(--foreground) / 0.86);
  font-family: ui-serif, Georgia, "Times New Roman", serif; font-size: 14px; line-height: 1.45;
  box-shadow: 0 1px 2px hsl(var(--shadow) / 0.14), 0 16px 34px -16px hsl(var(--shadow) / 0.4);
  transform: rotate(-0.35deg);
}
.st-paper::before { content: ""; position: absolute; top: 14px; left: 18px; width: 22px; height: 4px; border-radius: 1px; background: hsl(var(--muted-foreground) / 0.6); transform: rotate(-38deg); }
.st-paper-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; padding-bottom: 10px; margin-bottom: 14px; border-bottom: 2px solid hsl(var(--foreground) / 0.72); }
.st-paper-org { font-family: var(--font-ui); font-size: 9.5px; font-weight: 700; letter-spacing: 0.12em; color: hsl(var(--foreground) / 0.6); }
.st-paper-title { font-size: 20px; font-weight: 700; letter-spacing: -0.01em; margin-top: 2px; }
.st-paper-form { font-family: var(--font-mono); font-size: 10px; text-align: right; color: hsl(var(--foreground) / 0.6); }
.st-paper-fields { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 10px 16px; font-size: 12.5px; }
.st-pf { display: flex; align-items: flex-end; gap: 6px; white-space: nowrap; }
.st-pf .st-blank { flex: 1; width: auto; }
.st-covered {
  display: inline-block; flex: 1; height: 17px; padding: 0 6px; border-radius: 2px; transform: rotate(-1.2deg);
  background: hsl(var(--foreground) / 0.82); color: hsl(var(--background));
  font: 700 8.5px/17px var(--font-ui); letter-spacing: 0.14em; text-transform: uppercase; text-align: center;
}
.st-paper-sec { margin: 20px 0 8px; padding: 3px 7px; font-family: var(--font-ui); font-size: 10.5px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; background: hsl(var(--foreground) / 0.07); }
.st-print { white-space: pre-wrap; }
.st-print-plain { margin: 6px 0 4px; }
.st-print-small { font-size: 11.5px; font-style: italic; color: hsl(var(--foreground) / 0.6); margin-top: 2px; }
.st-box { display: inline-block; width: 11px; height: 11px; margin: 0 4px 0 6px; border: 1.3px solid currentColor; vertical-align: -1px; }
.st-blank { display: inline-block; width: 70px; margin: 0 4px; border-bottom: 1px solid currentColor; vertical-align: -2px; }
.st-blank-long { width: 170px; }
.st-rules { margin-top: 4px; }
.st-rule { height: 24px; border-bottom: 1px solid hsl(var(--foreground) / 0.3); }
.st-office { display: flex; flex-direction: column; gap: 14px; margin-top: 12px; }
.st-stamp {
  position: absolute; right: 56px; top: 250px; padding: 6px 14px; border: 2.5px solid hsl(var(--secondary) / 0.55); border-radius: 6px;
  color: hsl(var(--secondary) / 0.7); font: 800 18px/1 var(--font-ui); letter-spacing: 0.16em; text-transform: uppercase; transform: rotate(-9deg);
}
.st-paper-foot { position: absolute; left: 58px; right: 40px; bottom: 18px; display: flex; justify-content: space-between; font-family: var(--font-mono); font-size: 9.5px; color: hsl(var(--foreground) / 0.45); }
.st-region { position: relative; margin: 0 -10px 6px; padding: 7px 10px; border-radius: 6px; border: 1.5px dashed hsl(var(--ai) / 0.45); background: hsl(var(--ai) / 0.035); cursor: pointer; transition: background 140ms, border-color 140ms, box-shadow 140ms; }
.st-region:hover { background: hsl(var(--ai) / 0.08); }
.st-region.is-on { border-style: solid; border-color: hsl(var(--ai)); background: hsl(var(--ai) / 0.1); box-shadow: 0 0 0 4px hsl(var(--ai) / 0.16); }
.st-region.is-dropped { border-color: hsl(var(--border-strong)); background: none; opacity: 0.5; }
.st-region-num {
  position: absolute; left: -38px; top: 6px; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center;
  background: hsl(var(--ai)); color: hsl(var(--card)); font: 700 11.5px/1 var(--font-ui);
}
.st-region.is-dropped .st-region-num { background: hsl(var(--muted-foreground)); }
.st-paper-mini .st-region { border-color: transparent; background: none; }
.st-paper-mini .st-region-num { display: none; }

.st-qpane { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.st-qpane-head { display: flex; align-items: flex-start; gap: 10px; flex-wrap: wrap; }
.st-tally { margin-top: 2px; }
.st-legend-row { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 0; }
.st-legend-row div { display: flex; align-items: center; gap: 8px; min-width: 0; }
.st-legend-row dt { margin: 0; }
.st-legend-row dd { margin: 0; font-size: 12.5px; color: hsl(var(--muted-foreground)); }
.st-keys-list { margin-top: -2px; }
.st-qpane :is(input, select, button, .st-qcard, .st-fix) { scroll-margin: 16px 0 104px; }
.st-qlist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.st-qcard {
  container: stq / inline-size; display: flex; flex-direction: column; gap: 10px; padding: 14px 14px 12px;
  border: 1px solid hsl(var(--border)); border-left: 3px solid hsl(var(--border-strong)); border-radius: 12px; background: hsl(var(--card));
  transition: border-color 140ms, box-shadow 140ms, background 140ms; cursor: default;
}
.st-qcard:focus-visible { outline: 2px solid hsl(var(--ring)); outline-offset: 2px; }
.st-qcard.is-sel { border-color: hsl(var(--ai-border)); border-left-color: hsl(var(--ai)); box-shadow: 0 0 0 1px hsl(var(--ai-border)), 0 14px 30px -24px hsl(var(--ai) / 0.9); }
.st-qcard.is-keep, .st-qcard.is-fixed { border-left-color: hsl(var(--success)); }
.st-qcard.is-drop { background: hsl(var(--surface)); border-left-color: hsl(var(--border-strong)); }
.st-qcard.is-drop .st-qtitle { color: hsl(var(--muted-foreground)); text-decoration: line-through; text-decoration-color: hsl(var(--muted-foreground) / 0.6); }
.st-qhead { display: flex; align-items: flex-start; gap: 10px; }
.st-qnum { width: 24px; height: 24px; border-radius: 50%; flex: none; display: grid; place-items: center; margin-top: 1px; font-size: 12px; font-weight: 700; background: hsl(var(--ai-soft)); color: hsl(var(--ai)); box-shadow: inset 0 0 0 1px hsl(var(--ai-border)); }
.st-qcard.is-sel .st-qnum { background: hsl(var(--ai)); color: hsl(var(--card)); box-shadow: none; }
.st-qtitle { flex: 1; min-width: 0; margin: 2px 0 0; font-size: 14.5px; font-weight: 650; line-height: 1.35; }
.st-quote { margin: 0; padding: 8px 12px; border-radius: 8px; border-left: 3px solid hsl(var(--border-strong)); background: hsl(var(--muted)); font-family: ui-serif, Georgia, "Times New Roman", serif; font-size: 13.5px; line-height: 1.45; color: hsl(var(--foreground) / 0.88); overflow-wrap: anywhere; }
.st-quote-src { display: block; margin-bottom: 2px; font-family: var(--font-ui); font-size: 11.5px; font-weight: 600; color: hsl(var(--muted-foreground)); }
.st-reason { display: flex; align-items: flex-start; gap: 6px; margin: 0; font-size: 12.5px; line-height: 1.45; }
.st-reason .icon { width: 14px; height: 14px; margin-top: 2px; color: hsl(var(--warning)); }
.st-notice { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border-radius: 10px; border: 1px solid hsl(var(--secondary) / 0.35); background: hsl(var(--secondary-soft)); }
.st-notice p { margin: 0; font-size: 13px; line-height: 1.5; }
.st-notice .icon { margin-top: 2px; color: hsl(var(--secondary)); }
.st-qmeta { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 10px 14px; }
@container stq (max-width: 400px) { .st-qmeta { grid-template-columns: minmax(0, 1fr); } }
.st-qfield { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.st-qfield-label { font-size: 11px; font-weight: 650; letter-spacing: 0.05em; text-transform: uppercase; color: hsl(var(--muted-foreground)); }
.st-select-wrap { position: relative; display: block; }
.st-select-wrap > .icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: hsl(var(--muted-foreground)); pointer-events: none; }
.st-select { padding-left: 32px; min-height: 36px; cursor: pointer; }
.st-static { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; font-size: 13.5px; font-weight: 550; }
.st-static .icon { color: hsl(var(--muted-foreground)); }
.st-concept { display: flex; align-items: flex-start; gap: 8px; min-height: 36px; padding-top: 2px; font-size: 13.5px; min-width: 0; }
.st-concept > .icon { margin-top: 2px; color: hsl(var(--secondary)); }
.st-concept b { font-weight: 600; display: block; }
.st-concept-feeds { display: block; font-size: 12px; color: hsl(var(--muted-foreground)); }
.st-concept.is-none { color: hsl(var(--muted-foreground)); }
.st-concept.is-none > .icon { color: hsl(var(--muted-foreground)); }
.st-answers { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.st-answers .st-qfield-label { margin-right: 2px; }
.st-answer { display: inline-flex; align-items: center; height: 24px; padding: 0 8px; border-radius: 6px; border: 1px solid hsl(var(--border)); font-size: 12.5px; background: hsl(var(--surface)); }
.st-fix { display: flex; flex-direction: column; gap: 12px; padding: 12px; border-radius: 10px; background: hsl(var(--surface)); border: 1px solid hsl(var(--border)); }
.st-fix-split { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@container stq (max-width: 420px) { .st-fix-split { grid-template-columns: minmax(0, 1fr); } }
.st-fix-actions { display: flex; justify-content: flex-end; gap: 8px; }
.st-decide { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding-top: 10px; border-top: 1px solid hsl(var(--border)); }
.st-decide-btn {
  display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 14px; border-radius: 8px;
  border: 1px solid hsl(var(--border-strong)); background: hsl(var(--card)); font-size: 13px; font-weight: 600;
  transition: background 120ms, border-color 120ms, color 120ms;
}
.st-decide-btn:hover { background: hsl(var(--muted)); }
.st-decide-btn .icon { width: 15px; height: 15px; }
.st-decide-btn.is-k[aria-pressed="true"] { background: hsl(var(--success-soft)); border-color: hsl(var(--success)); color: hsl(var(--success)); }
.st-decide-btn.is-f[aria-pressed="true"] { background: hsl(var(--primary-soft)); border-color: hsl(var(--primary)); color: hsl(var(--primary-soft-foreground)); }
.st-decide-btn.is-d[aria-pressed="true"] { background: hsl(var(--muted)); border-color: hsl(var(--foreground) / 0.45); }
.st-decide-state { margin-left: auto; font-size: 12.5px; color: hsl(var(--muted-foreground)); }
@media (pointer: coarse) { .st-decide-btn { min-height: 44px; } }
@container stq (max-width: 380px) { .st-decide-state { flex-basis: 100%; margin-left: 0; } .st-decide-btn { flex: 1 1 auto; justify-content: center; } }
.st-dropped { display: flex; align-items: center; gap: 8px; font-size: 13px; color: hsl(var(--muted-foreground)); }
.st-actionbar-review { margin-top: 20px; }

@container st (max-width: 719px) {
  .st-viewer { max-height: 520px; }
}
@container st (max-width: 600px) {
  .st-pagehead h1 { font-size: 21px; }
  .st-qpane-head .btn { width: 100%; height: 40px; }
  .st-viewer { max-height: 460px; padding: 14px 10px 18px; }
  .st-viewer-bar .tabs button { padding: 10px 8px; }
}

/* Toasts sit above the floating action bar instead of over its buttons. */
.shell:has(.st-actionbar) .toast-stack { bottom: 92px; }
@media (max-width: 700px) { .shell:has(.st-actionbar) .toast-stack { bottom: 124px; } }
