:root {
  --bg: #0b0e14;
  --bg-panel: #10141d;
  --bg-card: #161b26;
  --border: #232a38;
  --text: #e6e9ef;
  --text-dim: #8a93a6;
  --accent: #5b9dff;
  --green: #34d399;
  --yellow: #fbbf24;
  --red: #f87171;
  --gray: #6b7280;

  /* ============================================================
     Evidence Observatory — Obsidian Bureau / Field Desk (Milestone 5D)
     Warm dark slate spectrum (#f4f6fa / #ffffff / #edf1f7 / #dce3ef),
     sober bullion/amber accents (#966b18 / #966b18), desaturated sage
     (#147d64 / #569e6b), subdued rust (#bc4052 / #c25454).
     Zero neon, zero retail hype badges, zero drop shadows.
     ============================================================ */
  --eo-bg: #f4f6fa;
  --eo-surface-1: #ffffff;
  --eo-surface-2: #edf1f7;
  --eo-surface-3: #282e37;
  --eo-border: #dce3ef;
  --eo-border-soft: #edf1f7;
  --eo-border-focus: #484f58;

  --eo-text: #23344d;
  --eo-text-dim: #64748b;
  --eo-text-faint: #64748b;

  /* Semantic accents — each meaning gets its OWN hue, never reused:
     health=sage, attention=amber/sand, limit=lavender-slate, integrity=teal,
     critical=brick/rust. Muted saturation throughout, never neon. */
  --eo-health: #147d64;
  --eo-health-bg: rgba(126, 199, 142, 0.12);
  --eo-attention: #966b18;
  --eo-attention-bg: rgba(212, 163, 115, 0.12);
  --eo-limit: #6954a1;
  --eo-limit-bg: rgba(156, 138, 209, 0.12);
  --eo-integrity: #3159d9;
  --eo-integrity-bg: rgba(107, 160, 181, 0.12);
  --eo-critical: #bc4052;
  --eo-critical-bg: rgba(224, 108, 117, 0.12);
  --eo-neutral: #64748b;
  --eo-neutral-bg: rgba(139, 148, 158, 0.12);

  --eo-font-editorial: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --eo-font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --eo-font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;

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

  --eo-radius-sm: 2px; --eo-radius-md: 4px; --eo-radius-lg: 6px;
  --eo-motion-fast: 120ms ease;
  --eo-motion-base: 200ms ease;
}

@media (prefers-reduced-motion: reduce) {
  :root { --eo-motion-fast: 0ms; --eo-motion-base: 0ms; }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 24px;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
}

.brand { display: flex; align-items: center; gap: 10px; }
.brand-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--gray); flex-shrink: 0; }
.brand-dot.healthy { background: var(--green); }
.brand-dot.degraded { background: var(--yellow); }
.brand-dot.attention { background: var(--red); }

.brand-name { font-weight: 700; font-size: 16px; }
.brand-sub { color: var(--text-dim); font-size: 12px; margin-left: 6px; }

.status-pill {
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.03em;
}


.table-wrap { overflow-x: auto; margin-bottom: 24px; }
table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
th, td {
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
th { color: var(--text-dim); font-weight: 600; font-size: 11px; text-transform: uppercase; background: var(--bg-panel); }
tr:last-child td { border-bottom: none; }

.pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}
.pill.HEALTHY, .pill.VALID, .pill.OK { background: rgba(52, 211, 153, 0.15); color: var(--green); }
.pill.DEGRADED, .pill.WARN { background: rgba(251, 191, 36, 0.15); color: var(--yellow); }
.pill.ATTENTION, .pill.CRITICAL, .pill.INVALID, .pill.FAIL { background: rgba(248, 113, 113, 0.15); color: var(--red); }
.pill.UNKNOWN { background: rgba(107, 114, 128, 0.2); color: var(--gray); }

.mono { font-family: var(--eo-font-mono); font-size: 12px; }

.state-msg {
  padding: 40px;
  text-align: center;
  color: var(--text-dim);
  font-size: 14px;
}
.state-msg.error { color: var(--red); }

.badge-readonly {
  display: inline-block;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(91, 157, 255, 0.15);
  color: var(--accent);
  margin-left: 8px;
  vertical-align: middle;
}

.calib-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 20px;
}
.calib-text {
  font-size: 15px;
  line-height: 1.6;
  padding: 16px;
  background: var(--bg-panel);
  border-radius: 6px;
  margin-bottom: 16px;
  border-left: 3px solid var(--accent);
}
.calib-meta {
  display: flex;
  gap: 16px;
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.calib-progress {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
  font-size: 13px;
}
.calib-progress-bar {
  flex: 1;
  height: 8px;
  background: var(--bg-panel);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.calib-progress-fill {
  height: 100%;
  background: var(--accent);
  transition: width 0.2s ease;
}
.calib-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
  margin-top: 16px;
}
.calib-btn {
  padding: 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-panel);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.calib-btn:hover { border-color: var(--accent); }
.calib-btn.positive:hover { border-color: var(--green); color: var(--green); }
.calib-btn.negative:hover { border-color: var(--red); color: var(--red); }
.calib-btn.neutral:hover { border-color: var(--gray); }
.calib-btn.unclear:hover { border-color: var(--yellow); color: var(--yellow); }
.calib-note {
  width: 100%;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 8px 10px;
  font-size: 13px;
  font-family: inherit;
  resize: vertical;
  min-height: 40px;
}

.footer {
  text-align: center;
  color: var(--text-dim);
  font-size: 12px;
  padding: 14px;
  border-top: 1px solid var(--border);
  background: var(--bg-panel);
}

/* ==================================================================
   Evidence Observatory — shell, nav, view toggle, area panels
   Obsidian Bureau Field Desk Layout
   ================================================================== */

.eo-app { background: var(--eo-bg); color: var(--eo-text); font-family: var(--eo-font-body); }

.eo-skip-link {
  position: absolute; left: -999px; top: 0; background: var(--eo-surface-3); color: var(--eo-text);
  padding: 10px 16px; border-radius: 0 0 var(--eo-radius-sm) 0; z-index: 100; font-size: 13px;
}
.eo-skip-link:focus { left: 0; }


/* Top bar */
.eo-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--eo-space-4); padding: var(--eo-space-3) var(--eo-space-5);
  background: var(--eo-surface-1); border-bottom: 1px solid var(--eo-border);
  flex-wrap: wrap;
}
.eo-brand { display: flex; align-items: center; gap: var(--eo-space-3); flex-wrap: wrap; }
.eo-brand-text { display: flex; flex-direction: column; gap: 2px; }
.eo-brand-title-row { display: flex; align-items: center; gap: var(--eo-space-2); }
.eo-brand-name { font-family: var(--eo-font-mono); font-size: 15px; font-weight: 700; letter-spacing: 0.08em; color: var(--eo-text); }
.eo-brand-sep { color: var(--eo-attention); font-weight: 700; }
.eo-brand-sub { font-family: var(--eo-font-mono); font-size: 12px; letter-spacing: 0.06em; color: var(--eo-text-dim); font-weight: 600; }
.eo-build-tag { font-family: var(--eo-font-mono); font-size: 10px; color: var(--eo-attention); background: var(--eo-attention-bg); padding: 1px 5px; border: 1px solid var(--eo-attention); border-radius: var(--eo-radius-sm); }
.eo-brand-venue-row { display: flex; align-items: center; gap: var(--eo-space-2); font-size: 11px; }
.eo-venue-tag { font-family: var(--eo-font-mono); font-size: 10.5px; color: var(--eo-text-dim); }

.eo-research-only-badge {
  font-family: var(--eo-font-mono); font-size: 10px; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--eo-attention); border: 1px solid var(--eo-attention); background: var(--eo-attention-bg);
  padding: 1px 6px; border-radius: var(--eo-radius-sm); white-space: nowrap;
}

.eo-header-right { display: flex; align-items: center; gap: var(--eo-space-3); flex-wrap: wrap; }

.eo-telemetry-pill {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--eo-surface-2); border: 1px solid var(--eo-border);
  padding: 4px 10px; border-radius: var(--eo-radius-sm); font-size: 11.5px;
}
.eo-telemetry-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--eo-health); }

/* Guided / Advanced segmented toggle */
.eo-view-toggle {
  display: inline-flex; background: var(--eo-surface-2); border: 1px solid var(--eo-border);
  border-radius: var(--eo-radius-sm); padding: 2px; gap: 2px;
}
.eo-view-toggle button {
  font-family: var(--eo-font-body); font-size: 12px; font-weight: 600; color: var(--eo-text-dim);
  background: transparent; border: none; border-radius: var(--eo-radius-sm);
  padding: 6px 12px; cursor: pointer; transition: background var(--eo-motion-fast), color var(--eo-motion-fast);
  min-height: 28px;
}
.eo-view-toggle button:hover { color: var(--eo-text); }
.eo-view-toggle button.active { background: var(--eo-surface-3); color: var(--eo-text); }
.eo-view-toggle button:focus-visible { outline: 2px solid var(--eo-integrity); outline-offset: 2px; }

.eo-status-pill {
  font-family: var(--eo-font-mono); font-size: 11px; font-weight: 600; letter-spacing: 0.03em;
  padding: 4px 10px; border-radius: var(--eo-radius-sm); border: 1px solid var(--eo-border); background: var(--eo-surface-2);
}
.eo-status-pill.health { color: var(--eo-health); border-color: var(--eo-health); background: var(--eo-health-bg); }
.eo-status-pill.attention { color: var(--eo-attention); border-color: var(--eo-attention); background: var(--eo-attention-bg); }
.eo-status-pill.critical { color: var(--eo-critical); border-color: var(--eo-critical); background: var(--eo-critical-bg); }
.eo-status-pill.neutral { color: var(--eo-neutral); border-color: var(--eo-neutral); background: var(--eo-neutral-bg); }

/* Navigation Bar */
.eo-nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 var(--eo-space-5); background: var(--eo-surface-1);
  border-bottom: 1px solid var(--eo-border); overflow-x: auto;
}
.eo-nav-tabs { display: flex; gap: var(--eo-space-1); }
.eo-nav-btn {
  font-family: var(--eo-font-body); font-size: 13px; font-weight: 600; color: var(--eo-text-dim);
  background: transparent; border: none; border-bottom: 2px solid transparent;
  padding: 10px 14px; cursor: pointer; white-space: nowrap; min-height: 42px;
  display: inline-flex; align-items: center; gap: 6px;
  transition: color var(--eo-motion-fast), border-color var(--eo-motion-fast);
}
.eo-nav-btn:hover { color: var(--eo-text); }
.eo-nav-btn.active { color: var(--eo-text); border-bottom-color: var(--eo-attention); }
.eo-nav-btn:focus-visible { outline: 2px solid var(--eo-integrity); outline-offset: -2px; }
.eo-nav-btn .eo-nav-idx { font-family: var(--eo-font-mono); font-size: 11px; color: var(--eo-attention); font-weight: 500; }
.eo-nav-btn .eo-nav-lock { font-family: var(--eo-font-mono); font-size: 9.5px; padding: 1px 4px; border-radius: var(--eo-radius-sm); background: var(--eo-critical-bg); color: var(--eo-critical); border: 1px solid var(--eo-critical); }
.eo-nav-discipline { font-family: var(--eo-font-mono); font-size: 10.5px; color: var(--eo-text-faint); white-space: nowrap; margin-left: auto; }

.eo-main { flex: 1; padding: var(--eo-space-5) var(--eo-space-5) var(--eo-space-7); max-width: 1360px; width: 100%; margin: 0 auto; }

.eo-area { display: none; }
.eo-area.active { display: block; animation: eo-fade-in var(--eo-motion-base); }
@keyframes eo-fade-in { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .eo-area.active { animation: none; } }

.eo-area-head { margin-bottom: var(--eo-space-5); }
.eo-area-tag { font-size: 10px; color: var(--eo-attention); letter-spacing: 0.08em; margin-bottom: var(--eo-space-1); }
.eo-area-title { font-family: var(--eo-font-editorial); font-size: 22px; font-weight: 600; margin: 0 0 var(--eo-space-1); letter-spacing: -0.01em; }
.eo-area-dek { color: var(--eo-text-dim); font-size: 13px; max-width: 720px; line-height: 1.5; margin: 0; }

.eo-depth { display: none; }
.eo-depth.active { display: block; }

/* ---------------- Pulse headline ---------------- */
.eo-pulse-headline {
  display: flex; align-items: center; gap: var(--eo-space-4); padding: var(--eo-space-4);
  background: var(--eo-surface-2); border: 1px solid var(--eo-border); border-radius: var(--eo-radius-md);
  margin-bottom: var(--eo-space-5); flex-wrap: wrap;
}
.eo-pulse-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--eo-neutral); flex-shrink: 0; }
.eo-pulse-dot.health { background: var(--eo-health); box-shadow: 0 0 0 3px var(--eo-health-bg); }
.eo-pulse-dot.attention { background: var(--eo-attention); box-shadow: 0 0 0 3px var(--eo-attention-bg); }
.eo-pulse-dot.critical { background: var(--eo-critical); box-shadow: 0 0 0 3px var(--eo-critical-bg); }
.eo-pulse-headline-text { font-family: var(--eo-font-editorial); font-size: 16px; font-weight: 600; }
.eo-pulse-headline-sub { color: var(--eo-text-dim); font-size: 12.5px; margin-top: 2px; }

/* ---------------- Evidence cards (guided) ---------------- */
.eo-card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: var(--eo-space-3); margin-bottom: var(--eo-space-4); }
.eo-evidence-card {
  background: var(--eo-surface-2); border: 1px solid var(--eo-border); border-radius: var(--eo-radius-sm);
  padding: var(--eo-space-4); border-left: 3px solid var(--eo-border);
}
.eo-evidence-card.health { border-left-color: var(--eo-health); }
.eo-evidence-card.attention { border-left-color: var(--eo-attention); }
.eo-evidence-card.limit { border-left-color: var(--eo-limit); }
.eo-evidence-card.integrity { border-left-color: var(--eo-integrity); }
.eo-evidence-card.critical { border-left-color: var(--eo-critical); }
.eo-evidence-card .eo-label { color: var(--eo-text-dim); font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: var(--eo-space-2); }
.eo-evidence-card .eo-value { font-size: 16px; font-weight: 600; overflow-wrap: anywhere; }
.eo-evidence-card .eo-value.mono { font-family: var(--eo-font-mono); font-size: 13.5px; }
.eo-evidence-card .eo-value.long-text { font-size: 12.5px; font-weight: 500; line-height: 1.4; }
.eo-evidence-card .eo-hint { color: var(--eo-text-faint); font-size: 11.5px; margin-top: var(--eo-space-2); line-height: 1.4; }

/* ---------------- Advanced metric tiles ---------------- */
.eo-metric-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: var(--eo-space-2); }
.eo-metric-tile {
  background: var(--eo-surface-2); border: 1px solid var(--eo-border); border-radius: var(--eo-radius-sm);
  padding: var(--eo-space-3) var(--eo-space-4);
}
.eo-metric-tile .eo-metric-label { color: var(--eo-text-dim); font-size: 10px; text-transform: uppercase; letter-spacing: 0.05em; }
.eo-metric-tile .eo-metric-value { font-family: var(--eo-font-mono); font-size: 18px; font-weight: 600; margin-top: 4px; overflow-wrap: anywhere; }

/* ---------------- Confusion matrix ---------------- */
.eo-matrix-wrap { overflow-x: auto; }
.eo-matrix { border-collapse: collapse; font-family: var(--eo-font-mono); font-size: 12px; }
.eo-matrix th, .eo-matrix td { padding: 7px 12px; border: 1px solid var(--eo-border-soft); text-align: center; }
.eo-matrix th { color: var(--eo-text-dim); font-weight: 600; background: var(--eo-surface-1); }
.eo-matrix td.eo-matrix-diag { background: var(--eo-health-bg); color: var(--eo-health); font-weight: 700; }
.eo-matrix td.eo-matrix-off { color: var(--eo-text-dim); }
.eo-matrix caption { caption-side: top; text-align: left; color: var(--eo-text-dim); font-family: var(--eo-font-body); font-size: 12px; margin-bottom: 6px; }

/* ---------------- Provenance thread ---------------- */
.eo-thread { display: flex; align-items: stretch; gap: 0; margin: var(--eo-space-3) 0; flex-wrap: wrap; }
.eo-thread-step {
  flex: 1 1 140px; min-width: 130px; position: relative; padding: var(--eo-space-3) var(--eo-space-3) var(--eo-space-3) var(--eo-space-4);
  background: var(--eo-surface-2); border: 1px solid var(--eo-border-soft);
}
.eo-thread-step:first-child { border-radius: var(--eo-radius-sm) 0 0 var(--eo-radius-sm); }
.eo-thread-step:last-child { border-radius: 0 var(--eo-radius-sm) var(--eo-radius-sm) 0; }
.eo-thread-step + .eo-thread-step { border-left: none; }
.eo-thread-step::before {
  content: ""; position: absolute; left: -1px; top: 50%; transform: translateY(-50%);
  width: 5px; height: 5px; border-radius: 50%; background: var(--eo-integrity);
}
.eo-thread-step:first-child::before { display: none; }
.eo-thread-label { font-size: 9.5px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--eo-text-faint); margin-bottom: 3px; }
.eo-thread-value { font-size: 12px; line-height: 1.35; }
.eo-thread-value.mono { font-family: var(--eo-font-mono); }
.eo-thread-step.conclusion { background: var(--eo-limit-bg); }
.eo-thread-step.conclusion .eo-thread-value { color: var(--eo-limit); font-weight: 600; }
@media (max-width: 640px) {
  .eo-thread { flex-direction: column; }
  .eo-thread-step, .eo-thread-step:first-child, .eo-thread-step:last-child { border-radius: var(--eo-radius-sm); border-left: 1px solid var(--eo-border-soft); }
  .eo-thread-step::before { left: 50%; top: -3px; transform: translateX(-50%); }
}

/* ---------------- Empty / loading / error states ---------------- */
.eo-state { text-align: center; padding: var(--eo-space-6) var(--eo-space-4); color: var(--eo-text-dim); }
.eo-state-icon { font-size: 24px; margin-bottom: var(--eo-space-2); opacity: 0.7; }
.eo-state-title { font-family: var(--eo-font-editorial); font-size: 15px; color: var(--eo-text); margin-bottom: var(--eo-space-2); font-weight: 600; }
.eo-state-body { font-size: 12.5px; max-width: 440px; margin: 0 auto; line-height: 1.5; }
.eo-state.eo-state-error .eo-state-title { color: var(--eo-critical); }
.eo-state.eo-state-attention .eo-state-title { color: var(--eo-attention); }

/* ---------------- Disclaimer / limit banner ---------------- */
.eo-limit-banner {
  display: flex; gap: var(--eo-space-3); align-items: flex-start; padding: var(--eo-space-3) var(--eo-space-4);
  background: var(--eo-limit-bg); border: 1px solid var(--eo-limit); border-radius: var(--eo-radius-sm);
  margin-bottom: var(--eo-space-4); color: var(--eo-text);
}
.eo-limit-banner .eo-limit-icon { color: var(--eo-limit); font-size: 16px; flex-shrink: 0; }
.eo-limit-banner .eo-limit-body { font-size: 12.5px; line-height: 1.5; }
.eo-limit-banner strong { color: var(--eo-limit); }

/* ---------------- Section / subsection scaffolding ---------------- */
.eo-section { margin-bottom: var(--eo-space-5); }
.eo-section-title { font-family: var(--eo-font-editorial); font-size: 14px; font-weight: 600; margin: 0 0 var(--eo-space-3); }
.eo-table-wrap { overflow-x: auto; }
.eo-table { width: 100%; border-collapse: collapse; background: var(--eo-surface-2); border: 1px solid var(--eo-border); border-radius: var(--eo-radius-sm); overflow: hidden; }
.eo-table th, .eo-table td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--eo-border-soft); font-size: 12px; }
.eo-table th { color: var(--eo-text-dim); font-weight: 600; font-size: 10px; text-transform: uppercase; letter-spacing: 0.04em; background: var(--eo-surface-1); }
.eo-table tr:last-child td { border-bottom: none; }
.eo-table td.mono { font-family: var(--eo-font-mono); font-size: 11.5px; }

.eo-pill { display: inline-block; padding: 2px 8px; border-radius: var(--eo-radius-sm); font-size: 10.5px; font-weight: 600; }
.eo-pill.health { background: var(--eo-health-bg); color: var(--eo-health); border: 1px solid var(--eo-health); }
.eo-pill.attention { background: var(--eo-attention-bg); color: var(--eo-attention); border: 1px solid var(--eo-attention); }
.eo-pill.limit { background: var(--eo-limit-bg); color: var(--eo-limit); border: 1px solid var(--eo-limit); }
.eo-pill.integrity { background: var(--eo-integrity-bg); color: var(--eo-integrity); border: 1px solid var(--eo-integrity); }
.eo-pill.critical { background: var(--eo-critical-bg); color: var(--eo-critical); border: 1px solid var(--eo-critical); }
.eo-pill.neutral { background: var(--eo-neutral-bg); color: var(--eo-neutral); border: 1px solid var(--eo-neutral); }

/* ---------------- Serenity Research Framework (Milestone 5D) ---------------- */
.eo-serenity-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  padding: var(--eo-space-4); background: var(--eo-surface-1);
  border: 1px solid var(--eo-border); border-bottom: none;
  border-radius: var(--eo-radius-sm) var(--eo-radius-sm) 0 0;
  flex-wrap: wrap; gap: var(--eo-space-3);
}
.eo-serenity-badge { font-size: 11px; color: var(--eo-attention); font-weight: 600; margin-bottom: 3px; }
.eo-serenity-title { font-family: var(--eo-font-editorial); font-size: 17px; font-weight: 600; margin: 0; color: var(--eo-text); }
.eo-serenity-status-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: var(--eo-radius-sm); font-size: 11px; font-weight: 600;
  background: var(--eo-attention-bg); border: 1px solid var(--eo-attention); color: var(--eo-attention);
}

.eo-serenity-grid {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 1px; background: var(--eo-border); border: 1px solid var(--eo-border);
  margin-bottom: var(--eo-space-4);
}
.eo-serenity-card {
  background: var(--eo-surface-2); padding: var(--eo-space-4);
  display: flex; flex-direction: column; justify-content: space-between;
  min-height: 150px;
}
.eo-serenity-card.step-invalidazione { background: var(--eo-surface-1); border: 1px solid var(--eo-critical); }
.eo-serenity-step-num { font-size: 10.5px; color: var(--eo-attention); font-weight: 700; letter-spacing: 0.05em; margin-bottom: 4px; }
.eo-serenity-step-num.critical { color: var(--eo-critical); }
.eo-serenity-step-title { font-size: 13.5px; font-weight: 600; color: var(--eo-text); margin-bottom: var(--eo-space-2); }
.eo-serenity-step-title.critical { color: var(--eo-critical); }
.eo-serenity-step-body { font-size: 12.5px; color: var(--eo-text-dim); line-height: 1.45; margin: 0 0 var(--eo-space-3); }
.eo-serenity-meta { font-size: 11px; color: var(--eo-text-faint); border-top: 1px solid var(--eo-border-soft); padding-top: var(--eo-space-2); }
.eo-serenity-meta.critical { color: var(--eo-critical); }

/* ---------------- Crypto Thesis Registry (Milestone 5E) ---------------- */
.eo-thesis-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--eo-space-3); margin-bottom: var(--eo-space-4); flex-wrap: wrap;
}
.eo-thesis-filters {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}
.eo-filter-pill {
  background: var(--eo-surface-2); border: 1px solid var(--eo-border);
  color: var(--eo-text-dim); padding: 4px 10px; border-radius: var(--eo-radius-sm);
  font-size: 11px; cursor: pointer; transition: all var(--eo-motion-fast);
}
.eo-filter-pill:hover {
  color: var(--eo-text); border-color: var(--eo-border-focus);
}
.eo-filter-pill.active {
  background: var(--eo-surface-3); border-color: var(--eo-attention);
  color: var(--eo-attention); font-weight: 600;
}

.eo-thesis-form-card, .eo-serenity-draft-card {
  background: var(--eo-surface-1); border: 1px solid var(--eo-border);
  border-radius: var(--eo-radius-sm); padding: var(--eo-space-4);
  margin-bottom: var(--eo-space-4);
}
.eo-thesis-form-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: var(--eo-space-3); flex-wrap: wrap; gap: var(--eo-space-2);
}
.eo-thesis-form-tag {
  font-size: 10.5px; color: var(--eo-attention); font-weight: 700;
}
.eo-thesis-form-title {
  font-family: var(--eo-font-editorial); font-size: 16px; font-weight: 600;
  color: var(--eo-text); margin: 2px 0 0;
}
.eo-thesis-form-intro {
  font-size: 12px; color: var(--eo-text-dim); margin-bottom: var(--eo-space-3);
  line-height: 1.45;
}
.eo-thesis-form {
  display: flex; flex-direction: column; gap: var(--eo-space-3);
}
.eo-form-group {
  display: flex; flex-direction: column; gap: 4px;
}
.eo-form-group label {
  font-size: 11px; font-weight: 600; color: var(--eo-text-dim);
}
.eo-form-group label.critical {
  color: var(--eo-critical);
}
.eo-form-group textarea,
.eo-form-group input,
.eo-form-group select {
  background: var(--eo-bg); border: 1px solid var(--eo-border);
  color: var(--eo-text); padding: 7px 10px; border-radius: var(--eo-radius-sm);
  font-size: 12px; font-family: var(--eo-font-body);
}
.eo-form-group textarea {
  resize: vertical; min-height: 52px; line-height: 1.4;
}
.eo-form-group textarea:focus,
.eo-form-group input:focus,
.eo-form-group select:focus {
  outline: none; border-color: var(--eo-attention);
}
.eo-form-label-row {
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 6px;
}
.eo-text-action-btn {
  background: none; border: none; color: var(--eo-attention);
  font-size: 11px; cursor: pointer; padding: 0; text-decoration: underline;
}
.eo-text-action-btn:hover {
  color: var(--eo-text);
}
.eo-evidence-input-grid {
  display: grid; grid-template-columns: 1.2fr 1fr 1.5fr 2fr; gap: 6px;
}
.eo-attached-context {
  font-size: 11px; color: var(--eo-integrity); background: var(--eo-integrity-bg);
  border: 1px solid var(--eo-integrity); padding: 5px 8px; border-radius: var(--eo-radius-sm);
  margin-top: 4px;
}
.eo-form-status-select {
  display: flex; align-items: center; gap: var(--eo-space-3);
}
.eo-form-feedback {
  padding: 8px 12px; border-radius: var(--eo-radius-sm); font-size: 11.5px;
}
.eo-form-feedback.error {
  background: var(--eo-critical-bg); border: 1px solid var(--eo-critical); color: var(--eo-critical);
}
.eo-form-feedback.success {
  background: var(--eo-health-bg); border: 1px solid var(--eo-health); color: var(--eo-health);
}

/* Theses List & Cards */
.eo-theses-list {
  display: flex; flex-direction: column; gap: var(--eo-space-3);
  margin-bottom: var(--eo-space-4);
}
.eo-thesis-card {
  background: var(--eo-surface-1); border: 1px solid var(--eo-border);
  border-radius: var(--eo-radius-sm); padding: var(--eo-space-4);
  transition: border-color var(--eo-motion-fast);
}
.eo-thesis-card:hover {
  border-color: var(--eo-border-focus);
}
.eo-thesis-card.status-monitoring {
  border-left: 3px solid var(--eo-health);
}
.eo-thesis-card.status-invalidated {
  border-left: 3px solid var(--eo-critical);
}
.eo-thesis-card.status-archived {
  opacity: 0.75; border-left: 3px solid var(--eo-neutral);
}
.eo-thesis-card-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: var(--eo-space-3); flex-wrap: wrap; gap: var(--eo-space-2);
}
.eo-thesis-card-id {
  font-size: 12px; font-weight: 700; color: var(--eo-attention);
  display: flex; align-items: center; gap: 8px;
}
.eo-thesis-card-meta {
  font-size: 11px; color: var(--eo-text-faint); display: flex; align-items: center; gap: 8px;
}
.eo-thesis-card-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: var(--eo-space-3);
  margin-bottom: var(--eo-space-3);
}
.eo-thesis-dim-box {
  background: var(--eo-surface-2); border: 1px solid var(--eo-border-soft);
  border-radius: var(--eo-radius-sm); padding: 8px 10px;
}
.eo-thesis-dim-label {
  font-size: 10px; font-weight: 700; color: var(--eo-text-dim); margin-bottom: 2px;
}
.eo-thesis-dim-val {
  font-size: 12px; color: var(--eo-text); line-height: 1.45;
}
.eo-thesis-dim-box.critical {
  border-color: var(--eo-critical); background: var(--eo-critical-bg);
}
.eo-thesis-dim-box.critical .eo-thesis-dim-label {
  color: var(--eo-critical);
}
.eo-thesis-card-evidence {
  background: var(--eo-surface-2); border: 1px solid var(--eo-border-soft);
  border-radius: var(--eo-radius-sm); padding: 8px 10px; margin-bottom: var(--eo-space-3);
  font-size: 11.5px;
}
.eo-thesis-card-actions {
  display: flex; align-items: center; gap: var(--eo-space-2);
  margin-top: var(--eo-space-2); border-top: 1px solid var(--eo-border-soft);
  padding-top: var(--eo-space-2); flex-wrap: wrap;
}
.eo-action-btn-sm {
  background: var(--eo-surface-2); border: 1px solid var(--eo-border);
  color: var(--eo-text); padding: 3px 8px; border-radius: var(--eo-radius-sm);
  font-size: 11px; cursor: pointer; transition: all var(--eo-motion-fast);
}
.eo-action-btn-sm:hover {
  border-color: var(--eo-attention); color: var(--eo-attention);
}
.eo-action-btn-sm.critical:hover {
  border-color: var(--eo-critical); color: var(--eo-critical);
}
.eo-action-btn-sm.health:hover {
  border-color: var(--eo-health); color: var(--eo-health);
}

/* Empty State */
.eo-thesis-empty-state {
  background: var(--eo-surface-1); border: 1px dashed var(--eo-border);
  border-radius: var(--eo-radius-sm); padding: var(--eo-space-6) var(--eo-space-4);
  text-align: center; margin-bottom: var(--eo-space-4);
}
.eo-thesis-empty-icon {
  font-size: 28px; color: var(--eo-text-faint); margin-bottom: var(--eo-space-2);
}
.eo-thesis-empty-title {
  font-family: var(--eo-font-editorial); font-size: 16px; font-weight: 600;
  color: var(--eo-text); margin-bottom: 4px;
}
.eo-thesis-empty-desc {
  font-size: 12px; color: var(--eo-text-dim); max-width: 520px;
  margin: 0 auto var(--eo-space-4); line-height: 1.5;
}

/* ---------------- Paper Lab Gating Callout (Milestone 5D) ---------------- */
.eo-paper-gate-callout {
  background: var(--eo-surface-1); border: 1px solid var(--eo-critical); border-radius: var(--eo-radius-sm);
  padding: var(--eo-space-4); margin-bottom: var(--eo-space-4);
}
.eo-paper-gate-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--eo-space-3); flex-wrap: wrap; gap: var(--eo-space-2); }
.eo-paper-gate-badge { font-size: 12px; font-weight: 700; color: var(--eo-critical); letter-spacing: 0.04em; }
.eo-paper-gate-body p { margin: 0 0 var(--eo-space-2); font-size: 12.5px; }
.eo-paper-gate-checklist { list-style: none; margin: 0 0 var(--eo-space-3); padding: 0; display: flex; flex-direction: column; gap: 4px; }
.eo-paper-gate-checklist li { font-size: 11.5px; padding: 4px 8px; border-radius: var(--eo-radius-sm); background: var(--eo-surface-2); border: 1px solid var(--eo-border-soft); }
.eo-paper-gate-checklist li.checked { color: var(--eo-health); border-color: var(--eo-health); background: var(--eo-health-bg); }
.eo-paper-gate-checklist li.missing { color: var(--eo-critical); border-color: var(--eo-critical); background: var(--eo-critical-bg); }
.eo-paper-gate-note { font-size: 12px; color: var(--eo-text-dim); line-height: 1.4; margin: 0; }

/* ---------------- Persistent Evidence Rail (Milestone 5D) ---------------- */
.eo-evidence-rail {
  position: sticky; bottom: 0; z-index: 50; width: 100%;
  display: flex; align-items: center; gap: var(--eo-space-4);
  padding: 8px var(--eo-space-5); background: var(--eo-surface-1);
  border-top: 1px solid var(--eo-border); overflow-x: auto; white-space: nowrap;
}
.eo-rail-cell { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; }
.eo-rail-label { color: var(--eo-text-dim); font-weight: 600; font-size: 10px; letter-spacing: 0.05em; }
.eo-rail-val { color: var(--eo-text); font-weight: 600; }
.eo-rail-val.health { color: var(--eo-health); }
.eo-rail-val.attention { color: var(--eo-attention); }
.eo-rail-val.critical { color: var(--eo-critical); }
.eo-rail-val.limit { color: var(--eo-limit); }
.eo-rail-grow { margin-left: auto; }

/* ---------------- Focus & touch targets ---------------- */
.eo-app button, .eo-app a { min-height: 30px; }
.eo-app *:focus-visible { outline: 2px solid var(--eo-integrity); outline-offset: 2px; }

@media (max-width: 960px) {
  .eo-serenity-grid { grid-template-columns: 1fr 1fr; }
  .eo-serenity-form { grid-template-columns: 1fr; }
  .eo-evidence-input-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 760px) {
  .eo-header { padding: var(--eo-space-3) var(--eo-space-4); }
  .eo-main { padding: var(--eo-space-4) var(--eo-space-3) var(--eo-space-7); }
  .eo-nav { padding: 0 var(--eo-space-3); }
  .eo-nav-btn { min-height: 44px; padding: var(--eo-space-3); font-size: 12.5px; }
  .eo-nav-discipline { display: none; }
  .eo-serenity-grid { grid-template-columns: 1fr; }
  .eo-card-grid, .eo-metric-grid { grid-template-columns: 1fr 1fr; }
  .eo-evidence-rail { padding: 6px var(--eo-space-3); font-size: 10.5px; }
  .eo-evidence-input-grid { grid-template-columns: 1fr; }
  .eo-thesis-card-grid { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .eo-card-grid, .eo-metric-grid { grid-template-columns: 1fr; }
  .eo-view-toggle button { padding: 6px 8px; font-size: 11.5px; }
}

/* ==================================================================
   Evidence Observatory — Milestone 5B additions (Operazioni / Mercati /
   Paper Trading / priority banner / anomaly safe-actions / local badge).
   All reuse existing --eo-* tokens — no new hues introduced, so the
   WCAG contrast pairs already verified for Milestone 5A stay valid.
   ================================================================== */

.eo-local-badge {
  font-family: var(--eo-font-mono); font-size: 10px; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--eo-integrity); border: 1px solid var(--eo-integrity); background: var(--eo-integrity-bg);
  padding: 1px 6px; border-radius: var(--eo-radius-sm); white-space: nowrap;
}

/* ---------------- Operational priority banner ---------------- */
.eo-priority-banner {
  display: flex; gap: var(--eo-space-3); align-items: flex-start; padding: var(--eo-space-3) var(--eo-space-4);
  border-radius: var(--eo-radius-sm); margin-bottom: var(--eo-space-4); border: 1px solid var(--eo-border);
}
.eo-priority-banner.health { background: var(--eo-health-bg); border-color: var(--eo-health); }
.eo-priority-banner.attention { background: var(--eo-attention-bg); border-color: var(--eo-attention); }
.eo-priority-banner.critical { background: var(--eo-critical-bg); border-color: var(--eo-critical); }
.eo-priority-banner.limit { background: var(--eo-limit-bg); border-color: var(--eo-limit); }
.eo-priority-label { font-family: var(--eo-font-mono); font-size: 10px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--eo-text-dim); margin-bottom: 4px; }
.eo-priority-text { font-size: 13.5px; line-height: 1.5; color: var(--eo-text); }

/* ---------------- Anomaly card safe actions + checklist ---------------- */
.eo-anomaly-actions { display: flex; gap: var(--eo-space-2); margin-top: var(--eo-space-3); flex-wrap: wrap; }
.eo-action-btn {
  font-family: var(--eo-font-body); font-size: 12px; font-weight: 600; color: var(--eo-text);
  background: var(--eo-surface-3); border: 1px solid var(--eo-border); border-radius: var(--eo-radius-sm);
  padding: 5px 10px; cursor: pointer; min-height: 30px;
}
.eo-action-btn:hover { border-color: var(--eo-integrity); }
.eo-action-btn:focus-visible { outline: 2px solid var(--eo-integrity); outline-offset: 2px; }
.eo-checklist { margin-top: var(--eo-space-3); font-size: 12px; color: var(--eo-text-dim); }
.eo-checklist summary { cursor: pointer; color: var(--eo-text); font-weight: 600; }
.eo-checklist summary:focus-visible { outline: 2px solid var(--eo-integrity); outline-offset: 2px; }
.eo-checklist ul { margin: var(--eo-space-2) 0 0; padding-left: 18px; line-height: 1.5; }

/* ---------------- Context list (Mercati — sentiment/events, never a signal) ---------------- */
.eo-context-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--eo-space-2); }
.eo-context-list li {
  background: var(--eo-surface-2); border: 1px solid var(--eo-border-soft); border-radius: var(--eo-radius-sm);
  padding: var(--eo-space-3); font-size: 12.5px; line-height: 1.4;
}

/* ---------------- Chart empty state (Mercati) ---------------- */
.eo-chart-placeholder {
  border: 1px dashed var(--eo-border); border-radius: var(--eo-radius-md); padding: var(--eo-space-6) var(--eo-space-4);
  text-align: center; background: var(--eo-surface-1); margin-bottom: var(--eo-space-4);
}
.eo-chart-placeholder-icon { font-size: 24px; color: var(--eo-text-faint); margin-bottom: var(--eo-space-2); }
.eo-chart-placeholder-title { font-family: var(--eo-font-editorial); font-size: 15px; color: var(--eo-text); margin-bottom: var(--eo-space-2); }
.eo-chart-placeholder-body { color: var(--eo-text-dim); font-size: 12.5px; max-width: 480px; margin: 0 auto; line-height: 1.5; }

.eo-timeframe-row { display: flex; gap: var(--eo-space-2); margin-bottom: var(--eo-space-2); flex-wrap: wrap; }
.eo-timeframe-row button {
  font-family: var(--eo-font-mono); font-size: 11.5px; padding: 5px 10px; border-radius: var(--eo-radius-sm);
  border: 1px solid var(--eo-border); background: var(--eo-surface-2); color: var(--eo-text-faint); cursor: not-allowed;
  min-height: 30px;
}

/* ---------------- Paper Trading lock banner (controls completely removed) ---------------- */
.eo-paper-lock-banner { background: var(--eo-surface-2); border: 1px solid var(--eo-border); border-radius: var(--eo-radius-sm); padding: var(--eo-space-4); margin-top: var(--eo-space-4); }
.eo-paper-lock-badge { font-family: var(--eo-font-mono); font-size: 11px; font-weight: 700; color: var(--eo-attention); letter-spacing: 0.05em; margin-bottom: var(--eo-space-2); }
.eo-paper-lock-note { color: var(--eo-text-dim); font-size: 12.5px; margin: 0; line-height: 1.5; }
.eo-paper-lock-note code { font-family: var(--eo-font-mono); font-size: 11px; }

/* ==================================================================
   Evidence Observatory — Milestone 5C additions (Kraken read-only
   candlestick chart). Reuses existing --eo-* tokens only; the candle
   rendering deliberately avoids a green/red up/down convention (see
   docs/EVIDENCE_OBSERVATORY_DESIGN_SYSTEM.md §2) — a single accent
   (--eo-integrity) is used for every candle, distinguished only by
   filled vs. hollow body, never by hue.
   ================================================================== */

.eo-chart-toolbar { display: flex; align-items: center; gap: var(--eo-space-3); flex-wrap: wrap; margin-bottom: var(--eo-space-3); }
.eo-chart-toolbar-group { display: inline-flex; gap: var(--eo-space-1); background: var(--eo-surface-2); border: 1px solid var(--eo-border); border-radius: var(--eo-radius-sm); padding: 2px; }
.eo-chart-toolbar-group button {
  font-family: var(--eo-font-mono); font-size: 11.5px; font-weight: 600; color: var(--eo-text-dim);
  background: transparent; border: none; border-radius: 2px; padding: 4px 10px; cursor: pointer;
  min-height: 26px;
}
.eo-chart-toolbar-group button:hover { color: var(--eo-text); }
.eo-chart-toolbar-group button.active { background: var(--eo-surface-3); color: var(--eo-text); }
.eo-chart-toolbar-group button:focus-visible { outline: 2px solid var(--eo-integrity); outline-offset: 2px; }

.eo-refresh-btn {
  font-family: var(--eo-font-body); font-size: 12px; font-weight: 700; color: var(--eo-text);
  background: var(--eo-surface-3); border: 1px solid var(--eo-integrity); border-radius: var(--eo-radius-sm);
  padding: 6px 14px; cursor: pointer; min-height: 30px;
}
.eo-refresh-btn:hover { background: var(--eo-integrity-bg); }
.eo-refresh-btn:disabled { cursor: not-allowed; opacity: 0.6; }
.eo-refresh-btn:focus-visible { outline: 2px solid var(--eo-integrity); outline-offset: 2px; }

.eo-chart-frame {
  background: var(--eo-surface-1); border: 1px solid var(--eo-border); border-radius: var(--eo-radius-sm);
  margin-bottom: var(--eo-space-4); min-height: 260px; height: 380px;
  width: 100%; box-sizing: border-box; display: block; overflow: hidden; position: relative;
}
.eo-chart-frame svg {
  width: 100%; min-width: 100%; height: 240px; min-height: 200px; max-height: 360px;
  display: block; box-sizing: border-box;
}
@media (min-width: 768px) {
  .eo-chart-frame { height: 420px; }
  .eo-chart-frame svg { height: 260px; }
}
.eo-chart-frame .eo-candle-wick { stroke: var(--eo-text-dim); stroke-width: 1; }
.eo-chart-frame .eo-candle-body-filled { fill: var(--eo-integrity); stroke: var(--eo-integrity); }
.eo-chart-frame .eo-candle-body-hollow { fill: var(--eo-surface-1); stroke: var(--eo-integrity); stroke-width: 1.5; }
.eo-chart-frame .eo-chart-axis-label { fill: var(--eo-text-faint); font-family: var(--eo-font-mono); font-size: 9.5px; }
.eo-chart-frame .eo-chart-gridline { stroke: var(--eo-border-soft); stroke-width: 1; }
.eo-chart-frame .eo-candle-incomplete { stroke-dasharray: 2,2; }

.eo-rsi-frame {
  background: var(--eo-surface-1); border: 1px solid var(--eo-border); border-top: 1px dashed var(--eo-border-soft);
  border-radius: var(--eo-radius-sm); height: 140px; min-height: 120px; width: 100%; box-sizing: border-box;
  margin-top: calc(-1 * var(--eo-space-4) + var(--eo-space-1)); margin-bottom: var(--eo-space-4);
  position: relative; overflow: hidden;
}

.eo-chart-attribution {
  font-size: 11px;
  color: var(--eo-text-faint);
  margin-top: calc(-1 * var(--eo-space-3));
  margin-bottom: var(--eo-space-3);
  text-align: right;
  line-height: 1.4;
}
.eo-chart-attribution a {
  color: var(--eo-text-dim);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.eo-chart-attribution a:hover {
  color: var(--eo-text);
}

.eo-chart-tooltip {
  position: relative; margin-bottom: var(--eo-space-2);
  pointer-events: none; background: var(--eo-surface-2);
  border: 1px solid var(--eo-border); border-radius: var(--eo-radius-sm);
  padding: 4px 10px; font-family: var(--eo-font-mono); font-size: 11px;
  line-height: 1.4; color: var(--eo-text);
  display: flex; gap: var(--eo-space-3); flex-wrap: wrap; align-items: center;
}
.eo-chart-tooltip .mkt-tt-item { display: inline-flex; gap: 4px; }
.eo-chart-tooltip .mkt-tt-label { color: var(--eo-text-dim); }
.eo-chart-tooltip .mkt-tt-val { color: var(--eo-text); font-weight: 600; }
.eo-chart-tooltip .mkt-tt-val.ema20 { color: var(--eo-attention); }
.eo-chart-tooltip .mkt-tt-val.ema50 { color: var(--eo-limit); }
.eo-chart-tooltip .mkt-tt-val.vwap { color: var(--eo-health); }
.eo-chart-tooltip .mkt-tt-val.rsi { color: var(--eo-integrity); }

.eo-chart-toggle-btn {
  font-family: var(--eo-font-mono); font-size: 11px; font-weight: 600; color: var(--eo-text-dim);
  background: transparent; border: none; border-radius: 2px; padding: 4px 8px; cursor: pointer;
  min-height: 26px; display: inline-flex; align-items: center; gap: 4px;
}
.eo-chart-toggle-btn:hover { color: var(--eo-text); }
.eo-chart-toggle-btn.active { background: var(--eo-surface-3); color: var(--eo-text); }
.eo-chart-toggle-btn.active[data-indicator="ema20"] { border-bottom: 2px solid var(--eo-attention); }
.eo-chart-toggle-btn.active[data-indicator="ema50"] { border-bottom: 2px solid var(--eo-limit); }
.eo-chart-toggle-btn.active[data-indicator="vwap"] { border-bottom: 2px solid var(--eo-health); }
.eo-chart-toggle-btn.active[data-indicator="rsi"] { border-bottom: 2px solid var(--eo-integrity); }
.eo-chart-toggle-btn .warmup-tag { font-size: 9px; color: var(--eo-attention); opacity: 0.85; }

.eo-chart-status-line { display: flex; align-items: center; gap: var(--eo-space-3); flex-wrap: wrap; margin-bottom: var(--eo-space-2); font-size: 12px; color: var(--eo-text-dim); }
.eo-chart-status-line .mono { font-family: var(--eo-font-mono); color: var(--eo-text); }

/* ==================================================================
   Evidence Observatory — Milestone 5H (Governed Paper Trading Simulator)
   Obsidian Bureau theme styling for simulator workspace, permanent
   safety banner, calculation preview, and cryptographic ledger.
   ================================================================== */

.eo-paper-sim-banner {
  display: flex;
  align-items: center;
  gap: var(--eo-space-3);
  background: var(--eo-surface-2);
  border: 1px solid var(--eo-attention);
  border-left: 4px solid var(--eo-attention);
  border-radius: var(--eo-radius-sm);
  padding: var(--eo-space-3) var(--eo-space-4);
  margin-bottom: var(--eo-space-4);
  flex-wrap: wrap;
}
.eo-paper-sim-badge {
  font-size: 11px;
  font-weight: 700;
  color: var(--eo-bg);
  background: var(--eo-attention);
  padding: 3px 8px;
  border-radius: 2px;
  letter-spacing: 0.05em;
  white-space: nowrap;
}
.eo-paper-sim-desc {
  font-size: 12px;
  color: var(--eo-text-dim);
  line-height: 1.4;
}

.eo-paper-kill-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--eo-surface-1);
  border: 1px solid var(--eo-border);
  border-radius: var(--eo-radius-sm);
  padding: var(--eo-space-3) var(--eo-space-4);
  margin-bottom: var(--eo-space-4);
  flex-wrap: wrap;
  gap: var(--eo-space-2);
}
.eo-paper-kill-banner.active-danger {
  border-color: var(--eo-critical);
  background: rgba(220, 38, 38, 0.08);
}
.eo-kill-status-wrap {
  display: flex;
  align-items: center;
  gap: var(--eo-space-2);
  flex-wrap: wrap;
}
.eo-dot-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--eo-health);
  display: inline-block;
}
.eo-dot-indicator.danger {
  background: var(--eo-critical);
}
.eo-kill-desc {
  font-size: 12px;
  color: var(--eo-text-dim);
}

.eo-paper-form {
  display: flex;
  flex-direction: column;
  gap: var(--eo-space-3);
}

.eo-form-grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--eo-space-3);
}

.eo-calc-preview-card {
  background: var(--eo-surface-2);
  border: 1px solid var(--eo-border);
  border-radius: var(--eo-radius-sm);
  padding: var(--eo-space-3);
  margin-top: var(--eo-space-2);
}
.eo-calc-title {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--eo-text-dim);
  letter-spacing: 0.04em;
  margin-bottom: var(--eo-space-2);
  border-bottom: 1px solid var(--eo-border-soft);
  padding-bottom: 4px;
}
.eo-calc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--eo-space-2) var(--eo-space-3);
}
.eo-calc-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.eo-calc-label {
  font-size: 10px;
  color: var(--eo-text-faint);
}
.eo-calc-val {
  font-size: 12px;
  color: var(--eo-text);
}
.eo-calc-item.highlight .eo-calc-val {
  color: var(--eo-attention);
  font-size: 13px;
}

.eo-risk-meter-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 6px;
}
.eo-risk-bar-track {
  height: 6px;
  width: 100%;
  background: var(--eo-surface-3);
  border-radius: 3px;
  overflow: hidden;
}
.eo-risk-bar-fill {
  height: 100%;
  background: var(--eo-integrity);
  transition: width 0.3s ease;
}
.eo-risk-bar-fill.warning {
  background: var(--eo-attention);
}
.eo-risk-bar-fill.danger {
  background: var(--eo-critical);
}

.eo-audit-report-box {
  background: var(--eo-surface-2);
  border: 1px solid var(--eo-border);
  border-radius: var(--eo-radius-sm);
  padding: var(--eo-space-3);
  font-size: 12px;
  line-height: 1.5;
}
.eo-audit-report-box.valid {
  border-left: 4px solid var(--eo-health);
}
.eo-audit-report-box.invalid {
  border-left: 4px solid var(--eo-critical);
}

/* Usability repair: clear tasks, readable text and a shared market workspace.
   Existing Obsidian palette retained; technical density belongs in Advanced. */
:root { --eo-text-dim: #b5beca; --eo-text-faint: #a2adbb; }
.eo-main { max-width: 1440px; }
.eo-area-title { font-size: clamp(25px, 3vw, 36px); line-height: 1.2; }
.eo-area-dek { font-size: 16px; max-width: 850px; line-height: 1.6; }
.eo-brand-sub { font-family: var(--eo-font-body); letter-spacing: 0; }
.eo-card-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr)); }
.eo-evidence-card { border-radius: 10px; padding: 20px; }
.eo-evidence-card .eo-label { font-size: 12px; text-transform: none; letter-spacing: 0; }
.eo-evidence-card .eo-hint, .eo-evidence-card .eo-value.long-text { font-size: 14px; line-height: 1.6; }
.eo-evidence-card .eo-value { font-size: 20px; line-height: 1.35; }
.eo-nav-btn, .eo-action-btn, .eo-refresh-btn, .eo-chart-toolbar button, .eo-view-toggle button { min-height: 44px; }
button:focus-visible, a:focus-visible, summary:focus-visible, [tabindex="-1"]:focus-visible { outline: 3px solid #3159d9; outline-offset: 3px; }
button { touch-action: manipulation; }
body[data-view-mode="guided"] .eo-area-tag,
body[data-view-mode="guided"] .eo-nav,
body[data-view-mode="guided"] .eo-nav-idx,
body[data-view-mode="guided"] .eo-nav-discipline,
body[data-view-mode="guided"] .eo-telemetry-pill,
body[data-view-mode="guided"] .eo-evidence-rail { display: none; }
.workspace-launcher { display: grid; grid-template-columns: 1.25fr 1fr 1fr; gap: 18px; margin: 28px 0; }
.workspace-start { color: var(--eo-text); text-align: left; background: var(--eo-surface-1); border: 1px solid #485462; border-radius: 14px; padding: 26px; cursor: pointer; display: flex; flex-direction: column; align-items: start; gap: 16px; font: inherit; }
.workspace-start.primary { background: #163e50; border-color: #3159d9; }
.workspace-start:hover { border-color: #b0dcef; }
.workspace-start strong { font-size: 25px; line-height: 1.25; }
.workspace-start > span:not(.workspace-kicker):not(.workspace-link) { color: #536580; font-size: 15px; line-height: 1.6; }
.workspace-kicker { display: block; color: #3159d9; font-size: 11px; font-weight: 700; letter-spacing: .09em; }
.workspace-link { margin-top: auto; padding-top: 12px; font-weight: 600; color: #3159d9; }
.workspace-model { border: 1px solid var(--eo-border); border-radius: 14px; padding: 24px; margin-bottom: 32px; }
.workspace-model h2, .workspace-section-heading { font-size: 21px; margin: 0 0 10px; }
.workspace-model p { color: var(--eo-text-dim); font-size: 15px; }
.workspace-model .eo-card-grid { margin-top: 20px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.workspace-help, .workspace-coverage { background: var(--eo-surface-1); border: 1px solid var(--eo-border); border-radius: 10px; padding: 16px 20px; margin-bottom: 18px; font-size: 15px; line-height: 1.6; }
.workspace-help summary, .workspace-coverage summary { cursor: pointer; min-height: 32px; font-weight: 600; }
.workspace-help-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0 28px; color: var(--eo-text-dim); }
.workspace-help-grid strong { color: var(--eo-text); }
.workspace-coverage { display: flex; justify-content: space-between; gap: 24px; align-items: start; }
.workspace-coverage details { max-width: 600px; }
.workspace-reading { display: grid; grid-template-columns: 1fr 1.5fr; gap: 28px; padding: 24px 0; color: var(--eo-text-dim); font-size: 14px; line-height: 1.5; }
.workspace-price { display: block; font-size: clamp(28px, 4vw, 42px); color: var(--eo-text); letter-spacing: -.03em; margin: 8px 0; font-variant-numeric: tabular-nums; }
.workspace-reading p { margin: 0 0 8px; }
.eo-chart-frame { height: 430px; }
.eo-chart-toolbar { gap: 12px; }
.eo-chart-tooltip { min-height: 44px; }
/* ---------------- Bot Governato — Vista Semplice ---------------- */
.bot-card {
  background: var(--eo-surface-1);
  border: 1px solid var(--eo-border);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 24px;
}
.bot-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 18px;
}
.bot-card-title {
  font-size: 20px;
  font-weight: 700;
  margin: 0;
  color: var(--eo-text);
  letter-spacing: -0.01em;
}
.bot-card-badge {
  display: inline-block;
  font-size: 11px;
  letter-spacing: 0.08em;
  padding: 4px 10px;
  border-radius: 6px;
  background: rgba(145, 207, 232, 0.12);
  color: #3159d9;
  border: 1px solid rgba(145, 207, 232, 0.25);
}
.bot-status-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 12px;
}
.bot-status-indicator {
  display: flex;
  align-items: center;
  gap: 12px;
}
.bot-status-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 10px rgba(0,0,0,0.5);
}
.bot-status-dot.health { background: #147d64; box-shadow: 0 0 10px rgba(126, 199, 142, 0.6); }
.bot-status-dot.attention { background: #966b18; box-shadow: 0 0 10px rgba(229, 192, 123, 0.6); }
.bot-status-dot.critical { background: #bc4052; box-shadow: 0 0 10px rgba(224, 108, 117, 0.6); }
.bot-status-dot.neutral { background: #7f8c98; }
.bot-status-text {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--eo-text);
}
.bot-status-pill {
  padding: 4px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
}
.bot-status-explanation {
  font-size: 16px;
  line-height: 1.6;
  color: var(--eo-text);
  margin: 0 0 20px;
}
.bot-activity-row {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid #3b4550;
  border-radius: 8px;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
}
.bot-activity-tag {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #3159d9;
  white-space: nowrap;
}
.bot-activity-desc {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  color: #536580;
}
.bot-portfolio-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}
.bot-metric-box {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--eo-border);
  border-radius: 8px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.bot-metric-label {
  font-size: 13px;
  color: var(--eo-text-dim);
  font-weight: 500;
}
.bot-metric-val {
  font-size: 24px;
  font-weight: 700;
  color: var(--eo-text);
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.bot-metric-val.profit { color: #147d64; }
.bot-metric-val.loss { color: #bc4052; }
.bot-metric-sub {
  font-size: 12px;
  color: var(--eo-text-faint);
}
.bot-unconfigured-box {
  background: rgba(22, 62, 80, 0.25);
  border: 1px dashed #3159d9;
  border-radius: 10px;
  padding: 24px;
  text-align: left;
}
.bot-unconfigured-msg {
  font-size: 15px;
  line-height: 1.6;
  color: #536580;
  margin: 0 0 18px;
}
.bot-cta-btn {
  min-height: 48px;
  padding: 14px 28px;
  font-size: 16px;
  font-weight: 700;
  border-radius: 8px;
  cursor: pointer;
}
.bot-inline-setup-form {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--eo-border);
}
.bot-price-row {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin: 6px 0;
}
.bot-price-display {
  font-size: 32px;
  font-weight: 800;
  color: var(--eo-text);
  letter-spacing: -0.03em;
}
.bot-price-change-display {
  font-size: 16px;
  font-weight: 700;
}
.bot-price-change-display.profit { color: #147d64; }
.bot-price-change-display.loss { color: #bc4052; }
.bot-feed-status {
  font-size: 13px;
  color: var(--eo-text-dim);
}
.bot-decision-body {
  font-size: 15px;
  line-height: 1.6;
}
.bot-decision-empty {
  color: var(--eo-text-dim);
  margin: 0;
}
.bot-decision-summary {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 8px;
}
.bot-decision-action-pill {
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
}
.bot-decision-action-pill.buy { background: rgba(126, 199, 142, 0.2); color: #147d64; border: 1px solid rgba(126, 199, 142, 0.4); }
.bot-decision-action-pill.sell { background: rgba(224, 108, 117, 0.2); color: #bc4052; border: 1px solid rgba(224, 108, 117, 0.4); }
.bot-decision-action-pill.setup { background: rgba(145, 207, 232, 0.2); color: #3159d9; border: 1px solid rgba(145, 207, 232, 0.4); }
.bot-decision-details {
  font-size: 15px;
  font-weight: 600;
  color: var(--eo-text);
}
.bot-decision-time {
  font-size: 13px;
  color: var(--eo-text-dim);
  margin-left: auto;
}
.bot-decision-reason {
  margin: 4px 0 0;
  font-size: 14px;
  color: #536580;
}
.bot-actions-section {
  margin-top: 32px;
  margin-bottom: 32px;
}
.bot-actions-heading {
  font-size: 18px;
  font-weight: 700;
  color: var(--eo-text);
  margin: 0 0 14px;
  letter-spacing: -0.01em;
}
.bot-actions-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.bot-actions-grid.single-cta {
  grid-template-columns: 1fr;
  max-width: 640px;
}
.bot-safety-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin: 16px 0 12px;
}
.bot-safety-box {
  background: var(--eo-surface-2);
  border: 1px solid var(--eo-border);
  border-radius: 8px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.bot-safety-label {
  font-family: var(--eo-font-mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  color: var(--eo-text-dim);
  text-transform: uppercase;
}
.bot-safety-val {
  font-family: var(--eo-font-mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--eo-text);
}
.bot-safety-sub {
  font-size: 11px;
  color: var(--eo-text-faint);
}
.bot-action-btn {
  background: var(--eo-surface-1);
  border: 1px solid #485462;
  border-radius: 12px;
  padding: 22px 20px;
  text-align: left;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  color: var(--eo-text);
  min-height: 110px;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.bot-action-btn:hover:not(:disabled) {
  border-color: #b0dcef;
  background: var(--eo-surface-2);
}
.bot-action-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.bot-action-btn.primary {
  background: #163e50;
  border-color: #3159d9;
}
.bot-action-btn.primary:hover:not(:disabled) {
  background: #1c4b60;
  border-color: #3159d9;
}
.bot-action-kicker {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #3159d9;
}
.bot-action-btn strong {
  font-size: 18px;
  line-height: 1.3;
}
.bot-action-btn span:not(.bot-action-kicker) {
  font-size: 13px;
  line-height: 1.4;
  color: #536580;
}
@media (max-width: 760px) {
  .workspace-launcher, .workspace-reading, .workspace-help-grid { grid-template-columns: 1fr; }
  .workspace-start { padding: 20px; gap: 10px; }
  .workspace-model { padding: 16px; }
  .workspace-model .eo-card-grid { grid-template-columns: 1fr; }
  .workspace-coverage { flex-direction: column; gap: 8px; }
  .eo-brand-title-row { flex-wrap: wrap; }
  .eo-header, .eo-main { padding-left: 16px; padding-right: 16px; }
  .eo-nav { padding: 0 12px; }
  .eo-chart-frame { height: 330px; }
  .workspace-reading { gap: 16px; }
  .bot-portfolio-grid { grid-template-columns: repeat(2, 1fr); }
  .bot-actions-grid { grid-template-columns: 1fr; }
  .bot-safety-grid { grid-template-columns: 1fr; }
  .bot-activity-row { flex-direction: column; align-items: flex-start; gap: 6px; }
  .bot-status-header { flex-direction: column; align-items: flex-start; gap: 8px; }
  .bot-decision-summary { flex-direction: column; align-items: flex-start; gap: 6px; }
  .bot-decision-time { margin-left: 0; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; } }

/* ==========================================================================
   Milestone 5J / EXP-047: Bot Brain v0 & Technique Library (Obsidian Bureau)
   ========================================================================== */

/* Mission Control: Strategy Banner & Status */
.bot-strategy-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: #f4f6fa;
  border-left: 3px solid #966b18;
  border-top: 1px solid #edf1f7;
  border-right: 1px solid #edf1f7;
  border-bottom: 1px solid #edf1f7;
  margin-top: 12px;
}
.bot-strategy-tag {
  font-size: 11px;
  font-weight: 700;
  color: #966b18;
  letter-spacing: 0.05em;
  white-space: nowrap;
}
.bot-strategy-desc {
  font-size: 12px;
  color: #23344d;
  margin: 0;
  line-height: 1.4;
}

/* Bot Brain Subtabs Navigation */
.brain-tabs-nav {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid #dce3ef;
  margin-bottom: 20px;
  overflow-x: auto;
  padding-bottom: 4px;
}
.brain-tab-btn {
  background: transparent;
  border: 1px solid transparent;
  color: #64748b;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 10px 16px;
  cursor: pointer;
  border-radius: 0;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.brain-tab-btn:hover {
  color: #23344d;
  background: #ffffff;
}
.brain-tab-btn.active {
  color: #966b18;
  background: #ffffff;
  border-color: #dce3ef;
  border-bottom-color: #966b18;
}

/* Brain Control Bar */
.brain-control-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  padding: 14px 20px;
  background: #ffffff;
  border: 1px solid #dce3ef;
  margin-bottom: 20px;
}
.brain-status-cluster {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.brain-status-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
}
.brain-ctrl-state {
  font-size: 13px;
  font-weight: 700;
  color: #23344d;
  letter-spacing: 0.04em;
}
.brain-risk-pill {
  font-size: 11px;
  padding: 3px 8px;
  border: 1px solid currentColor;
  border-radius: 0;
}
.brain-time-pill {
  font-size: 12px;
  color: #64748b;
}
.brain-actions-cluster {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Visual 6-Stage Pipeline Diagram */
.brain-pipeline-card {
  background: #ffffff;
  border: 1px solid #dce3ef;
  padding: 20px;
  margin-bottom: 24px;
}
.brain-pipeline-header {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 16px;
}
.brain-kicker {
  font-size: 11px;
  font-weight: 700;
  color: #966b18;
  letter-spacing: 0.06em;
}
.brain-pipeline-sub {
  font-size: 12px;
  color: #64748b;
}
.brain-pipeline-steps {
  display: flex;
  align-items: stretch;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 8px;
}
.brain-step-box {
  flex: 1;
  min-width: 140px;
  background: #f4f6fa;
  border: 1px solid #edf1f7;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  border-radius: 0;
}
.brain-step-box.active-step {
  border-color: #966b18;
  background: #151a22;
}
.brain-step-num {
  font-size: 11px;
  font-weight: 700;
  color: #966b18;
}
.brain-step-name {
  font-size: 13px;
  font-weight: 700;
  color: #23344d;
  line-height: 1.3;
}
.brain-step-desc {
  font-size: 11px;
  color: #64748b;
  line-height: 1.4;
  flex-grow: 1;
}
.brain-step-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  align-self: flex-start;
  border-radius: 0;
  letter-spacing: 0.04em;
}
.brain-step-badge.pass {
  background: rgba(63, 185, 80, 0.15);
  color: #147d64;
  border: 1px solid #147d64;
}
.brain-step-badge.neutral {
  background: rgba(139, 148, 158, 0.15);
  color: #64748b;
  border: 1px solid #64748b;
}
.brain-step-badge.safe {
  background: rgba(212, 163, 115, 0.15);
  color: #966b18;
  border: 1px solid #966b18;
}
.brain-step-badge.fail {
  background: rgba(248, 81, 73, 0.15);
  color: #bc4052;
  border: 1px solid #bc4052;
}
.brain-step-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #484f58;
  font-size: 18px;
  user-select: none;
}

/* Decisions Feed */
.brain-feed-section {
  margin-top: 24px;
}
.brain-feed-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 14px;
}
.brain-feed-title {
  font-size: 16px;
  font-weight: 700;
  color: #23344d;
  margin: 0;
}
.brain-feed-sub {
  font-size: 12px;
  color: #64748b;
}
.brain-decisions-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.brain-decision-item {
  background: #ffffff;
  border: 1px solid #dce3ef;
  padding: 16px 20px;
  border-radius: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.brain-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  border-bottom: 1px solid #edf1f7;
  padding-bottom: 10px;
}
.brain-item-id-group {
  display: flex;
  align-items: center;
  gap: 10px;
}
.brain-item-cycle {
  font-size: 12px;
  font-weight: 700;
  color: #966b18;
}
.brain-item-id {
  font-size: 12px;
  color: #64748b;
}
.brain-item-time {
  font-size: 12px;
  color: #64748b;
}
.brain-item-action-group {
  display: flex;
  align-items: center;
  gap: 8px;
}
.brain-action-tag {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  letter-spacing: 0.04em;
  border-radius: 0;
}
.brain-action-tag.no_action {
  background: rgba(212, 163, 115, 0.15);
  color: #966b18;
  border: 1px solid #966b18;
}
.brain-action-tag.blocked {
  background: rgba(248, 81, 73, 0.15);
  color: #bc4052;
  border: 1px solid #bc4052;
}
.brain-item-rationale {
  font-size: 14px;
  line-height: 1.5;
  color: #23344d;
  background: #f4f6fa;
  padding: 12px 14px;
  border-left: 3px solid #966b18;
  margin: 0;
}
.brain-tools-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.brain-tool-chip {
  font-size: 11px;
  padding: 2px 7px;
  background: #edf1f7;
  color: #64748b;
  border: 1px solid #dce3ef;
  border-radius: 0;
}
.brain-tool-chip.active {
  color: #147d64;
  border-color: rgba(63, 185, 80, 0.4);
}
.brain-item-conditions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
}
.brain-cond-row {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #23344d;
}
.brain-cond-tag {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 0;
}
.brain-cond-tag.pass {
  background: rgba(63, 185, 80, 0.2);
  color: #147d64;
}
.brain-cond-tag.fail {
  background: rgba(248, 81, 73, 0.2);
  color: #bc4052;
}
.brain-item-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid #edf1f7;
  padding-top: 10px;
}

/* Technique Library Styles */
.tech-subnav {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--eo-border);
  padding-bottom: 8px;
}
.tech-subnav-btn {
  background: none;
  border: 1px solid transparent;
  color: var(--eo-text-dim);
  font-family: var(--eo-font-mono);
  font-size: 13px;
  cursor: pointer;
  padding: 6px 14px;
  border-radius: 4px;
  transition: all 0.15s ease;
}
.tech-subnav-btn:hover {
  color: var(--eo-text);
  border-color: var(--eo-border);
}
.tech-subnav-btn.active {
  color: var(--eo-text);
  background: var(--eo-surface-2);
  border-color: var(--eo-border-hi);
  font-weight: 600;
}
.tech-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 24px;
}
.tech-filters-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex-grow: 1;
  max-width: 800px;
}
.tech-search-input {
  max-width: 460px;
  background: #ffffff;
  border-color: #dce3ef;
}
.tech-status-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.tech-filter-chip {
  background: #ffffff;
  border: 1px solid #dce3ef;
  color: #64748b;
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  padding: 5px 10px;
  cursor: pointer;
  border-radius: 0;
  transition: all 0.15s;
}
.tech-filter-chip:hover {
  color: #23344d;
  border-color: #3159d9;
}
.tech-filter-chip.active {
  background: #edf1f7;
  color: #966b18;
  border-color: #966b18;
}
.tech-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(420px, 1fr));
  gap: 20px;
}
.tech-card {
  background: #ffffff;
  border: 1px solid #dce3ef;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  border-radius: 0;
}
.tech-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}
.tech-card-title {
  font-size: 16px;
  font-weight: 700;
  color: #23344d;
  margin: 0;
  line-height: 1.3;
}
.tech-card-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border: 1px solid currentColor;
  border-radius: 0;
  letter-spacing: 0.05em;
  white-space: nowrap;
}
.tech-card-badge.status-FORMALIZED { color: #966b18; border-color: #966b18; }
.tech-card-badge.status-DOCUMENTED { color: #3159d9; border-color: #3159d9; }
.tech-card-badge.status-DRAFT { color: #64748b; border-color: #64748b; }
.tech-card-badge.status-TESTING { color: #966b18; border-color: #966b18; }
.tech-card-badge.status-VALIDATED { color: #147d64; border-color: #147d64; background: rgba(63, 185, 80, 0.1); }
.tech-card-badge.status-REJECTED { color: #bc4052; border-color: #bc4052; }
.tech-card-badge.status-ARCHIVED { color: #484f58; border-color: #484f58; }
.tech-card-badge.status-bozza { color: #64748b; border-color: #64748b; }
.tech-card-badge.status-in_revisione { color: #966b18; border-color: #966b18; }
.tech-card-badge.status-pronta_per_implementazione { color: #147d64; border-color: #147d64; background: rgba(63, 185, 80, 0.1); }
.tech-card-badge.status-respinta { color: #bc4052; border-color: #bc4052; }

.tech-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 12px;
  color: #64748b;
}
.tech-card-summary {
  font-size: 13px;
  color: #23344d;
  line-height: 1.5;
  background: #f4f6fa;
  padding: 10px 12px;
  border-left: 2px solid #dce3ef;
  margin: 0;
}
.tech-card-section {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.tech-sec-label {
  font-size: 11px;
  font-weight: 700;
  color: #966b18;
  letter-spacing: 0.04em;
}
.tech-sec-val {
  font-size: 12px;
  color: #64748b;
  line-height: 1.4;
}
.tech-card-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid #edf1f7;
}

/* Modals */
.brain-modal-backdrop {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 16px;
}
.brain-modal {
  background: #ffffff;
  border: 1px solid #dce3ef;
  width: 100%;
  max-width: 640px;
  max-height: 90vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  border-radius: 0;
}
.brain-modal.large {
  max-width: 860px;
}
.brain-modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid #dce3ef;
}
.brain-modal-title {
  font-size: 16px;
  font-weight: 700;
  color: #23344d;
  margin: 0;
}
.brain-modal-close {
  background: transparent;
  border: none;
  color: #64748b;
  font-size: 18px;
  cursor: pointer;
  padding: 4px;
}
.brain-modal-close:hover {
  color: #23344d;
}
.brain-modal-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.brain-modal-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
}

/* Tools Catalog Grid */
.tools-catalog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 16px;
  margin-top: 16px;
}
.tool-catalog-card {
  background: #ffffff;
  border: 1px solid #dce3ef;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-radius: 0;
}
.tool-catalog-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.tool-catalog-name {
  font-size: 14px;
  font-weight: 700;
  color: #23344d;
}
.tool-catalog-tag {
  font-size: 10px;
  padding: 2px 6px;
  background: rgba(63, 185, 80, 0.15);
  color: #147d64;
  border: 1px solid #147d64;
}
.tool-catalog-desc {
  font-size: 12px;
  color: #64748b;
  line-height: 1.4;
}
.tool-catalog-limits {
  font-size: 11px;
  color: #966b18;
  background: #f4f6fa;
  padding: 8px 10px;
  border-left: 2px solid #966b18;
}

/* Memory layout */
.memory-layout {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 24px;
}

@media (max-width: 900px) {
  .memory-layout { grid-template-columns: 1fr; }
  .tech-cards-grid { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .brain-control-bar { flex-direction: column; align-items: flex-start; }
  .brain-pipeline-steps { flex-direction: column; }
  .brain-step-arrow { transform: rotate(90deg); margin: 4px 0; }
  .tools-catalog-grid { grid-template-columns: 1fr; }
  .tech-toolbar { flex-direction: column; align-items: stretch; }
  .tech-search-input { max-width: 100%; }
}

/* -------------------------------------------------------------
   MANDATE STEPPER & AUTONOMOUS JOURNEY (EXP-056)
   ------------------------------------------------------------- */
.mandate-stepper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding: 12px 16px;
  background: var(--eo-surface-2);
  border: 1px solid var(--eo-border);
  border-radius: 8px;
}

.mandate-step-item {
  display: flex;
  align-items: center;
  gap: 8px;
  opacity: 0.5;
  transition: opacity 0.2s ease;
}

.mandate-step-item.active {
  opacity: 1;
}

.mandate-step-item.completed {
  opacity: 0.85;
}

.mandate-step-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--eo-surface-3, rgba(255, 255, 255, 0.1));
  color: var(--eo-text);
  font-family: var(--eo-font-mono);
  font-size: 11px;
  font-weight: 700;
}

.mandate-step-item.active .mandate-step-badge {
  background: var(--eo-primary, #38bdf8);
  color: #0f172a;
}

.mandate-step-item.completed .mandate-step-badge {
  background: var(--eo-health, #4ade80);
  color: #0f172a;
}

.mandate-step-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--eo-text);
}

.mandate-step-divider {
  flex: 1;
  height: 1px;
  background: var(--eo-border);
  margin: 0 12px;
}

.mandate-summary-box {
  background: var(--eo-surface-2);
  border: 1px solid var(--eo-border);
  border-radius: 8px;
  padding: 16px;
}

@media (max-width: 760px) {
  .mandate-stepper {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  .mandate-step-divider {
    display: none;
  }
}



/* Control chat follows the existing field-desk palette and type system. */
.control-chat { max-width: 760px; margin: 0 auto; padding: 20px; background: var(--eo-surface-1); border: 1px solid var(--eo-border); color: var(--eo-text); }
.control-chat p { line-height: 1.6; overflow-wrap: anywhere; }
.control-chat-shortcuts { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0; }
.control-chat button { min-height: 44px; padding: 10px 14px; background: var(--eo-surface-2); border: 1px solid var(--eo-border); color: var(--eo-text); cursor: pointer; font: inherit; }
.control-chat button:disabled { opacity: .6; cursor: wait; }
.control-chat button:focus-visible, .control-chat textarea:focus-visible { outline: 2px solid var(--eo-attention); outline-offset: 3px; }
#control-chat-messages { max-height: none; overflow: visible; padding: 0; margin: 0; }
.control-chat-user, .control-chat-bot { border-left: 0; padding-left: 0; }
.control-chat textarea { display: block; width: 100%; box-sizing: border-box; padding: 12px; margin-top: 8px; resize: vertical; background: var(--eo-bg); color: var(--eo-text); border: 1px solid var(--eo-border); font: inherit; }
#control-chat-confirmation { margin-top: 16px; padding: 12px; border: 1px solid var(--eo-attention); }
#control-chat-confirmation[hidden] { display: none; }
@media (max-width: 480px) { .control-chat { padding: 12px; } }

/* Keep virtual portfolio metrics within narrow screens. */
.bot-portfolio-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.bot-metric-box { min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 760px) {
  .bot-portfolio-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bot-metric-val { font-size: clamp(17px, 5vw, 24px); }
}
