:root {
  --bg: #07101c;
  --panel: rgba(12, 25, 42, 0.84);
  --panel-strong: rgba(15, 32, 53, 0.96);
  --line: rgba(137, 181, 222, 0.16);
  --line-strong: rgba(74, 168, 255, 0.32);
  --text: #edf6ff;
  --muted: #a8bdcf;
  --azure: #3aa0ff;
  --cyan: #42d4ea;
  --green: #45d19a;
  --amber: #f7b955;
  --red: #ff7384;
  --violet: #a894ff;
  --shadow: 0 18px 60px rgba(0, 0, 0, 0.28);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 0;
  min-height: 100vh;
  overflow-x: auto;
  color: var(--text);
  background:
    radial-gradient(circle at 20% -10%, rgba(34, 127, 205, 0.22), transparent 34rem),
    radial-gradient(circle at 90% 20%, rgba(71, 47, 141, 0.16), transparent 32rem),
    linear-gradient(145deg, #050b13 0%, #091321 46%, #07101b 100%);
}

button { font: inherit; }

.ambient {
  position: fixed;
  width: 28rem;
  height: 28rem;
  border-radius: 50%;
  filter: blur(110px);
  opacity: .12;
  pointer-events: none;
}
.ambient-one { top: 18%; left: 32%; background: var(--azure); }
.ambient-two { right: 4%; bottom: 2%; background: var(--violet); }

.app-shell {
  position: relative;
  z-index: 1;
  width: min(1720px, calc(100vw - 36px));
  margin: 0 auto;
  padding: 18px 0 22px;
}

.topbar,
.scenario-hero,
.control-dock {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.topbar {
  height: 66px;
  border-bottom: 1px solid var(--line);
}

.brand-lockup { display: flex; align-items: center; gap: 13px; }
.brand-mark {
  display: grid;
  grid-template-columns: repeat(3, 7px);
  gap: 3px;
  align-items: end;
  width: 31px;
  height: 31px;
  padding: 5px;
  border: 1px solid rgba(62, 165, 255, .42);
  border-radius: 8px;
  background: rgba(38, 119, 191, .12);
  box-shadow: inset 0 0 18px rgba(58, 160, 255, .12);
}
.brand-mark span { display: block; background: linear-gradient(180deg, var(--cyan), var(--azure)); border-radius: 1px; }
.brand-mark span:nth-child(1) { height: 9px; }
.brand-mark span:nth-child(2) { height: 17px; }
.brand-mark span:nth-child(3) { height: 12px; }

.eyebrow,
.section-kicker {
  margin: 0 0 4px;
  color: #93aec3;
  font-size: 11px;
  line-height: 1.2;
  font-weight: 750;
  letter-spacing: .17em;
}

.brand-lockup h1 { margin: 0; font-size: 20px; line-height: 1; font-weight: 720; letter-spacing: -.02em; }
.environment-strip { display: flex; align-items: center; gap: 10px; color: #a8bbcb; font: 600 12px/1 ui-monospace, SFMono-Regular, Menlo, monospace; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px rgba(69, 209, 154, .10), 0 0 15px rgba(69, 209, 154, .65); }
.divider { width: 1px; height: 14px; background: var(--line-strong); }
.mode-badge,
.phase-status,
.count-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 6px 10px;
  color: #b7d9f8;
  background: rgba(58, 160, 255, .09);
  font: 750 10px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: .08em;
}
.mode-badge.live { color: #92f2c8; border-color: rgba(69, 209, 154, .38); background: rgba(69, 209, 154, .10); }

.scenario-hero { min-height: 126px; padding: 18px 4px 14px; }
.scenario-hero h2 { margin: 6px 0 7px; font-size: clamp(23px, 2vw, 31px); line-height: 1.15; letter-spacing: -.035em; }
.scenario-hero > div > p:last-child { margin: 0; color: var(--muted); font-size: 13px; }
.hero-metrics { display: grid; grid-template-columns: repeat(3, minmax(125px, 1fr)); gap: 8px; }
.hero-metrics article { min-width: 132px; padding: 12px 14px; border-left: 1px solid var(--line-strong); }
.hero-metrics span { display: block; color: #93aec3; font-size: 10px; font-weight: 750; letter-spacing: .12em; text-transform: uppercase; }
.hero-metrics strong { display: block; margin-top: 7px; color: #cce6fb; font: 700 11px/1.2 ui-monospace, SFMono-Regular, Menlo, monospace; }

.panel {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(145deg, rgba(15, 31, 51, .88), rgba(8, 20, 34, .87));
  box-shadow: var(--shadow), inset 0 1px rgba(255,255,255,.015);
  backdrop-filter: blur(18px);
}

.workspace { display: grid; grid-template-columns: 242px minmax(480px, 1fr) 358px; gap: 12px; min-height: 644px; }
.phase-panel { padding: 16px 13px; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.panel-heading h3,
.explain-card h3 { margin: 0; font-size: 13px; letter-spacing: -.01em; }
.count-pill { padding: 5px 8px; font-size: 10px; }
.phase-list { display: grid; gap: 5px; margin: 16px 0 0; padding: 0; list-style: none; }
.phase-item button {
  position: relative;
  display: grid;
  grid-template-columns: 29px 1fr 8px;
  align-items: center;
  width: 100%;
  min-height: 52px;
  padding: 7px 8px;
  border: 1px solid transparent;
  border-radius: 9px;
  color: #8ca4b9;
  text-align: left;
  background: transparent;
  cursor: pointer;
  transition: .16s ease;
}
.phase-item button:hover { color: #d9ecfb; background: rgba(255,255,255,.025); border-color: var(--line); }
.phase-item button.selected { background: rgba(58, 160, 255, .08); border-color: rgba(58, 160, 255, .26); color: #eaf6ff; }
.phase-number { display: grid; place-items: center; width: 23px; height: 23px; border: 1px solid var(--line); border-radius: 7px; color: #8ba7bc; font: 700 10px/1 ui-monospace, monospace; }
.phase-item button.active .phase-number { color: #fff; border-color: var(--azure); background: rgba(58,160,255,.22); box-shadow: 0 0 15px rgba(58,160,255,.18); }
.phase-item button.completed .phase-number { color: #8febc4; border-color: rgba(69,209,154,.4); background: rgba(69,209,154,.09); }
.phase-label strong { display: block; color: inherit; font-size: 12px; line-height: 1.25; }
.phase-label small { display: block; margin-top: 3px; color: #7896ad; font-size: 9px; letter-spacing: .08em; text-transform: uppercase; }
.phase-indicator { width: 6px; height: 6px; border-radius: 50%; background: #29455d; }
.phase-item button.active .phase-indicator { background: var(--cyan); box-shadow: 0 0 10px var(--cyan); }
.phase-item button.completed .phase-indicator { background: var(--green); }

.center-stage { display: grid; grid-template-rows: minmax(300px, .88fr) minmax(260px, 1.12fr); gap: 12px; min-width: 0; }
.current-phase,
.timeline-panel { padding: 20px; }
.phase-title-row { display: flex; justify-content: space-between; align-items: start; }
.phase-title-row h3 { margin: 4px 0 0; font-size: 25px; letter-spacing: -.035em; }
.phase-status.active { color: #9ee8ff; }
.phase-status.completed { color: #8febc4; border-color: rgba(69,209,154,.32); background: rgba(69,209,154,.08); }
.customer-question { margin: 14px 0 18px; color: #9eb4c7; font-size: 13px; }
.agent-now { display: flex; align-items: center; gap: 14px; padding: 15px; border: 1px solid rgba(66,212,234,.18); border-radius: 11px; background: linear-gradient(90deg, rgba(27,120,160,.13), rgba(21,67,116,.08)); }
.agent-now h4 { margin: 0 0 4px; font-size: 12px; }
.agent-now p { margin: 0; color: #9dbfd0; font-size: 11px; line-height: 1.45; }
.pulse-ring { width: 17px; height: 17px; flex: 0 0 auto; border: 2px solid var(--cyan); border-radius: 50%; box-shadow: 0 0 0 5px rgba(66,212,234,.08), 0 0 18px rgba(66,212,234,.32); }
.action-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 12px; }
.action-card { padding: 12px; border: 1px solid var(--line); border-radius: 9px; background: rgba(5,14,25,.42); }
.action-card strong { display: block; font-size: 11px; }
.action-card p { margin: 6px 0 8px; color: #819aae; font-size: 10px; line-height: 1.45; }
.action-card code { display: block; overflow: hidden; color: #79c9fa; font: 600 10px/1.4 ui-monospace, monospace; text-overflow: ellipsis; white-space: nowrap; }

.timeline-panel { min-height: 0; overflow: hidden; }
.timeline { position: relative; display: grid; gap: 9px; height: calc(100% - 43px); margin-top: 14px; overflow-y: auto; padding-right: 6px; }
.timeline::before { content: ""; position: absolute; left: 7px; top: 6px; bottom: 6px; width: 1px; background: linear-gradient(var(--azure), rgba(58,160,255,.08)); }
.timeline-entry { position: relative; display: grid; grid-template-columns: 16px 76px 1fr; gap: 10px; padding: 7px 0; }
.timeline-node { width: 7px; height: 7px; margin-top: 5px; border-radius: 50%; background: var(--azure); box-shadow: 0 0 0 4px rgba(58,160,255,.10); z-index: 1; }
.timeline-time { color: #829fb5; font: 600 10px/1.5 ui-monospace, monospace; }
.timeline-content { min-width: 0; }
.timeline-content strong { display: block; margin-bottom: 3px; color: #b9d8f0; font: 700 11px/1.35 ui-monospace, monospace; }
.timeline-content p { margin: 0; color: #a1b7c8; font-size: 11px; line-height: 1.45; }
.timeline-empty { display: grid; place-items: center; min-height: 160px; color: #607c94; font-size: 11px; }

.evidence-column { display: grid; grid-template-columns: 1fr 1fr; grid-auto-rows: minmax(124px, auto); gap: 10px; min-width: 0; }
.explain-card { padding: 14px; min-width: 0; overflow: hidden; }
.explain-card h3 { margin-bottom: 11px; }
.source-panel,
.tool-panel { grid-column: 1 / -1; }
.observation-panel,
.interpretation-panel,
.approval-panel,
.recovery-panel { grid-column: 1 / -1; }
.chip-list { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { max-width: 100%; padding: 5px 7px; border: 1px solid rgba(58,160,255,.22); border-radius: 6px; color: #9bcdef; background: rgba(58,160,255,.07); font-size: 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tool-list { display: grid; gap: 6px; }
.tool-item { display: flex; align-items: center; gap: 7px; min-width: 0; color: #a2b8c9; font: 600 10px/1.4 ui-monospace, monospace; }
.tool-item::before { content: ">_"; color: var(--cyan); font-weight: 800; }
.tool-item span { overflow: visible; white-space: normal; overflow-wrap: anywhere; }
.receipt-heading { margin: 12px 0 7px; color: #b8cee0; font-size: 11px; }
.receipt-list { min-width: 0; }
.execution-receipt { display: grid; gap: 7px; }
.execution-receipt > div { display: flex; justify-content: space-between; gap: 8px; color: #9fc0d8; font-size: 10px; }
.execution-receipt > div span { color: #85a4bb; }
.execution-receipt code { display: block; max-height: 92px; padding: 7px; overflow: auto; border: 1px solid var(--line); border-radius: 6px; color: #94d7ff; font: 600 10px/1.45 ui-monospace, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
.execution-receipt ul { display: grid; gap: 4px; margin: 0; padding: 0; list-style: none; }
.execution-receipt li { display: flex; justify-content: space-between; gap: 8px; color: #8da8bc; font: 600 9px/1.3 ui-monospace, monospace; }
.execution-receipt li strong { color: #b9d8f0; }
.no-receipt { margin: 0; color: #87a0b5; font-size: 10px; line-height: 1.4; }
.compact-list { display: grid; gap: 7px; margin: 0; padding: 0; list-style: none; }
.compact-list li { position: relative; padding-left: 13px; color: #94adbf; font-size: 10px; line-height: 1.45; }
.compact-list li::before { content: ""; position: absolute; left: 0; top: 5px; width: 5px; height: 5px; border-radius: 50%; background: var(--green); box-shadow: 0 0 8px rgba(69,209,154,.5); }
.hypothesis { margin: 0 0 10px; color: #9eb6c8; font-size: 10px; line-height: 1.5; }
.confidence-track { height: 4px; border-radius: 999px; background: rgba(255,255,255,.06); overflow: hidden; }
.confidence-track span { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--azure), var(--cyan)); transition: width .35s ease; }
.interpretation-panel small { display: block; margin-top: 7px; color: #88a4b9; font: 700 9px/1 ui-monospace, monospace; letter-spacing: .08em; }
.approval-panel p,
.recovery-panel p { margin: 0; color: #91a9ba; font-size: 10px; line-height: 1.45; }
.decision-row { display: grid; grid-template-columns: .65fr 1.35fr; gap: 7px; margin-top: 11px; }
.proposal-details { display: grid; gap: 5px; margin: 10px 0 0; }
.proposal-details > div { display: grid; grid-template-columns: 58px 1fr; gap: 7px; }
.proposal-details dt { color: #7fa0b8; font: 700 9px/1.35 ui-monospace, monospace; }
.proposal-details dd { margin: 0; color: #a9c0d1; font-size: 10px; line-height: 1.35; overflow-wrap: anywhere; }
.verification-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; margin-top: 10px; }
.verification-grid span { padding: 6px 4px; border: 1px solid var(--line); border-radius: 6px; color: #88a4b9; font: 650 9px/1.2 ui-monospace, monospace; text-align: center; }
.verification-receipt { max-height: 110px; margin: 9px 0 0; padding: 7px; overflow: auto; border: 1px solid var(--line); border-radius: 6px; color: #9fc0d8; background: rgba(4, 12, 22, .45); font: 600 9px/1.4 ui-monospace, monospace; white-space: pre-wrap; }
.verification-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-top: 8px; }

.control-dock { min-height: 70px; margin-top: 12px; padding: 12px 15px; }
.control-note { display: flex; align-items: center; gap: 12px; }
.control-note p { margin: 0; }
.control-note strong { display: block; font-size: 11px; }
.control-note small { display: block; margin-top: 3px; color: #6f899f; font-size: 9px; }
.controls { display: flex; gap: 8px; }
.button { min-height: 34px; padding: 0 13px; border: 1px solid rgba(58,160,255,.30); border-radius: 8px; color: #d9edfc; background: rgba(58,160,255,.10); font-size: 10px; font-weight: 720; cursor: pointer; transition: .16s ease; }
.button:hover:not(:disabled) { transform: translateY(-1px); border-color: rgba(66,212,234,.56); background: rgba(58,160,255,.17); }
.button:disabled { opacity: .32; cursor: not-allowed; }
.button.primary { padding-inline: 18px; color: #07111e; border-color: #61c5ff; background: linear-gradient(135deg, #55bcff, #42d4ea); box-shadow: 0 8px 22px rgba(58,160,255,.18); }
.button.live { color: #9eeed0; border-color: rgba(69,209,154,.28); background: rgba(69,209,154,.07); }
.live-dot { display: inline-block; width: 6px; height: 6px; margin-right: 6px; border-radius: 50%; background: var(--green); box-shadow: 0 0 9px var(--green); }
.button.ghost { color: #8fa8ba; border-color: var(--line); background: rgba(255,255,255,.018); }
.button.approve { color: #9eeed0; border-color: rgba(69,209,154,.30); background: rgba(69,209,154,.08); }
.button.danger { color: #e7a2aa; }

.toast { position: fixed; right: 24px; bottom: 104px; z-index: 10; max-width: 380px; padding: 11px 14px; border: 1px solid var(--line-strong); border-radius: 9px; color: #d7e9f6; background: rgba(9,23,39,.96); box-shadow: var(--shadow); font-size: 11px; opacity: 0; transform: translateY(8px); pointer-events: none; transition: .2s ease; }
.toast.visible { opacity: 1; transform: translateY(0); }
.toast.error { border-color: rgba(255,115,132,.4); color: #ffc1c8; }

@media (max-height: 850px) {
  .scenario-hero { min-height: 104px; }
  .workspace { min-height: 585px; }
  .phase-item button { min-height: 46px; }
  .control-dock { min-height: 62px; }
}

@media (max-width: 1100px) {
  .workspace { grid-template-columns: 220px minmax(0, 1fr); }
  .evidence-column { grid-column: 1 / -1; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .source-panel,
  .tool-panel,
  .observation-panel,
  .interpretation-panel,
  .approval-panel,
  .recovery-panel { grid-column: span 1; }
}

@media (max-width: 700px) {
  .app-shell { width: calc(100vw - 20px); padding-top: 10px; }
  .topbar,
  .scenario-hero,
  .control-dock { align-items: flex-start; flex-direction: column; gap: 12px; height: auto; }
  .topbar { padding-bottom: 12px; }
  .environment-strip { flex-wrap: wrap; line-height: 1.4; }
  .scenario-hero > div { min-width: 0; width: 100%; }
  .scenario-hero h2 { overflow-wrap: anywhere; }
  .hero-metrics { width: 100%; grid-template-columns: 1fr; }
  .hero-metrics article { min-width: 0; }
  .workspace { grid-template-columns: 1fr; }
  .evidence-column { grid-column: auto; grid-template-columns: 1fr; }
  .source-panel,
  .tool-panel,
  .observation-panel,
  .interpretation-panel,
  .approval-panel,
  .recovery-panel { grid-column: auto; }
  .action-list { grid-template-columns: 1fr; }
  .controls { display: grid; grid-template-columns: 1fr; width: 100%; }
  .button { min-height: 42px; }
}

@media (max-width: 360px) {
  .brand-lockup { min-width: 0; gap: 8px; }
  .brand-lockup > div { min-width: 0; }
  .brand-lockup .eyebrow { font-size: 9px; letter-spacing: .11em; overflow-wrap: anywhere; }
  .brand-lockup h1 { font-size: 18px; }
  .scenario-hero h2 { font-size: 21px; }
}
