:root {
  --ink: #11130f;
  --paper: #eee8d6;
  --panel: #fbf4e2;
  --line: #29251a;
  --muted: #665f4c;
  --green: #54b87d;
  --red: #cf4a41;
  --amber: #d4a63a;
  --cyan: #3e9ca4;
  --violet: #6d5fd0;
  --shadow: 0 14px 42px rgba(17, 19, 15, 0.16);

  /* Semantic back-compatibility variables for high-fidelity custom themes */
  --card-bg: rgba(251, 244, 226, 0.95);
  --contrast-bg: #151711;
  --topbar-gradient: linear-gradient(90deg, rgba(255, 249, 231, 0.94), rgba(245, 240, 223, 0.86)), rgba(245, 240, 223, 0.94);
  --control-gradient: linear-gradient(90deg, rgba(245, 240, 223, 0.98), rgba(255, 249, 231, 0.92)), rgba(245, 240, 223, 0.92);
  --button-sec-bg: #fff9e7;
  --button-sec-hover: #fff1c0;
  --input-bg: #fffdf5;
  --file-bg: rgba(255, 249, 231, 0.72);
  --file-active-bg: #fff7d8;
  --event-bg: rgba(255, 249, 231, 0.74);
  --agent-bg: #fff9e7;
  --agent-done-bg: #ecf8e7;
  --agent-hot-bg: #ffe9df;
  --verdict-bg: #fff9e7;
  --action-bg: #e8ffe9;
  --eval-row-bg: rgba(245, 240, 223, 0.75);
  --glow-color: rgba(41, 37, 26, 0.04);
}

body[data-theme="cyber"] {
  --ink: #e2e8f0;
  --paper: #080a0f;
  --panel: #11141e;
  --line: #334155;
  --muted: #64748b;
  --green: #10b981;
  --red: #ef4444;
  --amber: #f59e0b;
  --cyan: #06b6d4;
  --violet: #8b5cf6;
  --shadow: 0 20px 48px rgba(0, 0, 0, 0.65);

  --card-bg: rgba(17, 20, 30, 0.94);
  --contrast-bg: #090a10;
  --topbar-gradient: linear-gradient(90deg, rgba(20, 24, 35, 0.96), rgba(14, 17, 25, 0.92)), rgba(17, 20, 30, 0.94);
  --control-gradient: linear-gradient(90deg, rgba(14, 17, 25, 0.96), rgba(20, 24, 35, 0.92)), rgba(17, 20, 30, 0.94);
  --button-sec-bg: #1e293b;
  --button-sec-hover: #334155;
  --input-bg: #1e293b;
  --file-bg: rgba(30, 41, 59, 0.45);
  --file-active-bg: rgba(245, 158, 11, 0.16);
  --event-bg: rgba(30, 41, 59, 0.35);
  --agent-bg: rgba(30, 41, 59, 0.3);
  --agent-done-bg: rgba(16, 185, 129, 0.12);
  --agent-hot-bg: rgba(239, 68, 68, 0.12);
  --verdict-bg: rgba(30, 27, 75, 0.55);
  --action-bg: rgba(6, 78, 59, 0.45);
  --eval-row-bg: rgba(30, 41, 59, 0.35);
  --glow-color: rgba(6, 182, 212, 0.12);
}

* {
  box-sizing: border-box;
}

::selection {
  background: #11130f;
  color: #f8ecb9;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(rgba(17, 19, 15, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(17, 19, 15, 0.045) 1px, transparent 1px),
    radial-gradient(circle at 18% 0%, #f8ecb9 0, transparent 32%),
    linear-gradient(140deg, #f0e8d4 0%, #dfe1d0 55%, #cfdad9 100%);
  background-size: 24px 24px, 24px 24px, auto, auto;
  background-attachment: fixed;
  font-family: "Plus Jakarta Sans", sans-serif;
  transition: background 0.3s ease, color 0.3s ease;
}

body[data-theme="cyber"] {
  background:
    linear-gradient(rgba(255, 255, 255, 0.015) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.015) 1px, transparent 1px),
    radial-gradient(circle at 18% 0%, #1e1b4b 0, transparent 40%),
    linear-gradient(140deg, #090a0f 0%, #030712 100%);
  background-size: 24px 24px, 24px 24px, auto, auto;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at 80% 12%, rgba(76, 166, 170, 0.18), transparent 26%);
  mix-blend-mode: multiply;
  transition: background 0.3s ease;
}

body[data-theme="cyber"]::before {
  background: radial-gradient(circle at 80% 12%, rgba(6, 182, 212, 0.12), transparent 30%);
  mix-blend-mode: screen;
}

button {
  font: inherit;
}

.shell {
  width: min(1720px, calc(100vw - 28px));
  margin: 0 auto;
  padding: 18px 0 22px;
}

.topbar,
.control-strip,
.workspace > * {
  border: 1px solid rgba(41, 37, 26, 0.16);
  background: var(--card-bg);
  box-shadow: var(--shadow);
  border-radius: 12px;
}

.topbar {
  position: relative;
  min-height: 128px;
  display: grid;
  grid-template-columns: minmax(280px, 0.75fr) minmax(360px, 1fr);
  gap: 22px;
  align-items: center;
  padding: 24px 28px;
  background: var(--topbar-gradient);
  overflow: hidden;
  transition: background 0.3s ease, border-color 0.3s ease;
}

.topbar::after {
  content: "LIVE INCIDENT REPLAY";
  position: absolute;
  right: 22px;
  bottom: 18px;
  color: var(--line);
  opacity: 0.12;
  font-size: clamp(28px, 4vw, 62px);
  font-weight: 600;
  letter-spacing: -0.08em;
  pointer-events: none;
}

.eyebrow {
  margin: 0 0 2px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 12px;
  color: var(--muted);
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-family: "Newsreader", serif;
  font-size: clamp(48px, 6.4vw, 94px);
  line-height: 0.86;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 15px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

h3 {
  margin-bottom: 8px;
  font-size: 14px;
}

.brief {
  position: relative;
  z-index: 1;
  max-width: 780px;
  font-size: 16px;
  line-height: 1.6;
  color: #242318;
}

.hero-checkpoints {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}

.hero-checkpoints span {
  border: 1px solid rgba(41, 37, 26, 0.55);
  background: rgba(255, 249, 231, 0.72);
  padding: 7px 9px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.control-strip {
  display: flex;
  gap: 10px;
  align-items: center;
  margin: 12px 0;
  padding: 12px;
  background: var(--control-gradient);
  transition: background 0.3s ease, border-color 0.3s ease;
}

.scenario-selector {
  flex: 1 1 420px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  font-size: 12px;
  margin-right: 14px;
}

.scenario-selector label {
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  white-space: nowrap;
}

.scenario-selector select {
  width: min(100%, 640px);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--input-bg);
  color: var(--ink);
  padding: 6px 12px;
  cursor: pointer;
  outline: none;
}

.scenario-selector select:focus {
  outline: 2px solid var(--amber);
}

.symptom-desc {
  font-size: 11px;
  color: var(--muted);
  font-weight: 500;
}

.primary,
.secondary {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 16px;
  cursor: pointer;
  transition: transform 140ms ease, box-shadow 140ms ease, background 140ms ease, color 140ms ease, border-color 140ms ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 600;
  font-family: "Plus Jakarta Sans", sans-serif;
  font-size: 13px;
}

.primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 3px 0 var(--line);
}

.secondary:hover {
  transform: translateY(-1px);
  box-shadow: 0 3px 0 var(--line);
  background: var(--button-sec-hover);
}

.primary:active,
.secondary:active {
  transform: translateY(0);
  box-shadow: none;
}

.primary:disabled,
.secondary:disabled {
  cursor: wait;
  opacity: 0.72;
}

.primary:focus-visible,
.secondary:focus-visible,
.scenario-selector select:focus-visible,
.format-links a:focus-visible,
.sources a:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
}

.primary {
  background: var(--ink);
  color: var(--paper);
}

.secondary {
  background: var(--button-sec-bg);
  color: var(--ink);
}

.status {
  margin-left: auto;
  color: var(--muted);
  font-size: 13px;
}

.watchtower-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.watchtower-card {
  position: relative;
  min-height: 92px;
  border: 1px solid rgba(41, 37, 26, 0.15);
  border-radius: 8px;
  background: var(--card-bg);
  box-shadow: var(--shadow);
  padding: 12px 14px;
  overflow: hidden;
  transition: background 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

.watchtower-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--cyan);
  opacity: 0.85;
}

.watchtower-card.primary-signal::before {
  background: var(--amber);
}

.watchtower-card.primary-signal {
  background: var(--contrast-bg);
  color: var(--paper);
}

.watchtower-card span {
  display: block;
  font-family: "Plus Jakarta Sans", sans-serif;
  text-transform: uppercase;
  font-weight: 700;
  font-size: 10px;
  letter-spacing: 0.05em;
  color: var(--muted);
  line-height: 1.35;
}

.watchtower-card small {
  display: block;
  font-family: "IBM Plex Mono", monospace;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.35;
  margin-top: 2px;
}

.watchtower-card.primary-signal span,
.watchtower-card.primary-signal small {
  color: #c9c1a6;
}

.watchtower-card strong {
  display: block;
  margin: 4px 0 2px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.real-data-strip {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) repeat(3, minmax(150px, 0.72fr));
  gap: 12px;
  margin-bottom: 12px;
  border: 2px solid var(--line);
  background: var(--card-bg);
  box-shadow: var(--shadow);
  padding: 12px;
  position: relative;
  transition: background 0.3s ease, border-color 0.3s ease;
}

.real-data-copy h2 {
  margin: 2px 0 8px;
  font-family: "Newsreader", serif;
  font-size: 28px;
  line-height: 1;
  text-transform: none;
}

.real-data-copy p:last-child {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  margin-bottom: 0;
}

.real-data-strip figure {
  margin: 0;
  border: 2px solid var(--line);
  background: var(--contrast-bg);
  color: var(--paper);
  padding: 8px;
  box-shadow: inset 0 0 0 1px rgba(245, 240, 223, 0.12);
  transition: background 0.3s ease, border-color 0.3s ease;
}

.real-data-strip img {
  width: 100%;
  height: 118px;
  object-fit: cover;
  display: block;
  background: #0d100c;
}

.real-data-strip figcaption {
  margin-top: 7px;
  font-size: 11px;
  color: #d8d0b7;
}

.format-strip {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(360px, 1.1fr) minmax(230px, 0.62fr);
  gap: 12px;
  margin-bottom: 12px;
  border: 2px solid var(--line);
  background: var(--card-bg);
  box-shadow: var(--shadow);
  padding: 12px;
  transition: background 0.3s ease, border-color 0.3s ease;
}

.format-copy h2 {
  margin: 2px 0 8px;
  font-family: "Newsreader", serif;
  font-size: 28px;
  line-height: 1;
  text-transform: none;
}

.format-copy p:last-child {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  margin-bottom: 0;
}

.format-map {
  margin: 0;
  border: 2px solid var(--line);
  background: var(--contrast-bg);
  padding: 8px;
  transition: background 0.3s ease, border-color 0.3s ease;
}

.format-map img {
  width: 100%;
  height: 190px;
  object-fit: contain;
  display: block;
  background: var(--contrast-bg);
  transition: background 0.3s ease;
}

.format-links {
  display: grid;
  gap: 8px;
  align-content: start;
}

.format-links a {
  min-height: 40px;
  display: flex;
  align-items: center;
  border: 1px solid var(--line);
  background: var(--button-sec-bg);
  color: var(--ink);
  padding: 9px;
  font-size: 12px;
  text-decoration: none;
  overflow-wrap: anywhere;
  transition: background 140ms ease, transform 140ms ease, border-color 140ms ease, color 140ms ease;
  gap: 8px;
}

.format-links a:hover {
  background: #fff1c0;
  transform: translateX(2px);
}

.economics-strip {
  display: grid;
  grid-template-columns: minmax(280px, 1.25fr) repeat(3, minmax(170px, 0.75fr));
  gap: 12px;
  margin-bottom: 12px;
  border: 2px solid var(--line);
  background: var(--contrast-bg);
  color: var(--paper);
  box-shadow: var(--shadow);
  padding: 12px;
  transition: background 0.3s ease, border-color 0.3s ease;
}

.economics-copy h2 {
  margin: 2px 0 8px;
  font-family: "Newsreader", serif;
  font-size: 30px;
  line-height: 1;
  text-transform: none;
}

.economics-copy p:last-child {
  color: #d8d0b7;
  font-size: 12px;
  line-height: 1.5;
  margin-bottom: 0;
}

.economics-strip .eyebrow {
  color: #c9c1a6;
}

.formula-card {
  border: 1px solid var(--line);
  background: rgba(245, 240, 223, 0.05);
  padding: 10px;
  transition: border-color 0.3s ease;
}

.formula-card span,
.formula-card small {
  display: block;
  color: #c9c1a6;
  font-size: 11px;
  line-height: 1.35;
}

.formula-card strong {
  display: block;
  margin: 7px 0;
  font-size: 18px;
  line-height: 1.12;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(310px, 0.82fr) minmax(520px, 1.45fr) minmax(330px, 0.9fr);
  gap: 12px;
}

.workspace > * {
  min-height: calc(100vh - 178px);
  padding: 16px;
}

.panel-head,
.stage-head,
.chart-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  border-bottom: 2px solid rgba(41, 37, 26, 0.22);
  padding-bottom: 12px;
  margin-bottom: 14px;
}

.panel-head span,
.chart-head span,
.stage-head p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.wafer-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--contrast-bg);
  color: var(--paper);
  padding: 12px;
  transition: background 0.3s ease, border-color 0.3s ease;
}

.wafer-meta {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 8px;
  font-size: 11px;
  color: #c9c1a6;
}

#waferCanvas {
  width: 100%;
  aspect-ratio: 1;
  display: block;
  background: #0d100c;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
  font-size: 11px;
  color: #d8d0b7;
}

.legend i {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 5px;
  border: 1px solid #000;
}

.good {
  background: var(--green);
}

.bad {
  background: var(--red);
}

.suspect {
  background: var(--amber);
}

.file-list {
  margin-top: 14px;
  display: grid;
  gap: 8px;
}

.file {
  min-height: 42px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  border: 1px solid rgba(41, 37, 26, 0.15);
  border-radius: 6px;
  padding: 8px 12px;
  background: var(--file-bg);
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  transition: background 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

.file.active {
  border-color: var(--amber);
  box-shadow: 0 0 0 3px rgba(212, 166, 58, 0.18);
  background: var(--file-active-bg);
}

.file b {
  color: var(--muted);
  font-weight: 500;
  white-space: nowrap;
}

.live-feed {
  margin-top: 14px;
}

.mini-head {
  margin-bottom: 8px;
  padding-bottom: 8px;
}

.event-stream {
  display: grid;
  gap: 8px;
  max-height: 260px;
  overflow: auto;
}

.event-item {
  border: 1px solid rgba(41, 37, 26, 0.12);
  border-radius: 6px;
  background: var(--event-bg);
  padding: 8px 10px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  line-height: 1.4;
  transition: background 0.3s ease, border-color 0.3s ease;
}

.event-item strong {
  display: block;
  font-size: 12px;
}

.event-item.high {
  border-left: 5px solid var(--red);
}

.event-item.medium {
  border-left: 5px solid var(--amber);
}

.event-item.normal {
  border-left: 5px solid var(--green);
}

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

.stage-head p {
  max-width: 740px;
  margin: 6px 0 0;
}

.metric {
  min-width: 96px;
  border: 2px solid var(--line);
  text-align: center;
  padding: 8px;
  background: var(--button-sec-bg);
  transition: background 0.3s ease, border-color 0.3s ease;
}

.metric span {
  display: block;
  font-family: "Newsreader", serif;
  font-size: 42px;
  line-height: 0.9;
}

.metric small {
  font-size: 10px;
  color: var(--muted);
}

.agent-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  gap: 9px;
}

.agent {
  min-height: 96px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--agent-bg);
  padding: 10px;
  position: relative;
  overflow: hidden;
  transition: background 180ms ease, border-color 180ms ease, transform 180ms ease;
  box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}

.agent::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent 0 40%, rgba(76, 166, 170, 0.22) 50%, transparent 60% 100%);
  transform: translateX(-120%);
}

.agent.running::before {
  animation: sweep 0.9s linear infinite;
}

.agent.done {
  border-color: var(--green);
  background: var(--agent-done-bg);
}

.agent.hot {
  border-color: var(--red);
  background: var(--agent-hot-bg);
}

.agent-name {
  display: block;
  font-family: "Plus Jakarta Sans", sans-serif;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 6px;
}

.agent-output {
  font-family: "IBM Plex Mono", monospace;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.35;
}

.managed-lanes {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--button-sec-bg);
  padding: 14px;
  transition: background 0.3s ease, border-color 0.3s ease;
}

.lane-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid rgba(41, 37, 26, 0.15);
  padding-bottom: 9px;
  margin-bottom: 10px;
}

.lane-head span {
  color: var(--muted);
  font-family: "IBM Plex Mono", monospace;
  font-size: 10px;
}

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

.lane {
  min-height: 142px;
  border: 1px solid rgba(41, 37, 26, 0.12);
  border-radius: 6px;
  background: var(--file-bg);
  padding: 8px;
  transition: background 0.3s ease, border-color 0.3s ease;
}

.lane-title {
  display: block;
  margin-bottom: 7px;
  font-family: "Plus Jakarta Sans", sans-serif;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.lane-agent {
  border: 1px solid var(--line);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.06);
  padding: 7px;
  margin-bottom: 7px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 10px;
  line-height: 1.35;
  transition: background 0.3s ease, border-color 0.3s ease;
}

.lane-agent strong {
  display: block;
  font-family: "Plus Jakarta Sans", sans-serif;
  font-weight: 700;
  font-size: 11px;
}

.lane-agent.waiting_approval {
  border-color: var(--red);
  background: var(--agent-hot-bg);
}

@keyframes sweep {
  to {
    transform: translateX(120%);
  }
}

.analysis-bay {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 10px;
  margin-top: 14px;
}

.chart-card {
  min-height: 246px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--contrast-bg);
  color: var(--paper);
  padding: 12px;
  transition: background 0.3s ease, border-color 0.3s ease;
}

.chart-card .chart-head {
  border-color: rgba(245, 240, 223, 0.22);
}

.chart-card .chart-head span {
  color: #bdb69f;
}

#traceCanvas {
  width: 100%;
  height: 190px;
  display: block;
}

.commonality {
  display: grid;
  gap: 9px;
  padding-top: 4px;
}

.bar-row {
  display: grid;
  grid-template-columns: 92px 1fr 48px;
  gap: 8px;
  align-items: center;
  font-size: 11px;
}

.bar {
  height: 18px;
  border: 1px solid rgba(245, 240, 223, 0.45);
  background: rgba(245, 240, 223, 0.12);
}

.bar-fill {
  height: 100%;
  width: 0%;
  background: var(--cyan);
  transition: width 600ms ease;
}

.packet-panel {
  display: flex;
  flex-direction: column;
}

.verdict {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--verdict-bg);
  padding: 14px;
  margin-bottom: 12px;
  transition: background 0.3s ease, border-color 0.3s ease;
}

.severity {
  display: inline-block;
  background: var(--muted);
  color: #fff8ed;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 3px 8px;
  margin-bottom: 10px;
  font-family: "Plus Jakarta Sans", sans-serif;
  font-weight: 700;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.severity.medium {
  background: var(--amber);
  color: var(--ink);
}

.severity.high {
  background: var(--red);
  color: #fff8ed;
}

.verdict h3 {
  font-family: "Newsreader", serif;
  font-size: 26px;
  line-height: 1.1;
  margin: 0 0 10px;
}

.verdict p,
.sources p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.evidence-chain {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.chain-item {
  border-left: 4px solid var(--cyan);
  border-top: 1px solid rgba(41, 37, 26, 0.1);
  border-right: 1px solid rgba(41, 37, 26, 0.1);
  border-bottom: 1px solid rgba(41, 37, 26, 0.1);
  border-radius: 0 6px 6px 0;
  background: var(--file-bg);
  padding: 9px 12px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  line-height: 1.45;
  transition: background 0.3s ease, border-color 0.3s ease;
}

.chain-item strong {
  display: block;
  font-family: "Plus Jakarta Sans", sans-serif;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 3px;
}

.action-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--action-bg);
  padding: 14px;
  margin-bottom: 12px;
  transition: background 0.3s ease, border-color 0.3s ease;
}

.action-box ol {
  margin: 0;
  padding-left: 20px;
  font-size: 12px;
  line-height: 1.5;
}

.eval-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--verdict-bg);
  padding: 14px;
  margin-bottom: 12px;
  transition: background 0.3s ease, border-color 0.3s ease;
}

.eval-checks {
  display: grid;
  gap: 7px;
}

.eval-row {
  border-left: 4px solid var(--green);
  border-top: 1px solid rgba(41, 37, 26, 0.1);
  border-right: 1px solid rgba(41, 37, 26, 0.1);
  border-bottom: 1px solid rgba(41, 37, 26, 0.1);
  border-radius: 0 6px 6px 0;
  background: var(--eval-row-bg);
  padding: 8px 10px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  line-height: 1.4;
  transition: background 0.3s ease, border-color 0.3s ease;
}

@media (max-width: 980px) {
  .lane-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.eval-row.fail {
  border-color: var(--red);
}

.managed-output-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--contrast-bg);
  color: var(--paper);
  padding: 14px;
  margin-bottom: 12px;
}

.managed-output-box p {
  color: #c9c1a6;
  font-size: 11px;
  line-height: 1.45;
  margin-bottom: 9px;
}

.managed-output-box pre {
  max-height: 360px;
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  margin: 0;
  border: 1px solid rgba(245, 240, 223, 0.28);
  background: rgba(245, 240, 223, 0.08);
  color: #f5f0df;
  padding: 10px;
  font: 11px/1.45 "IBM Plex Mono", monospace;
}

.sources {
  margin-top: auto;
  border-top: 2px solid rgba(41, 37, 26, 0.22);
  padding-top: 12px;
}

.sources a {
  display: block;
  color: var(--ink);
  font-size: 12px;
  margin-top: 7px;
}

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

  .workspace > * {
    min-height: auto;
  }

  .watchtower-strip {
    grid-template-columns: repeat(2, minmax(180px, 1fr));
  }

  .real-data-strip {
    grid-template-columns: 1fr 1fr;
  }

  .format-strip {
    grid-template-columns: 1fr 1fr;
  }

  .format-links {
    grid-column: 1 / -1;
    grid-template-columns: repeat(4, minmax(140px, 1fr));
  }

  .economics-strip {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 760px) {
  .shell {
    width: min(100% - 20px, 440px);
    padding-top: 12px;
  }

  .topbar {
    grid-template-columns: 1fr;
    padding: 18px;
  }

  h1 {
    font-size: clamp(42px, 15vw, 64px);
  }

  .topbar::after {
    display: none;
  }

  .hero-checkpoints {
    margin-top: 14px;
  }

  .control-strip {
    display: grid;
    grid-template-columns: 1fr;
  }

  .primary,
  .secondary,
  .scenario-selector select {
    width: 100%;
  }

  .status {
    width: 100%;
    margin-left: 0;
  }

  .agent-grid {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
  }

  .workspace > * {
    padding: 12px;
  }

  .format-map img {
    height: 160px;
  }

  .analysis-bay {
    grid-template-columns: 1fr;
  }

  .watchtower-strip,
  .real-data-strip,
  .format-strip,
  .format-links,
  .economics-strip {
    grid-template-columns: 1fr;
  }

  .lane-grid {
    grid-template-columns: 1fr;
  }
}

/* Custom tooltips, scrollbars, laser scanners, and animations */
.tech-tooltip {
  position: absolute;
  pointer-events: none;
  background: var(--contrast-bg);
  border: 1px solid var(--line);
  color: var(--ink);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  padding: 8px 12px;
  box-shadow: var(--shadow);
  z-index: 1000;
  display: none;
  opacity: 0.95;
  backdrop-filter: blur(4px);
}

.tech-tooltip strong {
  color: var(--amber);
  display: block;
  margin-bottom: 2px;
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--paper);
}

::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 0px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--muted);
}

/* Scanning effect on images under Cyber Theme */
body[data-theme="cyber"] .real-data-strip figure {
  position: relative;
  overflow: hidden;
}

body[data-theme="cyber"] .real-data-strip figure::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: rgba(6, 182, 212, 0.7);
  box-shadow: 0 0 8px rgba(6, 182, 212, 0.9);
  animation: laser-scan 3s linear infinite;
  pointer-events: none;
}

@keyframes laser-scan {
  0% { top: 0%; }
  100% { top: 100%; }
}

/* Lucide Icon Style */
.lucide {
  width: 16px;
  height: 16px;
  stroke-width: 2.2px;
  vertical-align: middle;
  display: inline-block;
}

.btn-icon {
  width: 18px;
  height: 18px;
}

/* Stagger animations for page load */
@keyframes slideUpFade {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.topbar, .control-strip, .watchtower-strip, .real-data-strip, .format-strip, .economics-strip, .workspace > * {
  animation: slideUpFade 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.topbar { animation-delay: 0.05s; }
.control-strip { animation-delay: 0.1s; }
.watchtower-strip { animation-delay: 0.15s; }
.real-data-strip { animation-delay: 0.2s; }
.format-strip { animation-delay: 0.25s; }
.economics-strip { animation-delay: 0.3s; }
.workspace > .evidence-panel { animation-delay: 0.35s; }
.workspace > .agent-stage { animation-delay: 0.4s; }
.workspace > .packet-panel { animation-delay: 0.45s; }

/* Custom toggle buttons container */
.control-strip-buttons {
  display: flex;
  gap: 10px;
  align-items: center;
}

@media (max-width: 760px) {
  .control-strip-buttons {
    flex-direction: column;
    width: 100%;
  }
}

/* --- FLOATING TOAST NOTIFICATION --- */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 10000;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  background: var(--card-bg);
  border: 1px solid rgba(41,37,26,0.15);
  box-shadow: 0 10px 30px rgba(0,0,0,0.15);
  border-radius: 8px;
  padding: 16px;
  min-width: 320px;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transform: translateY(20px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
}

body[data-theme="cyber"] .toast {
  border-color: rgba(255,255,255,0.1);
  box-shadow: 0 10px 30px rgba(0,0,0,0.4);
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.toast::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 4px;
  background: var(--amber);
}

.toast.success::before {
  background: var(--green);
}

.toast.info::before {
  background: var(--cyan);
}

.toast-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
  font-size: 13px;
  color: var(--ink);
}

.toast-body {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.4;
  font-family: "IBM Plex Mono", monospace;
}

.toast-progress {
  height: 2px;
  background: rgba(217, 170, 56, 0.1);
  width: 100%;
  position: absolute;
  bottom: 0;
  left: 0;
}

.toast-progress-bar {
  height: 100%;
  background: var(--amber);
  width: 0%;
  transition: width 0.1s linear;
}

.toast.success .toast-progress-bar {
  background: var(--green);
}

.toast.info .toast-progress-bar {
  background: var(--cyan);
}

/* --- PIPELINE FLOW BANNER --- */
.pipeline-flow-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1px solid rgba(41, 37, 26, 0.15);
  border-radius: 8px;
  background: var(--card-bg);
  box-shadow: var(--shadow);
  padding: 10px 16px;
  margin-bottom: 12px;
  animation: slideUpFade 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
  animation-delay: 0.12s;
}

body[data-theme="cyber"] .pipeline-flow-banner {
  border-color: rgba(255, 255, 255, 0.1);
}

.pipeline-step {
  display: flex;
  align-items: center;
  gap: 10px;
  opacity: 0.4;
  transition: opacity 0.3s ease;
}

.pipeline-step.active {
  opacity: 1;
}

.pipeline-step.running {
  opacity: 1;
  animation: pulse-pipeline 1.5s infinite;
}

@keyframes pulse-pipeline {
  0% { opacity: 0.6; }
  50% { opacity: 1; }
  100% { opacity: 0.6; }
}

.step-num {
  font-family: "IBM Plex Mono", monospace;
  font-size: 13px;
  font-weight: bold;
  background: var(--button-sec-bg);
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 4px;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.pipeline-step.active .step-num {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}

.pipeline-step.active#step1 .step-num, .pipeline-step.active#step2 .step-num {
  background: var(--cyan);
  border-color: var(--cyan);
}

.pipeline-step.active#step3 .step-num {
  background: var(--amber);
  border-color: var(--amber);
}

.pipeline-step.active#step4 .step-num {
  background: var(--violet);
  border-color: var(--violet);
}

.pipeline-step.active#step5 .step-num {
  background: var(--green);
  border-color: var(--green);
}

.step-label {
  display: flex;
  flex-direction: column;
}

.step-label strong {
  font-size: 11px;
  font-weight: 600;
  color: var(--ink);
}

.step-label small {
  font-size: 9px;
  color: var(--muted);
}

.pipeline-arrow {
  color: var(--line);
  display: flex;
  align-items: center;
}

@media (max-width: 1024px) {
  .pipeline-flow-banner {
    flex-wrap: wrap;
    gap: 12px;
  }
  .pipeline-arrow {
    display: none;
  }
}
