/* AI Risk Assistant
   Layout: top bar, left module rail grouped by the risk cycle, a working column.
   The review screen pairs the user's input (left) with reviewable findings (right). */
:root {
  /* The working paper: an auditor's evidence file. Ruled paper, graphite ink, red pen for the AI's notes,
     highlighter for source evidence, tick-mark green for what the reviewer accepts. */
  --bg: #e9ece7; --surface: #fbfbf8; --sunk: #f1f3ee; --line: #d3d8d0; --line-strong: #a7aea5;
  --fg: #1f2421; --muted: #5d655f; --accent: #1f2421; --accent-2: #24456e; --accent-soft: #e3e8ee; --on-accent: #fbfbf8;
  --ai: #b8322a; --ai-soft: #f6e4e0; --pen: #b8322a;
  --good: #2e6b3f; --good-bg: #e2eee3; --warn: #96620f; --warn-bg: #f6ecd4; --bad: #b8322a; --bad-bg: #f6e4e0;
  --mark: #f6ec8a; --mark-on: #efd94a;
  --font: "Schibsted Grotesk", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-head: "Schibsted Grotesk", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
  --font-hand: "Caveat", "Segoe Print", cursive;
  --r: 4px; --shadow: none;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131714; --surface: #1b201c; --sunk: #222823; --line: #323a33; --line-strong: #4b554c;
    --fg: #e6e9e3; --muted: #9aa49b; --accent: #e6e9e3; --accent-2: #9dbbe0; --accent-soft: #233041; --on-accent: #131714;
    --ai: #f08a7e; --ai-soft: #3a211e; --pen: #f08a7e;
    --good: #7fcf95; --good-bg: #1b3022; --warn: #e7b85c; --warn-bg: #36290f; --bad: #f08a7e; --bad-bg: #3a211e;
    --mark: #5b5214; --mark-on: #847516; color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--fg); font: 15px/1.55 var(--font); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent-2); }
:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 100; }
.skip:focus { left: 8px; }
.muted { color: var(--muted); } .small { font-size: 13px; }
.mono { font-family: var(--font-mono); font-size: 13px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.end, .end-row { justify-content: flex-end; }
h1, h2, h3 { font-family: var(--font-head); font-weight: 600; text-wrap: balance; margin: 0; line-height: 1.2; }
h1 { font-size: 30px; letter-spacing: -0.01em; } h2 { font-size: 18px; } h3 { font-size: 15px; margin: 16px 0 6px; }
.eyebrow { margin: 0 0 4px; font: 600 12px/1.3 var(--font-head); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.lede { margin: 6px 0 0; color: var(--muted); max-width: 68ch; }

/* ---------- buttons, inputs, pills ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--fg);
  border-radius: var(--r); padding: 7px 14px; cursor: pointer; text-decoration: none; font-weight: 500; white-space: nowrap; min-height: 36px; }
.btn:hover { border-color: var(--accent-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.ghost { border-color: transparent; background: none; color: var(--muted); }
.btn.ghost:hover { color: var(--fg); background: var(--sunk); }
.btn.sm { padding: 4px 10px; min-height: 30px; font-size: 14px; }
.btn.lg { padding: 10px 22px; min-height: 44px; font-size: 16px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.link { border: 0; background: none; padding: 0; color: var(--accent-2); cursor: pointer; font-size: 14px; text-decoration: underline; text-underline-offset: 3px; }
.inp, select, textarea { border: 1px solid var(--line-strong); background: var(--surface); border-radius: var(--r); padding: 8px 10px; width: 100%; min-width: 0; }
textarea { resize: vertical; line-height: 1.5; }
.field { display: flex; flex-direction: column; gap: 6px; margin: 0; }
.field > span, .field legend { font-weight: 600; font-size: 14px; }
.field em { font-style: normal; font-weight: 400; color: var(--muted); }
.check { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; cursor: pointer; }
.check input { margin-top: 3px; width: 16px; height: 16px; flex: none; }
.pill { display: inline-flex; align-items: center; border-radius: 999px; padding: 1px 9px; font-size: 12.5px; font-weight: 500; background: var(--sunk); color: var(--muted); white-space: nowrap; line-height: 1.6; }
.pill.good { background: var(--good-bg); color: var(--good); } .pill.warn { background: var(--warn-bg); color: var(--warn); } .pill.bad { background: var(--bad-bg); color: var(--bad); }
.pill.conf { background: var(--accent-soft); color: var(--accent-2); }
.pill.assumed { background: var(--ai-soft); color: var(--ai); } .pill.stated { background: transparent; border: 1px solid var(--line); }
.tag { font: 600 11px/1.6 var(--font-head); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 0 7px; }
.err { color: var(--bad); min-height: 1.2em; margin: 0; font-size: 14px; }
.warn-note { background: var(--warn-bg); color: var(--fg); border-radius: var(--r); padding: 10px 12px; font-size: 14px; }

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px max(16px, env(safe-area-inset-right, 0px)) 24px max(16px, env(safe-area-inset-left, 0px)); }
.login-card { width: min(400px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 28px; display: flex; flex-direction: column; gap: 14px; box-shadow: var(--shadow); }
.login-card p { margin: 0; }

/* ---------- shell ---------- */
.brand { display: inline-flex; align-items: center; gap: 10px; font: 600 17px/1 var(--font-head); color: var(--fg); text-decoration: none; letter-spacing: .01em; }
.brand.lg { font-size: 22px; }
.mark { width: 26px; height: 26px; border-radius: 7px; background: var(--accent); position: relative; flex: none; }
.mark::after { content: ""; position: absolute; inset: 7px 6px 8px; border: solid var(--on-accent); border-width: 2.5px 2.5px 0 0; transform: rotate(-45deg) translate(1px, 3px); border-radius: 1px; }
.shell { display: grid; grid-template-columns: 240px minmax(0, 1fr); grid-template-rows: auto 1fr; min-height: 100vh; }
.topbar { grid-column: 1 / -1; display: flex; align-items: center; gap: 16px; height: 56px; padding: 10px max(20px, env(safe-area-inset-right, 0px)) 10px max(20px, env(safe-area-inset-left, 0px));
  background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.topbar-note { color: var(--muted); font-size: 13px; border-left: 1px solid var(--line); padding-left: 16px; }
.user { margin-left: auto; display: flex; align-items: center; gap: 6px; font-size: 14px; }
.menu-btn { display: none; }
.nav { border-right: 1px solid var(--line); padding: 18px 12px 32px max(12px, env(safe-area-inset-left, 0px)); display: flex; flex-direction: column; gap: 2px; position: sticky; top: 56px; height: calc(100vh - 56px); overflow: auto; }
.nav a { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 6px; color: var(--fg); text-decoration: none; font-size: 14.5px; }
.nav a:hover { background: var(--sunk); }
.nav a.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav a.soon { color: var(--muted); }
.nav a.soon .tag { font-size: 10px; white-space: nowrap; flex: none; }
.nav-label { margin: 16px 10px 4px; font: 600 11.5px/1.3 var(--font-head); text-transform: uppercase; letter-spacing: .09em; color: var(--muted); }
.nav-home { font-weight: 600; }
.nav-foot { margin-top: auto; padding-top: 16px; border-top: 1px solid var(--line); }
.main { padding: 28px max(28px, env(safe-area-inset-right, 0px)) 64px 28px; min-width: 0; outline: none; max-width: 1360px; width: 100%; }

/* ---------- page parts ---------- */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 20px; min-width: 0; }
.panel + .panel { margin-top: 16px; }
.panel h2 + * { margin-top: 10px; }
.panel.narrow { max-width: 720px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty.small { padding: 28px 16px; }
.empty h1 { color: var(--fg); margin-bottom: 8px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; }
.tabs a { padding: 9px 14px; color: var(--muted); text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; font-weight: 500; }
.tabs a:hover { color: var(--fg); }
.tabs a.on { color: var(--accent); border-bottom-color: var(--accent); }
.tabs .count { font-size: 12px; color: var(--muted); margin-left: 4px; }
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.toolbar .inp { max-width: 320px; }
.toolbar .btn { margin-left: auto; }
.tbl-wrap { position: relative; overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th { text-align: left; font: 600 12px/1.3 var(--font-head); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 10px 14px; background: var(--sunk); 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; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td:nth-child(2) { min-width: 260px; }

/* ---------- home ---------- */
.home-head h1 { font-size: 34px; }
.task-group { margin-bottom: 22px; }
.group-title { font-size: 15px; text-transform: uppercase; letter-spacing: .08em; margin: 0 0 10px; color: var(--fg); }
.group-title span { text-transform: none; letter-spacing: 0; font-weight: 500; color: var(--muted); font-family: var(--font); font-size: 14px; margin-left: 4px; }
.tasks { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(205px, 1fr)); gap: 14px; }
.task { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; display: flex; flex-direction: column; transition: border-color .15s, box-shadow .15s; }
.task:hover { border-color: var(--accent-2); box-shadow: var(--shadow); }
.task-main { display: flex; flex-direction: column; gap: 6px; padding: 18px 18px 12px; text-decoration: none; color: var(--fg); flex: 1; }
.task-main b { font: 600 18px/1.25 var(--font-head); }
.task-main span:last-child { color: var(--muted); font-size: 14px; }
.task-mod { font: 600 11.5px/1.3 var(--font-head); text-transform: uppercase; letter-spacing: .08em; color: var(--accent-2); }
.task-ex { border-top: 1px solid var(--line); padding: 9px 18px; font-size: 14px; text-decoration: none; color: var(--ai); font-weight: 500; }
.task-ex::before { content: "\25B6\FE0E  "; font-size: 10px; }
.task-ex:hover { background: var(--ai-soft); border-radius: 0 0 12px 12px; }
.home-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.home-grid .panel + .panel { margin-top: 0; }
.recent, .coming, .people { list-style: none; padding: 0; margin: 0; }
.recent li, .people li { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.recent li:first-child, .people li:first-child { border-top: 0; }
.recent a { flex: 1; min-width: 0; text-decoration: none; color: var(--fg); display: flex; flex-direction: column; }
.recent a b { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent a .muted { font-size: 13px; }
.people li > span:first-child { flex: 1; min-width: 0; }
.coming li { padding: 9px 0; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 2px; font-size: 14px; }
.coming li:first-child { border-top: 0; }
.coming a { display: flex; gap: 8px; align-items: center; text-decoration: none; color: var(--fg); }
.ticks { padding-left: 20px; } .ticks li { margin: 6px 0; }

/* ---------- module page: stepper ---------- */
.stepper { list-style: none; padding: 0; margin: 0 0 18px; display: flex; gap: 6px; flex-wrap: wrap; }
.stepper li > * { display: inline-flex; align-items: center; gap: 8px; padding: 5px 12px 5px 6px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); font-size: 14px; font-weight: 500; }
.stepper b { flex: none; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--sunk); font-size: 12px; }
.stepper li.on > * { border-color: var(--accent); color: var(--accent); }
.stepper li.on b { background: var(--accent); color: var(--on-accent); }
.stepper li.done > * { color: var(--good); cursor: pointer; }
.stepper li.done b { background: var(--good-bg); color: var(--good); }
.stepper li.later > * { cursor: pointer; border-style: dashed; }
.stepper button { font: inherit; }

/* ---------- Input ---------- */
.input-main { max-width: 860px; display: flex; flex-direction: column; gap: 18px; }
.intro { margin: 0; font-size: 16px; }
.example { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; background: var(--ai-soft); border-radius: 12px; padding: 14px 16px; }
.example p { margin: 0; font-weight: 500; }
.example .eyebrow { color: var(--ai); }
.drop { border: 1px solid var(--line-strong); border-radius: var(--r); background: var(--surface); }
.drop textarea { border: 0; border-radius: var(--r) var(--r) 0 0; }
.drop.over { border-color: var(--accent-2); box-shadow: 0 0 0 3px var(--accent-soft); }
.drop-bar { display: flex; gap: 10px; align-items: center; padding: 6px 8px; border-top: 1px dashed var(--line); flex-wrap: wrap; }
.hint { color: var(--muted); font-size: 13px; }
.file-btn { cursor: pointer; }
.attach { display: flex; flex-wrap: wrap; gap: 6px; }
.attach:empty { display: none; }
.chip-file { display: inline-flex; align-items: center; gap: 6px; background: var(--sunk); border-radius: 999px; padding: 3px 4px 3px 10px; font-size: 13px; }
.chip-file img { width: 22px; height: 22px; object-fit: cover; border-radius: 4px; }
.chip-file .x { border: 0; background: none; cursor: pointer; font-size: 16px; line-height: 1; padding: 2px 6px; color: var(--muted); border-radius: 50%; }
.choice { border: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.opt { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--line); border-radius: var(--r); padding: 10px 12px; background: var(--surface); cursor: pointer; }
.opt:has(input:checked) { border-color: var(--accent-2); background: var(--accent-soft); }
.opt input { margin-top: 4px; }
.opt span { display: flex; flex-direction: column; } .opt small { color: var(--muted); font-size: 13px; }
.go-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; padding-top: 4px; }

/* ---------- running ---------- */
.run { max-width: 620px; }
.run-head { display: flex; justify-content: space-between; align-items: center; }
.run h2 { display: flex; align-items: center; gap: 10px; }
.steps { list-style: none; padding: 0; margin: 16px 0; display: flex; flex-direction: column; gap: 2px; }
.steps li { padding: 6px 0 6px 30px; position: relative; color: var(--muted); }
.steps li::before { box-sizing: border-box; content: ""; position: absolute; left: 4px; top: 11px; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--line-strong); }
.steps li.on { color: var(--fg); font-weight: 600; }
.steps li.on::before { border-color: var(--ai); border-top-color: transparent; animation: spin .9s linear infinite; }
.steps li.done { color: var(--fg); }
.steps li.done::before { background: var(--good); border-color: var(--good); }
.steps li.done::after { content: ""; position: absolute; left: 8.5px; top: 13.5px; width: 3px; height: 6px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.spin { flex: none; box-sizing: border-box; width: 16px; height: 16px; border: 2.5px solid var(--ai-soft); border-top-color: var(--ai); border-radius: 50%; animation: spin .9s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Review ---------- */
.review { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 8fr); gap: 20px; align-items: start; }
.source { position: sticky; top: 72px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; display: flex; flex-direction: column; max-height: calc(100vh - 96px); min-width: 0; }
.source-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.source > .muted { margin: 8px 14px 0; }
.source-text { padding: 12px 14px 16px; overflow: auto; white-space: pre-wrap; font-size: 14px; line-height: 1.6; overflow-wrap: anywhere; }
mark { background: var(--mark); color: inherit; border-radius: 3px; padding: 0 1px; cursor: pointer; }
mark.on { background: var(--mark-on); box-shadow: 0 0 0 2px var(--mark-on); }
.results { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.headline { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; }
.headline p { margin: 8px 0 0; max-width: 75ch; }
.title-edit { font: 600 22px/1.25 var(--font-head); border: 1px solid transparent; background: none; padding: 2px 6px; margin-left: -7px; width: 100%; border-radius: 6px; }
.title-edit:hover, .title-edit:focus { border-color: var(--line-strong); background: var(--surface); }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; background: var(--line); border-radius: 10px; overflow: hidden; margin: 14px 0 0; border: 1px solid var(--line); }
.stats div { background: var(--sunk); padding: 10px 12px; min-width: 0; }
.stats dt { font-size: 12px; color: var(--muted); }
.stats dd { margin: 2px 0 0; font: 600 16px/1.3 var(--font-head); overflow-wrap: anywhere; }
.review-bar { position: sticky; top: 56px; z-index: 5; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(6px); padding: 10px 0; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; border-bottom: 1px solid var(--line); }
.review-bar p { margin: 0; flex: 1; min-width: 220px; font-size: 14px; }
.meter { width: 100%; height: 4px; background: var(--sunk); border-radius: 2px; overflow: hidden; order: -1; }
.meter span { display: block; height: 100%; background: var(--good); transition: width .2s; }
.sec { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 6px 0 4px; }
.sec > header { display: flex; justify-content: space-between; align-items: center; padding: 10px 16px 6px; gap: 8px; }
.sec > .muted { padding: 4px 16px 12px; margin: 0; }
.item { display: flex; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--line); position: relative; outline: none; }
.sec > header + .item { border-top: 0; }
.item:focus-visible { box-shadow: inset 3px 0 0 var(--accent-2); background: var(--accent-soft); }
.item.flash { animation: flash 1.2s ease; }
@keyframes flash { 0%, 40% { background: var(--mark); } 100% { background: transparent; } }
.item-main { flex: 1; min-width: 0; }
.item-head { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 4px; }
.item-title { font-weight: 600; font-size: 14px; margin-right: 2px; }
.item-text { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; max-width: 78ch; }
.item-reason { margin: 4px 0 0; color: var(--muted); font-size: 13.5px; max-width: 78ch; }
.item-details { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 3px 14px; margin: 8px 0 0; font-size: 13.5px; max-width: 82ch; }
.item-details div { display: contents; }
.item-details dt { color: var(--muted); font-weight: 500; }
.item-details dd { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.item.s-rejected .item-details { opacity: .6; }
.head-actions { margin-top: 14px; }
.diagram-panel { margin-bottom: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 6px 0 12px; min-width: 0; }
.diagram-panel > header { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; padding: 10px 16px 8px; }
.diagram-panel > header .btn { margin-left: auto; }
.diagram { overflow-x: auto; padding: 4px 16px 6px; }
.diagram svg { display: block; max-width: none; }
.legend { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 6px 16px 0; padding: 0; font-size: 12.5px; color: var(--muted); }
.legend li { display: inline-flex; align-items: center; gap: 6px; }
.lg-box { width: 18px; height: 12px; border-radius: 3px; border: 1.5px solid var(--line-strong); background: var(--surface); }
.lg-box.gap { border: 2px solid var(--bad); } .lg-box.weak { border: 2px solid var(--warn); }
.lg-box.decision { background: var(--ai-soft); } .lg-box.auto { background: var(--accent-soft); }
.lg-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--good); }
.lg-line { width: 20px; border-top: 1.5px dashed var(--muted); }
.item-links { display: flex; gap: 16px; margin-top: 6px; flex-wrap: wrap; }
.item .edit { margin: 4px 0 8px; }
.status { font: 600 11.5px/1.6 var(--font-head); text-transform: uppercase; letter-spacing: .06em; margin-left: auto; }
.item-actions { display: flex; gap: 4px; align-items: flex-start; flex: none; }
.ia { width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-size: 15px; color: var(--muted); display: grid; place-items: center; }
.ia:hover { border-color: var(--line-strong); color: var(--fg); }
.ia.ok.on { background: var(--good); border-color: var(--good); color: #fff; }
.ia.ed.on { background: var(--accent-2); border-color: var(--accent-2); color: #fff; }
.ia.no.on { background: var(--bad); border-color: var(--bad); color: #fff; }
.item.s-accepted { box-shadow: inset 3px 0 0 var(--good); } .item.s-accepted .status { color: var(--good); }
.item.s-edited { box-shadow: inset 3px 0 0 var(--accent-2); } .item.s-edited .status { color: var(--accent-2); }
.item.s-rejected { box-shadow: inset 3px 0 0 var(--bad); } .item.s-rejected .status { color: var(--bad); }
.item.s-rejected .item-text { text-decoration: line-through; color: var(--muted); }
.end-row { display: flex; gap: 8px; padding-top: 4px; }

/* ---------- Export ---------- */
.export { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.export .end-row { grid-column: 1 / -1; justify-content: space-between; }
.export .panel + .panel { margin-top: 0; }
.out-grid { display: grid; gap: 10px; margin: 16px 0; }
.out { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; border: 1px solid var(--line-strong); background: var(--surface); border-radius: 10px; padding: 12px 14px; cursor: pointer; }
.out:hover { border-color: var(--accent-2); background: var(--accent-soft); }
.out b { font: 600 16px/1.3 var(--font-head); } .out span { color: var(--muted); font-size: 14px; }
.preview ul { padding-left: 18px; margin: 0; } .preview li { margin: 4px 0; font-size: 14px; }
.preview { max-height: 70vh; overflow: auto; }

/* ---------- library, settings ---------- */
.map-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; margin: 12px 0; }
.map-grid label { display: flex; flex-direction: column; gap: 4px; font-size: 13.5px; font-weight: 500; }
.unit-list, .tax-list { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.unit-row { display: grid; grid-template-columns: 110px minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.tax-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.tax-l1 { display: flex; flex-direction: column; gap: 6px; }
.tax-l1 .btn { align-self: flex-start; }
.user-add { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; align-items: end; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.user-add label { display: flex; flex-direction: column; gap: 4px; font-size: 13.5px; font-weight: 500; }
pre.code { white-space: pre-wrap; overflow-wrap: anywhere; background: var(--sunk); border-radius: var(--r); padding: 12px; font: 12.5px/1.5 var(--font-mono); max-height: 40vh; overflow: auto; }

/* ---------- modal, toast ---------- */
.modal { position: fixed; inset: 0; background: rgb(10 20 30 / 45%); display: flex; align-items: flex-start; justify-content: center; z-index: 50; overflow: auto;
  padding: max(40px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) 40px max(16px, env(safe-area-inset-left, 0px)); }
.sheet { background: var(--surface); border-radius: 14px; width: min(520px, 100%); border: 1px solid var(--line); box-shadow: 0 20px 60px rgb(0 0 0 / 25%); }
.sheet.wide { width: min(860px, 100%); }
.sheet > header { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.sheet-body { padding: 16px 20px; }
.sheet-body > p:first-child { margin-top: 0; }
.sheet > footer { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--line); }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(24px + env(safe-area-inset-bottom, 0px)); background: var(--fg); color: var(--bg); padding: 8px 8px 8px 16px; border-radius: 10px; z-index: 60; display: flex; gap: 10px; align-items: center; font-size: 14px; max-width: calc(100% - 32px); }
.toast .btn { color: var(--bg); }
.toast .btn:hover { background: rgb(255 255 255 / 12%); color: var(--bg); }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .review { grid-template-columns: minmax(0, 1fr); }
  .source { position: static; max-height: 320px; }
  .topbar-note { display: none; }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .menu-btn { display: inline-flex; }
  .nav { position: fixed; top: 56px; left: 0; bottom: 0; width: min(300px, 86vw); background: var(--surface); z-index: 30; transform: translateX(-100%); transition: transform .2s; height: auto; box-shadow: var(--shadow); }
  body.nav-open .nav { transform: none; }
  .main { padding: 20px max(16px, env(safe-area-inset-right, 0px)) 56px max(16px, env(safe-area-inset-left, 0px)); }
  .home-grid, .export { grid-template-columns: minmax(0, 1fr); }
  .tax-row { grid-template-columns: minmax(0, 1fr); }
  h1 { font-size: 26px; } .home-head h1 { font-size: 28px; }
  #who { display: none; }
}
@media (max-width: 520px) {
  .item-details { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .item-details dd { margin-bottom: 4px; }
  .stats { grid-template-columns: minmax(0, 1fr); }
  .item { flex-direction: column; gap: 6px; }
  .item-actions { align-self: flex-end; }
  .ia { width: 44px; height: 38px; }
  .review-bar { position: static; }
  .review-bar p { min-width: 0; flex-basis: 100%; }
  .stepper li > * { padding-right: 10px; }
  .unit-row { grid-template-columns: 80px minmax(0, 1fr); }
  .unit-row .btn { grid-column: 1 / -1; justify-self: start; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---------- AI models, Model Lab ---------- */
.models { list-style: none; padding: 0; margin: 12px 0 0; display: flex; flex-direction: column; gap: 10px; }
.model { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.model.is-default { border-color: var(--accent-2); }
.model-main { min-width: 0; flex: 1 1 320px; }
.model-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.model p { margin: 4px 0 0; overflow-wrap: anywhere; }
.test-result { font-size: 14px; margin: 6px 0 0; min-height: 1.2em; }
.test-result.ok { color: var(--good); } .test-result.bad { color: var(--bad); }
.tbl-wrap.flat { border-radius: 8px; margin-top: 10px; }
.tbl-wrap.flat td:nth-child(2) { min-width: 0; }
.preset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; margin-top: 12px; }
.preset { text-align: left; display: flex; flex-direction: column; gap: 4px; border: 1px solid var(--line-strong); background: var(--surface); border-radius: 10px; padding: 12px; cursor: pointer; }
.preset:hover { border-color: var(--accent-2); background: var(--accent-soft); }
.preset span { color: var(--muted); font-size: 13px; }
.mform { display: flex; flex-direction: column; gap: 14px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.grid2 .wide { grid-column: 1 / -1; }
.checks { display: flex; flex-direction: column; gap: 8px; }
.model-note { margin: -6px 0 0; text-align: right; }
.lab-form { display: flex; flex-direction: column; gap: 16px; }
.lab-form legend { margin-bottom: 8px; }
.model-picks { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.lab-results { display: grid; gap: 14px; margin-top: 16px; align-items: start; }
.lab-results.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.lab-results.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.lab-card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.lab-card > header { display: flex; flex-direction: column; }
.lab-card > header b { font: 600 17px/1.3 var(--font-head); }
.lab-metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; margin: 0; }
.lab-metrics div { background: var(--sunk); padding: 8px 10px; }
.lab-metrics dt { font-size: 12px; color: var(--muted); } .lab-metrics dd { margin: 2px 0 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.lab-head p { margin: 4px 0 0; font-size: 14px; }
.lab-stats { list-style: none; padding: 0; margin: 8px 0 0; font-size: 14px; display: flex; flex-direction: column; gap: 2px; }
.lab-card p.muted.small { margin: 0; }
@media (max-width: 1000px) { .lab-results.cols-2, .lab-results.cols-3 { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 640px) { .grid2 { grid-template-columns: minmax(0, 1fr); } }

/* ---------- invitations, account, people, usage ---------- */
.who { text-decoration: none; } .who:hover { color: var(--fg); text-decoration: underline; }
.invite-h { font-size: 24px; }
.inv-form, .pw-form { display: flex; flex-direction: column; gap: 12px; }
.inv-form .err:empty { display: none; }
.data-note { border-top: 1px solid var(--line); padding-top: 12px; margin: 4px 0 0; }
.pw-form { max-width: 420px; margin-top: 12px; }
.meter.wide { height: 8px; margin: 8px 0; max-width: 420px; }
.allow-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 16px 0 12px; padding: 12px; background: var(--sunk); border-radius: var(--r); }
.allow-row .inp { width: 90px; }
.allow-row .muted { flex-basis: 100%; }
.people-tbl td { vertical-align: middle; }
.people-tbl td:nth-child(2) { min-width: 0; }
.people-tbl .st { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; white-space: nowrap; }
.people-tbl .st small { color: var(--muted); font-size: 12.5px; }
.people-tbl .allow { width: 130px; }
.people-tbl td.acts { white-space: nowrap; text-align: right; }
.link-box { display: flex; gap: 8px; margin: 12px 0; }
.link-box .inp { flex: 1; }
.msg summary { cursor: pointer; color: var(--accent-2); font-size: 14px; }
.msg .btn { margin-top: 4px; }
.usage .stats { margin-bottom: 12px; }
.by-task summary { cursor: pointer; color: var(--accent-2); font-size: 14px; margin-bottom: 6px; }
.by-task td:nth-child(2) { min-width: 0; }
.usage + .tbl-wrap { margin-top: 16px; }
@media (max-width: 640px) { .link-box { flex-direction: column; } }
td.mono { white-space: nowrap; }
.lib-note { margin: 0; padding: 12px 14px; background: var(--sunk); border-radius: var(--r); font-size: 14px; color: var(--muted); }

/* ---------- public landing page ---------- */
.landing { background: var(--bg); min-height: 100vh; }
.landing > * { max-width: 1160px; margin-inline: auto; padding-inline: max(24px, env(safe-area-inset-left, 0px)); }
.lp-top { display: flex; align-items: center; gap: 24px; padding-block: 18px; }
.lp-links { display: flex; gap: 22px; margin-left: auto; font-size: 14.5px; }
.lp-links a { color: var(--muted); text-decoration: none; }
.lp-links a:hover { color: var(--fg); }
.lp-hero { display: grid; grid-template-columns: minmax(0, 1.12fr) minmax(0, 1fr); gap: 56px; align-items: center; padding-block: 56px 72px; }
.lp-hero h1 { font: 600 clamp(38px, 5.2vw, 64px)/1.02 var(--font-head); letter-spacing: -0.015em; color: var(--accent); margin: 0; }
.lp-lede { font-size: 18px; line-height: 1.55; max-width: 34em; margin: 22px 0 0; }
.lp-cta { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 28px; }
.lp-small { color: var(--muted); font-size: 14px; max-width: 40em; margin: 18px 0 0; }

/* the one moving part: a finding drawn from a sentence and accepted */
.lp-demo { margin: 0; position: relative; display: grid; gap: 0; }
.lp-mail { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 18px 20px 22px; font-size: 14.5px; line-height: 1.6; margin-right: 56px; box-shadow: var(--shadow); }
.lp-mail p { margin: 0; }
.lp-mail-head { color: var(--muted); font-size: 13px; padding-bottom: 10px; margin-bottom: 10px !important; border-bottom: 1px solid var(--line); }
.lp-mark { background: linear-gradient(var(--mark-on), var(--mark-on)) no-repeat 0 0 / 100% 100%; padding: 1px 0; border-radius: 2px; cursor: default; }
.lp-find { background: var(--surface); border: 1px solid var(--line-strong); border-left: 4px solid var(--good); border-radius: 10px; padding: 14px 16px; margin: -18px 0 0 56px; position: relative; box-shadow: var(--shadow); }
.lp-find-head { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-bottom: 6px; font-size: 14px; }
.lp-find-text { margin: 0; font-size: 15px; }
.lp-find-why { margin: 6px 0 0; color: var(--muted); font-size: 13.5px; }
.lp-find-act { display: flex; gap: 6px; align-items: center; margin-top: 10px; }
.lp-find-act .ia { cursor: default; }
.lp-status { font: 600 12px/1 var(--font-head); color: var(--good); margin-left: 6px; letter-spacing: .02em; }
.lp-accept { background: var(--good); border-color: var(--good); color: #fff; }
.lp-demo figcaption { color: var(--muted); font-size: 13px; margin: 12px 0 0 56px; }
@media (prefers-reduced-motion: no-preference) {
  .lp-mark { background-size: 0% 100%; animation: lp-sweep .9s .5s ease-out forwards; }
  .lp-find { opacity: 0; transform: translateY(10px); border-left-color: var(--line-strong); animation: lp-in .5s 1.4s ease-out forwards, lp-ok .3s 2.4s ease-out forwards; }
  .lp-accept, .lp-status { opacity: 0; animation: lp-pop .3s 2.4s ease-out forwards; }
}
@keyframes lp-sweep { to { background-size: 100% 100%; } }
@keyframes lp-in { to { opacity: 1; transform: none; } }
@keyframes lp-pop { from { opacity: 0; transform: scale(.85); } to { opacity: 1; transform: none; } }
@keyframes lp-ok { to { border-left-color: var(--good); } }

.landing h2 { font-size: 30px; margin: 0; }
.lp-how, .lp-mods, .lp-gov, .lp-req { padding-block: 56px; border-top: 1px solid var(--line); }
.lp-steps { list-style: none; counter-reset: s; padding: 0; margin: 28px 0 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 32px; }
.lp-steps li { counter-increment: s; }
.lp-steps li::before { content: counter(s); display: block; font: 600 44px/1 var(--font-head); color: var(--accent-2); margin-bottom: 10px; }
.lp-steps b { font: 600 20px/1.2 var(--font-head); }
.lp-steps p { margin: 8px 0 0; color: var(--muted); max-width: 32em; }
.lp-sub { color: var(--muted); margin: 8px 0 0; max-width: 46em; }
.lp-groups { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 36px 56px; margin-top: 32px; }
.lp-group h3 { font-size: 20px; margin: 0 0 6px; color: var(--accent); }
.lp-group h3 span { font: 400 15px var(--font); color: var(--muted); margin-left: 4px; }
.lp-group ul { list-style: none; padding: 0; margin: 0; }
.lp-group li { padding: 12px 0; border-top: 1px solid var(--line); display: grid; gap: 2px; }
.lp-group li b { font-weight: 600; }
.lp-group li span { color: var(--muted); font-size: 14.5px; }
.lp-gov-list { list-style: none; padding: 0; margin: 28px 0 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px 56px; }
.lp-gov-list li { max-width: 36em; }
.lp-gov-list b { display: block; font: 600 17px/1.3 var(--font-head); margin-bottom: 4px; }
.lp-req { display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); gap: 56px; align-items: start; }
.lp-req-copy p { margin: 12px 0 0; max-width: 30em; }
.lp-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 22px; }
.lp-wide { grid-column: 1 / -1; }
.lp-form .err:empty { display: none; }
.lp-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.lp-sent { background: var(--good-bg); border-radius: 12px; padding: 22px; }
.lp-sent h3 { margin: 0 0 6px; }
.lp-sent p { margin: 0; }
.lp-foot { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding-block: 24px 36px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13.5px; }
.login-foot { margin: 0; text-align: center; }
.nav-badge { margin-left: auto; background: var(--bad); color: #fff; border-radius: 999px; font-size: 11.5px; font-weight: 600; padding: 0 7px; line-height: 1.6; }
.req-box { border: 1px solid var(--warn); background: var(--warn-bg); border-radius: var(--r); padding: 12px 14px; margin: 16px 0 0; }
.req-box h3 { margin: 0 0 6px; font-size: 16px; }
.req-list { list-style: none; padding: 0; margin: 0; }
.req-list li { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; padding: 10px 0; border-top: 1px solid color-mix(in srgb, var(--warn) 30%, transparent); flex-wrap: wrap; }
.req-list li:first-child { border-top: 0; }
.req-list p { margin: 2px 0 0; }
@media (max-width: 900px) {
  .lp-hero, .lp-req { grid-template-columns: minmax(0, 1fr); gap: 36px; }
  .lp-steps, .lp-groups, .lp-gov-list { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .lp-links { display: none; }
  .lp-top .btn { margin-left: auto; }
}
@media (max-width: 560px) {
  .landing > * { padding-inline: 16px; }
  .lp-mail { margin-right: 20px; } .lp-find { margin-left: 20px; } .lp-demo figcaption { margin-left: 20px; }
  .lp-form { grid-template-columns: minmax(0, 1fr); padding: 16px; }
  .lp-hero { padding-block: 28px 48px; }
}
.lib-sum { list-style: none; padding: 0; margin: 4px 0 10px; display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
.lib-sum a { display: flex; flex-direction: column; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r); text-decoration: none; color: var(--fg); }
.lib-sum a:hover { border-color: var(--accent-2); }
.lib-sum b { font: 600 22px/1.1 var(--font-head); }
.lib-sum span { color: var(--muted); font-size: 13px; }

/* =====================================================================================================
   THE WORKING PAPER — visual layer. Everything below restyles the components above into an evidence file:
   ruled sheets instead of floating cards, ink instead of brand blue, red pen for the AI, tick marks for review.
   ===================================================================================================== */
body { font-feature-settings: "tnum" 0; letter-spacing: -0.003em; }
td.num, th.num, .stats dd, .lab-metrics dd, .lib-sum b { font-variant-numeric: tabular-nums; }
h1, h2, h3 { font-weight: 700; letter-spacing: -0.012em; }
h1 { font-size: 32px; letter-spacing: -0.022em; }
.eyebrow { text-transform: none; letter-spacing: 0; font: 600 13.5px/1.3 var(--font); color: var(--muted); }
.lede { color: var(--muted); }
a { text-underline-offset: 3px; }

/* the mark: a ruled sheet with a red tick */
.mark { width: 28px; height: 28px; border-radius: 0; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 28 28'%3E%3Cpath d='M5 2.5h13.5l4.5 4.5v18.5H5z' fill='%23fbfbf8' stroke='%231f2421' stroke-width='1.8' stroke-linejoin='round'/%3E%3Cpath d='M9 10h10M9 14h10M9 18h6' stroke='%23a7aea5' stroke-width='1.4' stroke-linecap='round'/%3E%3Cpath d='M12.5 18.5l3.6 4.2c2.6-6.3 6-11 10.4-14.4' fill='none' stroke='%23b8322a' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat; }
.mark::after { display: none; }
@media (prefers-color-scheme: dark) {
  .mark { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 28 28'%3E%3Cpath d='M5 2.5h13.5l4.5 4.5v18.5H5z' fill='%231b201c' stroke='%23e6e9e3' stroke-width='1.8' stroke-linejoin='round'/%3E%3Cpath d='M9 10h10M9 14h10M9 18h6' stroke='%234b554c' stroke-width='1.4' stroke-linecap='round'/%3E%3Cpath d='M12.5 18.5l3.6 4.2c2.6-6.3 6-11 10.4-14.4' fill='none' stroke='%23f08a7e' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
}
.brand { font-weight: 700; letter-spacing: -0.015em; }

/* buttons and fields: ink, square-cut */
.btn { border-radius: 3px; font-weight: 600; }
.btn.primary { background: var(--fg); border-color: var(--fg); color: var(--on-accent); }
.btn.primary:hover { background: color-mix(in srgb, var(--fg) 82%, var(--accent-2)); border-color: transparent; }
.btn:hover { border-color: var(--fg); }
.inp, select, textarea { border-radius: 3px; background: var(--surface); }
.inp:focus, select:focus, textarea:focus { outline: none; border-color: var(--fg); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-2) 22%, transparent); }
:focus-visible { outline-color: var(--accent-2); }

/* labels: small square-cut tags with a colour key, not pills */
.pill { border-radius: 2px; padding: 0 6px; font-size: 12.5px; font-weight: 600; background: var(--sunk); color: var(--muted); }
.pill.good { background: var(--good-bg); } .pill.warn { background: var(--warn-bg); } .pill.bad { background: var(--bad-bg); }
.pill.conf { background: transparent; color: var(--muted); font-weight: 500; padding: 0 2px; }
.pill.stated { border: 0; padding: 0 2px; font-weight: 500; }
.pill.assumed { background: transparent; color: var(--pen); font-family: var(--font-hand); font-size: 17px; font-weight: 600; line-height: 1.1; padding: 0 2px; }
.tag { border-radius: 2px; text-transform: none; letter-spacing: 0; font: 600 11.5px/1.6 var(--font); }

/* sheets, not floating cards */
.panel, .sec, .headline, .task, .tbl-wrap, .source, .diagram-panel, .lab-card, .lp-form, .sheet { border-radius: 4px; box-shadow: none; }
.sheet { box-shadow: 0 18px 50px rgb(0 0 0 / 18%); }
.topbar { border-bottom: 3px double var(--line-strong); }
.topbar-note { border-left-color: var(--line-strong); }

/* navigation as a file index */
.nav { gap: 1px; }
.nav-label { text-transform: none; letter-spacing: 0; font: 700 13px/1.3 var(--font); color: var(--fg); margin: 18px 10px 4px; }
.nav a { border-radius: 0; border-left: 3px solid transparent; padding: 6px 10px 6px 9px; font-size: 14.5px; gap: 10px; justify-content: flex-start; }
.nav a .ic { width: 18px; height: 18px; color: var(--muted); flex: none; }
.nav a:hover { background: var(--sunk); }
.nav a.on { background: var(--surface); color: var(--fg); border-left-color: var(--pen); font-weight: 700; }
.nav a.on .ic { color: var(--pen); }
.nav-badge { margin-left: auto; border-radius: 2px; background: var(--pen); }

/* page heads and tabs */
.page-head .eyebrow { display: flex; align-items: center; gap: 8px; }
.page-head .eyebrow .ic { color: var(--pen); width: 18px; height: 18px; }
.tabs { border-bottom: 2px solid var(--fg); }
.tabs a { border-bottom-width: 3px; margin-bottom: -2px; font-weight: 600; }
.tabs a.on { color: var(--fg); border-bottom-color: var(--pen); }
.stepper li > * { border-radius: 3px; }
.stepper b { border-radius: 2px; }
.stepper li.on > * { border-color: var(--fg); color: var(--fg); }
.stepper li.on b { background: var(--fg); }

/* home: task index */
.group-title { text-transform: none; letter-spacing: -0.01em; font-size: 19px; border-bottom: 2px solid var(--fg); padding-bottom: 6px; margin-bottom: 0; }
.group-title span { font-size: 15px; }
.tasks { gap: 0; border-left: 1px solid var(--line); }
.task { border-radius: 0; border: 0; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: transparent; }
.task:hover { border-color: var(--line); box-shadow: none; background: var(--surface); }
.task-main { padding: 16px 16px 10px; }
.task-main b { font-size: 18px; font-weight: 700; letter-spacing: -0.012em; }
.task-mod { text-transform: none; letter-spacing: 0; font: 600 13px/1.3 var(--font); color: var(--muted); display: flex; align-items: center; gap: 6px; }
.task-mod .ic { width: 17px; height: 17px; color: var(--pen); }
.task-ex { border-top: 0; padding: 4px 16px 14px; color: var(--accent-2); font-weight: 600; }
.task-ex::before { content: ""; }
.task-ex:hover { background: none; text-decoration: underline; }
.task-group { margin-bottom: 30px; }

/* tables: ledger style */
th { text-transform: none; letter-spacing: 0; font: 700 13px/1.3 var(--font); color: var(--fg); background: transparent; border-bottom: 2px solid var(--fg); }
.tbl-wrap { background: var(--surface); }

/* stats: ruled ledger columns */
.stats { background: transparent; border: 0; border-top: 2px solid var(--fg); border-radius: 0; gap: 0; }
.stats div { background: transparent; border-right: 1px solid var(--line); padding: 10px 14px 4px 0; }
.stats div + div { padding-left: 14px; }
.stats div:last-child { border-right: 0; }
.stats dd { font-size: 20px; font-weight: 700; }

/* review: findings as ruled rows, with the reviewer's marks in the margin */
.headline { border-top: 4px solid var(--fg); }
.title-edit { font-weight: 800; letter-spacing: -0.02em; }
.sec { padding-top: 2px; }
.sec > header { border-bottom: 1px solid var(--line-strong); padding-bottom: 8px; }
.sec > header h2 { font-size: 17px; }
.item { padding-left: 46px; border-top-color: var(--line); }
.item::before { content: ""; position: absolute; left: 12px; top: 12px; width: 24px; height: 24px; background: center / contain no-repeat; }
.item.s-accepted, .item.s-edited, .item.s-rejected { box-shadow: none; }
.item.s-accepted::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3.5 13.5l5.2 5.5C12 10.5 16.5 5.6 21.5 3' fill='none' stroke='%232e6b3f' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
.item.s-rejected::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5 5.5c4.5 4 9 8.6 14 13.5M18.5 4.5C13.5 9.5 9 14 4.5 19.5' fill='none' stroke='%23b8322a' stroke-width='2.4' stroke-linecap='round'/%3E%3C/svg%3E"); }
.item.s-edited::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 20l1.2-4.6L16.5 4.1a2 2 0 0 1 2.9 0l.5.5a2 2 0 0 1 0 2.9L8.6 18.8z' fill='none' stroke='%2324456e' stroke-width='1.8' stroke-linejoin='round'/%3E%3Cpath d='M4 20h16' stroke='%2324456e' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E"); }
.item.s-rejected .item-text { text-decoration-color: var(--pen); text-decoration-thickness: 1.5px; }
.status { text-transform: none; letter-spacing: 0; font: 600 18px/1 var(--font-hand); }
.item.s-accepted .status { color: var(--good); } .item.s-rejected .status { color: var(--pen); } .item.s-edited .status { color: var(--accent-2); }
.item:focus-visible { box-shadow: inset 3px 0 0 var(--accent-2); }
.ia { border-radius: 3px; }
.ia.ed.on { background: var(--accent-2); border-color: var(--accent-2); }
.item-reason { color: var(--muted); }
.review-bar { border-bottom: 2px solid var(--fg); }
.meter { border-radius: 0; height: 3px; }

/* the source: evidence with highlighter */
.source { border-top: 4px solid var(--fg); }
.source-text { background: repeating-linear-gradient(to bottom, transparent 0 calc(1.6em - 1px), color-mix(in srgb, var(--line) 70%, transparent) calc(1.6em - 1px) 1.6em); background-position: 0 12px; }
mark, .lp-mark { background: linear-gradient(100deg, transparent .15em, var(--mark) .3em, var(--mark) calc(100% - .3em), transparent calc(100% - .1em)); border-radius: 0; padding: 0 .1em; }
mark.on { background: linear-gradient(100deg, transparent .15em, var(--mark-on) .3em, var(--mark-on) calc(100% - .3em), transparent calc(100% - .1em)); box-shadow: none; outline: 2px solid var(--mark-on); outline-offset: 1px; }

/* Input */
.example { background: transparent; border: 1px dashed var(--pen); border-radius: 4px; }
.example .eyebrow { color: var(--pen); font-family: var(--font-hand); font-size: 20px; font-weight: 600; }
.opt { border-radius: 3px; }
.opt:has(input:checked) { border-color: var(--fg); background: var(--surface); box-shadow: inset 3px 0 0 var(--pen); }
.drop { border-radius: 3px; }
.lib-note { border-left: 3px solid var(--line-strong); border-radius: 0; background: transparent; }

/* running */
.spin { border-color: var(--line); border-top-color: var(--pen); }
.steps li.on::before { border-color: var(--pen); border-top-color: transparent; }

/* export */
.out { border-radius: 3px; }
.out:hover { border-color: var(--fg); background: var(--surface); box-shadow: inset 3px 0 0 var(--pen); }

/* empty states */
.empty .sketch, .recent-empty .sketch { width: 150px; height: auto; color: var(--line-strong); display: block; margin: 0 auto 10px; }
.sketch .pen { stroke: var(--pen); }
.recent-empty { text-align: center; padding: 18px 8px; color: var(--muted); }
.lib-sum a { border-radius: 3px; }
.lib-sum a:hover { border-color: var(--fg); }
.toast { border-radius: 3px; }
.login-card { border-radius: 4px; border-top: 4px solid var(--fg); box-shadow: none; }
.invite-h { letter-spacing: -0.02em; }

/* ---------- landing page, working paper ---------- */
.landing { background: var(--bg); }
.lp-top { border-bottom: 3px double var(--line-strong); max-width: none; padding-inline: max(24px, calc((100% - 1160px) / 2 + 24px)); }
.lp-hero { padding-block: 64px 80px; gap: 64px; }
.lp-hero h1 { font: 800 clamp(40px, 5.4vw, 68px)/1.02 var(--font-head); letter-spacing: -0.035em; color: var(--fg); }
.lp-led { position: relative; display: inline-block; }
.lp-underline { position: absolute; left: -2%; right: -4%; bottom: -0.16em; width: 106%; height: 0.32em; overflow: visible; }
.lp-underline path { fill: none; stroke: var(--pen); stroke-width: 5; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.lp-lede { color: var(--fg); }
.lp-cta .btn.lg { padding-inline: 20px; }

.lp-demo { padding: 10px 0 0; }
.lp-paper { position: relative; background: var(--surface); border: 1px solid var(--line-strong); padding: 20px 22px 26px 52px; margin-right: 40px; font-size: 14.5px; line-height: 1.75;
  background-image: linear-gradient(90deg, transparent 38px, color-mix(in srgb, var(--pen) 45%, transparent) 38px, color-mix(in srgb, var(--pen) 45%, transparent) 39.5px, transparent 39.5px),
    repeating-linear-gradient(to bottom, transparent 0 calc(1.75em - 1px), color-mix(in srgb, var(--accent-2) 16%, transparent) calc(1.75em - 1px) 1.75em);
  background-position: 0 0, 0 15px; }
.lp-paper::before { content: ""; position: absolute; inset: 8px -8px -8px 8px; border: 1px solid var(--line-strong); background: var(--sunk); z-index: -1; }
.lp-demo { isolation: isolate; }
.lp-paper p { margin: 0 0 6px; }
.lp-mail-head { color: var(--muted); font-size: 13px; line-height: 1.6; border-bottom: 0 !important; padding-bottom: 6px; }
.lp-note { font: 600 22px/1.15 var(--font-hand); color: var(--pen); margin: 14px 0 0 34% !important; transform: rotate(-2deg); max-width: 15em; }
.lp-note { position: relative; }
.lp-arrow { position: absolute; left: -82px; top: -112px; width: 80px; height: 120px; overflow: visible; }
.lp-arrow path { fill: none; stroke: var(--pen); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.lp-find { margin: -26px 0 0 70px; border: 1px solid var(--fg); border-left: 4px solid var(--good); border-radius: 3px; box-shadow: 6px 6px 0 color-mix(in srgb, var(--fg) 12%, transparent); background: var(--surface); }
.lp-find-head b { font-weight: 700; }
.lp-status { font: 600 20px/1 var(--font-hand); letter-spacing: 0; color: var(--good); }
.lp-demo figcaption { font: 600 19px/1.2 var(--font-hand); color: var(--muted); margin: 14px 0 0 70px; }
.lp-mark { background-repeat: no-repeat; background-size: 100% 100%; }
@media (prefers-reduced-motion: no-preference) {
  .lp-mark { background-size: 0% 100%; animation: lp-sweep .9s .4s ease-out forwards; }
  .lp-note, .lp-arrow { opacity: 0; animation: lp-in .4s 1.3s ease-out forwards; }
  .lp-arrow path { stroke-dasharray: 200; stroke-dashoffset: 200; animation: lp-draw .6s 1.4s ease-out forwards; }
  .lp-find { opacity: 0; transform: translateY(10px); border-left-color: var(--line-strong); animation: lp-in .5s 2s ease-out forwards, lp-ok .3s 2.8s ease-out forwards; }
  .lp-accept, .lp-status { opacity: 0; animation: lp-pop .3s 2.8s ease-out forwards; }
  .lp-underline path { stroke-dasharray: 400; stroke-dashoffset: 400; animation: lp-draw .8s .2s ease-out forwards; }
}
@keyframes lp-draw { to { stroke-dashoffset: 0; } }

.landing h2 { font-size: 32px; letter-spacing: -0.025em; font-weight: 800; }
.lp-how, .lp-mods, .lp-gov, .lp-req, .lp-exhibits { border-top: 2px solid var(--fg); }
.lp-exhibits { padding-block: 56px; }
.lp-ex-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px; margin-top: 28px; }
.lp-ex { margin: 0; }
.lp-ex-wide { grid-column: 1 / -1; }
.lp-ex img { display: block; width: 100%; height: auto; border: 1px solid var(--line-strong); background: var(--surface); }
.lp-ex figcaption { margin-top: 10px; font-size: 14.5px; color: var(--muted); max-width: 60em; }
.lp-ex figcaption b { color: var(--fg); }
.lp-steps li::before { content: none; }
.lp-steps li { counter-increment: s; position: relative; }
.lp-steps b::before { content: counter(s) ". "; color: var(--pen); }
.lp-steps b { font-size: 21px; font-weight: 800; letter-spacing: -0.015em; }
.lp-sketch { width: 64px; height: 48px; color: var(--fg); display: block; margin-bottom: 12px; }
.lp-sketch .pen { stroke: var(--pen); }
.lp-steps p { color: var(--muted); }
.lp-group h3 { color: var(--fg); font-size: 21px; font-weight: 800; border-bottom: 2px solid var(--fg); padding-bottom: 6px; margin-bottom: 0; }
.lp-group li b { font-size: 16px; }
.lp-gov-list b { font-weight: 800; font-size: 18px; }
.lp-gov-list li { border-top: 1px solid var(--line-strong); padding-top: 12px; }
.lp-form { border-top: 4px solid var(--fg); }
.lp-foot { border-top: 3px double var(--line-strong); }
@media (max-width: 900px) {
  .lp-ex-grid { grid-template-columns: minmax(0, 1fr); }
  .lp-paper { margin-right: 14px; }
  .lp-find { margin-left: 24px; }
  .lp-demo figcaption { margin-left: 24px; }
  .lp-arrow { display: none; }
  .lp-note { margin-left: 8px !important; }
}

/* ---------- External events ---------- */
.ev-locked { overflow: hidden; }
.ev-fresh { margin: 10px 0 0; font-size: 14px; color: var(--muted); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ev-fresh b { color: var(--fg); }
.ev-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line-strong); display: inline-block; flex: none; }
.ev-dot.ok { background: var(--good); } .ev-dot.warn { background: var(--warn); }
.ev-top { display: flex; gap: 12px; align-items: center; margin-bottom: 10px; flex-wrap: wrap; }
.ev-search { position: relative; flex: 1 1 360px; max-width: 640px; }
.ev-search .inp { padding-left: 38px; min-height: 42px; font-size: 15.5px; }
.ev-search-ic { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--muted); pointer-events: none; }
.ev-sort { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; margin-left: auto; }
.ev-sort select { width: auto; min-height: 40px; }
.ev-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-height: 32px; margin-bottom: 16px; }
.ev-chip { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--fg); background: var(--surface); border-radius: 2px; padding: 3px 6px 3px 10px; font-size: 13.5px; font-weight: 600; cursor: pointer; }
.ev-chip span { font-size: 16px; line-height: 1; color: var(--muted); padding: 0 2px; }
.ev-chip:hover { background: var(--sunk); } .ev-chip:hover span { color: var(--pen); }
.ev-layout { display: grid; grid-template-columns: 236px minmax(0, 1fr); gap: 32px; align-items: start; }
.ev-filters > summary { display: none; }
.ev-filters { position: sticky; top: 76px; max-height: calc(100vh - 96px); overflow: auto; padding-right: 4px; }
.ev-facet { border: 0; border-top: 2px solid var(--fg); margin: 0 0 18px; padding: 8px 0 0; min-width: 0; }
.ev-facet legend { font-weight: 700; font-size: 14px; padding: 0; float: left; width: 100%; margin-bottom: 4px; }
.ev-facet legend + * { clear: both; }
.ev-opt { display: grid; grid-template-columns: 18px minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 4px 0; font-size: 14px; cursor: pointer; }
.ev-opt input { width: 16px; height: 16px; margin: 0; accent-color: var(--fg); }
.ev-opt:hover span:first-of-type { text-decoration: underline; text-underline-offset: 3px; }
.ev-opt.zero { color: var(--muted); }
.ev-n { font: 500 12.5px/1 var(--font-mono); color: var(--muted); font-variant-numeric: tabular-nums; }
.ev-dates { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 6px; }
.ev-dates label { font-size: 12.5px; color: var(--muted); display: flex; flex-direction: column; gap: 2px; }
.ev-dates .inp { padding: 5px 6px; font-size: 13px; }
.ev-stats { margin-top: 0; }
.ev-stats .ev-sub, .ev-cstats .ev-sub { font: 400 12.5px/1.35 var(--font); color: var(--muted); margin-top: 2px; }
.ev-types { display: flex; flex-direction: column; gap: 3px; font-size: 13px !important; font-weight: 400 !important; margin-top: 4px !important; }
.ev-types span { display: grid; grid-template-columns: minmax(0, 1fr) 70px 22px; gap: 8px; align-items: center; }
.ev-types b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev-types i { display: block; height: 6px; width: var(--w); background: var(--fg); border-radius: 0 2px 2px 0; }
.ev-types em { font-style: normal; text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); }
.ev-bars { margin: 14px 0 0; }
.ev-bars svg { display: block; width: 100%; height: 40px; margin-top: 4px; }
.ev-bars rect { fill: var(--fg); } .ev-bars rect.nil { fill: var(--line); } .ev-bars rect:hover { fill: var(--pen); }
.ev-bars-axis { display: flex; justify-content: space-between; margin-top: 3px; }
.ev-bulk { display: flex; align-items: center; gap: 14px; padding: 18px 0 8px; border-bottom: 2px solid var(--fg); }
.ev-bulk .btn { margin-left: auto; }
.ev-list { list-style: none; margin: 0; padding: 0; }
.ev-row { display: grid; grid-template-columns: 30px minmax(0, 1fr); align-items: start; border-bottom: 1px solid var(--line); }
.ev-row > input { margin: 17px 0 0 6px; width: 16px; height: 16px; accent-color: var(--fg); }
.ev-row.sel { background: color-mix(in srgb, var(--mark) 35%, transparent); }
.ev-open { all: unset; box-sizing: border-box; cursor: pointer; display: grid; grid-template-columns: 96px minmax(0, 1fr) 190px 104px 34px; gap: 14px; align-items: start; padding: 13px 8px 13px 4px; width: 100%; }
.ev-open:hover { background: var(--surface); } .ev-open:hover .ev-main b { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.ev-open:focus-visible { outline: 2px solid var(--accent-2); outline-offset: -2px; }
.ev-date { font: 500 13px/1.5 var(--font-mono); color: var(--muted); padding-top: 1px; }
.ev-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ev-main b { font-size: 15.5px; font-weight: 700; letter-spacing: -0.008em; line-height: 1.35; }
.ev-main > span { font-size: 13.5px; color: var(--muted); }
.ev-type .tag { white-space: normal; display: inline-block; }
.ev-loss { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; font-size: 14.5px; white-space: nowrap; }
.ev-loss .muted { font-weight: 400; font-size: 13px; }
.ev-unrev { font: 600 17px/1 var(--font-hand); color: var(--pen); white-space: nowrap; }
.rel { display: inline-flex; gap: 2px; align-items: flex-end; height: 16px; padding-top: 3px; }
.rel i { width: 5px; background: var(--line); border-radius: 1px; }
.rel i:nth-child(1) { height: 6px; } .rel i:nth-child(2) { height: 10px; } .rel i:nth-child(3) { height: 14px; }
.rel-Low i:nth-child(1) { background: var(--muted); }
.rel-Medium i:nth-child(-n+2) { background: var(--fg); }
.rel-High i { background: var(--pen); }
.ev-empty .sketch { width: 130px; }
.ev-empty p { margin: 4px 0; }

/* detail panel */
.ev-panel-wrap { position: fixed; inset: 0; z-index: 45; }
.ev-scrim { position: absolute; inset: 0; background: rgb(10 20 15 / 35%); }
.ev-panel { position: absolute; top: 0; right: 0; bottom: 0; width: min(580px, 100%); background: var(--surface); border-left: 2px solid var(--fg); display: flex; flex-direction: column; outline: none; box-shadow: -18px 0 50px rgb(0 0 0 / 14%); }
@media (prefers-reduced-motion: no-preference) { .ev-panel { animation: evp-in .18s ease-out; } }
@keyframes evp-in { from { transform: translateX(24px); opacity: 0; } }
.evp-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 12px 20px; border-bottom: 3px double var(--line-strong); }
.evp-status { margin: 0; font-size: 13.5px; color: var(--muted); }
.evp-ok { font: 600 19px/1 var(--font-hand); color: var(--good); } .evp-rej { font: 600 19px/1 var(--font-hand); color: var(--pen); }
.evp-body { padding: 16px 20px 24px; overflow: auto; flex: 1; }
.evp-body > .mono { margin: 0 0 4px; }
.evp-body h2 { font-size: 23px; font-weight: 800; letter-spacing: -0.02em; }
.evp-meta { margin: 8px 0 14px; font-size: 14px; color: var(--muted); line-height: 1.7; }
.evp-sec { border-top: 2px solid var(--fg); padding: 10px 0 6px; margin-top: 14px; }
.evp-sec h3 { margin: 0 0 6px; font-size: 14.5px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.evp-sec h4 { margin: 12px 0 4px; font-size: 13px; font-weight: 700; color: var(--muted); }
.evp-sec p { margin: 0 0 6px; } .evp-sec ul, .evp-sec ol { margin: 4px 0 6px; padding-left: 20px; }
.evp-sec li { margin-bottom: 4px; }
.evp-amt { font: 800 26px/1.2 var(--font-head) !important; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.evp-amt .muted { font-size: 17px; font-weight: 600; }
.evp-rel { font-weight: 600; font-size: 13px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.evp-why { border-left: 3px solid var(--pen); padding-left: 10px; }
.evp-links { list-style: none; padding: 0 !important; }
.evp-links li { display: grid; grid-template-columns: 52px minmax(0, 1fr); gap: 8px; font-size: 14px; }
.evp-src li { font-size: 14px; } .evp-src li a { display: block; font-weight: 600; overflow-wrap: anywhere; }
.evp-flags { list-style: none; padding: 0 !important; } .evp-flags li { font-size: 14px; border-left: 3px solid var(--warn); padding-left: 8px; }
.evp-foot { border-top: 2px solid var(--fg); padding: 12px 20px calc(12px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: 8px; background: var(--surface); }
.evp-foot .row + .row { justify-content: flex-start; }
.ev-edit { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 14px; }
.ev-edit .wide { grid-column: 1 / -1; }
.ev-edit fieldset { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.ev-cov { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 6px 14px; margin: 12px 0; }
.ev-cov dt { font-weight: 700; } .ev-cov dd { margin: 0; }

/* review queue */
.ev-seg { display: inline-flex; border: 1px solid var(--fg); border-radius: 3px; margin-bottom: 14px; flex-wrap: wrap; }
.ev-seg button { border: 0; background: none; padding: 7px 14px; font-weight: 600; cursor: pointer; border-right: 1px solid var(--line-strong); }
.ev-seg button:last-child { border-right: 0; }
.ev-seg button.on { background: var(--fg); color: var(--on-accent); }
.ev-seg .count { font: 500 12px var(--font-mono); opacity: .75; margin-left: 4px; }
.ev-qbar { display: flex; align-items: center; gap: 12px; border-bottom: 2px solid var(--fg); padding-bottom: 8px; }
.ev-qbar .btn { margin-left: auto; }
.ev-queue { list-style: none; margin: 0; padding: 0; }
.ev-q { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px; padding: 14px 4px 14px 46px; border-bottom: 1px solid var(--line); position: relative; }
.ev-q h3 { margin: 4px 0; font-size: 16.5px; font-weight: 700; }
.ev-q p { margin: 4px 0; } .ev-q-meta { font-size: 13px; color: var(--muted); }
.ev-q-acts { display: flex; gap: 6px; align-items: flex-start; }
.ev-q::before { content: ""; position: absolute; left: 12px; top: 16px; width: 24px; height: 24px; background: center / contain no-repeat; }
.ev-q.done-ok, .ev-q.done-no { opacity: .55; }
.ev-q.done-ok::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3.5 13.5l5.2 5.5C12 10.5 16.5 5.6 21.5 3' fill='none' stroke='%232e6b3f' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
.ev-q.done-no::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5 5.5c4.5 4 9 8.6 14 13.5M18.5 4.5C13.5 9.5 9 14 4.5 19.5' fill='none' stroke='%23b8322a' stroke-width='2.4' stroke-linecap='round'/%3E%3C/svg%3E"); }
.ev-q.done-no h3 { text-decoration: line-through; text-decoration-color: var(--pen); }
.ev-q.done-ok .ev-q-acts, .ev-q.done-no .ev-q-acts { visibility: hidden; }

/* coverage */
.ev-setup { border-top: 4px solid var(--pen); }
.ev-steps { margin: 10px 0 0; padding: 0; list-style: none; counter-reset: st; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; }
.ev-steps li { counter-increment: st; padding: 4px 18px 8px 0; display: flex; flex-direction: column; gap: 4px; align-items: flex-start; color: var(--muted); }
.ev-steps li + li { padding-left: 18px; border-left: 1px solid var(--line); }
.ev-steps b::before { content: counter(st) ". "; color: var(--pen); }
.ev-steps li.done b { text-decoration: line-through; text-decoration-color: var(--good); color: var(--muted); }
.ev-steps li.now { color: var(--fg); } .ev-steps li.now b { font-size: 16px; }
.ev-steps span { font-size: 13.5px; }
.ev-switch { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; cursor: pointer; }
.ev-switch input { appearance: none; width: 40px; height: 22px; border: 2px solid var(--fg); border-radius: 12px; background: var(--surface); position: relative; cursor: pointer; margin: 0; }
.ev-switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--fg); transition: left .15s; }
.ev-switch input:checked { background: var(--good); border-color: var(--good); }
.ev-switch input:checked::after { left: 20px; background: var(--surface); }
.ev-cstats .meter { margin: 6px 0 0; max-width: 220px; }
.ev-running { display: flex; align-items: center; gap: 12px; margin-top: 14px; padding: 10px 12px; border: 1px dashed var(--pen); border-radius: 3px; }
.ev-running p { margin: 2px 0 0; } .ev-running .btn { margin-left: auto; }
.ev-run-btns { margin: 14px 0 8px; }
.ev-cov-form fieldset.ev-cv { border: 0; padding: 0; margin: 18px 0 0; min-width: 0; }
.ev-cv legend { font-weight: 700; padding: 0; margin-bottom: 8px; }
.ev-cv legend em { font-style: normal; font-weight: 400; color: var(--muted); font-size: 13.5px; margin-left: 6px; }
.ev-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px; }
.ev-opt2 { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--line-strong); border-radius: 3px; padding: 9px 10px; cursor: pointer; background: var(--surface); }
.ev-opt2 input { margin: 3px 0 0; width: 16px; height: 16px; accent-color: var(--fg); flex: none; }
.ev-opt2 span { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.ev-opt2 b { font-size: 14px; } .ev-opt2 small { color: var(--muted); font-size: 12.5px; line-height: 1.35; }
.ev-opt2:has(input:checked) { border-color: var(--fg); box-shadow: inset 3px 0 0 var(--pen); }
.ev-form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 18px; margin-top: 18px; }
.ev-form-grid .ev-wide { grid-column: 1 / -1; }
.ev-form-grid small { font-size: 12.5px; }
.ev-adv { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 10px; }
.ev-adv summary { cursor: pointer; font-weight: 700; }
.ev-msg summary { cursor: pointer; color: var(--accent-2); }
.ev-msg p { margin: 4px 0 0; max-width: 46ch; }

@media (max-width: 1100px) {
  .ev-open { grid-template-columns: 88px minmax(0, 1fr) 96px 30px; }
  .ev-type { display: none; }
}
@media (max-width: 860px) {
  .ev-layout { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .ev-filters { position: static; max-height: none; border: 1px solid var(--fg); border-radius: 3px; padding: 0; overflow: visible; }
  .ev-filters > summary { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; font-weight: 700; cursor: pointer; list-style: none; }
  .ev-filters > summary::after { content: "Show"; font-weight: 600; color: var(--accent-2); font-size: 14px; }
  .ev-filters[open] > summary::after { content: "Hide"; }
  .ev-filters > summary::-webkit-details-marker { display: none; }
  .ev-filters > div { padding: 0 14px 4px; }
  .ev-sort { margin-left: 0; }
  .ev-open { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "main rel" "date loss"; gap: 4px 12px; }
  .ev-main { grid-area: main; } .ev-rel { grid-area: rel; } .ev-date { grid-area: date; } .ev-loss { grid-area: loss; }
  .ev-steps { grid-template-columns: minmax(0, 1fr); }
  .ev-steps li + li { border-left: 0; padding-left: 0; border-top: 1px solid var(--line); padding-top: 10px; }
  .ev-form-grid, .ev-edit { grid-template-columns: minmax(0, 1fr); }
  .ev-q { grid-template-columns: minmax(0, 1fr); padding-left: 40px; }
  .ev-q::before { left: 8px; }
  .ev-panel { border-left: 0; }
}
@media (max-width: 520px) {
  .ev-stats { grid-template-columns: minmax(0, 1fr); }
  .ev-stats div { border-right: 0; border-bottom: 1px solid var(--line); padding-left: 0 !important; padding-bottom: 8px; }
  .ev-bulk { flex-wrap: wrap; }
  .ev-cov { grid-template-columns: minmax(0, 1fr); gap: 0 0; } .ev-cov dd { margin-bottom: 8px; }
}
.ev-types, .ev-cstats dd, .ev-stats dd { font-variant-numeric: proportional-nums; }
@media (max-width: 520px) {
  .ev-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ev-stats div:nth-child(2) { border-right: 0; padding-left: 12px !important; }
  .ev-stats div:nth-child(3) { display: none; }
  .ev-stats div { border-bottom: 0; }
  .evp-foot { padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px)); gap: 4px; }
  .evp-foot .row:first-child { flex-wrap: nowrap; }
  .evp-foot .row:first-child .btn { flex: 1 1 auto; padding-inline: 10px; white-space: normal; min-height: 42px; line-height: 1.2; }
  .evp-foot .row + .row .btn { padding-inline: 8px; }
  .evp-body { padding: 12px 16px 20px; }
  .evp-head { padding: 10px 16px; }
}
.ev-sched { margin: 6px 0 0; color: var(--muted); font-size: 14.5px; }
.ev-sched b { color: var(--fg); }
.ev-freq { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.ev-freq-opt b { font-size: 16px; }
.ev-freq-opt small + small { margin-top: 4px; }
.ev-cost { font-style: normal; font-weight: 700; font-size: 13.5px; margin-top: 6px; font-variant-numeric: proportional-nums; }
.ev-when { display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap; margin-top: 12px; }
.ev-when .field { width: 210px; }
.ev-est { margin: 0 0 8px; font-size: 14.5px; }
.ev-reg { flex-direction: column; gap: 8px; cursor: default; }
.ev-reg > label { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.ev-reg > label input { margin: 3px 0 0; width: 16px; height: 16px; accent-color: var(--fg); flex: none; }
.ev-reg > label span { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.ev-reg select { padding: 4px 6px; font-size: 13.5px; margin-left: 26px; width: calc(100% - 26px); }
.ev-reg:not(:has(input:checked)) select { display: none; }
.ev-plans { max-width: 560px; margin-top: 12px; }
.ev-plans td, .ev-plans th[scope=row] { padding: 6px 10px; vertical-align: middle; }
.ev-plans th[scope=row] { border-bottom: 1px solid var(--line); font-size: 14px; }
.ev-plans .inp { max-width: 110px; padding: 5px 8px; }
@media (max-width: 860px) { .ev-freq { grid-template-columns: minmax(0, 1fr); } .ev-when .field { width: 100%; } }
.ua-how, .ua-pw { grid-column: 1 / -1; border: 0; padding: 0; margin: 0; display: flex; gap: 6px 22px; flex-wrap: wrap; }
.ua-how legend { font-size: 13.5px; font-weight: 600; padding: 0; margin-bottom: 4px; }
.user-add .check { flex-direction: row; font-weight: 400; font-size: 14px; align-items: flex-start; }
.ua-pw { flex-direction: column; gap: 8px; }
.ua-pw > label:first-child { max-width: 420px; }
.ua-pwrow { display: flex; gap: 8px; }
.ta-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; margin: 6px 0 4px; }
@media (max-width: 520px) { .ta-grid { grid-template-columns: minmax(0, 1fr); } }

/* ---------- heat map ---------- */
.hm-wrap { overflow-x: auto; }
.hm-svg { display: block; width: 100%; max-width: 700px; height: auto; }
.hm-cell[tabindex] { cursor: pointer; }
.hm-cell[tabindex]:hover rect { stroke: #1f2421; stroke-width: 2; }
.hm-cell:focus { outline: none; } .hm-cell:focus-visible rect { stroke: #24456e; stroke-width: 4; }
.hm-tools { display: flex; gap: 12px 16px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 10px; }
.hm-tools .ev-seg { margin-bottom: 0; }
.hm-f { display: flex; flex-direction: column; gap: 3px; font-size: 13px; font-weight: 600; }
.hm-f select { min-width: 180px; max-width: 260px; }
.hm-dl { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; padding-bottom: 12px; border-bottom: 2px solid var(--fg); margin-bottom: 16px; }
.hm-dl .link { margin-left: auto; }
.hm-layout { display: grid; grid-template-columns: minmax(0, 700px) minmax(260px, 1fr); gap: 28px; align-items: start; }
.hm-main { background: #fbfbf8; border: 1px solid var(--line); padding: 8px; }
.hm-main > p { padding: 0 8px; }
.hm-side h2 { font-size: 20px; display: flex; flex-direction: column; gap: 2px; }
.hm-side h3 { font-size: 14.5px; margin: 18px 0 6px; border-top: 2px solid var(--fg); padding-top: 8px; }
.hm-bands { margin: 12px 0 4px; display: grid; gap: 6px; }
.hm-bands div { display: grid; grid-template-columns: 96px minmax(0, 1fr); align-items: center; gap: 8px; }
.hm-bands dt { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; }
.hm-bands dt i, .sc-b i { width: 14px; height: 14px; display: inline-block; border: 1px solid rgb(0 0 0 / 15%); flex: none; }
.hm-bands dd { margin: 0; display: flex; align-items: center; gap: 8px; }
.hm-bar-v { display: block; height: 8px; background: var(--fg); border-radius: 0 2px 2px 0; min-width: 2px; }
.hm-bands b { font-variant-numeric: tabular-nums; }
.hm-flag { border-left: 3px solid var(--pen); padding: 6px 10px; margin-top: 14px; font-size: 14px; background: var(--surface); }
.hm-flag p { margin: 4px 0 0; }
.hm-top { margin: 0; padding-left: 20px; } .hm-top li { margin-bottom: 8px; } .hm-top p { margin: 2px 0 0; }
.hm-cellhead { border-top: 6px solid var(--band); padding-top: 8px; display: flex; flex-direction: column; gap: 2px; }
.hm-cellhead b { font-size: 17px; } .hm-cellhead span { color: var(--muted); font-size: 14px; }
.hm-list { list-style: none; padding: 0; margin: 10px 0 14px; }
.hm-list li { display: grid; grid-template-columns: 52px minmax(0, 1fr); gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.hm-list p { margin: 0 0 2px; }
.hm-panel { background: var(--surface); border: 1px solid var(--line); border-top: 4px solid var(--fg); padding: 12px 16px; margin-bottom: 18px; }
.hm-panel > summary { display: flex; gap: 12px; align-items: baseline; flex-wrap: wrap; cursor: pointer; list-style: none; }
.hm-panel > summary::-webkit-details-marker { display: none; }
.hm-panel > summary h2 { font-size: 17px; }
.hm-bar { display: flex; gap: 10px; align-items: center; margin: 10px 0; flex-wrap: wrap; }
.hm-bar .ev-seg { margin-bottom: 0; }
.hm-panel .hm-svg { max-width: 600px; }
/* settings: the scale */
.sc-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 560px); gap: 28px; align-items: start; margin-top: 12px; }
.sc-f { border: 0; padding: 0; margin: 0 0 16px; display: flex; flex-direction: column; gap: 6px; }
.sc-f legend { font-weight: 700; margin-bottom: 6px; padding: 0; } .sc-f legend em { font-style: normal; font-weight: 400; color: var(--muted); }
.sc-bands { display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; }
.sc-b { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; }
.sc-b .inp { width: 64px; padding: 5px 6px; }
.sc-levels td { min-width: 0; } .sc-levels td:nth-child(2) { min-width: 0; }
.sc-levels .inp { margin-bottom: 4px; font-weight: 600; }
.sc-levels textarea { font-size: 13px; padding: 5px 8px; }
.sc-levels th[scope=row] { font-size: 16px; vertical-align: top; padding-top: 16px; width: 48px; }
.sc-right { position: sticky; top: 76px; }
@media (max-width: 1100px) { .hm-layout, .sc-grid { grid-template-columns: minmax(0, 1fr); } .sc-right { position: static; } }
@media (max-width: 600px) { .hm-f, .hm-f select { width: 100%; max-width: none; } .hm-dl .link { margin-left: 0; flex-basis: 100%; } }
.hm-show { color: var(--accent-2); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.hm-panel:not([open]) { padding-bottom: 12px; }
@media (max-width: 600px) { .hm-main .hm-svg, .hm-panel .hm-svg { min-width: 540px; } }
.name-list { margin: 6px 0 12px; padding-left: 20px; font-weight: 600; }

/* ---------- loss analytics ---------- */
.lc-near { align-self: center; margin-top: 18px; }
.hm-dl .lc-dl { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.lc-stats { grid-template-columns: repeat(5, minmax(0, 1fr)); margin: 4px 0 22px; }
.lc-stats .ev-sub { font: 400 12.5px/1.35 var(--font); color: var(--muted); margin-top: 2px; }
.lc-panel { margin-bottom: 26px; }
.lc-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; border-top: 2px solid var(--fg); padding-top: 8px; margin-bottom: 8px; }
.lc-head h2 { font-size: 17px; margin-right: auto; }
.lc-head .ev-seg { margin-bottom: 0; }
.lc-chart { background: #fbfbf8; border: 1px solid var(--line); padding: 6px; overflow-x: auto; }
.lc-svg { display: block; width: 100%; height: auto; }
.lc-chart .lc-svg { min-width: 460px; }
.lc-bar:hover rect:first-child { fill: var(--pen); }
.lc-row[tabindex] { cursor: pointer; } .lc-row[tabindex]:hover > rect:first-child { fill: #eef0ea; }
.lc-row:focus { outline: none; } .lc-row:focus-visible > rect:first-child { fill: #e3e8ee; }
.lc-two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.lc-dl-grid { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 6px 14px; margin: 0; }
.lc-dl-grid dt { font-weight: 700; } .lc-dl-grid dd { margin: 0; }
@media (max-width: 1100px) { .lc-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); } .lc-two { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 600px) { .lc-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } .lc-stats div { border-right: 0; padding-left: 0 !important; } .hm-dl .lc-dl { margin-left: 0; } .lc-dl-grid { grid-template-columns: minmax(0, 1fr); } .lc-near { margin-top: 0; } }

/* ---------- Risk News ---------- */
.nw-admin { border: 1px dashed var(--pen); border-radius: 3px; padding: 10px 14px; margin-bottom: 20px; background: var(--surface); }
.nw-admin p { margin: 0 0 8px; }
.nw-issue { max-width: 860px; }
.nw-mast { border-top: 4px solid var(--fg); padding-top: 12px; }
.nw-kicker { margin: 0; font-size: 13.5px; color: var(--muted); font-weight: 600; }
.nw-title { font-size: 34px; font-weight: 800; letter-spacing: -0.025em; line-height: 1.1; margin: 6px 0 10px; }
.nw-brief { font-size: 18.5px; line-height: 1.55; margin: 0 0 10px; max-width: 68ch; }
.nw-tools { margin-bottom: 4px; }
.nw-figs { grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 16px 0 6px; }
.nw-figs dd { font-variant-numeric: proportional-nums; }
.nw-figs .ev-sub { font: 400 12.5px/1.35 var(--font); color: var(--muted); }
.nw-sec { margin-top: 26px; }
.nw-sec h3 { font-size: 18px; border-top: 2px solid var(--fg); padding-top: 8px; margin: 0 0 10px; }
.nw-sec h4 { font-size: 15px; margin: 16px 0 4px; }
.nw-close { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.nw-card { background: var(--surface); border: 1px solid var(--line-strong); border-left: 4px solid var(--pen); padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; }
.nw-card p { margin: 0; font-size: 14.5px; } .nw-card b { font-size: 15.5px; line-height: 1.3; }
.nw-card-k { font-size: 12.5px !important; color: var(--muted); }
.nw-q { background: var(--sunk); padding: 6px 8px; } .nw-q span { display: block; font-size: 12px; font-weight: 700; color: var(--muted); }
.nw-card .row { margin-top: auto; padding-top: 4px; }
.nw-theme { border-left: 3px solid var(--pen); padding: 2px 0 2px 12px; margin-bottom: 12px; }
.nw-theme p { margin: 2px 0; }
.nw-chip { display: inline-block; font-size: 13px; border: 1px solid var(--line-strong); padding: 0 7px; margin: 2px 4px 0 0; border-radius: 2px; text-decoration: none; }
.nw-items { list-style: none; padding: 0; margin: 0; }
.nw-items li { padding: 9px 0; border-bottom: 1px solid var(--line); }
.nw-items p { margin: 2px 0; }
.nw-src { font-size: 13px; color: var(--muted); }
.nw-archive { margin-top: 34px; max-width: 860px; }
.nw-archive h2 { font-size: 17px; border-top: 2px solid var(--fg); padding-top: 8px; }
.nw-archive ul { list-style: none; padding: 0; } .nw-archive li { padding: 8px 0; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; }
.nw-archive li.on a { font-weight: 800; }
.nw-ed .panel { max-width: 900px; }
.nw-ed h3 { margin-top: 18px; }
.nw-ed .field { margin-top: 10px; }
.nw-ed-close, .nw-ed-theme { border-left: 3px solid var(--line-strong); padding: 6px 0 6px 12px; margin: 8px 0; display: flex; flex-direction: column; gap: 6px; }
.nw-ed-theme { flex-direction: column; }
.nw-ed-items { list-style: none; padding: 0; } .nw-ed-items li { padding: 8px 0; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; }
.nw-ed-items textarea { font-size: 14px; }
.nw-pub { border-top: 4px solid var(--accent-2); }
.nw-ed-bar { position: sticky; bottom: 0; background: var(--bg); border-top: 2px solid var(--fg); padding: 12px 0; margin-top: 16px; display: flex; gap: 8px; flex-wrap: wrap; z-index: 5; }
.ns-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 14px; margin-top: 10px; }
.ns-grid .ns-wide { grid-column: 1 / -1; }
@media (max-width: 760px) { .nw-figs { grid-template-columns: repeat(2, minmax(0, 1fr)); } .nw-figs div { border-right: 0; padding-left: 0 !important; } .ns-grid { grid-template-columns: minmax(0, 1fr); } .nw-title { font-size: 27px; } }
