/* Meridian — governance console (SPEC.md §18)
   Direction: trading-desk terminal density (dense monospace tables, sharp corners,
   hairline borders, hover-for-detail) — but in the same navy/brass "admiralty
   chart" palette as the executive deck, not a generic amber terminal. Northwind is
   a logistics/shipping account; navy + brass is the actual industry register for
   this case study, and it's the one palette this whole product already speaks —
   deck, presentation, and console should read as one thing, not three. */

@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500;600;700&display=swap');

:root {
  --bg: #0B1420;
  --panel: #101B2B;
  --panel-alt: #162336;
  --panel-raised: #1C2C43;
  --border: rgba(199, 154, 70, 0.16);
  --border-bright: rgba(199, 154, 70, 0.34);
  --text: #F2EEE3;
  --text-dim: #A9B3C4;
  --text-faint: #5B6B80;

  --amber: #E0B563;
  --amber-dim: #8C6C2E;
  --amber-bg: rgba(199, 154, 70, 0.1);

  --green: #6FBF97;
  --green-bg: rgba(111, 191, 151, 0.1);
  --green-border: rgba(111, 191, 151, 0.32);

  --red: #C97C6A;
  --red-bg: rgba(201, 124, 106, 0.1);
  --red-border: rgba(201, 124, 106, 0.32);

  --cyan: #7FA8D9;
  --cyan-bg: rgba(127, 168, 217, 0.09);

  --gray: #8B95A8;
  --gray-bg: rgba(139, 149, 168, 0.1);

  --mono: 'IBM Plex Mono', 'SF Mono', monospace;
  --sans: 'IBM Plex Sans', -apple-system, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; border-radius: 0 !important; }
::selection { background: var(--amber-dim); color: var(--text); }
::-webkit-scrollbar { width: 7px; height: 7px; }
::-webkit-scrollbar-thumb { background: var(--border-bright); }
::-webkit-scrollbar-track { background: var(--panel); }

body {
  font-family: var(--mono);
  background: var(--bg);
  color: var(--text);
  font-size: 12.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

#app { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }

/* ── Ticker header ── */
.mission-bar {
  display: flex; align-items: stretch; gap: 0;
  background: var(--panel);
  border-bottom: 1px solid var(--border-bright);
  flex-shrink: 0; height: 46px;
}
.brand { display: flex; align-items: center; gap: 9px; padding: 0 16px; border-right: 1px solid var(--border); }
.brand-mark { color: var(--amber); font-weight: 700; font-size: 13px; letter-spacing: 0.02em; }
.brand-title { font-weight: 700; font-size: 12.5px; letter-spacing: 0.03em; color: var(--text); }
.brand-sub { font-size: 9px; color: var(--text-faint); letter-spacing: 0.02em; }

.mission-divider { display: none; }

.hero-metric { display: flex; align-items: center; gap: 10px; padding: 0 16px; border-right: 1px solid var(--border); }
.gauge { display: none; }
.hero-metric-value { font-family: var(--mono); font-size: 20px; font-weight: 700; color: var(--amber); line-height: 1; font-variant-numeric: tabular-nums; }
.hero-metric-label { font-size: 8.5px; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.05em; }
.hero-trend { display: flex; align-items: center; margin-left: 4px; }

.mission-stats { display: flex; }
.mstat { display: flex; flex-direction: column; justify-content: center; gap: 1px; padding: 0 16px; border-right: 1px solid var(--border); }
.mstat-value { font-family: var(--mono); font-size: 13px; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.mstat-label { font-size: 8.5px; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.04em; }

.mission-spacer { flex: 1; }

.conn-pill {
  font-family: var(--mono); font-size: 9.5px; padding: 0 14px;
  border-left: 1px solid var(--border); color: var(--text-faint); background: transparent;
  white-space: nowrap; display: flex; align-items: center; letter-spacing: 0.03em;
}
.conn-pill.live { color: var(--green); }
.conn-pill.dead { color: var(--red); }

.nav-toggle { display: flex; border-left: 1px solid var(--border); }
.nav-toggle button { font-family: var(--mono); font-size: 10px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-faint); background: transparent; border: none; border-right: 1px solid var(--border); padding: 0 16px; cursor: pointer; transition: 0.1s; }
.nav-toggle button.active { background: var(--amber-bg); color: var(--amber); }
.nav-toggle button:hover:not(.active) { color: var(--text-dim); background: var(--panel-alt); }

/* ── Layout ── */
.layout { display: flex; flex: 1; overflow: hidden; }

/* ── Sidebar / queue — dense table rows, not cards ── */
.sidebar { width: 360px; flex-shrink: 0; background: var(--panel); border-right: 1px solid var(--border-bright); display: flex; flex-direction: column; overflow: hidden; }
.queue-section { display: flex; flex-direction: column; overflow: hidden; }
.queue-section.exceptions { flex: 1; min-height: 0; }
.queue-head { padding: 8px 12px; display: flex; align-items: center; gap: 8px; flex-shrink: 0; background: var(--panel-alt); border-bottom: 1px solid var(--border); border-top: 1px solid var(--border); }
.queue-title { font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-dim); }
.queue-title.exception-title { color: var(--red); }
.queue-title.intake-title { color: var(--cyan); }
.queue-count.intake-count { color: var(--cyan); }
.queue-count { font-family: var(--mono); font-size: 10px; color: var(--text-faint); margin-left: auto; font-variant-numeric: tabular-nums; }
.queue-count.exception-count { color: var(--red); }
.queue-scroll { overflow-y: auto; flex: 1; min-height: 0; }

.run-card {
  display: block; padding: 7px 12px; cursor: pointer;
  background: var(--panel); border-bottom: 1px solid var(--border); transition: 0.08s;
}
.run-card:nth-child(even) { background: var(--panel-alt); }
.run-card:hover { background: var(--amber-bg); }
.run-card.active { background: var(--amber-bg); box-shadow: inset 2px 0 0 var(--amber); }
.run-card.auto-resolved { padding: 5px 12px; }

.run-card-top { display: flex; align-items: center; gap: 6px; margin-bottom: 3px; }
.badge { font-family: var(--mono); font-size: 8.5px; font-weight: 700; padding: 1px 6px; text-transform: uppercase; letter-spacing: 0.02em; border: 1px solid; }
.badge.pending { color: var(--red); background: var(--red-bg); border-color: var(--red-border); }
.badge.approved { color: var(--text-dim); background: transparent; border-color: var(--border-bright); }
.badge.declined { color: var(--gray); background: var(--gray-bg); border-color: var(--border-bright); }
.badge.auto_resolved, .badge.auto_resolved_negotiated { color: var(--green); background: var(--green-bg); border-color: var(--green-border); }
.badge.in_progress { color: var(--cyan); background: var(--cyan-bg); border-color: var(--border); }
.trigger-tag { font-family: var(--mono); font-size: 8px; color: var(--cyan); background: var(--cyan-bg); border: 1px solid var(--border-bright); padding: 1px 5px; text-transform: uppercase; }

.run-card-action { font-size: 11px; color: var(--text); line-height: 1.4; margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.run-card.auto-resolved .run-card-action { font-size: 10px; color: var(--text-dim); }
.run-card-meta { font-size: 9.5px; color: var(--text-faint); font-variant-numeric: tabular-nums; }

.empty-sidebar { padding: 18px 14px; font-size: 11px; color: var(--text-faint); text-align: center; line-height: 1.6; }
.empty-sidebar code { font-family: var(--mono); background: var(--panel-alt); padding: 1px 5px; border: 1px solid var(--border); }

/* ── Detail pane ── */
.detail { flex: 1; display: flex; flex-direction: column; overflow: hidden; background: var(--bg); }
.empty-detail { flex: 1; display: flex; align-items: center; justify-content: center; color: var(--text-faint); font-size: 12px; padding: 40px; text-align: center; }
.empty-detail code { font-family: var(--mono); background: var(--panel-alt); padding: 2px 6px; border: 1px solid var(--border); }

.decision-banner { padding: 8px 16px; font-size: 11px; font-weight: 600; border-bottom: 1px solid; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; letter-spacing: 0.02em; }
.decision-banner.pending    { background: var(--red-bg); color: var(--red); border-color: var(--red-border); }
.decision-banner.approved   { background: var(--panel-alt); color: var(--text-dim); border-color: var(--border); }
.decision-banner.declined   { background: var(--gray-bg); color: var(--gray); border-color: var(--border); }
.decision-banner.running    { background: var(--panel-alt); color: var(--text-faint); border-color: var(--border); }
.decision-banner.auto_resolved, .decision-banner.auto_resolved_negotiated { background: var(--green-bg); color: var(--green); border-color: var(--green-border); }
.decision-banner-spacer { flex: 1; }

.envelope-tag { font-family: var(--mono); font-size: 9.5px; color: var(--green); background: rgba(62,207,110,0.14); border: 1px solid var(--green-border); padding: 1px 7px; }

.promote-btn { font-family: var(--mono); font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; color: var(--bg); background: var(--amber); border: none; padding: 4px 10px; cursor: pointer; transition: 0.1s; }
.promote-btn:hover { background: #FFC940; }

.urgency-banner { padding: 7px 16px; background: var(--red-bg); color: var(--red); font-size: 11px; border-bottom: 1px solid var(--red-border); display: flex; gap: 7px; align-items: flex-start; }
.urgency-icon { flex-shrink: 0; }

.skew-alert { display: flex; gap: 10px; padding: 10px 14px; margin: 14px 16px 0; background: var(--red-bg); border: 1px solid var(--red-border); }
.skew-icon { font-size: 15px; flex-shrink: 0; }
.skew-alert-title { font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--red); margin-bottom: 3px; }
.skew-alert-body > div:not(.skew-alert-title):not(.skew-stats) { font-size: 11px; color: var(--text-dim); line-height: 1.55; font-family: var(--sans); }
.skew-stats { display: flex; gap: 10px; margin-top: 7px; flex-wrap: wrap; }
.skew-stat { font-family: var(--mono); font-size: 10.5px; color: var(--text); background: var(--panel); padding: 2px 8px; border: 1px solid var(--border-bright); font-variant-numeric: tabular-nums; }

.detail-chrome { padding: 8px 16px 0; font-family: var(--mono); font-size: 9.5px; color: var(--text-faint); letter-spacing: 0.02em; }

.detail-content { flex: 1; overflow-y: auto; padding: 14px 16px; }

/* ── Formula-transparent stat: hover for the real derivation — "36% has no
   formula" fix. Uses the .has-tip/.chip-tooltip rendered popover above, not
   the native title attribute (see that block's comment for why). ── */
.stat-formula { border-bottom: 1px dotted var(--text-faint); }

/* ── Evidence disclosure — one collapse, not a second tab ── */
.evidence-toggle-block { margin-top: 4px; }
.evidence-toggle-block > summary { cursor: pointer; font-family: var(--mono); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-dim); padding: 10px 16px; border-top: 1px solid var(--border-bright); background: var(--panel-alt); list-style: none; }
.evidence-toggle-block > summary::-webkit-details-marker { display: none; }
.evidence-toggle-block > summary::before { content: "▸ "; color: var(--amber); }
.evidence-toggle-block[open] > summary::before { content: "▾ "; }
.evidence-toggle-block > summary:hover { color: var(--text); }
.evidence-body { padding: 14px 16px; }

/* ── Ticket trace — one linear timeline per ticket (SPEC.md §18: "resolve
   tickets quickly with end-to-end traceability"), same collapse language as
   .evidence-toggle-block. ── */
.ticket-trace { margin: 0 0 4px; border-bottom: 1px solid var(--border-bright); }
.ticket-trace > summary { cursor: pointer; font-family: var(--mono); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-dim); padding: 10px 16px; background: var(--panel-alt); list-style: none; }
.ticket-trace > summary::-webkit-details-marker { display: none; }
.ticket-trace > summary::before { content: "▸ "; color: var(--amber); }
.ticket-trace[open] > summary::before { content: "▾ "; }
.ticket-trace > summary:hover { color: var(--text); }
.ticket-trace-body { padding: 10px 16px 14px; max-height: 360px; overflow-y: auto; }
.trace-event { display: grid; grid-template-columns: 78px 12px 1fr; gap: 8px; padding: 3px 0; }
.trace-event-time { font-family: var(--mono); font-size: 9px; color: var(--text-faint); white-space: nowrap; padding-top: 2px; }
.trace-event-dot { position: relative; }
.trace-event-dot::before { content: ""; position: absolute; left: 4px; top: 4px; width: 6px; height: 6px; border-radius: 50%; background: var(--text-faint); }
.trace-event-dot::after { content: ""; position: absolute; left: 6.5px; top: 12px; width: 1px; bottom: -6px; background: var(--border-bright); }
.trace-event:last-child .trace-event-dot::after { display: none; }
.trace-event-label { font-size: 11.5px; color: var(--text); }
.trace-event-detail { font-size: 10.5px; color: var(--text-faint); margin-top: 1px; line-height: 1.4; }
.trace-event.trace-decision .trace-event-dot::before { background: var(--amber); }
.trace-event.trace-chat .trace-event-dot::before { background: var(--cyan); }
.trace-event.trace-escalation .trace-event-dot::before { background: var(--red); }
.trace-event.trace-csat .trace-event-dot::before { background: var(--green); }

/* ── Facts as a dense, scannable table — not a hover-only chip wall ── */
.fact-group { margin-bottom: 14px; }
.fact-group:last-child { margin-bottom: 0; }
.fact-group-head { font-family: var(--mono); font-size: 10px; font-weight: 700; color: var(--amber); text-transform: uppercase; letter-spacing: 0.04em; padding: 5px 0; border-bottom: 1px solid var(--border-bright); margin-bottom: 2px; }
.fact-table { width: 100%; border-collapse: collapse; }
.fact-table td { padding: 5px 8px; border-bottom: 1px solid var(--border); font-size: 11.5px; vertical-align: top; }
.fact-table tr:hover td { background: var(--panel-alt); }
.fact-table .fact-id { font-family: var(--mono); font-size: 10px; color: var(--text-faint); white-space: nowrap; width: 58px; }
.fact-table .fact-text { color: var(--text-dim); font-family: var(--sans); line-height: 1.5; }
.fact-table .fact-conf { font-family: var(--mono); font-size: 9px; text-transform: uppercase; white-space: nowrap; width: 62px; text-align: right; }
.fact-table .fact-conf.conf-high { color: var(--green); }
.fact-table .fact-conf.conf-medium { color: var(--amber); }
.fact-table .fact-conf.conf-low, .fact-table .fact-conf.conf-unknown { color: var(--text-faint); }

/* ── Conflicts — full claim text, real actions, not a hover chip ── */
.conflict-card { background: var(--panel); border: 1px solid var(--red-border); border-left: 2px solid var(--red); padding: 10px 14px; margin-bottom: 10px; }
.conflict-card:last-child { margin-bottom: 0; }
.conflict-card-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.conflict-card-id { font-family: var(--mono); font-size: 10px; font-weight: 700; color: var(--red); }
.conflict-card-desc { font-family: var(--sans); font-size: 12px; color: var(--text); line-height: 1.5; margin-bottom: 8px; }
.conflict-claims { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 8px; }
.conflict-claim { background: var(--bg); border: 1px solid var(--border); padding: 7px 9px; font-size: 11px; }
.conflict-claim .claim-id { font-family: var(--mono); font-size: 9.5px; color: var(--text-faint); display: block; margin-bottom: 3px; }
.conflict-claim .claim-text { color: var(--text-dim); font-family: var(--sans); line-height: 1.45; }
.conflict-note-block { border-top: 1px dashed var(--border); padding-top: 8px; }
.conflict-note-existing { font-family: var(--sans); font-size: 11px; color: var(--text-dim); background: var(--green-bg); border: 1px solid var(--green-border); padding: 6px 9px; margin-bottom: 6px; }
.conflict-note-existing b { color: var(--green); }
.conflict-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.conflict-actions input, .conflict-actions textarea { font-family: var(--sans); font-size: 11px; background: var(--bg); border: 1px solid var(--border-bright); color: var(--text); padding: 5px 8px; outline: none; }
.conflict-actions input:focus, .conflict-actions textarea:focus { border-color: var(--amber); }
.conflict-note-input { flex: 1; min-width: 220px; }
.conflict-name-input { width: 110px; }
.conflict-actions button { font-family: var(--mono); font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; padding: 5px 10px; cursor: pointer; border: 1px solid var(--border-bright); background: var(--panel-alt); color: var(--text-dim); transition: 0.1s; }
.conflict-actions button:hover { color: var(--text); border-color: var(--amber-dim); }
.conflict-actions button.escalate-btn:hover { color: var(--cyan); border-color: var(--cyan); }

.panel { margin-bottom: 14px; }
.panel-title { font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-faint); margin-bottom: 6px; padding-bottom: 5px; border-bottom: 1px solid var(--border); }

.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--border); border: 1px solid var(--border); }
.kpi-tile { background: var(--panel); padding: 10px 12px; }
.kpi-value { font-family: var(--mono); font-size: 17px; font-weight: 700; color: var(--text); line-height: 1; font-variant-numeric: tabular-nums; }
.kpi-tile.good .kpi-value { color: var(--green); }
.kpi-tile.warn .kpi-value { color: var(--red); }
.kpi-tile.bad .kpi-value { color: var(--red); }
.kpi-baseline { font-size: 8.5px; color: var(--text-faint); margin-top: 3px; }
.kpi-label { font-size: 9.5px; color: var(--text-faint); margin-top: 3px; text-transform: uppercase; letter-spacing: 0.02em; }

.rec-card { background: var(--panel); border: 1px solid var(--border-bright); border-left: 2px solid var(--amber); padding: 10px 14px; }
.rec-action { font-family: var(--sans); font-size: 12.5px; font-weight: 600; color: var(--text); margin-bottom: 6px; line-height: 1.5; }
.rec-rationale { font-family: var(--sans); font-size: 11.5px; color: var(--text-dim); line-height: 1.55; }

.doc-block { font-family: var(--sans); background: var(--panel); border: 1px solid var(--border); padding: 12px 14px; font-size: 12px; line-height: 1.65; color: var(--text-dim); white-space: pre-wrap; }
.doc-block.exec-clean { color: var(--text); }
.cite { font-family: var(--mono); font-size: 0.82em; color: var(--amber); background: var(--amber-bg); padding: 0 3px; }

.approval-panel { background: var(--red-bg); border: 1px solid var(--red-border); padding: 10px 14px; margin-bottom: 14px; }
.approval-title { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; color: var(--red); margin-bottom: 3px; }
.approval-sub { font-family: var(--sans); font-size: 11px; color: var(--text-dim); margin-bottom: 9px; }
.approval-row { display: flex; gap: 6px; flex-wrap: wrap; }
.approval-input { flex: 1; min-width: 160px; background: var(--bg); border: 1px solid var(--border-bright); padding: 6px 9px; color: var(--text); font-family: var(--mono); font-size: 11.5px; outline: none; }
.approval-input:focus { border-color: var(--amber); }
.btn { font-family: var(--mono); font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; padding: 6px 14px; cursor: pointer; border: 1px solid transparent; transition: 0.1s; }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn-approve { background: var(--amber); color: var(--bg); }
.btn-approve:hover:not(:disabled) { background: #FFC940; }
.btn-decline { background: transparent; color: var(--text-dim); border-color: var(--border-bright); }
.btn-decline:hover:not(:disabled) { border-color: var(--red-border); color: var(--red); }

.stage-timeline { display: grid; grid-template-columns: repeat(6, 1fr); gap: 1px; background: var(--border); border: 1px solid var(--border); }
.stage-chip { background: var(--panel); padding: 8px 10px; }
.stage-chip-name { font-size: 8.5px; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.02em; margin-bottom: 4px; }
.stage-chip-time { font-family: var(--mono); font-size: 14px; font-weight: 700; color: var(--amber); font-variant-numeric: tabular-nums; }
.stage-chip-sub { font-size: 8.5px; color: var(--text-faint); margin-top: 2px; }

/* ── Dense data chips with hover-inspector tooltip (facts/conflicts/unknowns) ── */
.chip-row { display: flex; flex-wrap: wrap; gap: 3px; }
.data-chip {
  position: relative; font-family: var(--mono); font-size: 10px; cursor: default;
  background: var(--panel); border: 1px solid var(--border-bright);
  padding: 3px 8px; display: flex; align-items: center; gap: 6px;
}
.data-chip:hover { background: var(--amber-bg); border-color: var(--amber-dim); z-index: 5; }
.chip-id { color: var(--amber); font-weight: 700; }
.chip-sub { color: var(--text-faint); font-size: 9.5px; }

.conflict-chip { border-left: 2px solid var(--red); }
.conflict-chip .chip-id { color: var(--red); }
.unknown-chip .chip-id { color: var(--cyan); }
.fact-chip-mini.conf-high { border-left: 2px solid var(--green); }
.fact-chip-mini.conf-medium { border-left: 2px solid var(--amber); }
.fact-chip-mini.conf-low, .fact-chip-mini.conf-unknown { border-left: 2px solid var(--text-faint); }

.chip-tooltip {
  display: none; position: absolute; bottom: calc(100% + 4px); left: 0; z-index: 20;
  width: max-content; max-width: 340px; background: var(--panel-raised);
  border: 1px solid var(--amber-dim); box-shadow: 0 8px 24px rgba(0,0,0,0.6);
  padding: 9px 11px; font-family: var(--sans); font-size: 11.5px; color: var(--text);
  line-height: 1.5; white-space: normal;
}
.data-chip:hover .chip-tooltip { display: block; }
.chip-tooltip-meta { margin-top: 6px; font-family: var(--mono); font-size: 9.5px; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.02em; }

/* ── Formula/derivation tooltips on header stats & KPI tiles — a real
   rendered popover, not the native `title` attribute. The native tooltip
   only appears after a ~1s hover delay and is easy to read as "just a help
   cursor with nothing behind it" (a real complaint: "hover shows a ? cursor
   instead of showing the data"). Same .chip-tooltip visual, shown instantly
   via :hover on a `.has-tip` ancestor instead of waiting on the browser. ── */
.has-tip { position: relative; cursor: help; }
.has-tip:hover .chip-tooltip { display: block; }
.mstat-value.has-tip { display: inline-block; }
.mstat .chip-tooltip, .hero-metric .chip-tooltip { bottom: auto; top: calc(100% + 8px); left: 50%; transform: translateX(-50%); }

/* ── Shared chart primitives (charts.js) ── */
.barpair-row { display: grid; grid-template-columns: 140px 1fr 1fr; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.barpair-row:last-child { border-bottom: none; }
.barpair-label { font-size: 11px; color: var(--text-dim); font-family: var(--sans); }
.barpair-track { position: relative; height: 16px; background: var(--panel-alt); }
.barpair-bar { height: 100%; }
.barpair-bar.before { background: var(--red); opacity: 0.55; }
.barpair-bar.after { background: var(--green); }
.barpair-val { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); font-family: var(--mono); font-size: 9.5px; color: var(--text); font-variant-numeric: tabular-nums; }
.barpair-legend { font-size: 10px; color: var(--text-faint); margin-bottom: 8px; display: flex; align-items: center; }
.legend-swatch { display: inline-block; width: 9px; height: 9px; margin: 0 4px 0 10px; }
.legend-swatch:first-child { margin-left: 0; }
.legend-swatch.before { background: var(--red); opacity: 0.55; }
.legend-swatch.after { background: var(--green); }

.donut-wrap { display: flex; align-items: center; gap: 16px; }
.donut-center-text { font-family: var(--mono); font-size: 18px; font-weight: 700; fill: var(--text); }
.donut-legend { display: flex; flex-direction: column; gap: 5px; }
.donut-legend-row { display: flex; align-items: center; gap: 7px; font-size: 11px; }
.donut-swatch { width: 8px; height: 8px; flex-shrink: 0; }
.donut-legend-label { color: var(--text-dim); flex: 1; }
.donut-legend-val { font-family: var(--mono); color: var(--text); font-variant-numeric: tabular-nums; }

.sparkline-row { display: flex; align-items: center; gap: 10px; }
.sparkline-row .spark-label { font-size: 9.5px; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.04em; }

/* ── Envelopes view ── */
.envelopes-view { flex: 1; overflow-y: auto; padding: 18px 20px; }
.envelopes-head { margin-bottom: 16px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.envelopes-head h1 { font-family: var(--mono); font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--amber); margin-bottom: 5px; }
.envelopes-head p { font-family: var(--sans); font-size: 11.5px; color: var(--text-dim); max-width: 620px; line-height: 1.6; }
.envelopes-head-stats { font-family: var(--mono); font-size: 10px; color: var(--text-faint); margin-top: 8px; }
.envelope-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1px; background: var(--border); border: 1px solid var(--border); }
.envelope-card { background: var(--panel); padding: 12px 14px; }
.envelope-card-name { font-family: var(--sans); font-size: 12px; font-weight: 600; color: var(--text); margin-bottom: 7px; }
.envelope-card-keywords { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 8px; }
.envelope-kw { font-family: var(--mono); font-size: 9.5px; color: var(--amber); background: var(--amber-bg); border: 1px solid var(--amber-dim); padding: 1px 6px; }
.envelope-meta { font-size: 9.5px; color: var(--text-faint); line-height: 1.7; }
.envelope-empty { color: var(--text-faint); font-size: 11.5px; padding: 40px; text-align: center; font-family: var(--sans); }

/* ── Accounts view ── */
.acct-health { font-weight: 700; }
.acct-health.good { color: var(--green); }
.acct-health.warn { color: var(--amber); }
.acct-health.bad { color: var(--red); }
.acct-link-counts { display: flex; gap: 10px; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border); font-family: var(--mono); font-size: 9.5px; color: var(--text-faint); }
.acct-esc-open { color: var(--red); font-weight: 700; }
