/* Recovery Energetra forensic report — Roundcube-style light theme */
:root {
  --bg: #f4f7fa;
  --surface: #ffffff;
  --surface-alt: #fafbfc;
  --border: #d8d9dc;
  --border-strong: #b8bbc1;
  --border-faint: #ebedef;
  --text: #303030;
  --text-muted: #6e7681;
  --text-faint: #9ba2ac;
  --link: #1976d2;
  --link-hover: #1565c0;
  --brand: #37beff;
  --row-hover: #f1f6fb;
  --row-selected: #cfe7f4;
  --accent-high: #c0392b;
  --accent-high-bg: #fdedec;
  --accent-medium: #b9750f;
  --accent-medium-bg: #fef5e7;
  --accent-low: #6d7c6d;
  --warn-bg: #fff8e1;
  --warn-border: #f0c674;
  --ok: #1f7a3a;
  --ok-bg: #e7f4eb;

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "SF Mono", Menlo, Consolas, "Liberation Mono", "Courier New", monospace;

  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px;
  --s-5: 24px; --s-6: 32px; --s-7: 48px;

  --container: 1200px;
  --radius: 3px;
  --shadow-sm: 0 1px 0 rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.10);
  --shadow-lg: 0 20px 60px rgba(0,0,0,0.18);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); }
body {
  font-family: var(--font);
  font-size: 13px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
body.needs-auth { overflow: hidden; }
body.authed { overflow: auto; }

a { color: var(--link); text-decoration: none; }
a:hover { color: var(--link-hover); text-decoration: underline; }
code, .mono { font-family: var(--mono); font-size: 0.92em; }
strong { font-weight: 600; }
em { font-style: italic; }
.nowrap { white-space: nowrap; }
.break-all { word-break: break-all; }
.faint { color: var(--text-faint); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.accent-high { color: var(--accent-high); font-weight: 600; }
.accent-medium { color: var(--accent-medium); font-weight: 600; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* App bar */
.appbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 50;
}
.appbar-inner {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 var(--s-4);
  display: flex; align-items: center; gap: var(--s-4);
  min-height: 52px;
}
.brand { display: flex; align-items: center; gap: var(--s-2); color: var(--text); font-weight: 600; font-size: 14px; }
.brand:hover { text-decoration: none; }
.brand-mark {
  display: inline-block; background: var(--accent-high); color: #fff;
  font-family: var(--mono); font-size: 11px; font-weight: 700; letter-spacing: 0.05em;
  padding: 4px 7px; border-radius: var(--radius);
}
.brand-text { line-height: 1.2; }
.brand-sub { display: block; font-size: 11px; font-weight: 400; color: var(--text-muted); letter-spacing: 0.02em; }

.tabs { display: flex; gap: 0; margin-left: auto; }
.tabs a {
  display: inline-block; padding: 16px var(--s-3); color: var(--text-muted);
  border-bottom: 2px solid transparent; font-size: 13px; font-weight: 500;
  text-decoration: none;
}
.tabs a:hover { color: var(--text); background: var(--surface-alt); }
.tabs a.active { color: var(--text); border-bottom-color: var(--brand); }

.header-right { display: flex; align-items: center; gap: var(--s-3); }
.btn-ghost { background: transparent; border: 1px solid transparent; }
.btn-ghost:hover { background: var(--surface-alt); border-color: var(--border); }

.lang-toggle {
  display: inline-flex;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  overflow: hidden;
}
.lang-toggle button {
  background: var(--surface);
  border: none;
  border-right: 1px solid var(--border-strong);
  padding: 4px 10px;
  font: 11px var(--mono);
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  cursor: pointer;
}
.lang-toggle button:last-child { border-right: none; }
.lang-toggle button:hover { background: var(--row-hover); color: var(--text); }
.lang-toggle button.active { background: var(--brand); color: #fff; }

/* Main */
.main { max-width: var(--container); margin: 0 auto; padding: var(--s-5) var(--s-4); }
.page {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: var(--s-5);
  box-shadow: var(--shadow-sm);
}

.page-head {
  border-bottom: 1px solid var(--border);
  margin: 0 0 var(--s-5) 0; padding: 0 0 var(--s-4) 0;
}
.page-head h1 {
  font-size: 22px; font-weight: 600; margin: 0 0 4px 0;
  letter-spacing: -0.005em;
}
.page-sub { margin: 0; color: var(--text-muted); font-size: 13px; line-height: 1.55; max-width: 80ch; }

.section-h {
  font-size: 14px; font-weight: 600; margin: var(--s-5) 0 var(--s-2);
  color: var(--text); letter-spacing: -0.002em;
}

/* Document metadata block */
.docmeta {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0; margin: 0 0 var(--s-4) 0; padding: var(--s-3) 0;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface-alt);
}
.docmeta > div { padding: var(--s-2) var(--s-4); border-right: 1px solid var(--border); }
.docmeta > div:last-child { border-right: none; }
.docmeta dt {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-muted); font-weight: 600; margin-bottom: 2px;
}
.docmeta dd { margin: 0; font-size: 13px; }

/* Caveat box */
.caveat {
  background: var(--warn-bg); border: 1px solid var(--warn-border);
  border-left-width: 3px; padding: var(--s-3) var(--s-4);
  margin: var(--s-4) 0; border-radius: var(--radius);
}
.caveat-tag {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--accent-high); margin-bottom: var(--s-1);
}
.caveat p { margin: 0; font-size: 13px; line-height: 1.55; }
.caveat strong { color: var(--accent-high); }
.caveat-cta { background: #eef4fb; border-color: #cfdef0; }
.caveat-cta .caveat-tag { color: var(--brand); }

/* Plain-language summary on the Overview page — written for ordinary readers,
   not security analysts. Sits prominently above the technical exec-summary. */
.plain-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--brand);
  border-radius: var(--radius);
  padding: var(--s-4) var(--s-5);
  margin: var(--s-4) 0 var(--s-5);
}
.plain-block .plain-h {
  font-size: 15px; font-weight: 700; color: var(--text);
  margin: var(--s-3) 0 var(--s-2);
  letter-spacing: 0;
  text-transform: none;
}
.plain-block .plain-h:first-child { margin-top: 0; }
.plain-block .plain-lede {
  font-size: 14px; line-height: 1.6; color: var(--text);
  margin: 0 0 var(--s-2);
}
.plain-block .plain-list {
  font-size: 14px; line-height: 1.6; color: var(--text);
  margin: 0 0 var(--s-3); padding-left: var(--s-4);
}
.plain-block .plain-list li { margin-bottom: var(--s-1); }
.plain-block .plain-foot {
  font-size: 12px; line-height: 1.5; color: var(--text-muted);
  margin: var(--s-3) 0 0; padding-top: var(--s-2);
  border-top: 1px solid var(--border);
}

/* Highlighted consequences-summary block on Overview — deliberately loud red
   styling so the financial exposure cannot be ignored by stakeholders.
   Background: light-red wash. Border: thick red. Everything inside is bold
   and red-tinted; the TOTAL row is the most saturated. */
/* "Known gap" — homepage block surfacing the documented 16-month suppression
   of the breach. Visually the loudest element on the entire site. */
.known-gap {
  background: #fff5f3;
  border: 3px solid var(--accent-high);
  border-left-width: 8px;
  border-radius: var(--radius);
  padding: var(--s-4) var(--s-5);
  margin: var(--s-3) 0 var(--s-4);
  box-shadow: 0 4px 18px rgba(192, 57, 43, 0.18);
}
.known-gap-head { display: flex; align-items: baseline; gap: var(--s-2); flex-wrap: wrap; margin-bottom: var(--s-2); }
.known-gap-tag {
  background: var(--accent-high);
  color: #fff;
  font-size: 11px; font-weight: 800; letter-spacing: 0.08em;
  padding: 4px 9px;
  border-radius: 3px;
  text-transform: uppercase;
}
.known-gap-title {
  font-size: 19px; font-weight: 800; color: var(--accent-high);
  margin: 0; line-height: 1.3;
}
.known-gap-summary {
  font-size: 13.5px; line-height: 1.6; color: var(--text);
  font-weight: 600; margin: 0 0 var(--s-3); padding: var(--s-2) 0;
  border-bottom: 1px solid #f0d7d2;
}
.known-gap-grid {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: var(--s-2);
  margin-bottom: var(--s-3);
}
.known-gap-card {
  background: #fff; border: 1px solid #f0d7d2;
  border-radius: 4px; padding: var(--s-2) var(--s-3);
}
.known-gap-label {
  font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em;
  margin-bottom: 4px;
}
.known-gap-value {
  font-size: 16px; font-weight: 700; color: var(--text);
}
.known-gap-value.known-gap-zero {
  color: var(--accent-high); font-size: 28px; line-height: 1;
}
.known-gap-foot { margin: 0; }
.known-gap-link {
  display: inline-block;
  background: var(--accent-high); color: #fff;
  padding: 8px 14px; border-radius: 4px;
  font-size: 13px; font-weight: 700; text-decoration: none;
}
.known-gap-link:hover { background: #a13128; text-decoration: none; }
@media (max-width: 760px) {
  .known-gap-grid { grid-template-columns: repeat(2, 1fr); }
}

.cons-highlight {
  background: var(--accent-high-bg);
  border: 2px solid var(--accent-high);
  border-left-width: 6px;
  border-radius: var(--radius);
  padding: var(--s-4) var(--s-5);
  margin: var(--s-3) 0 var(--s-5);
  box-shadow: 0 2px 12px rgba(192, 57, 43, 0.12);
}
.cons-highlight-head { margin-bottom: var(--s-3); }
.cons-highlight-title {
  font-size: 17px; font-weight: 800; color: var(--accent-high);
  margin: 0 0 var(--s-1); letter-spacing: 0; text-transform: none;
}
.cons-highlight-sub {
  font-size: 13px; line-height: 1.55; color: var(--text);
  font-weight: 600; margin: 0;
}
.cons-highlight-grid {
  display: grid; row-gap: 0;
  border-top: 1px solid var(--accent-high);
  margin-top: var(--s-3);
  background: #fff;
  border-radius: var(--radius);
  overflow: hidden;
}
.cons-hl-row {
  display: grid; grid-template-columns: 2fr 1fr 1fr 1fr;
  padding: var(--s-2) var(--s-2);
  border-bottom: 1px solid var(--accent-high-bg);
  align-items: baseline;
}
.cons-hl-row:last-child { border-bottom: none; }
.cons-hl-head .cons-hl-cell {
  font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em;
  font-weight: 800; color: var(--accent-high);
}
.cons-hl-head { background: #fff5f4; }
.cons-hl-cell { padding: 0 var(--s-2); }
.cons-hl-label { font-size: 14px; color: var(--text); font-weight: 700; }
.cons-hl-value {
  font-size: 14px; text-align: right; font-variant-numeric: tabular-nums;
  font-weight: 700; color: var(--accent-high);
}
.cons-hl-total {
  background: var(--accent-high);
}
.cons-hl-total .cons-hl-label,
.cons-hl-total .cons-hl-value {
  font-weight: 800; color: #fff;
  font-size: 15px;
  letter-spacing: 0.01em;
}
.cons-highlight-foot {
  margin: var(--s-3) 0 0; font-size: 13px; font-weight: 600;
}
.cons-highlight-link {
  color: var(--accent-high); text-decoration: underline;
  font-weight: 700;
}
.cons-highlight-link:hover { text-decoration: none; }

/* Consequences page */
.assumptions { margin: var(--s-2) 0 var(--s-4); padding-left: var(--s-4); font-size: 13px; line-height: 1.55; color: var(--text); }
.assumptions li { margin-bottom: var(--s-1); }
.rate-basis { margin: var(--s-2) 0; padding: var(--s-2) var(--s-3); background: #f7f5ef; border-left: 3px solid #b89c4a; font-size: 12.5px; line-height: 1.55; color: var(--text); }
.hp-gap-cell { background: #fdf3f3; border-left: 3px solid #c63232; color: var(--text); font-weight: 500; }
.hp-consequences-cell { background: #fdf6e6; border-left: 3px solid #b8821a; color: var(--text); font-weight: 500; }
.hp-roles-cell { background: #f0f6fa; border-left: 3px solid #2a6db8; color: var(--text); font-weight: 500; }
.witness-statement { background: #fafaf6; border: 1px solid #d8d6c9; border-left: 4px solid #6b6755; padding: 18px 22px 14px; margin: 28px 0 22px; border-radius: 3px; }
.witness-statement .ws-h { margin-top: 0; }
.witness-statement .ws-intro { font-style: italic; color: #555; margin-bottom: 14px; }
.witness-statement .ws-kv th { width: 24%; }
.witness-statement .ws-limits-cell { background: #fdf6e6; border-left: 3px solid #b8821a; color: var(--text); font-weight: 500; }
.witness-statement .ws-signature { margin-top: 16px; padding-top: 12px; border-top: 1px solid #d8d6c9; }
.witness-statement .ws-sig-h { margin: 0 0 6px; font-size: 13px; font-weight: 600; color: #555; text-transform: uppercase; letter-spacing: 0.5px; }
.witness-statement .ws-sig-body { margin: 0; font-size: 13px; line-height: 1.5; color: var(--text); }
.ms-timeline { white-space: pre-line; line-height: 1.7; font-size: 12.5px; }

/* §7E OSINT screenshot gallery — each figure is a captioned image with SHA-256
   chain-of-custody anchor below. Compact, monospace hashes, no decorative styling. */
.osint-pattern { margin: var(--s-3) 0; padding: var(--s-2) var(--s-3); background: #f7f5ef; border-left: 3px solid #b89c4a; font-size: 13px; line-height: 1.55; }
.osint-figure { margin: var(--s-4) 0; padding: var(--s-3); background: #fff; border: 1px solid #d6dde4; border-radius: var(--radius); }
.osint-title { margin: 0 0 var(--s-2); font-size: 14px; font-weight: 700; color: var(--text); letter-spacing: 0; text-transform: none; }
.osint-figure img { display: block; max-width: 100%; height: auto; border: 1px solid #e6ebef; }
.osint-figure figcaption { margin-top: var(--s-2); font-size: 12.5px; line-height: 1.6; color: var(--text); }
.osint-hash { margin: var(--s-2) 0 0; padding-top: var(--s-2); border-top: 1px dashed #d6dde4; font-size: 11px; color: var(--text-muted); }
.osint-hash code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 10.5px; word-break: break-all; }
.osint-missing { margin: var(--s-2) 0; color: var(--text-muted); font-style: italic; }
.osint-provenance { margin: var(--s-4) 0; padding: var(--s-3); background: #f4f7fa; border-left: 3px solid var(--brand); font-size: 12.5px; line-height: 1.6; }

/* §7F AI-triage subsections — distinguishable from §7E OSINT figures */
.tri-finding { font-size: 14px; font-weight: 600; color: var(--accent-high); margin-top: var(--s-4); margin-bottom: var(--s-2); letter-spacing: 0; text-transform: none; }
.tri-finding-body { margin: 0 0 var(--s-3); padding: var(--s-2) var(--s-3); background: #fff; border: 1px solid #d6dde4; border-left: 3px solid var(--accent-high); font-size: 12.5px; line-height: 1.6; }
.tri-finding-body.tri-timeline-confirmed { border-left-color: #2e7d32; }
.invoice { margin: var(--s-3) 0; padding: var(--s-4); background: #fff; border: 1px solid #d6dde4; border-top: 4px solid var(--brand); }
.invoice-header { width: 100%; border-collapse: collapse; margin-bottom: var(--s-3); }
.invoice-header th { text-align: left; padding: 4px 12px 4px 0; font-weight: 600; font-size: 12px; color: var(--text-muted); width: 25%; vertical-align: top; }
.invoice-header td { padding: 4px 0; font-size: 13px; color: var(--text); }
.invoice-lines { font-size: 13px; }
.invoice-lines th, .invoice-lines td { padding: 6px 10px; }
.invoice-lines th.num, .invoice-lines td.num { text-align: right; white-space: nowrap; }
.invoice-lines tfoot .invoice-total th, .invoice-lines tfoot .invoice-total td { border-top: 2px solid var(--text); font-weight: 700; background: #f4f7fa; }
.invoice-footnote { font-size: 12px; color: var(--text-muted); line-height: 1.55; margin: var(--s-3) 0 0; padding-top: var(--s-2); border-top: 1px solid #e6ebef; }
.scenarios tbody td.strong { font-weight: 700; color: var(--accent-high); }
.sources { margin: var(--s-2) 0 var(--s-4); padding-left: var(--s-4); font-size: 12px; line-height: 1.55; }
.sources li { margin-bottom: var(--s-1); }
.sources a { word-break: break-all; }
.source-tag { color: var(--text-muted); margin-right: var(--s-1); font-size: 11px; }

/* Data tables */
.data {
  width: 100%; border-collapse: collapse; font-size: 13px;
  margin: var(--s-3) 0 var(--s-4); background: var(--surface);
}
.data thead th {
  text-align: left; background: var(--surface-alt);
  border-bottom: 1px solid var(--border); padding: var(--s-2) var(--s-3);
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em;
  font-weight: 600; color: var(--text-muted); white-space: nowrap;
}
.data tbody td {
  padding: var(--s-2) var(--s-3); border-bottom: 1px solid var(--border-faint);
  vertical-align: top;
}
.data tbody tr:hover td { background: var(--row-hover); }
.data tbody tr.hi-row td { background: var(--accent-high-bg); }
.data tbody tr.hi-row:hover td { background: #fbe1de; }
.data .loading-row {
  text-align: center; color: var(--text-faint); font-style: italic;
  padding: var(--s-4); font-size: 12px;
}

.data.kv th {
  text-align: left; background: var(--surface-alt); font-weight: 600;
  font-size: 12px; width: 180px; text-transform: none; letter-spacing: 0;
  color: var(--text); border-right: 1px solid var(--border); vertical-align: top;
}
.data.kv tr.hi-row th { background: var(--accent-high-bg); }

.data.exec th {
  text-align: left; background: var(--surface-alt); font-weight: 600;
  font-size: 13px; text-transform: none; letter-spacing: 0;
  color: var(--text); width: 220px; border-right: 1px solid var(--border);
}
.data.exec td { white-space: nowrap; }
.data.exec td:last-child { white-space: normal; color: var(--text-muted); }

/* OWASP / glossary */
.owasp-table td:first-child { width: 50px; font-weight: 600; }
.owasp-table td:nth-child(2) { width: 200px; font-weight: 600; }
.glossary {
  display: grid; grid-template-columns: 1fr; gap: 0;
  margin: var(--s-3) 0; border: 1px solid var(--border);
  border-radius: var(--radius);
}
.glossary-row {
  display: grid; grid-template-columns: 200px 1fr; gap: var(--s-3);
  padding: var(--s-2) var(--s-3); border-bottom: 1px solid var(--border-faint);
}
.glossary-row:last-child { border-bottom: none; }
.glossary-row dt { font-weight: 600; color: var(--text); margin: 0; }
.glossary-row dd { margin: 0; color: var(--text-muted); font-size: 12.5px; }
@media (max-width: 700px) {
  .glossary-row { grid-template-columns: 1fr; gap: 4px; }
}

/* Severity pills */
.sev-pill {
  display: inline-block; font-family: var(--mono); font-size: 10px;
  font-weight: 700; letter-spacing: 0.06em; padding: 2px 6px; border-radius: 2px;
  text-transform: uppercase; border: 1px solid;
}
.sev-high   { color: var(--accent-high);   background: var(--accent-high-bg);   border-color: var(--accent-high); }
.sev-medium { color: var(--accent-medium); background: var(--accent-medium-bg); border-color: var(--accent-medium); }
.sev-low    { color: var(--accent-low);    background: var(--surface-alt);      border-color: var(--accent-low); }

/* Histogram */
.hist { width: 100%; height: auto; max-width: 800px; }
.hist-tick { font: 10px var(--mono); fill: var(--text-muted); }
.hint { font-size: 12px; color: var(--text-muted); margin: var(--s-1) 0 var(--s-3); }

/* Two-column layout */
.two-col {
  display: grid; grid-template-columns: 1fr;
  gap: var(--s-5); margin: var(--s-3) 0;
}
@media (min-width: 800px) {
  .two-col { grid-template-columns: 1fr 1fr; }
}

/* Lists */
.toc { margin: var(--s-3) 0; padding-left: var(--s-5); font-size: 13px; }
.toc li { margin-bottom: var(--s-1); }
.rules { list-style: none; padding: 0; margin: var(--s-2) 0; }
.rules li { padding: var(--s-2) 0; border-bottom: 1px solid var(--border-faint); display: flex; gap: var(--s-2); align-items: flex-start; }
.rules li:last-child { border-bottom: none; }

/* Evidence block */
.evidence {
  font-family: var(--mono); font-size: 12px; line-height: 1.55;
  color: var(--text); background: var(--surface-alt);
  border: 1px solid var(--border); border-left: 3px solid var(--accent-high);
  padding: var(--s-3); margin: var(--s-3) 0; white-space: pre-wrap;
  word-break: break-all; overflow-x: auto; border-radius: var(--radius);
}
.evidence.inline {
  display: flex; align-items: center; gap: var(--s-2);
  padding: var(--s-2) var(--s-3); font-size: 12px;
  border-left-color: var(--brand);
}
.evidence.inline code { flex: 1; font-size: 12px; word-break: break-all; }

/* Buttons */
.btn {
  display: inline-block; background: var(--surface); color: var(--text);
  border: 1px solid var(--border-strong); padding: 4px 10px;
  font: 12px var(--font); border-radius: var(--radius); cursor: pointer;
  white-space: nowrap; transition: background 0.12s, border-color 0.12s;
}
.btn:hover { background: var(--row-hover); border-color: var(--brand); color: var(--link); }
.btn:active { background: var(--row-selected); }
.btn.copy { padding: 2px 8px; font-size: 11px; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.btn-primary {
  background: var(--link); color: #fff; border-color: var(--link);
  padding: 8px 16px; font-size: 13px; font-weight: 500;
}
.btn-primary:hover { background: var(--link-hover); border-color: var(--link-hover); color: #fff; }
.btn-primary[disabled] { background: var(--text-faint); border-color: var(--text-faint); }

.status-pill {
  display: inline-block; font-family: var(--mono); font-size: 11px;
  padding: 2px 8px; border-radius: 2px; border: 1px solid;
  margin-left: var(--s-2);
}
.status-pill.up   { color: var(--ok); background: var(--ok-bg); border-color: var(--ok); }
.status-pill.down { color: var(--accent-high); background: var(--accent-high-bg); border-color: var(--accent-high); }
.status-pill.checking { color: var(--text-muted); background: var(--surface-alt); border-color: var(--border-strong); }

/* Mailboxes page */
.mb-access-bar { display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; padding: var(--s-2) 0; }
.mb-access-bar a.mono { font-size: 13px; }
.mailboxes-table .btn.open-mailbox { font-size: 12px; }

/* Legal section */
.law-section { border: 2px solid #c0392b; border-radius: 4px; padding: var(--s-4); margin: var(--s-4) 0; background: #fff5f5; }
.law-header { display: flex; align-items: baseline; gap: var(--s-3); margin-bottom: var(--s-3); }
.law-title { margin: 0; color: #c0392b; }
.law-badge { font-size: 11px; font-weight: 700; letter-spacing: .06em; background: #c0392b; color: #fff; padding: 2px 8px; border-radius: 2px; white-space: nowrap; }
.law-lead { margin: 0 0 var(--s-3); color: var(--text-main); line-height: 1.6; }
.law-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: var(--s-3); }
.law-card { background: #fff; border: 1px solid #e8d0d0; border-radius: 3px; padding: var(--s-3); }
.law-card h3 { margin: 0 0 var(--s-2); font-size: 13px; font-weight: 700; }
.law-card p { margin: var(--s-1) 0; font-size: 13px; line-height: 1.6; }
.law-card a { color: var(--accent); }
.law-card .hint { font-size: 12px; color: var(--text-muted); margin-top: var(--s-2); }
.law-card--violation h3 { color: #c0392b; }
.law-card--penalty { border-color: #e8a030; background: #fffbf0; }
.law-card--penalty h3 { color: #a06000; }
.law-card--authority { border-color: #2980b9; background: #f0f7ff; }
.law-card--authority h3 { color: #1a5276; }

/* Toast */
.toast {
  position: fixed; bottom: var(--s-4); left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #303030; color: #fff;
  padding: var(--s-2) var(--s-4); border-radius: var(--radius);
  font-size: 13px; pointer-events: none; opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 200; box-shadow: var(--shadow-md);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Address filters */
.filters {
  display: grid; grid-template-columns: 1fr; gap: var(--s-3);
  margin: var(--s-3) 0; padding: var(--s-3);
  background: var(--surface-alt); border: 1px solid var(--border);
  border-radius: var(--radius); align-items: end;
}
@media (min-width: 800px) { .filters { grid-template-columns: 1fr auto auto; gap: var(--s-5); } }
.search { display: block; }
.search span {
  display: block; font-size: 11px; text-transform: uppercase;
  letter-spacing: 0.06em; font-weight: 600; color: var(--text-muted);
  margin-bottom: 3px;
}
.search input {
  width: 100%; background: var(--surface);
  border: 1px solid var(--border-strong); padding: 6px 10px;
  font: 13px var(--font); color: var(--text);
  border-radius: var(--radius); outline: none;
}
.search input:focus { border-color: var(--brand); box-shadow: 0 0 0 2px rgba(55,190,255,0.18); }
.checks { border: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 4px; }
.checks legend {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em;
  font-weight: 600; color: var(--text-muted); margin-bottom: 3px;
}
.checks label { display: flex; align-items: center; gap: 6px; font-size: 12px; cursor: pointer; }
.checks input { width: 14px; height: 14px; accent-color: var(--brand); }
.result-count { font-family: var(--mono); font-size: 12px; color: var(--text-muted); }

/* Address table */
.address-table { table-layout: fixed; }
.address-table th:nth-child(1), .address-table td:nth-child(1) { width: 42%; }
.address-table th:nth-child(2), .address-table td:nth-child(2) { width: 12%; }
.address-table th:nth-child(3), .address-table td:nth-child(3) { width: 18%; }
.address-table th:nth-child(4), .address-table td:nth-child(4) { width: 28%; }
.address-table td code { font-size: 12px; word-break: break-all; }
.src-tags { display: flex; flex-wrap: wrap; gap: 3px; }
.src-tag {
  display: inline-block; font-family: var(--mono); font-size: 10px;
  letter-spacing: 0.04em; text-transform: uppercase; padding: 1px 5px;
  border: 1px solid var(--border-strong); color: var(--text-muted);
  border-radius: 2px; background: var(--surface-alt);
}
.src-tag.internal { color: var(--link); border-color: var(--link); background: #e3f2fd; }
.src-tag.automation { color: var(--text-faint); }
.src-tag.headers { color: var(--text); border-color: var(--border-strong); background: var(--surface); font-weight: 600; }
.address-table td.inboxes { font-size: 11px; color: var(--text-muted); font-family: var(--mono); }

.pager {
  display: flex; justify-content: center; align-items: center; gap: var(--s-2);
  margin: var(--s-4) 0; font-family: var(--mono); font-size: 12px;
}
.pager .pager-info { color: var(--text-muted); padding: 0 var(--s-2); }

/* Timeline */
.timeline-table { table-layout: auto; }
.event-row { cursor: pointer; }
.event-row.expanded td { background: var(--row-selected); }
.event-detail-row td { background: var(--surface-alt); padding: var(--s-3) var(--s-4); }
.event-detail .evt-subject { font-style: italic; color: var(--text); margin-bottom: var(--s-2); }
.evt-kv {
  display: grid; grid-template-columns: 140px 1fr;
  gap: 4px var(--s-4); margin: 0; font-size: 12px;
}
.evt-kv dt {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-muted); font-weight: 600;
}
.evt-kv dd { margin: 0; }

/* Findings page */
.findings-grid { display: flex; flex-direction: column; gap: var(--s-4); }
.finding {
  border: 1px solid var(--border); border-left: 3px solid var(--accent-high);
  background: var(--surface); padding: var(--s-3) var(--s-4);
  border-radius: var(--radius);
}
.finding-h { display: flex; gap: var(--s-3); align-items: center; margin-bottom: var(--s-2); }
.finding-num { font-size: 12px; color: var(--text-muted); }
.finding-meta { display: flex; gap: var(--s-2); align-items: center; flex-wrap: wrap; font-size: 12px; }
.finding-inbox { color: var(--text-muted); }
.finding-inbox code { color: var(--text); }
.finding-target {
  font-family: var(--mono); font-size: 13px; font-weight: 600;
  margin: 0 0 var(--s-2) 0; word-break: break-all; color: var(--text);
}
.finding-target code { font-size: inherit; }
.finding-subject { color: var(--text-muted); font-size: 12px; margin: 0 0 var(--s-2) 0; font-style: italic; }
.evidence-table { margin: var(--s-2) 0 0 0; font-size: 12px; }
.evidence-table th { width: 140px; font-size: 11px; }

/* Footer */
.footer {
  max-width: var(--container); margin: 0 auto; padding: var(--s-4);
  color: var(--text-muted); font-size: 12px;
}
.footer-row { display: flex; justify-content: space-between; gap: var(--s-3); flex-wrap: wrap; }

/* =========================================================================
   Login overlay — full-screen gate before authenticated content
   ========================================================================= */
.login-overlay {
  position: fixed; inset: 0; background: rgba(244,247,250,0.96);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  z-index: 150;
  display: flex; align-items: center; justify-content: center;
  padding: var(--s-4);
  overflow-y: auto;
}
.login-overlay[hidden] { display: none; }
.login-card {
  background: var(--surface); border: 1px solid var(--border);
  border-top: 3px solid var(--brand); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); width: 100%; max-width: 480px;
  padding: var(--s-5) var(--s-5);
}
.login-head {
  display: flex; align-items: center; gap: var(--s-2);
  margin-bottom: var(--s-3); padding-bottom: var(--s-3);
  border-bottom: 1px solid var(--border-faint);
}
.login-head h1 { margin: 0; font-size: 16px; font-weight: 600; }
.login-lede { margin: 0 0 var(--s-4) 0; color: var(--text-muted); font-size: 13px; line-height: 1.55; }

#login-form { display: flex; flex-direction: column; gap: var(--s-3); }
.login-field { display: block; }
.login-field input, .login-field select {
  width: 100%; background: var(--surface);
  border: 1px solid var(--border-strong); padding: 8px 12px;
  font: 14px var(--mono); color: var(--text);
  border-radius: var(--radius); outline: none;
}
.login-field input:focus, .login-field select:focus { border-color: var(--brand); box-shadow: 0 0 0 2px rgba(55,190,255,0.18); }
.login-field input:disabled, .login-field select:disabled { background: var(--surface-alt); cursor: wait; }
.login-field select { appearance: auto; cursor: pointer; }

.login-status {
  min-height: 1.4em; font-size: 12px;
  color: var(--text-muted); padding: 4px 0;
}
.login-status.error { color: var(--accent-high); font-weight: 500; }
.login-status.working { color: var(--text-muted); font-style: italic; }
.login-status.success { color: var(--ok); font-weight: 500; }

.login-help {
  margin-top: var(--s-3); padding-top: var(--s-3);
  border-top: 1px solid var(--border-faint);
}
.login-help summary {
  cursor: pointer; font-size: 12px; font-weight: 600;
  color: var(--text-muted); padding: 4px 0;
  list-style: none;
}
.login-help summary::-webkit-details-marker { display: none; }
.login-help summary::before { content: "▸ "; display: inline-block; transition: transform 0.15s; }
.login-help[open] summary::before { transform: rotate(90deg); }
.login-help p { margin: var(--s-2) 0; font-size: 12px; color: var(--text-muted); line-height: 1.55; }

/* Session countdown */
#session-countdown { color: var(--text-faint); font-size: 11px; }
#session-countdown.warning { color: var(--accent-medium); font-weight: 600; }
#session-countdown.urgent { color: var(--accent-high); font-weight: 600; }

/* Role banner (one-time / read-only) */
.role-banner {
  position: fixed; top: 0; left: 0; right: 0; z-index: 200;
  background: #fff3cd; color: #856404;
  border-bottom: 1px solid #ffeeba;
  padding: 8px 16px; font-size: 12px; font-weight: 600;
  text-align: center; letter-spacing: 0.02em;
}
.role-banner[hidden] { display: none; }
body:has(.role-banner:not([hidden])) { padding-top: 32px; }
body:has(.role-banner:not([hidden])) .appbar { top: 32px; }
body:has(.role-banner:not([hidden])) .login-overlay { padding-top: calc(var(--s-5) + 32px); }

/* ============================================================
   Responsive layer — tablet (≤900px), phone (≤560px).
   Operator/forensic surface stays the same visual language; layout
   adapts so KV tables, header chrome, and figures all stay legible.
   ============================================================ */

@media (max-width: 900px) {
  .main { padding: var(--s-4) var(--s-3); }
  .page { padding: var(--s-4); }
  .page-head h1 { font-size: 20px; }
  .page-head { padding-bottom: var(--s-3); margin-bottom: var(--s-4); }
  .docmeta { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
  .data.kv th { width: 150px; font-size: 11.5px; }
  .data.exec th { width: 170px; }
  .witness-statement { padding: 14px 16px 12px; }
  .witness-statement .ws-kv th { width: 28%; }
  .invoice-header th { width: 30%; }
  .cons-hl-row { grid-template-columns: 1.4fr 1fr 1fr 1fr; }
  .tabs a { padding: 14px 10px; font-size: 12.5px; }
  .law-section { padding: var(--s-3); }
  .osint-figure { padding: var(--s-2); }
}

@media (max-width: 560px) {
  body, html { overflow-x: hidden; }
  body { font-size: 13px; }

  /* App bar — wrap to two rows: brand + header-right on row 1, tabs scroll on row 2 */
  .appbar-inner { padding: 0 var(--s-3); gap: var(--s-2); flex-wrap: wrap; min-height: 48px; }
  .brand-sub { display: none; }
  .brand-text { font-size: 13px; }
  .header-right { margin-left: auto; gap: var(--s-2); }
  .lang-toggle button { padding: 3px 8px; font-size: 10.5px; }
  .tabs {
    order: 3;
    flex-basis: 100%;
    margin-left: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-top: 1px solid var(--border-faint);
    scrollbar-width: thin;
  }
  .tabs a { padding: 10px 10px; font-size: 12px; white-space: nowrap; }

  /* Main column — tighter padding, no rounded edges on full-bleed page */
  .main { padding: var(--s-3) var(--s-2); }
  .page { padding: var(--s-3); border-radius: 0; }
  .page-head { padding-bottom: var(--s-2); margin-bottom: var(--s-3); }
  .page-head h1 { font-size: 18px; line-height: 1.3; }
  .page-sub { font-size: 12.5px; }
  .section-h { margin-top: var(--s-4); font-size: 13.5px; }

  /* docmeta — stack with horizontal dividers */
  .docmeta { grid-template-columns: 1fr; }
  .docmeta > div { border-right: none; border-bottom: 1px solid var(--border); }
  .docmeta > div:last-child { border-bottom: none; }

  /* KV tables — stack th over td as labeled card-like blocks */
  .data.kv, .data.kv tbody, .data.kv tbody tr { display: block; }
  .data.kv tbody tr { border-bottom: 2px solid var(--border); padding: 0; margin-bottom: 6px; }
  .data.kv tbody tr:last-child { border-bottom: none; margin-bottom: 0; }
  .data.kv th, .data.kv td {
    display: block; width: auto; border-right: none;
    padding: 6px var(--s-2);
  }
  .data.kv th {
    background: var(--surface-alt);
    border-bottom: 1px solid var(--border-faint);
    font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em;
    font-weight: 600; color: var(--text-muted);
  }
  .data.kv td { background: var(--surface); }

  /* exec-summary is also KV-shaped */
  .data.exec, .data.exec tbody, .data.exec tbody tr { display: block; }
  .data.exec th, .data.exec td {
    display: block; width: auto; white-space: normal; border-right: none;
    padding: 6px var(--s-2);
  }
  .data.exec th {
    background: var(--surface-alt);
    border-bottom: 1px solid var(--border-faint);
    font-size: 12px; font-weight: 600;
  }

  /* Real data tables — horizontal scroll fallback */
  .data:not(.kv):not(.exec) {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
  }
  .data:not(.kv):not(.exec) thead th { font-size: 10.5px; padding: 6px 8px; }
  .data:not(.kv):not(.exec) tbody td { padding: 6px 8px; }

  /* OWASP table — widths reset so columns adapt to scroll */
  .owasp-table td:first-child { width: 40px; }
  .owasp-table td:nth-child(2) { width: 130px; }

  /* Known-gap → single column on phone, tighter cards */
  .known-gap { padding: var(--s-3) var(--s-3); }
  .known-gap-grid { grid-template-columns: 1fr; gap: 4px; }
  .known-gap-card { padding: var(--s-2); }
  .known-gap-title { font-size: 16px; }
  .known-gap-value { font-size: 14px; }
  .known-gap-value.known-gap-zero { font-size: 22px; }
  .known-gap-tag { font-size: 10px; padding: 3px 7px; }

  /* Cons-highlight grid — 2 cols, drop header row noise */
  .cons-highlight { padding: var(--s-3); }
  .cons-hl-row {
    grid-template-columns: 1fr 1fr;
    gap: 4px 8px;
    padding: var(--s-2);
  }
  .cons-hl-head { display: none; }
  .cons-hl-cell { padding: 0 4px; }
  .cons-hl-label, .cons-hl-value { font-size: 13px; }
  .cons-hl-value { text-align: left; }
  .cons-hl-total { grid-template-columns: 1fr 1fr; }

  /* Invoice — stack header pairs, scroll line-items table */
  .invoice { padding: var(--s-3); }
  .invoice-header, .invoice-header tbody, .invoice-header tr { display: block; }
  .invoice-header th, .invoice-header td {
    display: block; width: auto; padding: 2px 0;
  }
  .invoice-header th {
    font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.04em;
    color: var(--text-muted); margin-top: var(--s-2);
  }
  .invoice-lines {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Witness statement — tighter, KV stacks */
  .witness-statement {
    padding: var(--s-3) var(--s-3) var(--s-2);
    margin: var(--s-4) 0;
  }
  .witness-statement .ws-kv, .witness-statement .ws-kv tbody, .witness-statement .ws-kv tr { display: block; }
  .witness-statement .ws-kv th, .witness-statement .ws-kv td {
    display: block; width: auto; border-right: none;
    padding: 4px var(--s-2);
  }
  .witness-statement .ws-kv th {
    background: rgba(107, 103, 85, 0.06);
    font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em;
  }
  .witness-statement .ws-sig-h { font-size: 12px; }
  .witness-statement .ws-sig-body { font-size: 12.5px; }

  /* Law section */
  .law-section { padding: var(--s-3); }
  .law-grid { grid-template-columns: 1fr; }
  .law-header { flex-direction: column; align-items: flex-start; gap: var(--s-1); margin-bottom: var(--s-2); }
  .law-title { font-size: 16px; }

  /* OSINT figures + tri-findings */
  .osint-figure { padding: var(--s-2); }
  .osint-title { font-size: 13px; }
  .osint-hash code { font-size: 10px; }
  .tri-finding { font-size: 13px; margin-top: var(--s-3); }
  .tri-finding-body { padding: var(--s-2); font-size: 12px; }

  /* Filters compact */
  .filters { padding: var(--s-2); gap: var(--s-2); }

  /* Footer wraps tighter, smaller copy */
  .footer { padding: var(--s-3) var(--s-3); }
  .footer-row { gap: var(--s-2); font-size: 11px; line-height: 1.5; }

  /* Login overlay — fits viewport on phone */
  .login-overlay { padding: var(--s-3); align-items: flex-start; padding-top: var(--s-5); }
  .login-card { padding: var(--s-4); max-width: 100%; }
  .login-head h1 { font-size: 15px; }
  .login-lede { font-size: 12.5px; }
  .login-field input { font-size: 16px; /* prevent iOS zoom on focus */ }

  /* Toast — wider on small screens */
  .toast { left: var(--s-3); right: var(--s-3); transform: translateY(20px); max-width: none; bottom: var(--s-3); }
  .toast.show { transform: translateY(0); }

  /* Buttons tap-friendly */
  .btn, .lang-toggle button { min-height: 32px; }
  .btn-primary { min-height: 44px; padding: 11px 18px; font-size: 14px; }

  /* mailboxes access bar wraps tighter */
  .mb-access-bar a.mono { font-size: 12px; word-break: break-all; }

  /* Histogram fits viewport */
  .hist { width: 100%; max-width: 100%; }

  /* Evidence block + long monospace strings */
  .evidence { padding: var(--s-2); font-size: 11px; }
  .evidence.inline { flex-direction: column; align-items: stretch; gap: var(--s-1); }
}
