/* sci2audio: one stylesheet for the app, the login and the legal pages.
   Colours carry meaning: --regel (green) = solved by rules, free; --ki (amber) = needs AI, costs; --accent (blue) = your action.
   Fonts are served from /static/fonts (never from Google: the IP address would go to Google). */

@font-face { font-family: "Atkinson Hyperlegible Next"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("fonts/atkinson-hyperlegible-next-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Atkinson Hyperlegible Next"; font-style: italic; font-weight: 400; font-display: swap;
  src: url("fonts/atkinson-hyperlegible-next-latin-400-italic.woff2") format("woff2"); }
@font-face { font-family: "Atkinson Hyperlegible Next"; font-style: normal; font-weight: 600 700; font-display: swap;
  src: url("fonts/atkinson-hyperlegible-next-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Atkinson Hyperlegible Mono"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("fonts/atkinson-hyperlegible-mono-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Atkinson Hyperlegible Mono"; font-style: normal; font-weight: 600 700; font-display: swap;
  src: url("fonts/atkinson-hyperlegible-mono-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Literata"; font-style: normal; font-weight: 500 700; font-display: swap;
  src: url("fonts/literata-latin-600-normal.woff2") format("woff2"); }

:root {
  --bg: #f3f5f6; --surface: #ffffff; --sunk: #e8edf0; --ink: #15212c; --muted: #56636f; --line: #d4dce2;
  --accent: #2443a0; --accent-ink: #ffffff; --accent-soft: #e2e8fa;
  --regel: #15704f; --regel-soft: #d9f0e6; --ki: #96560a; --ki-soft: #f9ead0;
  --err: #b42318; --err-soft: #fde4e1; --warn: #7a5600; --warn-soft: #fff1cc;
  --shadow: 0 12px 32px -12px rgba(10, 20, 30, .28);
  --f-display: "Literata", Georgia, "Times New Roman", serif;
  --f-body: "Atkinson Hyperlegible Next", system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-mono: "Atkinson Hyperlegible Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --r-s: 6px; --r-m: 10px; --r-l: 14px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1419; --surface: #162029; --sunk: #1d2933; --ink: #e4ebf0; --muted: #98a6b2; --line: #2b3945;
    --accent: #8eaaff; --accent-ink: #0b1220; --accent-soft: #1e2a49;
    --regel: #63d1a7; --regel-soft: #12332a; --ki: #f1b456; --ki-soft: #3a2a10;
    --err: #ff9289; --err-soft: #3d1a17; --warn: #f0cf7a; --warn-soft: #3a2f12;
    --shadow: 0 12px 32px -12px rgba(0, 0, 0, .7);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e1419; --surface: #162029; --sunk: #1d2933; --ink: #e4ebf0; --muted: #98a6b2; --line: #2b3945;
  --accent: #8eaaff; --accent-ink: #0b1220; --accent-soft: #1e2a49;
  --regel: #63d1a7; --regel-soft: #12332a; --ki: #f1b456; --ki-soft: #3a2a10;
  --err: #ff9289; --err-soft: #3d1a17; --warn: #f0cf7a; --warn-soft: #3a2f12;
  --shadow: 0 12px 32px -12px rgba(0, 0, 0, .7);
  color-scheme: dark;
}

/* -- base ------------------------------------------------------------------------------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 1rem/1.55 var(--f-body); }
h1, h2, h3, h4, h5 { margin: 0; line-height: 1.25; text-wrap: balance; }
h1, h2 { font-family: var(--f-display); font-weight: 600; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.375rem; }
h3 { font-size: 1rem; font-weight: 700; }
p { margin: 0 0 .75rem; }
a { color: var(--accent); text-underline-offset: 2px; }
code, kbd, .mono { font-family: var(--f-mono); font-size: .92em; }
.hidden { display: none !important; }
[hidden] { display: none !important; }
.muted { color: var(--muted); font-size: .875rem; }
.small { font-size: .8125rem; }
.num, .tab { font-family: var(--f-mono); font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
::selection { background: var(--accent-soft); }

/* -- controls --------------------------------------------------------------------------- */
button, .btn {
  font: 600 .9375rem/1.2 var(--f-body); display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 10px 16px; border-radius: var(--r-s); cursor: pointer; text-decoration: none;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
}
button:hover:not(:disabled), .btn:hover { border-color: var(--muted); }
button.primary, .btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
button.primary:hover:not(:disabled) { filter: brightness(1.08); border-color: var(--accent); }
button.sm, .btn.sm { min-height: 34px; padding: 6px 11px; font-size: .8125rem; }
button.link { min-height: 0; padding: 0; border: 0; background: none; color: var(--accent); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
button:disabled { opacity: .45; cursor: not-allowed; }
input[type=text], input[type=email], input[type=number], input[type=search], select, textarea {
  font: 1rem/1.4 var(--f-body); color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r-s); padding: 9px 11px; min-height: 44px; width: 100%; max-width: 100%;
}
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
input[type=checkbox], input[type=radio] { width: 20px; height: 20px; accent-color: var(--accent); margin: 2px 0 0; flex: none; }
input[type=range] { width: 100%; accent-color: var(--accent); min-height: 32px; }
textarea { min-height: 110px; resize: vertical; }
label.field { display: flex; flex-direction: column; gap: 6px; font-weight: 700; font-size: .875rem; min-width: 0; }
label.field .hint, .hint { font-weight: 400; color: var(--muted); font-size: .8125rem; }
label.check { display: flex; gap: 10px; align-items: flex-start; font-size: .9375rem; cursor: pointer; }
label.check .muted { display: block; }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 20px; }
@media (max-width: 640px) { .grid { grid-template-columns: 1fr; } }
.span2 { grid-column: 1 / -1; }
.row3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.buttons, .row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.spread { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: baseline; }
.inline { display: flex; gap: 8px; align-items: center; }
.inline > input, .inline > select { flex: 1; min-width: 0; }

/* segmented switch: a radio group that looks like one control */
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; padding: 2px; background: var(--sunk); gap: 2px; flex-wrap: wrap; }
.seg button, .seg label { min-height: 32px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); padding: 5px 12px; font-size: .8125rem; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.seg button.on, .seg label:has(input:checked) { background: var(--surface); color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--accent); }
.seg label input { position: absolute; opacity: 0; pointer-events: none; width: 1px; height: 1px; }
.seg label:has(input:focus-visible) { outline: 3px solid var(--accent); outline-offset: 1px; }
.seg button:disabled { opacity: .45; }

/* chips: the solution of a category; colour plus word, never colour alone */
.chip { display: inline-flex; align-items: center; gap: 5px; font: 700 .75rem/1 var(--f-body); padding: 5px 9px; border-radius: 999px; white-space: nowrap; background: var(--sunk); color: var(--muted); }
.chip.regel { background: var(--regel-soft); color: var(--regel); }
.chip.ki { background: var(--ki-soft); color: var(--ki); }
.chip.aktion { background: var(--accent-soft); color: var(--accent); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }

/* notices */
.notice { padding: 12px 14px; border-radius: var(--r-m); font-size: .9375rem; }
.notice.warn { background: var(--warn-soft); color: var(--warn); }
.notice.err { background: var(--err-soft); color: var(--err); white-space: pre-wrap; }
.notice.info { background: var(--accent-soft); color: var(--ink); }
.ok { color: var(--regel); font-weight: 700; }
.status-ok { color: var(--regel); }
.status-bad { color: var(--err); }

/* key-value tables (estimate, receipts) */
table.kv { border-collapse: collapse; width: 100%; font-size: .875rem; }
table.kv td { padding: 6px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
table.kv td:first-child { color: var(--muted); width: 42%; padding-right: 12px; }
table.kv tr:last-child td { border-bottom: 0; }
.tablewrap { overflow-x: auto; }

/* -- wave: the logo and the loading animation in one ----------------------------------- */
.wave { display: inline-flex; gap: 3px; align-items: center; height: 26px; flex: none; }
.wave i { display: block; width: 4px; height: 100%; background: var(--accent); border-radius: 2px; transform: scaleY(.45); }
.wave.sm { height: 16px; gap: 2px; } .wave.sm i { width: 3px; }
.wave i:nth-child(2) { transform: scaleY(.8); } .wave i:nth-child(3) { transform: scaleY(.55); }
.wave i:nth-child(4) { transform: scaleY(1); } .wave i:nth-child(5) { transform: scaleY(.35); }
.wave.live i { animation: wave 1.1s ease-in-out infinite; }
.wave.live i:nth-child(2) { animation-delay: -.9s; } .wave.live i:nth-child(3) { animation-delay: -.7s; }
.wave.live i:nth-child(4) { animation-delay: -.5s; } .wave.live i:nth-child(5) { animation-delay: -.3s; }
.wave.live i:nth-child(6) { animation-delay: -.1s; } .wave.live i:nth-child(7) { animation-delay: -.6s; }
@keyframes wave { 0%, 100% { transform: scaleY(.25); } 50% { transform: scaleY(1); } }
@media (prefers-reduced-motion: reduce) { .wave.live i { animation: none; } }

/* -- app header ------------------------------------------------------------------------- */
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 30; background: var(--surface); }
.app-h { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; background: var(--surface); border-bottom: 1px solid var(--line); }
.app-h .in { max-width: 1240px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 10px 16px; flex-wrap: wrap;
  padding-block: 10px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.wordmark { display: inline-flex; align-items: center; gap: 9px; font: 700 1.125rem/1 var(--f-body); color: var(--ink); text-decoration: none; letter-spacing: -.01em; }
.app-h .right { display: flex; align-items: center; gap: 8px 14px; flex-wrap: wrap; }
.bal { font: 700 .8125rem/1 var(--f-mono); padding: 8px 12px; border-radius: 999px; background: var(--sunk); border: 1px solid var(--line); color: var(--ink); text-decoration: none; white-space: nowrap; }
.modelink { font-weight: 700; font-size: .875rem; }
.badge-mode { margin-left: 2px; }

/* account menu */
.menu { position: relative; }
.menu > button { min-height: 38px; padding: 6px 12px; font-size: .875rem; }
.menu-list { position: absolute; right: 0; top: calc(100% + 6px); min-width: 240px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-m); box-shadow: var(--shadow); padding: 6px; display: grid; gap: 2px; z-index: 40; }
.menu-list a, .menu-list button { display: flex; justify-content: flex-start; width: 100%; min-height: 40px; padding: 8px 10px; border: 0; border-radius: var(--r-s);
  background: none; color: var(--ink); font: 600 .875rem var(--f-body); text-decoration: none; text-align: left; }
.menu-list a:hover, .menu-list button:hover { background: var(--sunk); }
.menu-list hr { border: 0; border-top: 1px solid var(--line); margin: 4px 2px; }
.menu-list .theme { padding: 6px 10px 8px; display: grid; gap: 6px; font-size: .8125rem; color: var(--muted); }

/* -- page frame ------------------------------------------------------------------------- */
.app-main { max-width: 1240px; margin: 0 auto; padding-block: 24px;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.narrow { max-width: 780px; margin: 0 auto; display: grid; gap: 16px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); padding: 20px; min-width: 0; }
.card > h2, .card > h3 { margin-bottom: 10px; }
.card-title { font: 600 1.1875rem/1.3 var(--f-display); margin: 0 0 8px; }
.eyebrow { font: 700 .75rem/1.4 var(--f-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
#error { margin-bottom: 16px; scroll-margin-top: 96px; }
.progress-card .progress-sub { overflow-wrap: anywhere; }

/* steps of the quick start */
.stepper { display: flex; gap: 8px; flex-wrap: wrap; list-style: none; margin: 0; padding: 0; font-size: .8125rem; font-weight: 700; color: var(--muted); }
.stepper li { display: inline-flex; align-items: center; gap: 7px; padding: 4px 12px 4px 4px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); }
.stepper em { font-style: normal; width: 22px; height: 22px; border-radius: 50%; display: inline-grid; place-items: center; background: var(--sunk); font: 700 .6875rem var(--f-mono); }
.stepper .done em { background: var(--regel); color: var(--surface); }
.stepper .now { color: var(--ink); border-color: var(--accent); }
.stepper .now em { background: var(--accent); color: var(--accent-ink); }

/* drop zone */
.drop { border: 2px dashed var(--line); border-radius: var(--r-m); padding: 28px 16px; text-align: center; cursor: pointer; color: var(--muted); background: var(--surface); display: grid; gap: 6px; justify-items: center; }
.drop:hover, .drop.over { border-color: var(--accent); color: var(--ink); background: var(--accent-soft); }
.drop strong { color: var(--ink); }
.drop .wave { margin-bottom: 4px; }
.or { text-align: center; color: var(--muted); font-size: .8125rem; margin: 2px 0; }
textarea.paste { min-height: 96px; font: 1rem/1.5 var(--f-body); }

/* the uploaded file */
.fileline { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.fileline .ico { width: 38px; height: 48px; border-radius: 5px; border: 1px solid var(--line); background: var(--sunk); display: grid; place-items: center; font: 700 .625rem var(--f-mono); color: var(--muted); flex: none; text-transform: uppercase; }
.fileline .nm { font-weight: 700; overflow-wrap: anywhere; }
.fileline .info { flex: 1; min-width: 0; }

/* Prüfbericht: rules vs. AI at a glance */
.stack { height: 12px; border-radius: 6px; overflow: hidden; display: flex; background: var(--sunk); margin: 12px 0 8px; }
.stack .r { background: var(--regel); }
.stack .k { background: repeating-linear-gradient(135deg, var(--ki) 0 5px, var(--ki-soft) 5px 8px); }
.stack .o { background: var(--line); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: .8125rem; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.dot { width: 11px; height: 11px; border-radius: 3px; display: inline-block; flex: none; background: var(--line); }
.dot.r { background: var(--regel); } .dot.k { background: var(--ki); }
.examples { display: grid; gap: 8px; margin: 14px 0 4px; padding: 0; list-style: none; font-size: .875rem; }
.examples li { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.examples .src { font-family: var(--f-display); color: var(--muted); overflow-wrap: anywhere; }
.examples .arrow { color: var(--muted); }
.examples .to { overflow-wrap: anywhere; }
.m-r { border-bottom: 2px solid var(--regel); }
.m-k { border-bottom: 2px dashed var(--ki); }
.pending { display: flex; align-items: center; gap: 12px; color: var(--muted); }

/* the two quick-start buttons */
.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 640px) { .choices { grid-template-columns: 1fr; } }
button.choice { display: grid; gap: 4px; justify-content: stretch; justify-items: start; text-align: left; padding: 16px 18px; border-radius: var(--r-m); border-width: 1.5px; min-height: 92px; }
button.choice .top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; width: 100%; flex-wrap: wrap; }
button.choice strong { font-size: 1.125rem; }
button.choice .price { font: 700 .9375rem var(--f-mono); }
button.choice .sub { font-weight: 400; font-size: .8125rem; color: var(--muted); }
button.choice.free { border-color: var(--regel); }
button.choice.ai { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
button.choice.ai .sub { color: var(--accent-ink); opacity: .88; }

/* rights confirmation before every run (demo) */
.rights { border-radius: var(--r-m); background: var(--sunk); padding: 12px 14px; }
.rights p { margin: 6px 0 0 30px; font-size: .8125rem; color: var(--muted); }
.rights label strong { font-weight: 700; }

/* book box (cover, title, author) */
.bookbox { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 16px; align-items: start; }
.bookbox .cover { width: 110px; aspect-ratio: 3 / 4; max-width: 100%; border: 1px solid var(--line); border-radius: var(--r-s);
  background: linear-gradient(160deg, var(--regel-soft), var(--accent-soft)); display: grid; place-items: center; text-align: center; font-size: .75rem; color: var(--muted); overflow: hidden; }
.bookbox .cover img { display: block; width: 100%; height: 100%; object-fit: cover; }
.bookbox .cover img[hidden] + span { display: block; }
.bookbox .cover span { display: none; padding: 6px; }
.bookbox .fields { display: grid; gap: 10px; }
.cover-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
@media (max-width: 520px) { .bookbox { grid-template-columns: 1fr; } }

/* -- progress: wave, phases, bar -------------------------------------------------------- */
.progress-card .head, .loader .head { display: flex; align-items: center; gap: 14px; }
.progress-card .head h3, .loader .head h3 { font: 600 1.1875rem/1.3 var(--f-display); }
.loader .progress-sub { display: block; overflow-wrap: anywhere; }
.phases .detail { display: block; font-weight: 400; color: var(--muted); font-size: .8125rem; overflow-wrap: anywhere; }
.phases { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 9px; font-size: .9375rem; }
.phases li { display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; gap: 10px; align-items: center; }
.phases .ic { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font: 700 .6875rem var(--f-body); background: var(--sunk); color: var(--muted); }
.phases .ok .ic { background: var(--regel); color: var(--surface); }
.phases .run { font-weight: 700; }
.phases .run .ic { background: var(--accent-soft); }
.phases .wait { color: var(--muted); }
.phases .skip { color: var(--muted); text-decoration: line-through; }
.phases .n { font: .8125rem var(--f-mono); color: var(--muted); white-space: nowrap; }
.bar { height: 8px; background: var(--sunk); border-radius: 4px; overflow: hidden; margin: 14px 0 0; }
.bar > div { height: 100%; width: 0; background: var(--accent); border-radius: 4px; transition: width .3s; }
.bar > div.indet { width: 30% !important; animation: slide 1.3s ease-in-out infinite; }
@keyframes slide { 0% { margin-left: -30%; } 100% { margin-left: 100%; } }
@media (prefers-reduced-motion: reduce) { .bar > div.indet { animation: none; width: 100% !important; opacity: .35; } .bar > div { transition: none; } }
.progress-foot { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 12px; }
.progress-sub { white-space: pre-line; }
.confirm-inline { display: inline-flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* -- result: player, chapters, receipt -------------------------------------------------- */
.player { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 18px; align-items: start; }
.player .cover { width: 96px; aspect-ratio: 3 / 4; border-radius: var(--r-s); border: 1px solid var(--line); overflow: hidden;
  background: linear-gradient(160deg, var(--regel-soft), var(--accent-soft)); display: grid; place-items: end start; padding: 6px; font: 600 .6875rem/1.2 var(--f-display); color: var(--ink); }
.player .cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.player .cover:has(img:not([hidden])) { padding: 0; }
.player h3 { font: 600 1.1875rem/1.3 var(--f-display); overflow-wrap: anywhere; }
.player .controls { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 10px; }
.player .controls .play { width: 48px; min-height: 48px; padding: 0; border-radius: 50%; font-size: 1.1rem; }
.scrub { position: relative; margin-top: 12px; }
.scrub input { margin: 0; }
.scrub .marks { position: absolute; left: 0; right: 0; top: 50%; height: 0; pointer-events: none; }
/* chapter marks: a line through the track, shorter for a subchapter; figures are diamonds above it */
.chmark { position: absolute; top: -9px; width: 3px; min-height: 0; height: 18px; padding: 0; margin-left: -1px; border: 0; border-radius: 1px;
  background: var(--ink); opacity: .55; pointer-events: auto; cursor: pointer; }
.chmark.sub { top: -5px; height: 10px; width: 2px; opacity: .4; }
.chmark::before { content: ""; position: absolute; inset: -8px -2px; }  /* easier to hit, narrow so the track stays draggable */
.chmark:hover { opacity: 1; background: var(--accent); }
@media (pointer: coarse) { .chmark { pointer-events: none; } }  /* on a phone the track stays free to drag; the list below jumps */
.chpop { position: absolute; top: calc(100% + 6px); max-width: min(320px, 100%); z-index: 5; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-m); box-shadow: var(--shadow); padding: 6px 8px; font-size: .8125rem; line-height: 1.4; pointer-events: none; }
.times { display: flex; justify-content: space-between; font: .8125rem var(--f-mono); color: var(--muted); }
.nowchap { font-size: .875rem; margin-top: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* figures in the player: marks above the track, a preview on hover, the stage below the controls */
.scrub:has(.figmarks) { margin-top: 22px; }
.scrub .figmarks { position: absolute; left: 0; right: 0; top: -14px; height: 0; }
.figmark { position: absolute; top: 0; width: 12px; min-height: 0; height: 12px; padding: 0; margin-left: -6px; border: 2px solid var(--surface);
  border-radius: 3px; background: var(--accent); transform: rotate(45deg); box-shadow: 0 0 0 1px var(--accent); cursor: pointer; }
.figmark::before { content: ""; position: absolute; inset: -9px -3px; }  /* taller for fingers, narrow so close marks stay apart */
.figmark:hover, .figmark:focus-visible { background: var(--accent-ink); outline: 2px solid var(--accent); outline-offset: 1px; }
.figpop { position: absolute; top: calc(100% + 6px); width: min(280px, 100%); z-index: 5; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-m); box-shadow: var(--shadow); padding: 8px; font-size: .8125rem; line-height: 1.4; pointer-events: none; }
.figpop img { display: block; width: 100%; max-height: 170px; object-fit: contain; background: #fff; border-radius: var(--r-s); margin-bottom: 6px; }
.figpop .figcap { color: var(--muted); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; margin-top: 2px; }
.fig-stage { margin: 16px 0 0; display: grid; gap: 8px; }
.fig-stage .frame { border: 1px solid var(--line); border-radius: var(--r-m); background: #fff; padding: 10px; display: grid; place-items: center;
  aspect-ratio: 4 / 3; width: 100%; max-height: min(52vh, 460px); max-height: min(52dvh, 460px); overflow: hidden; }
.fig-stage .frame img { max-width: 100%; max-height: 100%; object-fit: contain; display: block; }
.fig-stage.before .frame { background: var(--sunk); }
.fig-stage.before .frame img { max-height: 70%; border-radius: var(--r-s); box-shadow: var(--shadow); }
.fig-stage .empty { color: var(--muted); font-size: .875rem; }
.fig-stage figcaption { font-size: .875rem; line-height: 1.45; color: var(--muted); }
.fig-stage figcaption strong { color: var(--ink); margin-right: 6px; }
.fig-stage.before figcaption strong { font-weight: 400; color: var(--muted); }
.fig-stage.in .frame img { animation: figin .35s ease-out; }
@keyframes figin { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .fig-stage.in .frame img { animation: none; } }
/* read along: the original text under the controls, the spoken sentence highlighted */
.readalong { margin-top: 16px; }
.readalong .readtext { position: relative; max-height: min(48vh, 420px); max-height: min(48dvh, 420px); overflow-y: auto; border: 1px solid var(--line);
  border-radius: var(--r-m); background: var(--surface); padding: 14px 16px; font: 1rem/1.65 var(--f-body); scroll-behavior: smooth; }
.readalong .readtext:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.readalong p { margin: 0 0 .9em; }
.readalong p:last-child { margin-bottom: 0; }
.readalong h4 { font: 600 1.0625rem/1.4 var(--f-display); margin: 1.1em 0 .5em; }
.readalong h4:first-child { margin-top: 0; }
.readalong .table { font: .875rem/1.5 var(--f-mono); white-space: pre-wrap; }
.readalong .skipped, .readalong .s.off { color: var(--muted); }
.readalong .skipped { font-size: .875rem; font-style: italic; }
.readalong .s[data-s] { cursor: pointer; border-radius: 3px; padding: 1px 0; transition: background .15s; }
.readalong .s[data-s]:hover { background: var(--sunk); }
.readalong .s[data-s]:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.readalong .s.on { background: var(--accent-soft); box-shadow: 0 0 0 3px var(--accent-soft); color: var(--ink); }
.readalong .readnote { font-size: .8125rem; margin: 6px 2px 0; }
.player .controls [data-read].active { background: var(--accent-soft); border-color: var(--accent); color: var(--ink); }
@media (prefers-reduced-motion: reduce) { .readalong .readtext { scroll-behavior: auto; } }
ol.chapter-marks { list-style: none; padding: 0; margin: 14px 0 0; display: grid; gap: 2px; max-height: 260px; overflow-y: auto; font-size: .875rem; }
ol.chapter-marks button { width: 100%; justify-content: space-between; min-height: 38px; border: 0; background: none; padding: 6px 10px; font-weight: 400; text-align: left; gap: 12px; }
ol.chapter-marks button:hover { background: var(--sunk); }
ol.chapter-marks .on button { background: var(--accent-soft); font-weight: 700; }
ol.chapter-marks .t { font-family: var(--f-mono); color: var(--muted); }
ol.chapter-marks .sub button { padding-left: 28px; min-height: 34px; }
.downloads { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
ul.files { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 4px; }
ul.files li { display: flex; gap: 10px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: .875rem; }
ul.files li span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.receipt { font: .875rem/1.7 var(--f-mono); }
.receipt .line { display: flex; justify-content: space-between; gap: 12px; border-bottom: 1px dotted var(--line); }
.receipt .sum { border-bottom: 0; border-top: 1.5px solid var(--ink); font-weight: 700; margin-top: 4px; padding-top: 4px; }
.receipt .note { font-family: var(--f-body); color: var(--muted); font-size: .8125rem; margin-top: 6px; }
details.more { border-top: 1px solid var(--line); margin-top: 14px; padding-top: 10px; }
details.more > summary { cursor: pointer; font-weight: 700; font-size: .875rem; color: var(--muted); }
details.more[open] > summary { color: var(--ink); margin-bottom: 8px; }
details > summary .sum { font-weight: 400; color: var(--muted); font-size: .8125rem; margin-left: 6px; }
/* folded cards (foreign words, glossary): one line each until opened; an open one takes the whole width */
.folds { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.folds > details[open] { grid-column: 1 / -1; }
@media (max-width: 640px) { .folds { gap: 10px; } details.fold > summary { padding: 12px 14px; } details.fold[open] > *:not(summary) { margin-left: 14px; margin-right: 14px; } }
details.fold { padding: 0; }
details.fold > summary { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; padding: 14px 20px; cursor: pointer; list-style: none; min-height: 44px; }
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary::before { content: "▸"; color: var(--muted); transition: transform .15s; }
details.fold[open] > summary::before { transform: rotate(90deg); }
details.fold > summary .sec { font: 700 .75rem var(--f-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
details.fold > summary .sum { margin-left: 0; }
details.fold[open] > *:not(summary) { margin-left: 20px; margin-right: 20px; }
details.fold[open] > :last-child { margin-bottom: 20px; }
@media (prefers-reduced-motion: reduce) { details.fold > summary::before, details.need > summary::before { transition: none; } }
textarea#script { min-height: 340px; font: 1rem/1.65 var(--f-body); }

/* -- expert workspace --------------------------------------------------------------------- */
.ws { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 24px; align-items: start; }
.rail { position: sticky; top: calc(env(safe-area-inset-top, 0px) + 76px); display: grid; gap: 2px; }
.rail button.step { justify-content: flex-start; gap: 10px; width: 100%; min-height: 42px; border: 0; background: none; padding: 8px 10px; font-weight: 600; font-size: .9375rem; text-align: left; border-radius: var(--r-s); }
.rail button.step:hover { background: var(--surface); }
.rail button.step em { font-style: normal; width: 22px; height: 22px; border-radius: 50%; display: inline-grid; place-items: center; font: 700 .6875rem var(--f-mono); background: var(--sunk); color: var(--muted); flex: none; }
.rail button.step.done em { background: var(--regel); color: var(--surface); }
.rail button.step[aria-current="step"] { background: var(--accent-soft); font-weight: 700; }
.rail button.step[aria-current="step"] em { background: var(--accent); color: var(--accent-ink); }
.rail .bilanz { margin-top: 14px; padding: 12px; border-radius: var(--r-m); background: var(--surface); border: 1px solid var(--line); font-size: .8125rem; line-height: 1.6; }
.rail .bilanz b { display: block; font-size: .75rem; font-family: var(--f-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.rail .bilanz .r { color: var(--regel); } .rail .bilanz .k { color: var(--ki); }
.rail-select { display: none; }
.ws-main { display: grid; gap: 16px; min-width: 0; }
.ws-step { display: grid; gap: 16px; min-width: 0; }
.step-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: baseline; }
/* the step's main action stays in view even when a long list is open */
.step-nav { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; position: sticky; bottom: 0; z-index: 5;
  background: var(--bg); padding: 10px 0 calc(10px + env(safe-area-inset-bottom, 0px)); margin-top: -10px; }
@media (max-width: 640px) {
  .step-head > span.muted, .va-hint { display: none; }
  .ws-main .card { padding: 16px; }
  .ws-main .grid { gap: 12px 20px; }
  #ttsHint, #voiceHint, #chaptersHint, #vaCounts, .scale-intro, .scale .ends, .runbar .cap > .muted:last-child:not(:first-child) { display: none; }
}
@media (max-width: 860px) {
  .ws { grid-template-columns: 1fr; }
  .rail { position: static; display: none; }
  .rail-select { display: grid; gap: 6px; position: sticky; top: calc(env(safe-area-inset-top, 0px) + 64px); z-index: 10; background: var(--bg); padding: 6px 0; }
}
.card h3.sec { font-size: .75rem; font-family: var(--f-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 18px 0 8px; }
.card h3.sec:first-child { margin-top: 0; }
.checks { display: flex; gap: 10px 18px; flex-wrap: wrap; margin-top: 6px; font-weight: 400; }

/* chapter list in the text selection */
.chapters-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.chapters-head .muted { flex: 1 1 200px; }
ul.chapters { list-style: none; padding: 0; margin: 0; max-height: clamp(180px, calc(100vh - 500px), 440px); max-height: clamp(180px, calc(100dvh - 500px), 440px); overflow-y: auto; border: 1px solid var(--line); border-radius: var(--r-m); }
ul.chapters li { border-bottom: 1px solid var(--line); }
ul.chapters li:last-child { border-bottom: 0; }
ul.chapters li.part { padding: 8px 12px 2px; font: 700 .6875rem var(--f-mono); color: var(--muted); text-transform: uppercase; letter-spacing: .06em; border-bottom: 0; }
ul.chapters label { display: flex; gap: 10px; align-items: flex-start; padding: 9px 12px; cursor: pointer; min-height: 44px; }
ul.chapters .title { flex: 1; min-width: 0; overflow-wrap: anywhere; }
ul.chapters .meta { color: var(--muted); font-size: .8125rem; white-space: nowrap; text-align: right; font-family: var(--f-mono); }
ul.chapters li.off .title { color: var(--muted); }
ul.chapters .num { font-family: var(--f-mono); font-size: .8125rem; color: var(--muted); margin-right: .55em; }
ul.chapters li.sub label { min-height: 40px; padding-top: 7px; padding-bottom: 7px; }
.tag { font-size: .75rem; color: var(--warn); background: var(--warn-soft); border-radius: 4px; padding: 1px 6px; margin-left: 6px; }
@media (max-width: 640px) { ul.chapters { max-height: clamp(160px, calc(100dvh - 610px), 440px); } .chapters-head .muted { flex-basis: 100%; } ul.chapters label { flex-wrap: wrap; } ul.chapters .meta { width: 100%; text-align: left; padding-left: 30px; } }

/* pre-analysis: family tabs, category list, detail */
.va-top { display: flex; gap: 10px 14px; flex-wrap: wrap; align-items: center; }
.va-risk { font-weight: 700; font-size: .8125rem; padding: 5px 11px; border-radius: 999px; background: var(--sunk); color: var(--muted); }
.va-risk.gering { background: var(--regel-soft); color: var(--regel); }
.va-risk.mittel { background: var(--warn-soft); color: var(--warn); }
.va-risk.hoch { background: var(--err-soft); color: var(--err); }
.va-ki { display: flex; gap: 10px 14px; flex-wrap: wrap; align-items: center; padding: 12px 14px; border-radius: var(--r-m); background: var(--ki-soft); }
.va-ki .sum { flex: 1 1 260px; font-size: .9375rem; }
.va-ki .sum strong { font-variant-numeric: tabular-nums; }
.va-split { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: start; }
@media (min-width: 1180px) { .va-split.with-detail { grid-template-columns: minmax(0, 1fr) minmax(0, 420px); } }
.tabs { display: flex; gap: 2px; flex-wrap: wrap; border-bottom: 1px solid var(--line); margin-top: 6px; }
@media (max-width: 640px) { .tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: thin; } .tabs button { white-space: nowrap; flex: none; } }
.tabs button { min-height: 40px; border: 0; border-bottom: 2.5px solid transparent; border-radius: 0; background: none; color: var(--muted); padding: 8px 12px; font-size: .875rem; margin-bottom: -1px; }
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }
.tabs .cnt { font: 700 .6875rem var(--f-mono); background: var(--accent-soft); color: var(--accent); border-radius: 999px; padding: 2px 7px; }
.va-cats { border: 1px solid var(--line); border-radius: var(--r-m); background: var(--surface); overflow: hidden; margin-top: 12px; }
.va-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto 18px; gap: 10px 12px; padding: 8px 14px; border-bottom: 1px solid var(--line); align-items: center; cursor: pointer; font-size: .9375rem; }
.va-row:last-child { border-bottom: 0; }
.va-row:hover { background: var(--sunk); }
.va-row.sel { background: var(--accent-soft); }
.va-row:focus-visible { outline-offset: -3px; }
.va-row .t { font-weight: 700; overflow-wrap: anywhere; }
.va-row .t .sub { display: block; font-weight: 400; color: var(--muted); font-size: .8125rem; }
.va-row .go { color: var(--muted); font-size: 1.2rem; line-height: 1; }
.va-row.off .t { color: var(--muted); text-decoration: line-through; }
.va-row.off .t .sub { text-decoration: none; }
.ki-sw { min-height: 32px; padding: 4px 0; width: 84px; font-size: .75rem; border-radius: 999px; }
.ki-sw[aria-pressed="true"] { background: var(--ki-soft); color: var(--ki); border-color: var(--ki); }
.ki-sw[aria-pressed="false"] { color: var(--muted); }
.ki-sw .own { font-size: .625rem; vertical-align: super; }
details.va-auto > summary { cursor: pointer; color: var(--muted); font-size: .8125rem; padding: 10px 14px; list-style-position: inside; }
details.va-auto[open] > summary { color: var(--ink); border-bottom: 1px solid var(--line); }
.va-empty { color: var(--muted); font-size: .8125rem; padding: 10px 14px; border-top: 1px solid var(--line); }
.va-detail { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); padding: 18px; display: grid; gap: 12px; min-width: 0; }
@media (min-width: 1180px) { .va-split.with-detail .va-detail { position: sticky; top: calc(env(safe-area-inset-top, 0px) + 76px); max-height: calc(100vh - 100px); overflow-y: auto; } }
.va-detail h3 { font: 600 1.125rem/1.3 var(--f-display); }
.va-det-head { display: flex; gap: 8px 12px; flex-wrap: wrap; align-items: center; font-size: .875rem; }
.va-item { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; padding: 12px; border: 1px solid var(--line); border-radius: var(--r-m); }
.va-item + .va-item { margin-top: 8px; }
.va-item .word { font-weight: 700; overflow-wrap: anywhere; }
.va-item .fix { font-size: .875rem; }
.va-item .note { color: var(--muted); font-size: .8125rem; overflow-wrap: anywhere; }
.va-item .note em { font-family: var(--f-display); font-style: normal; }
.va-item .act { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.va-item .spoken { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.va-item .spoken input { width: 220px; min-height: 36px; padding: 5px 9px; font-size: .875rem; }
.va-item.ignored .word { color: var(--muted); text-decoration: line-through; }
.va-item.muted .word { color: var(--muted); }
.va-badge { font-size: .6875rem; font-weight: 700; border-radius: 4px; padding: 1px 6px; margin-left: 6px; color: var(--muted); background: var(--sunk); }
.va-badge.dec { color: var(--accent); background: var(--accent-soft); }
details.va-auto-det > summary { cursor: pointer; color: var(--muted); font-size: .875rem; padding: 6px 0; }
@media (max-width: 640px) { .va-row { grid-template-columns: minmax(0, 1fr) auto 14px; } .va-row > .chip { display: none; } }

/* foreign words */
.fw-bar { display: flex; gap: 14px 20px; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; }
.fw-tools { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin: 12px 0 6px; }
.fw-tools input[type=search] { flex: 1 1 200px; width: auto; }
.fw-list { border-top: 1px solid var(--line); }
.fw-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.fw-row.native .fw-word { color: var(--muted); text-decoration: line-through; }
.fw-word { font-weight: 700; }
.fw-forms, .fw-meta { color: var(--muted); font-size: .75rem; font-weight: 400; }
.fw-example { grid-column: 1 / -1; color: var(--muted); font-size: .8125rem; font-family: var(--f-display); }
.fw-example mark { background: var(--ki-soft); color: var(--ink); border-radius: 3px; padding: 0 2px; }
.fw-actions { display: flex; gap: 6px; align-items: center; }
.fw-add { margin-top: 12px; flex-wrap: wrap; }
.fw-add > input { min-width: 200px; }
textarea.small { min-height: 120px; font: .875rem/1.5 var(--f-mono); }

/* cost scale: the only model choice */
.scale { display: grid; gap: 6px; }
.scale .ends { display: flex; justify-content: space-between; color: var(--muted); font-size: .75rem; }
.scale .now { font-weight: 700; font-size: .875rem; margin: 2px 0 6px; }
.scale .row { display: grid; grid-template-columns: minmax(8.5em, 11em) minmax(0, 1fr) 6.5em; gap: 10px; align-items: center; font-size: .875rem; padding: 6px 8px; border-radius: var(--r-s); cursor: pointer; }
.scale .row:hover { background: var(--sunk); }
.scale .row .track { height: 10px; background: var(--sunk); border-radius: 5px; overflow: hidden; }
.scale .row .fill { height: 100%; background: var(--muted); opacity: .45; border-radius: 5px; }
.scale .row.sel { background: var(--accent-soft); font-weight: 700; }
.scale .row.sel .fill { background: var(--accent); opacity: 1; }
.scale .row .val { text-align: right; font-family: var(--f-mono); font-variant-numeric: tabular-nums; }
.need-list { display: grid; grid-template-columns: auto 1fr; gap: 4px 16px; font-size: .9375rem; margin: 6px 0 0; }
/* step 5 on one screen: what needs AI next to the cost scale */
details.need > summary { cursor: pointer; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; list-style: none; }
details.need > summary::-webkit-details-marker { display: none; }
details.need > summary::before { content: "▸"; color: var(--muted); transition: transform .15s; }
details.need[open] > summary::before { transform: rotate(90deg); }
details.need > summary .sec { font: 700 .75rem var(--f-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
details.need > summary .sum { margin-left: 0; }
details.need[open] > summary { margin-bottom: 8px; }
.run-grid { display: grid; gap: 16px; align-items: start; }
@media (min-width: 1100px) { .run-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.need-list dt { color: var(--muted); }
.need-list dd { margin: 0; }
.cap { border: 1.5px solid var(--ink); border-radius: var(--r-m); padding: 14px 16px; display: grid; gap: 2px; }
/* price and start in one card: what it costs stands next to the button that starts it */
.runbar { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px 16px; align-items: center; }
.runbar > :not(.cap):not(.run-buttons) { grid-column: 1 / -1; }
.runbar .cap { border: 0; padding: 0; }
.runbar .run-buttons { justify-content: flex-end; }
.runbar:has(> .cap.hidden) .run-buttons { grid-column: 1 / -1; justify-content: flex-start; }
@media (max-width: 640px) { .runbar { grid-template-columns: 1fr; } .runbar .run-buttons { justify-content: flex-start; } }
.cap .big { font: 600 1.625rem/1.2 var(--f-display); }

/* account page */
.balance-big { font: 600 2.5rem/1.1 var(--f-display); margin: 4px 0; }
.amounts { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.amounts button.on { box-shadow: inset 0 0 0 2px var(--accent); border-color: var(--accent); }
.amounts input { width: 7em; }
.bookings { display: grid; gap: 0; }
.bookings details { border-bottom: 1px solid var(--line); }
.bookings summary { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; cursor: pointer; font-size: .9375rem; list-style: none; }
.bookings summary::-webkit-details-marker { display: none; }
.bookings summary .what { min-width: 0; overflow-wrap: anywhere; }
.bookings summary .when { display: block; color: var(--muted); font-size: .8125rem; }
.bookings summary .amt { font-family: var(--f-mono); font-weight: 700; white-space: nowrap; }
.bookings .plus { color: var(--regel); }
.bookings .receipt { padding: 0 0 12px; }

/* -- footer ------------------------------------------------------------------------------- */
.legal-footer { text-align: center; color: var(--muted); font-size: .8125rem; padding-block: 8px 32px;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.legal-footer a { color: var(--muted); }

/* -- simple pages: login, legal texts ------------------------------------------------------ */
.page-simple main { max-width: 780px; margin: 0 auto; padding-block: 28px 32px;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.page-simple article { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); padding: 24px 26px; }
.page-simple article h1 { margin-bottom: 6px; }
.page-simple article h2 { font-size: 1.1875rem; margin: 28px 0 8px; }
.page-simple article h3 { margin: 18px 0 4px; }
.page-simple article p, .page-simple article ul, .page-simple article ol { margin: 8px 0; max-width: 70ch; }
.page-simple article li { margin: 4px 0; }
.page-simple article table { border-collapse: collapse; width: 100%; font-size: .875rem; margin: 8px 0; }
.page-simple article th, .page-simple article td { border: 1px solid var(--line); padding: 7px 9px; text-align: left; vertical-align: top; }
.page-simple article th { background: var(--sunk); }
.page-simple .draft { color: var(--muted); font-size: .8125rem; margin: 0 0 14px; }
.page-simple .back { display: inline-block; margin-bottom: 14px; font-weight: 600; }
@media (max-width: 520px) { .page-simple article { padding: 18px 16px; } }

.login main { max-width: 500px; }
.login .brand { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.login .lead { color: var(--muted); }
.login .notice-box { border-radius: var(--r-m); background: var(--sunk); padding: 12px 14px 12px 16px; margin: 0 0 16px; font-size: .875rem; }
.login .notice-box strong { display: block; margin-bottom: 4px; }
.login .notice-box ul { margin: 0; padding-left: 18px; }
.login .notice-box li { margin: 4px 0; }
.login form { display: grid; gap: 10px; }
.login #code { font: 1.0625rem/1.4 var(--f-mono); letter-spacing: .04em; }
.login .err { color: var(--err); min-height: 1.4em; font-size: .875rem; }
.login .err:empty { min-height: 0; }
.login .ok-msg { font-size: .875rem; }
.login .or { margin: 10px 0 2px; }

/* Narrow phones: keep the header on one line. */
@media (max-width: 480px) {
  .app-h .badge-mode, .app-h .bal-word { display: none; }
  .app-h .in, .app-h .right { flex-wrap: nowrap; }
  .app-h .right { gap: 8px; }
  .app-h .in:has(#balChip:not(.hidden)) .wm-text { display: none; }
}
