/* Same colours as the desktop app (printconv/gui.py STYLE).
   Light and dark (Chris, 2026-11-22: "add a switch for users and default to whatever the pc is set to"):
   the PC's setting picks the colours with no script; the switch (theme.js) sets data-theme on <html> to
   override it. The drawing stays white paper with print-red values in both (--paper-red). */
:root { --blue:#1D4ED8; --ink:#16191D; --muted:#5B6470; --line:#D9DDE3; --bg:#F4F5F7; --red:#C70000;
  --surface:#fff; --button:#fff; --border-strong:#9AA4B2; --disabled:#A0A7B1; --primary-off-bg:#9DB4EE;
  --primary-off-fg:#fff; --tint:#EFF4FF; --canvas:#E9EBEF; --row-line:#EEF0F3; --row-sel:#DBEAFE; --on-ink:#fff;
  --banner-bg:#FEF3C7; --banner-fg:#78350F; --banner-line:#F59E0B;
  --st-blue-bg:#E0E7FF; --st-blue-fg:#1E3A8A; --st-check-bg:#FEF3C7; --st-check-fg:#92400E;
  --st-edit-bg:#FDE68A; --st-edit-fg:#78350F; --st-grey-bg:#E5E7EB; --st-grey-fg:#374151;
  --st-note-bg:#DBEAFE; --st-note-fg:#1E40AF; --warn:#92400E; --fine:#1E3A8A; --overlay:rgba(22,25,29,.35);
  --spin-track:#DBEAFE; --danger:#B91C1C; --danger-line:#FCA5A5; --danger-bg:#FEF2F2;
  color-scheme: light;
  --paper-red:#C70000; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --blue:#4F7DF3; --ink:#E6E8EB; --muted:#9AA3AE; --line:#30363D; --bg:#0F1216; --red:#FF6B6B;
  --surface:#171B21; --button:#1B2027; --border-strong:#3A424C; --disabled:#5B6470; --primary-off-bg:#2A3B66;
  --primary-off-fg:#8EA0C8; --tint:#172445; --canvas:#252A31; --row-line:#242A31; --row-sel:#1E2F55; --on-ink:#0F1216;
  --banner-bg:#3A2A06; --banner-fg:#FCD34D; --banner-line:#8A6A10;
  --st-blue-bg:#1E2A55; --st-blue-fg:#A5B8FF; --st-check-bg:#3A2A06; --st-check-fg:#FCD34D;
  --st-edit-bg:#4A3A08; --st-edit-fg:#FDE68A; --st-grey-bg:#2A3038; --st-grey-fg:#B6BEC8;
  --st-note-bg:#12305A; --st-note-fg:#93C5FD; --warn:#FCD34D; --fine:#A5B8FF; --overlay:rgba(0,0,0,.6);
  --spin-track:#1E2F55; --danger:#F87171; --danger-line:#7F1D1D; --danger-bg:#2A1215;
  color-scheme: dark; } }
:root[data-theme="dark"] { --blue:#4F7DF3; --ink:#E6E8EB; --muted:#9AA3AE; --line:#30363D; --bg:#0F1216; --red:#FF6B6B;
  --surface:#171B21; --button:#1B2027; --border-strong:#3A424C; --disabled:#5B6470; --primary-off-bg:#2A3B66;
  --primary-off-fg:#8EA0C8; --tint:#172445; --canvas:#252A31; --row-line:#242A31; --row-sel:#1E2F55; --on-ink:#0F1216;
  --banner-bg:#3A2A06; --banner-fg:#FCD34D; --banner-line:#8A6A10;
  --st-blue-bg:#1E2A55; --st-blue-fg:#A5B8FF; --st-check-bg:#3A2A06; --st-check-fg:#FCD34D;
  --st-edit-bg:#4A3A08; --st-edit-fg:#FDE68A; --st-grey-bg:#2A3038; --st-grey-fg:#B6BEC8;
  --st-note-bg:#12305A; --st-note-fg:#93C5FD; --warn:#FCD34D; --fine:#A5B8FF; --overlay:rgba(0,0,0,.6);
  --spin-track:#1E2F55; --danger:#F87171; --danger-line:#7F1D1D; --danger-bg:#2A1215;
  color-scheme: dark; }
@font-face { font-family: "DejaVu Sans Condensed"; src: url("/static-font/DejaVuSansCondensed.ttf") format("truetype"); }
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--ink); font: 14px "Segoe UI", Inter, system-ui, sans-serif;
       display: flex; flex-direction: column; }
h1 { font-size: 24px; margin: 0 0 4px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
button, .btn { background: var(--button); border: 1px solid var(--border-strong); border-radius: 8px; padding: 8px 16px; font: inherit;
               cursor: pointer; color: var(--ink); display: inline-block; }
button:hover { border-color: var(--blue); }
button:disabled { color: var(--disabled); border-color: var(--line); cursor: default; }
.primary { background: var(--blue); color: #fff; border-color: var(--blue); font-weight: 600; }
.primary:disabled { background: var(--primary-off-bg); border-color: var(--primary-off-bg); color: var(--primary-off-fg); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px; }

#header, #footer { background: var(--surface); display: flex; align-items: center; gap: 12px; padding: 8px 24px; }
#header { border-bottom: 1px solid var(--line); }
#footer { border-top: 1px solid var(--line); }
#header .title { font-size: 17px; font-weight: 700; flex: 1; }
#steps button { border: none; border-radius: 16px; padding: 6px 14px; color: var(--muted); background: transparent; }
#steps button.on { background: var(--blue); color: #fff; font-weight: 600; }
#footer #status { flex: 1; text-align: center; }
#footer button { min-width: 140px; min-height: 42px; }

main { flex: 1; overflow: auto; min-height: 0; }
.page { display: none; padding: 24px 32px; height: 100%; }
.page.on { display: block; }
#p-review.on { display: flex; flex-direction: column; padding: 16px 24px 8px; }
.row { display: flex; gap: 20px; margin-top: 16px; }
.grow { flex: 1; min-width: 0; }
.side { flex: 0 0 40%; }

.drop { flex: 1; min-height: 300px; background: var(--surface); border: 2px dashed var(--border-strong); border-radius: 12px; display: flex;
        flex-direction: column; align-items: center; justify-content: center; gap: 10px; cursor: pointer; }
.drop.hover { border-color: var(--blue); background: var(--tint); }
.drop .big { font-size: 18px; font-weight: 600; }
.fname { font-size: 16px; font-weight: 600; }
.thumb { margin-top: 12px; text-align: center; }
.thumb img { max-width: 100%; max-height: 420px; border: 1px solid var(--line); }
.thumb img:not([src]) { display: none; }

.choices { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 16px 0; }
.choice { text-align: left; padding: 16px; font-size: 16px; min-height: 96px; }
.choice.on { border: 2px solid var(--blue); background: var(--tint); }
.note p { margin: 6px 0 0; }

fieldset { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; margin: 14px 0 0; padding: 10px 12px;
           display: flex; flex-wrap: wrap; gap: 6px 18px; }
fieldset.col { flex-direction: column; max-width: 900px; }
legend { font-weight: 600; padding: 0 4px; }
fieldset label { display: flex; align-items: center; gap: 6px; padding: 4px 0; }
fieldset input[type=number] { width: 56px; padding: 4px; }
.keep { display: flex; gap: 8px; align-items: flex-start; margin-top: 10px; }
#preview .ex { margin: 10px 0; font-family: Consolas, monospace; }
#preview .ex .red { color: var(--red); font-weight: 600; font-size: 16px; }

.rtop { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pill { border-radius: 16px; padding: 6px 12px; }
.pill.on { background: var(--ink); color: var(--on-ink); border-color: var(--ink); font-weight: 600; }
.banner { background: var(--banner-bg); color: var(--banner-fg); border: 1px solid var(--banner-line); border-radius: 8px; padding: 10px 14px; margin-top: 8px; }
.split { flex: 1; display: flex; gap: 12px; margin-top: 10px; min-height: 0; }
.viewer { flex: 58; display: flex; flex-direction: column; min-width: 0; }
#svg { flex: 1; width: 100%; background: var(--canvas); border: 1px solid var(--line); border-radius: 8px; touch-action: none;
       cursor: grab; user-select: none; }
#svg.panning { cursor: grabbing; }
#svg .lab { cursor: move; fill: var(--paper-red); font-family: "DejaVu Sans Condensed", sans-serif; }
#svg .lab.off { opacity: .25; }
#svg .bal { cursor: move; }
#svg .bal circle { fill: rgba(255,255,255,.01); stroke: var(--paper-red); stroke-width: .5; }
#svg .bal text { fill: var(--paper-red); font-family: "DejaVu Sans Condensed", sans-serif; text-anchor: middle;
                 dominant-baseline: central; pointer-events: none; }
#svg .bal.sel circle, #svg .lab.sel { filter: drop-shadow(0 0 1.5px var(--blue)); }
#svg .box { fill: none; stroke: rgba(91,100,112,.55); stroke-width: .6; cursor: pointer; }
#svg .box.attn { stroke: #D97706; stroke-width: 1.2; fill: rgba(217,119,6,.14); }
#svg .box.sel { stroke: var(--blue); stroke-width: 1.6; fill: rgba(29,78,216,.16); }
#svg .lead { stroke: var(--paper-red); stroke-width: .35; fill: var(--paper-red); pointer-events: none; }
.tools { display: flex; gap: 8px; align-items: center; padding: 8px 0; flex-wrap: wrap; }
.tablewrap { flex: 42; overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; min-width: 0; }
table { border-collapse: collapse; width: 100%; }
th { position: sticky; top: 0; background: var(--surface); text-align: left; padding: 6px; color: var(--muted);
     border-bottom: 1px solid var(--line); font-weight: 600; }
td { padding: 5px 6px; border-bottom: 1px solid var(--row-line); vertical-align: top; }
tr.sel td { background: var(--row-sel); }
td.mono { font-family: Consolas, monospace; }
td.red { color: var(--red); font-weight: 700; font-family: Consolas, monospace; }
td.grey { color: var(--muted); font-family: Consolas, monospace; font-weight: 700; }
td.typed { color: var(--blue); font-style: italic; }
td.edit { cursor: text; }
td input.cell { width: 100%; font: inherit; padding: 2px 4px; }
td.flags { font-size: 12px; color: var(--muted); max-width: 260px; }
td.bal { color: var(--red); text-align: center; font-weight: 600; }
.st { border-radius: 6px; padding: 2px 8px; white-space: nowrap; font-size: 12px; }
.st-ready, .st-approved, .st-edited, .st-listed { background: var(--st-blue-bg); color: var(--st-blue-fg); }
.st-check { background: var(--st-check-bg); color: var(--st-check-fg); }
.st-edit { background: var(--st-edit-bg); color: var(--st-edit-fg); }
.st-excluded, .st-not_converted { background: var(--st-grey-bg); color: var(--st-grey-fg); }
.st-note { background: var(--st-note-bg); color: var(--st-note-fg); }

.actions { display: flex; gap: 10px; margin-top: 16px; }
.actions .primary { min-height: 46px; min-width: 160px; }
#files { margin-top: 16px; }
#files a { display: block; margin: 6px 0; font-size: 15px; color: var(--blue); }

#overlay { position: fixed; inset: 0; background: var(--overlay); display: flex; align-items: center; justify-content: center; z-index: 10; }
#overlay[hidden] { display: none; }
.wait { min-width: 340px; text-align: center; padding: 28px; }
#wait-msg { font-size: 16px; font-weight: 600; margin-top: 14px; }
.spinner { width: 36px; height: 36px; border: 4px solid var(--spin-track); border-top-color: var(--blue); border-radius: 50%;
           margin: 0 auto; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

body.login { align-items: center; justify-content: center; }
body.login form { width: 340px; display: flex; flex-direction: column; gap: 12px; }
body.login h1 { font-size: 20px; }
body.login input { padding: 10px; font: inherit; border: 1px solid var(--border-strong); border-radius: 8px; }
body.login .err { color: var(--red); margin: 0; }

#who { white-space: nowrap; }
#who a { color: var(--muted); }
.card.demo { width: 440px; display: flex; flex-direction: column; gap: 12px; }
.card.demo input { padding: 10px; font: inherit; border: 1px solid var(--border-strong); border-radius: 8px; }
main.admin { padding: 24px 32px; overflow: auto; }
main.admin h2 { margin-top: 28px; font-size: 18px; }
main.admin .inline { display: flex; gap: 8px; }
main.admin .inline input { padding: 8px; font: inherit; border: 1px solid var(--border-strong); border-radius: 8px; }
main.admin .ok { color: var(--fine); }
table.list { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; margin-top: 10px; }
table.list input { width: 360px; font: 12px Consolas, monospace; padding: 4px; }
.card.mine { margin-top: 20px; }
.card.mine table { width: 100%; margin-top: 8px; }
.card.mine td { border-bottom: 1px solid var(--row-line); padding: 8px 6px; }
.card.mine a { color: var(--blue); }
.err { color: var(--red); }
.card.newcode { margin: 12px 0; background: var(--tint); border-color: var(--blue); }
.card.newcode .code { font: 700 22px Consolas, monospace; letter-spacing: 2px; margin-left: 8px; }
[hidden] { display: none !important; }
.warn { color: var(--warn); }
.fine { color: var(--fine); }
form.inl { display: inline; }
#wait-bar { width: 100%; height: 14px; margin-top: 14px; accent-color: var(--blue); }
#svg .blead { stroke: var(--paper-red); stroke-width: .35; pointer-events: none; }
#svg .bal.place circle { stroke: #D97706; stroke-width: .9; stroke-dasharray: 1.6 .9; fill: rgba(254,243,199,.85); }
#svg .bal.place text { fill: #B45309; font-weight: 700; }
#svg .blead.place { stroke: #D97706; }
.card.mine td.del { text-align: right; width: 1%; white-space: nowrap; }
button.danger { color: var(--danger); border-color: var(--danger-line); }
button.danger:hover { border-color: var(--danger); background: var(--danger-bg); }
#svg.boxing { cursor: crosshair; }
#svg .band { fill: rgba(29,78,216,.10); stroke: var(--blue); stroke-width: .8; stroke-dasharray: 3 2; pointer-events: none; }
.tools button.on { background: var(--blue); color: #fff; border-color: var(--blue); }
.privacy-link { color: var(--muted); }
body.privacy { overflow: auto; }
.privacy-note { max-width: 760px; margin: 32px auto; padding: 28px 32px; }
.privacy-note h1 { font-size: 26px; }
.privacy-note h2 { font-size: 16px; margin: 22px 0 4px; }
.privacy-note p { line-height: 1.5; margin: 4px 0; }
ul.terms { padding-left: 20px; line-height: 1.5; }
ul.terms li { margin: 6px 0; }
.gdt-box { margin-bottom: 4px; color: var(--ink); }
.gdt-box select { margin-top: 3px; font: inherit; max-width: 200px; }
.gdt-box label { white-space: nowrap; }
.gdt-box.asking { background: var(--banner-bg); border: 1px solid var(--banner-line); border-radius: 6px; padding: 6px; }
.gdt-ask { color: var(--warn); font-size: 12px; margin-bottom: 4px; }
#theme { padding: 4px 12px; font-size: 12px; white-space: nowrap; }
