/* Brand: purple and white, DIN (files in ./fonts, same ones as the inventory app). */
@font-face { font-family: 'DIN'; src: url('https://brwdgbitxisadwbuwbdi.supabase.co/storage/v1/object/public/fonts/DIN-Regular.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'DIN'; src: url('https://brwdgbitxisadwbuwbdi.supabase.co/storage/v1/object/public/fonts/DIN-Medium.woff2') format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'DIN'; src: url('https://brwdgbitxisadwbuwbdi.supabase.co/storage/v1/object/public/fonts/DIN-Bold.woff2') format('woff2'); font-weight: 700; font-display: swap; }
:root {
  --p900: #3a0a2e;  /* darkest, nudged toward red */
  --p700: #5b1348;
  --p500: #86306f;
  --p300: #c79bbd;
  --p100: #f1e4ee;
  --p50: #faf5f9;
  --ink: #26121f;
  --muted: #7a6674;
  --line: #e3d3df;
  --ok: #1d7a4d;
  --bad: #b3261e;
  --font: 'DIN', 'DIN Alternate', 'Barlow', 'Segoe UI', system-ui, -apple-system, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: var(--font); color: var(--ink); background: #fff; font-size: 16px; line-height: 1.45; }
.top { background: var(--p900); color: #fff; display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; gap: 12px; }
.brand { font-weight: 700; letter-spacing: .02em; font-size: 18px; }
.brand span { color: var(--p300); font-weight: 400; }
#who { font-size: 13px; color: var(--p100); text-align: right; }
#who button { margin-left: 8px; }
.tabs { display: flex; gap: 4px; overflow-x: auto; padding: 8px 16px 0; background: var(--p100); border-bottom: 2px solid var(--p700); }
.tabs button { background: transparent; border: 0; color: var(--p700); padding: 10px 14px; font: inherit; font-weight: 700; cursor: pointer; border-radius: 8px 8px 0 0; white-space: nowrap; }
.tabs button.on { background: var(--p700); color: #fff; }
.subtabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 16px; }
.subtabs button { background: var(--p100); color: var(--p700); border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; font: inherit; font-size: 14px; cursor: pointer; }
.subtabs button.on { background: var(--p500); color: #fff; border-color: var(--p500); }
.wrap { max-width: 980px; margin: 0 auto; padding: 16px; }
h1, h2, h3 { color: var(--p900); margin: 0 0 8px; }
h2 { font-size: 20px; } h3 { font-size: 16px; margin-top: 20px; }
.muted { color: var(--muted); font-size: 14px; }
.card { background: var(--p50); border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin: 0 0 14px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 8px 0; }
label { display: block; font-size: 13px; color: var(--muted); margin: 8px 0 2px; }
input, select, textarea { font: inherit; padding: 9px 10px; border: 1px solid var(--p300); border-radius: 8px; background: #fff; color: var(--ink); max-width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--p500); outline-offset: 1px; }
textarea { width: 100%; min-height: 90px; }
.grow { flex: 1 1 200px; }
button.btn, button.ghost, button.danger { font: inherit; font-weight: 700; padding: 9px 14px; border-radius: 8px; border: 1px solid var(--p700); cursor: pointer; }
button.btn { background: var(--p700); color: #fff; }
button.btn:hover { background: var(--p900); }
button.ghost { background: #fff; color: var(--p700); }
button.danger { background: #fff; color: var(--bad); border-color: var(--bad); }
button:disabled { opacity: .5; cursor: default; }
.who-btn { background: transparent; border: 1px solid var(--p300); color: #fff; border-radius: 6px; padding: 3px 8px; font: inherit; font-size: 12px; cursor: pointer; }
.scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: var(--p100); color: var(--p900); position: sticky; top: 0; }
td.num, th.num { text-align: right; }
.pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; background: var(--p100); color: var(--p700); }
.pill.ok { background: #dff2e7; color: var(--ok); }
.pill.bad { background: #f9dedc; color: var(--bad); }
.pick { border: 1px solid var(--line); border-radius: 8px; margin-top: 4px; background: #fff; }
.pick button { display: block; width: 100%; text-align: left; background: #fff; border: 0; border-bottom: 1px solid var(--line); padding: 8px 10px; font: inherit; cursor: pointer; }
.pick button:hover { background: var(--p100); }
.total { font-size: 28px; font-weight: 700; color: var(--p700); }
.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--p900); color: #fff; padding: 10px 16px; border-radius: 10px; max-width: 90vw; z-index: 9; }
.toast.err { background: var(--bad); }
pre.out { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 10px; white-space: pre-wrap; font-size: 13px; max-height: 260px; overflow: auto; }
.login { max-width: 380px; margin: 40px auto; }
@media (max-width: 600px) { th, td { padding: 6px 6px; font-size: 13px; } }

/* ---- portal additions ---- */
a { color: var(--p700); }
.brand { color: #fff; text-decoration: none; }
.tabs a { background: transparent; border: 0; color: var(--p700); padding: 10px 14px; font-weight: 700; border-radius: 8px 8px 0 0; white-space: nowrap; text-decoration: none; }
.tabs a.on { background: var(--p700); color: #fff; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0; }
.chip { background: var(--p100); color: var(--p700); border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; font: inherit; font-size: 14px; cursor: pointer; }
.chip.on { background: var(--p500); color: #fff; border-color: var(--p500); }
.list { display: grid; gap: 10px; }
a.item, div.item { display: block; text-decoration: none; color: inherit; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
a.item:hover { border-color: var(--p500); }
.item .t { font-weight: 700; color: var(--p900); font-size: 17px; }
.item .s { color: var(--muted); font-size: 14px; margin-top: 2px; }
.item .meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; align-items: center; }
.pill.warn { background: #fff2d6; color: #8a5a00; }
.pill.dark { background: var(--p700); color: #fff; }
.hero { background: var(--p900); color: #fff; border-radius: 14px; padding: 18px 16px; margin: 0 0 14px; }
.hero h1 { color: #fff; font-size: 24px; margin: 4px 0 6px; }
.hero .muted { color: var(--p300); }
.qr { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 8px; display: inline-block; line-height: 0; }
.qr svg { width: min(72vw, 300px); height: auto; }
.qr.big svg { width: min(86vw, 460px); }
.bigcode { font-size: 40px; font-weight: 700; letter-spacing: .12em; color: var(--p700); }
.bar { height: 10px; background: var(--p100); border-radius: 999px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--p500); }
.bar.over > i { background: var(--bad); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: 14px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; }
.neg { color: var(--bad); font-weight: 700; }
.good { color: var(--ok); font-weight: 700; }
.stack > * + * { margin-top: 10px; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.stat b { display: block; font-size: 24px; color: var(--p700); }
.stat span { font-size: 13px; color: var(--muted); }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--p700); }
label.chk { display: flex; gap: 8px; align-items: center; color: var(--ink); font-size: 15px; margin: 6px 0; }
td input, td select { padding: 6px 8px; width: 100%; min-width: 70px; }
td input[type=number] { min-width: 80px; }
video.scan { width: 100%; max-width: 420px; border-radius: 12px; background: #000; }
.sheet td.cell input { text-align: right; }
.sub { font-size: 13px; color: var(--muted); }
.sticky { position: sticky; bottom: 0; background: #fff; padding: 10px 0; border-top: 1px solid var(--line); }

a.btn-link { display: inline-block; font-weight: 700; padding: 9px 14px; border-radius: 8px; border: 1px solid var(--p700); text-decoration: none; background: #fff; color: var(--p700); }
a.btn-link.solid { background: var(--p700); color: #fff; }
.qr svg { max-width: 100%; }
.qr.big svg { width: min(72vw, 420px); }
.stack > .card { overflow: hidden; }

/* Write-up text editor: keep it on brand and only offer headings the website can show */
#p-body .toastui-editor-defaultUI { border-color: var(--p300); border-radius: 8px; }
#p-body .toastui-editor-popup-add-heading [data-level="5"],
#p-body .toastui-editor-popup-add-heading [data-level="6"],
.toastui-editor-popup-add-heading [data-level="5"],
.toastui-editor-popup-add-heading [data-level="6"] { display: none; }
.toastui-editor-contents img { max-width: 100%; height: auto; border-radius: 8px; }
.card .toastui-editor-contents { font-size: 1rem; }

/* Editor text uses the portal font (DIN) with clear spacing between paragraphs */
.toastui-editor-defaultUI, .toastui-editor-contents, .toastui-editor-contents p, .toastui-editor-contents li,
.toastui-editor-contents h1, .toastui-editor-contents h2, .toastui-editor-contents h3, .toastui-editor-contents h4,
.toastui-editor-contents td, .toastui-editor-contents th, .toastui-editor-contents blockquote,
.ProseMirror, .toastui-editor-ww-container .ProseMirror, .toastui-editor-defaultUI-toolbar button,
.toastui-editor-popup, .toastui-editor-popup input, .toastui-editor-popup button { font-family: var(--font) !important; }
.toastui-editor-contents { font-size: 16px; line-height: 1.5; color: var(--ink); }
.toastui-editor-contents p { margin: 0 0 12px; min-height: 1.5em; }
.toastui-editor-contents h2 { color: var(--p900); font-size: 22px; border-bottom: 0; margin: 20px 0 8px; }
.toastui-editor-contents h3 { color: var(--p900); font-size: 18px; margin: 16px 0 6px; }

/* An empty new line must keep its height so the caret can move down onto it */
.ProseMirror p > br:only-child, .ProseMirror br.ProseMirror-trailingBreak { display: inline !important; }
.ProseMirror p { min-height: 1.5em; }

/* ---- policy app ---- */
.ref { display: inline-block; font-weight: 700; color: var(--p500); letter-spacing: .02em; }
.clause.repealed { opacity: .55; }
.md .toastui-editor-contents { font-size: 15px; }
.md .toastui-editor-contents table { font-size: 14px; }
.diff { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; white-space: pre-wrap; font-size: 14px; max-height: 420px; overflow: auto; }
.diff del { background: #f9dedc; color: var(--bad); text-decoration: line-through; }
.diff ins { background: #dff2e7; color: var(--ok); text-decoration: underline; }
ul.votes { list-style: none; margin: 10px 0 0; padding: 0; }
ul.votes li { padding: 6px 0; border-top: 1px solid var(--line); font-size: 14px; }
.comment { border-top: 1px solid var(--line); padding: 8px 0; font-size: 14px; }
.row textarea, .card textarea { width: 100%; }
details summary { cursor: pointer; color: var(--p700); font-weight: 700; margin: 8px 0; }

label + input.grow { width: 100%; }
.row > div:has(> label + input.grow) { flex: 1 1 260px; }

/* ---- white, document-first: no tinted backgrounds. Only the one dark purple is used for emphasis. ---- */
:root { --p50: #fff; --p100: #fff; --p300: #b9a3b5; }
.pill { border: 1px solid var(--line); background: #fff; color: var(--p900); }
.pill.ok, .pill.bad, .pill.warn { background: #fff; }
.pill.ok { border-color: var(--ok); } .pill.bad { border-color: var(--bad); } .pill.warn { border-color: var(--p700); color: var(--p900); }
.pill.dark { background: var(--p900); color: #fff; border-color: var(--p900); }
.tabs { background: #fff; border-bottom: 1px solid var(--line); }
.tabs a { color: var(--ink); } .tabs a.on { background: #fff; color: var(--p900); box-shadow: inset 0 -3px 0 var(--p900); border-radius: 0; }
.card { background: #fff; }
.hero { background: #fff; color: var(--ink); border: 0; border-bottom: 1px solid var(--line); border-radius: 0; padding: 18px 0 14px; }
.hero h1 { color: var(--p900); } .hero .muted { color: var(--muted); }
.chip { background: #fff; color: var(--ink); } .chip.on { background: var(--p900); border-color: var(--p900); color: #fff; }
th { background: #fff; border-bottom: 2px solid var(--p900); }
.toastui-editor-defaultUI-toolbar { background: #fff; }
.diff { background: #fff; }
button.ghost:hover, a.btn-link:hover { background: #fff; border-color: var(--p900); }

/* Print / Save as PDF: just the document. */
@media print {
  .top, .tabs, .noprint, .toast, .row button, .row a.btn-link, #who { display: none !important; }
  body { background: #fff; }
  .wrap { max-width: none; padding: 0; }
  .card.clause { border: 0; border-bottom: 1px solid var(--line); border-radius: 0; break-inside: avoid; padding: 8px 0; }
}
