/* Korpex — dense, clean, attorney-facing. No external assets. The working tokens
   below take the brand's values (the --kx-* tokens further down; SaaS phase 1). */

:root {
  --ink: #16213A;
  --ink-soft: #5E6B82;
  --line: #DDE3EC;
  --line-soft: #EDF0F5;
  --paper: #F4F6F9;
  --card: #ffffff;
  --accent: #0B1F3A;
  --accent-soft: #EEF1F6;
  --good: #1e7a3c;
  --good-bg: #e7f4ec;
  --warn: #9a6b00;
  --warn-bg: #fdf3dd;
  --bad: #b02a2a;
  --bad-bg: #fbeaea;
  --priv: #7a1f4d;
  --priv-bg: #f9e9f1;
  --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
}

* { box-sizing: border-box; }
/* every size is in rem: this one setting scales the whole workbench (16px from
   2026-10-22; 13px read too small in investigation reports) */
html { font-size: 16px; }
body {
  margin: 0;
  font-family: "IBM Plex Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: var(--paper);
  line-height: 1.5;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.35rem; margin: 0 0 .25rem; }
h2 { font-size: 1.05rem; margin: 1.4rem 0 .5rem; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin: 1.4rem 0 .5rem; }
.section-head h2 { margin: 0; }
h3 { font-size: .95rem; margin: 1rem 0 .4rem; }

.muted { color: var(--ink-soft); }
.small { font-size: .85rem; }
.mono { font-family: var(--mono); font-size: .85rem; }

table.data {
  width: 100%; background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  border-collapse: separate; border-spacing: 0; overflow: hidden;
}
table.data th, table.data td {
  border-bottom: 1px solid var(--line-soft); padding: .55rem .8rem;
  text-align: left; vertical-align: top;
}
table.data th {
  background: #F7F8FA; font-weight: 600; font-size: .78rem; color: var(--ink-soft);
  border-bottom-color: var(--line); white-space: nowrap;
}
table.data tbody tr:last-child td { border-bottom: 0; }
/* a table wider than its column scrolls inside this box, not the whole page */
.table-scroll { overflow-x: auto; }
.table-scroll > table.data { min-width: 68rem; }  /* columns keep a readable width; the box scrolls */
table.data tr:hover td { background: #FAFBFD; }

.badge {
  display: inline-block; padding: .05rem .45rem; border-radius: 9px;
  font-size: .75rem; font-weight: 600; white-space: nowrap;
}
.badge-responsive { background: var(--good-bg); color: var(--good); }
.badge-not_responsive { background: #eceff3; color: var(--ink-soft); }
.badge-unsure { background: var(--warn-bg); color: var(--warn); }
.badge-priv { background: var(--priv-bg); color: var(--priv); }
.badge-fail { background: var(--bad-bg); color: var(--bad); }
.badge-ok { background: var(--good-bg); color: var(--good); }
.badge-warn { background: var(--warn-bg); color: var(--warn); }
.badge-stage { background: var(--accent-soft); color: var(--accent); }
.badge-deferred { background: var(--warn-bg); color: var(--warn); }

.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 14px; padding: 1rem 1.25rem; margin-bottom: .9rem;
}
.card .card-head {
  display: flex; gap: .6rem; align-items: baseline; flex-wrap: wrap;
}
.card .card-head .subject { font-weight: 600; }
.card .meta { color: var(--ink-soft); font-size: .85rem; }
.card .reasoning {
  margin: .5rem 0; padding: .5rem .7rem;
  background: var(--accent-soft); border-left: 3px solid var(--accent);
  border-radius: 0 4px 4px 0;
}
.chips { display: flex; gap: .35rem; flex-wrap: wrap; margin: .35rem 0; }
.chip {
  display: inline-block; background: #fff; border: 1px solid var(--line);
  border-radius: 10px; padding: .05rem .5rem; font-size: .78rem;
  font-family: var(--mono);
}
.chip.chip-bad { border-color: var(--bad); color: var(--bad); }
.confidence { font-weight: 600; }

.tag-controls { display: inline-flex; gap: .4rem; align-items: center; }
button, .btn {
  font: inherit; font-size: .88rem; font-weight: 500; cursor: pointer;
  background: var(--card); color: var(--accent);
  border: 1px solid var(--line); border-radius: 8px; padding: .4rem .85rem;
}
button:hover, .btn:hover { border-color: #B9C3D2; }
button.primary, .btn.primary {
  background: var(--accent); color: #fff; border-color: var(--accent); font-weight: 600;
}
button.primary:hover, .btn.primary:hover { background: var(--kx-deep); border-color: var(--kx-deep); }
button:disabled { opacity: .55; cursor: not-allowed; }
input[type=text], input[type=date], textarea, select {
  font: inherit; width: 100%; padding: .5rem .7rem;
  border: 1px solid var(--kx-input); border-radius: 10px; background: #fff; color: var(--ink);
}
input[type=text]:focus, input[type=date]:focus, textarea:focus, select:focus {
  outline: 2px solid var(--kx-signal); outline-offset: 1px;
}
textarea.expansions { font-family: var(--mono); font-size: .85rem; min-height: 9rem; }
form.inline { display: flex; gap: .5rem; align-items: flex-start; }
form.inline input[type=text] { flex: 1; }
button.small { font-size: .78rem; padding: .15rem .5rem; }
button.danger { color: var(--bad); }
button.danger:hover { border-color: var(--bad); }
/* Ask: billed totals (BILLING_MARKUP x AI cost) */
.cost-summary { display: flex; flex-wrap: wrap; gap: .75rem; align-items: stretch; margin: 1rem 0 .25rem; }
.cost-tile { background: var(--card); border: 1px solid var(--line); border-radius: 6px;
  padding: .5rem .9rem; min-width: 9rem; }
.cost-label { font-size: .75rem; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .03em; }
.cost-value { font-size: 1.35rem; font-weight: 600; font-variant-numeric: tabular-nums; }
/* Ask: deleted sessions stay listed with their costs (migration 0016) */
.session-filter { margin: -.25rem 0 .5rem; }
table.data td.row-action { white-space: nowrap; }
table.data td.row-action form { margin: 0; }
table.data tr.deleted td { color: var(--ink-soft); }
form.session-actions { margin: 0 0 1rem; }
.session-deleted form { margin-top: .5rem; }

pre.body {
  white-space: pre-wrap; word-wrap: break-word;
  background: #fff; border: 1px solid var(--line-soft); border-radius: 4px;
  padding: .7rem .9rem; font-family: inherit; font-size: .95rem; margin: .4rem 0;
}
details.quoted { margin: .5rem 0; }
details.quoted summary {
  cursor: pointer; color: var(--ink-soft); font-size: .85rem;
}
details.quoted pre {
  white-space: pre-wrap; background: #f7f8fa; border: 1px dashed var(--line);
  border-radius: 4px; padding: .6rem .8rem; color: var(--ink-soft);
  font-family: inherit; font-size: .88rem;
}

.headers { width: 100%; border-collapse: collapse; margin: .3rem 0 .8rem; }
.headers th {
  text-align: right; color: var(--ink-soft); font-weight: 500;
  padding: .12rem .6rem .12rem 0; white-space: nowrap; width: 7rem;
  vertical-align: top; font-size: .85rem;
}
.headers td { padding: .12rem 0; }

.statgrid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(135px, 1fr));
  gap: .6rem; margin: .6rem 0 1rem;
}
.stat {
  background: var(--card); border: 1px solid var(--line); border-radius: 6px;
  padding: .5rem .7rem; text-align: center;
}
.stat .n { font-size: 1.3rem; font-weight: 600; color: var(--accent); }
.stat .l { font-size: .75rem; color: var(--ink-soft); text-transform: uppercase; }
.stat.stat-wide { grid-column: span 2; text-align: left; }
.stat.stat-wide .n, .stat.stat-wide .l { text-align: center; }
.stat ol.reasons { margin: .3rem 0 0; padding-left: 1.1rem; font-size: .78rem; color: var(--ink); }
.stat ol.reasons .num { color: var(--ink-soft); }

ul.tree, ul.tree ul { list-style: none; margin: 0; padding-left: 1.1rem; }
ul.tree li {
  position: relative; padding-left: .9rem; margin: .15rem 0;
}
ul.tree li::before {
  content: ""; position: absolute; left: 0; top: .65em;
  width: .6rem; border-top: 1px solid var(--line);
}
.thread-row.current { background: var(--accent-soft); }
.section-note {
  background: var(--warn-bg); border: 1px solid #ecd9a8; color: var(--warn);
  border-radius: 4px; padding: .4rem .7rem; margin: .6rem 0; font-size: .88rem;
}
.ok { color: var(--good); }
.err { color: var(--bad); }
.noncompliant-bar {
  background: var(--bad); color: #fff; padding: .45rem 1rem; font-size: .9rem;
  text-align: center;
}
.noncompliant {
  background: var(--bad-bg); color: var(--bad); border: 2px solid var(--bad);
  border-radius: 4px; padding: .45rem .75rem; margin: .6rem 0;
}

/* --- additions: layout, results, doc view, dashboard ----------------------- */
.foot { margin-top: auto; padding: 1rem 2rem 1.5rem; color: var(--ink-soft); font-size: .78rem; }
.nowrap { white-space: nowrap; }
.num, table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
.crumbs { font-size: .85rem; color: var(--ink-soft); margin-bottom: .4rem; }
.crumbs a { color: var(--ink-soft); }
.page-head { display: flex; gap: 1rem; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; }
.page-head .actions { display: flex; gap: .4rem; flex-wrap: wrap; }
.query-text {
  font-size: 1.05rem; margin: .2rem 0 .3rem; padding: .35rem .6rem;
  background: var(--card); border: 1px solid var(--line); border-radius: 4px;
}
.filters { display: flex; gap: .3rem; flex-wrap: wrap; margin: .8rem 0 .6rem; }
.filters a {
  border: 1px solid var(--line); border-radius: 12px; padding: .1rem .65rem;
  background: var(--card); font-size: .82rem;
}
.filters a.on { background: var(--accent); color: #fff; border-color: var(--accent); }

.jcard.flagged { border-color: var(--bad); box-shadow: inset 3px 0 0 var(--bad); }
.jcard.priv { border-color: #d9b3c6; box-shadow: inset 3px 0 0 var(--priv); }
.jcard .card-head .subject { font-size: 1rem; }
.flag {
  background: var(--bad-bg); color: var(--bad); border-radius: 4px;
  padding: .3rem .6rem; margin: .4rem 0; font-size: .85rem;
}
.cites { margin: .35rem 0 0; padding: 0; list-style: none; }
.cites li { margin: .15rem 0; font-size: .88rem; }
.cites .q { font-style: italic; color: var(--ink); }
.cites .why { color: var(--bad); font-size: .8rem; }
.card-foot {
  display: flex; justify-content: space-between; align-items: center; gap: .6rem;
  flex-wrap: wrap; margin-top: .5rem; padding-top: .4rem;
  border-top: 1px solid var(--line-soft); font-size: .8rem; color: var(--ink-soft);
}
.tag-controls form { display: inline-flex; gap: .3rem; margin: 0; }
button.on-agree { background: var(--good-bg); color: var(--good); border-color: var(--good); }
button.on-disagree { background: var(--bad-bg); color: var(--bad); border-color: var(--bad); }
.terms { display: flex; flex-wrap: wrap; gap: .3rem; margin: .3rem 0; }
.term {
  background: var(--accent-soft); color: var(--accent); border-radius: 3px;
  padding: .05rem .45rem; font-size: .85rem;
}
.term.q { background: var(--accent); color: #fff; }
.term.add { background: var(--good-bg); color: var(--good); }
.term.del { background: var(--bad-bg); color: var(--bad); text-decoration: line-through; }
details.panel {
  background: var(--card); border: 1px solid var(--line); border-radius: 6px;
  padding: .5rem .9rem; margin: .6rem 0;
}
details.panel > summary { cursor: pointer; font-weight: 600; }
.kv { border-collapse: collapse; font-size: .85rem; }
.kv th { text-align: left; color: var(--ink-soft); font-weight: 500; padding: .1rem .8rem .1rem 0; vertical-align: top; }
.kv td { padding: .1rem 0; }

.doc-layout { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 1rem; align-items: start; }
@media (max-width: 920px) { .doc-layout { grid-template-columns: minmax(0, 1fr); } }
.side .card h3 { margin-top: 0; }
.priv-banner {
  background: var(--priv-bg); color: var(--priv); border: 1px solid #e3bfd2;
  border-radius: 4px; padding: .5rem .8rem; margin: .5rem 0;
}
mark { background: #fff1a8; color: inherit; padding: 0 .05rem; border-radius: 2px; }
ul.thread { list-style: none; margin: 0; padding: 0; font-size: .85rem; }
ul.thread li { padding: .2rem .3rem; border-radius: 3px; }
ul.thread li.current { background: var(--accent-soft); font-weight: 600; }
.d1 { padding-left: .9rem !important; } .d2 { padding-left: 1.8rem !important; }
.d3 { padding-left: 2.7rem !important; } .d4 { padding-left: 3.6rem !important; }
.d5 { padding-left: 4.5rem !important; } .d6 { padding-left: 5.4rem !important; }
.d7 { padding-left: 6.3rem !important; } .d8 { padding-left: 7.2rem !important; }
ul.tree li.current > .node { background: var(--accent-soft); font-weight: 600; border-radius: 3px; }

/* attachment text (ATTACHMENTS-SPEC §6): parts, extractor labels, cited passages */
.part-nav { display: flex; gap: .7rem; align-items: center; flex-wrap: wrap; margin: .3rem 0; font-size: .88rem; }
.part-nav select { font: inherit; padding: .1rem .3rem; border: 1px solid var(--line); border-radius: 4px; }
pre.attachment-text { max-height: none; }
.xlabel {
  font-family: var(--mono); font-size: .82em; color: var(--ink-soft);
  background: #eef0f4; border-radius: 2px; padding: 0 .15rem;
}
.cite-anchor { scroll-margin-top: 3rem; }
.cite-anchor:target + mark { outline: 2px solid var(--accent); }
table.file-meta th { font-weight: 500; }
table.file-meta td { word-break: break-word; }
ul.tree { font-size: .85rem; padding-left: 0; }
.occ td, .occ th { font-size: .8rem; }

meter.stage { width: 100%; height: .8rem; }
tr.bad td { background: var(--bad-bg); }
.small-json { font-family: var(--mono); font-size: .75rem; color: var(--ink-soft); white-space: pre-wrap; word-break: break-word; }
.ids a { margin-right: .25rem; }

/* --- investigation assistant (Ask) and conversations ---------------------- */
.field-label { display: block; font-weight: 600; margin: .2rem 0 .3rem; }
.ask-form textarea { font-size: .95rem; }
.ask-form fieldset.scope {
  border: 1px solid var(--line-soft); border-radius: 4px; margin: .6rem 0; padding: .4rem .7rem .6rem;
}
.ask-form legend { font-size: .85rem; color: var(--ink-soft); padding: 0 .3rem; }
.custodian-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: .1rem .8rem;
  max-height: 11rem; overflow-y: auto; padding: .2rem 0; font-size: .85rem;
}
label.check { white-space: nowrap; }
.dates { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; margin-top: .4rem; }
.dates input[type=date] {
  font: inherit; padding: .2rem .4rem; border: 1px solid var(--line); border-radius: 4px;
}
.form-foot { display: flex; gap: .8rem; align-items: center; flex-wrap: wrap; margin-top: .5rem; }
button[disabled] { opacity: .5; cursor: not-allowed; }
ul.problems { margin: .3rem 0 0; padding-left: 1.2rem; }

.turn { margin-bottom: 1.1rem; }
.turn.flagged { border-color: #e2b4b4; }
.turn-head { display: flex; gap: .5rem; align-items: baseline; flex-wrap: wrap; }
.turn-n { font-weight: 600; font-size: 1rem; color: var(--accent); }
p.question {
  font-size: 1.02rem; margin: .35rem 0; padding: .35rem .6rem; white-space: pre-wrap;
  background: var(--accent-soft); border-left: 3px solid var(--accent); border-radius: 0 4px 4px 0;
}
.mtext { white-space: pre-wrap; word-wrap: break-word; margin: .2rem 0; }
.turn h3 { border-bottom: 1px solid var(--line-soft); padding-bottom: .15rem; }
.validation-flags ul { margin: .3rem 0 0; padding-left: 1.2rem; }
/* the report's citation check, in the reader's terms (2026-10-22) */
.verify-summary {
  border: 1px solid var(--line); border-left-width: 4px; border-radius: 4px;
  padding: .5rem .8rem; margin: .6rem 0; font-size: .92rem;
}
.verify-summary p { margin: .2rem 0; }
.verify-summary.verify-ok { border-color: var(--good); background: var(--good-bg); }
.verify-summary.verify-bad { border-color: var(--bad); background: var(--bad-bg); }
.verify-summary.verify-warn { border-color: #e2c27a; background: #fffaf0; }
.verify-summary ul.problems { margin: .3rem 0 .2rem; padding-left: 1.2rem; }
.verify-summary details.tech { margin-top: .4rem; font-size: .8rem; color: var(--ink-soft); }
.verify-summary details.tech ul { margin: .2rem 0 0; padding-left: 1.2rem; }
/* severity (2026-10-22): red = the check found the report does not match a document;
   amber = nothing could be checked (no citation, no stated basis): the assistant's
   own reading. The list on top names each item once; the item says it again. */
.verified-note { color: var(--ink-soft); font-size: .85rem; font-weight: 600; }
.verified-note.all { color: var(--good); }
.checklist { list-style: none; margin: .3rem 0 .2rem; padding: 0; }
.checklist li {
  display: grid; grid-template-columns: auto 1fr; gap: .2rem .6rem; align-items: baseline;
  padding: .4rem .6rem; border-radius: 4px; margin: .25rem 0; background: #fff;
}
.checklist li.sev-warn { border-left: 4px solid var(--warn); }
.checklist li.sev-bad { border-left: 4px solid var(--bad); }
.checklist .sev {
  font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  padding: .1rem .4rem; border-radius: 3px; white-space: nowrap;
}
.checklist .sev-warn .sev { background: var(--warn-bg); color: var(--warn); }
.checklist .sev-bad .sev { background: var(--bad-bg); color: var(--bad); }
.checklist .where a { font-weight: 600; }
.checklist .said { font-style: italic; }
.checklist .what { grid-column: 2; color: var(--ink-soft); font-size: .9rem; }
.callout { margin: .4rem 0 .15rem; padding: .45rem .7rem; border-radius: 4px; font-size: .9rem; }
.callout strong { display: block; margin-bottom: .1rem; }
.callout-warn { background: var(--warn-bg); border-left: 4px solid var(--warn); color: #5c4300; }
.callout-bad { background: var(--bad-bg); border-left: 4px solid var(--bad); color: #6d1414; }
.cites .callout { font-size: .85rem; }
.claim.has-bad { border-left-color: var(--bad); background: #fffafa; }
.claim.has-warn { border-left-color: var(--warn); background: #fffdf6; }
ol.against > li.has-warn, tr.has-warn td { background: #fffdf6; }
ol.against > li.has-bad, tr.has-bad td { background: #fffafa; }
.claim-n { font-size: .78rem; font-weight: 600; color: var(--ink-soft); }
.item-n { font-weight: 700; color: var(--accent); font-size: .9rem; white-space: nowrap; }
.section-intro { margin: -.2rem 0 .4rem; color: var(--ink-soft); font-size: .88rem; }
ol.against { list-style: none; margin: .2rem 0; padding: 0; }
ol.against > li {
  display: grid; grid-template-columns: 2.4rem 1fr; padding: .45rem .6rem .45rem 0;
  margin: .3rem 0; border-radius: 4px;
}
ol.against > li > .item-n { grid-row: 1 / span 3; text-align: right; padding-right: .6rem; }
ol.against > li > :not(.item-n) { grid-column: 2; }
.cites .matched-note { color: var(--good); font-size: .8rem; }
.cites .aside-note, .acard .aside-note { color: var(--ink-soft); font-size: .8rem; font-style: italic; }
.cites li.cite-aside .q { color: var(--ink-soft); text-decoration: line-through; text-decoration-color: var(--line); }
:target { scroll-margin-top: 1rem; }
/* followed from the list on top: the item stands out */
li:target, tr:target { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }
li:target, tr:target td { background: var(--accent-soft); }
.recap-note { color: var(--ink-soft); background: #f7f8fa; border-color: var(--line); }
.badge-server { background: #eceff3; color: var(--ink-soft); }
.badge-st-supported { background: var(--good-bg); color: var(--good); }
.badge-st-contradicted { background: var(--bad-bg); color: var(--bad); }
.badge-st-mixed { background: var(--warn-bg); color: var(--warn); }
.badge-st-no_evidence_found { background: #eceff3; color: var(--ink-soft); }
.badge-st-unknown { background: var(--bad-bg); color: var(--bad); }
.badge-kind-fact { background: var(--accent); color: #fff; }
.badge-kind-inference { background: #efe7f7; color: #5b2e86; }
.badge-kind-absence { background: #eceff3; color: var(--ink-soft); border: 1px dashed var(--ink-soft); }
.badge-kind-unknown { background: var(--bad-bg); color: var(--bad); }
.finding { margin: .6rem 0 .9rem; }
.finding-head { display: flex; gap: .45rem; align-items: baseline; }
.fnum { font-weight: 600; }
.proposition { font-weight: 600; font-size: .98rem; }
ol.claims { list-style: none; margin: .3rem 0 0; padding: 0; }
.claim {
  margin: .35rem 0; padding: .35rem .6rem; border-radius: 0 4px 4px 0;
  border-left: 3px solid var(--line);
}
.claim-head { display: flex; gap: .45rem; align-items: baseline; flex-wrap: wrap; }
.claim-fact { border-left-color: var(--accent); background: #fbfcfe; }
.claim-inference { border-left: 3px dashed #7b4fa6; background: #fcf9fe; }
.claim-inference .mtext { font-style: italic; }
.claim-absence { border-left: 3px dotted var(--ink-soft); background: #fafafa; }
.claim-unknown { border-left-color: var(--bad); }
.flags { display: inline-flex; gap: .25rem; flex-wrap: wrap; }
.cite-n { font-family: var(--mono); font-size: .78rem; color: var(--ink-soft); }
.cites .who { font-size: .8rem; color: var(--ink-soft); }
table.timeline td { font-size: .88rem; }
table.timeline td .cites { margin: 0; }
ul.limitations { margin: .2rem 0; padding-left: 1.2rem; }
ul.limitations li.server { list-style: square; color: var(--ink-soft); }
ol.steps { margin: .3rem 0; padding-left: 1.6rem; }
.turn-progress { border-style: dashed; }
.turn-progress.done { border-style: solid; color: var(--ink-soft); }
/* how long an investigation takes, and that it runs on without the page */
.expect {
  background: var(--accent-soft); border: 1px solid #cfdaea; border-radius: 4px;
  padding: .45rem .75rem; margin: .6rem 0; font-size: .9rem;
}
.turn-progress .expect { margin-bottom: 0; }
.report-label {
  margin-top: .8rem; font-size: .75rem; font-weight: 600; letter-spacing: .04em;
  text-transform: uppercase; color: var(--accent);
}
table.data tr.active td { background: #fbfcfe; }
/* the home page: the matter to investigate, the matters' tools */
.ask-form select {
  font: inherit; width: 100%; padding: .35rem .5rem; margin-bottom: .5rem;
  border: 1px solid var(--line); border-radius: 4px; background: #fff;
}
table.matters td.tools { color: var(--ink-soft); }
.cost { margin-top: .6rem; }
.acard { border-color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); }
.acard.flagged { border-color: var(--bad); box-shadow: inset 3px 0 0 var(--bad); }

.conv-layout {
  display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 1rem; align-items: start;
}
@media (max-width: 920px) { .conv-layout { grid-template-columns: minmax(0, 1fr); } }
.member.priv { border-color: #d9b3c6; box-shadow: inset 3px 0 0 var(--priv); }
.digest { background: #fbfaf6; border: 1px dashed #c9bf9a; }
.badge-machine { background: #f3eedb; color: #6b5a12; text-transform: uppercase; letter-spacing: .03em; }
ul.statements, ul.participants { list-style: none; margin: .2rem 0; padding: 0; }
ul.statements li { padding: .35rem 0; border-bottom: 1px solid var(--line-soft); }
ul.statements li.bad { background: var(--bad-bg); }
.digest .q { font-style: italic; }

/* Narrow screens: wrap the top bar, let wide tables scroll inside themselves. */
@media (max-width: 760px) {
  table.data, table.kv { display: block; overflow-x: auto; }
  form.inline { flex-direction: column; align-items: stretch; }
}

/* --- Korpex brand: sign-in pages, settings, team (SaaS phase 1) ---------------------
   Tokens from the marketing site (korpex-site README). Fonts fall back to system
   faces until the self-hosted Space Grotesk / IBM Plex Sans / Archivo files land. */
:root {
  --kx-ink: #0B1F3A; --kx-deep: #122B4E; --kx-paper: #F4F6F9; --kx-text: #16213A;
  --kx-signal: #E39B2D; --kx-signal-text: #8A5A0E; --kx-signal-bg: #FFF1D6;
  --kx-slate: #52607A; --kx-muted: #5E6B82; --kx-line: #DDE3EC; --kx-input: #C9D2DE;
  --kx-good: #1E7A3C; --kx-good-bg: #E7F4EC; --kx-bad: #B02A2A; --kx-bad-bg: #FBEAEA;
  --kx-font: "IBM Plex Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  --kx-display: "Space Grotesk", "Segoe UI", system-ui, sans-serif;
  --kx-mark: "Archivo", "Segoe UI", system-ui, sans-serif;
}
body.kx { margin: 0; background: var(--kx-paper); color: var(--kx-text); font-family: var(--kx-font); }
.kx-wordmark { font-family: var(--kx-mark); font-weight: 700; letter-spacing: .06em; }
.kx-eyebrow { display: flex; align-items: center; gap: .5rem; margin: 0; font-size: .8rem; font-weight: 600;
  letter-spacing: .14em; text-transform: uppercase; color: var(--kx-signal); }
.kx-eyebrow::before { content: ""; width: .5rem; height: .5rem; border-radius: 50%; background: var(--kx-signal); }

.auth { min-height: 100vh; display: flex; flex-wrap: wrap; }
.auth-brand { flex: 1 1 26rem; box-sizing: border-box; background: var(--kx-ink); color: #D6DEEA; padding: 3rem;
  display: flex; flex-direction: column; justify-content: space-between; gap: 3rem; }
.auth-logo { display: flex; align-items: center; gap: .75rem; color: #fff; text-decoration: none; font-size: 1.2rem; }
.auth-pitch { display: flex; flex-direction: column; gap: 1.25rem; max-width: 30rem; }
.auth-headline { margin: 0; font-family: var(--kx-display); font-size: 2.6rem; line-height: 1.06; font-weight: 700;
  letter-spacing: -.02em; color: #fff; text-wrap: pretty; }
.auth-lead { margin: 0; font-size: 1.05rem; line-height: 1.6; color: #B8C2D4; }
.auth-note { margin: 0; font-size: .85rem; color: #8A97AD; }
.auth-main { flex: 1 1 26rem; box-sizing: border-box; display: flex; align-items: center; justify-content: center;
  padding: 3rem 1.5rem; }
.auth-form { width: 100%; max-width: 27rem; display: flex; flex-direction: column; gap: 1.1rem; }
.auth-title { margin: 0; font-family: var(--kx-display); font-size: 1.75rem; font-weight: 600; color: var(--kx-ink); }
.auth-sub { margin: 0; color: var(--kx-slate); line-height: 1.55; }
.auth-foot { margin: 0; color: var(--kx-slate); text-align: center; }
.auth a, .kx-settings a { color: var(--kx-ink); }
.auth a:hover, .kx-settings a:hover { color: var(--kx-signal-text); }
.auth .auth-logo, .auth .auth-logo:hover { color: #fff; }  /* the wordmark on the ink panel */

.kx-form { display: flex; flex-direction: column; gap: 1rem; }
.kx-inline-form { display: inline-flex; gap: .5rem; align-items: flex-end; margin: 0; flex-wrap: wrap; }
.kx-field { display: flex; flex-direction: column; gap: .35rem; min-width: 0; }
.kx-field label { font-size: .85rem; font-weight: 600; }
.kx-field-head { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; font-size: .85rem; }
.kx-row2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(12rem, 100%), 1fr)); gap: .9rem; }
.kx-input { min-height: 2.75rem; padding: 0 .85rem; border: 1px solid var(--kx-input); border-radius: 10px; background: #fff;
  font: inherit; color: var(--kx-text); box-sizing: border-box; width: 100%; }
.kx-input:focus, .kx-btn:focus-visible, .kx-link-btn:focus-visible { outline: 2px solid var(--kx-signal); outline-offset: 2px; }
.kx-hint { font-size: .8rem; color: var(--kx-muted); line-height: 1.45; }
/* the label is running text (it may hold links); the box sits in its left margin */
.kx-check { display: block; position: relative; padding-left: 1.75rem; line-height: 1.5; font-size: .92rem; color: #33405A; }
.kx-check input { position: absolute; left: 0; top: .2rem; width: 1.1rem; height: 1.1rem; margin: 0; accent-color: var(--kx-ink); }
.kx-btn { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; min-height: 2.6rem; padding: 0 1rem;
  border-radius: 10px; border: 1px solid var(--kx-line); background: #fff; color: var(--kx-ink); font: 500 .95rem var(--kx-font);
  text-decoration: none; cursor: pointer; }
.kx-btn:hover { border-color: #B9C3D2; color: var(--kx-ink); }
.kx-btn-ink { background: var(--kx-ink); border-color: var(--kx-ink); color: #fff; font-weight: 600; }
.kx-btn-ink:hover { background: var(--kx-deep); color: #fff; }
a.kx-btn, a.kx-btn:hover { text-decoration: none; }
a.kx-btn-ink, a.kx-btn-ink:hover { color: #fff; }
.kx-btn-wide { width: 100%; min-height: 3rem; }
.kx-btn-sm { min-height: 2rem; padding: 0 .7rem; font-size: .85rem; border-radius: 8px; }
.kx-link-btn { background: none; border: 0; padding: 0; font: inherit; color: inherit; text-decoration: underline; cursor: pointer; }
.kx-alert { margin: 0; padding: .75rem .9rem; border-radius: 10px; background: var(--kx-bad-bg); color: var(--kx-bad); }
.kx-ok { margin: 0; padding: .75rem .9rem; border-radius: 10px; background: var(--kx-good-bg); color: var(--kx-good); }
.kx-settings { display: flex; flex-direction: column; gap: .9rem; max-width: 40rem; }
.kx-settings h2 { margin: 0; }
.kx-settings h3 { margin: .4rem 0 0; font-size: .95rem; }
.kx-facts { display: grid; grid-template-columns: max-content 1fr; gap: .45rem 1.2rem; margin: 0; }
.kx-facts dt { font-size: .85rem; font-weight: 600; color: var(--kx-muted); }
.kx-facts dd { margin: 0; overflow-wrap: anywhere; }
.kx-doc { display: flex; flex-direction: column; gap: .6rem; line-height: 1.6; }
.kx-doc h2 { margin: .8rem 0 0; font-family: var(--kx-display); font-size: 1.1rem; color: var(--kx-ink); }
.kx-doc p { margin: 0; }

/* --- App shell (SaaS phase 1): sidebar, top bar, content ---------------------------
   The sidebar and the main column wrap (flex-wrap) instead of a breakpoint: below
   about 1000px (14.5rem + 48rem) the sidebar becomes a block above the page, so the
   tables keep the full width. No script needed. */
body.kx-app { margin: 0; background: var(--kx-paper); color: var(--kx-text); font-family: var(--kx-font); }
.kx-app h1 { font-family: var(--kx-display); font-size: 1.6rem; font-weight: 600; letter-spacing: -.01em;
  color: var(--kx-ink); margin: 0 0 .35rem; }
.kx-app h2 { font-family: var(--kx-display); font-size: 1.1rem; font-weight: 600; color: var(--kx-ink); }
.skip-link { position: absolute; left: -999px; top: .5rem; background: #fff; padding: .5rem .8rem; border-radius: 8px; z-index: 10; }
.skip-link:focus { left: .5rem; }
.shell { min-height: 100vh; display: flex; flex-wrap: wrap; }
.side { flex: 1 1 14.5rem; max-width: 100%; box-sizing: border-box; background: #fff; border-right: 1px solid var(--kx-line);
  padding: 1rem .75rem; display: flex; flex-direction: column; gap: .15rem; }
.shell-main { flex: 999 1 48rem; min-width: 0; display: flex; flex-direction: column; }
.side-brand { display: flex; align-items: center; gap: .6rem; padding: .25rem .6rem .9rem; text-decoration: none; font-size: 1.05rem; }
.side-firm { display: flex; flex-direction: column; line-height: 1.25; padding: .5rem .75rem; margin-bottom: .5rem;
  border: 1px solid #EDF0F5; border-radius: 10px; background: #F7F8FA; }
.side-firm span { font-size: .7rem; color: var(--kx-muted); }
.side-nav { display: flex; flex-direction: column; gap: .15rem; }
.nav-item { display: flex; align-items: center; gap: .6rem; min-height: 2.5rem; padding: 0 .6rem; border-radius: 8px;
  color: #33405A; text-decoration: none; font-size: .9rem; font-weight: 500; }
.kx-app .nav-item { color: #33405A; }
.kx-app .nav-item:hover { background: var(--kx-paper); color: var(--kx-ink); text-decoration: none; }
.kx-app .nav-item.on { background: #EEF1F6; color: var(--kx-ink); font-weight: 600; }
.nav-sec { font-size: .7rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--kx-muted);
  padding: 1.1rem .6rem .35rem; }
.side-matter { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem .4rem; padding: .1rem .6rem .5rem;
  font-size: .85rem; line-height: 1.35; }
.side-matter span:nth-child(2) { flex-basis: 100%; font-weight: 600; color: var(--kx-ink); overflow-wrap: anywhere; }
.side-user { display: flex; align-items: center; gap: .6rem; padding: .75rem .6rem .25rem; margin-top: auto;
  border-top: 1px solid #EDF0F5; }
.side-user form { margin: 0 0 0 auto; }
.side-user-name { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; font-size: .9rem; }
.side-user-name strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-user-name span { font-size: .75rem; color: var(--kx-muted); }
.avatar { flex: none; width: 2rem; height: 2rem; border-radius: 50%; background: var(--kx-ink); color: #fff;
  display: grid; place-items: center; font-weight: 600; font-size: .8rem; }
.icon-btn { display: grid; place-items: center; width: 2.25rem; height: 2.25rem; border: 0; border-radius: 8px;
  background: none; color: var(--kx-muted); cursor: pointer; }
.icon-btn:hover { background: var(--kx-paper); color: var(--kx-ink); }
.kx-icon { flex: none; }
.top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem;
  min-height: 3.75rem; padding: .6rem 2rem; box-sizing: border-box; background: #fff; border-bottom: 1px solid var(--kx-line); }
.top-title { font-weight: 600; font-size: .95rem; color: var(--kx-ink); overflow-wrap: anywhere; }
.top-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; }
.kx-app main { width: 100%; max-width: 1240px; margin: 0 auto; padding: 1.75rem 2rem 3rem; box-sizing: border-box; }
.kx-app .foot { margin-top: auto; padding: 1rem 2rem 1.5rem; font-size: .8rem; color: var(--kx-muted); }
@media (max-width: 62.5rem) {
  .side { border-right: 0; border-bottom: 1px solid var(--kx-line); }
  .side-nav { flex-direction: row; flex-wrap: wrap; }
  .nav-sec { flex-basis: 100%; padding-top: .6rem; }
  .side-user { margin-top: .6rem; }
  .top { padding: .6rem 1rem; }
  .kx-app main { padding: 1.25rem 1rem 2.5rem; }
}

/* home (SaaS phase 1) */
.page-intro { display: flex; flex-direction: column; gap: .25rem; margin-bottom: 1.25rem; }
.page-intro p { margin: 0; }
.quick-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin: .25rem 0 .5rem; }
.get-started { display: flex; flex-direction: column; gap: .9rem; padding: 1.25rem 1.4rem; }
.get-started h2 { margin: 0; }
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: .75rem;
  grid-template-columns: repeat(auto-fit, minmax(min(14rem, 100%), 1fr)); }
.steps li { border: 1px solid var(--line); border-radius: 12px; padding: 1rem; display: flex; flex-direction: column;
  gap: .4rem; background: #FBFCFD; }
.steps li span:not(.step-n) { color: var(--kx-slate); line-height: 1.5; font-size: .9rem; }
.steps .kx-btn { align-self: flex-start; margin-top: auto; }
.step-n { font-size: .75rem; font-weight: 600; color: var(--kx-signal-text); }

.session-tools { display: flex; gap: .5rem; margin: .5rem 0 1rem; }
.print-only { display: none; }

@media print {
  .print-only { display: block; }
  .side, .top, .foot, .skip-link, .noncompliant-bar, form, .no-print { display: none !important; }
  body.kx-app { background: #fff; }
  .shell, .shell-main { display: block; }
  .kx-app main { max-width: none; padding: 0; }
  .kx-app .card, .kx-app table.data { border-color: #c9d2de; break-inside: avoid; }
  a { color: inherit; text-decoration: none; }
}
