/* =========================================================
   SHWAINTD — PLOTTER CSS (DARK UI)
   ========================================================= */

:root {
  --bg: #1b1f26;
  --panel: #252b34;
  --panel-2: #202630;
  --border: #47515e;
  --text: #f0f3f7;
  --muted: #aeb8c5;

  --primary: #4db8ff;
  --primary-2: #2d8dce;

  --success: #22c55e;
  --warn: #f59e0b;
  --danger: #ef4444;

  --shadow: 0 18px 42px rgba(6, 10, 18, 0.32);

  --radius: 18px;
  --radius-sm: 12px;

  --font: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { box-sizing: border-box; }

html, body {
  min-height: 100%;
  margin: 0;
  background: radial-gradient(1200px 700px at 55% 20%, rgba(43, 188, 255, 0.15), transparent 55%),
              radial-gradient(900px 600px at 30% 70%, rgba(0, 255, 136, 0.06), transparent 60%),
              var(--bg);
  color: var(--text);
  font-family: var(--font);
}

/* ==================== TOPBAR ========================== */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(to bottom, rgba(0,0,0,0.35), transparent);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-icon {
  color: var(--primary);
  font-weight: 700;
}

.brand-title {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.2px;
}

/* ==================== LAYOUT ========================== */
.layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 18px;
  padding: 18px 18px 12px;
  max-width: 1400px;
  margin: 0 auto;
}

@media (max-width: 1024px) {
  .layout {
    grid-template-columns: 1fr;
  }
}

/* ==================== CARD ============================ */
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}

.controls-card {
  height: fit-content;
}

.chart-card {
  padding: 0;
  overflow: hidden;
}

.plot-workbench {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  align-items: stretch;
  min-height: calc(100vh - 190px);
}

.plot-shell {
  position: relative;
  min-width: 0;
  border-right: 1px solid var(--border);
}

/* ==================== HEADERS ========================= */
.card h2 {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0 0 10px;
}

.card h3 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  margin: 8px 0 2px;
}

/* ==================== CONTROLS ========================== */
.plot-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.plot-controls.single {
  grid-template-columns: 1fr;
}

.plot-field label {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
  margin: 0 0 6px;
}

.plot-field input {
  width: 100%;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 10px;
  outline: none;
}

.plot-field input:focus {
  border-color: rgba(43, 188, 255, 0.6);
  box-shadow: 0 0 0 3px rgba(43, 188, 255, 0.15);
}

.plot-field input[type="checkbox"] {
  accent-color: var(--primary);
  margin-right: 6px;
}

.status-text {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 4px;
}

.controls-help {
  line-height: 1.45;
  margin-top: 8px;
}

/* ==================== TIME ADJUST ==================== */

.plot-field--span2 {
  grid-column: span 2;
}

.time-adjust {
  display: flex;
  justify-content: center;
  gap: 12px;
}

.time-adjust .btn {
  width: 48px;
  height: 40px;
  font-size: 1.1rem;
}

/* ==================== BUTTONS =========================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.06);
  color: var(--text);
  cursor: pointer;
  font-weight: 600;
  text-decoration: none;
  transition: transform 0.08s ease, background 0.12s ease, border-color 0.12s ease;
}

.btn:hover {
  transform: translateY(-1px);
  background: rgba(255,255,255,0.09);
  border-color: rgba(255,255,255,0.14);
}

.btn:active {
  transform: translateY(0px);
}

.btn-primary {
  background: linear-gradient(180deg, rgba(43, 188, 255, 0.95), rgba(20, 145, 209, 0.95));
  border-color: rgba(43, 188, 255, 0.5);
  color: #041018;
}

.btn-primary:hover {
  border-color: rgba(43, 188, 255, 0.7);
}

.btn-ghost {
  background: rgba(255,255,255,0.05);
}

/* ======================= CHART ========================== */
.plot-container {
  width: 100%;
  height: calc(100vh - 190px);
  min-height: 520px;
  background: linear-gradient(to bottom, rgba(0,0,0,0.12), rgba(0,0,0,0.22));
  position: relative;
}

.plot-log-panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: calc(100vh - 190px);
  min-height: 520px;
  background:
    linear-gradient(180deg, rgba(8, 12, 18, 0.82), rgba(9, 13, 20, 0.94)),
    radial-gradient(500px 240px at 25% 0%, rgba(43, 188, 255, 0.08), transparent 70%);
}

.log-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 18px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.log-panel-title {
  font-size: 0.95rem;
  font-weight: 700;
}

.log-panel-subtitle {
  margin-top: 4px;
  font-size: 0.76rem;
  line-height: 1.45;
  color: var(--muted);
}

.log-panel-actions {
  flex-shrink: 0;
}

.log-panel-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.log-tabs {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.log-tab {
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.05);
  color: var(--text);
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 0.78rem;
  font-weight: 650;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease, transform 0.08s ease;
}

.log-tab:hover {
  transform: translateY(-1px);
  background: rgba(255,255,255,0.08);
}

.log-tab.is-active {
  background: linear-gradient(180deg, rgba(43, 188, 255, 0.22), rgba(20, 145, 209, 0.18));
  border-color: rgba(43, 188, 255, 0.42);
}

.log-autoscroll {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.76rem;
  color: var(--muted);
  user-select: none;
}

.log-autoscroll input {
  accent-color: var(--primary);
}

.log-panel-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 14px 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.log-panel-empty {
  margin: auto 0;
  padding: 18px 14px;
  border: 1px dashed rgba(255,255,255,0.08);
  border-radius: 14px;
  background: rgba(255,255,255,0.025);
  text-align: center;
}

.log-panel-empty-title {
  font-weight: 700;
  margin-bottom: 6px;
}

.log-panel-empty-sub {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.45;
}

.log-item {
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 14px;
  padding: 12px 12px 10px;
  background: rgba(255,255,255,0.035);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.03);
  cursor: pointer;
  transition: border-color 0.12s ease, background 0.12s ease, box-shadow 0.12s ease, transform 0.08s ease;
}

.log-item:hover {
  transform: translateY(-1px);
  border-color: rgba(255,255,255,0.12);
}

.plot-log-item-active {
  background: rgba(95,168,255,0.10);
  border-color: rgba(95,168,255,0.30);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.04),
    0 0 0 1px rgba(95,168,255,0.10),
    0 0 18px rgba(95,168,255,0.08);
}

.plot-log-item-selected {
  background: rgba(255,214,102,0.10);
  border-color: rgba(255,214,102,0.38);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.04),
    0 0 0 1px rgba(255,214,102,0.10),
    0 0 18px rgba(255,214,102,0.10);
}

.log-item--long {
  border-left: 3px solid rgba(0,255,136,0.6);
}

.log-item--short {
  border-left: 3px solid rgba(255,85,85,0.7);
}

.log-item--neutral {
  border-left: 3px solid rgba(43,188,255,0.55);
}

.log-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.log-time-chip {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.06);
  font-family: var(--mono);
  font-size: 0.72rem;
  color: rgba(255,255,255,0.78);
}

.log-side-badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(43, 188, 255, 0.12);
  border: 1px solid rgba(43, 188, 255, 0.18);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: rgba(220,235,248,0.9);
}

.log-item-title {
  font-size: 0.82rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.log-item-text {
  font-size: 0.78rem;
  line-height: 1.55;
  color: rgba(255,255,255,0.84);
}

.log-item-reasons {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.74rem;
}

.log-item-reasons summary {
  cursor: pointer;
  user-select: none;
}

.log-item-reasons ul {
  margin: 8px 0 0 18px;
  padding: 0;
}

.plotter-y-scroll {
  position: absolute;
  left: 8px;
  top: 80px;
  bottom: 80px;
  width: 6px;
  border-radius: 999px;
  background: rgba(20,30,45,0.35);
  border: 1px solid rgba(120,160,200,0.2);
  z-index: 12;
  pointer-events: none;
}

.plotter-y-scroll-handle {
  position: absolute;
  left: -2px;
  width: 10px;
  min-height: 24px;
  border-radius: 999px;
  background: rgba(80,150,220,0.24);
  border: 1px solid rgba(220,240,255,0.72);
  box-shadow: 0 0 0 1px rgba(20,30,45,0.3);
  cursor: ns-resize;
  pointer-events: auto;
}

/* ======================= FOOTER ========================= */
.footer {
  text-align: center;
  font-size: 0.78rem;
  color: rgba(255,255,255,0.4);
  padding: 16px 0 22px;
}
/* ======================= LAYER BAR ======================= */

.chart-card {
  position: relative; /* needed for overlay */
}

.layerbar {
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  z-index: 50;

  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;

  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 14px;

  background: rgba(10, 14, 20, 0.55);
  backdrop-filter: blur(10px);
  box-shadow: 0 10px 26px rgba(0,0,0,0.35);
}

.layerbar .lb-title {
  font-size: 0.72rem;
  color: var(--muted);
  margin-right: 2px;
  user-select: none;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;

  padding: 7px 10px;
  border-radius: 999px;

  border: 1px solid var(--border);
  background: rgba(255,255,255,0.06);
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 650;

  cursor: pointer;
  user-select: none;
  transition: transform 0.08s ease, background 0.12s ease, border-color 0.12s ease;
}

.pill:hover {
  transform: translateY(-1px);
  background: rgba(255,255,255,0.09);
  border-color: rgba(255,255,255,0.14);
}

.pill:active {
  transform: translateY(0px);
}

.pill--on {
  background: linear-gradient(180deg, rgba(43, 188, 255, 0.22), rgba(20, 145, 209, 0.18));
  border-color: rgba(43, 188, 255, 0.45);
}

.pill--danger {
  background: rgba(255, 85, 85, 0.12);
  border-color: rgba(255, 85, 85, 0.35);
}

.pill--muted {
  color: rgba(255,255,255,0.72);
}

@media (max-width: 1320px) {
  .plot-workbench {
    grid-template-columns: 1fr;
  }

  .plot-shell {
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .plot-log-panel {
    height: 360px;
    min-height: 360px;
  }
}

#autoRefreshBtn.active {
  background: linear-gradient(180deg, rgba(43, 188, 255, 0.95), rgba(20, 145, 209, 0.95));
  border-color: rgba(43, 188, 255, 0.7);
  color: #041018;
}

.left-col{
  display:flex;
  flex-direction:column;
  gap:18px;
}

/* ======================= INTEL BAR ======================= */

.intel-bar {
  display: flex;
  gap: 14px;
  padding: 10px 14px;

  border-top: 1px solid var(--border);
  background: rgba(10, 14, 20, 0.85);

  font-size: 0.75rem;
  color: var(--text);
}

.intel-item {
  padding: 6px 10px;
  border-radius: 10px;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  white-space: nowrap;
}

.intel-item.support {
  border-color: rgba(0, 255, 136, 0.45);
  background: rgba(0, 255, 136, 0.12);
}

.intel-item.resistance {
  border-color: rgba(255, 85, 85, 0.45);
  background: rgba(255, 85, 85, 0.12);
}

#liveBtn.active {
  background: linear-gradient(180deg, rgba(0,255,136,0.9), rgba(0,200,120,0.9));
  border-color: rgba(0,255,136,0.7);
  color: #041018;
}

/* =========================================================
   PLOTTER V3 PHASE 1 — CHART-FIRST SHELL
   Visual/layout only. Existing IDs, APIs, store and chart logic remain intact.
   ========================================================= */

html,
body {
  min-width: 0;
  overflow-x: hidden;
  background:
    radial-gradient(1100px 680px at 58% -6%, rgba(77, 184, 255, 0.1), transparent 60%),
    radial-gradient(860px 520px at 16% 92%, rgba(34, 197, 94, 0.06), transparent 66%),
    linear-gradient(180deg, #202630 0%, var(--bg) 44%, #171b21 100%);
}

body {
  min-width: 0;
  min-height: 100vh;
}

*,
*::before,
*::after {
  min-width: 0;
}

.topbar {
  padding: 14px 22px;
  background: linear-gradient(180deg, rgba(37, 43, 52, 0.9), rgba(32, 38, 48, 0.58));
  border-bottom-color: rgba(121, 139, 164, 0.25);
}

.brand-icon {
  color: var(--primary);
  text-shadow: 0 0 18px rgba(77, 184, 255, 0.28);
}

.brand-title {
  color: #f6f9fc;
}

.layout.plotter-v3 {
  width: 100%;
  max-width: 1440px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  padding: 14px 18px 12px;
}

.card {
  border-color: rgba(117, 135, 160, 0.32);
  background:
    linear-gradient(180deg, rgba(48, 56, 67, 0.96), rgba(37, 43, 52, 0.98)),
    var(--panel);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.045),
    var(--shadow);
}

.card h2,
.card h3 {
  color: #e3eaf2;
}

.controlbar-card {
  padding: 12px 14px;
}

.controlbar-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 10px;
}

.controlbar-head h2,
.evidence-head h2,
.inspector-placeholder h2 {
  margin: 0 0 4px;
  font-size: 1rem;
}

.controlbar-head .controls-help {
  margin: 0;
  line-height: 1.35;
}

.status-pill {
  flex-shrink: 0;
  max-width: 360px;
  padding: 7px 10px;
  border: 1px solid rgba(117, 135, 160, 0.26);
  border-radius: 999px;
  background: rgba(32, 38, 48, 0.78);
  color: var(--muted);
  text-align: right;
}

.controlbar-grid {
  grid-template-columns:
    minmax(120px, 0.8fr)
    minmax(135px, 0.9fr)
    minmax(100px, 0.65fr)
    minmax(100px, 0.65fr)
    minmax(160px, 0.9fr)
    minmax(190px, 1fr);
  align-items: end;
  gap: 10px;
}

.replay-field {
  grid-column: span 3;
}

.run-field {
  grid-column: span 1;
}

.trade-test-field {
  grid-column: span 2;
}

.plot-field label {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.plot-field input {
  height: 38px;
  border-color: rgba(126, 145, 169, 0.38);
  background: #303743;
  color: var(--text);
}

.plot-field input:focus {
  border-color: rgba(77, 184, 255, 0.72);
  box-shadow: 0 0 0 2px rgba(77, 184, 255, 0.16);
}

.button-row,
.time-adjust {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.time-adjust {
  justify-content: flex-start;
}

.time-adjust .btn {
  width: auto;
  min-width: 38px;
  height: 38px;
  font-size: 0.9rem;
}

.prev-days-control,
.simulate-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 38px;
  color: var(--muted);
  font-size: 0.72rem;
}

.prev-days-control input {
  width: 54px;
  height: 34px;
  padding: 6px;
  text-align: center;
}

.simulate-toggle input {
  width: auto;
  height: auto;
}

.trade-test-field {
  padding-left: 12px;
  border-left: 1px dashed rgba(239, 68, 68, 0.34);
}

.btn {
  min-height: 38px;
  border-color: rgba(126, 145, 169, 0.36);
  background: #303743;
  color: #eef3f8;
  white-space: nowrap;
}

.btn:hover {
  background: #384150;
  border-color: rgba(174, 184, 197, 0.55);
}

.btn-primary {
  border-color: rgba(77, 184, 255, 0.78);
  background: linear-gradient(180deg, #66c5ff, var(--primary));
  color: #08111c;
  font-weight: 800;
}

.btn-ghost {
  background: rgba(48, 55, 67, 0.72);
}

.filterbar-card {
  position: relative;
  padding: 8px 10px;
  overflow: visible;
}

.filterbar-card .layerbar {
  position: static;
  inset: auto;
  width: 100%;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

.pill,
.log-tab {
  flex-shrink: 0;
  border-color: rgba(126, 145, 169, 0.34);
  background: rgba(48, 55, 67, 0.76);
  color: #e8eef5;
}

.filterbar-card .lb-title {
  flex-shrink: 0;
}

.pill--on,
.log-tab.is-active {
  border-color: rgba(77, 184, 255, 0.55);
  background: rgba(77, 184, 255, 0.16);
}

.pill--danger {
  border-color: rgba(239, 68, 68, 0.46);
  background: rgba(239, 68, 68, 0.12);
}

.chart-card {
  padding: 0;
}

.plot-workbench {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 360px);
  gap: 0;
  align-items: stretch;
  min-height: auto;
}

.plot-shell {
  border-right: 1px solid rgba(117, 135, 160, 0.28);
}

.plot-container {
  height: clamp(620px, calc(100vh - 270px), 880px);
  min-height: 620px;
  background:
    linear-gradient(180deg, rgba(24, 30, 38, 0.96), rgba(18, 23, 30, 0.98)),
    var(--panel-2);
}

.intel-bar {
  flex-wrap: wrap;
  gap: 8px;
  border-top-color: rgba(117, 135, 160, 0.24);
  background: rgba(32, 38, 48, 0.94);
}

.intel-item {
  border-color: rgba(126, 145, 169, 0.32);
  background: rgba(48, 55, 67, 0.72);
}

.inspector-placeholder {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px;
  background:
    linear-gradient(180deg, rgba(43, 49, 59, 0.96), rgba(35, 41, 50, 0.98)),
    var(--panel);
}

.inspector-eyebrow {
  width: fit-content;
  padding: 4px 8px;
  border: 1px solid rgba(245, 158, 11, 0.45);
  border-radius: 999px;
  color: #f8bd4a;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.inspector-placeholder p {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.5;
}

.inspector-title-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.inspector-subtitle {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.72rem;
}

.inspector-empty {
  padding: 14px;
  border: 1px dashed rgba(126, 145, 169, 0.3);
  border-radius: 12px;
  background: rgba(32, 38, 48, 0.64);
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.45;
}

.inspector-grid {
  display: grid;
  gap: 8px;
}

.inspector-grid > div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 10px;
  border: 1px solid rgba(126, 145, 169, 0.22);
  border-radius: 10px;
  background: rgba(32, 38, 48, 0.74);
}

.inspector-grid label {
  color: var(--muted);
  font-size: 0.7rem;
  text-transform: uppercase;
}

.inspector-grid span {
  overflow: hidden;
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.74rem;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.inspector-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid rgba(126, 145, 169, 0.2);
}

.inspector-section h3 {
  margin: 0;
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.inspector-headline {
  color: #f0f3f7;
  font-size: 0.9rem;
  font-weight: 800;
  line-height: 1.35;
}

.inspector-section p {
  display: -webkit-box;
  overflow: hidden;
  margin: 0;
  color: rgba(240, 243, 247, 0.82);
  font-size: 0.8rem;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 5;
}

.inspector-badge {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  min-height: 22px;
  padding: 3px 8px;
  border: 1px solid rgba(126, 145, 169, 0.3);
  border-radius: 999px;
  background: rgba(32, 38, 48, 0.72);
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.inspector-badge.side-long,
.inspector-badge.candle-green {
  border-color: rgba(34, 197, 94, 0.5);
  color: #5ee28d;
}

.inspector-badge.side-short,
.inspector-badge.candle-red {
  border-color: rgba(239, 68, 68, 0.55);
  color: #ff8585;
}

.inspector-badge.side-neutral,
.inspector-badge.candle-neutral,
.inspector-badge.candle-unknown {
  border-color: rgba(126, 145, 169, 0.35);
  color: var(--muted);
}

.inspector-reasons {
  display: grid;
  gap: 6px;
  margin: 0;
  padding-left: 18px;
  color: rgba(240, 243, 247, 0.84);
  font-size: 0.78rem;
  line-height: 1.4;
}

.inspector-reasons .muted {
  color: var(--muted);
}

.inspector-evidence-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.inspector-evidence-row span {
  padding: 8px;
  border: 1px solid rgba(126, 145, 169, 0.24);
  border-radius: 10px;
  background: rgba(32, 38, 48, 0.68);
  color: var(--muted);
  font-size: 0.72rem;
  text-align: center;
}

.inspector-evidence-row strong {
  display: block;
  margin-top: 2px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.9rem;
}

.session-summary-card {
  padding: 0;
  overflow: hidden;
}

.session-summary {
  display: grid;
  gap: 10px;
  padding: 12px 14px;
  background:
    linear-gradient(180deg, rgba(43, 49, 59, 0.94), rgba(35, 41, 50, 0.98)),
    var(--panel);
}

.session-summary-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: start;
}

.session-summary-eyebrow {
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 850;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.session-summary h2 {
  margin: 2px 0 4px;
  font-size: 0.96rem;
}

.session-summary p {
  margin: 0;
  color: rgba(240, 243, 247, 0.84);
  font-size: 0.82rem;
  line-height: 1.4;
}

.session-summary-badges,
.session-summary-notes,
.session-summary-points {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.session-summary-badges {
  justify-content: flex-end;
  max-width: 620px;
}

.session-summary-badge,
.session-summary-empty-chip {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 5px 8px;
  border: 1px solid rgba(126, 145, 169, 0.3);
  border-radius: 999px;
  background: rgba(32, 38, 48, 0.72);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 800;
}

.session-summary-badge.side-long {
  border-color: rgba(34, 197, 94, 0.45);
  color: #5ee28d;
}

.session-summary-badge.side-short {
  border-color: rgba(239, 68, 68, 0.52);
  color: #ff8585;
}

.session-summary-bottom {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.session-summary-chip {
  display: inline-flex;
  max-width: 280px;
  min-height: 32px;
  align-items: center;
  gap: 8px;
  padding: 6px 9px;
  border: 1px solid rgba(126, 145, 169, 0.28);
  border-left-width: 3px;
  border-radius: 999px;
  background: rgba(32, 38, 48, 0.72);
  color: var(--text);
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease, transform 0.08s ease;
}

.session-summary-chip:hover {
  transform: translateY(-1px);
  border-color: rgba(174, 184, 197, 0.48);
  background: rgba(48, 55, 67, 0.88);
}

.session-summary-chip span {
  flex-shrink: 0;
  color: #dbe8f6;
  font-family: var(--mono);
  font-size: 0.68rem;
}

.session-summary-chip strong {
  overflow: hidden;
  font-size: 0.72rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.session-summary-chip.side-long {
  border-left-color: rgba(34, 197, 94, 0.78);
}

.session-summary-chip.side-short {
  border-left-color: rgba(239, 68, 68, 0.8);
}

.session-summary-chip.side-neutral,
.session-summary-chip.side-unknown {
  border-left-color: rgba(174, 184, 197, 0.5);
}

.session-summary-notes {
  justify-content: flex-end;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.66rem;
}

.session-summary-empty {
  padding: 10px 12px;
  border: 1px dashed rgba(126, 145, 169, 0.3);
  border-radius: 12px;
  background: rgba(32, 38, 48, 0.64);
  color: var(--muted);
  font-size: 0.82rem;
}

.story-v6-card {
  padding: 0;
  overflow: hidden;
}

.story-v6-panel {
  display: grid;
  gap: 12px;
  padding: 13px 14px 14px;
  background:
    linear-gradient(180deg, rgba(38, 48, 53, 0.96), rgba(31, 39, 43, 0.98)),
    var(--panel);
}

.story-v6-head,
.story-v6-section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.story-v6-head {
  min-width: 0;
}

.story-v6-head > div:first-child {
  min-width: 0;
}

.story-v6-head-actions {
  display: flex;
  flex-shrink: 0;
  gap: 8px;
  align-items: center;
}

.story-v6-eyebrow {
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 850;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.story-v6-head h2 {
  margin: 2px 0 0;
  font-size: 0.98rem;
}

.story-v6-panel-summary {
  max-width: 760px;
  margin-top: 5px;
  overflow: hidden;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.68rem;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.story-v6-panel-toggle {
  flex-shrink: 0;
  min-height: 26px;
  padding: 4px 9px;
  border: 1px solid rgba(126, 145, 169, 0.34);
  border-radius: 999px;
  background: rgba(48, 55, 67, 0.76);
  color: #e8eef5;
  cursor: pointer;
  font-size: 0.68rem;
  font-weight: 800;
}

.story-v6-panel-toggle:hover {
  border-color: rgba(77, 184, 255, 0.46);
  background: rgba(77, 184, 255, 0.14);
}

.story-v6-panel-toggle:focus-visible {
  outline: 1px solid rgba(77, 184, 255, 0.75);
  outline-offset: 2px;
}

.story-v6-panel.is-collapsed {
  gap: 0;
}

.story-v6-status,
.story-v6-count {
  flex-shrink: 0;
  min-height: 24px;
  padding: 4px 8px;
  border: 1px solid rgba(34, 197, 94, 0.34);
  border-radius: 999px;
  background: rgba(34, 197, 94, 0.11);
  color: #9af0b8;
  font-family: var(--mono);
  font-size: 0.66rem;
  font-weight: 850;
}

.story-v6-status--loading {
  border-color: rgba(77, 184, 255, 0.34);
  background: rgba(77, 184, 255, 0.12);
  color: #bde7ff;
}

.story-v6-status--error {
  border-color: rgba(239, 68, 68, 0.42);
  background: rgba(239, 68, 68, 0.1);
  color: #ff9b9b;
}

.story-v6-status--idle,
.story-v6-status--missing {
  border-color: rgba(126, 145, 169, 0.32);
  background: rgba(32, 38, 48, 0.66);
  color: var(--muted);
}

.story-v6-sections {
  display: grid;
  gap: 10px;
}

.story-v6-section {
  display: grid;
  gap: 8px;
  padding: 11px 12px;
  border: 1px solid rgba(126, 145, 169, 0.24);
  border-radius: 12px;
  background: rgba(21, 30, 34, 0.42);
}

.story-v6-section h3 {
  margin: 0;
  color: #dbe8f6;
  font-size: 0.82rem;
}

.story-v6-collapsible {
  padding: 0;
  gap: 0;
  overflow: hidden;
}

.story-v6-section-toggle {
  display: grid;
  grid-template-columns: minmax(190px, auto) minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  min-height: 38px;
  padding: 8px 11px;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  text-align: left;
}

.story-v6-section-toggle:hover {
  background: rgba(77, 184, 255, 0.05);
}

.story-v6-section-toggle:focus-visible {
  outline: 1px solid rgba(77, 184, 255, 0.7);
  outline-offset: -2px;
}

.story-v6-section-heading {
  display: flex;
  gap: 7px;
  align-items: center;
  min-width: 0;
}

.story-v6-section-chevron {
  color: var(--muted);
  font-size: 1rem;
  line-height: 1;
  transform: rotate(0deg);
  transition: transform 120ms ease;
}

.story-v6-collapsible.is-expanded .story-v6-section-chevron {
  transform: rotate(90deg);
}

.story-v6-section-title {
  overflow: hidden;
  color: #dbe8f6;
  font-size: 0.82rem;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.story-v6-section-preview {
  overflow: hidden;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.66rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.story-v6-section-meta {
  flex-shrink: 0;
  color: #bde7ff;
  font-family: var(--mono);
  font-size: 0.65rem;
  font-weight: 800;
  white-space: nowrap;
}

.story-v6-section-content {
  display: grid;
  gap: 8px;
  padding: 0 11px 11px;
}

.story-v6-collapsible.is-collapsed .story-v6-section-content {
  display: none;
}

.story-v6-collapsible.is-expanded .story-v6-section-preview {
  opacity: 0.62;
}

.story-v6-headline {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid rgba(34, 197, 94, 0.24);
  border-radius: 12px;
  background: rgba(34, 197, 94, 0.08);
  color: rgba(240, 243, 247, 0.9);
  font-size: 0.82rem;
  line-height: 1.35;
}

.story-v6-headline strong {
  color: #f3f7fb;
  font-size: 0.88rem;
}

.story-v6-headline span {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 4px 8px;
  border: 1px solid rgba(126, 145, 169, 0.22);
  border-radius: 999px;
  background: rgba(32, 38, 48, 0.54);
  color: rgba(240, 243, 247, 0.82);
  font-family: var(--mono);
  font-size: 0.68rem;
}

.story-v6-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
}

.story-v6-grid--summary {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.story-v6-grid--opening-range {
  align-items: stretch;
}

.story-v6-grid--or-values {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.story-v6-or-group {
  display: grid;
  grid-column: 1 / -1;
  gap: 6px;
  min-width: 0;
  padding: 8px;
  border: 1px solid rgba(126, 145, 169, 0.18);
  border-radius: 10px;
  background: rgba(14, 19, 28, 0.34);
}

.story-v6-or-group--wick {
  border-color: rgba(77, 184, 255, 0.18);
}

.story-v6-or-group-title {
  min-width: 0;
  color: rgba(240, 243, 247, 0.86);
  font-size: 0.67rem;
  font-weight: 900;
  text-transform: uppercase;
}

.story-v6-or-levels-toggle {
  min-width: 0;
  min-height: 42px;
  padding: 8px 10px;
  border: 1px solid rgba(77, 184, 255, 0.28);
  border-radius: 10px;
  background: rgba(14, 19, 28, 0.58);
  color: #c9efff;
  cursor: pointer;
  font-size: 0.68rem;
  font-weight: 900;
  text-transform: uppercase;
}

.story-v6-or-levels-toggle:hover,
.story-v6-or-levels-toggle.is-active {
  border-color: rgba(84, 202, 255, 0.58);
  background: rgba(31, 92, 132, 0.34);
  color: #eefaff;
}

.story-v6-grid--shield,
.story-v6-current-map {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
}

.story-v6-metric {
  min-width: 0;
  padding: 8px 9px;
  border: 1px solid rgba(126, 145, 169, 0.2);
  border-radius: 10px;
  background: rgba(32, 38, 48, 0.64);
}

.story-v6-metric label {
  display: block;
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 800;
  text-transform: uppercase;
}

.story-v6-metric span {
  display: block;
  overflow: hidden;
  color: #eef5f8;
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.story-v6-current-map-section {
  border-color: rgba(77, 184, 255, 0.22);
  background: rgba(24, 35, 43, 0.48);
}

.story-v6-journey {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.story-v6-journey-step {
  position: relative;
  min-width: 0;
  padding: 10px 11px;
  border: 1px solid rgba(126, 145, 169, 0.24);
  border-radius: 12px;
  background: rgba(32, 38, 48, 0.68);
}

.story-v6-journey-step:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 50%;
  right: -9px;
  width: 10px;
  height: 1px;
  background: rgba(174, 184, 197, 0.36);
}

.story-v6-journey-step label,
.story-v6-journey-step span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.story-v6-journey-step label {
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 850;
  text-transform: uppercase;
}

.story-v6-journey-step strong {
  display: block;
  margin-top: 4px;
  color: #eef5f8;
  font-family: var(--mono);
  font-size: 0.9rem;
}

.story-v6-journey-step span {
  margin-top: 3px;
  color: rgba(174, 184, 197, 0.82);
  font-family: var(--mono);
  font-size: 0.66rem;
}

.story-v6-structure-line {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  color: rgba(240, 243, 247, 0.82);
  font-size: 0.78rem;
}

.story-v6-structure-line strong {
  color: #eef5f8;
}

.story-v6-structure-line span {
  padding: 3px 7px;
  border: 1px solid rgba(126, 145, 169, 0.22);
  border-radius: 999px;
  background: rgba(32, 38, 48, 0.58);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.66rem;
}

.story-v6-footnote {
  overflow: hidden;
  color: rgba(174, 184, 197, 0.78);
  font-family: var(--mono);
  font-size: 0.66rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.story-v6-empty {
  padding: 10px 12px;
  border: 1px dashed rgba(126, 145, 169, 0.3);
  border-radius: 12px;
  background: rgba(32, 38, 48, 0.64);
  color: var(--muted);
  font-size: 0.82rem;
}

.story-v6-selected-truth {
  border-color: rgba(77, 184, 255, 0.28);
  background:
    linear-gradient(180deg, rgba(29, 43, 51, 0.62), rgba(21, 30, 34, 0.46)),
    rgba(21, 30, 34, 0.42);
}

.story-v6-selected-truth .story-v6-section-head span {
  color: #bde7ff;
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 850;
}

.story-v6-selected-primary {
  display: grid;
  gap: 5px;
  padding: 9px 10px;
  border: 1px solid rgba(77, 184, 255, 0.28);
  border-radius: 10px;
  background: rgba(77, 184, 255, 0.08);
}

.story-v6-selected-primary label,
.story-v6-selected-facts > label,
.story-v6-selected-fallback-label {
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 850;
  text-transform: uppercase;
}

.story-v6-selected-primary div {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  min-width: 0;
}

.story-v6-selected-primary strong {
  color: #eef5f8;
  font-size: 0.82rem;
}

.story-v6-selected-primary span:not(.story-v6-event-chip) {
  color: rgba(240, 243, 247, 0.76);
  font-family: var(--mono);
  font-size: 0.68rem;
}

.story-v6-event-chip {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 2px 6px;
  border: 1px solid rgba(126, 145, 169, 0.28);
  border-radius: 999px;
  background: rgba(32, 38, 48, 0.72);
  color: rgba(240, 243, 247, 0.82);
  font-family: var(--mono);
  font-size: 0.6rem;
  font-weight: 850;
  white-space: nowrap;
}

.story-v6-event-chip--or {
  border-color: rgba(77, 184, 255, 0.38);
  color: #bde7ff;
}

.story-v6-event-chip--trend-birth {
  border-color: rgba(34, 197, 94, 0.36);
  color: #9af0b8;
}

.story-v6-event-chip--trend {
  border-color: rgba(34, 197, 94, 0.36);
  color: #9af0b8;
}

.story-v6-event-chip--shield {
  border-color: rgba(248, 189, 74, 0.44);
  color: #f8bd4a;
}

.story-v6-event-chip--structure {
  border-color: rgba(179, 151, 255, 0.36);
  color: #d7c8ff;
}

.story-v6-event-chip--issue {
  border-color: rgba(239, 68, 68, 0.42);
  color: #ff9b9b;
}

.story-v6-event-chip--flip,
.story-v6-event-chip--area {
  border-color: rgba(126, 145, 169, 0.34);
  color: rgba(240, 243, 247, 0.78);
}

.story-v6-readiness {
  border-color: rgba(34, 197, 94, 0.24);
  background:
    linear-gradient(180deg, rgba(28, 49, 38, 0.36), rgba(21, 30, 34, 0.46)),
    rgba(21, 30, 34, 0.42);
}

.story-v6-readiness--warning {
  border-color: rgba(248, 189, 74, 0.34);
  background:
    linear-gradient(180deg, rgba(55, 43, 22, 0.36), rgba(21, 30, 34, 0.46)),
    rgba(21, 30, 34, 0.42);
}

.story-v6-readiness--incomplete,
.story-v6-readiness--unknown {
  border-color: rgba(126, 145, 169, 0.3);
}

.story-v6-readiness-headline {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
}

.story-v6-readiness-headline strong {
  color: #eef5f8;
  font-size: 0.88rem;
}

.story-v6-readiness-headline span {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.66rem;
}

.story-v6-readiness-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.story-v6-readiness-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.story-v6-readiness-columns > div {
  min-width: 0;
  padding: 8px 9px;
  border: 1px solid rgba(126, 145, 169, 0.18);
  border-radius: 10px;
  background: rgba(32, 38, 48, 0.52);
}

.story-v6-readiness-columns label {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 850;
  text-transform: uppercase;
}

.story-v6-readiness-columns p {
  margin: 0;
  color: var(--muted);
  font-size: 0.72rem;
}

.story-v6-readiness-list {
  display: grid;
  gap: 4px;
  margin: 0;
  padding: 0 0 0 14px;
  color: rgba(240, 243, 247, 0.86);
  font-size: 0.72rem;
  line-height: 1.34;
}

.story-v6-readiness-list--warning {
  color: #f8d38a;
}

.story-v6-event-timeline {
  border-color: rgba(248, 189, 74, 0.26);
  background:
    linear-gradient(180deg, rgba(44, 38, 24, 0.34), rgba(21, 30, 34, 0.46)),
    rgba(21, 30, 34, 0.42);
}

.story-v6-lifecycle {
  border-color: rgba(179, 151, 255, 0.3);
  background:
    linear-gradient(180deg, rgba(42, 34, 58, 0.34), rgba(21, 30, 34, 0.46)),
    rgba(21, 30, 34, 0.42);
}

.story-v6-lifecycle-listing {
  display: grid;
  gap: 7px;
}

.story-v6-lifecycle-trend {
  overflow: hidden;
  border: 1px solid rgba(126, 145, 169, 0.22);
  border-radius: 10px;
  background: rgba(32, 38, 48, 0.58);
}

.story-v6-lifecycle-trend.is-current {
  border-color: rgba(77, 184, 255, 0.48);
  box-shadow: inset 3px 0 0 rgba(77, 184, 255, 0.72);
}

.story-v6-lifecycle-trend.is-historical {
  opacity: 0.86;
}

.story-v6-lifecycle-toggle {
  display: grid;
  grid-template-columns: auto minmax(135px, 0.7fr) minmax(150px, 1fr) minmax(180px, 1fr);
  gap: 8px;
  align-items: center;
  width: 100%;
  padding: 8px 9px;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  text-align: left;
}

.story-v6-lifecycle-toggle:hover {
  background: rgba(77, 184, 255, 0.05);
}

.story-v6-lifecycle-trend.is-expanded .story-v6-section-chevron {
  transform: rotate(90deg);
}

.story-v6-lifecycle-title {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.story-v6-lifecycle-title strong {
  color: #eef5f8;
  font-family: var(--mono);
  font-size: 0.72rem;
}

.story-v6-lifecycle-title span,
.story-v6-lifecycle-times,
.story-v6-lifecycle-counts {
  overflow: hidden;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.64rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.story-v6-lifecycle-counts {
  color: #d7c8ff;
  text-align: right;
}

.story-v6-lifecycle-detail {
  display: grid;
  gap: 8px;
  padding: 0 9px 9px 31px;
}

.story-v6-lifecycle-trend.is-collapsed .story-v6-lifecycle-detail {
  display: none;
}

.story-v6-lifecycle-subhead {
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 850;
  text-transform: uppercase;
}

.story-v6-lifecycle-list {
  display: grid;
  gap: 5px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.story-v6-lifecycle-list li {
  display: grid;
  grid-template-columns: minmax(80px, auto) 55px minmax(0, 1fr);
  gap: 8px;
  padding: 6px 8px;
  border: 1px solid rgba(248, 189, 74, 0.2);
  border-radius: 8px;
  background: rgba(44, 38, 24, 0.34);
  font-family: var(--mono);
  font-size: 0.65rem;
}

.story-v6-lifecycle-list strong {
  color: #f8bd4a;
}

.story-v6-lifecycle-list span,
.story-v6-lifecycle-list small {
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.story-v6-lifecycle-empty {
  padding: 8px 9px;
  border: 1px dashed rgba(248, 189, 74, 0.28);
  border-radius: 9px;
  background: rgba(44, 38, 24, 0.28);
  color: #f8d38a;
  font-size: 0.7rem;
}

.story-v6-timeline-list {
  display: grid;
  gap: 6px;
  max-height: 360px;
  overflow: auto;
  padding-right: 2px;
}

.story-v6-timeline-row {
  display: grid;
  grid-template-columns: 43px auto minmax(0, 1fr);
  gap: 7px;
  align-items: start;
  width: 100%;
  min-width: 0;
  padding: 8px 9px;
  border: 1px solid rgba(126, 145, 169, 0.2);
  border-radius: 10px;
  background: rgba(32, 38, 48, 0.58);
  color: inherit;
  cursor: pointer;
  text-align: left;
}

.story-v6-timeline-row:disabled {
  cursor: default;
  opacity: 0.74;
}

.story-v6-timeline-row:not(:disabled):hover {
  border-color: rgba(77, 184, 255, 0.34);
  background: rgba(35, 48, 57, 0.72);
}

.story-v6-timeline-row.is-selected {
  border-color: rgba(77, 184, 255, 0.7);
  background: rgba(77, 184, 255, 0.1);
  box-shadow: inset 3px 0 0 rgba(77, 184, 255, 0.82);
}

.story-v6-timeline-time {
  color: #bde7ff;
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 850;
  line-height: 20px;
}

.story-v6-timeline-main {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.story-v6-timeline-main strong,
.story-v6-timeline-main small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.story-v6-timeline-main strong {
  color: #eef5f8;
  font-size: 0.74rem;
}

.story-v6-timeline-main small {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.65rem;
}

.story-v6-selected-facts {
  display: grid;
  gap: 6px;
}

.story-v6-selected-truth-list {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.story-v6-selected-truth-list li {
  display: grid;
  grid-template-columns: auto minmax(92px, 0.72fr) minmax(0, 1fr);
  gap: 7px;
  align-items: center;
  min-width: 0;
  padding: 7px 8px;
  border: 1px solid rgba(126, 145, 169, 0.18);
  border-radius: 9px;
  background: rgba(32, 38, 48, 0.52);
}

.story-v6-selected-truth-list strong,
.story-v6-selected-truth-list span:not(.story-v6-event-chip) {
  overflow: hidden;
  font-family: var(--mono);
  font-size: 0.67rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.story-v6-selected-truth-list strong {
  color: #eef5f8;
}

.story-v6-selected-truth-list span:not(.story-v6-event-chip) {
  color: var(--muted);
}

.story-v6-issues {
  display: grid;
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.story-v6-issues li {
  display: grid;
  grid-template-columns: minmax(0, 160px) auto minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  padding: 8px 9px;
  border: 1px solid rgba(126, 145, 169, 0.2);
  border-radius: 10px;
  background: rgba(32, 38, 48, 0.6);
}

.story-v6-issues strong,
.story-v6-issues span {
  overflow: hidden;
  font-family: var(--mono);
  font-size: 0.68rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.story-v6-issues strong {
  color: #f8bd4a;
}

.story-v6-issues span {
  color: var(--muted);
}

.story-v6-issues p {
  margin: 0;
  color: rgba(240, 243, 247, 0.84);
  font-size: 0.74rem;
  line-height: 1.38;
}

.story-v6-issues .story-v6-no-issues {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
}

.story-v4-card {
  padding: 0;
  overflow: hidden;
}

.story-v4-card.is-hidden {
  display: none;
}

.story-v4-panel {
  display: grid;
  gap: 12px;
  padding: 13px 14px 14px;
  background:
    linear-gradient(180deg, rgba(39, 47, 58, 0.96), rgba(31, 37, 46, 0.98)),
    var(--panel);
}

.story-v4-head,
.story-v4-section-head,
.story-v4-chapter-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.story-v4-eyebrow {
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 850;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.story-v4-head h2 {
  margin: 2px 0 0;
  font-size: 0.98rem;
}

.story-v4-status {
  flex-shrink: 0;
  min-height: 24px;
  padding: 4px 8px;
  border: 1px solid rgba(77, 184, 255, 0.34);
  border-radius: 999px;
  background: rgba(77, 184, 255, 0.12);
  color: #bde7ff;
  font-family: var(--mono);
  font-size: 0.66rem;
  font-weight: 800;
}

.story-v4-status--error {
  border-color: rgba(239, 68, 68, 0.42);
  background: rgba(239, 68, 68, 0.1);
  color: #ff9b9b;
}

.story-v4-section {
  display: grid;
  gap: 8px;
  padding: 11px 12px;
  border: 1px solid rgba(126, 145, 169, 0.24);
  border-radius: 12px;
  background: rgba(21, 27, 36, 0.38);
}

.story-v4-section h3 {
  margin: 0;
  color: #dbe8f6;
  font-size: 0.82rem;
}

.story-v4-section p {
  margin: 0;
  color: rgba(240, 243, 247, 0.84);
  font-size: 0.8rem;
  line-height: 1.52;
}

.story-v4-headline {
  color: #f3f7fb;
  font-weight: 750;
}

.story-v4-section-head span {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.68rem;
}

.story-v4-map {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.story-v4-map div {
  min-width: 0;
  padding: 8px 9px;
  border: 1px solid rgba(126, 145, 169, 0.22);
  border-radius: 10px;
  background: rgba(48, 55, 67, 0.48);
}

.story-v4-map label {
  display: block;
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.story-v4-map span {
  display: block;
  margin-top: 3px;
  overflow: hidden;
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.76rem;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.story-v4-timeline {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 8px;
}

.story-v4-chapter {
  appearance: none;
  color: inherit;
  cursor: pointer;
  font: inherit;
  text-align: left;
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid rgba(126, 145, 169, 0.22);
  border-left: 3px solid rgba(77, 184, 255, 0.48);
  border-radius: 10px;
  background: rgba(48, 55, 67, 0.42);
  transition: background 0.12s ease, border-color 0.12s ease, transform 0.08s ease;
}

.story-v4-chapter:hover {
  transform: translateY(-1px);
  border-color: rgba(174, 184, 197, 0.42);
  background: rgba(58, 67, 82, 0.58);
}

.story-v4-chapter.is-selected {
  border-color: rgba(245, 158, 11, 0.68);
  border-left-color: rgba(245, 158, 11, 0.92);
  background: rgba(245, 158, 11, 0.12);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.045),
    0 0 0 1px rgba(245, 158, 11, 0.1);
}

.story-v4-id,
.story-v4-time {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.66rem;
  font-weight: 800;
}

.story-v4-chapter-title {
  margin-top: 6px;
  color: #eef5fc;
  font-size: 0.78rem;
  font-weight: 800;
}

.story-v4-chapter p {
  margin-top: 5px;
  color: rgba(240, 243, 247, 0.76);
  font-size: 0.74rem;
  line-height: 1.38;
}

.story-v4-empty {
  padding: 10px 12px;
  border: 1px dashed rgba(126, 145, 169, 0.3);
  border-radius: 12px;
  background: rgba(32, 38, 48, 0.64);
  color: var(--muted);
  font-size: 0.8rem;
}

.story-v4-empty--error {
  border-color: rgba(239, 68, 68, 0.34);
  color: #ffb0b0;
}

.story-v4-inspector {
  gap: 10px;
}

.story-v4-inspector-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  border: 1px solid rgba(126, 145, 169, 0.22);
  border-radius: 10px;
  background: rgba(48, 55, 67, 0.42);
}

.story-v4-inspector-title strong {
  color: #f0f5fb;
  font-size: 0.86rem;
}

.story-v4-inspector-title > span:last-child {
  margin-left: auto;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 800;
}

.story-v4-inspector-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.story-v4-inspector-grid div {
  min-width: 0;
  padding: 8px 9px;
  border: 1px solid rgba(126, 145, 169, 0.22);
  border-radius: 10px;
  background: rgba(48, 55, 67, 0.42);
}

.story-v4-inspector-grid label {
  display: block;
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.story-v4-inspector-grid span {
  display: block;
  margin-top: 3px;
  overflow: hidden;
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.story-v4-inspector-group {
  display: grid;
  gap: 8px;
  padding-top: 2px;
}

.story-v4-inspector-group h4 {
  margin: 0;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 850;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.story-v4-inspector-group p {
  margin: 0;
  color: rgba(240, 243, 247, 0.84);
  font-size: 0.8rem;
  line-height: 1.48;
}

.story-v4-inspector-group .story-v4-muted {
  color: var(--muted);
  font-size: 0.74rem;
}

.story-v4-trace {
  display: grid;
  gap: 9px;
  padding-top: 2px;
}

.story-v4-trace-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.story-v4-trace-summary div {
  min-width: 0;
  padding: 8px 9px;
  border: 1px solid rgba(126, 145, 169, 0.22);
  border-radius: 10px;
  background: rgba(48, 55, 67, 0.42);
}

.story-v4-trace-summary label {
  display: block;
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.story-v4-trace-summary span {
  display: block;
  margin-top: 3px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 800;
}

.story-v4-trace-block {
  display: grid;
  gap: 7px;
}

.story-v4-trace-block h4 {
  margin: 0;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 850;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.story-v4-trace-item {
  display: grid;
  grid-template-columns: minmax(120px, 1.2fr) repeat(5, minmax(80px, 1fr));
  gap: 8px;
  width: 100%;
  padding: 8px 9px;
  border: 1px solid rgba(126, 145, 169, 0.22);
  border-radius: 10px;
  background: rgba(48, 55, 67, 0.42);
  color: rgba(240, 243, 247, 0.82);
  cursor: text;
  font: inherit;
  text-align: left;
}

.story-v4-trace-item:focus {
  outline: none;
  border-color: rgba(245, 158, 11, 0.6);
  background: rgba(245, 158, 11, 0.1);
}

.story-v4-trace-item span {
  overflow: hidden;
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.story-v4-trace-id {
  color: #dbe8f6;
}

.timeline-card {
  padding: 0;
  overflow: hidden;
}

.timeline-rail {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 14px;
  background:
    linear-gradient(180deg, rgba(43, 49, 59, 0.96), rgba(35, 41, 50, 0.98)),
    var(--panel);
}

.timeline-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.timeline-head h2 {
  margin: 2px 0 0;
  font-size: 0.92rem;
}

.timeline-eyebrow {
  width: fit-content;
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 850;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.timeline-count {
  flex-shrink: 0;
  padding: 5px 8px;
  border: 1px solid rgba(126, 145, 169, 0.28);
  border-radius: 999px;
  background: rgba(32, 38, 48, 0.7);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.68rem;
}

.timeline-track {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 0 0 4px;
  overscroll-behavior-x: contain;
}

.timeline-track::-webkit-scrollbar {
  height: 5px;
}

.timeline-track::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(174, 184, 197, 0.32);
}

.timeline-event {
  display: flex;
  flex: 0 0 190px;
  max-width: 220px;
  min-height: 76px;
  flex-direction: column;
  gap: 5px;
  padding: 9px 10px;
  border: 1px solid rgba(126, 145, 169, 0.26);
  border-left-width: 3px;
  border-radius: 12px;
  background: rgba(32, 38, 48, 0.78);
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: background 0.12s ease, border-color 0.12s ease, transform 0.08s ease;
}

.timeline-event:hover {
  transform: translateY(-1px);
  border-color: rgba(174, 184, 197, 0.45);
  background: rgba(48, 55, 67, 0.9);
}

.timeline-event.is-selected {
  border-color: rgba(245, 158, 11, 0.7);
  background: rgba(245, 158, 11, 0.13);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 0 0 1px rgba(245, 158, 11, 0.12);
}

.timeline-event-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.timeline-time,
.timeline-type {
  font-family: var(--mono);
  font-size: 0.66rem;
}

.timeline-time {
  color: #dbe8f6;
}

.timeline-type {
  max-width: 74px;
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.timeline-title {
  display: block;
  overflow: hidden;
  color: #f0f3f7;
  font-size: 0.78rem;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.timeline-subtitle {
  display: -webkit-box;
  overflow: hidden;
  color: rgba(240, 243, 247, 0.74);
  font-size: 0.7rem;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.timeline-empty {
  padding: 12px;
  border: 1px dashed rgba(126, 145, 169, 0.3);
  border-radius: 12px;
  background: rgba(32, 38, 48, 0.64);
  color: var(--muted);
  font-size: 0.82rem;
}

.timeline-event.side-long {
  border-left-color: rgba(34, 197, 94, 0.78);
}

.timeline-event.side-short {
  border-left-color: rgba(239, 68, 68, 0.8);
}

.timeline-event.side-none,
.timeline-event.side-unknown {
  border-left-color: rgba(174, 184, 197, 0.5);
}

.timeline-event.severity-warning {
  border-top-color: rgba(245, 158, 11, 0.5);
}

.timeline-event.severity-critical {
  border-top-color: rgba(239, 68, 68, 0.7);
  background: rgba(239, 68, 68, 0.08);
}

.evidence-card {
  padding: 0;
  overflow: hidden;
}

.evidence-head {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(117, 135, 160, 0.24);
}

.evidence-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 14px 14px;
  border-bottom: 1px solid rgba(117, 135, 160, 0.24);
  background:
    linear-gradient(180deg, rgba(43, 49, 59, 0.88), rgba(35, 41, 50, 0.94)),
    var(--panel);
}

.evidence-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.evidence-tabs::-webkit-scrollbar {
  height: 4px;
}

.evidence-tabs::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(174, 184, 197, 0.28);
}

.evidence-tab {
  flex: 0 0 auto;
  min-height: 30px;
  padding: 6px 10px;
  border: 1px solid rgba(126, 145, 169, 0.34);
  border-radius: 999px;
  background: rgba(48, 55, 67, 0.76);
  color: #e8eef5;
  cursor: pointer;
  font-size: 0.72rem;
  font-weight: 800;
  transition: background 0.12s ease, border-color 0.12s ease, transform 0.08s ease;
}

.evidence-tab:hover {
  transform: translateY(-1px);
  border-color: rgba(174, 184, 197, 0.5);
  background: rgba(56, 65, 80, 0.88);
}

.evidence-tab.is-active {
  border-color: rgba(77, 184, 255, 0.56);
  background: rgba(77, 184, 255, 0.16);
}

.evidence-context {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.7rem;
}

.evidence-result-note {
  margin-bottom: 8px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.68rem;
}

.evidence-body {
  min-height: 130px;
}

.evidence-list {
  display: grid;
  max-height: 310px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  overflow-y: auto;
  padding-right: 3px;
}

.evidence-list::-webkit-scrollbar {
  width: 5px;
}

.evidence-list::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(174, 184, 197, 0.28);
}

.evidence-item {
  display: flex;
  min-height: 146px;
  flex-direction: column;
  gap: 7px;
  padding: 11px 12px;
  border: 1px solid rgba(126, 145, 169, 0.22);
  border-left-width: 3px;
  border-radius: 14px;
  background: rgba(32, 38, 48, 0.72);
  color: var(--text);
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease, transform 0.08s ease;
}

.evidence-item:hover {
  transform: translateY(-1px);
  border-color: rgba(174, 184, 197, 0.42);
  background: rgba(48, 55, 67, 0.88);
}

.evidence-item.is-selected {
  border-color: rgba(245, 158, 11, 0.68);
  background: rgba(245, 158, 11, 0.12);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 0 0 1px rgba(245, 158, 11, 0.1);
}

.evidence-item.is-nearby {
  opacity: 0.88;
}

.evidence-item.is-orphan {
  border-style: dashed;
}

.evidence-item.side-long {
  border-left-color: rgba(34, 197, 94, 0.78);
}

.evidence-item.side-short {
  border-left-color: rgba(239, 68, 68, 0.8);
}

.evidence-item.side-none,
.evidence-item.side-unknown {
  border-left-color: rgba(174, 184, 197, 0.5);
}

.evidence-item.severity-warning {
  border-top-color: rgba(245, 158, 11, 0.5);
}

.evidence-item.severity-critical {
  border-top-color: rgba(239, 68, 68, 0.74);
  background: rgba(239, 68, 68, 0.08);
}

.evidence-item-head {
  display: flex;
  align-items: center;
  gap: 6px;
}

.evidence-time {
  margin-right: auto;
  color: #dbe8f6;
  font-family: var(--mono);
  font-size: 0.68rem;
}

.evidence-badge {
  flex: 0 0 auto;
  padding: 3px 7px;
  border: 1px solid rgba(126, 145, 169, 0.3);
  border-radius: 999px;
  background: rgba(32, 38, 48, 0.78);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.62rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.evidence-badge.severity {
  color: #d7e0ea;
}

.evidence-title {
  overflow: hidden;
  color: #f0f3f7;
  font-size: 0.82rem;
  font-weight: 850;
  line-height: 1.28;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.evidence-item p {
  display: -webkit-box;
  overflow: hidden;
  margin: 0;
  color: rgba(240, 243, 247, 0.8);
  font-size: 0.74rem;
  line-height: 1.42;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.evidence-reasons {
  display: grid;
  gap: 4px;
  margin: 0;
  padding-left: 16px;
  color: rgba(240, 243, 247, 0.7);
  font-size: 0.7rem;
  line-height: 1.3;
}

.evidence-source {
  margin-top: auto;
  color: rgba(174, 184, 197, 0.72);
  font-family: var(--mono);
  font-size: 0.64rem;
  text-transform: uppercase;
}

.evidence-empty,
.evidence-debug-note {
  padding: 14px;
  border: 1px dashed rgba(126, 145, 169, 0.3);
  border-radius: 12px;
  background: rgba(32, 38, 48, 0.64);
  color: var(--muted);
  font-size: 0.82rem;
}

.plot-log-panel.evidence-raw-hidden {
  display: none;
}

.plot-log-panel.evidence-raw-visible {
  display: flex;
}

.plot-log-panel {
  height: 420px;
  min-height: 420px;
  max-height: 420px;
  background:
    linear-gradient(180deg, rgba(37, 43, 52, 0.96), rgba(32, 38, 48, 0.98)),
    var(--panel);
}

.log-panel-head,
.log-panel-toolbar {
  border-bottom-color: rgba(117, 135, 160, 0.22);
}

.log-panel-body {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-content: start;
}

.log-item {
  border-color: rgba(126, 145, 169, 0.22);
  background: rgba(32, 38, 48, 0.72);
}

.log-item-text {
  display: -webkit-box;
  overflow: hidden;
  color: rgba(240, 243, 247, 0.86);
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
}

.footer {
  color: rgba(174, 184, 197, 0.62);
}

@media (max-width: 1280px) {
  .controlbar-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .replay-field,
  .run-field,
  .trade-test-field {
    grid-column: span 2;
  }

  .log-panel-body {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .layout.plotter-v3 {
    padding: 12px;
  }

  .controlbar-head {
    flex-direction: column;
    gap: 8px;
  }

  .status-pill {
    max-width: none;
    text-align: left;
  }

  .controlbar-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .replay-field,
  .run-field,
  .trade-test-field {
    grid-column: span 2;
  }

  .plot-workbench {
    grid-template-columns: minmax(0, 1fr);
  }

  .plot-shell {
    border-right: none;
    border-bottom: 1px solid rgba(117, 135, 160, 0.24);
  }

  .plot-container {
    height: 620px;
  }

  .inspector-placeholder {
    display: flex;
    max-height: 520px;
    overflow-y: auto;
    border-top: 1px solid rgba(117, 135, 160, 0.24);
  }

  .timeline-event {
    flex-basis: 170px;
  }

  .session-summary-main,
  .session-summary-bottom {
    grid-template-columns: minmax(0, 1fr);
  }

  .session-summary-badges,
  .session-summary-notes {
    justify-content: flex-start;
  }

  .story-v6-grid,
  .story-v6-grid--summary,
  .story-v6-grid--shield,
  .story-v6-current-map {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .story-v6-journey {
    grid-template-columns: minmax(0, 1fr);
  }

  .story-v6-journey-step:not(:last-child)::after {
    display: none;
  }

  .story-v6-issues li {
    grid-template-columns: minmax(0, 1fr);
  }

  .story-v6-lifecycle-toggle {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .story-v6-lifecycle-times,
  .story-v6-lifecycle-counts {
    grid-column: 2;
    text-align: left;
  }

  .story-v6-lifecycle-detail {
    padding-left: 9px;
  }

  .evidence-list {
    grid-template-columns: minmax(0, 1fr);
  }

  .log-panel-body {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 520px) {
  .topbar {
    padding: 12px;
  }

  .brand-title {
    font-size: 0.95rem;
  }

  .controlbar-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .replay-field,
  .run-field,
  .trade-test-field {
    grid-column: auto;
  }

  .controlbar-head .controls-help {
    display: none;
  }

  .button-row,
  .time-adjust {
    align-items: stretch;
  }

  .button-row .btn,
  .time-adjust .btn {
    flex: 1 1 auto;
  }

  .simulate-toggle {
    flex-basis: 100%;
  }

  .filterbar-card .layerbar {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 2px;
  }

  .filterbar-card .layerbar::-webkit-scrollbar {
    height: 4px;
  }

  .plot-container {
    height: 560px;
    min-height: 560px;
  }

  .intel-bar {
    overflow-x: auto;
    flex-wrap: nowrap;
  }

  .plot-log-panel {
    height: 380px;
    min-height: 380px;
    max-height: 380px;
  }

  .inspector-placeholder {
    max-height: 480px;
  }

  .timeline-rail {
    padding: 10px;
  }

  .timeline-head {
    align-items: center;
  }

  .timeline-event {
    flex-basis: 155px;
    min-height: 70px;
  }

  .session-summary {
    padding: 10px;
  }

  .session-summary-chip {
    max-width: 100%;
  }

  .evidence-panel {
    padding: 10px;
  }

  .evidence-list {
    max-height: 360px;
  }

  .evidence-item {
    min-height: 132px;
  }
}

.pill--legacy-debug {
  border-color: rgba(148, 163, 184, 0.45);
  color: #cbd5e1;
}

.pill--legacy-debug.pill--on {
  border-color: rgba(245, 158, 11, 0.72);
  background: rgba(120, 53, 15, 0.42);
  color: #fde68a;
}

body:not(.legacy-debug-open) .session-summary-card,
body:not(.legacy-debug-open) .timeline-card,
body:not(.legacy-debug-open) .evidence-card,
body:not(.legacy-debug-open) #storyInspectorPanel,
body:not(.legacy-debug-open) #plotLogPanel,
body:not(.legacy-debug-open) #storyV4Card {
  display: none !important;
}

body:not(.legacy-debug-open) .plot-workbench {
  grid-template-columns: minmax(0, 1fr);
}

body:not(.legacy-debug-open) .plot-shell {
  border-right: 0;
}

body.legacy-debug-open #plotLogPanel {
  display: flex !important;
}

/* ==================== TRADEBRAIN V2 BRAIN VOICE ==================== */
.brain-voice-card {
  block-size: clamp(22rem, 46dvh, 32rem);
  padding: 0;
  overflow: hidden;
  border-color: rgba(139, 124, 196, 0.38);
}

.brain-voice-card.is-reader-expanded {
  block-size: auto;
}

.brain-voice-panel {
  block-size: 100%;
  background:
    linear-gradient(180deg, rgba(42, 40, 57, 0.97), rgba(31, 31, 43, 0.99)),
    var(--panel);
}

.brain-voice-shell {
  display: grid;
  grid-template-rows: auto auto auto auto minmax(0, 1fr);
  gap: 12px;
  block-size: 100%;
  padding: 14px;
  overflow: hidden;
}

.brain-voice-shell--expanded {
  grid-template-rows: auto;
  block-size: auto;
  overflow: visible;
}

.brain-voice-shell--terminal {
  background: linear-gradient(180deg, rgba(148, 163, 184, 0.035), transparent 42%);
}

.brain-voice-reader-body {
  display: grid;
  align-content: start;
  gap: 12px;
  min-block-size: 0;
  padding-right: 4px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.brain-voice-shell--expanded .brain-voice-reader-body {
  overflow: visible;
}

.brain-voice-reader-body:focus-visible {
  outline: 1px solid rgba(139, 124, 196, 0.76);
  outline-offset: 2px;
}

.brain-voice-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.brain-voice-header h2 {
  margin: 2px 0 0;
  font-size: 1rem;
}

.brain-voice-error-detail {
  width: fit-content;
  max-width: 100%;
  padding: 5px 8px;
  border: 1px solid rgba(248, 113, 113, 0.22);
  border-radius: 7px;
  color: #d7a3a3;
  font-family: var(--mono);
  font-size: 0.68rem;
  overflow-wrap: anywhere;
}

.brain-voice-eyebrow {
  color: #bbb1e4;
  font-size: 0.62rem;
  font-weight: 850;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.brain-voice-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.brain-voice-reader-toggle {
  min-block-size: 30px;
  padding: 5px 10px;
  border: 1px solid rgba(139, 124, 196, 0.48);
  border-radius: 999px;
  background: rgba(139, 124, 196, 0.12);
  color: #ddd6fe;
  cursor: pointer;
  font-size: 0.68rem;
  font-weight: 800;
}

.brain-voice-reader-toggle:hover {
  background: rgba(139, 124, 196, 0.2);
}

.brain-voice-reader-toggle:focus-visible {
  outline: 2px solid rgba(139, 124, 196, 0.82);
  outline-offset: 2px;
}

.brain-voice-badge {
  padding: 4px 8px;
  border: 1px solid rgba(174, 184, 197, 0.28);
  border-radius: 999px;
  background: rgba(29, 31, 43, 0.72);
  color: #dce2ea;
  font-family: var(--mono);
  font-size: 0.65rem;
}

.brain-voice-badge--match {
  border-color: rgba(139, 124, 196, 0.55);
  color: #d5ccff;
}

.brain-voice-badge--terminal {
  border-color: rgba(148, 163, 184, 0.5);
  color: #cbd5e1;
}

.brain-voice-badge--anomaly {
  border-color: rgba(245, 158, 11, 0.5);
  color: #fbd38d;
}

.brain-voice-meta,
.brain-voice-muted {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.68rem;
}

.brain-voice-empty {
  padding: 14px;
  border: 1px dashed rgba(174, 184, 197, 0.28);
  border-radius: 12px;
  color: var(--muted);
}

.brain-voice-section {
  display: grid;
  gap: 7px;
  padding: 11px 12px;
  border: 1px solid rgba(174, 184, 197, 0.2);
  border-radius: 12px;
  background: rgba(18, 19, 28, 0.36);
}

.brain-voice-section h3,
.brain-voice-expectation-group h4,
.brain-voice-technical h4 {
  margin: 0;
  color: #e5e2f5;
}

.brain-voice-section h3 {
  font-size: 0.82rem;
}

.brain-voice-section p {
  margin: 0;
  color: #d8dee7;
  font-size: 0.79rem;
  line-height: 1.5;
}

.brain-voice-conclusion {
  font-weight: 760;
}

.brain-voice-list,
.brain-voice-expectations,
.brain-voice-technical-list,
.brain-voice-lineage {
  display: grid;
  gap: 6px;
  margin: 0;
  padding-left: 18px;
}

.brain-voice-list li,
.brain-voice-expectations li {
  color: #d8dee7;
  font-size: 0.76rem;
  line-height: 1.45;
}

.brain-voice-related-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.brain-voice-relationship-group {
  display: grid;
  gap: 6px;
}

.brain-voice-relationship-group h4 {
  margin: 0;
  color: #cfc8ed;
  font-size: 0.72rem;
}

.brain-voice-interpretation {
  display: grid;
  gap: 6px;
  padding: 9px 10px;
  border: 1px solid rgba(174, 184, 197, 0.18);
  border-radius: 10px;
  background: rgba(31, 33, 46, 0.64);
}

.brain-voice-relationship--historical-terminal-interpretation {
  border-style: dashed;
  border-color: rgba(148, 163, 184, 0.34);
  background: rgba(30, 32, 39, 0.46);
}

.brain-voice-relationship--unknown {
  opacity: 0.82;
}

.brain-voice-interpretation-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.brain-voice-interpretation-head strong {
  font-size: 0.75rem;
}

.brain-voice-interpretation-head span,
.brain-voice-interpretation small,
.brain-voice-expectations small {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.62rem;
}

.brain-voice-interpretation-head span,
.brain-voice-expectations small {
  opacity: 0.72;
}

.brain-voice-expectation-group {
  display: grid;
  gap: 6px;
  padding-top: 8px;
  border-top: 1px solid rgba(174, 184, 197, 0.15);
}

.brain-voice-expectation-group:first-of-type {
  padding-top: 0;
  border-top: 0;
}

.brain-voice-expectation-group h4,
.brain-voice-technical h4 {
  font-size: 0.72rem;
}

.brain-voice-expectations li {
  display: grid;
  gap: 2px;
}

.brain-voice-state-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.brain-voice-state-grid span {
  padding: 4px 7px;
  border-radius: 8px;
  background: rgba(139, 124, 196, 0.1);
  color: #cfc8ed;
  font-family: var(--mono);
  font-size: 0.65rem;
}

.brain-voice-anomalies {
  border-color: rgba(245, 158, 11, 0.35);
  background: rgba(120, 53, 15, 0.12);
}

.brain-voice-technical {
  padding: 10px 12px;
  border: 1px solid rgba(174, 184, 197, 0.2);
  border-radius: 12px;
  background: rgba(18, 19, 28, 0.32);
}

.brain-voice-technical summary {
  display: flex;
  align-items: center;
  min-block-size: 34px;
  color: #cfc8ed;
  cursor: pointer;
  font-size: 0.74rem;
  font-weight: 760;
}

.brain-voice-technical-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
  margin: 10px 0;
}

.brain-voice-technical-grid > div {
  display: grid;
  gap: 3px;
  padding: 7px;
  border: 1px solid rgba(174, 184, 197, 0.14);
  border-radius: 8px;
}

.brain-voice-technical-grid label {
  color: var(--muted);
  font-size: 0.6rem;
  text-transform: uppercase;
}

.brain-voice-technical-grid span,
.brain-voice-technical-list,
.brain-voice-lineage {
  overflow-wrap: anywhere;
  color: #d8dee7;
  font-family: var(--mono);
  font-size: 0.63rem;
}

@media (max-width: 900px) {
  .brain-voice-card {
    block-size: clamp(22rem, 52dvh, 30rem);
  }

  .brain-voice-header {
    flex-direction: column;
  }

  .brain-voice-badges {
    justify-content: flex-start;
  }

  .brain-voice-related-grid,
  .brain-voice-technical-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .brain-voice-reader-toggle,
  .brain-voice-technical summary {
    min-block-size: 44px;
  }
}
