/* =============================================================
   Relatório — template de relatório (clima papel + DNA Triage)
   Paleta clara derivada do Triage Design System. Sem sombras:
   elevação por luminância de superfície. Bordas-espinha à esquerda.
   ============================================================= */

/* Fontes: ver assets/fonts.css (woff2 embarcadas, offline) — linkado pela shell. STORY-035. */

:root {
  /* ---- Paper neutrals (warm, low-chroma) ---- */
  --paper-0:  #FBFAF7;   /* page bg */
  --paper-1:  #FFFEFC;   /* surface / card */
  --paper-2:  #F4F1EA;   /* sunken / elevated panel */
  --paper-3:  #ECE7DC;   /* deeper sunken */
  --line:     #E0DACF;   /* faint rule / border */
  --line-2:   #D2CABA;   /* stronger border */

  /* ---- Ink ---- */
  --ink:      #211F1C;   /* primary text */
  --ink-2:    #4A453D;   /* secondary text */
  --muted:    #6B6457;   /* tertiary / labels */
  --muted-2:  #938B7C;   /* quaternary */

  /* ---- Ember accent (warm, Triage-derived for light) ---- */
  --ember:        #C25A2E;   /* primary accent (text/border on light) */
  --ember-soft:   #E8734A;   /* fills */
  --ember-deep:   #7A3E22;   /* hover / deep */
  --ember-wash:   #F6EBE3;   /* tinted surface */

  /* ---- Severity (temperature scale) ---- */
  --sev-crit: #B23A1F;   --sev-crit-wash: #F6E7E1;
  --sev-high: #B5631F;   --sev-high-wash: #F7EEDF;
  --sev-mid:  #8A7320;   --sev-mid-wash:  #F3EFDD;
  --sev-low:  #3F6F4D;   --sev-low-wash:  #E7F0E8;

  /* ---- Type families ---- */
  --font-display: "Space Grotesk", ui-sans-serif, system-ui, sans-serif;
  --font-body:    "IBM Plex Sans", ui-sans-serif, system-ui, sans-serif;
  --font-mono:    "JetBrains Mono", ui-monospace, SFMono-Regular, monospace;

  /* ---- Type scale (reading document) ---- */
  --t-h1:   clamp(2.4rem, 4.5vw, 3.25rem);
  --t-h2:   1.9rem;
  --t-h3:   1.2rem;
  --t-body: 1.125rem;
  --t-small:0.9375rem;
  --t-label:0.6875rem;

  --radius-spine: 0 6px 6px 0;
  --lh: 1.72;

  /* ---- Layout ---- */
  --rail: 296px;
  --measure: 760px;
  --gutter: clamp(28px, 5vw, 88px);
}

* { box-sizing: border-box; }

html {
  font-family: var(--font-body);
  background: var(--paper-0);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  font-size: var(--t-body);
  line-height: var(--lh);
  color: var(--ink-2);
}

::selection { background: rgba(232, 115, 74, 0.22); color: var(--ink); }

/* faint editor-rule grid on the page, radially masked (Triage signature) */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 48px 48px;
  opacity: 0.4;
  -webkit-mask-image: radial-gradient(ellipse at 22% 12%, black 0%, transparent 62%);
          mask-image: radial-gradient(ellipse at 22% 12%, black 0%, transparent 62%);
}

/* =============================================================
   PROGRESS BAR (top)
   ============================================================= */
#progress {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 3px;
  z-index: 60;
  background: transparent;
}
#progress > i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--ember-soft);
  transition: width 90ms linear;
}

/* =============================================================
   TOOLBAR (sticky top)
   ============================================================= */
#toolbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 16px;
  height: 56px;
  padding: 0 var(--gutter);
  background: color-mix(in srgb, var(--paper-0) 86%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
#toolbar .brand {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}
#toolbar .brand b { color: var(--ink); font-weight: 600; }
#toolbar .spacer { flex: 1; }

.search {
  position: relative;
  display: flex;
  align-items: center;
}
.search input {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--ink);
  background: var(--paper-1);
  border: 1px solid var(--line-2);
  border-left-width: 2px;
  border-radius: var(--radius-spine);
  padding: 7px 11px 7px 28px;
  width: 190px;
  outline: none;
  transition: border-color 150ms ease-out, border-left-width 150ms ease-out, width 150ms ease-out;
}
.search input:focus {
  border-color: var(--line-2);
  border-left: 4px solid var(--ember);
  width: 230px;
}
.search input::placeholder { color: var(--muted-2); }
.search .mag {
  position: absolute;
  left: 9px;
  color: var(--muted-2);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  pointer-events: none;
}
.search .count {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--muted);
  letter-spacing: 0.04em;
  min-width: 44px;
  text-align: right;
  white-space: nowrap;
}

.tbtn {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-2);
  background: var(--paper-1);
  border: 1px solid var(--line-2);
  border-left-width: 2px;
  border-radius: var(--radius-spine);
  padding: 8px 13px;
  cursor: pointer;
  transition: border-left-width 150ms ease-out, color 150ms ease-out, background 150ms ease-out;
  white-space: nowrap;
}
.tbtn:hover { border-left-width: 4px; color: var(--ink); background: var(--ember-wash); }
.tbtn:active { transform: translateY(1px); }
.tbtn[aria-pressed="true"] {
  border-left: 4px solid var(--ember);
  color: var(--ember-deep);
  background: var(--ember-wash);
}

/* =============================================================
   VERSION TABS (Executivo · Decisão · Completo) — STORY-035
   ============================================================= */
#versions {
  display: inline-flex;
  gap: 0;
  border: 1px solid var(--line-2);
  border-radius: 7px;
  overflow: hidden;
  background: var(--paper-1);
}
#versions button {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-right: 1px solid var(--line);
  padding: 8px 14px;
  cursor: pointer;
  transition: color 140ms, background 140ms;
}
#versions button:last-child { border-right: 0; }
#versions button:hover { color: var(--ink); background: var(--ember-wash); }
#versions button.active {
  color: var(--paper-1);
  background: var(--ember);
}
@media (max-width: 720px) {
  #versions button { padding: 7px 9px; font-size: 0.64rem; }
}
@media print { #versions, #toolbar .search, #search-count { display: none; } }

/* =============================================================
   OPTIONS (alternativas consideradas por decisão) — STORY-035
   ============================================================= */
.c-options { margin: 1rem 0; }
.optgroup { margin: 0 0 1.5rem; }
.optgroup .ot {
  font-family: var(--font-display); font-weight: 600; font-size: 1.08rem;
  color: var(--ink); margin: 0 0 0.55rem;
}
.opts { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.5rem; }
.opt {
  border: 1px solid var(--line); border-left: 3px solid var(--line-2);
  border-radius: var(--radius-spine); padding: 0.6rem 0.85rem; background: var(--paper-1);
}
.opt.chosen { border-left-color: var(--ember); background: var(--ember-wash); }
.opt .ol { font-family: var(--font-display); font-weight: 600; color: var(--ink-2); }
.opt.chosen .ol { color: var(--ember-deep); }
.opt .badge {
  font-family: var(--font-mono); font-size: 0.6rem; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--paper-1); background: var(--ember);
  padding: 0.08rem 0.45rem; border-radius: 999px; margin-left: 0.5rem; vertical-align: middle;
}
.opt .od { font-size: 0.96rem; color: var(--muted); margin-top: 0.2rem; }
.orat { margin: 0.55rem 0 0; font-size: 0.96rem; color: var(--ink-2); }

/* =============================================================
   LAYOUT
   ============================================================= */
.shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: var(--rail) minmax(0, 1fr);
  align-items: start;
  gap: 0;
  max-width: 1320px;
  margin: 0 auto;
}

/* ---- Sidebar TOC ---- */
#toc {
  position: sticky;
  top: 56px;
  align-self: start;
  height: calc(100vh - 56px);
  overflow-y: auto;
  padding: 40px 28px 40px var(--gutter);
  border-right: 1px solid var(--line);
}
#toc .toc-kicker {
  font-family: var(--font-mono);
  font-size: var(--t-label);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted-2);
  margin: 0 0 18px;
}
#toc ol { list-style: none; margin: 0; padding: 0; }
#toc li { margin: 0; }
#toc a {
  display: flex;
  gap: 12px;
  align-items: baseline;
  padding: 9px 12px;
  border-left: 2px solid transparent;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.92rem;
  line-height: 1.35;
  transition: border-left-width 150ms ease-out, color 150ms ease-out, background 150ms ease-out;
}
#toc a .tn {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--muted-2);
  font-variant-numeric: tabular-nums;
  flex: none;
  width: 1.4em;
}
#toc a:hover { color: var(--ink); border-left: 4px solid var(--line-2); background: var(--paper-2); }
#toc a.active {
  color: var(--ember-deep);
  border-left: 4px solid var(--ember);
  background: var(--ember-wash);
}
#toc a.active .tn { color: var(--ember); }

/* =============================================================
   MAIN COLUMN
   ============================================================= */
main {
  padding: 56px var(--gutter) 140px;
  max-width: calc(var(--measure) + 2 * var(--gutter));
}

/* ---- Document header ---- */
.doc-head { margin: 12px 0 64px; }
.doc-head .kicker {
  font-family: var(--font-mono);
  font-size: var(--t-label);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ember);
  margin: 0 0 20px;
}
.doc-head .filete {
  border: 0;
  border-top: 1px solid var(--line-2);
  margin: 0 0 20px;
}
.doc-head h1 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--t-h1);
  line-height: 1.02;
  letter-spacing: -0.03em;
  color: var(--ink);
  margin: 0 0 18px;
}
.doc-head .dek {
  font-size: 1.32rem;
  line-height: 1.45;
  color: var(--ink-2);
  font-weight: 400;
  margin: 0 0 22px;
  max-width: 30ch;
  text-wrap: balance;
}
.doc-head .meta {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted-2);
  margin: 0;
}

/* ---- Sections ---- */
section.sec { scroll-margin-top: 76px; margin: 0 0 72px; }
section.sec > .sec-head {
  display: flex;
  align-items: baseline;
  gap: 18px;
  margin: 0 0 8px;
}
section.sec h2 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--t-h2);
  line-height: 1.12;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin: 0;
}
section.sec .sec-num {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--ember);
  letter-spacing: 0.04em;
  flex: none;
  padding-top: 0.5em;
}
section.sec > .rule {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 0 0 28px;
}

/* ---- Prose ---- */
.prose { max-width: var(--measure); }
.prose > p { margin: 0 0 22px; color: var(--ink-2); }
.prose strong { color: var(--ink); font-weight: 600; }
.prose a { color: var(--ember-deep); text-decoration: underline; text-underline-offset: 2px; }
.prose code {
  font-family: var(--font-mono);
  font-size: 0.86em;
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 1px 5px;
  color: var(--ember-deep);
}
.prose h3 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--t-h3);
  letter-spacing: -0.01em;
  color: var(--ink);
  margin: 36px 0 12px;
}
.prose ul { margin: 0 0 22px; padding: 0; list-style: none; }
.prose ul li {
  position: relative;
  padding: 4px 0 4px 26px;
  margin: 0 0 2px;
}
.prose ul li::before {
  content: "·";
  position: absolute;
  left: 6px;
  top: 3px;
  color: var(--ember);
  font-family: var(--font-mono);
  font-size: 1.4em;
  line-height: 1.2;
}
.prose ol { margin: 0 0 22px; padding-left: 1.4em; }
.prose ol li { padding: 4px 0; }

/* ---- Blockquote / callout ---- */
.prose blockquote {
  margin: 0 0 26px;
  padding: 18px 24px;
  background: var(--paper-2);
  border-left: 3px solid var(--ember);
  border-radius: var(--radius-spine);
  color: var(--ink-2);
  font-size: 1.06rem;
  line-height: 1.6;
}
.prose blockquote p { margin: 0; }

/* ---- Tables (generic markdown) ---- */
.prose .tbl-wrap { margin: 0 0 28px; overflow-x: auto; }
.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--t-small);
}
.prose table thead th {
  text-align: left;
  font-family: var(--font-mono);
  font-size: var(--t-label);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line-2);
  white-space: nowrap;
}
.prose table tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  color: var(--ink-2);
  vertical-align: top;
}
.prose table tbody tr:nth-child(even) { background: var(--paper-2); }
.prose table tbody td strong { color: var(--ink); }
.prose table tbody td:last-child {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--muted);
  white-space: nowrap;
}

/* =============================================================
   COMPONENT BLOCKS
   ============================================================= */

/* ---- Decision summary ---- */
.c-decision {
  background: var(--paper-1);
  border: 1px solid var(--line-2);
  border-left: 3px solid var(--ember);
  border-radius: var(--radius-spine);
  padding: 30px 34px;
  margin: 0 0 28px;
}
.c-decision .thesis {
  font-size: 1.22rem;
  line-height: 1.5;
  color: var(--ink);
  margin: 0 0 24px;
  font-weight: 400;
}
.c-decision .thesis strong { color: var(--ember-deep); font-weight: 600; }
.c-decision dl {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0;
  margin: 0;
  border-top: 1px solid var(--line);
}
.c-decision dt {
  font-family: var(--font-mono);
  font-size: var(--t-label);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 12px 28px 12px 0;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.c-decision dd {
  margin: 0;
  padding: 12px 0;
  color: var(--ink-2);
  font-size: var(--t-small);
  border-bottom: 1px solid var(--line);
}

/* ---- KPI band ---- */
.c-kpi {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius-spine);
  overflow: hidden;
  margin: 28px 0;
}
.c-kpi .stat {
  background: var(--paper-1);
  padding: 24px 26px;
  border-left: 2px solid transparent;
  transition: border-left-width 150ms ease-out, background 150ms ease-out;
}
.c-kpi .stat:hover { border-left: 4px solid var(--ember); background: var(--ember-wash); }
.c-kpi .stat .n {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 2.6rem;
  line-height: 1;
  letter-spacing: -0.03em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.c-kpi .stat .l {
  font-family: var(--font-mono);
  font-size: var(--t-label);
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 10px;
}
@media (max-width: 720px) {
  .c-kpi { grid-auto-flow: row; grid-auto-columns: auto; grid-template-columns: 1fr 1fr; }
}

/* ---- Transition table (Hoje → Alvo) ---- */
.c-transition {
  border: 1px solid var(--line);
  border-radius: var(--radius-spine);
  overflow: hidden;
  margin: 8px 0 28px;
}
.c-transition .row {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) 28px minmax(120px, 1fr) minmax(0, 2.2fr);
  align-items: center;
  gap: 16px;
  padding: 18px 24px;
  border-left: 2px solid transparent;
  background: var(--paper-1);
  transition: border-left-width 150ms ease-out, background 150ms ease-out;
}
.c-transition .row:not(:last-child) { border-bottom: 1px solid var(--line); }
.c-transition .row:hover { border-left: 4px solid var(--ember); background: var(--ember-wash); }
.c-transition .from {
  font-family: var(--font-mono);
  font-size: 0.92rem;
  color: var(--muted);
  text-decoration: line-through;
  text-decoration-color: var(--line-2);
}
.c-transition .arrow { color: var(--ember); font-family: var(--font-mono); text-align: center; }
.c-transition .to {
  font-family: var(--font-mono);
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--ink);
}
.c-transition .ben { font-size: var(--t-small); color: var(--ink-2); line-height: 1.45; }
@media (max-width: 720px) {
  .c-transition .row { grid-template-columns: 1fr; gap: 6px; }
  .c-transition .arrow { display: none; }
}

/* ---- Waves roadmap ---- */
.c-waves { margin: 8px 0 28px; padding: 0; list-style: none; counter-reset: none; }
.c-waves li {
  display: grid;
  grid-template-columns: 96px 1fr auto;
  align-items: center;
  gap: 18px;
  padding: 16px 22px;
  background: var(--paper-1);
  border: 1px solid var(--line);
  border-left: 2px solid var(--line-2);
  margin: 0 0 -1px;
  transition: border-left-width 150ms ease-out, background 150ms ease-out;
}
.c-waves li:first-child { border-radius: var(--radius-spine); }
.c-waves li:hover { border-left: 4px solid var(--ember); background: var(--ember-wash); }
.c-waves .wn {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ember);
  font-weight: 500;
}
.c-waves .wt { font-size: 1.02rem; color: var(--ink); }
.c-waves .eff {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: var(--radius-spine);
  border-left: 2px solid currentColor;
  white-space: nowrap;
}
.c-waves .eff.leve   { color: var(--sev-low);  background: var(--sev-low-wash); }
.c-waves .eff.medio  { color: var(--sev-mid);  background: var(--sev-mid-wash); }
.c-waves .eff.pesado { color: var(--sev-high); background: var(--sev-high-wash); }
@media (max-width: 720px) {
  .c-waves li { grid-template-columns: 1fr auto; }
  .c-waves .wn { grid-column: 1 / -1; }
}

/* ---- Risk cards ---- */
.c-risks { display: grid; gap: 14px; margin: 8px 0 28px; }
.c-risk {
  background: var(--paper-1);
  border: 1px solid var(--line);
  border-left: 3px solid var(--muted-2);
  border-radius: var(--radius-spine);
  padding: 20px 26px;
  transition: border-left-width 150ms ease-out;
}
.c-risk:hover { border-left-width: 5px; }
.c-risk .rhead { display: flex; align-items: baseline; gap: 14px; margin: 0 0 10px; }
.c-risk .rt { font-family: var(--font-display); font-weight: 600; font-size: 1.08rem; color: var(--ink); flex: 1; line-height: 1.3; }
.c-risk .rs {
  font-family: var(--font-mono);
  font-size: 0.64rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 4px 9px;
  border-radius: var(--radius-spine);
  border-left: 2px solid currentColor;
  white-space: nowrap;
  flex: none;
}
.c-risk .rm { font-size: var(--t-small); color: var(--ink-2); line-height: 1.55; margin: 0; }
.c-risk .rm strong { color: var(--ink); }
.c-risk.crit { border-left-color: var(--sev-crit); }
.c-risk.crit .rs { color: var(--sev-crit); background: var(--sev-crit-wash); }
.c-risk.high { border-left-color: var(--sev-high); }
.c-risk.high .rs { color: var(--sev-high); background: var(--sev-high-wash); }
.c-risk.mid  { border-left-color: var(--sev-mid); }
.c-risk.mid  .rs { color: var(--sev-mid); background: var(--sev-mid-wash); }
.c-risk.low  { border-left-color: var(--sev-low); }
.c-risk.low  .rs { color: var(--sev-low); background: var(--sev-low-wash); }

/* ---- Charts ---- */
.c-chart {
  background: var(--paper-1);
  border: 1px solid var(--line);
  border-left: 2px solid var(--line-2);
  border-radius: var(--radius-spine);
  padding: 24px 28px;
  margin: 8px 0 28px;
}
.c-chart .ctitle {
  font-family: var(--font-mono);
  font-size: var(--t-label);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 18px;
}
.c-chart.donut .body { display: flex; align-items: center; gap: 36px; flex-wrap: wrap; }
.c-chart.donut svg { flex: none; }
.c-chart .legend { display: grid; gap: 12px; }
.c-chart .legend .li { display: flex; align-items: baseline; gap: 12px; }
.c-chart .legend .sw { width: 12px; height: 12px; border-radius: 2px; flex: none; transform: translateY(1px); }
.c-chart .legend .ln { font-size: var(--t-small); color: var(--ink-2); }
.c-chart .legend .lv { font-family: var(--font-mono); font-weight: 500; color: var(--ink); font-variant-numeric: tabular-nums; margin-left: auto; padding-left: 18px; }

.c-chart.bars .barrow { display: grid; grid-template-columns: 86px 1fr 36px; align-items: center; gap: 14px; margin: 0 0 12px; }
.c-chart.bars .barrow:last-child { margin-bottom: 0; }
.c-chart.bars .blabel { font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.06em; color: var(--muted); text-align: right; }
.c-chart.bars .btrack { height: 22px; background: var(--paper-2); border-radius: 0 3px 3px 0; overflow: hidden; }
.c-chart.bars .bfill { height: 100%; border-radius: 0 3px 3px 0; }
.c-chart.bars .bval { font-family: var(--font-mono); font-weight: 500; color: var(--ink); font-variant-numeric: tabular-nums; }

/* ---- Heatmap (severidade × dimensão, tabela, sem lib) ---- */
.c-chart.heatmap .hwrap { overflow-x: auto; }
table.c-heatmap { border-collapse: separate; border-spacing: 4px; width: 100%; }
table.c-heatmap th.corner { background: transparent; border: 0; }
table.c-heatmap thead th {
  font-family: var(--font-mono);
  font-size: var(--t-label);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
  text-align: center;
  padding: 4px 8px 10px;
  white-space: nowrap;
}
table.c-heatmap th.hrow {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  color: var(--ink-2);
  font-weight: 600;
  text-align: right;
  padding: 0 14px 0 10px;
  white-space: nowrap;
}
table.c-heatmap td.hc {
  text-align: center;
  border-radius: 3px;
  min-width: 52px;
  height: 38px;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  font-size: 0.95rem;
}
table.c-heatmap td.hc.empty { background: var(--paper-2); }
table.c-heatmap td.hc .hn { display: inline-block; }

/* ---- Glossary ---- */
.prose ul.glossary-list { margin: 8px 0 0; padding: 0; list-style: none; }
.prose ul.glossary-list li { padding-left: 0; }
.prose ul.glossary-list li::before { display: none; }
.glossary-list { margin: 8px 0 0; padding: 0; list-style: none; }
.glossary-list li {
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
  font-size: var(--t-small);
  color: var(--ink-2);
  line-height: 1.55;
}
.glossary-list li strong { color: var(--ink); font-weight: 600; }

/* =============================================================
   SEARCH HIGHLIGHT
   ============================================================= */
mark.find {
  background: rgba(232, 115, 74, 0.22);
  color: inherit;
  border-radius: 2px;
  padding: 0 1px;
}
mark.find.current { background: var(--ember-soft); color: #fff; }

/* =============================================================
   FOCUS (reading) MODE
   ============================================================= */
body.focus #toc { opacity: 0.0; pointer-events: none; }
body.focus .shell { grid-template-columns: 0 minmax(0, 1fr); }
body.focus main { margin-left: auto; margin-right: auto; max-width: calc(var(--measure) + 120px); }
body.focus::before { opacity: 0.16; }

/* =============================================================
   RESPONSIVE
   ============================================================= */
@media (max-width: 1080px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  #toc {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 24px var(--gutter);
  }
  #toc ol { columns: 2; column-gap: 24px; }
}
@media (max-width: 620px) {
  #toolbar .brand { display: none; }
  .search input { width: 130px; }
  .search input:focus { width: 150px; }
  #toc ol { columns: 1; }
}

/* =============================================================
   PRINT / PDF
   ============================================================= */
@media print {
  @page { margin: 18mm 16mm; }
  html, body { background: #fff; color: #000; }
  body::before, #toolbar, #toc, #progress { display: none !important; }
  .shell { display: block; max-width: none; }
  main { padding: 0; max-width: none; }
  section.sec { break-inside: avoid; margin-bottom: 32px; }
  section.sec h2 { break-after: avoid; }
  .c-decision, .c-kpi, .c-transition, .c-waves li, .c-risk, .c-chart { break-inside: avoid; }
  .doc-head { margin-bottom: 36px; }
  a { color: #000; }
  .c-kpi .stat:hover, .c-transition .row:hover, .c-waves li:hover { border-left-color: transparent; background: #fff; }
}

/* ── Marcadores explicáveis (IMP-06, CUT-Q1, RSK-03, D-12…) — tooltip no hover (render.js
   envolve com <abbr class="ref" title="…">). Sublinhado pontilhado discreto + cursor de ajuda. */
abbr.ref {
  text-decoration: none;
  border-bottom: 1px dotted var(--muted-2);
  cursor: help;
  font-variant-numeric: tabular-nums;
  color: inherit;
}
abbr.ref:hover { border-bottom-color: var(--ember); color: var(--ember-deep); }
/* IDs renderizados como `código` que são marcadores do glossário: mesmo affordance de hover. */
code.ref { cursor: help; border-bottom: 1px dotted var(--muted-2); }
code.ref:hover { border-bottom-color: var(--ember); color: var(--ember-deep); }
/* Referências cruzadas "§N.N" que resolvem para uma seção do relatório: link de navegação. */
a.xref { color: var(--ember-deep); text-decoration: none; border-bottom: 1px dotted var(--ember); cursor: pointer; white-space: nowrap; }
a.xref:hover { border-bottom-style: solid; }
/* alvo do §link é um sub-heading dentro da prosa: deixa folga p/ a barra fixa não cobrir. */
.prose h2, .prose h3, .prose h4, .prose h5, .prose h6 { scroll-margin-top: 76px; }
