/* Kraken Agent Office 3.0 — "Abyssal Command Deck"
   One family (Archivo, variable weight + width). Width is the expressive axis:
   expanded for verdicts and headline figures, normal for working text,
   condensed for dense tables. Colour tokens below are validated for the dark
   surface (long/short pair passes CVD separation; see FRONTEND-3.0.md). */

@font-face {
  font-family: "Archivo";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  font-stretch: 62% 125%;
  src: url("../fonts/archivo-latin-ext-standard-normal.woff2") format("woff2-variations");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Archivo";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  font-stretch: 62% 125%;
  src: url("../fonts/archivo-latin-standard-normal.woff2") format("woff2-variations");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  color-scheme: dark;
  /* surfaces */
  --trench: #07111f;
  --hull: #0b1626;
  --hull-2: #0f1e33;
  --hull-3: #142741;
  --line: #1b2e48;
  --line-2: #24395a;
  /* ink */
  --ink: #e4eefa;
  --ink-2: #a9bbd1;
  --muted: #6f86a3;
  /* accents */
  --sonar: #4fb6f0;
  --bio: #57f0d4;
  --plasma: #9b86ff;
  /* polarity (validated diverging pair on --hull) */
  --long: #1caa95;
  --short: #e0693a;
  --neutral: #5d7290;
  /* status (reserved, always with icon + label) */
  --good: #2fc58f;
  --warn: #e8b04a;
  --critical: #ff4d5e;

  --r-lg: 18px;
  --r-md: 12px;
  --r-sm: 8px;
  --gap: 14px;
  --rail: 76px;
  --top: 64px;

  --t-xs: 11px;
  --t-sm: 12.5px;
  --t-md: 14px;
  --t-lg: 18px;
  --t-xl: 26px;
  --t-2xl: 40px;
  --t-hero: 64px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
html { overflow-x: clip; }
body {
  margin: 0;
  background:
    radial-gradient(1200px 700px at 72% -10%, rgba(79, 182, 240, .07), transparent 60%),
    radial-gradient(900px 600px at -10% 110%, rgba(155, 134, 255, .05), transparent 60%),
    var(--trench);
  color: var(--ink);
  font-family: "Archivo", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: var(--t-md);
  line-height: 1.45;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; color: inherit; }
a { color: var(--sonar); }
:focus-visible { outline: 2px solid var(--sonar); outline-offset: 2px; border-radius: 6px; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- shell ---------- */
.shell {
  display: grid;
  grid-template-columns: var(--rail) 1fr;
  grid-template-rows: auto 1fr;
  min-height: 100vh;
}
.rail {
  grid-row: 1 / 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 8px;
  border-right: 1px solid var(--line);
  background: rgba(7, 17, 31, .7);
  position: sticky;
  top: 0;
  height: 100vh;
}
.rail__mark { width: 40px; height: 40px; margin-bottom: 14px; }
.rail__btn {
  width: 60px;
  padding: 9px 0 7px;
  border: 0;
  border-radius: var(--r-md);
  background: transparent;
  color: var(--muted);
  display: grid;
  justify-items: center;
  gap: 4px;
  cursor: pointer;
  font-size: 10.5px;
  font-stretch: 88%;
  letter-spacing: .01em;
}
.rail__btn svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.rail__btn:hover { color: var(--ink-2); background: var(--hull); }
.rail__btn[aria-current="page"] { color: var(--ink); background: var(--hull-2); box-shadow: inset 2px 0 0 var(--sonar); }
.rail__spacer { flex: 1; }

.topbar {
  grid-column: 2;
  min-width: 0;
  min-height: var(--top);
  flex-wrap: wrap;
  row-gap: 8px;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 10px 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(7, 17, 31, .82);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 20;
}
.brand { display: flex; flex-direction: column; line-height: 1.1; margin-right: 8px; }
.brand b { white-space: nowrap; font-stretch: 118%; font-weight: 700; font-size: 15px; letter-spacing: .01em; }
.brand span { color: var(--muted); font-size: var(--t-xs); }
.desk-state { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  background: var(--hull);
  font-size: var(--t-sm);
  color: var(--ink-2);
  white-space: nowrap;
}
.pill b { color: var(--ink); font-weight: 600; }
.pill svg { width: 13px; height: 13px; flex: none; }
.pill--good { border-color: rgba(47, 197, 143, .45); }
.pill--good svg { color: var(--good); }
.pill--warn { border-color: rgba(232, 176, 74, .5); }
.pill--warn svg { color: var(--warn); }
.pill--critical { border-color: rgba(255, 77, 94, .6); background: rgba(255, 77, 94, .1); }
.pill--critical svg { color: var(--critical); }
.pill--live { border-color: var(--critical); background: rgba(255, 77, 94, .14); color: var(--ink); }
.topbar__spacer { flex: 1; }
.controls { display: flex; gap: 8px; }
.btn {
  border: 1px solid var(--line-2);
  background: var(--hull-2);
  color: var(--ink);
  border-radius: 10px;
  padding: 8px 14px;
  font-weight: 560;
  font-size: var(--t-sm);
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover { background: var(--hull-3); }
.btn:disabled { opacity: .5; cursor: progress; }
.btn--primary { background: var(--sonar); border-color: var(--sonar); color: #04121f; }
.btn--primary:hover { background: #7cc9f4; }
.btn--danger { border-color: rgba(255, 77, 94, .55); color: #ffd7db; background: rgba(255, 77, 94, .12); }
.btn--danger:hover { background: rgba(255, 77, 94, .22); }
.btn--ghost { background: transparent; }

.main { grid-column: 2; padding: 18px 22px 40px; min-width: 0; }
.view { display: none; }
.view--active { display: block; }
.view__head { display: flex; align-items: baseline; gap: 16px; margin: 2px 0 16px; flex-wrap: wrap; }
.view__title { margin: 0; font-size: var(--t-xl); font-stretch: 115%; font-weight: 640; letter-spacing: -.01em; }
.view__lede { margin: 0; color: var(--muted); max-width: 70ch; }

/* ---------- panels ---------- */
.panel {
  background: linear-gradient(180deg, rgba(15, 30, 51, .72), rgba(11, 22, 38, .9));
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 16px 18px;
  min-width: 0;
}
.panel--flush { padding: 0; overflow: hidden; }
.panel__head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.panel__title { margin: 0; font-size: 15px; font-weight: 620; font-stretch: 108%; }
.panel__hint { color: var(--muted); font-size: var(--t-sm); }
.panel__head .panel__hint:last-child { margin-left: auto; }
.empty { color: var(--muted); font-size: var(--t-sm); padding: 18px 0; }
.empty b { color: var(--ink-2); font-weight: 560; }

/* ---------- KPI ribbon ---------- */
.ribbon {
  display: grid;
  grid-template-columns: minmax(330px, 1.8fr) repeat(7, minmax(110px, 1fr));
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: rgba(11, 22, 38, .75);
  margin-bottom: var(--gap);
  overflow: hidden;
}
.kpi { padding: 13px 16px; border-left: 1px solid var(--line); min-width: 0; }
.kpi:first-child { border-left: 0; }
.kpi__label { color: var(--muted); font-size: var(--t-sm); }
.kpi__value { font-size: 22px; font-weight: 600; font-stretch: 108%; margin-top: 2px; white-space: nowrap; }
.kpi__sub { color: var(--muted); font-size: var(--t-xs); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi--hero { display: grid; grid-template-columns: auto minmax(70px, 130px); gap: 14px; align-items: center; justify-content: space-between; }
.kpi--hero .kpi__value { font-size: 32px; font-stretch: 122%; font-weight: 680; letter-spacing: -.02em; }
.kpi__spark { height: 44px; width: 100%; min-width: 80px; }
.pos { color: var(--long); }
.neg { color: var(--short); }
.dim { color: var(--muted); }

/* ---------- command layout ---------- */
.command {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(360px, .9fr);
  gap: var(--gap);
}
.command__dial { grid-row: span 2; }
.command__market { grid-column: 1 / -1; }
.stack { display: grid; gap: var(--gap); align-content: start; }

/* ---------- deliberation dial ---------- */
.dial-wrap { position: relative; }
.dial { width: 100%; height: auto; display: block; max-height: 74vh; margin: 0 auto; }
.dial__ring { fill: none; stroke: var(--line); stroke-width: 1; }
.dial__ring--strong { stroke: var(--line-2); }
.dial__spoke { stroke: var(--line); stroke-width: 1; opacity: .55; }
.dial__ringlabel { fill: var(--muted); font-size: 12px; font-stretch: 112%; letter-spacing: .08em; }
.dial__sweep { transform-origin: 400px 400px; opacity: 0; transition: opacity .6s; }
.dial--scanning .dial__sweep { opacity: 1; animation: sweep 4.5s linear infinite; }
@keyframes sweep { to { transform: rotate(360deg); } }
.node { cursor: pointer; }
.node__halo { fill: none; stroke-width: 2; opacity: 0; }
.node__core { fill: var(--hull-2); stroke: var(--line-2); stroke-width: 1.5; transition: stroke .3s, fill .3s; }
.node__glyph { fill: var(--ink-2); font-size: 13px; font-weight: 700; font-stretch: 120%; text-anchor: middle; dominant-baseline: central; pointer-events: none; }
.node__name { fill: var(--ink-2); font-size: 12.5px; font-weight: 600; font-stretch: 112%; text-anchor: middle; pointer-events: none; }
.node__role { fill: var(--muted); font-size: 10.5px; text-anchor: middle; pointer-events: none; }
.node__vote { fill: none; stroke-width: 3; stroke-linecap: round; }
.node:hover .node__core, .node:focus .node__core { stroke: var(--ink-2); }
.node:focus { outline: none; }
.node:focus-visible .node__core { stroke: var(--sonar); stroke-width: 2.5; }
.node[data-state="working"] .node__core { stroke: var(--sonar); fill: #10283f; }
.node[data-state="meeting"] .node__core { stroke: var(--plasma); fill: #1a1d3d; }
.node[data-state="approved"] .node__core { stroke: var(--good); }
.node[data-state="rejected"] .node__core,
.node[data-state="error"] .node__core,
.node[data-state="emergency"] .node__core { stroke: var(--critical); fill: #2a141c; }
.node[data-state="paused"] .node__core { stroke: var(--warn); }
.node[data-state="working"] .node__glyph, .node[data-state="meeting"] .node__glyph { fill: var(--ink); }
.node--ping .node__halo { animation: ping 1.2s ease-out 1; }
@keyframes ping { 0% { opacity: .9; stroke-width: 3; transform: scale(1); } 100% { opacity: 0; stroke-width: 1; transform: scale(1.9); } }
.node__halo { transform-box: fill-box; transform-origin: center; stroke: var(--bio); }
.node--selected .node__core { stroke: var(--ink); stroke-width: 2.5; }
.particle { fill: var(--bio); }
.core__ring { fill: none; stroke: var(--line-2); stroke-width: 2; }
.core__arc { fill: none; stroke-width: 6; stroke-linecap: round; }
.core__verdict { font-size: 38px; font-weight: 720; font-stretch: 118%; text-anchor: middle; fill: var(--ink); letter-spacing: -.01em; }
.core__symbol { font-size: 15px; font-weight: 600; text-anchor: middle; fill: var(--ink-2); font-stretch: 110%; }
.core__meta { font-size: 12px; text-anchor: middle; fill: var(--muted); }
.dial-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; color: var(--muted); font-size: var(--t-xs); margin-top: 6px; }
.dial-legend i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; border: 2px solid currentColor; }
.lg--sonar i { color: var(--sonar); }
.lg--plasma i { color: var(--plasma); }
.lg--good i { color: var(--good); }
.lg--critical i { color: var(--critical); }
.lg--long i, .lg--short i, .lg--neutral i { border-radius: 2px; width: 12px; height: 4px; border: 0; vertical-align: 2px; }
.lg--long i { background: var(--long); }
.lg--short i { background: var(--short); }
.lg--neutral i { background: var(--neutral); }
.split { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); }
.split__cell { padding: 16px 18px; min-width: 0; }
.split__cell + .split__cell { border-left: 1px solid var(--line); }
@media (max-width: 1180px) { .split { grid-template-columns: 1fr; } .split__cell + .split__cell { border-left: 0; border-top: 1px solid var(--line); } }
.dial-tip {
  position: absolute;
  pointer-events: none;
  min-width: 220px;
  max-width: 320px;
  background: rgba(7, 17, 31, .96);
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  padding: 10px 12px;
  font-size: var(--t-sm);
  box-shadow: 0 18px 50px rgba(0, 0, 0, .45);
  z-index: 5;
}
.dial-tip b { font-stretch: 112%; }
.dial-tip p { margin: 6px 0 0; color: var(--ink-2); }

/* ---------- verdict / bracket ---------- */
.verdict { display: grid; gap: 14px; }
.verdict__line { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.verdict__word { font-size: var(--t-2xl); font-weight: 720; font-stretch: 125%; line-height: 1; letter-spacing: -.02em; }
.verdict__word--long { color: var(--long); }
.verdict__word--short { color: var(--short); }
.verdict__sym { font-size: var(--t-lg); font-weight: 600; font-stretch: 110%; }
.verdict__thesis { color: var(--ink-2); margin: 0; max-width: 72ch; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.conviction { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; font-size: var(--t-sm); color: var(--muted); }
.meter { height: 6px; border-radius: 999px; background: var(--hull-3); overflow: hidden; position: relative; }
.meter i { position: absolute; inset: 0 auto 0 0; border-radius: 999px; background: var(--sonar); }
.meter__mark { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--ink-2); }

.ladder { position: relative; height: 210px; margin: 4px 0 0; }
.ladder__track { position: absolute; left: 50%; top: 6px; bottom: 6px; width: 4px; margin-left: -2px; border-radius: 4px; background: var(--hull-3); }
.ladder__zone { position: absolute; left: 50%; width: 12px; margin-left: -6px; border-radius: 4px; }
.ladder__zone--reward { background: rgba(28, 170, 149, .55); }
.ladder__zone--risk { background: rgba(224, 105, 58, .55); }
.ladder__row { position: absolute; left: 0; right: 0; display: grid; grid-template-columns: 1fr 34px 1fr; align-items: center; transform: translateY(-50%); font-size: var(--t-sm); }
.ladder__row span:first-child { text-align: right; color: var(--muted); }
.ladder__row b { font-weight: 600; }
.ladder__tick { position: absolute; left: 50%; width: 26px; margin-left: -13px; height: 2px; background: var(--ink-2); transform: translateY(-50%); }
.ladder__tick--mark { background: var(--bio); height: 3px; width: 34px; margin-left: -17px; }
.ladder__row--mark b, .ladder__row--mark span:first-child { color: var(--bio); }

.gate { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.gate li { display: grid; grid-template-columns: 18px 1fr auto; gap: 8px; align-items: start; font-size: var(--t-sm); color: var(--ink-2); }
.gate svg { width: 16px; height: 16px; margin-top: 1px; }
.gate .ok svg { color: var(--good); }
.gate .fail svg { color: var(--critical); }
.gate .info svg { color: var(--muted); }
.gate em { font-style: normal; color: var(--muted); white-space: nowrap; }

/* ---------- market matrix ---------- */
.matrix { width: 100%; border-collapse: collapse; font-size: var(--t-sm); }
.matrix th { text-align: left; font-weight: 500; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.matrix td { padding: 8px 10px; border-bottom: 1px solid rgba(27, 46, 72, .6); white-space: nowrap; }
.matrix tr:last-child td { border-bottom: 0; }
.matrix .num { text-align: right; }
.matrix tbody tr { cursor: default; }
.matrix tbody tr:hover td { background: rgba(20, 39, 65, .45); }
.matrix__sym { font-weight: 640; font-stretch: 112%; }
.matrix__sym small { display: block; font-weight: 400; color: var(--muted); font-stretch: 100%; }
.matrix tr.is-candidate td:first-child { box-shadow: inset 3px 0 0 var(--sonar); }
.spark { width: 120px; height: 30px; display: block; }
.scorebar { display: grid; grid-template-columns: 70px 44px 16px; align-items: center; gap: 6px; justify-content: end; }
.scorebar .meter { height: 5px; }
.flash-up { animation: flashUp .9s ease-out; }
.flash-down { animation: flashDown .9s ease-out; }
@keyframes flashUp { from { color: var(--long); } }
@keyframes flashDown { from { color: var(--short); } }
.table-scroll { overflow-x: auto; }

/* ---------- tape ---------- */
.tape { display: grid; gap: 1px; max-height: 420px; overflow: auto; font-size: var(--t-sm); }
.tape__row { display: grid; grid-template-columns: 62px 92px 1fr; gap: 10px; padding: 6px 4px; border-bottom: 1px solid rgba(27, 46, 72, .5); }
.tape__row time { color: var(--muted); }
.tape__who { color: var(--ink-2); font-weight: 600; font-stretch: 108%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tape__msg { color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tape__row--critical .tape__msg, .tape__row--error .tape__msg { color: #ffb3ba; }
.tape__row--new { animation: tapeIn 1.2s ease-out; }
@keyframes tapeIn { from { background: rgba(87, 240, 212, .1); } }

/* ---------- committee ---------- */
.committee { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: var(--gap); }
.history { display: grid; gap: 2px; max-height: 76vh; overflow: auto; }
.history__item { text-align: left; border: 1px solid transparent; background: transparent; border-radius: var(--r-md); padding: 9px 10px; cursor: pointer; display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; }
.history__item:hover { background: var(--hull-2); }
.history__item[aria-current="true"] { background: var(--hull-2); border-color: var(--line-2); }
.history__sym { font-weight: 620; font-stretch: 110%; }
.history__time { color: var(--muted); font-size: var(--t-xs); }
.history__act { font-size: var(--t-sm); font-weight: 600; }
.history__why { grid-column: 1 / -1; color: var(--muted); font-size: var(--t-xs); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.votes { display: grid; gap: 2px; }
.vote { display: grid; grid-template-columns: 150px minmax(180px, 1.1fr) minmax(0, 2fr); gap: 14px; align-items: center; padding: 9px 4px; border-bottom: 1px solid rgba(27, 46, 72, .55); }
.vote__who b { display: block; font-stretch: 112%; }
.vote__who span { color: var(--muted); font-size: var(--t-xs); }
.vote__summary { color: var(--ink-2); font-size: var(--t-sm); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.diverge { position: relative; height: 22px; }
.diverge__axis { position: absolute; left: 50%; top: 2px; bottom: 2px; width: 1px; background: var(--line-2); }
.diverge__bar { position: absolute; top: 7px; height: 8px; border-radius: 4px; }
.diverge__bar--long { left: calc(50% + 1px); background: var(--long); }
.diverge__bar--short { right: calc(50% + 1px); background: var(--short); }
.diverge__dot { position: absolute; left: 50%; top: 7px; width: 8px; height: 8px; margin-left: -4px; border-radius: 50%; background: var(--neutral); }
.diverge__label { position: absolute; top: 2px; font-size: var(--t-xs); color: var(--ink-2); }
.diverge__scale { display: flex; justify-content: space-between; color: var(--muted); font-size: var(--t-xs); }
.debate { display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap); }
.case h4 { margin: 0 0 4px; font-size: var(--t-lg); font-stretch: 118%; }
.case ul, .bullets { margin: 8px 0 0; padding-left: 18px; color: var(--ink-2); font-size: var(--t-sm); display: grid; gap: 4px; }
.tag { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 999px; font-size: var(--t-xs); border: 1px solid var(--line-2); color: var(--ink-2); }
.tag--long { border-color: rgba(28, 170, 149, .6); color: #8fe3d4; }
.tag--short { border-color: rgba(224, 105, 58, .6); color: #f3b398; }
.tag--veto { border-color: rgba(255, 77, 94, .6); color: #ffb3ba; }
.tag--ok { border-color: rgba(47, 197, 143, .6); color: #a6ecd0; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gap); }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--gap); }
.mt { margin-top: var(--gap); }
.kv { display: grid; grid-template-columns: 1fr auto; gap: 6px 14px; font-size: var(--t-sm); }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; text-align: right; font-weight: 560; }

/* ---------- charts ---------- */
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart__grid { stroke: var(--line); stroke-width: 1; }
.chart__axis { fill: var(--muted); font-size: 11px; }
.chart__line { fill: none; stroke: var(--sonar); stroke-width: 2; stroke-linejoin: round; }
.chart__area { fill: url(#eqfill); }
.chart__dd { fill: rgba(224, 105, 58, .35); }
.chart__cross { stroke: var(--ink-2); stroke-width: 1; }
.chart__dot { fill: var(--sonar); stroke: var(--hull); stroke-width: 2; }
.chart-tip { position: absolute; pointer-events: none; background: rgba(7, 17, 31, .96); border: 1px solid var(--line-2); border-radius: var(--r-sm); padding: 7px 9px; font-size: var(--t-xs); white-space: nowrap; transform: translate(-50%, calc(-100% - 10px)); z-index: 4; }
.chart-tip b { font-size: var(--t-sm); }
.bars { display: grid; gap: 8px; }
.bars__row { display: grid; grid-template-columns: 90px 1fr 120px; gap: 10px; align-items: center; font-size: var(--t-sm); }
.bars__row span:last-child { text-align: right; color: var(--ink-2); }
.bars__track { position: relative; height: 12px; }
.bars__axis { position: absolute; left: 50%; top: -3px; bottom: -3px; width: 1px; background: var(--line-2); }
.bars__fill { position: absolute; top: 2px; height: 8px; border-radius: 4px; }

/* ---------- progress / stats ---------- */
.journey { display: grid; grid-template-columns: auto 1fr auto; gap: 16px; align-items: center; }
.journey__days { font-size: var(--t-2xl); font-weight: 700; font-stretch: 122%; line-height: 1; }
.journey__days small { font-size: var(--t-md); color: var(--muted); font-weight: 500; font-stretch: 100%; }
.journey .meter { height: 10px; }
.journey .meter i { background: linear-gradient(90deg, var(--sonar), var(--bio)); }
.statline { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; }
.statline > div { padding: 10px 14px; border-left: 1px solid var(--line); }
.statline > div:first-child { border-left: 0; }
.statline span { display: block; color: var(--muted); font-size: var(--t-xs); }
.statline b { font-size: var(--t-lg); font-weight: 620; font-stretch: 108%; }
.insight { border-left: 3px solid var(--sonar); padding: 6px 0 6px 12px; color: var(--ink-2); margin: 0; max-width: 80ch; }
.insight--warn { border-left-color: var(--warn); }
.insight--good { border-left-color: var(--good); }

.data-table { width: 100%; border-collapse: collapse; font-size: var(--t-sm); }
.data-table th { text-align: left; color: var(--muted); font-weight: 500; padding: 7px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.data-table td { padding: 7px 8px; border-bottom: 1px solid rgba(27, 46, 72, .5); white-space: nowrap; }
.data-table .num { text-align: right; }
.data-table td.wrap { white-space: normal; min-width: 260px; color: var(--ink-2); }

.position { display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; padding: 10px 0; border-bottom: 1px solid rgba(27, 46, 72, .55); }
.position:last-child { border-bottom: 0; }
.position__track { grid-column: 1 / -1; position: relative; height: 8px; border-radius: 4px; background: var(--hull-3); }
.position__track i { position: absolute; top: -3px; width: 2px; height: 14px; background: var(--ink); }
.position__track .seg-risk { position: absolute; top: 0; bottom: 0; background: rgba(224, 105, 58, .55); border-radius: 4px 0 0 4px; }
.position__track .seg-reward { position: absolute; top: 0; bottom: 0; background: rgba(28, 170, 149, .55); border-radius: 0 4px 4px 0; }

.integration { display: grid; grid-template-columns: auto 1fr auto; gap: 4px 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid rgba(27, 46, 72, .55); }
.integration:last-child { border-bottom: 0; }
.integration svg { width: 18px; height: 18px; }
.integration p { grid-column: 2 / -1; margin: 0; color: var(--muted); font-size: var(--t-sm); }
.ok-ico { color: var(--good); }
.warn-ico { color: var(--warn); }
.bad-ico { color: var(--critical); }

.filters { display: flex; gap: 6px; flex-wrap: wrap; }
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: 10px; overflow: hidden; }
.seg button { border: 0; background: transparent; padding: 5px 10px; color: var(--muted); cursor: pointer; font-size: var(--t-sm); }
.seg button[aria-pressed="true"] { background: var(--hull-3); color: var(--ink); }

pre.json { margin: 0; max-height: 320px; overflow: auto; background: var(--trench); border: 1px solid var(--line); border-radius: var(--r-md); padding: 10px; font-size: 11.5px; color: var(--ink-2); white-space: pre-wrap; word-break: break-word; }

/* ---------- drawer / modal / toast ---------- */
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(460px, 100vw); background: var(--hull); border-left: 1px solid var(--line-2); z-index: 40; padding: 20px; overflow: auto; box-shadow: -30px 0 80px rgba(0, 0, 0, .5); transform: translateX(105%); transition: transform .28s ease; }
.drawer:not(.drawer--open) { visibility: hidden; transition: transform .28s ease, visibility 0s .28s; }
.drawer--open { transform: none; visibility: visible; }
.drawer__close { position: absolute; top: 14px; right: 14px; }
.drawer h3 { margin: 0 0 2px; font-size: var(--t-xl); font-stretch: 120%; }
.drawer__role { color: var(--muted); margin-bottom: 14px; }
.drawer section { margin-top: 16px; }
.drawer h5 { margin: 0 0 6px; font-size: var(--t-sm); color: var(--muted); font-weight: 520; }

.modal { position: fixed; inset: 0; background: rgba(3, 8, 15, .78); display: grid; place-items: center; z-index: 60; padding: 16px; }
.modal__card { width: min(420px, 100%); background: var(--hull); border: 1px solid var(--line-2); border-radius: var(--r-lg); padding: 24px; display: grid; gap: 12px; }
.modal__card h2 { margin: 0; font-stretch: 118%; }
.modal__card p { margin: 0; color: var(--ink-2); }
.modal__card input { background: var(--trench); border: 1px solid var(--line-2); border-radius: 10px; padding: 10px 12px; }
.modal__row { display: flex; gap: 8px; justify-content: flex-end; }

.toast { position: fixed; bottom: 22px; right: 22px; max-width: 420px; padding: 12px 14px; border-radius: var(--r-md); background: var(--hull-2); border: 1px solid var(--line-2); z-index: 70; white-space: pre-line; font-size: var(--t-sm); box-shadow: 0 18px 50px rgba(0, 0, 0, .45); }
.toast--error { border-color: rgba(255, 77, 94, .6); }
.toast--ok { border-color: rgba(47, 197, 143, .6); }

.banner-live { background: rgba(255, 77, 94, .14); border: 1px solid rgba(255, 77, 94, .6); color: #ffd7db; border-radius: var(--r-md); padding: 8px 14px; margin-bottom: var(--gap); font-weight: 600; }

/* ---------- responsive ---------- */
@media (max-width: 1500px) {
  .ribbon { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .ribbon .kpi:nth-child(n+5) { border-top: 1px solid var(--line); }
  .ribbon .kpi:nth-child(5) { border-left: 0; }
  .kpi--hero { grid-template-columns: auto minmax(50px, 110px); }
  .kpi--hero .kpi__value { font-size: 28px; }
}
@media (max-width: 1500px) {
  .brand span { display: none; }
  .controls .btn--label { display: none; }
}
@media (max-width: 1180px) {
  .command { grid-template-columns: 1fr; }
  .command__dial { grid-row: auto; }
  .committee { grid-template-columns: 1fr; }
  .history { max-height: 260px; }
  .controls .btn--label { display: none; }
}
@media (max-width: 820px) {
  :root { --rail: 0px; --top: auto; }
  .shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr auto; }
  .topbar, .main { min-width: 0; }
  .desk-state { gap: 6px; }
  .pill { padding: 4px 9px; font-size: 11.5px; }
  .rail { grid-row: 3; grid-column: 1; flex-direction: row; position: fixed; bottom: 0; left: 0; right: 0; top: auto; height: auto; justify-content: space-around; border-right: 0; border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); z-index: 30; background: rgba(7, 17, 31, .96); overflow-x: auto; }
  .rail__mark, .rail__spacer { display: none; }
  .rail__btn { width: auto; min-width: 48px; padding: 6px 4px; }
  .topbar { grid-column: 1; flex-wrap: wrap; padding: 10px 16px; gap: 10px; }
  .brand span { display: none; }
  .topbar__spacer { display: none; }
  .controls { width: 100%; overflow-x: auto; }
  .main { grid-column: 1; padding: 14px 16px 96px; }
  .ribbon { grid-template-columns: 1fr 1fr; }
  .ribbon .kpi { border-left: 0; border-top: 1px solid var(--line); }
  .kpi--hero { grid-column: 1 / -1; border-top: 0 !important; }
  .grid-2, .grid-3, .debate { grid-template-columns: 1fr; }
  .vote { grid-template-columns: 1fr; gap: 6px; }
  .journey { grid-template-columns: 1fr; }
  .node__role { display: none; }
  .bars__row { grid-template-columns: 70px 1fr 90px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* helpers added for views */
.msvg { display: block; }
[data-span="2"] { grid-column: span 2; }
.spark--wide { width: 100%; height: 70px; }
.matrix__sym .btn { padding: 2px 6px; font-weight: 640; font-stretch: 112%; }
details summary { cursor: pointer; }
@media (max-width: 820px) { [data-span="2"] { grid-column: auto; } }

.memory { padding: 12px 0; border-bottom: 1px solid rgba(27, 46, 72, .55); }
.memory:last-child { border-bottom: 0; }
.memory p { margin: 6px 0 0; color: var(--ink-2); font-size: var(--t-sm); max-width: 110ch; }
.vote .diverge { margin-bottom: 2px; }

/* ---------- 3.1 executive office ---------- */
.office { position: relative; height: max(560px, calc(100vh - 250px)); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden;
  background: radial-gradient(1200px 600px at 50% 20%, #0c1a2d, #060d18 70%); }
.office__canvas { display: block; touch-action: none; cursor: grab; }
.office__canvas:focus-visible { outline: 2px solid var(--sonar); outline-offset: -2px; }
.office__bar { position: absolute; top: 12px; left: 12px; right: 12px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; pointer-events: none; }
.office__bar .seg { pointer-events: auto; background: rgba(7, 17, 31, .82); backdrop-filter: blur(8px); }
.office__phase { margin-left: auto; color: var(--ink-2); font-size: var(--t-sm); background: rgba(7, 17, 31, .82); border: 1px solid var(--line-2); border-radius: 999px; padding: 5px 12px; }
.office__phase:empty { display: none; }
.office__islands { position: absolute; top: 56px; right: 12px; width: 230px; display: grid; gap: 2px; padding: 8px 10px; background: rgba(7, 17, 31, .82);
  border: 1px solid var(--line-2); border-radius: 12px; backdrop-filter: blur(8px); font-size: var(--t-xs); }
.office__islands button { all: unset; display: grid; grid-template-columns: 1fr auto; gap: 1px 8px; padding: 5px 6px; border-radius: 8px; cursor: pointer; }
.office__islands button:hover, .office__islands button:focus-visible { background: var(--hull-2); }
.office__islands b { color: var(--ink); font-weight: 600; font-size: var(--t-sm); }
.office__islands span { color: var(--muted); }
.office__dots { display: flex; gap: 4px; align-items: center; grid-row: span 2; }
.office__dots i { width: 7px; height: 7px; border-radius: 50%; background: #3b4f6b; }
.office__dots i.s-working { background: var(--sonar); }
.office__dots i.s-meeting { background: var(--plasma); }
.office__dots i.s-approved { background: var(--good); }
.office__dots i.s-rejected, .office__dots i.s-error { background: var(--critical); }
.office__dots i.s-paused { background: var(--warn); }
.office__legend { position: absolute; left: 12px; bottom: 12px; display: flex; flex-wrap: wrap; gap: 6px 14px; padding: 7px 12px; color: var(--ink-2); font-size: var(--t-xs);
  background: rgba(7, 17, 31, .82); border: 1px solid var(--line-2); border-radius: 12px; pointer-events: none; }
.office__legend i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; border: 2px solid currentColor; }
.lg--idle i { color: #6f86a3; }
.office__zoom { position: absolute; right: 12px; bottom: 12px; display: flex; gap: 6px; }
.office__zoom .btn { background: rgba(7, 17, 31, .86); min-width: 38px; }
.office__tip { position: absolute; pointer-events: none; min-width: 220px; max-width: 320px; background: rgba(7, 17, 31, .96); border: 1px solid var(--line-2);
  border-radius: var(--r-md); padding: 10px 12px; font-size: var(--t-sm); box-shadow: 0 18px 50px rgba(0, 0, 0, .45); z-index: 5; }
.office__tip b { font-stretch: 112%; }
.office__tip p { margin: 6px 0 0; color: var(--ink-2); }
.drawer__portrait { width: 96px; height: 96px; border-radius: 22px; border: 1px solid var(--line-2); float: right; margin: 34px 0 10px 14px; }
@media (max-width: 820px) {
  .office { height: min(70vh, 115vw); }
  #ribbon-office .kpi:not(.kpi--hero) { display: none; }
  .office__legend, .office__islands { display: none; }
  .office__bar .seg button { padding: 5px 8px; }
}

/* 3.3.1 Direção (CEO) */
.ceo__meta { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin: 0; }
.ceo__list { margin: 10px 0 0; padding-left: 20px; display: grid; gap: 6px; color: var(--ink-2); font-size: var(--t-sm); max-width: 80ch; }
.ceo__list li::marker { color: var(--warn); font-weight: 600; }
.ceo__list--warn li::marker { color: var(--critical); }
#ceo-panel .panel__head .btn { padding-block: 4px; font-size: var(--t-xs); }
