/* Demand Press: the print shop counter. Direction in docs/design/DIRECTION.md. */

@font-face {
  font-family: "Atkinson Next";
  src: url("fonts/atkinson-next-latin-wght.woff2") format("woff2");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Besley";
  src: url("fonts/besley-latin-wght.woff2") format("woff2");
  font-weight: 400 900;
  font-style: normal;
  font-display: swap;
}
/* Metric-matched stand-ins while the real fonts load, so the swap does not shift anything. */
@font-face { font-family: "Atkinson Fallback"; src: local("Arial"), local("Liberation Sans"), local("Helvetica"); size-adjust: 98%; }
@font-face { font-family: "Besley Fallback"; src: local("Georgia"), local("DejaVu Serif"), local("Times New Roman"); size-adjust: 112%; }

:root {
  --desk: #f3eee4;
  --sheet: #fffdf8;
  --sheet-2: #f8f4ec;
  --ink: #1c1a16;
  --ink-2: #48433a;
  --muted: #665f53;
  --rule: #ddd4c3;
  --rule-2: #ebe4d6;
  --rule-strong: #b9ae99;
  --accent: #2b3c9e;
  --accent-ink: #ffffff;
  --accent-soft: #e7e9f6;
  --accent-press: #22307f;
  --attn: #a64b06;
  --attn-soft: #fbebda;
  --paper: #ffffff;
  --focus: #2b3c9e;
  --shadow-sm: 0 1px 0 rgba(60, 45, 20, 0.05), 0 1px 3px rgba(60, 45, 20, 0.06);
  --shadow-md: 0 1px 1px rgba(60, 45, 20, 0.06), 0 6px 18px -8px rgba(60, 45, 20, 0.22);
  --grain: 0.05;
  --serif: "Besley", "Besley Fallback", serif;
  --sans: "Atkinson Next", "Atkinson Fallback", sans-serif;
  --out: cubic-bezier(0.2, 0.8, 0.2, 1);
  --gutter: 16px;
  --check: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m5 12.5 4.5 4.5L19 7.5' fill='none' stroke='%23fff' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --desk: #15130f;
    --sheet: #1f1c17;
    --sheet-2: #26221c;
    --ink: #f3eee4;
    --ink-2: #d3cbbc;
    --muted: #a69e8f;
    --rule: #3a352c;
    --rule-2: #2c2822;
    --rule-strong: #5c5547;
    --accent: #a3b2ff;
    --accent-ink: #121634;
    --accent-soft: #262b4a;
    --accent-press: #c2cbff;
    --attn: #f2a25c;
    --attn-soft: #3a2a19;
    --focus: #a3b2ff;
    --shadow-sm: 0 1px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 1px 1px rgba(0, 0, 0, 0.4), 0 10px 24px -10px rgba(0, 0, 0, 0.7);
    --grain: 0.06;
    --paper-dim: brightness(0.93);
    --check: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m5 12.5 4.5 4.5L19 7.5' fill='none' stroke='%23121634' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { font-size: 17px; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100dvh;
  background-color: var(--desk);
  color: var(--ink);
  font-family: var(--sans);
  font-weight: 400;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "kern";
  overflow-x: clip;
}
/* A faint paper grain on the desk. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: var(--grain);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .4 0 0 0 0 .3 0 0 0 0 .15 0 0 0 1 0'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)'/%3E%3C/svg%3E");
}

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
header svg, main svg, .dropveil svg, dialog svg { width: 1.2em; height: 1.2em; flex: none; }
.ico { width: 1.15em; height: 1.15em; flex: none; }
.acc { stroke: var(--accent); }

h1, h2, h3 { font-family: var(--serif); font-weight: 700; margin: 0; letter-spacing: -0.01em; }
h2 { font-size: 1.3rem; line-height: 1.2; }
p { margin: 0; }
.sub { color: var(--muted); font-size: 0.9rem; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.label { font-size: 0.78rem; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase; color: var(--muted); }
.num, .fig { font-variant-numeric: tabular-nums lining-nums; }

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

/* ---------- letterhead ---------- */

.letterhead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: 1320px;
  margin: 0 auto;
  padding: calc(14px + env(safe-area-inset-top)) calc(var(--gutter) + env(safe-area-inset-right)) 12px calc(var(--gutter) + env(safe-area-inset-left));
  border-bottom: 3px double var(--rule-strong);
}
.wordmark { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); }
.wordmark .wm-mark { width: 30px; height: 30px; }
.wm-name { font-family: var(--serif); font-weight: 800; font-size: 1.32rem; letter-spacing: -0.02em; line-height: 1; }
.wm-tag { font-size: 0.78rem; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase; color: var(--muted); text-align: right; }
@media (max-width: 479px) { .wm-tag { display: none; } }

.page {
  max-width: 1320px;
  margin: 0 auto;
  padding: 20px calc(var(--gutter) + env(safe-area-inset-right)) calc(56px + env(safe-area-inset-bottom)) calc(var(--gutter) + env(safe-area-inset-left));
}

/* ---------- hero and drop (moment 1) ---------- */

.hero { margin: clamp(12px, 5vh, 56px) 0 clamp(18px, 3vh, 28px); }
.hero h1 { font-size: clamp(2.05rem, 1.2rem + 3.6vw, 3.3rem); line-height: 1.04; font-weight: 750; letter-spacing: -0.025em; max-width: 15ch; }
.lede { margin-top: 12px; color: var(--ink-2); font-size: clamp(1.02rem, 0.95rem + 0.3vw, 1.18rem); max-width: 40ch; }
.has-files .hero { display: none; }

.drop {
  position: relative;
  width: 100%;
  min-height: clamp(300px, 46vh, 440px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 36px 20px;
  background: var(--sheet);
  color: var(--ink);
  border: 2px dashed var(--rule-strong);
  border-radius: 10px;
  box-shadow: var(--shadow-sm), inset 0 0 0 8px var(--sheet-2);
  font: inherit;
  cursor: pointer;
  text-align: center;
  -webkit-tap-highlight-color: transparent;
  transition: border-color 0.14s, background-color 0.14s, transform 0.14s var(--out);
}
.drop:hover, .drop.over { border-color: var(--accent); background-color: var(--accent-soft); }
.drop:active { transform: scale(0.995); }
.drop .drop-icon { width: 92px; height: 92px; color: var(--ink); transition: transform 0.26s var(--out); }
.drop.over .drop-icon, .drop:hover .drop-icon { transform: translateY(-4px); }
.drop-plus { display: none; }
.drop-text { display: flex; flex-direction: column; gap: 6px; align-items: center; }
.drop-main { font-size: clamp(1.2rem, 1rem + 0.9vw, 1.55rem); font-weight: 700; max-width: 24ch; line-height: 1.25; }
.drop-sub { color: var(--muted); font-size: 0.98rem; max-width: 34ch; }
.drop-kinds { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 10px; margin-top: 8px; }
.kind {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 12px 6px 10px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: var(--sheet);
  font-size: 0.86rem; font-weight: 600; color: var(--ink-2);
}
.kind svg { width: 18px; height: 18px; color: var(--accent); }
.kind-opt { border-style: dashed; color: var(--muted); }
.drop.busy { cursor: progress; }
.drop.busy .drop-icon .acc, .drop.busy .drop-plus { animation: nudge 0.9s var(--out) infinite alternate; }
@keyframes nudge { from { transform: translateY(-3px); opacity: 1; } to { transform: translateY(3px); opacity: 0.45; } }

/* compact once something is in */
.has-files .drop {
  min-height: 52px;
  width: auto;
  justify-self: start;
  flex-direction: row;
  justify-content: flex-start;
  gap: 12px;
  padding: 10px 16px;
  text-align: left;
  box-shadow: none;
  border-width: 1.5px;
  border-radius: 8px;
}
.has-files .drop .drop-icon, .has-files .drop-kinds { display: none; }
.has-files .drop-plus { display: block; width: 26px; height: 26px; padding: 4px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); }
.has-files .drop-text { align-items: flex-start; gap: 0; }
.has-files .drop-main { font-size: 1rem; max-width: none; }
.has-files .drop-sub { font-size: 0.85rem; max-width: none; }

.intake { display: grid; gap: 14px; }
.has-files .intake > .drop { order: 2; }
.has-files .intake > .tally { order: 1; }
.has-files .intake > .next, .has-files .intake > .hint { order: 1; }
.has-files .intake > .warnings { order: 3; }
body.has-files:not(.is-ready) .drop { width: 100%; min-height: 96px; border-width: 2px; padding: 16px 20px; }
body.has-files:not(.is-ready) .drop-main { font-size: 1.15rem; }
.has-files .drop-text { flex-direction: row; flex-wrap: wrap; align-items: baseline; gap: 0 10px; }

/* the empty desk on wide screens: the words on the left, the tray on the right */
@media (min-width: 1000px) {
  body:not(.has-files) .page {
    display: grid;
    grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
    align-items: center;
    gap: 56px;
    min-height: calc(100dvh - 80px);
    padding-top: 0;
  }
  body:not(.has-files) .hero { margin: 0 0 6vh; }
  body:not(.has-files) .drop { min-height: min(62vh, 560px); }
}
.how { list-style: none; margin: 26px 0 0; padding: 0; display: flex; flex-direction: column; gap: 12px; counter-reset: how; }
.how li { display: flex; align-items: baseline; gap: 12px; font-weight: 600; color: var(--ink-2); counter-increment: how; }
.how li::before {
  content: counter(how);
  flex: none;
  width: 28px; height: 28px;
  display: inline-grid; place-items: center;
  border: 1.5px solid var(--ink);
  border-radius: 50%;
  font-family: var(--serif); font-weight: 800; font-size: 0.9rem; color: var(--ink);
  transform: translateY(-1px);
}
@media (max-width: 999px) { .how { display: none; } }

/* ---------- recognized files (moment 2) ---------- */

.chips { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 10px; }
.chips:empty { display: none; }
.chip {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 72px;
  padding: 12px 14px;
  background: var(--sheet);
  border: 1px solid var(--rule);
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
}
.chip-ico {
  position: relative;
  flex: none;
  width: 42px; height: 42px;
  display: grid; place-items: center;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent);
}
.chip-ico > .ico { width: 24px; height: 24px; }
.chip-ico .tick {
  position: absolute; right: -6px; bottom: -6px;
  width: 20px; height: 20px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: 0 0 0 2px var(--sheet);
}
.chip-ico .tick .ico { width: 12px; height: 12px; }
.what { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.chip-head { font-weight: 700; font-size: 1.02rem; line-height: 1.25; color: var(--ink); }
.chip-head .num { font-size: 1.28rem; font-weight: 800; }
.chip-sub { color: var(--muted); font-size: 0.85rem; line-height: 1.3; overflow-wrap: anywhere; }
.chip-change { align-self: center; }
@media (max-width: 719px) {
  .chips { gap: 8px; }
  .chip { min-height: 0; padding: 10px 12px; gap: 12px; }
  .chip-ico { width: 36px; height: 36px; }
  .chip-ico > .ico { width: 20px; height: 20px; }
  .chip-sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .thumb { width: 36px; height: 46px; }
  .tally { gap: 4px 18px; }
  .tally .fig { font-size: 1.4rem; }
  /* once ready, the files fold into one tight list so the questions come first */
  .is-ready .chips { gap: 0; }
  .is-ready .chip { border-radius: 0; box-shadow: none; padding: 8px 12px; margin-top: -1px; }
  .is-ready .chip:first-child { border-radius: 8px 8px 0 0; margin-top: 0; }
  .is-ready .chip:last-child { border-radius: 0 0 8px 8px; }
  .is-ready .chip-ico { width: 30px; height: 30px; border-radius: 6px; }
  .is-ready .chip-ico > .ico { width: 18px; height: 18px; }
  .is-ready .chip-ico .tick { width: 16px; height: 16px; right: -5px; bottom: -5px; }
  .is-ready .chip-ico .tick .ico { width: 10px; height: 10px; }
  .is-ready .chip-head { font-size: 0.95rem; }
  .is-ready .chip-head .num { font-size: 1.05rem; }
  .is-ready .chip-sub, .is-ready .thumb { display: none; }
  .is-ready .drop-sub { display: none; }
  .is-ready .drop { min-height: 48px; padding: 6px 12px; }
  .stamp { font-size: 0.82rem; padding: 4px 9px 4px 6px; }
}
@media (max-width: 379px) {
  .tally .fig { font-size: 1.22rem; }
  .tally { gap: 2px 14px; }
  .stamp svg { width: 16px; height: 16px; }
}
@media (min-width: 720px) and (max-width: 1099px) {
  .is-ready .drop-sub, .is-ready .chip-sub, .is-ready .thumb { display: none; }
  .is-ready .chip { min-height: 60px; }
}
@media (min-width: 720px) {
  .is-ready .intake { grid-template-columns: minmax(0, 1fr) auto; align-items: center; }
  .is-ready .intake > * { grid-column: 1 / -1; }
  .is-ready .intake > .tally { grid-column: 1; grid-row: 2; }
  .is-ready .intake > .drop { grid-column: 2; grid-row: 2; }
}
.thumb {
  flex: none;
  width: 46px; height: 59px;
  object-fit: cover; object-position: top;
  background: var(--paper);
  border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.06), 0 4px 10px -4px rgba(60, 45, 20, 0.4);
  transform: rotate(2deg);
  margin: -4px 2px -4px 0;
}

.tally {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 28px;
  padding: 4px 2px 2px;
}
.t-item { display: inline-flex; align-items: baseline; gap: 8px; }
.tally .fig { font-size: clamp(1.55rem, 1.2rem + 1.2vw, 2rem); font-weight: 800; letter-spacing: -0.01em; color: var(--ink); }
.t-label { color: var(--ink-2); font-weight: 600; }

.next {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px;
  border-left: 4px solid var(--accent);
  background: var(--sheet);
  font-weight: 700;
  font-size: 1.05rem;
}
.hint { color: var(--muted); font-size: 0.95rem; }

.warnings { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.warnings li {
  position: relative;
  padding: 10px 14px 10px 42px;
  background: var(--attn-soft);
  border-left: 4px solid var(--attn);
  border-radius: 4px;
  color: var(--ink);
}
.warnings li::before {
  content: "";
  position: absolute; left: 14px; top: 13px;
  width: 13px; height: 13px;
  border: 2px solid var(--attn);
  transform: rotate(45deg);
}

/* ---------- buttons ---------- */

button { font: inherit; color: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 58px;
  padding: 14px 28px;
  background: var(--accent);
  color: var(--accent-ink);
  border: 0;
  border-radius: 8px;
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.2), var(--shadow-sm);
  font-size: 1.18rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.14s var(--out), background-color 0.14s;
}
.primary:hover:not(:disabled) { background: var(--accent-press); }
.primary:active:not(:disabled) { transform: translateY(1px); box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.2); }
.primary:disabled { background: var(--rule); color: var(--ink-2); box-shadow: none; cursor: not-allowed; }
.primary.small { min-height: 48px; font-size: 1rem; padding: 10px 18px; }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 44px;
  padding: 9px 14px;
  border: 1.5px solid var(--rule-strong);
  border-radius: 8px;
  background: var(--sheet);
  color: var(--ink);
  font-weight: 650;
  text-decoration: none;
  cursor: pointer;
  transition: border-color 0.14s, transform 0.14s var(--out);
}
.btn:hover { border-color: var(--accent); }
.btn:active { transform: translateY(1px); }
.btn svg { width: 18px; height: 18px; color: var(--accent); }
.btn[aria-disabled="true"], .btn-hero[aria-disabled="true"], .btn-big[aria-disabled="true"] { opacity: 0.5; pointer-events: none; }

.linkish {
  display: inline-flex; align-items: center;
  min-height: 44px;
  background: none;
  border: 0;
  padding: 0 4px;
  color: var(--accent);
  font-weight: 650;
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 3px;
  cursor: pointer;
}
.linkish.quiet { font-weight: 500; font-size: 0.88rem; color: var(--ink-2); }

/* one-tap answers */
.choice {
  display: inline-flex; align-items: center; gap: 10px;
  min-height: 52px;
  padding: 12px 18px;
  border: 1.5px solid var(--rule-strong);
  border-radius: 8px;
  background: var(--sheet);
  color: var(--ink);
  font-weight: 650;
  font-size: 1rem;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.14s, background-color 0.14s, transform 0.14s var(--out);
}
.choice:hover { border-color: var(--accent); background: var(--accent-soft); }
.choice:active { transform: scale(0.98); }
.choice.strong { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.2); }
.choice.strong:hover { background: var(--accent-press); }
.choice .ico { width: 20px; height: 20px; }

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

.work { margin-top: 22px; display: flex; flex-direction: column; gap: 18px; }
.steps { display: flex; flex-direction: column; gap: 18px; min-width: 0; }

.confirm, .action, .progress, .done, .fold, .es-dialog {
  background: var(--sheet);
  border: 1px solid var(--rule);
  border-radius: 10px;
  box-shadow: var(--shadow-sm);
}

/* phones: one column; the done card first, then questions, then the paper */
@media (max-width: 719px) {
  .desk, .steps { display: contents; }
  .done { order: 0; }
  .confirm { order: 1; }
  .action, .progress { order: 2; }
  .preview { order: 3; }
  .filled { order: 4; }
  .review { order: 5; }
}

@media (min-width: 720px) {
  .desk {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 20px;
    align-items: start;
  }
  .steps { grid-column: 1; grid-row: 1; }
  .preview { grid-column: 2; grid-row: 1; position: sticky; top: 12px; }
}
@media (min-width: 1100px) {
  .desk { grid-template-columns: minmax(0, 0.92fr) minmax(0, 1fr); gap: 28px; }
}

/* the assistant card: friendly questions with big answers */
.confirm { padding: 18px 18px 8px; border-top: 4px solid var(--accent); }
.confirm h2 { display: flex; align-items: center; gap: 10px; font-size: 1.35rem; margin-bottom: 4px; }
.confirm h2 .ico {
  width: 34px; height: 34px; padding: 6px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
}
.confirm-items { display: flex; flex-direction: column; container-type: inline-size; }
.ask { display: flex; flex-direction: column; gap: 12px; padding: 16px 0 18px; border-top: 1px dashed var(--rule); }
.ask:first-child { border-top: 0; }
.ask-title { font-weight: 700; font-size: 1.1rem; line-height: 1.3; }
.ask-sub { margin-top: 4px; color: var(--ink-2); font-size: 0.93rem; }
.ask-actions { display: flex; flex-direction: column; align-items: stretch; gap: 8px; }
.ask-actions .choice { width: 100%; }
@container (min-width: 520px) {
  .ask-actions { flex-direction: row; flex-wrap: wrap; align-items: center; }
  .ask-actions .choice { width: auto; }
}
.own { display: flex; gap: 8px; }
.own input, .q input, .es-pair textarea {
  font: inherit;
  color: var(--ink);
  background: var(--sheet);
  border: 1.5px solid var(--rule-strong);
  border-radius: 8px;
}
.own input { flex: 1; min-width: 0; min-height: 48px; padding: 8px 12px; }
.own input:focus, .q input:focus { border-color: var(--accent); outline: 3px solid var(--accent-soft); outline-offset: 0; }
.ranges { border-top: 1px dashed var(--rule); padding: 6px 0 10px; }
.ranges summary { cursor: pointer; color: var(--ink-2); font-weight: 650; font-size: 0.93rem; min-height: 44px; display: flex; align-items: center; gap: 10px; list-style: none; }
.ranges summary::-webkit-details-marker { display: none; }
.ranges summary::before { content: ""; width: 7px; height: 7px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg); transition: transform 0.2s var(--out); }
.ranges[open] summary::before { transform: rotate(45deg); }
.ranges .ask { padding-left: 14px; border-left: 3px solid var(--rule-2); }

.confirm, .done { transition: opacity 0.3s var(--out), translate 0.3s var(--out); }
@starting-style { .confirm, .done { opacity: 0; translate: 0 10px; } }

/* the action card: the date and the big Make button */
.action { padding: 18px; display: flex; flex-direction: column; gap: 16px; }
.action-main { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.questions { display: flex; flex-direction: column; gap: 14px; }
.q { display: flex; flex-direction: column; gap: 8px; }
.q label { display: flex; flex-direction: column; gap: 2px; }
.q-name { font-family: var(--serif); font-weight: 700; font-size: 1.2rem; }
.q-aside { color: var(--muted); font-size: 0.9rem; }
.q input {
  width: 100%;
  min-height: 54px;
  padding: 10px 14px;
  font-size: 1.2rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.remembered { font-size: 0.92rem; color: var(--ink-2); }
.remembered summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; font-weight: 600; }
.remembered ul { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.remembered li { display: flex; align-items: center; gap: 8px; }
.ok-mark { color: var(--accent); }

.make-box { display: flex; flex-direction: column; gap: 8px; }
.make-box .primary { width: 100%; }
.make-why { display: flex; gap: 8px; align-items: flex-start; color: var(--ink-2); font-size: 0.9rem; }
.make-why .why-mark { color: var(--attn); margin-top: 2px; }

/* progress */
.progress { padding: 18px; }
.progress-msg { margin: 0 0 10px; font-weight: 700; font-size: 1.08rem; }
.bar { height: 12px; background: var(--rule-2); border-radius: 6px; overflow: hidden; box-shadow: inset 0 0 0 1px var(--rule); }
.bar-fill {
  height: 100%; width: 0;
  background: var(--accent) linear-gradient(90deg, transparent 0 40%, rgba(255, 255, 255, 0.28) 50%, transparent 60% 100%) 0 0 / 200% 100%;
  border-radius: 6px;
  transition: width 0.3s var(--out);
  animation: sheen 1.6s linear infinite;
}
@keyframes sheen { to { background-position: -200% 0; } }
.progress-count { margin-top: 8px; color: var(--muted); font-size: 0.92rem; font-variant-numeric: tabular-nums; }

/* ---------- done (moment 4) ---------- */

.done { padding: 20px 18px; display: flex; flex-direction: column; gap: 14px; }
.done-head { container-type: inline-size; }
/* Narrow screens: the stamp sits under the headline, never on top of it. */
@media (max-width: 560px) {
  .done-head { flex-direction: column; align-items: flex-start; gap: 10px; }
  .done-head .stamp { order: 2; margin-left: 4px; }
}
.done-head { display: flex; align-items: center; gap: 16px; position: relative; }
.stamp {
  flex: none;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px 6px 8px;
  border: 3px solid var(--accent);
  border-radius: 6px;
  color: var(--accent);
  font-family: var(--serif);
  font-weight: 800;
  font-size: 1rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  transform: rotate(-6deg);
  box-shadow: inset 0 0 0 2px var(--sheet), inset 0 0 0 3px var(--accent);
}
.stamp svg { width: 20px; height: 20px; }
#done-title { font-size: clamp(1.45rem, 1.2rem + 1vw, 1.85rem); line-height: 1.15; }
#done-title:focus { outline: none; }
.done-sub { margin-top: 4px; color: var(--ink-2); font-weight: 600; font-variant-numeric: tabular-nums; }

.btn-hero, .btn-big {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  width: 100%;
  min-height: 64px;
  padding: 14px 20px;
  border-radius: 8px;
  font-size: 1.18rem;
  font-weight: 750;
  text-decoration: none;
  transition: transform 0.14s var(--out), background-color 0.14s;
}
.btn-hero svg, .btn-big svg { width: 26px; height: 26px; }
.btn-hero { background: var(--accent); color: var(--accent-ink); box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.22), var(--shadow-md); }
.btn-hero:hover { background: var(--accent-press); }
.btn-hero:active, .btn-big:active { transform: translateY(1px); }
.btn-big { min-height: 56px; font-size: 1.06rem; background: var(--sheet); color: var(--accent); border: 2px solid var(--accent); }
.btn-big:hover { background: var(--accent-soft); }
.dl-es { display: flex; flex-direction: column; gap: 10px; }

.es-note {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px;
  padding: 10px 12px 10px 14px;
  background: var(--attn-soft);
  border-left: 4px solid var(--attn);
  border-radius: 4px;
  color: var(--ink);
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.35;
}
.es-note > span { flex: 1 1 16em; }
.es-note .ico { color: var(--attn); width: 20px; height: 20px; }
.es-note .linkish { min-height: 44px; }
.es-wait { color: var(--muted); }
.dl-more { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding-top: 12px; border-top: 1px dashed var(--rule); }
.dl-more .label { width: 100%; }
.dl-last { display: flex; justify-content: flex-start; }
.left-out { font-size: 0.93rem; }
.left-out-h { margin: 0 0 4px; font-weight: 650; }
.left-out ul { margin: 0; padding-left: 20px; color: var(--ink-2); }

/* ---------- the paper (moment 3) ---------- */

.preview { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.pv-head { display: flex; flex-direction: column; gap: 10px; }
.pv-who { display: flex; align-items: center; gap: 10px; }
.pv-who > div { flex: 1; min-width: 0; text-align: center; }
.pv-name { font-family: var(--serif); font-weight: 700; font-size: 1.3rem; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pv-unit { display: block; font-family: var(--sans); font-size: 0.76rem; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase; color: var(--muted); font-variant-numeric: tabular-nums; }
.pv-pos { color: var(--muted); font-size: 0.88rem; font-variant-numeric: tabular-nums; }
.nav {
  flex: none;
  width: 48px; height: 48px;
  display: grid; place-items: center;
  border-radius: 50%;
  border: 1.5px solid var(--rule-strong);
  background: var(--sheet);
  color: var(--ink);
  cursor: pointer;
  transition: border-color 0.14s, transform 0.14s var(--out);
}
.nav svg { width: 22px; height: 22px; }
.nav:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.nav:active:not(:disabled) { transform: scale(0.94); }
.nav:disabled { opacity: 0.35; cursor: default; }
.pv-toggles { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }
.seg { display: inline-flex; padding: 3px; gap: 3px; border: 1.5px solid var(--rule-strong); border-radius: 10px; background: var(--sheet); }
.seg button {
  min-height: 44px;
  padding: 6px 14px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--ink-2);
  font-weight: 650;
  font-size: 0.93rem;
  cursor: pointer;
  transition: background-color 0.14s, color 0.14s;
}
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--sheet); }
.es-progress { color: var(--muted); font-size: 0.86rem; text-align: center; }

.pv-stage { position: relative; display: grid; justify-items: center; padding: 8px 12px 22px 4px; touch-action: pan-y; }
.pv-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 8.5 / 11;
  background: var(--paper);
  border-radius: 2px;
  overflow: hidden;
  transform: translateY(-2px);
  /* the sheet, lifted, with the rest of the stack peeking out behind it */
  box-shadow:
    0 0 0 1px rgba(40, 30, 10, 0.07),
    0 2px 3px rgba(40, 30, 10, 0.08),
    0 18px 34px -14px rgba(40, 30, 10, 0.38),
    5px 5px 0 -1px var(--paper),
    5px 5px 0 0 var(--rule),
    10px 10px 0 -1px var(--paper),
    10px 10px 0 0 var(--rule);
}
@media (min-width: 720px) {
  .pv-frame { width: min(100%, calc((100dvh - 250px) * 8.5 / 11)); min-width: min(100%, 300px); }
}
.pv-frame img { position: absolute; inset: 0; display: block; width: 100%; height: 100%; object-fit: contain; transition: opacity 0.26s; filter: var(--paper-dim, none); }
.pv-frame img.loading { opacity: 0.55; }
.pv-frame .ghost { pointer-events: none; }
.pv-msg {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  padding: 30px;
  text-align: center;
  color: #48433a;
  background: var(--paper);
  font-size: 1rem;
}
.pv-es-note { margin: 0; }

/* ---------- folded details: what we filled in, residents ---------- */

.fold > summary {
  display: flex; align-items: baseline; flex-wrap: wrap; gap: 2px 12px;
  min-height: 60px;
  padding: 16px 48px 16px 18px;
  position: relative;
  cursor: pointer;
  list-style: none;
}
.fold > summary::-webkit-details-marker { display: none; }
.fold > summary::after {
  content: "";
  position: absolute; right: 20px; top: 24px;
  width: 9px; height: 9px;
  border-right: 2.2px solid var(--ink-2);
  border-bottom: 2.2px solid var(--ink-2);
  transform: rotate(45deg);
  transition: transform 0.2s var(--out);
}
.fold[open] > summary::after { transform: translateY(4px) rotate(-135deg); }
.fold > summary:hover .fold-title { text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 1.5px; }
.fold-title { font-family: var(--serif); font-weight: 700; font-size: 1.18rem; }
.fold-sum { color: var(--muted); font-size: 0.92rem; }
.fold[open] > summary { border-bottom: 1px solid var(--rule-2); }

.filled .fold > :not(summary) { margin-left: 18px; margin-right: 18px; }
.filled .sub { margin-top: 12px; margin-bottom: 4px; }
.frows { display: flex; flex-direction: column; }
.frow {
  display: grid;
  grid-template-columns: minmax(92px, 36%) minmax(0, 1fr) auto;
  gap: 2px 12px;
  align-items: baseline;
  padding: 8px 0;
  border-top: 1px solid var(--rule-2);
}
.frow:first-child { border-top: 0; }
.f-label { color: var(--ink-2); font-size: 0.9rem; }
.f-val { font-weight: 700; color: var(--ink); overflow-wrap: anywhere; }
.f-val.money { font-variant-numeric: tabular-nums; text-align: right; }
.f-src { display: block; font-weight: 400; color: var(--muted); font-size: 0.8rem; margin-top: 1px; }
.f-src.suggested::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: currentColor; margin-right: 5px; vertical-align: 1px; }
.f-val.empty { color: var(--muted); font-weight: 400; font-style: italic; }
.change { font-size: 0.88rem; font-weight: 600; }
.menu {
  grid-column: 1 / -1;
  margin: 6px 0 4px;
  padding: 12px;
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: var(--sheet-2);
  display: flex; flex-direction: column; gap: 8px;
}
.menu-title { font-size: 0.78rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.opt {
  display: flex; justify-content: space-between; gap: 12px;
  width: 100%;
  min-height: 48px;
  padding: 10px 12px;
  text-align: left;
  border: 1.5px solid var(--rule-strong);
  border-radius: 8px;
  background: var(--sheet);
  color: var(--ink);
  cursor: pointer;
}
.opt:hover { border-color: var(--accent); }
.opt b { font-variant-numeric: tabular-nums; }
.menu-foot { display: flex; gap: 14px; flex-wrap: wrap; }
.blanks { margin: 8px 18px 14px; border-top: 1px solid var(--rule-2); }
.blanks summary { cursor: pointer; color: var(--ink-2); font-weight: 650; font-size: 0.93rem; min-height: 44px; display: flex; align-items: center; }
.filled .fold[open] { padding-bottom: 10px; }

/* residents */
.table-wrap { container-type: inline-size; padding: 4px 18px 14px; }
table { width: 100%; border-collapse: collapse; table-layout: fixed; }
th.num { width: 150px; }
th.num:nth-child(6) { width: 250px; }
th {
  text-align: left;
  font-size: 0.76rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--muted);
  padding: 10px 8px;
  border-bottom: 2px solid var(--ink);
  background: var(--sheet);
}
th.num, td.num { text-align: right; }
td { padding: 6px 8px; border-bottom: 1px solid var(--rule-2); vertical-align: top; }
tr.out td { color: var(--muted); }
tr.out .who { text-decoration: line-through; }
tr.current td { background: var(--accent-soft); }
.c-inc { width: 44px; }
.c-unit { width: 110px; }
td.c-unit { font-variant-numeric: tabular-nums; font-weight: 700; padding-top: 14px; }
td.c-inc { padding-top: 6px; }
td.c-name { padding-top: 6px; }
.who {
  min-height: 44px;
  background: none; border: 0; padding: 4px 0;
  color: var(--ink); font-weight: 650; text-align: left; cursor: pointer;
}
.who:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.out-tag { display: block; font-size: 0.78rem; color: var(--muted); }
/* a 44 px tap area around a 22 px box */
td input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 44px; height: 44px;
  margin: 0 0 0 -11px;
  border-radius: 8px;
  cursor: pointer;
  background:
    linear-gradient(var(--sheet), var(--sheet)) center / 18px 18px no-repeat,
    linear-gradient(var(--ink-2), var(--ink-2)) center / 22px 22px no-repeat;
}
td input[type="checkbox"]:checked {
  background:
    var(--check) center / 16px 16px no-repeat,
    linear-gradient(var(--accent), var(--accent)) center / 22px 22px no-repeat;
}
.money-in {
  width: 9em;
  max-width: 100%;
  min-height: 44px;
  font: inherit;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  text-align: right;
  color: var(--ink);
  background: transparent;
  border: 1.5px solid transparent;
  border-radius: 6px;
  padding: 6px 8px;
}
.money-in:hover { border-color: var(--rule); }
.money-in:focus { border-color: var(--accent); background: var(--sheet); outline: 3px solid var(--accent-soft); outline-offset: 0; }
.money-in::placeholder { color: var(--muted); font-weight: 400; }
.tag { display: block; font-size: 0.76rem; color: var(--muted); margin-top: -2px; padding-right: 9px; }
.tag.estimate::before, .st .dot { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: currentColor; margin-right: 5px; vertical-align: 1px; }
.items { display: block; font-size: 0.76rem; color: var(--muted); padding-right: 9px; max-width: 26em; margin-left: auto; }
.c-state { width: 170px; }
td.c-state { padding-top: 14px; font-size: 0.88rem; }
.st { display: inline-flex; align-items: center; gap: 6px; font-weight: 650; color: var(--ink-2); }
.st .m { width: 16px; height: 16px; }
.st .dot { width: 9px; height: 9px; margin: 0 3px; }
.st-ok .m { color: var(--accent); }
.st-need { color: var(--ink); }
.st-need .m { color: var(--attn); }
td.c-state .linkish { margin-left: 4px; min-height: 44px; min-width: 44px; justify-content: center; margin-top: -12px; margin-bottom: -12px; }
tr.answer-row td { border-bottom: 1px solid var(--rule-2); padding-top: 0; }
tr[data-split="needs"] td { border-bottom: 0; }
.answers { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 4px 0 12px; font-size: 0.92rem; }
.ans-label { font-weight: 700; }
.ans-or { color: var(--muted); }
.ans-note { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); }
.ans-note .m { width: 16px; height: 16px; color: var(--attn); }
.chip-btn { min-height: 44px; padding: 8px 14px; font-size: 0.92rem; }
.chip-fig { font-weight: 500; color: var(--muted); margin-left: 4px; font-variant-numeric: tabular-nums; }
.choice.chip-btn .chip-fig { color: inherit; opacity: 0.8; }
.ans-rent { display: inline-flex; align-items: center; gap: 8px; font-weight: 650; }
.money-in.boxed { border-color: var(--rule-strong); background: var(--sheet); width: 8em; }
.fit-ask { flex-basis: 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.fit-ask .ans-note { flex-basis: 100%; }
.fit-ask .choice { min-height: 44px; }
.fit-own { flex: 1 1 18em; align-items: flex-end; min-width: 0; }
.fit-lab { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 0; font-weight: 650; }
.fit-own .btn { min-height: 48px; }

/* residents as stacked cards when the table does not fit */
@container (max-width: 820px) {
  #grid, #grid tbody { display: block; }
  #grid thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  #grid tr { display: flex; flex-wrap: wrap; align-items: flex-start; padding: 10px 0 8px; border-bottom: 1px solid var(--rule); }
  #grid td { display: block; border: 0; padding: 2px 4px; width: auto; }
  #grid td.c-inc { order: 0; width: 44px; padding: 0; }
  #grid td.c-inc input { margin: -8px 0 -8px -11px; }
  #grid td.c-unit { order: 1; padding-top: 0; flex: none; min-width: 4.2em; }
  #grid td.c-name { order: 2; flex: 1 1 0; min-width: 0; padding-top: 0; }
  #grid tr::before { content: ""; order: 3; flex-basis: 100%; height: 0; }
  #grid td.num { order: 4; flex: 0 1 10em; min-width: 0; text-align: right; }
  #grid td.c-name + td.num { margin-left: 44px; }
  #grid td.num::before { content: attr(data-short); display: block; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
  #grid td.c-state { order: 5; flex: 1 0 100%; padding: 2px 4px 0 44px; }
  #grid .money-in { width: 100%; padding: 4px 2px 4px 0; min-height: 44px; font-size: 0.98rem; }
  #grid td.c-unit { padding-top: 10px; }
  #grid td.c-inc { padding-top: 11px; }
  #grid td.c-name { padding-top: 0; }
  #grid .tag, #grid .items { padding-right: 2px; }
  #grid tr.answer-row { padding-top: 0; }
  #grid tr.answer-row td:first-child { display: none; }
  #grid tr.answer-row td { flex: 1 1 100%; padding-left: 44px; }
  #grid tr[data-split="needs"] { border-bottom: 0; }
  #grid tr.current { background: var(--accent-soft); border-radius: 6px; }
  #grid tr.current td { background: none; }
}

/* ---------- the dock: primary action pinned for thumbs on phones ---------- */

@media (max-width: 719px) {
  .is-ready .page { padding-bottom: calc(150px + env(safe-area-inset-bottom)); }
  .dock {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 20;
    margin: 0;
    padding: 12px calc(var(--gutter) + env(safe-area-inset-right)) calc(12px + env(safe-area-inset-bottom)) calc(var(--gutter) + env(safe-area-inset-left));
    background: var(--sheet);
    border: 0;
    border-top: 1px solid var(--rule);
    border-radius: 0;
    box-shadow: 0 -8px 24px -12px rgba(40, 30, 10, 0.3);
  }
  .make-why { font-size: 0.85rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .make-why:not([hidden]) { display: -webkit-box; }
  .make-why .why-mark { display: none; }
  .progress.dock { padding-top: 14px; }
  .action { padding-bottom: 18px; }
}

/* ---------- drag veil ---------- */

.dropveil {
  position: fixed; inset: 10px; z-index: 30;
  display: grid; place-items: center;
  background: color-mix(in srgb, var(--accent-soft) 88%, transparent);
  border: 3px dashed var(--accent);
  border-radius: 14px;
  pointer-events: none;
}
.dropveil p {
  display: flex; align-items: center; gap: 14px;
  padding: 18px 28px;
  background: var(--sheet);
  color: var(--ink);
  border-radius: 10px;
  box-shadow: var(--shadow-md);
  font-family: var(--serif);
  font-size: 1.5rem;
  font-weight: 700;
}
.dropveil svg { width: 48px; height: 48px; }

/* ---------- Spanish review ---------- */

.es-dialog {
  width: min(980px, calc(100vw - 24px));
  max-height: calc(100dvh - 32px);
  padding: 0;
  color: var(--ink);
}
.es-dialog::backdrop { background: rgba(20, 16, 8, 0.55); }
.es-form { display: flex; flex-direction: column; max-height: calc(100dvh - 34px); }
.es-top { padding: 20px 22px 12px; border-bottom: 1px solid var(--rule-2); }
.es-top h2 { margin-bottom: 4px; }
.es-list { overflow: auto; padding: 8px 22px; }
.es-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--rule-2); }
.es-en { color: var(--ink-2); font-size: 0.93rem; }
.es-pair textarea { width: 100%; min-height: 4.5em; font-size: 0.95rem; padding: 8px 10px; resize: vertical; }
.es-pair textarea.saving { opacity: 0.7; }
.es-pair .es-bad { grid-column: 2; margin: 4px 0 0; color: var(--ink-2); font-size: 0.88rem; }
.es-error { margin: 8px 22px 0; padding: 8px 12px; background: var(--attn-soft); border-left: 4px solid var(--attn); border-radius: 4px; }
.es-actions { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; padding: 14px 22px calc(14px + env(safe-area-inset-bottom)); border-top: 1px solid var(--rule-2); }
.es-actions .linkish { margin-left: auto; }
.es-saved { color: var(--muted); font-size: 0.9rem; }
@media (max-width: 640px) { .es-pair { grid-template-columns: 1fr; gap: 6px; } .es-pair .es-bad { grid-column: 1; } }

/* ---------- motion ---------- */

::view-transition-group(*) { animation-duration: 0.3s; animation-timing-function: var(--out); }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: 0.18s; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; }
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
}
.muted { color: var(--muted); }
.chip-note { flex-basis: 100%; color: var(--ink); font-size: 0.9rem; }
.chip.forget { background: none; border: 0; }
