/* Shout panel. One stylesheet, light and dark, no build step. */
:root {
  --paper: #f5f2ec; --card: #ffffff; --ink: #17191e; --muted: #6a707c; --line: #e2ddd3; --soft: #efebe3;
  --link: #c63e0c; --accent: #ff5a1f; --accent-dark: #d9450f; --accent-ink: #ffffff; --accent-soft: #fff0e9;
  --ok: #1c8f4e; --ok-soft: #e4f5ea; --warn: #b86e00; --warn-soft: #fdf1dc; --bad: #cf3636; --bad-soft: #fde9e9;
  --radius: 10px; --shadow: 0 1px 2px rgba(20, 18, 12, .06), 0 6px 20px rgba(20, 18, 12, .05);
  --font: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #101216; --card: #191c22; --ink: #eceef2; --muted: #9aa1ad; --line: #2b2f39; --soft: #20242c;
    --link: #ff8a5c; --accent-soft: #3a2015; --ok-soft: #153023; --warn-soft: #3a2c10; --bad-soft: #3b1a1a;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
  }
}
:root[data-theme="dark"] {
  --paper: #101216; --card: #191c22; --ink: #eceef2; --muted: #9aa1ad; --line: #2b2f39; --soft: #20242c;
  --link: #ff8a5c; --accent-soft: #3a2015; --ok-soft: #153023; --warn-soft: #3a2c10; --bad-soft: #3b1a1a;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 15px/1.5 var(--font); }
a { color: var(--link); }
h1 { font-size: 26px; line-height: 1.2; letter-spacing: -.02em; font-weight: 800; margin: 0 0 4px; }
h2 { font-size: 17px; font-weight: 700; margin: 0 0 10px; letter-spacing: -.01em; }
h3 { font-size: 14px; font-weight: 700; margin: 0 0 6px; }
p { margin: 0 0 10px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-family: var(--mono); font-size: 13px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.hide { display: none !important; }

/* icons: line drawings that take the colour and size of the text beside them */
.ic { width: 1.2em; height: 1.2em; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vertical-align: -0.22em; }
.side .ic { width: 18px; height: 18px; opacity: .8; }
.side a.on .ic { opacity: 1; }
.top .tlink { display: inline-flex; align-items: center; gap: 6px; }
details.item > summary .ttl .ic { vertical-align: -0.2em; }

/* top bar */
.top { display: flex; align-items: center; gap: 14px; padding: 0 20px; height: 56px; background: var(--ink); color: #fff; position: sticky; top: 0; z-index: 30; }
:root[data-theme="dark"] .top { background: #07080a; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .top { background: #07080a; } }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 900; font-size: 20px; letter-spacing: -.03em; color: #fff; text-decoration: none; }
.brand svg { width: 26px; height: 26px; }
.brand b { color: var(--accent); }
.top .grow { flex: 1; }
.top select { background: #2a2d35; color: #fff; border: 1px solid #3a3e48; border-radius: 8px; padding: 6px 10px; font: inherit; max-width: 42vw; }
.top a.tlink, .top button.tlink { color: #cfd3da; text-decoration: none; background: none; border: 0; font: inherit; cursor: pointer; padding: 6px 8px; border-radius: 8px; }
.top a.tlink:hover, .top button.tlink:hover { color: #fff; background: #2a2d35; }
.top form { margin: 0; }

/* shell */
.shell { display: grid; grid-template-columns: 216px minmax(0, 1fr); min-height: calc(100vh - 56px); }
.shell.nonav { grid-template-columns: minmax(0, 1fr); }
.side { padding: 18px 12px; border-right: 1px solid var(--line); position: sticky; top: 56px; align-self: start; height: calc(100vh - 56px); overflow: auto; }
.side a { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 8px; color: var(--ink); text-decoration: none; font-weight: 600; font-size: 14px; }
.side a:hover { background: var(--soft); }
.side a.on { background: var(--ink); color: var(--paper); }
.side .sep { height: 1px; background: var(--line); margin: 10px 4px; }
.side .tname { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: 2px 12px 10px; font-weight: 700; }
.main { padding: 26px 30px 60px; max-width: 1180px; width: 100%; }
.main.wide { max-width: none; padding: 0; }
.head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.head .grow { flex: 1; min-width: 200px; }
.head p { margin: 0; color: var(--muted); }

/* building blocks */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; margin-bottom: 18px; }
.card.flush { padding: 0; overflow: hidden; }
.card > h2:first-child { margin-top: 0; }
.grid { display: grid; gap: 18px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.stat .n { font-size: 30px; font-weight: 800; letter-spacing: -.03em; line-height: 1.1; }
.stat .l { color: var(--muted); font-size: 13px; }
.flash { background: var(--ok-soft); color: var(--ok); border: 1px solid color-mix(in srgb, var(--ok) 30%, transparent); padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; font-weight: 600; }
.alert { background: var(--bad-soft); color: var(--bad); border: 1px solid color-mix(in srgb, var(--bad) 30%, transparent); padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; font-weight: 600; }
.note { background: var(--warn-soft); color: var(--warn); border-radius: 8px; padding: 10px 14px; margin-bottom: 16px; }
.pill { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 700; background: var(--soft); color: var(--muted); white-space: nowrap; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.acc { background: var(--accent-soft); color: var(--accent-dark); }

/* buttons, forms */
button, .btn { font: inherit; font-weight: 700; font-size: 14px; border-radius: 8px; border: 1px solid var(--line); background: var(--card); color: var(--ink); padding: 8px 14px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; line-height: 1.2; }
button:hover, .btn:hover { border-color: var(--muted); }
button.primary, .btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
button.primary:hover, .btn.primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
button.danger { color: var(--bad); }
button.quiet, .btn.quiet { border-color: transparent; background: none; color: var(--muted); padding: 6px 8px; }
button.quiet:hover, .btn.quiet:hover { background: var(--soft); color: var(--ink); }
button.sm, .btn.sm { padding: 5px 10px; font-size: 13px; }
button:disabled { opacity: .5; cursor: default; }
input[type=text], input[type=email], input[type=password], input[type=search], input[type=date], input[type=number], input[type=url], select, textarea {
  font: inherit; color: var(--ink); background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; width: 100%; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
textarea { min-height: 90px; resize: vertical; }
label { font-weight: 600; font-size: 13px; display: block; margin-bottom: 4px; }
label.check { display: flex; gap: 9px; align-items: flex-start; font-weight: 500; font-size: 14px; margin: 8px 0; cursor: pointer; }
label.check input { margin-top: 3px; accent-color: var(--accent); width: 16px; height: 16px; flex: none; }
label.check small { display: block; color: var(--muted); font-weight: 400; }
.field { margin-bottom: 14px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.row > * { flex: 1; min-width: 150px; }
.row > .fit { flex: none; min-width: 0; }
.actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
form.inline { display: inline; margin: 0; }
select[multiple] { min-height: 110px; padding: 4px; }

/* tables */
table { border-collapse: collapse; width: 100%; }
th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
tr.link { cursor: pointer; }
tr.link:hover td { background: var(--soft); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tscroll { overflow-x: auto; }
.empty { padding: 28px; text-align: center; color: var(--muted); }

/* avatar */
.av { width: 34px; height: 34px; border-radius: 50%; background: var(--soft); color: var(--muted); display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: 12px; overflow: hidden; flex: none; }
.av img { width: 100%; height: 100%; object-fit: cover; }
.who { display: flex; gap: 10px; align-items: center; }

/* bar chart */
.chart svg { width: 100%; height: auto; display: block; }
.chart rect { fill: var(--accent); }
.chart rect:hover { fill: var(--accent-dark); }
.chart text { fill: var(--muted); font-size: 11px; }
.hbar { display: grid; grid-template-columns: minmax(120px, 34%) 1fr 54px; gap: 10px; align-items: center; padding: 5px 0; font-size: 14px; }
.hbar .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar .b { height: 10px; border-radius: 6px; background: var(--soft); overflow: hidden; }
.hbar .b i { display: block; height: 100%; background: var(--accent); border-radius: 6px; }
.hbar .n { text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; }

/* setup checklist */
.steps { list-style: none; margin: 0; padding: 0; counter-reset: s; }
.steps li { display: flex; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); align-items: flex-start; }
.steps li:last-child { border-bottom: 0; }
.steps li::before { counter-increment: s; content: counter(s); width: 24px; height: 24px; border-radius: 50%; background: var(--soft); color: var(--muted); font-weight: 800; font-size: 12px; display: flex; align-items: center; justify-content: center; flex: none; }
.steps li.done::before { content: "\2713"; background: var(--ok); color: #fff; }
.steps li.done { color: var(--muted); }

/* disclosure cards (rules, banners) */
details.item { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 12px; box-shadow: var(--shadow); }
details.item > summary { list-style: none; cursor: pointer; padding: 14px 18px; display: flex; gap: 12px; align-items: center; }
details.item > summary::-webkit-details-marker { display: none; }
details.item > summary .ord { width: 26px; height: 26px; border-radius: 50%; background: var(--ink); color: var(--paper); font-weight: 800; font-size: 12px; display: flex; align-items: center; justify-content: center; flex: none; }
details.item > summary .ttl { font-weight: 700; flex: 1; min-width: 0; }
details.item > summary .ttl small { display: block; font-weight: 400; color: var(--muted); }
details.item[open] > summary { border-bottom: 1px solid var(--line); }
details.item > .body { padding: 18px; }
details.item.new > summary { color: var(--accent-dark); }

.whobox .whosome { display: none; }
.whobox.some .whosome { display: block; padding: 12px 14px 2px; margin-bottom: 14px; border-left: 3px solid var(--accent); background: var(--soft); border-radius: 0 8px 8px 0; }

/* signature preview frames */
.sigframe { width: 100%; border: 0; background: #fff; border-radius: 8px; min-height: 120px; display: block; }
.sigbox { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 14px; overflow: auto; }
.sigcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 18px; }
.sigcard { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; display: flex; flex-direction: column; }
.sigcard .pv { background: #fff; height: 170px; overflow: hidden; border-bottom: 1px solid var(--line); position: relative; }
.sigcard .pv iframe { border: 0; width: 200%; height: 340px; transform: scale(.5); transform-origin: 0 0; pointer-events: none; }
.sigcard .meta { padding: 12px 16px; flex: 1; }
.sigcard .meta b { font-size: 15px; }
.sigcard .foot { padding: 10px 12px; border-top: 1px solid var(--line); display: flex; gap: 6px; align-items: center; }
.presets { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.presets label { border: 1px solid var(--line); border-radius: 8px; padding: 12px; cursor: pointer; font-weight: 700; background: var(--card); margin: 0; }
.presets label small { display: block; font-weight: 400; color: var(--muted); margin-top: 2px; }
.presets input { position: absolute; opacity: 0; }
.presets label:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }

/* sign-in and public pages */
.center { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.center .card { width: 100%; max-width: 400px; padding: 28px; }
.center .brand { color: var(--ink); font-size: 28px; margin-bottom: 18px; }
.faces { display: flex; gap: 12px; justify-content: center; margin: 14px 0 18px; }
.faces label { font-size: 40px; cursor: pointer; padding: 8px 12px; border-radius: 14px; border: 2px solid transparent; margin: 0; line-height: 1; }
.faces input { position: absolute; opacity: 0; }
.faces label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }

pre.code { background: #15171c; color: #e6e8ec; border-radius: 8px; padding: 14px 16px; overflow: auto; font: 12.5px/1.55 var(--mono); margin: 0 0 10px; white-space: pre; }
.kv { display: grid; grid-template-columns: 180px 1fr; gap: 6px 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }

@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line); display: flex; overflow-x: auto; padding: 8px 10px; gap: 4px; }
  .side a { white-space: nowrap; padding: 7px 11px; }
  .side .sep, .side .tname { display: none; }
  .main { padding: 18px 14px 50px; }
  .g2, .g3, .g4 { grid-template-columns: minmax(0, 1fr); }
  .g4.keep2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .top { padding: 0 12px; gap: 8px; }
  .top .hide-s { display: none; }
  .kv { grid-template-columns: 1fr; }
  h1 { font-size: 22px; }
}
