/* ZenSet workspace. Colors, type and spacing follow the approved workspace mockup. */

@font-face { font-family: 'Instrument Sans'; src: url('fonts/instrument-sans-latin-400-normal.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Instrument Sans'; src: url('fonts/instrument-sans-latin-500-normal.woff2') format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Instrument Sans'; src: url('fonts/instrument-sans-latin-600-normal.woff2') format('woff2'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'IBM Plex Mono'; src: url('fonts/ibm-plex-mono-latin-400-normal.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'IBM Plex Mono'; src: url('fonts/ibm-plex-mono-latin-500-normal.woff2') format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Newsreader'; src: url('fonts/newsreader-latin-400-normal.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Newsreader'; src: url('fonts/newsreader-latin-500-normal.woff2') format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Newsreader'; src: url('fonts/newsreader-latin-600-normal.woff2') format('woff2'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Newsreader'; src: url('fonts/newsreader-latin-500-italic.woff2') format('woff2'); font-weight: 500; font-style: italic; font-display: swap; }
@font-face { font-family: 'Newsreader'; src: url('fonts/newsreader-latin-600-italic.woff2') format('woff2'); font-weight: 600; font-style: italic; font-display: swap; }

:root {
  --ink: #1B1D1A;
  --muted: #575B54;
  --faint: #8E9288;
  --line: #D9DAD3;
  --line-soft: #E6E7E0;
  --ground: #F3F3EF;
  --stage: #ECEDE7;
  --panel: #FBFBF8;
  --accent: #3D5A45;
  --good: #2F6B3F;
  --warn: #8A4F0F;
  --warn-ground: #FBF1E3;
  --warn-line: #E8CFA6;
  --bad: #8C2B1D;
  --bad-ground: #FBE9E6;
  --bad-line: #E9B9B0;
  --sans: 'Instrument Sans', system-ui, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;
  --serif: Newsreader, Georgia, serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
h1, h2, h3, p { margin: 0; }

.app { display: flex; flex-direction: column; height: 100vh; }

/* ---------- Top bar ---------- */
.topbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 20px;
  min-height: 64px;
  padding: 8px 20px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 8px; font-family: var(--serif); font-size: 22px; font-weight: 600; }
.logo-mark { flex: none; }
.logo-mark .book-1 { fill: #3D5A45; }
.logo-mark .book-2 { fill: #58785F; }
.logo-mark .book-3 { fill: #8FAE97; }
.logo-name em { font-style: italic; color: var(--accent); }
.book-title { display: flex; flex-direction: column; min-width: 0; padding-left: 20px; border-left: 1px solid var(--line); }
.book-title .name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.book-title .meta { font-family: var(--mono); font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.pill, .export {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}
.pill { border: 1px solid var(--line); background: #fff; }
.pill.passed { border-color: #BCD3C1; background: #EDF4EE; color: var(--good); }
.pill.warning { border-color: var(--warn-line); background: var(--warn-ground); color: var(--warn); }
.pill.error { border-color: var(--bad-line); background: var(--bad-ground); color: var(--bad); }
.export { border: 0; background: var(--accent); color: #fff; padding: 0 18px; }
.export:disabled { background: #B5B8AE; }

/* ---------- Welcome (no manuscript yet) ---------- */
.welcome { flex: 1 1 auto; display: grid; place-items: center; padding: 32px 20px; overflow: auto; }
.welcome-card {
  width: min(560px, 100%);
  padding: 36px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  text-align: center;
}
.welcome-card h1 { font-family: var(--serif); font-size: 28px; font-weight: 500; line-height: 1.2; margin-bottom: 12px; }
.welcome-card p { color: var(--muted); }
.welcome-card .fine { margin-top: 14px; font-size: 13px; }
.upload, .replace {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
  overflow: hidden;
}
.upload { margin-top: 22px; padding: 0 22px; background: var(--accent); color: #fff; }
.replace { width: 100%; margin-top: 12px; border: 1px solid var(--ink); background: #fff; font-size: 14px; }
.upload.busy, .replace.busy { opacity: 0.6; cursor: progress; }
.upload input[type=file], .replace input[type=file] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.upload:focus-within, .replace:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.problem {
  margin-top: 14px;
  padding: 10px 12px;
  border: 1px solid var(--bad-line);
  border-radius: 10px;
  background: var(--bad-ground);
  color: var(--bad) !important;
  font-size: 14px;
  text-align: left;
}

/* ---------- Three columns ---------- */
.columns { flex: 1 1 auto; display: grid; grid-template-columns: 250px minmax(0, 1fr) 310px; min-height: 0; }
.left, .right { background: var(--panel); overflow-y: auto; }
.left { padding: 20px 14px 28px; border-right: 1px solid var(--line); }
.right { border-left: 1px solid var(--line); }
.center { display: flex; flex-direction: column; min-width: 0; overflow-y: auto; }

.label { margin: 0 6px 10px; font-family: var(--mono); font-size: 11.5px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.manuscript-card { padding: 14px; background: #fff; border: 1px solid var(--line); border-radius: 12px; }
.file { display: flex; gap: 10px; align-items: flex-start; }
.file svg { flex: 0 0 auto; margin-top: 2px; }
.file-name { display: block; font-weight: 600; font-size: 14px; overflow-wrap: anywhere; }
.file-meta { display: block; font-size: 12.5px; color: var(--muted); }
.summary { margin-top: 10px; font-size: 13.5px; color: var(--muted); }
.import-notes { margin-top: 10px; font-size: 13px; }
.import-notes summary { display: flex; align-items: center; gap: 6px; color: var(--warn); font-weight: 600; cursor: pointer; }
.import-notes ul { margin: 8px 0 0; padding-left: 18px; color: var(--muted); }
.import-notes li { margin-bottom: 6px; }

.group { margin: 22px 10px 6px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.sections { list-style: none; margin: 0; padding: 0; }
.sections button {
  display: flex;
  align-items: baseline;
  gap: 8px;
  width: 100%;
  min-height: 40px;
  padding: 8px 10px;
  border: 0;
  border-radius: 8px;
  background: none;
  text-align: left;
  font-size: 14.5px;
}
.sections button:hover { background: var(--line-soft); }
.sections button.on-show { background: #ECEDE7; font-weight: 600; }
.section-name { flex: 1 1 auto; min-width: 0; }
.section-page { flex: 0 0 auto; font-family: var(--mono); font-size: 12px; color: var(--faint); }

/* ---------- Preview ---------- */
.toolbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.step {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}
.step:disabled { color: #B5B8AE; }
.pages { min-width: 150px; text-align: center; font-family: var(--mono); font-size: 13px; }
.step.dots { color: var(--muted); }
.strip { position: relative; flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: 4px; overflow: hidden; }
.spread-button { flex: 0 0 auto; min-width: 46px; height: 36px; padding: 0 8px; border: 1px solid var(--line); border-radius: 8px; background: #fff; font-family: var(--mono); font-size: 12px; color: var(--muted); white-space: nowrap; }
.spread-button:hover { border-color: var(--faint); color: var(--ink); }
.spread-button.starts { border-color: var(--accent); color: var(--accent); font-weight: 600; }
.spread-button.current { border-color: var(--ink); background: var(--ink); color: #fff; }
.spread-button.starts.current { border-color: var(--accent); background: var(--accent); }
.goto { display: inline-flex; align-items: center; gap: 8px; margin-left: 8px; font-size: 13px; color: var(--muted); white-space: nowrap; }
.goto input { width: 76px; min-height: 44px; padding: 0 10px; border: 1px solid var(--faint); border-radius: 10px; background: #fff; font-family: var(--mono); font-size: 14px; }
.working { font-size: 13px; color: var(--muted); }
/* The toolbar stays in view while a tall or zoomed-in page is scrolled. */
.toolbar { position: sticky; top: 0; z-index: 2; flex-wrap: wrap; row-gap: 8px; }
.toolbar .strip { flex-basis: 220px; }
.view-tools { flex: 0 0 auto; display: flex; align-items: center; gap: 10px; margin-left: auto; }
.view-toggle { min-height: 44px; display: inline-flex; align-items: center; gap: 8px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; font-size: 13.5px; font-weight: 600; white-space: nowrap; }
.view-toggle:disabled { color: #B5B8AE; }
.zoom { display: inline-flex; align-items: center; gap: 4px; }
.zoom-level { min-width: 58px; min-height: 44px; padding: 0 8px; border: 1px solid var(--line); border-radius: 10px; background: #fff; font-family: var(--mono); font-size: 13px; }
.zoom-level:disabled { color: #B5B8AE; }
.margins-toggle { flex: 0 0 auto; white-space: nowrap; }
.toolbar .step { flex: 0 0 auto; }

.stage { flex: 0 0 auto; padding: 32px 24px; background: var(--stage); transition: opacity 0.15s; overflow-x: auto; container-type: inline-size; }
.stage.zoomed { cursor: grab; }
.stage.zoomed.panning { cursor: grabbing; user-select: none; }
.stage.updating .spread { opacity: 0.55; }
/* The pair of pages is as wide as its pages and centred while it fits; zoomed in, it can be scrolled from edge to edge. */
.spread { display: flex; width: max-content; margin: 0 auto; }
.page {
  position: relative;
  flex: 0 0 auto;
  /* Fitted, each of two pages takes half the preview's width or as much as its height allows, whichever is less. */
  width: calc(min(50cqw, clamp(380px, 100vh - 370px, 900px) * var(--ratio)) * var(--zoom, 1));
  aspect-ratio: var(--ratio);
  background: #fff;
  box-shadow: 0 10px 24px rgba(27, 29, 26, 0.14), 0 1px 2px rgba(27, 29, 26, 0.12);
}
.spread.cream .page { background: #F6EEDA; }
.spread.cream canvas { mix-blend-mode: multiply; }
.page.empty { visibility: hidden; }
/* One page on show: fitted to the preview's width (up to a comfortable reading size), so it is about twice as large
   and is read by scrolling down. The other side of the book isn't drawn at all. */
.spread.single .page { width: calc(min(100cqw, 980px) * var(--zoom, 1)); }
.spread.single .page.empty { display: none; }
.spread.single .page { border-radius: 3px; }
.spread.single .page::after { display: none; }
.left-page { border-radius: 3px 0 0 3px; }
.right-page { border-radius: 0 3px 3px 0; }
.left-page::after, .right-page::after { content: ""; position: absolute; top: 0; bottom: 0; width: 18px; pointer-events: none; }
.left-page::after { right: 0; background: linear-gradient(to right, transparent, rgba(27, 29, 26, 0.09)); }
.right-page::after { left: 0; background: linear-gradient(to left, transparent, rgba(27, 29, 26, 0.09)); }
.page canvas { display: block; width: 100%; height: 100%; }
.margin-guide { position: absolute; border: 1px dashed #C2553D; pointer-events: none; }

/* ---------- Bleed Easy ---------- */
.preflight {
  flex: 0 0 auto;
  margin: 0 20px 28px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
}
.stage + .preflight { margin-top: -4px; }

/* In the workspace Bleed Easy is a drawer: a bar pinned to the bottom of the preview, with the details sliding up
   over the pages when the bar is clicked. */
.preflight.drawer { position: sticky; bottom: 0; z-index: 3; margin: auto 0 0; border-width: 1px 0 0; border-radius: 0; box-shadow: 0 -8px 24px rgba(27, 29, 26, 0.10); overflow: visible; }
.stage + .preflight.drawer { margin-top: auto; }
.preflight-bar { width: 100%; min-height: 56px; display: flex; align-items: center; gap: 12px; padding: 0 20px; border: 0; background: #fff; text-align: left; cursor: pointer; }
.preflight-bar:hover { background: var(--panel); }
.preflight-title { font-family: var(--serif); font-size: 20px; font-weight: 600; }
.preflight-bar .tally { margin-left: auto; }
.preflight-bar .flag-icon { flex: 0 0 auto; color: var(--good); }
.preflight-bar .flag-text { font-size: 14px; font-weight: 600; white-space: nowrap; }
.preflight-bar .chevron { flex: 0 0 auto; color: var(--muted); transition: transform 0.2s; }
.preflight.open .preflight-bar .chevron { transform: rotate(180deg); }
.preflight.warning .preflight-bar { background: var(--warn-ground); box-shadow: inset 0 3px 0 var(--warn); }
.preflight.warning .preflight-bar .flag-icon, .preflight.warning .preflight-bar .flag-text { color: var(--warn); }
.preflight.error .preflight-bar { background: var(--bad-ground); box-shadow: inset 0 3px 0 var(--bad); }
.preflight.error .preflight-bar .flag-icon, .preflight.error .preflight-bar .flag-text { color: var(--bad); }
.preflight-slide { display: grid; grid-template-rows: 0fr; transition: grid-template-rows 0.22s ease; background: #fff; }
.preflight.open .preflight-slide { grid-template-rows: 1fr; }
.preflight-body { min-height: 0; overflow: hidden; }
.preflight.open .preflight-body { max-height: min(60vh, 560px); overflow-y: auto; border-top: 1px solid var(--line-soft); }
.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
@media (prefers-reduced-motion: reduce) { .preflight-slide, .preflight-bar .chevron { transition: none; } }
.preflight header { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; padding: 18px 20px; }
.preflight h2 { font-family: var(--serif); font-size: 22px; font-weight: 600; }
.tally { font-family: var(--mono); font-size: 12px; color: var(--muted); text-align: right; }
.finding { display: flex; align-items: flex-start; gap: 14px; padding: 16px 20px; border-top: 1px solid var(--line-soft); }
.finding svg { flex: 0 0 auto; margin-top: 2px; }
.finding.warning { background: var(--warn-ground); border-top-color: var(--warn-line); }
.finding.warning svg { color: var(--warn); }
.finding.error { background: var(--bad-ground); border-top-color: var(--bad-line); }
.finding.error svg { color: var(--bad); }
.finding-text { flex: 1 1 auto; min-width: 0; }
.finding-text .fix { margin-top: 4px; font-size: 14px; color: var(--muted); }
.go {
  flex: 0 0 auto;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid currentColor;
  border-radius: 999px;
  background: none;
  font-size: 14px;
  font-weight: 600;
}
.finding.warning .go { color: var(--warn); }
.finding.error .go { color: var(--bad); }
ul.passed {
  list-style: none;
  margin: 0;
  padding: 14px 20px 16px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 10px 24px;
  border-top: 1px solid var(--line-soft);
  font-size: 14.5px;
}
ul.passed li { display: flex; align-items: center; gap: 10px; }
ul.passed svg { flex: 0 0 auto; }
.typesetter-notes { padding: 12px 20px 16px; border-top: 1px solid var(--line-soft); font-size: 14px; color: var(--muted); }
.typesetter-notes summary { cursor: pointer; font-weight: 600; color: var(--ink); }
.typesetter-notes ul { margin: 8px 0 0; padding-left: 18px; }
.typesetter-notes li { margin-bottom: 4px; }

/* ---------- Settings ---------- */
.right section { padding: 20px; border-bottom: 1px solid var(--line-soft); }
.right h3 { margin-bottom: 12px; font-size: 15px; font-weight: 600; }
.field { display: block; margin-bottom: 12px; }
.field > span, .field-label { display: block; margin-bottom: 6px; font-size: 13px; color: var(--muted); }
.field input, .field select {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--faint);
  border-radius: 10px;
  background: #fff;
}
/* The dropdowns in the workspace's settings column are set a little smaller so their longest choices fit. */
.right .field select { font-size: 13px; padding: 0 8px; text-overflow: ellipsis; }
.choice { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.choice button { min-height: 44px; border: 1px solid var(--faint); border-radius: 10px; background: #fff; font-weight: 600; }
.choice button.chosen { border-color: var(--accent); background: var(--accent); color: #fff; }
.hint { margin-top: 10px; font-size: 13.5px; color: var(--muted); }
.hint.needed { color: var(--warn); font-weight: 500; }
.margins { margin: 0; }
.margins > div { display: flex; align-items: baseline; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid var(--line-soft); }
.margins > div:last-child { border-bottom: 0; }
.margins dt small { display: block; font-size: 12px; color: var(--muted); }
.margins dd { margin: 0; font-family: var(--mono); font-size: 13px; }
.themes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.themes button {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 4px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  font-size: 13.5px;
  font-weight: 600;
}
.themes button.chosen { border: 2px solid var(--accent); padding: 11px 3px 9px; }
.themes button:disabled { color: #9A9D94; background: var(--ground); }
.sample { font-size: 24px; font-weight: 400; line-height: 1.1; }
.sample.classic { font-family: var(--serif); }
.sample.modern { font-family: var(--sans); }
.sample.hearth { font-family: Georgia, serif; }
.check { display: flex; align-items: center; gap: 10px; min-height: 36px; font-size: 14.5px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.check:has(input:disabled) { color: #9A9D94; cursor: not-allowed; }

/* ---------- Who is signed in (top bar) ---------- */
.account { margin-left: auto; display: flex; align-items: center; gap: 12px; min-width: 0; }
.actions + .account { margin-left: 0; padding-left: 16px; border-left: 1px solid var(--line); }
.account .who { max-width: 180px; font-size: 14px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.signout { min-height: 44px; padding: 0 14px; border: 1px solid var(--line); border-radius: 999px; background: #fff; font-size: 14px; font-weight: 600; white-space: nowrap; }
.signout:hover { border-color: var(--faint); }

.shelf-link { color: var(--accent); font-size: 14px; font-weight: 600; text-decoration: none; white-space: nowrap; }
.shelf-link:hover { text-decoration: underline; }

/* ---------- My books ---------- */
.shelf { flex: 1 1 auto; width: min(860px, 100%); margin: 0 auto; padding: 36px 20px 60px; overflow: auto; }
.shelf-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.shelf-head h1 { font-family: var(--serif); font-size: 32px; font-weight: 500; }
.new-book { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: 10px; background: var(--accent); color: #fff; font-weight: 600; text-decoration: none; }
.new-book:hover { background: #34503C; }
.shelf-note { color: var(--muted); }
.shelf .problem { margin: 0 0 16px; }
.shelf-empty { padding: 40px 32px; background: #fff; border: 1px solid var(--line); border-radius: 16px; text-align: center; }
.shelf-empty h2 { font-family: var(--serif); font-size: 24px; font-weight: 500; margin: 0 0 10px; }
.shelf-empty p { max-width: 52ch; margin: 0 auto 22px; color: var(--muted); }
.book-list { list-style: none; margin: 0; padding: 0; background: #fff; border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.book-list li { display: flex; align-items: center; gap: 12px; padding: 6px 16px 6px 0; border-bottom: 1px solid var(--line-soft); }
.book-list li:last-child { border-bottom: 0; }
.book-list .open { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; padding: 12px 20px; color: inherit; text-decoration: none; }
.book-list .open:hover .name { color: var(--accent); text-decoration: underline; }
.book-list .name { font-family: var(--serif); font-size: 20px; font-weight: 500; overflow-wrap: anywhere; }
.book-list .meta { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.book-list .confirm { flex: 0 0 auto; display: flex; align-items: center; gap: 8px; font-size: 14px; }
.book-list li > .quiet { flex: 0 0 auto; }
@media (max-width: 720px) { .book-list li { flex-wrap: wrap; padding: 6px 16px 12px 0; } .book-list .confirm { flex-wrap: wrap; padding-left: 20px; } .book-list li > .quiet { margin-left: auto; } .book-list .status { margin-left: 20px; } }
.status { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px; min-height: 30px; padding: 0 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--ground); color: var(--muted); font-size: 13px; font-weight: 600; white-space: nowrap; }
.status.passed { border-color: #BCD3C1; background: #EDF4EE; color: var(--good); }
.status.warning { border-color: var(--warn-line); background: var(--warn-ground); color: var(--warn); }
.status.error { border-color: var(--bad-line); background: var(--bad-ground); color: var(--bad); }
.quiet, .danger { min-height: 40px; padding: 0 14px; border-radius: 999px; font-size: 14px; font-weight: 600; white-space: nowrap; }
.quiet { border: 1px solid var(--line); background: #fff; color: var(--muted); }
.quiet:hover { border-color: var(--faint); color: var(--ink); }
.danger { border: 1px solid var(--bad-line); background: var(--bad-ground); color: var(--bad); }
a.upload { text-decoration: none; }

/* ---------- The "working on it" card ---------- */
.busy-card { position: fixed; left: 50%; top: 42%; z-index: 6; transform: translate(-50%, -50%); display: flex; align-items: center; gap: 16px; max-width: min(460px, calc(100vw - 40px)); padding: 18px 22px; background: #fff; border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 18px 50px rgba(27, 29, 26, 0.22); pointer-events: none; }
.topbar a.brand { color: inherit; text-decoration: none; }
.leave-veil { position: fixed; inset: 0; z-index: 8; background: rgba(27, 29, 26, 0.28); }
.leave-card { position: fixed; left: 50%; top: 40%; z-index: 9; transform: translate(-50%, -50%); display: flex; flex-direction: column; gap: 10px; width: min(440px, calc(100vw - 40px)); padding: 22px 24px; background: #fff; border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 18px 50px rgba(27, 29, 26, 0.26); }
.leave-card strong { font-size: 17px; font-weight: 600; }
.leave-card span { font-size: 14.5px; line-height: 1.5; color: var(--muted); }
.leave-buttons { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }
.leave-link { display: inline-flex; align-items: center; min-height: 40px; padding: 0 16px; border-radius: 999px; background: #3D5A45; color: #fff; font-size: 14px; font-weight: 600; text-decoration: none; }
.busy-card strong { display: block; font-size: 16px; font-weight: 600; }
.busy-card span { font-size: 13.5px; color: var(--muted); }
.spinner { flex: 0 0 auto; width: 28px; height: 28px; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: zs-spin 0.9s linear infinite; }
@keyframes zs-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } }

/* ---------- Plans and coupon codes ---------- */
.plan-line { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; padding: 12px 16px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; font-size: 14px; color: var(--muted); }
.plan-line p { flex: 1 1 320px; }
.plan-line .full { color: var(--warn); font-weight: 500; }
.plan-drawer { margin-bottom: 22px; padding: 20px; background: #fff; border: 1px solid var(--line); border-radius: 16px; }
.plan-panel .problem, .plan-panel .notice { margin: 0 0 14px; }
.notice { padding: 10px 12px; border: 1px solid #BCD3C1; border-radius: 10px; background: #EDF4EE; color: var(--good); font-size: 14px; }
.plan-panel > .hint { margin: 0 0 14px; }
.plan-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.plan { display: flex; flex-direction: column; gap: 8px; padding: 18px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); }
.plan h3 { font-family: var(--serif); font-size: 21px; font-weight: 500; }
.plan .price { font-size: 26px; font-weight: 600; }
.plan .price small { font-size: 13px; font-weight: 400; color: var(--muted); }
.plan p { font-size: 14px; color: var(--muted); }
.plan .buy { margin-top: auto; min-height: 44px; border: 0; border-radius: 10px; background: var(--accent); color: #fff; font-weight: 600; }
.plan .buy:disabled { background: #B5B8AE; }
.coupon { display: flex; align-items: flex-end; gap: 10px; margin-top: 18px; }
.coupon .field { flex: 1 1 auto; margin: 0; }
.coupon input { font-family: var(--mono); text-transform: uppercase; }
.coupon .apply { min-height: 44px; padding: 0 18px; border: 1px solid var(--accent); border-radius: 10px; background: #fff; color: var(--accent); font-weight: 600; white-space: nowrap; }
.sheet { position: fixed; inset: 0; z-index: 5; display: grid; place-items: start center; padding: 84px 20px 20px; background: rgba(27, 29, 26, 0.35); overflow: auto; }
.sheet-card { width: min(640px, 100%); padding: 24px; background: #fff; border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 18px 50px rgba(27, 29, 26, 0.18); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sheet-head h2 { font-family: var(--serif); font-size: 26px; font-weight: 500; margin: 0; }
.sheet-card .lead { margin: 6px 0 16px; color: var(--muted); }
.export.unlock { background: var(--ink); }

/* ---------- Homepage (the page itself carries its styles inline, as the approved mockup does) ---------- */
.home a { color: #1B1D1A; text-decoration: none; }
.home a:hover { color: #575B54; }
.home summary { cursor: pointer; list-style: none; }
.home summary::-webkit-details-marker { display: none; }
.home details[open] .faq-plus { transform: rotate(45deg); }

/* ---------- Free tools (Spine Doctor, Bleed Easy) ---------- */
.topbar.public .brand { color: inherit; text-decoration: none; }
.tools-nav { display: flex; align-items: center; gap: 6px; padding-left: 20px; border-left: 1px solid var(--line); }
.tools-nav a { min-height: 40px; display: inline-flex; align-items: center; padding: 0 12px; border-radius: 999px; color: var(--muted); font-size: 14.5px; font-weight: 600; text-decoration: none; }
.tools-nav a:hover { color: var(--ink); background: var(--ground); }
.tools-nav a.here { color: var(--accent); background: #EDF4EE; }
.signup { min-height: 44px; display: inline-flex; align-items: center; padding: 0 16px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 14px; font-weight: 600; text-decoration: none; white-space: nowrap; }
.tool { flex: 1 1 auto; width: min(980px, 100%); margin: 0 auto; padding: 40px 20px 60px; overflow: auto; }
.tool h1 { font-family: var(--serif); font-size: 38px; font-weight: 500; line-height: 1.15; }
.tool > .lead { max-width: 68ch; margin: 10px 0 28px; font-size: 17px; color: var(--muted); }
.tool-columns { display: grid; grid-template-columns: minmax(240px, 300px) 1fr; gap: 20px; align-items: start; }
.tool-form, .tool-result { padding: 22px; background: #fff; border: 1px solid var(--line); border-radius: 16px; }
.tool-form .field input, .tool-form .field select { font-size: 16px; }
.upload-pdf { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 14px; margin-bottom: 22px; }
.upload-pdf .field { flex: 0 1 280px; margin: 0; }
.upload-pdf .upload { margin-top: 0; }
.upload-pdf .fine, .upload-pdf .problem { flex: 1 0 100%; margin: 0; font-size: 13px; color: var(--muted); }
.tool .preflight.report { margin: 0 0 8px; }
.tool .preflight.report header { flex-wrap: wrap; }
.tool .preflight.report .note { margin: 0; padding: 10px 20px 14px; border-top: 1px solid var(--line-soft); }
.figures { margin: 0 0 18px; display: grid; gap: 14px; }
.figures dt { font-size: 13px; color: var(--muted); }
.figures dd { margin: 2px 0 0; }
.figures .headline strong { display: block; font-family: var(--mono); font-size: 26px; font-weight: 500; letter-spacing: -0.01em; }
.figures .headline small { font-family: var(--mono); font-size: 12.5px; color: var(--muted); }
.figures.small { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line-soft); }
.figures.small dd { font-family: var(--mono); font-size: 14px; }
.cover-diagram { display: block; width: 100%; max-width: 520px; height: auto; }
.cover-diagram text { font-family: var(--sans); font-size: 13px; fill: var(--muted); }
.cover-diagram text.caption { font-size: 11.5px; }
.tool-result .problem { margin: 0 0 16px; }
.next-step { display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-top: 28px; padding: 22px; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; }
.next-step > div { flex: 1 1 380px; }
.next-step h2 { font-family: var(--serif); font-size: 22px; font-weight: 500; margin: 0 0 6px; }
.next-step p { font-size: 14.5px; color: var(--muted); }
@media (max-width: 760px) { .tool-columns { grid-template-columns: 1fr; } .tools-nav { padding-left: 0; border-left: 0; } }

/* ---------- Admin ---------- */
.admin-tag { padding: 3px 10px; border-radius: 999px; background: var(--ink); color: #fff; font-family: var(--mono); font-size: 11.5px; letter-spacing: 0.08em; text-transform: uppercase; }
.admin-link { color: var(--ink); }
.admin { flex: 1 1 auto; min-height: 0; width: 100%; padding: 24px 24px 0; display: flex; flex-direction: column; overflow: hidden; }
.admin-tabs, .admin-fixed, .admin > .problem { flex: none; }
.admin-scroll { flex: 1 1 auto; min-height: 0; overflow: auto; padding-bottom: 40px; }
.admin-scroll .admin-table thead th { position: sticky; top: 0; z-index: 2; box-shadow: inset 0 -1px 0 var(--line), inset 0 1px 0 var(--line); }
.admin-bar { flex: none; display: flex; justify-content: flex-end; align-items: center; gap: 12px; padding: 12px 0 16px; border-top: 1px solid var(--line); font-size: 14px; }
.admin-bar .picked { color: var(--muted); }
.admin-bar .ask { font-weight: 600; color: var(--bad); }
.admin-bar .danger:disabled { opacity: 0.45; cursor: not-allowed; }
.admin-bar.asking { min-height: 30px; }
.delete-accounts-ask { position: fixed; right: 24px; bottom: 16px; z-index: 5; width: min(560px, calc(100vw - 48px)); padding: 16px 18px; background: #fff; border: 1px solid var(--bad-line); border-radius: 14px; box-shadow: 0 18px 50px rgba(27, 29, 26, 0.22); }
.delete-accounts-ask strong { font-size: 16px; }
.delete-accounts-ask ul { max-height: 130px; margin: 8px 0; padding-left: 20px; overflow: auto; font-size: 13.5px; }
.delete-accounts-ask p { margin: 0 0 10px; font-size: 13.5px; line-height: 1.5; color: var(--muted); }
.delete-accounts-ask .ask-buttons { display: flex; justify-content: flex-end; gap: 10px; margin-top: 10px; }
.admin-table .pick-cell { width: 34px; padding-right: 0; }
.admin-table .pick-cell input { width: 17px; height: 17px; margin: 1px 0 0; accent-color: var(--accent); }
.account-notice { margin: 0 0 12px; }
.admin-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 20px; border-bottom: 1px solid var(--line); }
.admin-tabs button { min-height: 44px; display: inline-flex; align-items: center; gap: 8px; padding: 0 16px; border: 0; border-bottom: 3px solid transparent; background: none; font-size: 15px; font-weight: 600; color: var(--muted); }
.admin-tabs button:hover { color: var(--ink); }
.admin-tabs button.here { color: var(--accent); border-bottom-color: var(--accent); }
.count { display: inline-block; padding: 1px 8px; border-radius: 999px; background: var(--ground); border: 1px solid var(--line); font-size: 12px; font-weight: 600; color: var(--muted); }
.count.bad { background: var(--bad); border-color: var(--bad); color: #fff; }
.alert { margin: 0 0 16px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: #fff; font-size: 14.5px; }
.alert.error { border-color: var(--bad-line); background: var(--bad-ground); color: var(--bad); }
.alert.warning { border-color: var(--warn-line); background: var(--warn-ground); color: var(--warn); }
.alert.good { border-color: #BCD3C1; background: #EDF4EE; color: var(--good); }
.alert .admin-table { margin-top: 12px; color: var(--ink); }
button.link { padding: 0; border: 0; background: none; color: inherit; font: inherit; font-weight: 600; text-decoration: underline; cursor: pointer; }
.admin-figures { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin: 0 0 16px; }
.admin-figures > div { padding: 18px 20px; background: #fff; border: 1px solid var(--line); border-radius: 14px; }
.admin-figures dt { font-size: 13px; color: var(--muted); }
.admin-figures dd { margin: 4px 0 0; font-family: var(--mono); font-size: 28px; font-weight: 500; }
.admin-figures dd small { font-size: 13px; color: var(--muted); }
.admin-card { margin-bottom: 20px; padding: 20px; background: #fff; border: 1px solid var(--line); border-radius: 14px; }
.admin-card h2 { font-family: var(--serif); font-size: 21px; font-weight: 600; margin-bottom: 12px; }
.admin-card .problem, .admin-card .notice { margin: 0 0 12px; }
.admin-card .primary { min-height: 44px; padding: 0 20px; border: 0; border-radius: 10px; background: var(--accent); color: #fff; font-weight: 600; }
.admin-form, .admin-filter { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 0 14px; }
.admin-form .wide, .admin-filter .wide { grid-column: span 2; }
.admin-form input.code { font-family: var(--mono); text-transform: uppercase; }
.admin-table { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--line); font-size: 13.5px; }
.admin-table th, .admin-table td { padding: 9px 12px; border-bottom: 1px solid var(--line-soft); text-align: left; vertical-align: top; }
.admin-table th { background: var(--panel); font-size: 12.5px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.admin-table .mono, .admin-table .when { font-family: var(--mono); font-size: 12.5px; white-space: nowrap; }
.admin-table .detail { max-width: 520px; overflow-wrap: anywhere; }
.admin-table tr.off td { color: #9A9D94; }
.admin-table tr.error td { background: var(--bad-ground); }
.admin-table tr.warning td { background: var(--warn-ground); }
.level-tag { font-family: var(--mono); font-size: 11.5px; font-weight: 600; }
.level-tag.error { color: var(--bad); }
.level-tag.warning { color: var(--warn); }
.level-tag.information { color: var(--muted); }
.account-actions { white-space: nowrap; }
.account-actions .quiet, .account-actions .danger { min-height: 34px; padding: 0 10px; font-size: 13px; }
.account-actions .quiet:disabled { color: #B5B8AE; }
.sign-in-state .level-tag { display: block; }
.temporary-password { display: inline-block; margin: 0 8px; padding: 6px 12px; border: 1px solid #BCD3C1; border-radius: 8px; background: #fff; font-family: var(--mono); font-size: 18px; letter-spacing: 0.06em; color: var(--ink); user-select: all; }
.alert.temporary p { margin: 10px 0; color: var(--ink); }

/* ---------- Terms, privacy and the links to them ---------- */
.legal-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 22px; margin-top: 8px; font-size: 13.5px; color: var(--muted); }
.legal-links a { color: var(--muted); }
.legal-links a:hover { color: var(--ink); }
.tool .legal-links { margin-top: 28px; }
.legal-page { min-height: 100vh; display: flex; flex-direction: column; align-items: center; gap: 24px; padding: 40px 20px 48px; }
.legal-page .brand { color: inherit; text-decoration: none; }
.legal { width: min(800px, 100%); padding: 40px 44px; background: #fff; border: 1px solid var(--line); border-radius: 16px; line-height: 1.6; }
.legal h1 { font-family: var(--serif); font-size: 36px; font-weight: 500; line-height: 1.15; }
.legal h2 { margin: 30px 0 8px; font-family: var(--serif); font-size: 22px; font-weight: 600; }
.legal p { margin: 0 0 12px; }
.legal ul { margin: 0 0 12px; padding-left: 22px; }
.legal li { margin-bottom: 6px; }
.legal a { color: var(--accent); font-weight: 600; }
.legal .effective { font-family: var(--mono); font-size: 12.5px; color: var(--muted); }
.legal .draft-note { padding: 10px 14px; border: 1px solid var(--warn-line); border-radius: 10px; background: var(--warn-ground); color: var(--warn); font-size: 14px; }
.legal table { width: 100%; margin: 0 0 14px; border-collapse: collapse; font-size: 14.5px; }
.legal th, .legal td { padding: 10px 12px; border: 1px solid var(--line); text-align: left; vertical-align: top; }
.legal th { background: var(--panel); font-weight: 600; }
.check.agree { align-items: flex-start; margin-top: 12px; }
.check.agree a { color: var(--accent); font-weight: 600; }
@media (max-width: 640px) { .legal { padding: 26px 20px; } }

/* ---------- Account pages (sign in, create account) ---------- */
.account-page { min-height: 100vh; display: flex; flex-direction: column; align-items: center; gap: 24px; padding: 48px 20px; }
.account-page .brand { color: inherit; text-decoration: none; }
.account-card { width: min(440px, 100%); padding: 32px; background: #fff; border: 1px solid var(--line); border-radius: 16px; }
.account-card h1 { font-family: var(--serif); font-size: 28px; font-weight: 500; line-height: 1.2; }
.account-card .lead { margin: 6px 0 22px; color: var(--muted); }
.account-card .problem { margin: 0 0 18px; }
.account-card .field { margin-bottom: 16px; }
.account-card .field small { display: block; margin-top: 6px; font-size: 13px; color: var(--muted); }
.password-box { position: relative; }
.password-box input { padding-right: 48px; }
.reveal { position: absolute; top: 0; right: 0; width: 44px; height: 44px; display: grid; place-items: center; border: 0; border-radius: 10px; background: none; color: var(--muted); }
.reveal:hover { color: var(--ink); }
.reveal .slash { display: none; }
.reveal.on { color: var(--accent); }
.reveal.on .slash { display: inline; }
.account-card .check { margin-bottom: 8px; }
.account-card .primary { width: 100%; min-height: 48px; margin-top: 10px; border: 0; border-radius: 10px; background: var(--accent); color: #fff; font-weight: 600; }
.account-card .primary:hover { background: #34503C; }
.account-card .switch { margin-top: 20px; font-size: 14.5px; color: var(--muted); text-align: center; }
.account-card a { color: var(--accent); font-weight: 600; }

/* ---------- Narrow windows: one column, settings below the preview ---------- */
@media (max-width: 1080px) {
  .app { height: auto; min-height: 100vh; }
  .columns { display: block; }
  .left, .right, .center { overflow: visible; border: 0; }
  .topbar { flex-wrap: wrap; }
}

#blazor-error-ui {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
  padding: 12px 20px;
  background: var(--bad-ground);
  border-top: 1px solid var(--bad-line);
  color: var(--bad);
}
#blazor-error-ui .reload { margin-left: 12px; color: var(--bad); font-weight: 600; }
