/* ==========================================================================
   Déjà Vu — incident memory with receipts
   Light, editorial, built to be readable on a projector.
   ========================================================================== */

:root {
  --bg: #f4f5f8;
  --bg-soft: #ffffff;
  --panel: #ffffff;
  --panel-2: #f0f1f5;
  --line: #dde0e6;
  --line-soft: #e7e9ef;
  --text: #0f1117;
  --text-dim: #3a3f4a;
  --muted: #6b7280;
  --accent: #ff5c1a;
  --accent-soft: rgba(255, 92, 26, 0.10);
  --accent-line: rgba(255, 92, 26, 0.40);
  --good: #16a34a;
  --good-soft: rgba(22, 163, 74, 0.12);
  --bad: #dc2626;
  --bad-soft: rgba(220, 38, 38, 0.10);
  --warn: #b45309;
  --warn-soft: rgba(180, 83, 9, 0.10);
  --blue: #2563eb;
  --mono: "Cascadia Mono", "JetBrains Mono", Consolas, "SF Mono", ui-monospace, monospace;
  --sans: "Segoe UI", system-ui, -apple-system, Inter, Roboto, sans-serif;
  --r: 14px;
  --shadow: 0 24px 60px -24px rgba(0, 0, 0, 0.18);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

body {
  background:
    radial-gradient(1100px 620px at 78% -12%, rgba(255, 92, 26, 0.08), transparent 62%),
    radial-gradient(900px 500px at -8% 8%, rgba(37, 99, 235, 0.06), transparent 60%),
    radial-gradient(700px 400px at 50% 110%, rgba(255, 92, 26, 0.04), transparent 60%),
    var(--bg);
  overflow: hidden;
  perspective: 1400px;
  animation: bgShift 20s ease-in-out infinite alternate;
}

@keyframes bgShift {
  0% { background-position: 0% 0%, 100% 0%, 50% 100%, 0 0; }
  100% { background-position: 10% 5%, 90% 10%, 50% 95%, 0 0; }
}

::selection { background: rgba(255, 92, 26, 0.32); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d4d7de; border-radius: 8px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #b8bcc6; }

.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  max-width: 1680px;
  margin: 0 auto;
}

/* ---------------------------------------------------------------- topbar */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 16px 26px 14px;
  border-bottom: 1px solid var(--line-soft);
  flex: 0 0 auto;
}

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

.mark {
  width: 38px;
  height: 38px;
  color: var(--accent);
  flex: 0 0 auto;
  filter: drop-shadow(0 0 18px rgba(255, 92, 26, 0.45));
}

.brand-text h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.brand-text p {
  margin: 3px 0 0;
  font-size: 11.5px;
  color: var(--muted);
  letter-spacing: 0.02em;
}

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

.badges { display: flex; gap: 7px; margin-right: 6px; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  font-size: 11.5px;
  font-family: var(--mono);
  color: var(--text-dim);
  white-space: nowrap;
}

.badge .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted);
  box-shadow: 0 0 0 3px rgba(118, 124, 137, 0.14);
}

.badge.ok .dot { background: var(--good); box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.16); }
.badge.ok { color: #b7f0d7; border-color: rgba(52, 211, 153, 0.3); }
.badge.warn .dot { background: var(--warn); box-shadow: 0 0 0 3px rgba(245, 181, 68, 0.16); }
.badge.warn { color: #f7d9a0; border-color: rgba(245, 181, 68, 0.3); }
.badge.bad .dot { background: var(--bad); box-shadow: 0 0 0 3px rgba(255, 84, 104, 0.16); }
.badge.bad { color: #ffc0c7; border-color: rgba(255, 84, 104, 0.32); }
.badge.neutral { color: var(--text-dim); }

/* ---------------------------------------------------------------- buttons */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  padding: 9px 15px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 550;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.16s ease, border-color 0.16s ease, transform 0.08s ease, box-shadow 0.2s ease;
  white-space: nowrap;
}

.btn:hover { background: #eef0f4; border-color: #c8ccd4; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

.btn.primary {
  background: linear-gradient(180deg, #ff6a2b, #f04c0c);
  border-color: #ff7a3f;
  color: #fff;
  box-shadow: 0 8px 24px -10px rgba(255, 92, 26, 0.85);
}

.btn.primary:hover { background: linear-gradient(180deg, #ff7b41, #fb5a17); border-color: #ff8b57; }

.btn.ghost { background: transparent; color: var(--text-dim); }
.btn.ghost:hover { background: var(--panel); color: var(--text); }

.btn.lg { padding: 12px 22px; font-size: 14px; border-radius: 10px; }

.btn.subtle {
  background: transparent;
  border-color: transparent;
  color: var(--muted);
  padding: 6px 9px;
  font-size: 12px;
}
.btn.subtle:hover { color: var(--text); background: var(--panel-2); }

.icon-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--muted);
  width: 30px;
  height: 30px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
}
.icon-btn:hover { background: var(--panel-2); color: var(--text); }

/* ------------------------------------------------------------------ tabs */

.tabs {
  display: flex;
  gap: 4px;
  padding: 0 26px;
  border-bottom: 1px solid var(--line-soft);
  flex: 0 0 auto;
}

.tab {
  position: relative;
  background: none;
  border: 0;
  color: var(--muted);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 550;
  padding: 13px 14px 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: color 0.15s ease;
}

.tab:hover { color: var(--text-dim); }

.tab.active { color: var(--text); }

.tab.active::after {
  content: "";
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: -1px;
  height: 2px;
  border-radius: 2px;
  background: var(--accent);
  box-shadow: 0 0 14px rgba(255, 92, 26, 0.7);
}

.tab .count {
  font-family: var(--mono);
  font-size: 10.5px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--text-dim);
  padding: 1px 6px;
  border-radius: 999px;
}

/* ----------------------------------------------------------------- panels */

main { flex: 1 1 auto; min-height: 0; position: relative; }

.panel { display: none; height: 100%; min-height: 0; }
.panel.active { display: flex; }

.panel.page {
  display: none;
  flex-direction: column;
  overflow-y: auto;
  padding: 22px 26px 30px;
  gap: 16px;
}
.panel.page.active { display: flex; }

/* -------------------------------------------------------------- live rail */

.rail {
  width: 288px;
  flex: 0 0 288px;
  border-right: 1px solid var(--line-soft);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.rail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px 12px;
}

.rail-head h2 {
  margin: 0;
  font-size: 11px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}

.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--good);
}
.live-pill i {
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--good);
  animation: blink 1.8s ease-in-out infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.5); }
  50% { opacity: 0.45; box-shadow: 0 0 0 4px rgba(52, 211, 153, 0); }
}

.alert-list {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 0 10px 10px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.alert-item {
  text-align: left;
  border: 1px solid transparent;
  background: transparent;
  border-radius: 10px;
  padding: 10px 11px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-family: inherit;
  color: var(--text);
  transition: background 0.14s ease, border-color 0.14s ease;
}

.alert-item:hover { background: var(--panel); border-color: var(--line-soft); }
.alert-item.active { background: var(--panel-2); border-color: #2e333f; }

.alert-item .ai-top {
  display: flex;
  align-items: center;
  gap: 7px;
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--muted);
}

.alert-item .ai-title {
  font-size: 12.8px;
  line-height: 1.35;
  color: var(--text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.alert-item.active .ai-title { color: var(--text); }

.sev {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.06em;
  padding: 2px 5px;
  border-radius: 4px;
  border: 1px solid;
}
.sev.SEV-1 { color: #ff9aa5; border-color: rgba(255, 84, 104, 0.4); background: var(--bad-soft); }
.sev.SEV-2 { color: #f7cf8d; border-color: rgba(245, 181, 68, 0.35); background: var(--warn-soft); }
.sev.SEV-3 { color: var(--text-dim); border-color: var(--line); background: var(--panel); }

.status-dot {
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--accent);
  margin-left: auto;
  flex: 0 0 auto;
}
.status-dot.resolved { background: var(--good); }

.rail-note {
  margin: 8px 14px 16px;
  padding: 12px 13px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.03);
}
.rail-note strong {
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}
.rail-note p {
  margin: 6px 0 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--muted);
}

/* ------------------------------------------------------------------ stage */

.stage {
  flex: 1 1 auto;
  min-width: 0;
  overflow-y: auto;
  padding: 22px 26px 90px;
}

.empty {
  height: 100%;
  min-height: 380px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 4px;
}

.empty-ring {
  width: 92px;
  height: 92px;
  border-radius: 50%;
  border: 1px solid rgba(255, 92, 26, 0.35);
  box-shadow:
    0 0 0 12px rgba(255, 92, 26, 0.05),
    0 0 0 30px rgba(255, 92, 26, 0.025),
    0 0 42px rgba(255, 92, 26, 0.18) inset;
  margin-bottom: 22px;
  position: relative;
  animation: breathe 3.6s ease-in-out infinite;
}

.empty-ring::after {
  content: "";
  position: absolute;
  inset: 38px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 22px rgba(255, 92, 26, 0.9);
}

@keyframes breathe {
  0%, 100% { transform: scale(1); opacity: 0.9; }
  50% { transform: scale(1.05); opacity: 1; }
}

.empty h2 { margin: 0; font-size: 20px; font-weight: 600; letter-spacing: -0.01em; }
.empty p {
  margin: 6px 0 20px;
  max-width: 430px;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.6;
}

/* ---------------------------------------------------------- alert summary */

.alert-summary {
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  padding: 18px 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

.as-top {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.as-id { font-family: var(--mono); font-size: 11px; color: var(--muted); }

.as-title {
  margin: 0 0 8px;
  font-size: 20px;
  font-weight: 620;
  letter-spacing: -0.015em;
  line-height: 1.3;
}

.as-body {
  margin: 0;
  font-size: 13.2px;
  line-height: 1.6;
  color: var(--text-dim);
  max-width: 980px;
}

.sig-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 13px;
}

.sig {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-dim);
  background: #f7f8fa;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  padding: 4px 8px;
}
.sig b { color: var(--text); font-weight: 600; }

/* ------------------------------------------------------------------ split */

.split {
  display: grid;
  grid-template-columns: 1fr 1.35fr;
  gap: 16px;
  align-items: stretch;
}

.mode-col {
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--panel);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 440px;
}

@media (max-width: 1180px) {
  .split { grid-template-columns: 1fr; }
  .rail { width: 250px; flex-basis: 250px; }
}

.mode-col.on {
  border-color: rgba(255, 92, 26, 0.4);
  box-shadow: 0 0 0 1px rgba(255, 92, 26, 0.08), 0 30px 70px -40px rgba(255, 92, 26, 0.5);
}

.mode-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line-soft);
  background: rgba(0, 0, 0, 0.025);
}

.mode-tag {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 3px 7px;
  border-radius: 5px;
  border: 1px solid var(--line);
  color: var(--muted);
  background: #f7f8fa;
}

.mode-col.on .mode-tag {
  color: #ffb591;
  border-color: rgba(255, 92, 26, 0.4);
  background: var(--accent-soft);
}

.mode-title { font-size: 13px; font-weight: 600; }
.mode-sub { font-size: 11.5px; color: var(--muted); margin-left: auto; font-family: var(--mono); }

.mode-body { padding: 16px; display: flex; flex-direction: column; gap: 14px; }

.run-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 44px 20px;
  text-align: center;
  flex: 1 1 auto;
}

.run-wrap p {
  margin: 0;
  font-size: 12.5px;
  color: var(--muted);
  max-width: 260px;
  line-height: 1.55;
}

/* ------------------------------------------------------------- hypothesis */

.hyp-label {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 7px;
}

.hyp-title {
  margin: 0;
  font-size: 19px;
  font-weight: 630;
  line-height: 1.3;
  letter-spacing: -0.015em;
}

.mode-col.on .hyp-title { color: #fff; }

.conf-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
}

.conf-bar {
  flex: 1 1 auto;
  height: 5px;
  border-radius: 999px;
  background: #e2e5ea;
  overflow: hidden;
}

.conf-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #ff8a3d, var(--accent));
  box-shadow: 0 0 12px rgba(255, 92, 26, 0.6);
  transition: width 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.conf-num {
  font-family: var(--mono);
  font-size: 12px;
  color: #ffb591;
  min-width: 34px;
  text-align: right;
}

.meta-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--text-dim);
  border: 1px solid var(--line);
  background: #f7f8fa;
  border-radius: 6px;
  padding: 4px 7px;
}

.chip.good { color: #9defc9; border-color: rgba(52, 211, 153, 0.28); background: var(--good-soft); }
.chip.warn { color: #f7d9a0; border-color: rgba(245, 181, 68, 0.3); background: var(--warn-soft); }
.chip.bad { color: #ffb3bd; border-color: rgba(255, 84, 104, 0.3); background: var(--bad-soft); }

.narrative {
  font-size: 13.4px;
  line-height: 1.68;
  color: var(--text-dim);
  margin: 0;
  padding-left: 12px;
  border-left: 2px solid rgba(255, 92, 26, 0.35);
}

.narrative em { color: var(--text); font-style: normal; font-weight: 550; }

.first-action {
  border: 1px solid rgba(255, 92, 26, 0.32);
  background: linear-gradient(180deg, rgba(255, 92, 26, 0.1), rgba(255, 92, 26, 0.03));
  border-radius: 10px;
  padding: 12px 13px;
}

.fa-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #ff9c6b;
  margin-bottom: 6px;
}

.fa-text { font-size: 13.6px; line-height: 1.5; color: #ffe7db; }

.section-title {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 4px 0 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-title::after {
  content: "";
  flex: 1 1 auto;
  height: 1px;
  background: var(--line-soft);
}

/* ---------------------------------------------------------------- generic */

.off-card {
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  padding: 13px;
  background: #f7f8fa;
}

.off-list { margin: 10px 0 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 9px; }

.off-list li {
  font-size: 12.8px;
  line-height: 1.5;
  color: var(--muted);
  padding-left: 18px;
  position: relative;
}

.off-list li::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 7px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #3a404c;
}

.verdict {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: 9px;
  font-size: 12.5px;
  line-height: 1.45;
  border: 1px solid var(--bad-soft);
  background: rgba(255, 84, 104, 0.06);
  color: #ffc2ca;
}

.verdict.good {
  border-color: rgba(52, 211, 153, 0.28);
  background: var(--good-soft);
  color: #a9f0d3;
}

/* ---------------------------------------------------------------- receipts */

.receipts { display: flex; flex-direction: column; gap: 8px; }

.receipt {
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: #f7f8fa;
  padding: 10px 12px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 4px 12px;
  align-items: center;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.receipt:hover { border-color: #c8ccd4; background: #f4f5f8; }

.receipt .rid {
  font-family: var(--mono);
  font-size: 11px;
  color: #ffb591;
  white-space: nowrap;
}

.receipt .rcause {
  font-size: 12.6px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.receipt .rscore {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--muted);
  white-space: nowrap;
}

.receipt .rmeta {
  grid-column: 2 / -1;
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--muted);
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.receipt .rmeta .ok { color: var(--good); }
.receipt .rmeta .no { color: var(--bad); }
.receipt .rmeta .stale { color: var(--warn); }

.receipt-row {
  display: flex;
  align-items: baseline;
  gap: 4px;
  font-size: 11.5px;
  color: var(--text-dim);
  padding: 7px 0;
  border-bottom: 1px dashed var(--line-soft);
}
.receipt-row:last-child { border-bottom: 0; }
.receipt-row .rlabel {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  min-width: 74px;
}

/* ------------------------------------------------------------- timeline */

.timeline {
  position: relative;
  height: 34px;
  margin: 10px 2px 12px;
}

.tl-line {
  position: absolute;
  left: 0;
  right: 0;
  top: 12px;
  height: 1px;
  background: linear-gradient(90deg, #dde0e6, #c8ccd4);
}

.tl-dot {
  position: absolute;
  top: 8.5px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  transform: translateX(-50%);
  border: 1.5px solid #f7f8fa;
}
.tl-dot.ok { background: var(--good); box-shadow: 0 0 8px rgba(52, 211, 153, 0.45); }
.tl-dot.warn { background: var(--warn); box-shadow: 0 0 8px rgba(245, 181, 68, 0.45); }

.tl-now {
  position: absolute;
  top: 6px;
  width: 1px;
  height: 13px;
  background: var(--accent);
  transform: translateX(-1px);
  box-shadow: 0 0 10px rgba(255, 92, 26, 0.8);
}

.tl-label {
  position: absolute;
  top: 20px;
  font-family: var(--mono);
  font-size: 8.5px;
  color: #6b7280;
  white-space: nowrap;
}
.tl-label.start { left: 0; }
.tl-label.end { right: 0; color: #ff9c6b; }

.tl-mid {
  position: absolute;
  right: 0;
  top: -3px;
  font-family: var(--mono);
  font-size: 8.5px;
  color: #4d535f;
}

/* ------------------------------------------------------------ contradiction */

.contradiction {
  border: 1px solid rgba(245, 181, 68, 0.32);
  background: linear-gradient(180deg, rgba(245, 181, 68, 0.09), rgba(245, 181, 68, 0.02));
  border-radius: 10px;
  padding: 12px 13px;
}

.cd-head {
  display: flex;
  align-items: center;
  gap: 7px;
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #f7cf8d;
  margin-bottom: 7px;
}

.cd-title { font-size: 12.8px; line-height: 1.55; color: #ffe9c4; }
.cd-title b { color: #fff; font-weight: 600; }

.cd-note {
  margin-top: 8px;
  font-size: 11.8px;
  line-height: 1.55;
  color: #c9b48d;
}

/* ----------------------------------------------------------------- avoid */

.avoid-card {
  border: 1px solid rgba(255, 84, 104, 0.28);
  background: rgba(255, 84, 104, 0.05);
  border-radius: 10px;
  padding: 12px 13px;
}

.avoid-card .cd-head { color: #ffb3bd; }
.avoid-card p { margin: 0; font-size: 12.6px; line-height: 1.55; color: #ffd3d8; }

/* ------------------------------------------------------------------ steps */

.steps { display: flex; flex-direction: column; gap: 0; }

.step {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 0 12px;
  padding-bottom: 14px;
  position: relative;
}

.step:last-child { padding-bottom: 0; }

.step .num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 1;
}

.step:not(:last-child)::before {
  content: "";
  position: absolute;
  left: 10.5px;
  top: 22px;
  bottom: 0;
  width: 1px;
  background: var(--line-soft);
}

.step .st-text { font-size: 12.9px; line-height: 1.5; padding-top: 1px; }
.step .st-why {
  margin-top: 3px;
  font-size: 11.6px;
  line-height: 1.5;
  color: var(--muted);
}
.step .st-src {
  display: inline-block;
  margin-top: 5px;
  font-family: var(--mono);
  font-size: 10px;
  color: #ffb591;
  background: var(--accent-soft);
  border: 1px solid rgba(255, 92, 26, 0.25);
  border-radius: 5px;
  padding: 2px 6px;
}

/* ------------------------------------------------------------------ trace */

.trace {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
  border-top: 1px solid var(--line-soft);
  padding-top: 11px;
}

.trace .tr {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 7px;
  border-radius: 5px;
  background: #f7f8fa;
  border: 1px solid var(--line-soft);
}
.trace .tr b { color: var(--text-dim); font-weight: 500; }
.trace .arr { color: #3a404c; }

/* ------------------------------------------------------------- page heads */

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.page-head h2 { margin: 0; font-size: 21px; font-weight: 620; letter-spacing: -0.02em; }

.sub {
  margin: 6px 0 0;
  font-size: 13.2px;
  line-height: 1.6;
  color: var(--muted);
  max-width: 760px;
}

.sub em { color: var(--text-dim); font-style: normal; }

.searchbox {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 9px;
  padding: 0 12px;
  min-width: 300px;
  color: var(--muted);
}
.searchbox:focus-within { border-color: var(--accent-line); box-shadow: 0 0 0 3px rgba(255, 92, 26, 0.08); }
.searchbox input {
  flex: 1 1 auto;
  background: none;
  border: 0;
  outline: 0;
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  padding: 10px 0;
}
.searchbox input::placeholder { color: #5c626e; }

/* ------------------------------------------------------------------ stats */

.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

.stat {
  border: 1px solid var(--line-soft);
  background: var(--panel);
  border-radius: 11px;
  padding: 13px 15px;
}

.stat .s-label {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.stat .s-value {
  font-size: 24px;
  font-weight: 620;
  letter-spacing: -0.02em;
  margin-top: 5px;
  line-height: 1;
}
.stat .s-value small { font-size: 12px; font-weight: 500; color: var(--muted); margin-left: 3px; letter-spacing: 0; }
.stat .s-value.accent { color: var(--accent); }
.stat .s-value.good { color: var(--good); }
.stat .s-note { font-size: 11px; color: var(--muted); margin-top: 6px; }

/* ----------------------------------------------------------------- memory */

.memory-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 10px;
}

.mem-card {
  border: 1px solid var(--line-soft);
  background: var(--panel);
  border-radius: 11px;
  padding: 13px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color 0.15s ease, transform 0.18s ease, box-shadow 0.18s ease;
  transform-style: preserve-3d;
}

.mem-card:hover { border-color: #c8ccd4; transform: translateY(-4px) rotateX(3deg); box-shadow: 0 22px 46px rgba(0, 0, 0, 0.5); }

.receipt { transition: transform 0.18s ease, border-color 0.18s ease; }
.receipt:hover { transform: translateX(5px); border-color: rgba(255, 92, 26, 0.35); }

.br-msg { transition: transform 0.18s ease; }
.br-msg:hover { transform: translateX(4px); }

.mc-top {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--muted);
}
.mc-badges {
  margin-left: auto;
  display: flex;
  gap: 6px;
  align-items: center;
}
.chip.repeat {
  color: var(--accent-ink);
  background: var(--accent-soft);
  border-color: rgba(234, 83, 31, 0.3);
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.mc-cause { font-size: 13.4px; font-weight: 570; line-height: 1.4; }

.mc-fix {
  font-size: 12.3px;
  line-height: 1.5;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.mc-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--muted);
  margin-top: 2px;
}

.mc-foot .who { color: var(--text-dim); }

/* ------------------------------------------------------------------- card */

.card {
  border: 1px solid var(--line-soft);
  background: var(--panel);
  border-radius: var(--r);
  padding: 16px 18px;
}

.card h3 {
  margin: 0 0 12px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.005em;
}
.card h3.good { color: #9defc9; }
.card h3.bad { color: #ffb3bd; }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 900px) { .two-col { grid-template-columns: 1fr; } .searchbox { min-width: 0; width: 100%; } }

.chart-card { padding-bottom: 12px; }

.chart-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 6px;
}
.chart-head h3 { margin: 0; font-size: 13px; font-weight: 600; }

.legend {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
}

.swatch { width: 7px; height: 7px; border-radius: 2px; display: inline-block; }
.swatch.ok { background: var(--good); margin-left: 8px; }
.swatch.bad { background: var(--bad); margin-left: 8px; }

#chart { width: 100%; }
#chart svg { display: block; width: 100%; height: auto; max-height: 340px; overflow: visible; }

.samples { display: flex; flex-direction: column; gap: 8px; }

.sample {
  border: 1px solid var(--line-soft);
  background: #f7f8fa;
  border-radius: 9px;
  padding: 9px 11px;
}
.sample .sm-top {
  display: flex;
  gap: 8px;
  align-items: center;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
  margin-bottom: 4px;
}
.sample .sm-text { font-size: 12.3px; line-height: 1.45; color: var(--text-dim); }
.sample .sm-text b { color: var(--text); font-weight: 550; }

/* ------------------------------------------------------------------ table */

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

.table { width: 100%; border-collapse: collapse; font-size: 12.6px; }

.table thead th {
  text-align: left;
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 500;
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.025);
  position: sticky;
  top: 0;
  backdrop-filter: blur(6px);
  z-index: 1;
}
.table thead th.r { text-align: right; }

.table tbody td {
  padding: 9px 14px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--text-dim);
  vertical-align: middle;
}
.table tbody tr:hover td { background: rgba(0, 0, 0, 0.03); }
.table tbody tr:last-child td { border-bottom: 0; }

.table .tid { font-family: var(--mono); font-size: 11px; color: #ffb591; white-space: nowrap; }
.table .tsvc { font-family: var(--mono); font-size: 11px; color: var(--muted); white-space: nowrap; }
.table .ttitle { color: var(--text); }
.table .tclass { font-size: 11.5px; color: var(--muted); }
.table .r { text-align: right; font-family: var(--mono); font-size: 11px; }

.pill-out {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.04em;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid;
  white-space: nowrap;
}
.pill-out.resolved { color: #9defc9; border-color: rgba(52, 211, 153, 0.3); background: var(--good-soft); }
.pill-out.recurred { color: #f7d9a0; border-color: rgba(245, 181, 68, 0.3); background: var(--warn-soft); }
.pill-out.made_it_worse { color: #ffb3bd; border-color: rgba(255, 84, 104, 0.3); background: var(--bad-soft); }

/* -------------------------------------------------------------------- bus */

.bus {
  flex: 0 0 auto;
  border-top: 1px solid var(--line);
  background: rgba(10, 11, 13, 0.94);
  backdrop-filter: blur(10px);
  z-index: 20;
}

.bus-head {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  background: none;
  border: 0;
  color: var(--text-dim);
  font-family: inherit;
  font-size: 11.5px;
  padding: 9px 26px;
  cursor: pointer;
}
.bus-head:hover { background: rgba(255, 255, 255, 0.02); }

.bus-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.pulse {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 rgba(255, 92, 26, 0.6);
  animation: busPulse 2.4s infinite;
}

@keyframes busPulse {
  0% { box-shadow: 0 0 0 0 rgba(255, 92, 26, 0.55); }
  70% { box-shadow: 0 0 0 6px rgba(255, 92, 26, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 92, 26, 0); }
}

.bus-meta { font-family: var(--mono); font-size: 10.5px; color: #4d535f; }
.chev { margin-left: auto; color: #4d535f; transition: transform 0.2s ease; font-size: 10px; }
.bus.open .chev { transform: rotate(180deg); }

.bus-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.28s ease;
}
.bus.open .bus-body { max-height: 190px; overflow-y: auto; }

.bus-log { padding: 0 20px 12px; display: flex; flex-direction: column; gap: 1px; }

.bus-line {
  display: grid;
  grid-template-columns: 62px 58px 1fr auto;
  gap: 12px;
  font-family: var(--mono);
  font-size: 10.5px;
  padding: 3px 6px;
  border-radius: 4px;
  color: var(--muted);
  align-items: baseline;
}
.bus-line:hover { background: rgba(255, 255, 255, 0.025); }
.bus-line .b-op { color: var(--text-dim); text-transform: uppercase; font-size: 9.5px; letter-spacing: 0.08em; }
.bus-line .b-op.retain { color: #ffb591; }
.bus-line .b-op.recall { color: #8fc4ff; }
.bus-line .b-q { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #6b7280; }
.bus-line .b-meta { color: #4d535f; white-space: nowrap; }
.bus-line .b-meta .hs { color: var(--good); }

/* ------------------------------------------------------------------ modal */

.modal-wrap {
  position: fixed;
  inset: 0;
  background: rgba(5, 6, 8, 0.72);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 24px;
  animation: fade 0.16s ease;
}
.modal-wrap.hidden { display: none; }

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.modal {
  width: 100%;
  max-width: 480px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 22px 22px 20px;
  box-shadow: 0 40px 100px -30px #000;
  animation: rise 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
  max-height: 90vh;
  overflow-y: auto;
}

@keyframes rise {
  from { transform: translateY(10px) scale(0.99); opacity: 0; }
  to { transform: none; opacity: 1; }
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.modal-head h3 { margin: 0; font-size: 16.5px; font-weight: 620; letter-spacing: -0.015em; }

.modal-sub {
  margin: 8px 0 18px;
  font-size: 12.8px;
  line-height: 1.6;
  color: var(--muted);
}

#resolveForm { display: flex; flex-direction: column; gap: 12px; }

#resolveForm label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

#resolveForm input,
#resolveForm select {
  background: #f7f8fa;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 11px;
  color: var(--text);
  font-family: var(--sans);
  font-size: 13.2px;
  outline: 0;
  text-transform: none;
  letter-spacing: normal;
}

#resolveForm input:focus,
#resolveForm select:focus {
  border-color: var(--accent-line);
  box-shadow: 0 0 0 3px rgba(255, 92, 26, 0.06);
}

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 6px;
}

/* ----------------------------------------------------------------- toasts */

.toasts {
  position: fixed;
  right: 22px;
  bottom: 56px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 120;
  pointer-events: none;
}

.toast {
  border: 1px solid var(--line);
  background: #f0f1f5;
  border-radius: 10px;
  padding: 11px 14px;
  font-size: 12.8px;
  color: var(--text);
  box-shadow: 0 20px 50px -20px #000;
  animation: toastIn 0.24s cubic-bezier(0.2, 0.8, 0.2, 1);
  max-width: 380px;
  display: flex;
  align-items: center;
  gap: 9px;
}
.toast.out { animation: toastOut 0.2s ease forwards; }
.toast .tdot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); flex: 0 0 auto; }
.toast.good { border-color: rgba(52, 211, 153, 0.35); }
.toast.good .tdot { background: var(--good); }
.toast.bad { border-color: rgba(255, 84, 104, 0.35); }
.toast.bad .tdot { background: var(--bad); }

@keyframes toastIn {
  from { transform: translateY(8px); opacity: 0; }
  to { transform: none; opacity: 1; }
}
@keyframes toastOut {
  to { transform: translateY(6px); opacity: 0; }
}

/* --------------------------------------------------------------- skeleton */

.skeleton {
  border-radius: 8px;
  background: linear-gradient(90deg, #eef0f4 25%, #e2e5ea 37%, #eef0f4 63%);
  background-size: 400% 100%;
  animation: shimmer 1.3s ease infinite;
}
@keyframes shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: 0 0; }
}

.spinner {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 2px solid rgba(0, 0, 0, 0.12);
  border-top-color: var(--accent);
  animation: spin 0.7s linear infinite;
  flex: 0 0 auto;
}
.btn .spinner { border-top-color: #fff; }
@keyframes spin { to { transform: rotate(360deg); } }

.fade-in { animation: fadeIn 0.3s ease; }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

.mono { font-family: var(--mono); }
.muted { color: var(--muted); }

/* ==========================================================================
   Interaction layer
   ========================================================================== */

.play {
  font-size: 9px;
  line-height: 1;
  position: relative;
  top: -0.5px;
  color: rgba(255, 255, 255, 0.9);
}

/* ------------------------------------------------------- off/on verdict bar */

.verdict-strip {
  display: grid;
  grid-template-columns: 1fr auto 1.4fr;
  align-items: stretch;
  gap: 10px;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(180deg, #f4f5f8, #ffffff);
  padding: 11px 13px;
}

.vs-side { display: flex; flex-direction: column; gap: 2px; min-width: 0; }

.vs-tag {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.vs-side.on .vs-tag { color: #ff9c6b; }

.vs-text {
  font-size: 13px;
  font-weight: 560;
  color: var(--text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.vs-side.on .vs-text { color: #fff; }
.vs-side.off .vs-text { color: #5a606c; text-decoration: line-through; text-decoration-color: rgba(255, 84, 104, 0.55); }

.vs-meta {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.vs-arrow {
  display: flex;
  align-items: center;
  color: var(--accent);
  font-size: 15px;
  padding: 0 4px;
}

@media (max-width: 900px) {
  .verdict-strip { grid-template-columns: 1fr; }
  .vs-arrow { justify-content: center; }
}

/* --------------------------------------------------------- recall animation */

.recall {
  border: 1px solid rgba(255, 92, 26, 0.26);
  background: linear-gradient(180deg, rgba(255, 92, 26, 0.05), rgba(255, 92, 26, 0.01));
  border-radius: 11px;
  padding: 14px 15px;
  min-height: 170px;
}

.recall-head {
  display: flex;
  align-items: center;
  gap: 9px;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  color: #ff9c6b;
  text-transform: uppercase;
  margin-bottom: 13px;
}
.recall-head b { color: #ffc4a8; font-weight: 600; letter-spacing: 0; text-transform: none; }

.recall-lines { display: flex; flex-direction: column; gap: 9px; }

.recall-line {
  display: flex;
  align-items: center;
  gap: 9px;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--text-dim);
  animation: fadeIn 0.22s ease;
}

.recall-line .rl-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  flex: 0 0 auto;
  box-shadow: 0 0 8px rgba(255, 92, 26, 0.8);
}

.recall-line .rl-ms {
  margin-left: auto;
  color: #4d535f;
  font-size: 10px;
}

/* ---------------------------------------------------------------- ring */

.hyp-head { display: flex; align-items: flex-start; gap: 14px; }

.ring { position: relative; width: 64px; height: 64px; flex: 0 0 auto; }

.ring-num {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 600;
  color: #ffd2ba;
  letter-spacing: -0.03em;
}
.ring-num span { font-size: 8px; color: var(--muted); margin-left: 1px; margin-top: 4px; }

/* ------------------------------------------------------ signal fingerprint */

.fingerprint {
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: #f7f8fa;
  overflow: hidden;
}

.fp-head,
.fp-row {
  display: grid;
  grid-template-columns: 1.15fr 0.9fr 1fr 74px;
  gap: 10px;
  align-items: center;
  padding: 6px 12px;
  font-family: var(--mono);
  font-size: 10.5px;
}

.fp-head {
  color: #6b7280;
  font-size: 9px;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--line-soft);
  padding-top: 8px;
  padding-bottom: 7px;
}

.fp-bar-h { text-align: right; padding-right: 1px; }

.fp-row + .fp-row { border-top: 1px solid rgba(221, 224, 230, 0.8); }

.fp-k { color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fp-v { color: var(--text); }
.fp-v.dim { color: var(--muted); }

.fp-bar {
  height: 4px;
  border-radius: 999px;
  background: #e2e5ea;
  overflow: hidden;
}
.fp-bar i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: #3a404c;
  transition: width 0.5s ease;
}
.fp-row.match .fp-bar i { background: var(--good); }
.fp-row.close .fp-bar i { background: var(--warn); }
.fp-row.diff .fp-bar i { background: var(--bad); }
.fp-row.absent .fp-k { color: #5c626e; }

.fp-foot {
  padding: 8px 12px;
  border-top: 1px solid var(--line-soft);
  font-size: 10.5px;
  color: #6b7280;
  line-height: 1.45;
}

/* ---------------------------------------------------------------- resolve */

.resolve-cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border: 1px dashed var(--line);
  border-radius: 11px;
  padding: 12px 14px;
  background: rgba(0, 0, 0, 0.025);
}
.resolve-cta strong { display: block; font-size: 12.8px; font-weight: 600; }
.resolve-cta span { display: block; font-size: 11.6px; color: var(--muted); margin-top: 2px; line-height: 1.45; }

/* ---------------------------------------------------------------- filters */

.filters { display: flex; flex-wrap: wrap; gap: 6px; }

.filter {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.04em;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 11px;
  cursor: pointer;
  transition: all 0.14s ease;
}
.filter:hover { color: var(--text-dim); border-color: #c8ccd4; }
.filter.active {
  color: #ffb591;
  border-color: rgba(255, 92, 26, 0.4);
  background: var(--accent-soft);
}

#memoryGrid { display: flex; flex-direction: column; gap: 10px; }
#memoryGrid > .mem-card { width: 100%; }

/* memory page: filters row spans the grid */
#memoryGrid > .filters { margin-bottom: 2px; }

.keys {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 9px;
  margin-top: 9px;
  font-family: var(--mono);
  font-size: 9.5px;
  color: #6b7280;
}
.keys kbd {
  display: inline-block;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 1px 4px;
  margin-right: 2px;
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 9px;
  background: #f7f8fa;
}

#memoryGrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 10px;
}
#memoryGrid > .filters { grid-column: 1 / -1; }

.mem-card.is-stale { border-color: rgba(245, 181, 68, 0.3); }
.mem-card.is-stale .mc-cause { color: #ffe9c4; }

/* ------------------------------------------------------------- empty states */

.rail-empty {
  padding: 24px 16px;
  text-align: center;
  font-size: 12px;
  line-height: 1.6;
  color: #5c626e;
}

.empty-mini {
  border: 1px dashed var(--line);
  border-radius: 10px;
  padding: 22px;
  text-align: center;
  font-size: 12.5px;
  color: var(--muted);
  grid-column: 1 / -1;
}

/* ------------------------------------------------------------------ table */

.empty-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-top: 6px; }

/* --------------------------------------------------------------- verdict hero */

.verdict-hero {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 18px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(135deg, #f4f5f8, #fafbfc);
  padding: 16px 18px;
  margin-bottom: 16px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.35);
}

.vh-eyebrow {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #6b7280;
  margin-bottom: 10px;
}

.vh-grid {
  display: grid;
  grid-template-columns: 1fr auto 1.5fr;
  gap: 12px;
  align-items: stretch;
}

.vh-col {
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  padding: 11px 13px;
  background: #f7f8fa;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: transform 0.2s ease, border-color 0.2s ease;
}
.vh-col:hover { transform: translateY(-2px); border-color: #c8ccd4; }

.vh-col.on { border-color: rgba(255, 92, 26, 0.3); background: linear-gradient(180deg, rgba(255, 92, 26, 0.06), #f7f8fa); }

.vh-tag {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.vh-tag.on { color: #ff9c6b; }

.vh-head {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
  letter-spacing: -0.01em;
}
.vh-col.off .vh-head { color: #5a606c; text-decoration: line-through; text-decoration-color: rgba(255, 84, 104, 0.45); }

.vh-sub {
  font-size: 11.6px;
  color: var(--muted);
  line-height: 1.5;
}

.vh-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  margin-top: 6px;
  font-family: var(--mono);
  font-size: 9.5px;
  color: #6b7280;
}

.vh-mid {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 4px;
}
.vh-arrow { color: var(--accent); font-size: 18px; }
.vh-saved {
  font-family: var(--mono);
  font-size: 9.5px;
  color: #7ef0c0;
  background: rgba(52, 211, 153, 0.08);
  border: 1px solid rgba(52, 211, 153, 0.3);
  border-radius: 999px;
  padding: 3px 8px;
  white-space: nowrap;
}

.vh-ring { flex: 0 0 auto; }

@media (max-width: 900px) {
  .verdict-hero { grid-template-columns: 1fr; }
  .vh-grid { grid-template-columns: 1fr; }
  .vh-mid { flex-direction: row; }
}

.decision {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid var(--line-soft);
}
.decision .d-label {
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid currentColor;
  white-space: nowrap;
}
.decision .d-reason { font-size: 12.5px; font-weight: 600; color: var(--text); }
.decision .d-check { font-size: 11.5px; color: var(--muted); margin-left: auto; }
.decision.apply { color: var(--good-ink); background: var(--good-soft); border-color: rgba(18, 130, 76, 0.28); }
.decision.verify { color: #8a5a00; background: rgba(245, 181, 68, 0.1); border-color: rgba(245, 181, 68, 0.38); }
.decision.stop { color: var(--bad-ink); background: rgba(192, 41, 47, 0.06); border-color: rgba(192, 41, 47, 0.26); }

@media (max-width: 640px) {
  .decision { flex-direction: column; align-items: flex-start; gap: 6px; }
  .decision .d-check { margin-left: 0; }
}

.mc-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.35;
  letter-spacing: -0.01em;
}

.mc-service {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.04em;
}

.mc-k {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #6b7280;
  margin-right: 6px;
}

.mc-symptom { font-size: 11.6px; color: var(--text-dim); line-height: 1.55; }
.mc-signals {
  font-family: var(--mono);
  font-size: 10px;
  color: #6b7280;
  background: #f7f8fa;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  padding: 5px 8px;
  word-break: break-word;
  line-height: 1.5;
}
.mc-disc {
  font-size: 11.6px;
  color: #2a2f3a;
  background: rgba(245, 181, 68, 0.05);
  border-left: 2px solid rgba(245, 181, 68, 0.4);
  padding: 6px 9px;
  border-radius: 0 6px 6px 0;
  line-height: 1.5;
}

.learned-wrap { margin-bottom: 12px; }
.learned-title {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}
.learned-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 8px;
  margin-bottom: 4px;
}
.learned-card {
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 9px 11px;
  background: var(--panel-2);
  transition: transform 0.18s ease, border-color 0.18s ease;
  transform-style: preserve-3d;
}
.learned-card:hover { transform: translateY(-3px) rotateX(2deg); border-color: var(--accent-line); }
.lc-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 3px; }
.lc-name { font-size: 12px; font-weight: 600; color: var(--text); }
.lc-count {
  font-family: var(--mono);
  font-size: 9.5px;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  border-radius: 999px;
  padding: 2px 7px;
}
.lc-meta { font-family: var(--mono); font-size: 9.5px; color: var(--muted); }

/* --------------------------------------------------------------- band room */

.band-room {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(180deg, #f4f5f8, #fafbfc);
  overflow: hidden;
}

.br-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.025);
}

.br-title {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.br-glyph { color: var(--accent); font-size: 13px; }
.br-chan {
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 400;
  color: var(--muted);
}

.br-right { display: flex; align-items: center; gap: 8px; }

.br-transport {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 8px;
}
.br-transport.live {
  color: #7ef0c0;
  border-color: rgba(52, 211, 153, 0.35);
  background: rgba(52, 211, 153, 0.08);
}

.br-verdict {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.12em;
  border-radius: 999px;
  padding: 3px 9px;
  border: 1px solid;
}
.br-verdict.allow { color: #7ef0c0; border-color: rgba(52, 211, 153, 0.4); background: rgba(52, 211, 153, 0.08); }
.br-verdict.review { color: #ffd08a; border-color: rgba(245, 181, 68, 0.4); background: rgba(245, 181, 68, 0.08); }
.br-verdict.block { color: #ff9aa5; border-color: rgba(255, 84, 104, 0.4); background: rgba(255, 84, 104, 0.08); }

.br-sub {
  padding: 10px 14px 0;
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.5;
}

.br-feed {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 14px;
}

.br-msg {
  border: 1px solid var(--line-soft);
  border-radius: 9px;
  padding: 9px 11px;
  background: #f7f8fa;
}
.br-msg.critic { border-color: rgba(255, 92, 26, 0.24); background: rgba(255, 92, 26, 0.04); }

.br-who { display: flex; align-items: center; gap: 6px; margin-bottom: 5px; }
.br-avatar { font-size: 9px; color: var(--accent); }
.br-author { font-size: 11px; font-weight: 600; }
.br-tag {
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: #6b7280;
  margin-left: auto;
}

.br-body {
  font-size: 11.8px;
  line-height: 1.62;
  color: var(--text-dim);
  word-break: break-word;
}
.br-body b { color: var(--text); font-weight: 600; }
.br-body code {
  font-family: var(--mono);
  font-size: 10.5px;
  color: #ffb591;
  background: rgba(255, 92, 26, 0.08);
  border-radius: 3px;
  padding: 0 3px;
}

.br-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 14px;
  border-top: 1px solid var(--line-soft);
  font-size: 10.5px;
  color: #6b7280;
}
.br-rule { color: var(--text-dim); }
.br-hint { font-family: var(--mono); font-size: 9px; color: #8a909c; }

.table-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}

.searchbox.small { min-width: 220px; padding: 0 10px; }
.searchbox.small input { padding: 7px 0; font-size: 12.5px; }

.table-scroll { max-height: calc(100vh - 300px); overflow-y: auto; }


/* --------------------------------------------------- 3d depth + motion */
.mem-card { transform-style: preserve-3d; }
.mem-card:hover { transform: translateY(-6px) rotateX(4deg) rotateY(-2deg); box-shadow: 0 28px 56px rgba(0, 0, 0, 0.16); border-color: #c8ccd4; }
.vh-col { transform-style: preserve-3d; }
.vh-col:hover { transform: translateY(-4px) rotateX(3deg); box-shadow: 0 16px 32px rgba(0, 0, 0, 0.12); }
.verdict-hero { transform-style: preserve-3d; }
.verdict-hero:hover { transform: translateY(-2px) rotateX(1deg); box-shadow: 0 22px 50px rgba(0, 0, 0, 0.18); }
@keyframes floatY { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
.empty-ring { animation: floatY 3s ease-in-out infinite; }
.ring { animation: floatY 4s ease-in-out infinite; }
@keyframes pulseDot { 0%,100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.5; transform: scale(1.4); } }
.live-pill i { animation: pulseDot 1.4s ease-in-out infinite; }
.tl-dot { animation: pulseDot 2s ease-in-out infinite; }

/* ============================================================ PREMIUM 3D */
.glass {
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(14px) saturate(1.15);
  -webkit-backdrop-filter: blur(14px) saturate(1.15);
  border: 1px solid rgba(255, 255, 255, 0.6);
}

.panel, .mode-col, .band-room, .mem-card, .verdict-hero, .stat, .receipt {
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(10px) saturate(1.1);
  -webkit-backdrop-filter: blur(10px) saturate(1.1);
  border: 1px solid rgba(221, 224, 230, 0.8);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.06), 0 2px 8px rgba(0, 0, 0, 0.04);
}

.mode-col:hover, .mem-card:hover, .band-room:hover {
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.10), 0 4px 12px rgba(0, 0, 0, 0.06);
}

/* 3D tilt on hover for cards */
.mem-card, .receipt, .stat, .learned-card {
  transform-style: preserve-3d;
  transition: transform 0.25s cubic-bezier(.2,.8,.2,1), box-shadow 0.25s ease, border-color 0.25s ease;
}
.mem-card:hover { transform: translateY(-8px) rotateX(5deg) rotateY(-3deg); }
.receipt:hover { transform: translateX(6px) rotateY(2deg); }
.stat:hover { transform: translateY(-4px) rotateX(3deg); }
.learned-card:hover { transform: translateY(-4px) rotateX(3deg) rotateY(-2deg); }

/* Animated gradient border on hero */
.verdict-hero {
  position: relative;
  background: linear-gradient(135deg, rgba(255,255,255,0.9), rgba(255,245,238,0.9));
  border: 1px solid rgba(255, 92, 26, 0.25);
}
.verdict-hero::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: 14px;
  padding: 1px;
  background: linear-gradient(135deg, rgba(255,92,26,0.4), rgba(37,99,235,0.2), rgba(255,92,26,0.4));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  animation: borderGlow 4s linear infinite;
  pointer-events: none;
}
@keyframes borderGlow {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* Floating particles */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(2px 2px at 20% 30%, rgba(255,92,26,0.15), transparent),
    radial-gradient(2px 2px at 60% 70%, rgba(37,99,235,0.12), transparent),
    radial-gradient(1.5px 1.5px at 80% 20%, rgba(255,92,26,0.1), transparent),
    radial-gradient(1.5px 1.5px at 30% 80%, rgba(37,99,235,0.1), transparent);
  background-size: 100% 100%;
  animation: particleDrift 25s ease-in-out infinite alternate;
  z-index: 0;
}
@keyframes particleDrift {
  0% { transform: translate(0, 0); }
  100% { transform: translate(-20px, -15px); }
}

/* Pulsing live indicator */
.live-pill i, .pulse {
  animation: pulseRing 1.6s ease-in-out infinite;
  box-shadow: 0 0 0 0 rgba(255, 92, 26, 0.5);
}
@keyframes pulseRing {
  0% { box-shadow: 0 0 0 0 rgba(255, 92, 26, 0.5); }
  70% { box-shadow: 0 0 0 8px rgba(255, 92, 26, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 92, 26, 0); }
}

/* Spinning accent on Run the story button */
#btnStory .play { display: inline-block; animation: spinSlow 6s linear infinite; }
@keyframes spinSlow { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

/* Glow on primary buttons */
.btn.primary {
  box-shadow: 0 4px 16px rgba(255, 92, 26, 0.25), 0 2px 6px rgba(0,0,0,0.08);
}
.btn.primary:hover {
  box-shadow: 0 8px 24px rgba(255, 92, 26, 0.35), 0 4px 10px rgba(0,0,0,0.1);
  transform: translateY(-1px);
}

/* Chart glow */
#chart svg path { filter: drop-shadow(0 2px 8px rgba(255, 92, 26, 0.25)); }

/* Ensure content sits above particles */
.app, .bus, .modal-wrap { position: relative; z-index: 1; }

/* --------------------------------------------------- memory card details */
.mc-expand {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  color: var(--accent);
  background: transparent;
  border: 1px solid var(--accent-line);
  border-radius: 6px;
  padding: 4px 10px;
  cursor: pointer;
  align-self: flex-start;
  transition: background 0.15s ease, transform 0.15s ease;
}
.mc-expand:hover { background: var(--accent-soft); transform: translateX(2px); }

.mc-details {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 10px;
  background: var(--panel-2);
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  font-size: 11.8px;
}
.mc-row { display: flex; gap: 8px; align-items: baseline; line-height: 1.5; color: var(--text-dim); }
.mc-sig { font-family: var(--mono); font-size: 10px; color: var(--muted); word-break: break-all; }
.mc-disc { background: rgba(245, 181, 68, 0.06); border-left: 2px solid rgba(245, 181, 68, 0.5); padding-left: 8px; border-radius: 0 4px 4px 0; }
.mc-resolution { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; font-size: 11.8px; color: var(--text-dim); }
.mc-arrow { color: var(--accent); font-weight: 600; }
.mc-outcome { font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.1em; text-transform: uppercase; padding: 2px 7px; border-radius: 999px; }
.mc-outcome.resolved { color: var(--good); background: var(--good-soft); }
.mc-outcome.recurred { color: var(--warn); background: var(--warn-soft); }

/* ==========================================================================
   V3 — editorial light theme, always-on ambient motion, real 3D interaction
   ========================================================================== */

:root {
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --bg: #f7f4ef;
  --bg-soft: #fffdfa;
  --panel: rgba(255, 255, 255, 0.84);
  --panel-2: #f6f1ea;
  --line: #e3ddd4;
  --line-soft: #ece7df;
  --text: #17130f;
  --text-dim: #453d35;
  --muted: #7a7066;
  --accent: #ea531f;
  --accent-soft: rgba(234, 83, 31, 0.10);
  --accent-line: rgba(234, 83, 31, 0.34);
  --accent-ink: #b84012;
  --good: #12824c;
  --good-soft: rgba(18, 130, 76, 0.10);
  --good-ink: #0d6b3e;
  --bad: #c0292f;
  --bad-soft: rgba(192, 41, 47, 0.09);
  --bad-ink: #a3232a;
  --warn: #a45a08;
  --warn-soft: rgba(164, 90, 8, 0.10);
  --warn-ink: #7c4505;
  --shadow: 0 26px 70px -34px rgba(74, 46, 20, 0.35);
}

html, body {
  background: var(--bg);
  font-family: var(--sans);
}

body {
  background:
    radial-gradient(1100px 640px at 82% -14%, rgba(234, 83, 31, 0.10), transparent 62%),
    radial-gradient(900px 520px at -10% 6%, rgba(37, 99, 235, 0.06), transparent 60%),
    radial-gradient(760px 460px at 52% 112%, rgba(18, 130, 76, 0.05), transparent 60%),
    var(--bg);
  animation: none;
}

::selection { background: rgba(234, 83, 31, 0.26); }

/* ---------------------------------------------------------------- ambient */

.ambient {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

#ambientCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0.75;
}

.ambient-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(74px);
  opacity: 0.55;
  animation: blobFloat 30s ease-in-out infinite alternate;
  will-change: transform;
}
.ambient-blob.b1 {
  width: 620px; height: 620px; left: -180px; top: -220px;
  background: radial-gradient(circle, rgba(234, 83, 31, 0.28), transparent 66%);
}
.ambient-blob.b2 {
  width: 680px; height: 680px; right: -220px; top: 4%;
  background: radial-gradient(circle, rgba(37, 99, 235, 0.15), transparent 66%);
  animation-delay: -9s;
}
.ambient-blob.b3 {
  width: 560px; height: 560px; left: 36%; bottom: -280px;
  background: radial-gradient(circle, rgba(18, 130, 76, 0.16), transparent 66%);
  animation-delay: -18s;
}

@keyframes blobFloat {
  0% { transform: translate3d(0, 0, 0) scale(1); }
  50% { transform: translate3d(40px, 28px, 0) scale(1.07); }
  100% { transform: translate3d(-26px, 48px, 0) scale(0.97); }
}

.ambient-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(23, 19, 15, 0.032) 1px, transparent 1px),
    linear-gradient(90deg, rgba(23, 19, 15, 0.032) 1px, transparent 1px);
  background-size: 58px 58px;
  -webkit-mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, #000 10%, transparent 75%);
  mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, #000 10%, transparent 75%);
  animation: gridDrift 46s linear infinite;
}

@keyframes gridDrift {
  from { background-position: 0 0, 0 0; }
  to { background-position: 58px 58px, 58px 58px; }
}

.ambient-scan {
  position: absolute;
  left: -10%;
  right: -10%;
  height: 160px;
  top: -180px;
  background: linear-gradient(180deg, transparent, rgba(234, 83, 31, 0.05), transparent);
  animation: scanMove 14s linear infinite;
}

@keyframes scanMove {
  0% { transform: translateY(0); opacity: 0; }
  12% { opacity: 1; }
  88% { opacity: 1; }
  100% { transform: translateY(120vh); opacity: 0; }
}

.app, .bus, .modal-wrap { position: relative; z-index: 1; }

/* ---------------------------------------------------------------- ticker */

.ticker {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 7px 26px;
  border-bottom: 1px solid var(--line-soft);
  background: rgba(255, 253, 250, 0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  overflow: hidden;
  flex: 0 0 auto;
}

.ticker-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex: 0 0 auto;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent-ink);
  border-right: 1px solid var(--line);
  padding-right: 14px;
}
.ticker-label .pulse { width: 5px; height: 5px; }

.ticker-track {
  flex: 1 1 auto;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 3%, #000 97%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 3%, #000 97%, transparent);
}

.ticker-inner {
  display: inline-flex;
  align-items: center;
  gap: 36px;
  white-space: nowrap;
  animation: tickerScroll 70s linear infinite;
  will-change: transform;
}

.ticker:hover .ticker-inner { animation-play-state: paused; }

.ticker-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--muted);
}
.ticker-item b { color: var(--text-dim); font-weight: 600; }
.ticker-item .t-dot {
  width: 4px; height: 4px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px rgba(234, 83, 31, 0.6);
}

@keyframes tickerScroll {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

/* ---------------------------------------------------------------- topbar */

.topbar, .tabs {
  background: rgba(250, 247, 242, 0.66);
  backdrop-filter: blur(14px) saturate(1.1);
  -webkit-backdrop-filter: blur(14px) saturate(1.1);
}

.brand-text { min-width: 0; }
.brand-text h1 {
  font-family: var(--serif);
  font-size: 23px;
  font-weight: 600;
  letter-spacing: -0.025em;
}
.brand-text p {
  white-space: nowrap;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.015em;
}

.mark {
  animation: markOrbit 26s linear infinite;
  transform-origin: 50% 50%;
}
@keyframes markOrbit {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.badge {
  background: rgba(255, 255, 255, 0.78);
  border-color: var(--line);
  color: var(--text-dim);
}
.badge.ok { color: var(--good-ink); border-color: rgba(18, 130, 76, 0.32); }
.badge.ok .dot { background: var(--good); box-shadow: 0 0 0 3px rgba(18, 130, 76, 0.14); }
.badge.warn { color: var(--warn-ink); border-color: rgba(164, 90, 8, 0.32); }
.badge.warn .dot { background: var(--warn); box-shadow: 0 0 0 3px rgba(164, 90, 8, 0.14); }
.badge.bad { color: var(--bad-ink); border-color: rgba(192, 41, 47, 0.32); }
.badge.bad .dot { background: var(--bad); box-shadow: 0 0 0 3px rgba(192, 41, 47, 0.14); }

.btn.primary {
  position: relative;
  overflow: hidden;
}
.btn.primary::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: -70%;
  width: 45%;
  z-index: 1;
  pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  transform: skewX(-18deg);
  mix-blend-mode: soft-light;
  animation: btnSheen 5.5s ease-in-out infinite;
}
@keyframes btnSheen {
  0%, 55% { left: -70%; }
  100% { left: 130%; }
}

/* ------------------------------------------------------------ hero landing */

.hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.18fr) minmax(280px, 0.82fr);
  gap: 34px;
  align-items: center;
  min-height: calc(100vh - 300px);
  padding: 20px 6px 36px;
}

.hero-copy { max-width: 720px; }

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent-ink);
  border: 1px solid var(--accent-line);
  background: var(--accent-soft);
  border-radius: 999px;
  padding: 6px 11px;
}
.hero-eyebrow i {
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 rgba(234, 83, 31, 0.5);
  animation: pulseRing 1.8s ease-in-out infinite;
}

.hero-title {
  margin: 20px 0 0;
  font-family: var(--serif);
  font-size: clamp(38px, 4.7vw, 64px);
  font-weight: 600;
  line-height: 1.03;
  letter-spacing: -0.035em;
  color: var(--text);
}
.hero-title em {
  font-style: italic;
  color: var(--accent);
  background: linear-gradient(120deg, #ea531f, #f59e0b 70%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-sub {
  max-width: 610px;
  margin: 18px 0 26px;
  font-size: 14.8px;
  line-height: 1.72;
  color: var(--text-dim);
}
.hero-sub b { color: var(--text); font-weight: 600; }

.hero-cta { display: flex; flex-wrap: wrap; gap: 11px; }

.hero-flow {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 26px;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
}
.hero-flow span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.6);
  border-radius: 999px;
  padding: 5px 10px;
}
.hero-flow b { color: var(--accent-ink); font-weight: 600; }
.hero-flow i { color: #b9ada2; font-style: normal; }

.hero-trust {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: -12px 0 24px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.05em;
  color: var(--muted);
}
.hero-trust::before { content: ""; width: 18px; height: 1px; background: var(--accent-line); }

.hero-proof {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 32px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}
.proof b {
  display: block;
  font-family: var(--serif);
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.03em;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.proof span {
  display: block;
  margin-top: 4px;
  font-size: 10.5px;
  line-height: 1.45;
  color: var(--muted);
}

/* ---------------------------------------------------------------- orb */

.hero-orb {
  position: relative;
  width: min(430px, 100%);
  aspect-ratio: 1;
  margin: 0 auto;
  display: grid;
  place-items: center;
  perspective: 900px;
  transform-style: preserve-3d;
}

.orb-halo {
  position: absolute;
  inset: 6%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(234, 83, 31, 0.16), transparent 62%);
  filter: blur(10px);
  animation: haloPulse 6s ease-in-out infinite;
}
@keyframes haloPulse {
  0%, 100% { transform: scale(1); opacity: 0.85; }
  50% { transform: scale(1.1); opacity: 1; }
}

.orb-ring {
  position: absolute;
  border-radius: 50%;
  border: 1px solid rgba(234, 83, 31, 0.26);
  box-shadow: 0 0 60px rgba(234, 83, 31, 0.08) inset;
  transform-style: preserve-3d;
}
.orb-ring.r1 {
  inset: 4%;
  transform: rotateX(70deg) rotateZ(8deg);
  animation: orbSpin 22s linear infinite;
}
.orb-ring.r2 {
  inset: 15%;
  border-color: rgba(37, 99, 235, 0.18);
  transform: rotateX(64deg) rotateZ(-22deg);
  animation: orbSpinRev 17s linear infinite;
}
.orb-ring.r3 {
  inset: 26%;
  border-color: rgba(18, 130, 76, 0.2);
  transform: rotateX(76deg) rotateZ(48deg);
  animation: orbSpin 13s linear infinite;
}
@keyframes orbSpin {
  from { transform: rotateX(70deg) rotateZ(0deg); }
  to { transform: rotateX(70deg) rotateZ(360deg); }
}
@keyframes orbSpinRev {
  from { transform: rotateX(64deg) rotateZ(360deg); }
  to { transform: rotateX(64deg) rotateZ(0deg); }
}

.orb-scan {
  position: absolute;
  inset: 10%;
  border-radius: 50%;
  background: conic-gradient(from 0deg, transparent 0deg, rgba(234, 83, 31, 0.22) 34deg, transparent 70deg);
  -webkit-mask-image: radial-gradient(circle, transparent 57%, #000 58%, #000 60%, transparent 61%);
  mask-image: radial-gradient(circle, transparent 57%, #000 58%, #000 60%, transparent 61%);
  animation: orbScan 8s linear infinite;
}
@keyframes orbScan {
  to { transform: rotate(360deg); }
}

.orb-core {
  position: relative;
  width: 30%;
  aspect-ratio: 1;
  border-radius: 50%;
  background:
    radial-gradient(circle at 34% 28%, #fffdf9 0%, #ffd9c7 26%, #ff8a4b 58%, #c2410c 100%);
  box-shadow:
    0 0 90px rgba(234, 83, 31, 0.5),
    0 0 24px rgba(234, 83, 31, 0.4),
    inset -14px -18px 34px rgba(110, 30, 0, 0.32),
    inset 8px 10px 22px rgba(255, 255, 255, 0.45);
  animation: coreFloat 7s ease-in-out infinite;
}
@keyframes coreFloat {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-10px) scale(1.035); }
}

.orb-node {
  position: absolute;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.04em;
  color: var(--text-dim);
  background: rgba(255, 253, 250, 0.86);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 8px;
  box-shadow: 0 8px 20px -12px rgba(74, 46, 20, 0.4);
  animation: nodeFloat 6.5s ease-in-out infinite;
  white-space: nowrap;
}
.orb-node.n1 { top: 10%; left: 2%; color: var(--accent-ink); }
.orb-node.n2 { top: 32%; right: 0%; animation-delay: -2.2s; }
.orb-node.n3 { bottom: 14%; left: 6%; animation-delay: -4.1s; }
.orb-node.n4 { bottom: 26%; right: 4%; color: var(--good-ink); animation-delay: -1.2s; }
@keyframes nodeFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-7px); }
}

/* --------------------------------------------------- contrast repairs */

.mode-col.on .hyp-title { color: var(--text); }
.conf-num { color: var(--accent-ink); }
.chip.good { color: var(--good-ink); border-color: rgba(18, 130, 76, 0.28); background: var(--good-soft); }
.chip.warn { color: var(--warn-ink); border-color: rgba(164, 90, 8, 0.3); background: var(--warn-soft); }
.chip.bad { color: var(--bad-ink); border-color: rgba(192, 41, 47, 0.3); background: var(--bad-soft); }
.fa-label { color: var(--accent-ink); }
.fa-text { color: var(--text); }
.verdict { color: var(--bad-ink); border-color: rgba(192, 41, 47, 0.22); background: rgba(192, 41, 47, 0.055); }
.verdict.good { color: var(--good-ink); border-color: rgba(18, 130, 76, 0.24); background: var(--good-soft); }
.receipt .rid, .table .tid, .tl-label.end { color: var(--accent-ink); }
.cd-head { color: var(--warn-ink); }
.cd-title { color: #583708; }
.cd-title b { color: var(--text); }
.cd-note { color: #74552b; }
.avoid-card .cd-head { color: var(--bad-ink); }
.avoid-card p { color: #8c2028; }
.ring-num { color: var(--text); }
.vs-side.on .vs-text { color: var(--text); }
.vh-saved { color: var(--good-ink); background: rgba(18, 130, 76, 0.08); border-color: rgba(18, 130, 76, 0.28); }
.card h3.good { color: var(--good-ink); }
.card h3.bad { color: var(--bad-ink); }
.pill-out.resolved { color: var(--good-ink); border-color: rgba(18, 130, 76, 0.3); background: var(--good-soft); }
.pill-out.recurred { color: var(--warn-ink); border-color: rgba(164, 90, 8, 0.3); background: var(--warn-soft); }
.pill-out.made_it_worse { color: var(--bad-ink); border-color: rgba(192, 41, 47, 0.3); background: var(--bad-soft); }
.mem-card.is-stale .mc-cause { color: #643a06; }
.filters .filter.active { color: var(--accent-ink); border-color: var(--accent-line); background: var(--accent-soft); }
.learned-card .lc-count { color: var(--accent-ink); }
.br-transport.live { color: var(--good-ink); border-color: rgba(18, 130, 76, 0.32); background: rgba(18, 130, 76, 0.07); }
.br-verdict.allow { color: var(--good-ink); border-color: rgba(18, 130, 76, 0.35); background: rgba(18, 130, 76, 0.07); }
.br-verdict.review { color: var(--warn-ink); border-color: rgba(164, 90, 8, 0.35); background: rgba(164, 90, 8, 0.07); }
.br-verdict.block { color: var(--bad-ink); border-color: rgba(192, 41, 47, 0.35); background: rgba(192, 41, 47, 0.07); }
.toast { background: rgba(255, 253, 250, 0.96); border-color: var(--line); }

/* -------------------------------------------------- warm glass surfaces */

.panel, .mode-col, .band-room, .mem-card, .verdict-hero, .stat, .receipt, .alert-summary, .inc-card {
  background: rgba(255, 255, 255, 0.82);
  border-color: var(--line-soft);
  backdrop-filter: blur(12px) saturate(1.12);
  -webkit-backdrop-filter: blur(12px) saturate(1.12);
  box-shadow: 0 10px 34px -20px rgba(74, 46, 20, 0.22), 0 2px 8px rgba(74, 46, 20, 0.04);
}
.alert-summary {
  background: linear-gradient(180deg, rgba(255, 253, 250, 0.95), rgba(255, 255, 255, 0.78));
  border-color: var(--line);
}
.mode-col.on {
  border-color: rgba(234, 83, 31, 0.36);
  box-shadow: 0 0 0 1px rgba(234, 83, 31, 0.07), 0 30px 70px -42px rgba(234, 83, 31, 0.55);
}
.verdict-hero {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(255, 246, 239, 0.92));
  border-color: rgba(234, 83, 31, 0.22);
}
.receipt, .off-card, .fingerprint, .sample, .mc-details, .mc-signals { background: rgba(250, 247, 242, 0.72); }
.first-action {
  background: linear-gradient(180deg, rgba(234, 83, 31, 0.09), rgba(234, 83, 31, 0.025));
  border-color: rgba(234, 83, 31, 0.3);
}
.contradiction {
  background: linear-gradient(180deg, rgba(164, 90, 8, 0.08), rgba(164, 90, 8, 0.02));
  border-color: rgba(164, 90, 8, 0.28);
}
.avoid-card { background: rgba(192, 41, 47, 0.05); border-color: rgba(192, 41, 47, 0.22); }
.verdict-strip { background: linear-gradient(180deg, rgba(250, 247, 242, 0.9), rgba(255, 255, 255, 0.8)); }
.mode-head, .table thead th, .br-head, .bus-head { background: rgba(246, 241, 234, 0.55); }
.kbd, kbd { background: rgba(255, 255, 255, 0.7); }
.searchbox { background: rgba(255, 255, 255, 0.8); }
#resolveForm input, #resolveForm select { background: rgba(250, 247, 242, 0.8); }

/* --------------------------------------------------------- typography */

.page-head h2, .empty h2, .as-title, .inc-title {
  font-family: var(--serif);
  font-weight: 600;
  letter-spacing: -0.025em;
}
.page-head h2 { font-size: 24px; }
.stat .s-value { font-family: var(--serif); font-size: 28px; font-weight: 600; }
.stat { border-radius: 13px; }
.hero-title, .hero-sub, .proof { text-wrap: balance; }

/* ----------------------------------------------------------- bus contrast */

.bus { background: rgba(26, 21, 17, 0.97); border-top-color: rgba(255, 255, 255, 0.08); }
.bus-meta, .bus-line .b-q, .bus-line .b-meta, .chev { color: #a89d92; }
.bus-line { color: #a89d92; }
.bus-line .b-op { color: #ddd3c9; }
.bus-line .b-op.retain { color: #ff9a6b; }
.bus-line .b-op.recall { color: #8fc4ff; }
.bus-line .b-meta .hs { color: #56d99a; }

/* ------------------------------------------------------------ 3D tilt */

.tilt { transform-style: preserve-3d; will-change: transform; }
.glass-depth { transform: translateZ(18px); }

.glare {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  z-index: 3;
  background: radial-gradient(260px circle at var(--mx, 50%) var(--my, 50%), rgba(255, 255, 255, 0.5), transparent 62%);
  opacity: 0;
  transition: opacity 0.22s ease;
}
.tilting .glare { opacity: 1; }
.tilting { transition: box-shadow 0.25s ease, border-color 0.25s ease !important; }

/* ------------------------------------------------------------- incidents */

.inc-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.inc-summary {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--muted);
  margin-bottom: 16px;
}
.inc-summary b { color: var(--text-dim); font-weight: 600; }

.inc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 12px;
}
.inc-grid > .empty-mini { grid-column: 1 / -1; }
.table-card { overflow: visible; }

.inc-card {
  position: relative;
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  padding: 15px 16px 14px;
  cursor: pointer;
  transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.25s ease, border-color 0.25s ease;
  animation: cardIn 0.45s both;
  animation-delay: calc(var(--i, 0) * 28ms);
}
.inc-card:hover {
  border-color: rgba(234, 83, 31, 0.32);
  box-shadow: 0 26px 54px -30px rgba(74, 46, 20, 0.4);
}
.inc-card.open { border-color: rgba(234, 83, 31, 0.5); box-shadow: 0 28px 60px -32px rgba(74, 46, 20, 0.45); }

.inc-top {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
}
.inc-id { color: var(--accent-ink); font-weight: 600; }
.inc-date { margin-left: auto; }
.inc-svc { color: var(--text-dim); }

.inc-title {
  font-size: 16.5px;
  line-height: 1.3;
  margin: 9px 0 0;
  color: var(--text);
}

.inc-symptom {
  margin: 7px 0 0;
  font-size: 12.3px;
  line-height: 1.55;
  color: var(--text-dim);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.inc-tags {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  margin-top: 11px;
  font-family: var(--mono);
  font-size: 9.5px;
  color: var(--muted);
}
.inc-class {
  color: var(--text-dim);
  background: rgba(246, 241, 234, 0.9);
  border: 1px solid var(--line-soft);
  border-radius: 5px;
  padding: 3px 7px;
}
.inc-eng { color: var(--text-dim); }
.inc-time { color: var(--muted); }
.inc-hint {
  margin-left: auto;
  color: var(--accent-ink);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 8.5px;
}

[hidden] { display: none !important; }

.inc-detail {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 13px;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
}
.inc-row {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 10px;
  font-size: 12.2px;
  line-height: 1.55;
}
.inc-row > span {
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  padding-top: 2px;
}
.inc-row p { margin: 0; color: var(--text-dim); }
.inc-row.hi p { color: var(--text); }
.inc-row.disc p {
  color: #64430f;
  background: rgba(164, 90, 8, 0.06);
  border-left: 2px solid rgba(164, 90, 8, 0.4);
  border-radius: 0 6px 6px 0;
  padding: 6px 9px;
}

.inc-note {
  margin: 0 0 16px;
  padding: 11px 14px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  background: rgba(255, 253, 250, 0.6);
  font-size: 12px;
  line-height: 1.6;
  color: var(--muted);
  max-width: 900px;
}
.inc-note b { color: var(--text-dim); font-weight: 600; }

/* ------------------------------------------------------- motion + entries */

@keyframes panelIn {
  from { opacity: 0; transform: translateY(10px) scale(0.995); }
  to { opacity: 1; transform: none; }
}
.panel.active { animation: panelIn 0.36s cubic-bezier(0.2, 0.8, 0.2, 1); }

@keyframes cardIn {
  from { opacity: 0; transform: translateY(12px) scale(0.99); }
  to { opacity: 1; transform: none; }
}
.mem-card:not(.skeleton), .stat, .learned-card, .sample { animation: cardIn 0.45s both; }
.mem-card:nth-child(2n) { animation-delay: 40ms; }
.mem-card:nth-child(3n) { animation-delay: 80ms; }

.mem-card:hover { transform: translateY(-6px) rotateX(3deg) rotateY(-2deg); }
.receipt:hover { transform: translateX(6px) rotateY(2deg); }

#chart svg .pt circle { transition: transform 0.2s ease; transform-box: fill-box; transform-origin: center; }
#chart svg .pt:hover circle { transform: scale(1.6); }

/* SVG line draw */
.chart-line {
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  animation: drawLine 1.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}
@keyframes drawLine { to { stroke-dashoffset: 0; } }

/* ------------------------------------------------------- learning maturity */

.maturity-head { margin: 4px 0 12px; }
.maturity-head h3 {
  margin: 0 0 5px;
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}
.maturity-head p {
  margin: 0;
  max-width: 760px;
  font-size: 12.6px;
  line-height: 1.6;
  color: var(--text-dim);
}
.maturity-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.maturity-card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 16px 16px 14px;
  background: var(--panel);
  box-shadow: 0 18px 40px -34px rgba(50, 30, 10, 0.4);
}
.maturity-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: linear-gradient(90deg, #b8afa3, #d9cfc2);
}
.maturity-card.warm::before { background: linear-gradient(90deg, #f59e0b, #ff8a3d); }
.maturity-card.hot::before { background: linear-gradient(90deg, #12824c, #34b374); }
.mat-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.06em;
  color: var(--muted);
  text-transform: uppercase;
}
.mat-mem {
  padding: 3px 7px;
  border-radius: 5px;
  border: 1px solid var(--line);
  background: rgba(250, 247, 242, 0.9);
  color: var(--text-dim);
  letter-spacing: 0.02em;
  text-transform: none;
}
.mat-label {
  margin: 12px 0 10px;
  font-family: var(--serif);
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--text);
}
.mat-body { display: grid; gap: 9px; }
.mat-body > div { display: grid; gap: 2px; }
.mat-body span {
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
.mat-body b {
  font-size: 12.6px;
  font-weight: 600;
  line-height: 1.45;
  color: var(--text);
}
.mat-body b.ok { color: var(--good-ink); }
.mat-body b.bad { color: var(--bad-ink); }
.mat-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
  font-family: var(--mono);
  font-size: 9.5px;
  color: var(--muted);
}
.mat-verdict {
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 8.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: 1px solid transparent;
}
.mat-verdict.ok { color: var(--good-ink); background: var(--good-soft); border-color: rgba(18, 130, 76, 0.25); }
.mat-verdict.bad { color: var(--bad-ink); background: var(--bad-soft); border-color: rgba(192, 41, 47, 0.22); }
.mat-note {
  margin: 10px 0 0;
  font-size: 11.6px;
  line-height: 1.55;
  color: var(--text-dim);
}

/* ----------------------------------------------------------- story overlay */

.story-bar {
  position: fixed;
  left: 50%;
  bottom: 58px;
  transform: translate(-50%, 16px);
  z-index: 70;
  width: min(640px, calc(100vw - 28px));
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  background: rgba(10, 12, 18, 0.94);
  box-shadow: 0 30px 80px -30px rgba(0, 0, 0, 0.72), inset 0 1px 0 rgba(255, 255, 255, 0.07);
  backdrop-filter: blur(18px);
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease, transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.story-bar.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }

/* Cinematic focus while the story runs: the room dims, the answer keeps the light. */
body.story-on::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 45;
  pointer-events: none;
  background: radial-gradient(118% 88% at 50% 42%, transparent 34%, rgba(5, 7, 12, 0.46) 100%);
  animation: storyDim 0.55s ease both;
}
@keyframes storyDim { from { opacity: 0; } to { opacity: 1; } }

.sb-progress {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 2px;
  width: calc(var(--p, 0) * 100%);
  background: linear-gradient(90deg, #ff8a3d, #ea531f);
  transition: width 0.5s ease;
}
.sb-act {
  flex: 0 0 auto;
  margin-top: 1px;
  padding: 3px 7px;
  border-radius: 5px;
  border: 1px solid rgba(255, 138, 61, 0.38);
  background: rgba(255, 92, 26, 0.18);
  color: #ffb591;
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}
.sb-copy b {
  display: block;
  font-family: var(--serif);
  font-size: 15.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: #f7f4ef;
}
.sb-copy p {
  margin: 3px 0 0;
  font-size: 12px;
  line-height: 1.55;
  color: rgba(247, 244, 239, 0.68);
}

/* ------------------------------------------------------------ responsive */

@media (max-width: 1180px) {
  .hero { grid-template-columns: minmax(0, 1fr) minmax(240px, 0.7fr); gap: 20px; }
  .hero-proof { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 1024px) {
  .brand-text p { display: none; }
  .topbar { gap: 12px; }
  .badges { display: none; }
}

@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; min-height: 0; padding-top: 12px; gap: 14px; }
  .hero-orb { max-width: 210px; order: 2; margin: 6px auto 0; }
  .hero-title { font-size: clamp(34px, 7.4vw, 46px); }
  .hero-proof { margin-top: 24px; }
  .ticker { display: none; }
  .inc-grid { grid-template-columns: 1fr; }
  .maturity-grid { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .hero-orb { display: none; }
  .hero-sub { font-size: 14px; }
  .hero-flow { display: none; }
  .topbar { flex-wrap: wrap; row-gap: 10px; }
  .top-actions { margin-left: auto; }
  #btnDemo, #btnReset { display: none; }
  .brand-text h1 { font-size: 22px; }
  .stage { padding: 16px 14px 22px; }
  .story-bar { bottom: 52px; padding: 12px 13px; gap: 10px; }
  .sb-copy b { font-size: 14px; }
  .sb-copy p { font-size: 11.5px; }
}

@media (max-width: 820px) {
  .rail { display: none; }
  #tab-live { flex-direction: column; }
  .stage { overflow-y: auto; }
  .inc-summary { flex-wrap: wrap; row-gap: 6px; }
  .inc-toolbar .searchbox { min-width: 0; width: 100%; }
}

@media (max-width: 720px) {
  .topbar { padding: 12px 14px; }
  .tabs { padding: 0 12px; overflow-x: auto; }
  .tab { padding: 12px 9px; }
  .panel.page, .stage { padding-left: 14px; padding-right: 14px; }
  .rail { width: 220px; flex-basis: 220px; }
  .hero-cta .btn { flex: 1 1 auto; justify-content: center; }
  .hero-proof { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* --------------------------------------------------------- reduced motion */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .ambient, body::after { display: none; }
  .ticker-inner { animation: none; }
  .btn.primary::after { display: none; }
}
