  /* Layout: an editor's desk. Choices on the left, a live mock of tomorrow's front page pinned on the right. */
  :root {
    --bg: #eef0f3; --surface: #ffffff; --ink: #15181e; --muted: #5a616d; --line: #d6dae1;
    --accent: #1d4ed8; --accent-soft: #e3eafc; --on-accent: #ffffff; --sheet: #fbfbf9; --good: #1a7f4b; --bad: #b42318;
    --display: "Newsreader", Georgia, "Times New Roman", serif;
    --ui: "Public Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
    --mast: "UnifrakturMaguntia", "Old English Text MT", Georgia, serif;
  }
  @media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
    --bg: #111318; --surface: #1a1d23; --ink: #eceef2; --muted: #9ba2ae; --line: #2d323b;
    --accent: #86a6ff; --accent-soft: #232c45; --on-accent: #0d1220; --sheet: #f4f4f1; --good: #4cc38a; --bad: #ff8a80; color-scheme: dark } }
  :root[data-theme="dark"] {
    --bg: #111318; --surface: #1a1d23; --ink: #eceef2; --muted: #9ba2ae; --line: #2d323b;
    --accent: #86a6ff; --accent-soft: #232c45; --on-accent: #0d1220; --sheet: #f4f4f1; --good: #4cc38a; --bad: #ff8a80; color-scheme: dark }

  * { box-sizing: border-box; }
  body { background: var(--bg); color: var(--ink); font: 15px/1.5 var(--ui); }
  .wrap { max-width: 1120px; margin: 0 auto; padding-block: 28px 120px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
  header.top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 22px; }
  .brand { font-family: var(--display); font-weight: 700; font-size: 30px; letter-spacing: -.01em; }
  .brand small { display: block; font: 500 13px/1.4 var(--ui); color: var(--muted); letter-spacing: 0; }
  .delivery-note { font-size: 13px; color: var(--muted); }
  .delivery-note b { color: var(--ink); font-weight: 600; }

  .layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 28px; align-items: start; }

  .panel { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 20px; display: grid; gap: 14px; }
  .panel.key { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
  .stack { display: grid; gap: 18px; }
  h2 { font-family: var(--display); font-weight: 700; font-size: 21px; margin: 0; text-wrap: balance; }
  .hint { color: var(--muted); font-size: 13.5px; margin: -8px 0 0; }
  label.field { display: grid; gap: 6px; font-weight: 600; font-size: 13.5px; min-width: 0; }
  label.field span.sub { font-weight: 400; color: var(--muted); }
  input[type=text], input[type=email] { width: 100%; font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
  input:focus-visible, button:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
  .row2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
  .err { color: var(--bad); font-size: 12.5px; font-weight: 500; }

  /* Delivery choices */
  .methods { display: grid; gap: 10px; }
  .method { display: flex; gap: 12px; align-items: flex-start; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; cursor: pointer; }
  .method:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
  .method input { margin-top: 4px; accent-color: var(--accent); width: 16px; height: 16px; flex: none; }
  .method b { display: block; font-weight: 600; }
  .method span { color: var(--muted); font-size: 13px; }
  details.help { border-top: 1px solid var(--line); padding-top: 10px; }
  details.help summary { cursor: pointer; font-weight: 600; font-size: 13.5px; color: var(--accent); }
  .help dl { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px 14px; margin: 12px 0 0; font-size: 13.5px; }
  .help dt { font-weight: 600; }
  .help dd { margin: 0; color: var(--muted); }
  .help code { font-size: 12.5px; background: var(--bg); padding: 1px 5px; border-radius: 4px; color: var(--ink); }
  @media (max-width: 520px) { .help dl { grid-template-columns: minmax(0, 1fr); gap: 2px; } .help dd { margin-bottom: 8px; } }
  .switch { display: flex; gap: 10px; align-items: center; font-weight: 500; font-size: 14px; cursor: pointer; }
  .switch input { accent-color: var(--accent); width: 16px; height: 16px; }

  /* Sections: one row each, with an amount control */
  .sections { display: grid; }
  .sec { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 14px; align-items: center; padding: 11px 0; border-top: 1px solid var(--line); }
  .sec:first-child { border-top: 0; padding-top: 0; }
  .sec .nm { font-weight: 600; }
  .sec .ds { color: var(--muted); font-size: 13px; }
  .seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
  .seg button { font: 500 12.5px var(--ui); color: var(--muted); background: transparent; border: 0; padding: 7px 10px; cursor: pointer; border-left: 1px solid var(--line); }
  .seg button:first-child { border-left: 0; }
  .seg button[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }
  .seg button[aria-pressed="true"][data-v="0"] { background: var(--line); color: var(--ink); }
  @media (max-width: 520px) { .sec { grid-template-columns: minmax(0, 1fr); } }

  /* Chips */
  .chips { display: flex; flex-wrap: wrap; gap: 8px; }
  .chip { font: 500 13px var(--ui); border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 999px; padding: 6px 12px; cursor: pointer; }
  .chip[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); }
  .chip[aria-pressed="true"]::before { content: "✓ "; color: var(--accent); font-weight: 700; }
  .tags { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; border: 1px solid var(--line); background: var(--bg); border-radius: 8px; padding: 6px; }
  .tags input { flex: 1 1 140px; border: 0; background: transparent; padding: 5px 6px; min-width: 0; }
  .tags input:focus-visible { outline: none; }
  .tags:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
  .tag { display: inline-flex; align-items: center; gap: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 3px 4px 3px 9px; font-size: 13px; }
  .tag button { border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 15px; line-height: 1; padding: 2px 5px; border-radius: 4px; }
  .tag button:hover { color: var(--ink); background: var(--line); }

  .toggles { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 10px; }
  .tg { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; cursor: pointer; }
  .tg input { margin-top: 3px; accent-color: var(--accent); width: 16px; height: 16px; flex: none; }
  .tg b { display: block; font-weight: 600; font-size: 14px; }
  .tg span { color: var(--muted); font-size: 12.5px; }

  /* Feedback */
  .rate { display: flex; gap: 10px; flex-wrap: wrap; }
  .rate button { font: 600 14px var(--ui); border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 8px; padding: 9px 16px; cursor: pointer; }
  .rate button[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); }
  textarea { width: 100%; min-height: 70px; font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; resize: vertical; }
  .fb-row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
  .btn-quiet { font: 600 13.5px var(--ui); background: transparent; color: var(--accent); border: 1px solid var(--accent); border-radius: 8px; padding: 8px 14px; cursor: pointer; }
  .btn-quiet[disabled] { opacity: .45; cursor: default; }

  /* Live front-page mock: always printed paper, so it keeps its own light colors in both themes */
  .preview-col { position: sticky; top: calc(env(safe-area-inset-top, 0px) + 16px); display: grid; gap: 10px; }
  .preview-label { font: 600 11.5px var(--ui); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
  .sheet { background: var(--sheet); color: #16181c; border-radius: 4px; box-shadow: 0 1px 2px rgba(0,0,0,.08), 0 8px 24px rgba(0,0,0,.08); padding: 16px 16px 14px; aspect-ratio: 8.5 / 11; max-width: 100%; overflow: hidden; display: flex; flex-direction: column; gap: 7px; font-family: var(--display); }
  .s-folio { display: grid; grid-template-columns: 1fr auto 1fr; font: 600 7.5px var(--ui); letter-spacing: .08em; text-transform: uppercase; border-bottom: 1px solid #222; padding-bottom: 3px; gap: 6px; }
  .s-folio :last-child { text-align: right; }
  .s-mast { text-align: center; font-family: var(--mast); font-size: 26px; line-height: 1.05; overflow-wrap: anywhere; }
  .s-by { text-align: center; font: 600 6.5px var(--ui); letter-spacing: .2em; text-transform: uppercase; margin-top: -4px; }
  .s-date { display: grid; grid-template-columns: 1fr auto; border-top: 2px solid #222; border-bottom: 1px solid #222; padding: 2px 0; font: 600 7px var(--ui); letter-spacing: .05em; text-transform: uppercase; }
  .s-date :last-child { text-align: right; }
  .s-ears { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
  .s-ear { border: 1px solid #222; padding: 4px 5px; font: 500 7.5px/1.3 var(--ui); min-height: 30px; }
  .s-ear b { display: block; font-size: 6.5px; letter-spacing: .08em; text-transform: uppercase; }
  .s-lead { font-weight: 700; font-size: 15px; line-height: 1.1; }
  .s-lines { display: grid; gap: 3px; }
  .s-lines i { display: block; height: 3px; background: #c9ccd1; border-radius: 2px; }
  .s-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; flex: 1; min-height: 0; }
  .s-sec { font: 700 7px var(--ui); letter-spacing: .1em; text-transform: uppercase; border-top: 2px solid #222; padding-top: 2px; margin-bottom: 3px; }
  .s-list { display: grid; gap: 5px; align-content: start; }
  .s-foot { font: 500 6.5px var(--ui); color: #444; border-top: 1px solid #222; padding-top: 3px; display: flex; justify-content: space-between; gap: 6px; }
  .plan { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; font-size: 13px; display: grid; gap: 6px; }
  .plan b { font-weight: 600; }
  .plan ol { margin: 0; padding-left: 18px; color: var(--muted); }
  .plan ol li b { color: var(--ink); }

  /* Save bar */
  .savebar { position: fixed; left: 0; right: 0; bottom: 0; background: var(--surface); border-top: 1px solid var(--line); padding-block: 12px calc(12px + env(safe-area-inset-bottom, 0px)); padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
  .savebar .in { max-width: 1120px; margin: 0 auto; display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
  .status { font-size: 13.5px; color: var(--muted); }
  .status.ok { color: var(--good); }
  .status.bad { color: var(--bad); }
  .btn { font: 600 14.5px var(--ui); background: var(--accent); color: var(--on-accent); border: 0; border-radius: 8px; padding: 11px 20px; cursor: pointer; }
  .btn[disabled] { opacity: .45; cursor: default; }
  @media (prefers-reduced-motion: no-preference) { .seg button, .chip, .btn, .method { transition: background-color .15s, color .15s, border-color .15s; } }
  body { margin: 0; }
  [hidden] { display: none !important; }
  img { max-width: 100%; }
  .signin { max-width: 440px; margin: 48px auto; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 28px; display: grid; gap: 14px; }
  .signin h1 { font-family: var(--mast); font-weight: 400; font-size: 44px; line-height: 1; margin: 0; text-align: center; }
  .signin .lede { text-align: center; color: var(--muted); margin: -4px 0 6px; }
  .signin ol { margin: 0; padding-left: 20px; color: var(--muted); font-size: 14px; display: grid; gap: 4px; }
  .signin ol b { color: var(--ink); }
  .who { font-size: 13px; color: var(--muted); display: flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
  .device-note { margin: 0; font-size: 13px; color: var(--ink); background: var(--accent-soft); border-radius: 8px; padding: 8px 12px; }
  #gate .linkbtn { justify-self: center; }
  .linkbtn { background: none; border: 0; color: var(--accent); font: 600 13px var(--ui); cursor: pointer; padding: 0; }

  /* Phones and narrow windows: one column, and the preview scrolls with the page instead of staying pinned.
     Kept last so it overrides the desktop rules above. */
  @media (max-width: 900px) {
    .layout { grid-template-columns: minmax(0, 1fr); }
    .preview-col { order: -1; position: static; justify-items: center; }
    .preview-label { justify-self: start; }
    .sheet { width: min(100%, 300px); }
    .plan { display: none; }
  }
