/* ============================================================
   The order tool. Loaded after tokens.css.

   This is a workspace, not a document: it fills the viewport, the
   rail and the editor scroll independently, and the dock stays put
   so the price and the two actions are always in view.
   ============================================================ */

body {
  background: var(--paper-2);
  font-size: 15px;
  line-height: 1.55;
}

.app { height: 100vh; display: flex; flex-direction: column; }
.shell {
  width: 100%;
  max-width: 1380px;
  margin-inline: auto;
  padding-inline: 22px;
  box-sizing: border-box;
}

/* ============================================================
   TOP BAR
   ============================================================ */
.apptop {
  flex: none;
  background: var(--card);
  border-bottom: 1px solid var(--line);
}
.apptop-inner { display: flex; align-items: center; gap: 20px; height: 60px; }

.crumb {
  margin-left: 4px;
  padding-left: 18px;
  border-left: 1px solid var(--line);
  font-size: 14px;
  color: var(--ink-faint);
}
.apptop-help {
  margin-left: auto;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-soft);
  text-decoration: none;
}
.apptop-help:hover { color: var(--accent); }

/* ============================================================
   WORKSPACE
   ============================================================ */
.workspace { flex: 1; min-height: 0; }
.workspace-grid {
  height: 100%;
  display: grid;
  grid-template-columns: minmax(320px, 390px) 1fr;
  gap: 18px;
  padding: 18px 0;
  box-sizing: border-box;
}

.rail { min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; padding-right: 4px; }

.panel {
  /* Keep natural height. Without this, flex-shrink squashes each panel
     below its content and the rows spill out past the panel's own
     border — the rail is what should scroll, not the panels that
     should compress. */
  flex: 0 0 auto;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
}
.panel-title {
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--ink-faint);
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.panel-title .count {
  margin-left: auto;
  letter-spacing: 0;
  text-transform: none;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* --- the uploaded file --- */
.filechip {
  display: flex; align-items: center; gap: 11px;
  background: color-mix(in oklab, var(--accent-2) 9%, transparent);
  border: 1px solid color-mix(in oklab, var(--accent-2) 32%, var(--line));
  border-radius: 9px;
  padding: 11px 12px;
}
.filechip svg { flex: none; }
.filechip svg [stroke] { stroke: var(--accent); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; fill: none; }
/* min-width:0 lets the text shrink below its own width, which a flex item
   otherwise refuses to do; without it a long filename pushes the remove
   button off the card. The name must be a block for the ellipsis to apply
   at all — text-overflow does nothing to an inline element. */
.filechip-text { min-width: 0; flex: 1; }
.filechip-name {
  display: block; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.filechip-size { display: block; font-size: 12.5px; color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.filechip-x {
  margin-left: auto; flex: none;
  width: 26px; height: 26px; border-radius: 6px;
  border: 1px solid var(--line); background: var(--card);
  color: var(--ink-faint);
  display: grid; place-items: center; cursor: pointer;
  transition: color .15s ease, border-color .15s ease;
}
.filechip-x:hover { color: var(--danger); border-color: var(--danger); }

.redrop {
  border: 1.5px dashed color-mix(in oklab, var(--accent-2) 42%, var(--line));
  border-radius: 9px;
  background: color-mix(in oklab, var(--accent-2) 5%, transparent);
  padding: 22px 14px; text-align: center; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.redrop b { font-size: 14.5px; }
.redrop span { font-size: 12.5px; color: var(--ink-faint); }

/* --- book metadata --- */
.fields { display: grid; gap: 10px; margin-top: 14px; }
.field { display: grid; gap: 4px; }
.field label { font-size: 12px; font-weight: 600; color: var(--ink-faint); }
.field input {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 8px 10px;
}
.field input:focus { border-color: var(--accent-2); outline: none; }

/* ============================================================
   PICKERS — voice and narration style share this component
   ============================================================ */
.voice-group {
  font-size: 12px; font-weight: 700; color: var(--ink-soft);
  margin: 4px 0 8px;
  display: flex; align-items: center; gap: 8px;
}
.voice-group:not(:first-of-type) { margin-top: 14px; }
.voice-group .hint { font-weight: 500; color: var(--ink-faint); }

/* Radios, not buttons, so they can hold their own play and discard
   controls without nesting interactive elements. */
.vopt {
  display: flex; align-items: center; gap: 11px;
  width: 100%; box-sizing: border-box; text-align: left;
  background: var(--paper); border: 1px solid var(--line);
  border-radius: 9px; padding: 11px 12px; margin-bottom: 7px;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}
.vopt:hover { border-color: color-mix(in oklab, var(--accent-2) 45%, var(--line)); }
.vopt.is-on { border-color: var(--accent-2); background: color-mix(in oklab, var(--accent-2) 8%, var(--paper)); }

.radio {
  flex: none; width: 16px; height: 16px; border-radius: 999px;
  border: 1.5px solid var(--ink-faint);
  display: grid; place-items: center;
}
.vopt.is-on .radio { border-color: var(--accent-2); }
.vopt.is-on .radio::after { content: ""; width: 8px; height: 8px; border-radius: 999px; background: var(--accent-2); }

.vopt-body { min-width: 0; display: grid; gap: 1px; }
.vopt-name { font-weight: 600; font-size: 14.5px; }
.vopt-desc { font-size: 12.5px; color: var(--ink-faint); }

.play {
  margin-left: auto; flex: none;
  width: 30px; height: 30px; border-radius: 999px; border: 0;
  background: var(--accent-2); color: #06201F;
  padding: 0; display: grid; place-items: center; cursor: pointer;
}
.play svg { fill: currentColor; display: block; }

/* discard the clip and go back to the two actions */
.vopt-x {
  flex: none; width: 24px; height: 24px; border-radius: 6px;
  border: 1px solid var(--line); background: var(--card);
  color: var(--ink-faint);
  display: grid; place-items: center; cursor: pointer;
  transition: color .15s ease, border-color .15s ease;
}
.vopt-x:hover { color: var(--danger); border-color: var(--danger); }

/* --- the two ways to supply your own voice: actions, not choices --- */
.voice-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.vbtn {
  display: flex; align-items: center; justify-content: center; gap: 7px;
  background: var(--paper); border: 1px solid var(--line);
  border-radius: 9px; padding: 12px 10px; cursor: pointer;
  font-size: 13.5px; font-weight: 650; letter-spacing: -.005em;
  transition: border-color .15s ease, background .15s ease, color .15s ease;
}
.vbtn svg [stroke] { stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; fill: none; }
.vbtn:hover { border-color: var(--accent-2); color: var(--accent); background: color-mix(in oklab, var(--accent-2) 7%, var(--paper)); }
.voice-note { font-size: 12px; color: var(--ink-faint); margin-top: 7px; }

/* ============================================================
   CHAPTERS
   ============================================================ */
.chaplist { display: flex; flex-direction: column; gap: 2px; }

.chap {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 8px; border-radius: 8px; cursor: pointer;
  border: 1px solid transparent;
  transition: background .12s ease;
}
.chap:hover { background: var(--paper); }
.chap.is-open {
  background: color-mix(in oklab, var(--accent-2) 10%, var(--paper));
  border-color: color-mix(in oklab, var(--accent-2) 38%, transparent);
}
.chap.is-off .chap-name, .chap.is-off .chap-words { opacity: .42; text-decoration: line-through; }

.chap-box {
  flex: none; width: 17px; height: 17px; border-radius: 5px;
  border: 1.5px solid var(--ink-faint); background: var(--card);
  display: grid; place-items: center; cursor: pointer;
}
.chap:not(.is-off) .chap-box { border-color: var(--accent-2); background: var(--accent-2); }
.chap-box svg { display: none; }
.chap:not(.is-off) .chap-box svg {
  display: block; stroke: #06201F; stroke-width: 2.6;
  stroke-linecap: round; stroke-linejoin: round; fill: none;
}

.chap-name {
  flex: 1; min-width: 0;
  background: transparent; border: 1px solid transparent; border-radius: 6px;
  padding: 3px 6px; font-size: 14px;
  text-overflow: ellipsis;
}
.chap-name:hover { border-color: var(--line); }
.chap-name:focus { border-color: var(--accent-2); background: var(--card); outline: none; }

.chap-words { flex: none; font-size: 12px; color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.chap-del {
  flex: none; width: 22px; height: 22px; border-radius: 5px;
  border: 0; background: transparent; color: var(--ink-faint);
  display: grid; place-items: center; cursor: pointer; opacity: 0;
  transition: opacity .12s ease, color .12s ease;
}
.chap:hover .chap-del { opacity: 1; }
.chap-del:hover { color: var(--danger); background: var(--paper-3); }

.addchap {
  margin-top: 10px; width: 100%;
  border: 1px dashed var(--line); background: transparent;
  border-radius: 8px; padding: 9px; cursor: pointer;
  font-size: 13.5px; font-weight: 600; color: var(--ink-soft);
  transition: border-color .15s ease, color .15s ease;
}
.addchap:hover { border-color: var(--accent-2); color: var(--accent); }

/* ============================================================
   EDITOR
   ============================================================ */
.editor {
  min-height: 0;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  display: flex; flex-direction: column;
  overflow: hidden;
}
.editor-head {
  flex: none; padding: 16px 20px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 14px;
}
.editor-title {
  flex: 1; min-width: 0;
  font-family: var(--serif); font-size: 22px; font-weight: 600; letter-spacing: -.015em;
  background: transparent; border: 1px solid transparent; border-radius: 8px;
  padding: 4px 8px; margin-left: -8px;
}
.editor-title:hover { border-color: var(--line); }
.editor-title:focus { border-color: var(--accent-2); background: var(--paper); outline: none; }
.editor-meta { flex: none; font-size: 12.5px; color: var(--ink-faint); font-variant-numeric: tabular-nums; text-align: right; }

.editor-body { flex: 1; min-height: 0; display: flex; }
.editor-body textarea {
  flex: 1; width: 100%; resize: none; border: 0; outline: none;
  background: transparent; padding: 22px 24px;
  font-family: var(--serif); font-size: 17px; line-height: 1.72;
  box-sizing: border-box;
  overflow-y: auto;
  scrollbar-gutter: stable;  /* no reflow when the bar appears */
}

.editor-foot {
  flex: none; padding: 10px 20px; border-top: 1px solid var(--line);
  font-size: 12.5px; color: var(--ink-faint);
  display: flex; align-items: center; gap: 16px;
}

/* the open chapter is switched off */
.editor.is-off .editor-body { opacity: .45; }

/* Quiet scrollbars in the three regions that scroll. The default
   chrome is heavy enough to break the calm of the panels. */
.rail, .editor-body textarea, .rec-passage {
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}
.rail::-webkit-scrollbar,
.editor-body textarea::-webkit-scrollbar,
.rec-passage::-webkit-scrollbar { width: 11px; }
.rail::-webkit-scrollbar-thumb,
.editor-body textarea::-webkit-scrollbar-thumb,
.rec-passage::-webkit-scrollbar-thumb {
  background: var(--line); border-radius: 999px;
  border: 3px solid transparent; background-clip: content-box;
}
.rail::-webkit-scrollbar-thumb:hover,
.editor-body textarea::-webkit-scrollbar-thumb:hover,
.rec-passage::-webkit-scrollbar-thumb:hover { background: var(--ink-faint); background-clip: content-box; }
.rail::-webkit-scrollbar-track,
.editor-body textarea::-webkit-scrollbar-track,
.rec-passage::-webkit-scrollbar-track { background: transparent; }

/* ============================================================
   DOCK — word count mapped onto the price brackets
   ============================================================ */
.dock {
  flex: none;
  background: var(--card);
  border-top: 1px solid var(--line);
}
.dock-inner {
  display: flex; align-items: center; gap: 34px;
  padding: 14px 0 16px;
}

.meter { flex: 1; min-width: 0; max-width: 620px; }
.meter-head {
  display: flex; align-items: baseline; gap: 10px;
  font-size: 13px; color: var(--ink-faint); margin-bottom: 7px;
}
.meter-head b { font-size: 17px; color: var(--ink); font-weight: 650; font-variant-numeric: tabular-nums; }
.meter-head .tier { margin-left: auto; color: var(--accent); font-weight: 650; font-size: 13.5px; }

.meter-track {
  position: relative; height: 8px; border-radius: 999px;
  background: var(--paper-3); overflow: hidden;
}
.meter-fill {
  position: absolute; inset: 0 auto 0 0;
  background: var(--accent-2); border-radius: 999px;
  transition: width .3s cubic-bezier(.2, .7, .3, 1);
}
/* bracket boundaries at 50k and 100k of the 150k track */
.meter-tick { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--card); }

.meter-scale {
  display: grid; grid-template-columns: repeat(3, 1fr);
  margin-top: 6px; font-size: 11.5px; color: var(--ink-faint);
}
.meter-seg { display: flex; align-items: baseline; gap: 5px; }
.meter-seg + .meter-seg { justify-content: center; }
.meter-seg:last-child { justify-content: flex-end; }
.meter-seg i { font-style: normal; font-variant-numeric: tabular-nums; }
.meter-seg.is-on { color: var(--ink); font-weight: 650; }

.dock-actions { flex: none; display: flex; align-items: center; gap: 10px; margin-left: auto; }

/* ============================================================
   DIALOGS
   ============================================================ */
dialog {
  border: 1px solid var(--line); border-radius: 14px;
  background: var(--card); color: var(--ink);
  padding: 26px; max-width: 430px; width: calc(100% - 40px);
  box-shadow: 0 24px 60px rgba(0, 0, 0, .22);
}
dialog::backdrop { background: rgba(15, 42, 32, .48); }
dialog h3 { font-size: 21px; letter-spacing: -.015em; margin-bottom: 8px; }
dialog p { font-size: 14.5px; color: var(--ink-soft); margin-bottom: 8px; }
.dlg-actions { display: flex; gap: 9px; justify-content: flex-end; margin-top: 20px; flex-wrap: wrap; }

/* --- recording --- */
.rec-dialog { max-width: 520px; }
.rec-lede { font-size: 14px; color: var(--ink-soft); margin-bottom: 16px; }

.rec-passage {
  background: var(--paper); border: 1px solid var(--line);
  border-left: 3px solid var(--accent-2);
  border-radius: 4px 10px 10px 4px;
  padding: 18px 20px;
  max-height: 240px; overflow-y: auto;
  display: grid; gap: 12px;
}
.rec-passage p {
  font-family: var(--serif); font-size: 16.5px; line-height: 1.62;
  color: var(--ink); margin: 0;
}

.rec-controls {
  display: flex; align-items: center; gap: 15px;
  margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line);
}
.rec-dot {
  flex: none; width: 46px; height: 46px; border-radius: 999px;
  border: 0; background: var(--danger); cursor: pointer;
  display: grid; place-items: center;
  transition: background .18s ease;
}
.rec-dot::after {
  content: ""; width: 15px; height: 15px; border-radius: 999px;
  background: #FFF;
  transition: border-radius .18s ease, width .18s ease, height .18s ease;
}
/* recording: the dot squares off into a stop control and pulses */
.rec-dialog.is-live .rec-dot::after { border-radius: 3px; width: 13px; height: 13px; }
.rec-dialog.is-live .rec-dot { animation: pulse 1.5s ease-in-out infinite; }
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in oklab, var(--danger) 45%, transparent); }
  50% { box-shadow: 0 0 0 9px color-mix(in oklab, var(--danger) 0%, transparent); }
}
.rec-dialog.is-done .rec-dot { background: var(--ink-faint); }

.rec-status { display: grid; gap: 1px; }
.rec-status b { font-size: 19px; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.rec-status span { font-size: 12.5px; color: var(--ink-faint); }

.rec-level { margin-left: auto; display: flex; align-items: center; gap: 3px; height: 30px; }
.rec-level i {
  width: 3px; height: 4px; border-radius: 2px; display: block;
  background: color-mix(in oklab, var(--accent-2) 55%, var(--line));
  transition: height .12s ease;
}
.rec-dialog.is-live .rec-level i { animation: bob .9s ease-in-out infinite; background: var(--accent-2); }
.rec-level i:nth-child(2n) { animation-delay: .12s; }
.rec-level i:nth-child(3n) { animation-delay: .26s; }
.rec-level i:nth-child(5n) { animation-delay: .4s; }
@keyframes bob { 0%, 100% { height: 5px; } 50% { height: 24px; } }

/* Once a real microphone is driving the bars, the canned animation has to get
   out of the way — otherwise the two fight and the meter reads as decoration.
   The transition also drops, because the JS updates every frame already. */
.rec-level.is-real i { animation: none !important; transition: none; }
.rec-dialog.is-live .rec-level.is-real i { background: var(--accent-2); }

/* ============================================================
   UPLOAD DIALOG — the way into the tool. Three states share one
   dialog: choose a file, read it, or explain a file we can't open.
   ============================================================ */
.up-dialog { max-width: 540px; padding: 30px; max-height: min(86vh, 760px); overflow-y: auto; }
.up-head { text-align: center; margin-bottom: 22px; }
.up-head h2 { font-size: 25px; letter-spacing: -.02em; margin-bottom: 8px; }
.up-lede { color: var(--ink-soft); font-size: 14.5px; line-height: 1.6; max-width: 42ch; margin-inline: auto; }

.drop {
  border: 1.5px dashed color-mix(in oklab, var(--accent-2) 42%, var(--line));
  border-radius: 13px;
  background: color-mix(in oklab, var(--accent-2) 5%, transparent);
  padding: 38px 24px;
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  cursor: pointer; text-align: center;
  transition: border-color .16s ease, background .16s ease;
}
.drop:hover { border-color: var(--accent-2); background: color-mix(in oklab, var(--accent-2) 9%, transparent); }
.drop.is-over { border-color: var(--accent-2); background: color-mix(in oklab, var(--accent-2) 16%, transparent); }
.drop-icon svg [stroke] { stroke: var(--accent); stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; fill: none; }
.drop-title { font-family: var(--serif); font-size: 19px; font-weight: 600; letter-spacing: -.015em; margin-top: 3px; }
.drop-or { font-size: 13px; color: var(--ink-faint); }
.drop-formats { font-size: 12.5px; color: var(--ink-faint); margin-top: 5px; }

/* `accept` is a hint the file picker may ignore, and drag-and-drop ignores
   it outright — so a rejection still has to land somewhere. Inline, next to
   the target they'll use again, rather than a screen of its own. */
.drop-error {
  display: flex; align-items: flex-start; gap: 8px;
  margin-top: 12px; padding: 10px 12px; border-radius: 9px;
  background: color-mix(in oklab, var(--danger) 9%, transparent);
  border: 1px solid color-mix(in oklab, var(--danger) 30%, var(--line));
  font-size: 13px; line-height: 1.45; color: var(--ink-soft); text-align: left;
}
.drop-error svg { flex: none; margin-top: 2px; }
.drop-error svg [stroke] { stroke: var(--danger); stroke-width: 1.7; stroke-linecap: round; fill: none; }
.drop-error b { color: var(--ink); font-weight: 650; word-break: break-all; }

.up-foot {
  margin-top: 18px; font-size: 12.5px; color: var(--ink-faint);
  display: flex; align-items: center; justify-content: center; gap: 7px; text-align: center;
}
.up-foot svg [stroke] { stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; fill: none; }
.up-alt { margin-top: 9px; text-align: center; font-size: 13px; color: var(--ink-faint); }
.link {
  background: none; border: 0; padding: 0; cursor: pointer;
  font-size: 13px; font-weight: 650; color: var(--accent);
  text-decoration: underline; text-underline-offset: 3px;
}
.link:hover { color: var(--accent-2); }

.reading {
  border: 1.5px solid var(--line); border-radius: 13px; padding: 38px 24px;
  display: flex; flex-direction: column; align-items: center; gap: 11px;
}
.spinner {
  width: 32px; height: 32px; border-radius: 999px;
  border: 3px solid color-mix(in oklab, var(--accent-2) 25%, transparent);
  border-top-color: var(--accent-2);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.reading b { font-family: var(--serif); font-size: 18px; font-weight: 600; }
.reading span { font-size: 13px; color: var(--ink-faint); font-variant-numeric: tabular-nums; }

.fail {
  border: 1px solid color-mix(in oklab, var(--danger) 34%, var(--line));
  border-radius: 13px;
  background: color-mix(in oklab, var(--danger) 5%, transparent);
  padding: 20px;
}
.fail-head { display: flex; align-items: flex-start; gap: 12px; }
.fail-icon { flex: none; margin-top: 1px; }
.fail-icon svg [stroke] { stroke: var(--danger); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; fill: none; }
.fail h3 { font-size: 17px; letter-spacing: -.012em; margin-bottom: 5px; }
.fail-why { font-size: 13.5px; color: var(--ink-soft); line-height: 1.55; margin: 0; }
.fail-file {
  display: inline-block; margin-top: 9px; font-size: 12px; color: var(--ink-faint);
  background: var(--paper-3); border-radius: 6px; padding: 3px 8px; word-break: break-all;
}
.fix { margin-top: 18px; padding-top: 16px; border-top: 1px solid color-mix(in oklab, var(--danger) 20%, var(--line)); }
.fix-title { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; font-weight: 700; color: var(--ink-faint); margin-bottom: 10px; }
.fix ol { margin: 0; padding-left: 19px; display: grid; gap: 8px; }
.fix li { font-size: 13.5px; line-height: 1.5; color: var(--ink-soft); }
.fix li b { color: var(--ink); font-weight: 650; }

.up-actions { display: flex; gap: 9px; justify-content: center; margin-top: 20px; flex-wrap: wrap; }

/* A book with no chapter breaks loads as one chapter, which is correct but
   looks broken. Saying so is the difference between the two. */
.notice {
  display: flex; gap: 9px; align-items: flex-start;
  margin-bottom: 12px; padding: 10px 12px; border-radius: 9px;
  background: color-mix(in oklab, var(--accent-2) 8%, transparent);
  border: 1px solid color-mix(in oklab, var(--accent-2) 26%, var(--line));
  font-size: 12.5px; line-height: 1.45; color: var(--ink-soft);
}
.notice svg { flex: none; margin-top: 2px; }
.notice svg [stroke] { stroke: var(--accent); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; fill: none; }
.notice b { color: var(--ink); font-weight: 650; }

/* ============================================================
   RESPONSIVE — two independently-scrolling columns only make sense
   with room for them; below that the page scrolls normally.
   ============================================================ */
@media (max-width: 940px) {
  .app { height: auto; }
  .workspace-grid { grid-template-columns: 1fr; height: auto; }
  .rail { overflow: visible; }
  .editor { overflow: visible; }
  .editor-body textarea { min-height: 420px; }
  .dock { position: sticky; bottom: 0; z-index: 20; }
  .dock-inner { flex-wrap: wrap; gap: 14px; }
  .meter { max-width: none; flex-basis: 100%; }
  .dock-actions { width: 100%; }
  .dock-actions .btn { flex: 1; }
  .crumb { display: none; }
}

@media (max-width: 600px) {
  .up-dialog { padding: 22px 18px; }
  .drop { padding: 28px 16px; }
  .up-actions .btn { flex: 1; }
}

/* ============================================================
   SUBMIT DIALOG — the last step before an order exists. Four
   states share one dialog: confirm, working, sent, failed.
   Reuses .field, .spinner and .fail from above, so the failure
   here looks like every other failure on the page.
   ============================================================ */
.sub-dialog { max-width: 460px; padding: 28px; max-height: min(88vh, 780px); overflow-y: auto; }

.sub-head { margin-bottom: 20px; }
.sub-head h2 { font-size: 23px; letter-spacing: -.02em; margin-bottom: 6px; }
.sub-lede { color: var(--ink-soft); font-size: 14px; line-height: 1.55; }

/* What you are confirming. Identical on both paths — the same book, the same
   voice, the same style — because only the last row differs by a price. */
.summary {
  background: var(--paper); border: 1px solid var(--line);
  border-radius: 11px; padding: 14px 16px;
  display: grid; gap: 8px; margin-bottom: 18px;
}
.sum-row { display: flex; align-items: baseline; gap: 12px; font-size: 13.5px; }
.sum-row dt { flex: none; color: var(--ink-faint); width: 82px; }
.sum-row dd { margin: 0; flex: 1; min-width: 0; font-weight: 600; }
.sum-row dd small { font-weight: 400; color: var(--ink-faint); }
.sum-total {
  border-top: 1px solid var(--line); margin-top: 3px; padding-top: 11px;
  display: flex; align-items: baseline;
}
.sum-total span { color: var(--ink-faint); font-size: 13.5px; }
.sum-total b {
  margin-left: auto; font-family: var(--serif);
  font-size: 24px; letter-spacing: -.02em; font-variant-numeric: tabular-nums;
}
/* A free sample has no price, so the slot carries a word instead of a number
   and drops the serif display size that a price earns. */
.sum-total b.is-free { font-family: var(--sans); font-size: 15px; font-weight: 650; color: var(--accent); }

.field-note { font-size: 12.5px; color: var(--ink-faint); }
.sub-problem { color: var(--danger); font-weight: 600; margin-top: 6px; }

#turnstile:not(:empty) { margin-top: 14px; }

.terms {
  font-size: 12.5px; line-height: 1.5; color: var(--ink-faint);
  margin-top: 14px; text-align: center;
}
.terms a { color: var(--accent); font-weight: 600; text-underline-offset: 2px; }

.sub-actions { margin-top: 18px; display: grid; gap: 9px; }

.working { text-align: center; padding: 12px 0 4px; }
.working .spinner { margin: 0 auto 20px; }
.working h2 { font-size: 21px; letter-spacing: -.018em; margin-bottom: 8px; }
.working p { color: var(--ink-soft); font-size: 14px; line-height: 1.6; max-width: 34ch; margin: 0 auto; }

.done { text-align: center; padding: 6px 0 0; }
.done-mark {
  width: 56px; height: 56px; border-radius: 999px; margin: 0 auto 18px;
  background: color-mix(in oklab, var(--accent-2) 16%, transparent);
  display: grid; place-items: center;
}
.done-mark svg [stroke] { stroke: var(--accent); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; fill: none; }
.done h2 { font-size: 23px; letter-spacing: -.02em; margin-bottom: 8px; }
.done > p { color: var(--ink-soft); font-size: 14px; line-height: 1.6; max-width: 36ch; margin: 0 auto; }
.done-mail { font-weight: 650; color: var(--ink); }
.done-when {
  margin-top: 18px; padding: 12px 14px;
  background: var(--paper); border: 1px solid var(--line);
  border-radius: 10px; font-size: 13px; color: var(--ink-soft);
}
.done-ref { margin-top: 14px; font-size: 12.5px; color: var(--ink-faint); }
.done-ref code {
  background: var(--paper-3); border-radius: 5px; padding: 2px 7px;
  font-size: 12.5px; letter-spacing: .04em;
}

@media (max-width: 560px) {
  .sub-dialog { padding: 22px 18px; }
  .sum-row dt { width: 70px; }
}
