/* ==========================================================================
   Querida Post — builder (/make/) and dashboard (/dashboard/)
   Same language as the invitations (design/design-system.md): paper on a
   table, letterpress keylines, index-card tab stubs, a wax seal to publish.
   No gradients, no glass, no pills, no SaaS chrome.
   Contrast (WCAG): ink/paper 13.4, ink-soft/paper 6.6, ink-soft/page 5.6,
   wax/paper 9.6, paper/wax 9.6, olive/paper 7.0.
   ========================================================================== */

:root {
  --b-page:      #E9E3D6;
  --b-paper:     #FAF6EE;
  --b-paper-2:   #F1EBDD;
  --b-ink:       #2A2520;
  --b-ink-soft:  #5C5347;
  --b-wax:       #7A2230;
  --b-wax-dark:  #611A26;
  --b-olive:     #4B5434;
  --b-foil:      #A9884C;
  --b-line:      rgba(42, 37, 32, .24);
  --b-line-2:    rgba(42, 37, 32, .12);
  --b-error:     #8E1B1B;
  --b-ok:        #3F5A2E;
  --shadow-rgb:  38, 30, 20;
  --shadow-paper: 0 1px 1px rgba(var(--shadow-rgb), .12), 0 6px 12px -6px rgba(var(--shadow-rgb), .26), 0 22px 34px -22px rgba(var(--shadow-rgb), .4);
  --shadow-low:   0 1px 1px rgba(var(--shadow-rgb), .14), 0 4px 8px -4px rgba(var(--shadow-rgb), .22);
  --f-script: 'Parisienne', 'Snell Roundhand', cursive;
  --f-display: 'Cormorant Garamond', Garamond, 'Times New Roman', serif;
  --f-serif: 'Spectral', 'Iowan Old Style', Georgia, serif;
  --f-sans: 'Karla', 'Avenir Next', 'Helvetica Neue', sans-serif;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --grain: url(/assets/shared/paper-grain.svg);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--b-page);
  background-image: var(--grain);
  background-size: 220px;
  background-blend-mode: multiply;
  color: var(--b-ink);
  font-family: var(--f-serif);
  font-size: 1.0625rem;
  line-height: 1.55;
}
img { max-width: 100%; display: block; }
h1, h2, h3, p, ul, ol, fieldset, legend, figure { margin: 0; padding: 0; }
fieldset { border: 0; min-width: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--b-wax); text-underline-offset: .2em; text-decoration-thickness: 1px; }
[hidden] { display: none !important; }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

:where(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: 2px dashed var(--b-wax);
  outline-offset: 4px;
}

/* ---------- masthead ---------- */
.mast {
  display: flex; align-items: baseline; justify-content: space-between; gap: 1rem;
  max-width: 1320px; margin: 0 auto; padding: 1.1rem 16px .4rem;
}
.mast__brand {
  font-family: var(--f-script); font-size: 1.9rem; line-height: 1; color: var(--b-ink); text-decoration: none;
}
.mast__brand small {
  display: block; margin-top: .25rem; font-family: var(--f-sans); font-size: .6875rem; letter-spacing: .2em;
  text-transform: uppercase; color: var(--b-ink-soft);
}
.mast__right { display: flex; align-items: baseline; gap: 1.1rem; }
.linkbtn {
  background: none; border: 0; padding: .5rem .1rem; min-height: 44px; cursor: pointer;
  font-family: var(--f-sans); font-size: .75rem; font-weight: 600; letter-spacing: .16em; text-transform: uppercase;
  color: var(--b-ink-soft); text-decoration: underline; text-underline-offset: .35em; text-decoration-color: var(--b-line);
}
.linkbtn:hover { color: var(--b-ink); text-decoration-color: currentColor; }
.savestate {
  font-family: var(--f-sans); font-size: .75rem; letter-spacing: .08em; color: var(--b-ink-soft);
}
.savestate[data-state="error"] { color: var(--b-error); }

/* ---------- layout: sheet + preview ---------- */
.desk {
  max-width: 1320px; margin: 0 auto; padding: 0 16px 7rem;
  display: grid; gap: 2rem; grid-template-columns: minmax(0, 1fr);
}
@media (min-width: 1024px) {
  .desk { grid-template-columns: minmax(0, 620px) minmax(0, 1fr); padding: 0 32px 4rem; align-items: start; }
}

/* ---------- tab stubs (index-card tabs over the sheet) ---------- */
.stubs {
  display: flex; gap: 4px; margin: 0; padding: .4rem 2px 0; list-style: none;
  overflow-x: auto; scrollbar-width: none; scroll-snap-type: x proximity;
}
.stubs::-webkit-scrollbar { display: none; }
.stub {
  flex: none; scroll-snap-align: start;
  display: flex; align-items: center; gap: .4rem;
  min-height: 44px; padding: .55rem .8rem .5rem;
  background-color: var(--b-paper-2);
  background-image: var(--grain); background-size: 200px; background-blend-mode: multiply;
  border: 0; border-radius: 4px 4px 0 0;
  box-shadow: inset 0 -1px 0 var(--b-line), 0 -1px 2px rgba(var(--shadow-rgb), .06);
  font-family: var(--f-sans); font-size: .75rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase;
  color: var(--b-ink-soft); cursor: pointer; white-space: nowrap;
  translate: 0 4px;
  transition: translate .18s var(--ease), background-color .18s;
}
.stub__n { font-family: var(--f-display); font-size: 1.05rem; font-weight: 600; letter-spacing: 0; color: var(--b-ink-soft); }
.stub__tick { display: none; width: 14px; height: 10px; }
.stub.is-done .stub__tick { display: block; }
.stub.is-done .stub__n { display: none; }
.stub:hover:not([disabled]) { translate: 0 1px; color: var(--b-ink); }
.stub[aria-current="step"] {
  background-color: var(--b-paper); color: var(--b-ink); translate: 0 0;
  box-shadow: 0 -1px 2px rgba(var(--shadow-rgb), .08);
  position: relative; z-index: 1;
}
.stub[aria-current="step"] .stub__n { color: var(--b-wax); }
.stub[disabled] { cursor: not-allowed; opacity: .55; }

/* ---------- the sheet ---------- */
.sheet {
  position: relative;
  background-color: var(--b-paper);
  background-image: var(--grain); background-size: 220px; background-blend-mode: multiply;
  box-shadow: var(--shadow-paper);
  padding: 2rem 1.25rem 2.25rem;
}
@media (min-width: 600px) { .sheet { padding: 2.75rem 2.75rem 3rem; } }
.sheet--narrow { max-width: 560px; margin: 2rem auto 0; }
.sheet::before { /* letterpress keyline 10px inside the trim */
  content: ''; position: absolute; inset: 10px; pointer-events: none;
  box-shadow: inset 0 0 0 1px rgba(122, 94, 44, .32);
}
.step { display: grid; gap: 1.6rem; }
.step:focus { outline: none; }
.step__kicker {
  font-family: var(--f-sans); font-size: .75rem; font-weight: 600; letter-spacing: .18em; text-transform: uppercase; color: var(--b-ink-soft);
}
.step__title {
  font-family: var(--f-display); font-weight: 600; font-size: clamp(2rem, 7vw, 2.6rem); line-height: 1.05; letter-spacing: -.005em;
}
.step__title em { font-family: var(--f-script); font-style: normal; font-weight: 400; color: var(--b-wax); font-size: 1.15em; }
.step__lede { color: var(--b-ink-soft); max-width: 46ch; margin-top: -.6rem; }
.section-label {
  display: flex; align-items: center; gap: .8rem;
  font-family: var(--f-sans); font-size: .75rem; font-weight: 700; letter-spacing: .18em; text-transform: uppercase; color: var(--b-olive);
}
.section-label::after { content: ''; flex: 1; border-top: 1px solid var(--b-line); }

/* ---------- fields: ruled stationery ---------- */
.f { display: grid; gap: .3rem; align-content: start; }
.f__label, .f legend {
  font-family: var(--f-sans); font-size: .75rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--b-ink-soft);
}
.f__opt { font-family: var(--f-serif); font-style: italic; text-transform: none; letter-spacing: 0; font-weight: 400; font-size: .875rem; }
.f__hint { font-size: .9rem; color: var(--b-ink-soft); font-style: italic; }
.f__count { font-family: var(--f-sans); font-size: .75rem; color: var(--b-ink-soft); justify-self: end; }
.f__error { color: var(--b-error); font-size: .9375rem; font-style: italic; }
.f__error:empty { display: none; }
.f input:not([type=radio]):not([type=checkbox]):not([type=file]), .f select, .f textarea {
  width: 100%; min-height: 48px; padding: .5rem .15rem;
  background: transparent; border: 0; border-bottom: 1.5px solid var(--b-ink-soft); border-radius: 0;
  font-family: var(--f-serif); font-size: 1.125rem; color: var(--b-ink);
}
.f select { appearance: none; -webkit-appearance: none; padding-right: 1.6rem; cursor: pointer;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%235C5347' stroke-width='1.5'/%3E%3C/svg%3E") right .3rem center no-repeat;
}
.f textarea {
  min-height: 6.5rem; resize: vertical; line-height: 2rem; padding-top: .1rem; border-bottom: 0;
  background-image: repeating-linear-gradient(to bottom, transparent 0 1.95rem, var(--b-line) 1.95rem 2rem);
  background-attachment: local;
}
.f input::placeholder, .f textarea::placeholder { color: var(--b-ink-soft); opacity: .8; font-style: italic; }
.f input:focus, .f select:focus, .f textarea:focus { border-bottom-color: var(--b-wax); outline: none; box-shadow: 0 2px 0 -0.5px var(--b-wax); }
.f.is-invalid input, .f.is-invalid select { border-bottom-color: var(--b-error); border-bottom-width: 2px; }
.row { display: grid; gap: 1.4rem; }
@media (min-width: 600px) { .row--2 { grid-template-columns: 1fr 1fr; } .row--3 { grid-template-columns: 1fr 1fr 1fr; } .row--1-2 { grid-template-columns: 1fr 2fr; } }

.check { display: flex; gap: .7rem; align-items: flex-start; min-height: 44px; padding: .55rem 0; cursor: pointer; }
.check input { width: 20px; height: 20px; margin: .2rem 0 0; accent-color: var(--b-wax); flex: none; }
.check__text small { display: block; color: var(--b-ink-soft); font-style: italic; font-size: .9rem; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  min-height: 48px; padding: .75rem 1.5rem;
  background-color: var(--b-wax); color: var(--b-paper);
  background-image: var(--grain); background-size: 160px; background-blend-mode: multiply;
  border: 0; border-radius: 2px; cursor: pointer; text-decoration: none;
  font-family: var(--f-sans); font-size: .8125rem; font-weight: 700; letter-spacing: .16em; text-transform: uppercase;
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .2), 0 1px 1px rgba(var(--shadow-rgb), .2);
  transition: background-color .15s, translate .1s;
}
.btn:hover { background-color: var(--b-wax-dark); }
.btn:active { translate: 0 1px; }
.btn[disabled], .btn[aria-busy="true"] { opacity: .6; cursor: progress; }
.btn--ghost { background: transparent; color: var(--b-ink); box-shadow: inset 0 0 0 1.5px var(--b-ink-soft); }
.btn--ghost:hover { background: var(--b-paper-2); }
.btn--small { min-height: 44px; padding: .5rem 1rem; font-size: .75rem; }
.btn--olive { background-color: var(--b-olive); }
.btn--olive:hover { background-color: #3C4329; }
.nav { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding-top: .75rem; border-top: 1px solid var(--b-line-2); margin-top: .5rem; }
.nav .btn { margin-left: auto; }

/* ---------- notes, stamps ---------- */
.note {
  padding: .9rem 1rem; border-left: 3px solid var(--b-foil); background: var(--b-paper-2);
  font-size: .95rem; color: var(--b-ink-soft);
}
.note--error { border-left-color: var(--b-error); color: var(--b-error); }
.stamp {
  position: relative; padding: 1rem 1.1rem; rotate: -.6deg;
  border: 1.5px dashed var(--b-wax); color: var(--b-ink);
}
.stamp__head { font-family: var(--f-sans); font-size: .75rem; font-weight: 700; letter-spacing: .18em; text-transform: uppercase; color: var(--b-wax); margin-bottom: .3rem; }

/* ---------- theme picker: four real envelopes ---------- */
.envelopes { display: grid; grid-template-columns: 1fr 1fr; gap: 1.6rem 1rem; padding: .5rem 0; }
.env { position: relative; cursor: pointer; display: grid; gap: .55rem; justify-items: center; text-align: center; }
.env input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.env__paper {
  position: relative; width: 100%; aspect-ratio: 1.45; overflow: hidden;
  background-color: var(--env); background-image: var(--grain); background-size: 160px; background-blend-mode: multiply;
  box-shadow: var(--shadow-low); rotate: var(--r, -2deg);
  transition: translate .2s var(--ease), box-shadow .2s var(--ease), rotate .25s var(--ease);
}
.env__paper::before { /* liner under the open flap */
  content: ''; position: absolute; inset: 0 0 auto 0; height: 56%;
  background: var(--liner) center / cover no-repeat, var(--liner-c);
  clip-path: polygon(4% 0, 96% 0, 50% 100%);
}
.env__paper::after { /* front pocket folds */
  content: ''; position: absolute; inset: 0;
  background: var(--env);
  clip-path: polygon(0 18%, 50% 66%, 100% 18%, 100% 100%, 0 100%);
  filter: brightness(1.04);
}
.env__seal { position: absolute; z-index: 2; left: 50%; top: 66%; width: 24%; translate: -50% -50%; }
.theme-icon { width: 3.5rem; height: 3.5rem; flex: none; object-fit: contain; pointer-events: none; }
.env__identity { display: flex; align-items: center; justify-content: center; gap: .35rem; min-height: 3.5rem; }
.env__identity .theme-icon { width: clamp(2.25rem, 5vw, 3.5rem); }
.env__name { font-family: var(--f-display); font-size: 1.25rem; font-weight: 600; line-height: 1.1; }
.env__mood { font-size: .875rem; font-style: italic; color: var(--b-ink-soft); line-height: 1.3; }
.env:hover .env__paper { translate: 0 -3px; }
.env input:checked + .env__paper { rotate: 0deg; translate: 0 -4px; box-shadow: 0 0 0 3px var(--b-paper), 0 0 0 5px var(--b-wax), var(--shadow-paper); }
.env input:focus-visible + .env__paper { outline: 2px dashed var(--b-wax); outline-offset: 9px; }
@media (min-width: 600px) { .envelopes { grid-template-columns: repeat(4, 1fr); } }

/* ---------- repeaters (hosts, schedule) ---------- */
.rep { display: grid; gap: .9rem; list-style: none; }
.rep__item { display: grid; gap: .8rem; grid-template-columns: minmax(0, 1fr) auto; align-items: end; padding-bottom: .9rem; border-bottom: 1px dotted var(--b-line); }
.rep__fields { display: grid; gap: .8rem; }
@media (min-width: 600px) { .rep--sched .rep__fields { grid-template-columns: 7rem 1fr 1fr; } }
.rep__remove {
  width: 44px; height: 44px; border: 0; background: none; cursor: pointer; color: var(--b-ink-soft);
  font-family: var(--f-display); font-size: 1.6rem; line-height: 1;
}
.rep__remove:hover { color: var(--b-error); }
.rep__add { justify-self: start; }
.preset-group { margin-top: .9rem; padding: .9rem 1rem; background: var(--b-paper-2); border: 1px dashed var(--b-line-2); }
.preset-group__head { margin: 0 0 .6rem; font-size: .85rem; }
.preset-group__head strong { font-weight: 600; letter-spacing: .02em; color: var(--b-ink); }
.preset-group__row { display: flex; flex-wrap: wrap; gap: .5rem .55rem; }
.preset-group .btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ---------- slug ---------- */
.slug { display: grid; gap: .4rem; padding: 1rem; background: var(--b-paper-2); box-shadow: inset 0 0 0 1px var(--b-line-2); }
.slug__url { font-family: var(--f-serif); font-size: 1.05rem; overflow-wrap: anywhere; }
.slug__url b { color: var(--b-wax); font-weight: 600; }
.slug__row { display: flex; gap: .6rem; align-items: end; flex-wrap: wrap; }
.slug__row .f { flex: 1 1 12rem; }

/* ---------- photos ---------- */
.photos { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.4rem 1rem; list-style: none; }
@media (min-width: 600px) { .photos { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.ph { position: relative; background: #FDFCF8; padding: 7% 7% 0; box-shadow: var(--shadow-low); rotate: var(--r, 0deg); }
.ph__img { aspect-ratio: 4 / 5; width: 100%; object-fit: cover; background: #DCD5C5; filter: sepia(.08) saturate(.92); }
.ph__fields { display: grid; gap: .1rem; padding: .3rem 0 .4rem; }
.ph__fields input { min-height: 40px !important; font-size: .95rem !important; padding: .25rem 0 !important; border-bottom-width: 1px !important; }
.ph__remove { position: absolute; top: -10px; right: -10px; width: 44px; height: 44px; border-radius: 50%; border: 0; cursor: pointer; background: var(--b-paper); box-shadow: var(--shadow-low); font-size: 1.3rem; line-height: 1; color: var(--b-ink-soft); }
.ph__remove:hover { color: var(--b-error); }
.ph--busy .ph__img { opacity: .45; }
.ph__busy { position: absolute; inset: 7% 7% auto; aspect-ratio: 4/5; display: grid; place-items: center; font-family: var(--f-sans); font-size: .75rem; letter-spacing: .14em; text-transform: uppercase; }
.drop {
  display: grid; place-items: center; gap: .3rem; min-height: 120px; padding: 1.2rem; text-align: center; cursor: pointer;
  border: 1.5px dashed var(--b-ink-soft); color: var(--b-ink-soft);
}
.drop:hover, .drop.is-over { border-color: var(--b-wax); color: var(--b-ink); background: var(--b-paper-2); }
.drop strong { font-family: var(--f-display); font-size: 1.3rem; color: var(--b-ink); font-weight: 600; }
.drop input { position: absolute; opacity: 0; width: 1px; height: 1px; }

/* ---------- preview ---------- */
.preview { display: none; }
@media (min-width: 1024px) {
  .preview { display: grid; position: sticky; top: 1rem; justify-items: center; gap: .6rem; padding-top: 3.2rem; }
}
.preview__label { font-family: var(--f-sans); font-size: .75rem; font-weight: 600; letter-spacing: .18em; text-transform: uppercase; color: var(--b-ink-soft); display: flex; gap: 1rem; align-items: baseline; }
.phone {
  width: 390px; height: min(780px, calc(100vh - 7rem)); max-width: 100%;
  border-radius: 34px; padding: 12px; background: #2B2723;
  box-shadow: 0 2px 2px rgba(0,0,0,.2), 0 30px 50px -24px rgba(var(--shadow-rgb), .6);
}
.phone iframe { width: 100%; height: 100%; border: 0; border-radius: 24px; background: var(--b-page); display: block; }
.preview-missing { padding: 2rem 1.5rem; text-align: center; color: var(--b-ink-soft); font-style: italic; }

/* mobile: preview as a full-screen sheet behind a tab */
.mobilebar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: flex; gap: 0; padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
  background: var(--b-paper); box-shadow: 0 -1px 0 var(--b-line), 0 -8px 20px -12px rgba(var(--shadow-rgb), .4);
}
.mobilebar button {
  flex: 1; min-height: 48px; border: 0; background: none; cursor: pointer;
  font-family: var(--f-sans); font-size: .8125rem; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--b-ink-soft);
}
.mobilebar button[aria-pressed="true"] { color: var(--b-wax); box-shadow: inset 0 -2px 0 var(--b-wax); }
@media (min-width: 1024px) { .mobilebar { display: none; } }
body.show-preview .preview {
  display: grid; position: fixed; inset: 0 0 64px 0; z-index: 15; padding: 12px; background: var(--b-page);
  justify-items: center; align-content: start;
}
body.show-preview .preview .phone { width: 100%; height: calc(100vh - 64px - 3.5rem); border-radius: 0; padding: 0; background: none; box-shadow: none; }
body.show-preview .preview .phone iframe { border-radius: 0; box-shadow: var(--shadow-paper); }

/* ---------- seal & send ---------- */
.checklist { list-style: none; display: grid; gap: .25rem; }
.checklist li { display: flex; gap: .7rem; align-items: baseline; padding: .45rem 0; border-bottom: 1px dotted var(--b-line); }
.checklist .mark { flex: none; width: 1.2rem; font-family: var(--f-display); font-weight: 600; color: var(--b-ok); }
.checklist .is-bad .mark { color: var(--b-error); }
.checklist a { font-size: .95rem; }
.sealbtn {
  justify-self: center; display: grid; justify-items: center; gap: .6rem;
  background: none; border: 0; cursor: pointer; padding: .5rem; min-height: 44px;
}
.sealbtn__wax {
  width: 132px; height: 132px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--seal-art, none) center / contain no-repeat, var(--b-wax);
  filter: drop-shadow(0 3px 2px rgba(var(--shadow-rgb), .35)) drop-shadow(0 10px 12px rgba(var(--shadow-rgb), .25));
  transition: scale .15s var(--ease), rotate .3s var(--ease);
  rotate: -8deg;
}
.sealbtn.has-art .sealbtn__wax { background-color: transparent; }
.sealbtn__text { font-family: var(--f-sans); font-size: .875rem; font-weight: 700; letter-spacing: .2em; text-transform: uppercase; color: var(--b-wax); }
.sealbtn:hover .sealbtn__wax { scale: 1.04; rotate: -4deg; }
.sealbtn:active .sealbtn__wax { scale: .94; }
.sealbtn[aria-busy="true"] .sealbtn__wax { animation: press .9s var(--ease) infinite alternate; }
.sealbtn[disabled] { cursor: not-allowed; opacity: .6; }
@keyframes press { from { scale: 1; } to { scale: .9; rotate: 4deg; } }

.done { display: grid; gap: 1.4rem; text-align: left; }
.done__title { font-family: var(--f-script); font-weight: 400; font-size: clamp(3rem, 13vw, 4.2rem); line-height: 1; color: var(--b-wax); }
.linkbox { display: grid; gap: .35rem; }
.linkbox__row { display: flex; gap: .5rem; align-items: stretch; flex-wrap: wrap; }
.linkbox__url {
  flex: 1 1 14rem; min-height: 48px; padding: .6rem .7rem; background: var(--b-paper-2); border: 1px solid var(--b-line);
  font-family: var(--f-serif); font-size: 1rem; overflow-wrap: anywhere; user-select: all;
}

/* ---------- dashboard ---------- */
.dash { max-width: 980px; margin: 0 auto; padding: 0 16px 4rem; display: grid; gap: 2rem; }
.site-picker { display: flex; flex-wrap: wrap; gap: .6rem; }
.site-picker__item { display: flex; align-items: center; gap: .6rem; min-height: 64px; max-width: 100%; padding: .4rem .8rem; background: transparent; border: 1px solid var(--b-line); border-radius: 2px; text-align: left; cursor: pointer; }
.site-picker__item[aria-current="true"] { background: var(--b-paper); border-color: var(--b-wax); box-shadow: inset 0 -2px var(--b-wax); }
.site-picker__copy { display: grid; min-width: 0; }
.site-picker__title { font-family: var(--f-display); font-size: clamp(1.125rem, 2vw, 1.35rem); font-weight: 600; overflow-wrap: anywhere; }
.site-picker__slug { font-size: .8125rem; color: var(--b-ink-soft); overflow-wrap: anywhere; }
@media (hover: hover) { .site-picker__item:hover { background: var(--b-paper-2); border-color: var(--b-ink-soft); } }
.site-picker__item:active { background: var(--b-paper-2); }
.sitecard { display: grid; gap: 1rem; }
.sitecard__head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: .8rem 1.5rem; }
.sitecard__identity { display: flex; align-items: center; gap: .8rem; min-width: 0; }
.sitecard__identity > div { min-width: 0; }
.sitecard__identity .theme-icon { width: 4rem; height: 4rem; align-self: center; }
.sitecard__theme { margin-top: .25rem; font-family: var(--f-serif); font-size: clamp(.875rem, 2vw, 1rem); font-style: italic; color: var(--b-ink-soft); }
.sitecard__title { font-family: var(--f-display); font-size: clamp(1.8rem, 6vw, 2.4rem); font-weight: 600; line-height: 1.05; overflow-wrap: anywhere; }
.status {
  display: inline-block; padding: .25rem .6rem; rotate: -2deg;
  font-family: var(--f-sans); font-size: .75rem; font-weight: 700; letter-spacing: .16em; text-transform: uppercase;
  border: 1.5px solid currentColor;
}
.status--published { color: var(--b-ok); }
.status--draft { color: var(--b-ink-soft); border-style: dashed; }
.status--unpublished, .status--expired { color: var(--b-error); }
.actions { display: flex; flex-wrap: wrap; gap: .6rem; }
.tally { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem; list-style: none; }
@media (min-width: 600px) { .tally { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.tally li {
  position: relative; padding: .9rem .8rem .8rem 1.2rem; background: var(--b-paper);
  box-shadow: var(--shadow-low); rotate: var(--r, 0deg);
}
.tally li::before { /* perforated stub edge */
  content: ''; position: absolute; left: 0; top: 6px; bottom: 6px; width: 6px;
  background-image: radial-gradient(circle at 0 50%, var(--b-page) 3px, transparent 3.5px);
  background-size: 6px 11px;
}
.tally__n { display: block; font-family: var(--f-display); font-weight: 600; font-size: 2.4rem; line-height: 1; font-variant-numeric: lining-nums tabular-nums; }
.tally__l { font-family: var(--f-sans); font-size: .75rem; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: var(--b-ink-soft); }
.replies { width: 100%; border-collapse: collapse; font-size: 1rem; }
.replies th { text-align: left; font-family: var(--f-sans); font-size: .75rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--b-ink-soft); padding: .5rem .5rem; border-bottom: 1.5px solid var(--b-ink-soft); }
.replies td { padding: .65rem .5rem; border-bottom: 1px dotted var(--b-line); vertical-align: top; }
.replies td.msg { font-style: italic; color: var(--b-ink-soft); max-width: 22rem; }
.att { font-family: var(--f-sans); font-size: .75rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.att--yes { color: var(--b-ok); } .att--no { color: var(--b-error); } .att--maybe { color: var(--b-ink-soft); }
.tablewrap { overflow-x: auto; }
@media (max-width: 699px) {
  .replies thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .replies tr { display: grid; grid-template-columns: 1fr auto; gap: .15rem .8rem; padding: .8rem 0; border-bottom: 1px dotted var(--b-line); }
  .replies td { border: 0; padding: 0; }
  .replies td[data-k]::before { content: attr(data-k) ' · '; font-family: var(--f-sans); font-size: .6875rem; letter-spacing: .12em; text-transform: uppercase; color: var(--b-ink-soft); }
  .replies td.name { font-weight: 600; }
  .replies td.msg, .replies td.extra { grid-column: 1 / -1; }
}
.empty { padding: 2rem 1rem; text-align: center; font-style: italic; color: var(--b-ink-soft); }
.empty__script { display: block; font-family: var(--f-script); font-style: normal; font-size: 2.2rem; color: var(--b-ink); margin-bottom: .3rem; }

.toast {
  position: fixed; left: 50%; bottom: calc(80px + env(safe-area-inset-bottom)); z-index: 40; translate: -50% 0;
  max-width: calc(100vw - 32px); padding: .75rem 1.1rem; background: var(--b-ink); color: var(--b-paper);
  font-family: var(--f-sans); font-size: .875rem; letter-spacing: .04em; box-shadow: var(--shadow-paper); rotate: -.5deg;
}
@media (min-width: 1024px) { .toast { bottom: 2rem; } }
.mockflag {
  position: fixed; top: 8px; left: 50%; translate: -50% 0; z-index: 50; padding: .2rem .6rem; rotate: -1deg;
  font-family: var(--f-sans); font-size: .6875rem; font-weight: 700; letter-spacing: .16em; text-transform: uppercase;
  color: var(--b-wax); border: 1.5px dashed var(--b-wax); background: var(--b-paper);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ---------- footer ---------- */
.foot {
  max-width: 1320px; margin: 0 auto; padding: 1.5rem 16px calc(6rem + env(safe-area-inset-bottom));
  display: flex; flex-wrap: wrap; gap: .4rem 1.4rem; align-items: baseline;
  font-family: var(--f-sans); font-size: .75rem; letter-spacing: .14em; text-transform: uppercase; color: var(--b-ink-soft);
}
.foot a { color: var(--b-ink-soft); padding: .6rem 0; }
@media (min-width: 1024px) { .foot { padding-bottom: 2rem; padding-left: 32px; } }
.dash ~ .foot, .sheet--narrow ~ .foot { justify-content: center; padding-bottom: 2rem; }

@media (max-width: 599px) {
  .mockflag { top: auto; bottom: calc(72px + env(safe-area-inset-bottom)); left: 12px; translate: none; }
  .dash ~ .mockflag, .qrpage .mockflag { bottom: 12px; }
}
