/* Styles for the hosted pages (interview, plot choice, admin). Builds on styles.css. */
body.app { padding-bottom: 3rem; }
.narrow { max-width: 46rem; margin: 0 auto; padding: 0 1.25rem; }
.narrow section { padding: 0; max-width: none; }
.h { font-size: clamp(1.7rem, 6vw, 2.3rem); margin: 1rem 0 0.75rem; }
.narrow h2 { font-size: 1.3rem; margin: 2rem 0 0.6rem; }
.narrow p { margin: 0 0 0.9rem; }
.muted { color: var(--ink-soft); }
.pre { white-space: pre-wrap; }
.notice, .error { padding: 0.7rem 0.9rem; border-radius: 3px; border: 1px solid var(--rule); background: #fdfaf3; }
.error { border-color: var(--accent); color: var(--accent); }
code { font-size: 0.85em; word-break: break-all; }

.form { display: grid; gap: 1.1rem; margin-top: 1.25rem; justify-items: start; }
.form label { display: grid; gap: 0.3rem; width: 100%; font-weight: 600; }
.form small { font-weight: 400; color: var(--ink-soft); }
input, select, textarea {
  font: inherit; color: inherit; width: 100%; padding: 0.65rem 0.75rem;
  border: 1px solid var(--rule); border-radius: 3px; background: #fdfaf3;
}
button { font: inherit; cursor: pointer; }
button.button { border: 0; }
button:disabled { opacity: 0.5; cursor: default; }

.chat { display: grid; gap: 0.75rem; margin: 1.5rem 0; }
.msg { padding: 0.75rem 1rem; border-radius: 3px; max-width: 88%; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.them { background: var(--paper-deep); justify-self: start; }
.msg.you { background: var(--cover); color: var(--cover-ink); justify-self: end; }
.msg.pending { color: var(--ink-soft); }
.composer { display: grid; gap: 0.6rem; justify-items: end; }
.finish { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; margin-top: 2rem; padding-top: 1.25rem; border-top: 1px solid var(--rule); }
.finish[hidden] { display: none; }

.plot { border-top: 1px solid var(--rule); padding: 1.5rem 0 !important; }
.plot h2 { margin-top: 0; }

.table { width: 100%; border-collapse: collapse; font-family: var(--sans); font-size: 0.9rem; margin-bottom: 1.25rem; }
.table th, .table td { text-align: left; padding: 0.55rem 0.5rem; border-top: 1px solid var(--rule); vertical-align: top; }
.inline { display: inline-flex; gap: 0.5rem; align-items: center; margin-right: 0.5rem; }
.inline input:not([type=checkbox]) { width: auto; padding: 0.2rem 0.4rem; }
.inline input[type=checkbox] { width: auto; }
.inline label { display: inline-flex; gap: 0.3rem; align-items: center; }
.log { background: #1f1a17; color: #f0e9dc; padding: 1rem; border-radius: 3px; font-size: 0.8rem; overflow-x: auto; white-space: pre-wrap; overflow-wrap: anywhere; }
.editor { font-family: ui-monospace, Menlo, monospace; font-size: 0.85rem; line-height: 1.5; }
.pages a { font-family: var(--sans); font-size: 0.85rem; }

/* ---- Order process ------------------------------------------------------ */
.steps-row { list-style: none; display: flex; gap: 0; padding: 0; margin: 1.5rem 0 0; overflow-x: auto; font-family: var(--sans); }
.step { flex: 1 0 4.6rem; display: grid; justify-items: center; gap: 0.2rem; text-align: center; position: relative; padding-top: 0.1rem; }
.step::before { content: ""; position: absolute; top: 0.95rem; left: -50%; width: 100%; height: 2px; background: var(--rule); }
.step:first-child::before { display: none; }
.step-done::before, .step-current::before { background: var(--cover); }
.dot { position: relative; z-index: 1; width: 1.8rem; height: 1.8rem; border-radius: 50%; display: grid; place-items: center;
  font-size: 0.8rem; font-weight: 600; background: var(--paper); border: 2px solid var(--rule); color: var(--ink-soft); }
.step-done .dot { background: var(--cover); border-color: var(--cover); color: var(--cover-ink); }
.step-current .dot { border-color: var(--accent); color: var(--accent); box-shadow: 0 0 0 4px rgba(140, 47, 27, 0.14); }
.step-label { font-size: 0.78rem; font-weight: 600; line-height: 1.2; }
.step-todo .step-label { color: var(--ink-soft); font-weight: 400; }
.step-owner { font-size: 0.68rem; color: var(--ink-soft); }
.step.owner-editor .step-owner { color: var(--accent); font-weight: 600; }
.step.owner-customer .step-owner { font-style: italic; }
.next { border: 1px solid var(--rule); border-left: 4px solid var(--accent); background: #fdfaf3; border-radius: 3px; padding: 1.1rem 1.25rem; margin: 1.5rem 0; }
.next h2 { margin: 0 0 0.4rem; }
.next .button { margin-top: 0.3rem; }
.manual { margin: 1.5rem 0; font-family: var(--sans); font-size: 0.9rem; }
.manual summary { cursor: pointer; color: var(--ink-soft); }
.pill { font-family: var(--sans); font-size: 0.8rem; font-weight: 600; padding: 0.3rem 0.7rem; border-radius: 99px; }
.pill-done { background: var(--cover); color: var(--cover-ink); }

/* ---- Marks: the editor's visual language. Change meanings here. ---------- */
.mk { border-radius: 2px; padding: 0 0.15em; }
.mk-real { background: #d9ebe4; color: #173f35; }                      /* real person from the interview */
.mk-new  { background: #fbe3a6; color: #5a3d00; }                      /* name the model invented */
.mk-ban  { background: #8c2f1b; color: #fff8ee; font-weight: 600; }    /* never-mention watch word */

/* ---- Plan workspace ------------------------------------------------------ */
.wide { max-width: 90rem; margin: 0 auto; padding: 0 1.25rem; }
body.app .top { max-width: 90rem; }
.ws { display: grid; gap: 2rem; }
.ws-side summary { font-family: var(--sans); font-size: 0.72rem; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-soft); margin: 0 0 0.5rem; cursor: pointer; padding: 0; }
.ws-side summary::after { content: none; }
.ws-side details { padding: 0 0 0.9rem; margin: 0 0 0.9rem; border-top: 0; border-bottom: 1px solid var(--rule); }
.ws-side details p { color: inherit; padding: 0; }
.ws-side { font-size: 0.92rem; line-height: 1.5; }
.ws-side p { margin: 0 0 0.6rem; }
.ws-side ul { margin: 0; padding-left: 1.1rem; }
.ws-side li { margin-bottom: 0.45rem; }
.ban-list li::marker { color: var(--accent); }
.ban-list { color: var(--accent); }
.cast { list-style: none; padding: 0 !important; }
.names { line-height: 2; }
.ws-main { padding: 0 !important; max-width: none !important; min-width: 0; }
.ws-bar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 1rem; position: sticky; top: 0;
  background: var(--paper); z-index: 2; padding: 0.6rem 0; border-bottom: 1px solid var(--rule); }
.ws-bar .h { margin: 0; font-size: 1.5rem; }
.ws-bar p { margin: 0; font-family: var(--sans); font-size: 0.8rem; }
.ws-actions { display: flex; align-items: center; gap: 1rem; font-family: var(--sans); font-size: 0.85rem; }
.legend { display: flex; flex-wrap: wrap; gap: 0.4rem 1.25rem; font-family: var(--sans); font-size: 0.8rem; color: var(--ink-soft); margin: 1rem 0; }
.presence { display: grid; gap: 3px; align-items: center; font-family: var(--sans); font-size: 0.75rem; margin: 1rem 0 2rem; }
.presence-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-right: 0.5rem; }
.presence-ch { text-align: center; }
.presence-cell { height: 0.9rem; background: var(--cover); border-radius: 2px; }
.presence-cell.empty { background: transparent; border: 1px solid var(--rule); }
.chapter { padding: 0 0 2rem !important; }
.chapter-head { display: flex; align-items: baseline; gap: 0.75rem; border-bottom: 2px solid var(--ink); padding-bottom: 0.35rem; }
.chapter-no { font-family: var(--sans); font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase; white-space: nowrap; }
.chapter-title { flex: 1; border: 0; background: transparent; font-size: 1.25rem; font-style: italic; padding: 0.1rem 0; min-width: 0; }
.chapter-title:focus { outline: 0; box-shadow: 0 2px 0 var(--accent); }
.chapter-head .muted { font-family: var(--sans); font-size: 0.8rem; white-space: nowrap; }
.chapter-summary { font-size: 0.9rem; color: var(--ink-soft); margin: 0.6rem 0 0.4rem !important; padding-left: 0.9rem; border-left: 3px solid var(--rule); }
.plan-page { display: grid; grid-template-columns: 2.4rem 1fr auto; gap: 0.5rem; align-items: start; padding: 0.55rem 0; border-bottom: 1px solid var(--rule); }
.page-no { font-family: var(--sans); font-size: 0.8rem; color: var(--ink-soft); text-align: right; padding-top: 0.2rem; }
.page-text { cursor: text; line-height: 1.55; max-width: 46rem; border-radius: 3px; padding: 0.1rem 0.3rem; }
.page-text:hover, .page-text:focus { background: #fdfaf3; outline: 0; }
.page-edit { line-height: 1.55; padding: 0.3rem 0.4rem; }
.page-tools { display: flex; gap: 2px; opacity: 0.25; }
.plan-page:hover .page-tools, .plan-page:focus-within .page-tools { opacity: 1; }
.tool { border: 1px solid var(--rule); background: var(--paper); border-radius: 3px; width: 1.7rem; height: 1.7rem; font-size: 0.8rem; color: var(--ink-soft); }
.tool:hover { border-color: var(--ink); color: var(--ink); }
@media (min-width: 62rem) {
  .ws { grid-template-columns: 21rem 1fr; }
  .ws-side { position: sticky; top: 0; align-self: start; max-height: 100vh; overflow-y: auto; padding-right: 0.75rem; }
}

/* ---- Team, queue, deadlines ---------------------------------------------- */
.mid { max-width: 68rem; margin: 0 auto; padding: 0 1.25rem; }
.top-nav { display: flex; align-items: center; gap: 1.25rem; font-family: var(--sans); font-size: 0.875rem; font-weight: 600; }
.top-nav a { text-decoration: none; border-bottom: 2px solid var(--accent); }
.top-nav form { margin: 0; }
button.link { border: 0; background: none; padding: 0; color: var(--ink-soft); font-size: 0.875rem; text-decoration: underline; }
.count { font-family: var(--sans); font-size: 0.8rem; font-weight: 600; color: var(--ink-soft); background: var(--paper-deep); border-radius: 99px; padding: 0.1rem 0.55rem; vertical-align: middle; }
.queue td { vertical-align: middle; }
.queue .flag { width: 3.2rem; }
.queue tr { border-left: 4px solid transparent; }
.bar { display: inline-block; width: 5rem; height: 0.4rem; background: var(--paper-deep); border-radius: 99px; overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--cover); }
/* Deadline language: red = overdue, amber = due within two days. */
.queue tr.due-overdue { border-left-color: var(--accent); }
.queue tr.due-overdue .due { color: var(--accent); font-weight: 600; }
.queue tr.due-soon { border-left-color: #c98a00; }
.queue tr.due-soon .due { color: #8a5d00; font-weight: 600; }
.pill-rush { background: var(--accent); color: var(--accent-ink); }
.pill-warn { background: #fbe3a6; color: #5a3d00; }
.assign { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.75rem 1.5rem; align-items: center; font-family: var(--sans); font-size: 0.9rem;
  border: 1px solid var(--rule); border-left: 4px solid var(--rule); border-radius: 3px; padding: 0.7rem 1rem; margin: 1rem 0; }
.assign.due-overdue { border-left-color: var(--accent); }
.assign.due-soon { border-left-color: #c98a00; }
.assign select, .assign input[type=date] { width: auto; padding: 0.25rem 0.4rem; }
.activity { list-style: none; padding: 0; margin: 0 0 1rem; font-family: ui-monospace, Menlo, monospace; font-size: 0.78rem; color: var(--ink-soft); }
.activity li { padding: 0.15rem 0; }
.mid h2 { font-size: 1.3rem; margin: 2.2rem 0 0.6rem; }
.mid p { margin: 0 0 0.9rem; }
.queue { table-layout: fixed; }
.queue th:nth-child(1) { width: 4.2rem; }
.queue th:nth-child(2) { width: 4.5rem; }
.queue th:nth-child(5) { width: 7rem; }
.queue th:nth-child(7) { width: 9rem; }
/* On a phone seven columns do not fit: each order becomes a small card. */
@media (max-width: 44rem) {
  .queue, .queue tbody { display: block; }
  .queue tr.head { display: none; }
  .queue tr { display: grid; grid-template-columns: auto 1fr auto; gap: 0.35rem 0.75rem; align-items: center;
    padding: 0.8rem 0.6rem; border-top: 1px solid var(--rule); }
  .queue td { display: block; padding: 0; border: 0; min-width: 0; }
  .queue .c-id { grid-area: 1 / 1; font-weight: 600; font-size: 1rem; }
  .queue .c-for { grid-area: 1 / 2; }
  .queue .flag { grid-area: 1 / 3; width: auto; text-align: right; }
  .queue .c-step { grid-area: 2 / 1 / auto / 3; }
  .queue .c-bar { grid-area: 2 / 3; text-align: right; }
  .queue .c-who { grid-area: 3 / 1 / auto / 3; }
  .queue .due { grid-area: 3 / 3; text-align: right; }
  .queue .due br { display: none; }
  .queue .due small::before { content: " · "; }
  .queue .due .muted::before { content: "deadline "; }
  .queue tr.none { display: block; }
}

/* ---- Sign-in providers ---------------------------------------------------- */
.signin { max-width: 26rem; }
.signin-card {
  margin: clamp(1.5rem, 8vh, 5rem) 0 0; padding: 2rem 1.75rem 2.25rem;
  background: #fdfaf3; border: 1px solid var(--rule); border-top: 3px solid var(--accent); border-radius: 4px;
  box-shadow: 0 1px 2px rgba(31, 26, 23, 0.04), 0 12px 32px -18px rgba(31, 26, 23, 0.35);
}
.signin-card .h { margin: 0; text-align: center; }
.signin-card .signin-lede { margin: 0.35rem 0 0; text-align: center; color: var(--ink-soft); font-size: 0.95rem; overflow-wrap: anywhere; }
.signin-card .error { margin: 1.25rem 0 0; background: #fff; font-family: var(--sans); font-size: 0.9rem; }
.signin-card input { background: #fff; }
.signin-card .form { margin-top: 1.25rem; gap: 0.9rem; }
.signin-card .form label { font-family: var(--sans); font-size: 0.85rem; }
.signin-card .form .button { width: 100%; text-align: center; margin-top: 0.3rem; }
.providers { display: grid; gap: 0.6rem; margin: 1.5rem 0 0; }
.provider {
  display: flex; align-items: center; justify-content: center; gap: 0.6rem;
  background: #fff; color: var(--ink); box-shadow: inset 0 0 0 1px var(--rule); border-radius: 4px;
}
.provider svg { flex: none; }
.provider:hover, .provider:focus-visible { background: #fff; color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.provider-apple { background: #000; color: #fff; box-shadow: none; }
.provider-apple:hover, .provider-apple:focus-visible { background: #2a2623; color: #fff; box-shadow: none; }
.or { display: flex; align-items: center; gap: 0.75rem; margin: 1.5rem 0 0 !important; font-family: var(--sans); font-size: 0.8rem; color: var(--ink-soft); }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--rule); }

/* ---- Consent and risk flags ---------------------------------------------- */
.consent { border: 1px solid var(--rule); border-radius: 3px; padding: 0.9rem 1.1rem; width: 100%; margin: 0; }
.consent legend { font-weight: 600; padding: 0 0.4rem; }
.consent ul { margin: 0.3rem 0 0.8rem; padding-left: 1.2rem; color: var(--ink-soft); }
.consent li { margin-bottom: 0.35rem; }
.form label.check { display: flex; gap: 0.6rem; align-items: flex-start; font-weight: 600; }
.check input { width: auto; margin-top: 0.35rem; }
.risk { border: 2px solid var(--accent); border-radius: 3px; background: #fdf3ef; padding: 0.9rem 1.1rem; margin: 1rem 0; }
.risk ul { margin: 0.6rem 0; padding-left: 0; list-style: none; }
.risk li { margin-bottom: 0.45rem; }
.legal h2 { font-size: 1.15rem; }
.legal ul { padding-left: 1.2rem; margin: 0 0 0.9rem; }
.legal li { margin-bottom: 0.4rem; }

/* ---- Story bible form ----------------------------------------------------- */
.transcript { white-space: pre-wrap; font-size: 0.9rem; line-height: 1.55; }
.bible-section { padding: 0 0 1.75rem !important; max-width: 52rem !important; }
.bible-section h2 { font-family: var(--serif); font-size: 1.25rem; letter-spacing: 0; text-transform: none; color: var(--ink);
  margin: 0 0 0.25rem; padding-bottom: 0.3rem; border-bottom: 2px solid var(--ink); }
.bible-section h3 { font-family: var(--sans); font-size: 0.8rem; margin: 1.1rem 0 0.2rem; }
.bible-section .hint { font-family: var(--sans); font-size: 0.82rem; margin: 0.3rem 0 0.7rem !important; }
.bible .row { display: flex; gap: 0.5rem; align-items: flex-start; margin-bottom: 0.4rem; }
.bible .row > textarea, .bible .row > input, .bible .cells { flex: 1; min-width: 0; }
.bible textarea, .bible input { padding: 0.4rem 0.55rem; line-height: 1.45; resize: none; overflow: hidden; }
.bible .cells { display: grid; gap: 0.4rem; }
.bible .cells-2 { grid-template-columns: 1fr 2fr; }
.bible .cells-3 { grid-template-columns: 1fr 1fr 2fr; }
.bible .record { padding-bottom: 0.4rem; border-bottom: 1px solid var(--rule); }
.bible .tool { width: auto; min-width: 1.7rem; padding: 0 0.5rem; height: 2.1rem; font-family: var(--sans); }
.bible .add { border: 0; background: none; color: var(--accent); font-family: var(--sans); font-size: 0.85rem; font-weight: 600; padding: 0.3rem 0; }
.flag-text { flex: 1; padding: 0.35rem 0; }
.bible-ban h2 { color: var(--accent); border-color: var(--accent); }
.bible-ban .row > textarea { border-color: #d9a79b; }
.bible-risk { border: 2px solid var(--accent); border-radius: 3px; background: #fdf3ef; padding: 0.9rem 1.1rem 0.5rem !important; margin-bottom: 1.75rem !important; }
.bible-risk h2 { border: 0; color: var(--accent); }
.bible-questions { border: 1px solid #e3c66d; border-radius: 3px; background: #fdf8e6; padding: 0.9rem 1.1rem 0.5rem !important; margin-bottom: 1.75rem !important; }
.bible-questions h2 { border: 0; }
.tools { font-family: var(--sans); font-size: 0.9rem; }
@media (max-width: 40rem) { .bible .cells-2, .bible .cells-3 { grid-template-columns: 1fr; } }
.bible-section { margin-left: 0 !important; margin-right: 0 !important; }

/* ---- Questions in the story bible ----------------------------------------- */
.question { background: #fffdf5; border: 1px solid #e3c66d; border-left-width: 4px; border-radius: 3px; padding: 0.7rem 0.9rem; margin-bottom: 0.6rem; }
.question-head { display: flex; gap: 0.75rem; align-items: flex-start; justify-content: space-between; margin-bottom: 0.5rem; }
.question-text { flex: 1; }
.question textarea { width: 100%; }
.question-actions { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.5rem; }
.question .hint { margin: 0.3rem 0 0 !important; }
.q-answered { border-color: #9cc3b6; background: #f4faf7; }
.q-ignored { border-color: var(--rule); background: transparent; }
.q-ignored .question-text { color: var(--ink-soft); }
.q-asked { border-color: #9db7d6; background: #f3f7fc; }
.pill-open { background: #fbe3a6; color: #5a3d00; }
.pill-asked { background: #d5e3f3; color: #1f3c5e; }
.pill-answered { background: #d9ebe4; color: #173f35; }
.pill-ignored { background: var(--paper-deep); color: var(--ink-soft); }
.ask-link { font-family: var(--sans); font-size: 0.85rem; }
.question-actions.bulk { align-items: center; margin: 0 0 0.8rem; font-family: var(--sans); font-size: 0.82rem; }
.question-actions.bulk .muted:not(:first-child) { margin-left: 0.8rem; }

/* ---- Audit log ------------------------------------------------------------ */
.filters { flex-wrap: wrap; gap: 0.6rem 1rem; margin: 0.5rem 0 1.25rem; font-family: var(--sans); font-size: 0.875rem; }
.filters select { width: auto; padding: 0.25rem 0.4rem; }
.audit td { vertical-align: top; }
.audit .when { white-space: nowrap; color: var(--ink-soft); font-size: 0.8rem; }
.kind { font-size: 0.72rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-soft); }
.audit tr.kind-view td { color: var(--ink-soft); }
.audit tr.kind-sign-in .kind, .audit tr.kind-team .kind { color: var(--accent); }

/* Steps are links to their result once it exists. */
.step-link { display: grid; justify-items: center; gap: 0.2rem; text-decoration: none; position: relative; z-index: 1; }
.step-link .step-label { text-decoration: underline; text-decoration-color: var(--rule); text-underline-offset: 3px; }
.step-link:hover .step-label, .step-link:focus-visible .step-label { text-decoration-color: var(--accent); color: var(--accent); }
.step-link:hover .dot, .step-link:focus-visible .dot { box-shadow: 0 0 0 4px rgba(140, 47, 27, 0.18); }

/* ---- Plots as the editor reads them --------------------------------------- */
.plot-card { border: 1px solid var(--rule); border-left: 4px solid var(--rule); border-radius: 3px; background: #fdfaf3; padding: 1.1rem 1.25rem !important; margin: 0 0 1rem !important; }
.plot-card.is-chosen { border-left-color: var(--cover); }
.plot-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.plot-card h2 { margin: 0 0 0.4rem; }

/* ---- The opening chapters, as the customer reads them ---------------------- */
.kicker { font-family: var(--sans); font-size: 0.75rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-soft); margin: 0 0 0.3rem; }
.reading { margin: 2rem 0 2.5rem; font-size: 1.08rem; line-height: 1.7; }
.reading h2 { margin: 2.5rem 0 1.2rem; text-align: center; font-size: 1.5rem; }
.reading .chapter-no { display: block; font-family: var(--sans); font-size: 0.75rem; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-soft); margin-bottom: 0.4rem; }
.reading p { margin: 0; text-indent: 1.5em; hyphens: auto; }
.reading h2 + p, .reading .scene-break + p { text-indent: 0; }
.reading .scene-break, .reading .to-be-continued { text-indent: 0; text-align: center; margin: 1.4rem 0; }
.reading .to-be-continued { margin-top: 2.5rem; font-style: italic; color: var(--ink-soft); }

/* The step whose stage is running right now: an arc circles its dot. */
.step-running .dot { box-shadow: none; }
.step-running:not(.step-done) .dot { border-color: rgba(140, 47, 27, 0.25); color: var(--accent); }
.step-running .dot::after { content: ""; position: absolute; inset: -5px; border-radius: 50%; border: 2px solid transparent;
  border-top-color: var(--accent); border-right-color: var(--accent); animation: step-spin 1.1s linear infinite; }
.step-running:not(.step-done) .dot::after { inset: -2px; }
.step-running .step-label { color: var(--accent); font-weight: 600; }
@keyframes step-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .step-running .dot::after { animation: none; } }

/* ---- The manuscript, as the editor reads it -------------------------------- */
.ms-layout { display: grid; gap: 1rem; }
.ms-text { min-width: 0; max-width: 44rem; }
.ms-contents { font-family: var(--sans); font-size: 0.85rem; }
.ms-contents details { padding: 0; border: 0; }
.ms-contents summary { position: relative; font-size: 0.72rem; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-soft); cursor: pointer; padding: 0.4rem 0; }
.ms-text section, .ms-layout section { padding: 0; margin: 0; max-width: none; }
.ms-contents ol { list-style: none; margin: 0.3rem 0 0; padding: 0; }
.ms-contents li { display: grid; grid-template-columns: 1.6rem 1fr; padding: 0.35rem 0.5rem 0.35rem 0.6rem; border-left: 3px solid transparent; line-height: 1.3; }
.ms-contents li a { display: contents; color: inherit; text-decoration: none; }
.ms-contents li a:hover .toc-title, .ms-contents li a:focus-visible .toc-title { color: var(--accent); text-decoration: underline; }
.toc-no { color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.toc-title { font-weight: 600; }
.toc-pages { grid-column: 2; font-size: 0.72rem; color: var(--ink-soft); }
.ms-contents li.is-unwritten .toc-title { font-weight: 400; color: var(--ink-soft); }
.ms-contents li.is-current { border-left-color: var(--accent); background: #fdfaf3; }
.ms-contents li.is-current .toc-title { color: var(--accent); }
.ms-chapter { scroll-margin-top: 1rem; }
.ms-page { position: relative; }
.ms-no { display: block; margin: 0.6rem 0 0.1rem; font-family: var(--sans); font-size: 0.72rem; color: var(--ink-soft); text-decoration: none; }
.ms-no:hover, .ms-no:focus-visible { color: var(--accent); text-decoration: underline; }
.ms-page:target { background: #fbf3dc; box-shadow: 0 0 0 0.4rem #fbf3dc; }
@media (max-width: 61.99rem) {
  .ms-contents { position: sticky; top: 0; z-index: 5; background: var(--paper); border-bottom: 1px solid var(--rule); margin: 0 -1.25rem; padding: 0 1.25rem; }
  .ms-contents ol { max-height: 60vh; overflow-y: auto; padding-bottom: 0.6rem; }
}
@media (min-width: 62rem) {
  .ms-layout { grid-template-columns: 17rem minmax(0, 44rem); gap: 4.5rem; justify-content: center; }
  .ms-contents { position: sticky; top: 1rem; align-self: start; max-height: calc(100vh - 2rem); overflow-y: auto; }
  .ms-contents summary { pointer-events: none; }
  .ms-contents details summary::after, .ms-contents details[open] summary::after { content: none; display: none; }
  .ms-no { position: absolute; left: -3rem; top: 0.25rem; width: 2.4rem; text-align: right; margin: 0; }
}

/* ---- The check report: decide, fix, apply ---------------------------------- */
.check-bar { margin-bottom: 1rem; }
.check-steps { display: grid; gap: 0.6rem; margin: 0 0 1.5rem; padding: 0.9rem 1rem; border: 1px solid var(--rule); border-left: 4px solid var(--accent); border-radius: 3px; background: #fdfaf3; font-family: var(--sans); font-size: 0.88rem; }
.check-steps > div { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; }
.check-steps .button { margin: 0; padding: 0.45rem 0.9rem; font-size: 0.88rem; }
.check-steps .button:disabled { opacity: 0.45; cursor: default; }
.check-n { display: inline-grid; place-items: center; width: 1.5rem; height: 1.5rem; border-radius: 50%; border: 2px solid var(--accent); color: var(--accent); font-weight: 600; font-size: 0.78rem; flex: none; }
.issue { border: 1px solid var(--rule); border-left: 4px solid var(--rule); border-radius: 3px; background: #fdfaf3; padding: 0.8rem 1rem; margin-bottom: 0.7rem; }
.issue.sev-high { border-left-color: var(--accent); }
.issue.sev-medium { border-left-color: #d9a520; }
.issue-dismiss, .issue-fixed { background: transparent; }
.issue-dismiss .issue-quote, .issue-dismiss .issue-problem, .issue-dismiss .issue-fix { color: var(--ink-soft); }
.issue-head { display: flex; justify-content: space-between; align-items: center; gap: 0.75rem; flex-wrap: wrap; margin-bottom: 0.5rem; }
.issue-where { display: flex; align-items: center; gap: 0.6rem; font-family: var(--sans); font-size: 0.85rem; }
.page-ref { font-family: var(--sans); font-weight: 600; }
.issue-kind { color: var(--ink-soft); font-size: 0.8rem; }
.sev-pill { background: var(--paper-deep); color: var(--ink-soft); padding: 0.15rem 0.55rem; font-size: 0.72rem; }
.sev-high .sev-pill { background: var(--accent); color: var(--accent-ink); }
.sev-medium .sev-pill { background: #fbe3a6; color: #5a3d00; }
.pill-accept { background: #d5e3f3; color: #1f3c5e; }
.pill-dismiss { background: var(--paper-deep); color: var(--ink-soft); }
.pill-fixed { background: #d9ebe4; color: #173f35; }
.issue-quote { margin: 0 0 0.5rem; padding: 0 0 0 0.8rem; border-left: 2px solid var(--rule); font-style: italic; }
.narrow .issue p { margin: 0 0 0.5rem; }
.issue-problem, .issue-fix { font-size: 0.95rem; line-height: 1.5; }
.issue-note { width: 100%; font-size: 0.9rem; }
#bulk .tool, .issue .tool { width: auto; white-space: nowrap; min-width: 1.7rem; padding: 0 0.6rem; height: 2rem; font-family: var(--sans); }
.issue-by { align-self: center; margin-left: 0.4rem; font-family: var(--sans); font-size: 0.75rem; }
.changes { margin: 0.6rem 0 0.2rem; border-top: 1px solid var(--rule); }
.change { display: grid; grid-template-columns: 1.2rem 1fr; gap: 0.6rem; padding: 0.55rem 0; border-bottom: 1px solid var(--rule); font-weight: 400; cursor: pointer; }
.change input { margin-top: 0.3rem; }
.change-top { display: flex; gap: 0.6rem; align-items: baseline; font-family: var(--sans); font-size: 0.8rem; }
.change-state { color: var(--ink-soft); }
.change-not_found .change-state, .change-ambiguous .change-state { color: var(--accent); font-weight: 600; }
.change-text { font-size: 0.95rem; line-height: 1.55; }
.change-text span { color: var(--ink-soft); }
.change-text del { background: #f6d9d2; color: #7a2414; text-decoration: line-through; padding: 0 0.15rem; border-radius: 2px; }
.change-text ins { background: #d9ebe4; color: #173f35; text-decoration: none; padding: 0 0.15rem; border-radius: 2px; }
.change-applied { cursor: default; }
.change-applied .change-text del { background: transparent; color: var(--ink-soft); }

/* Piles of issues: one is shown at a time, each named for what it needs next. */
.views { display: flex; flex-wrap: wrap; gap: 0.35rem; margin: 0 0 0.9rem; position: sticky; top: 0; z-index: 4; background: var(--paper); padding: 0.5rem 0; border-bottom: 1px solid var(--rule); }
.view { font-family: var(--sans); font-size: 0.82rem; padding: 0.3rem 0.7rem; border: 1px solid var(--rule); border-radius: 99px; background: var(--paper); color: var(--ink); cursor: pointer; white-space: nowrap; }
.view:hover { border-color: var(--ink); }
.view.is-current { background: var(--cover); border-color: var(--cover); color: var(--cover-ink); font-weight: 600; }
.view.is-empty:not(.is-current) { color: var(--ink-soft); border-style: dashed; }
.check-bar { position: static; }

/* ---- The cover -------------------------------------------------------------- */
.cover-preview { display: block; width: 100%; height: auto; border: 1px solid var(--rule); box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12); }
.cover-note { font-family: var(--sans); font-size: 0.82rem; margin-top: 0.5rem !important; }
.cover-art { display: grid; grid-template-columns: 9rem 1fr; gap: 1rem; align-items: start; margin-bottom: 0.8rem; }
.cover-art img { width: 100%; height: auto; border: 1px solid var(--rule); }
.cover-upload { font-family: var(--sans); font-size: 0.88rem; margin-bottom: 0.4rem; }
.brief { display: grid; grid-template-columns: 1fr auto; gap: 0.8rem; align-items: start; padding: 0.7rem 0; border-top: 1px solid var(--rule); }
.narrow .brief p { margin: 0; font-family: Georgia, serif; font-size: 0.95rem; line-height: 1.5; }
.cover-form input[type="color"] { width: 4rem; height: 2.2rem; padding: 0.1rem; }
.cover-form h2 { margin-bottom: 0; }
.lulu { border: 1px solid var(--rule); border-radius: 3px; padding: 0.7rem 0.9rem; display: flex; flex-wrap: wrap; gap: 0.6rem 1.2rem; width: 100%; font-family: var(--sans); font-size: 0.88rem; }
.lulu legend { padding: 0 0.4rem; color: var(--ink-soft); }
.lulu label { display: flex; width: auto; align-items: center; gap: 0.4rem; font-weight: 400; }
.lulu input { width: 6rem; }
@media (max-width: 34rem) { .cover-art { grid-template-columns: 1fr; } .cover-art img { max-width: 12rem; } }

/* Photos the customer sends for the cover. */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(7.5rem, 1fr)); gap: 0.8rem; margin: 0.6rem 0 1rem; }
.photo-grid figure { margin: 0; display: grid; gap: 0.3rem; justify-items: start; font-family: var(--sans); font-size: 0.8rem; }
.photo-grid img { width: 100%; aspect-ratio: 1; object-fit: cover; border: 1px solid var(--rule); border-radius: 3px; }

/* ---- Costs of an order ------------------------------------------------------ */
.costs .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.costs th { text-align: left; font-weight: 600; color: var(--ink-soft); font-size: 0.78rem; }
.costs tr.sub td { color: var(--ink-soft); }
.costs tr.total td { font-weight: 600; border-top: 2px solid var(--ink); }
.costs-add { font-family: var(--sans); font-size: 0.88rem; margin-bottom: 0.4rem; }

/* Cover pictures to choose from. */
.cover-options { display: grid; grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr)); gap: 1.2rem; width: 100%; margin: 0.6rem 0 1rem; }
.cover-option { margin: 0; display: grid; gap: 0.4rem; justify-items: start; font-family: var(--sans); font-size: 0.88rem; font-weight: 600; cursor: pointer; }
.cover-option img { width: 100%; height: auto; border: 1px solid var(--rule); box-shadow: 0 2px 10px rgba(0, 0, 0, 0.18); }
figure.cover-option { cursor: default; }
.cover-option:has(input:checked) img { outline: 3px solid var(--accent); outline-offset: 3px; }

.option-note { font-family: var(--sans); font-size: 0.78rem; font-weight: 400; line-height: 1.4; color: var(--ink-soft); margin: 0 !important; }
.verdict-strong { background: #d9ebe4; color: #173f35; }
.verdict-usable { background: #fbe3a6; color: #5a3d00; }
.verdict-reject { background: var(--accent); color: var(--accent-ink); }

.remake { display: grid; gap: 0.3rem; width: 100%; }
.remake textarea { width: 100%; font-size: 0.8rem; font-weight: 400; }

.print-check { margin: 14px 0 6px; padding-left: 0; list-style: none; }
.print-check li { margin: 4px 0; }
.print-check ul { margin: 4px 0 0 22px; list-style: disc; color: var(--ink-soft); }

/* ---- The customer's link: QR code, copy, optional email ------------------- */
.keep { display: flex; gap: 1.1rem; align-items: flex-start; border: 1px solid var(--rule); border-radius: 4px; background: #fffdf8; padding: 1rem 1.1rem; margin: 1.25rem 0; }
.keep-qr { flex: none; width: 8.25rem; height: 8.25rem; border-radius: 3px; }
.keep-body { flex: 1; min-width: 0; font-family: var(--sans); font-size: 0.9rem; }
.keep-body p { margin: 0 0 0.7rem; }
.keep-link { display: flex; gap: 0.5rem; }
.keep-link input { flex: 1; min-width: 0; font: inherit; color: inherit; padding: 0.5rem 0.6rem; border: 1px solid var(--rule); border-radius: 3px; background: #fff; }
.keep-link .button { white-space: nowrap; padding: 0.5rem 0.9rem; font-size: 0.875rem; }
.keep-hint { margin: 0.5rem 0 0 !important; font-size: 0.8125rem; }
.keep-hint kbd { font: inherit; border: 1px solid var(--rule); border-radius: 3px; padding: 0 0.3rem; background: #fff; }
.keep-mail { margin-top: 0.9rem; }
.keep-mail label { display: block; font-weight: 600; margin-bottom: 0.35rem; }
.keep-mail label small { display: block; font-weight: 400; color: var(--ink-soft); }
.keep-mail .error { margin-top: 0.5rem; }
.keep-fold { margin: 1.5rem 0; }
.keep-fold summary { cursor: pointer; font-family: var(--sans); font-size: 0.9rem; color: var(--ink-soft); }
@media (max-width: 34rem) {
  .keep { flex-direction: column; align-items: center; }
  .keep-body { width: 100%; }
}
.keep [hidden] { display: none; }
