:root {
  color-scheme: dark;
  --bg: #07111f;
  --panel: rgba(12, 25, 42, 0.82);
  --panel-strong: rgba(15, 36, 61, 0.94);
  --line: rgba(130, 170, 210, 0.24);
  --text: #e9f4ff;
  --muted: #8ca6bd;
  --cyan: #21d4fd;
  --blue: #3b82f6;
  --green: #3ee58b;
  --yellow: #facc15;
  --orange: #fb923c;
  --red: #ff4d5e;
  --purple: #b892ff;
  font-family: "Noto Sans SC", "Microsoft YaHei", "PingFang SC", sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at 12% 18%, rgba(33, 212, 253, 0.18), transparent 28%),
    radial-gradient(circle at 82% 0%, rgba(59, 130, 246, 0.24), transparent 30%),
    linear-gradient(135deg, #050b16 0%, #0a1830 48%, #08101e 100%);
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(rgba(255,255,255,0.035) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,0.035) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: linear-gradient(to bottom, black, transparent 90%);
}

.shell { position: relative; width: min(1680px, calc(100vw - 40px)); margin: 0 auto; padding: 28px 0 44px; }
.hero { display: flex; justify-content: space-between; gap: 24px; align-items: flex-start; margin-bottom: 24px; }
.eyebrow { color: var(--cyan); letter-spacing: 0.16em; text-transform: uppercase; font-size: 12px; margin: 0 0 8px; }
h1 { font-family: "Space Grotesk", "Noto Sans SC", sans-serif; font-size: clamp(32px, 5vw, 64px); line-height: 0.95; margin: 0; }
.subtitle { max-width: 920px; color: var(--muted); line-height: 1.7; margin: 16px 0 0; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.ghost { border: 1px solid var(--line); color: var(--text); background: rgba(11, 25, 44, 0.72); border-radius: 999px; padding: 10px 14px; text-decoration: none; cursor: pointer; }
.ghost:hover { border-color: var(--cyan); box-shadow: 0 0 22px rgba(33, 212, 253, 0.2); }

.cards { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 14px; margin-bottom: 16px; }
.metric-card, .panel, .detail-card {
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(13, 33, 56, 0.88), rgba(7, 18, 32, 0.88));
  box-shadow: 0 18px 70px rgba(0, 0, 0, 0.28), inset 0 1px rgba(255,255,255,0.05);
  backdrop-filter: blur(14px);
  border-radius: 24px;
}
.metric-card { padding: 18px; min-height: 120px; position: relative; overflow: hidden; }
.metric-card::after { content: ""; position: absolute; inset: auto -20% -40% 40%; height: 80px; background: radial-gradient(circle, rgba(33,212,253,0.28), transparent 68%); }
.metric-label { color: var(--muted); font-size: 13px; }
.metric-value { font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 34px; margin-top: 12px; }
.metric-note { color: var(--muted); font-size: 12px; margin-top: 8px; }

.panel { padding: 18px; }

.projected-panel { margin-bottom: 18px; border-color: rgba(33, 212, 253, 0.34); }
.projected-summary { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(360px, 0.9fr); gap: 18px; }
.project-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.project-card { border: 1px solid rgba(255,255,255,0.08); background: rgba(5, 18, 34, 0.62); border-radius: 18px; padding: 14px; }
.project-benchmarks { border: 1px solid rgba(255,255,255,0.08); background: rgba(5, 18, 34, 0.62); border-radius: 18px; padding: 14px; display: grid; gap: 10px; }
.project-note { color: var(--muted); font-size: 12px; line-height: 1.55; margin-bottom: 2px; }
.project-row { display: grid; grid-template-columns: 110px 1fr 58px; gap: 10px; align-items: center; }
.project-label { color: #dcecff; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.project-track { height: 12px; background: rgba(255,255,255,0.08); border-radius: 999px; overflow: hidden; }
.project-fill { height: 100%; background: linear-gradient(90deg, var(--green), var(--cyan)); box-shadow: 0 0 18px rgba(33,212,253,0.24); border-radius: inherit; }
.actual-fill { background: linear-gradient(90deg, var(--green), #d9ff72); box-shadow: 0 0 18px rgba(62,229,139,0.28); }
.project-num { font-family: "JetBrains Mono", ui-monospace, monospace; color: var(--muted); font-size: 12px; text-align: right; }

.split { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(320px, 0.7fr); gap: 18px; margin-bottom: 18px; }
.section-title { display: flex; justify-content: space-between; gap: 16px; align-items: baseline; flex-wrap: wrap; margin-bottom: 14px; }
.section-title span { font-size: 18px; font-weight: 700; }
.section-title small { color: var(--muted); line-height: 1.45; }
.heatmap { display: grid; gap: 8px; }
.heat-row { display: grid; grid-template-columns: 150px repeat(7, minmax(70px, 1fr)); gap: 8px; align-items: stretch; }
.heat-cell { border: 1px solid rgba(255,255,255,0.08); border-radius: 12px; padding: 10px; min-height: 44px; color: #eff8ff; background: rgba(15, 31, 54, 0.8); font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 12px; }
.heat-label { color: var(--muted); font-family: inherit; }
.rules { display: grid; gap: 8px; }
.rule { display: grid; grid-template-columns: 1fr 64px; gap: 10px; align-items: center; }
.rule-bar { height: 10px; background: rgba(255,255,255,0.08); border-radius: 999px; overflow: hidden; margin-top: 6px; }
.rule-fill { height: 100%; background: linear-gradient(90deg, var(--cyan), var(--orange), var(--red)); border-radius: inherit; }

.workspace { display: grid; grid-template-columns: 390px minmax(0, 1fr); gap: 18px; align-items: start; }
.case-list { max-height: calc(100vh - 36px); position: sticky; top: 18px; overflow: hidden; display: flex; flex-direction: column; }
.sticky-title { flex: none; }
.filters { display: grid; gap: 8px; margin-bottom: 12px; }
input, select { width: 100%; color: var(--text); background: rgba(3, 12, 22, 0.7); border: 1px solid var(--line); border-radius: 14px; padding: 11px 12px; outline: none; }
input:focus, select:focus { border-color: var(--cyan); }
input[type="checkbox"] { width: 16px; height: 16px; min-width: 16px; padding: 0; accent-color: var(--cyan); }
.case-items { overflow: auto; display: grid; gap: 10px; padding-right: 6px; }
.case-item { border: 1px solid rgba(255,255,255,0.08); background: rgba(11, 24, 42, 0.78); border-radius: 18px; padding: 12px; cursor: pointer; transition: 160ms ease; }
.case-item:hover, .case-item.active { border-color: var(--cyan); transform: translateY(-1px); }
.case-line { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.case-title { font-weight: 700; line-height: 1.35; }
.case-meta { margin-top: 8px; color: var(--muted); font-size: 12px; display: flex; flex-wrap: wrap; gap: 8px; }
.badge { display: inline-flex; align-items: center; flex: 0 1 auto; max-width: 100%; border-radius: 999px; padding: 4px 8px; font-size: 11px; line-height: 1.3; border: 1px solid rgba(255,255,255,0.12); background: rgba(255,255,255,0.06); overflow-wrap: anywhere; }
.actual-chip { border-color: rgba(62,229,139,0.38); color: #d9ffe8; background: rgba(62,229,139,0.12); }

.chain-panel { min-height: 720px; }
.chain-title { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; align-items: flex-start; }
.chain-title > div:first-child { min-width: 0; }
#caseTitle { display: block; overflow-wrap: anywhere; line-height: 1.25; }
#caseSubtitle { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; max-width: 100%; margin-top: 7px; }
.case-subtitle-chip { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; border: 1px solid rgba(255,255,255,0.1); border-radius: 999px; padding: 4px 8px; background: rgba(255,255,255,0.055); color: #dcecff; font-size: 11px; line-height: 1.25; overflow-wrap: anywhere; }
.case-subtitle-chip b { flex: none; color: var(--muted); font-size: 10px; letter-spacing: 0.06em; text-transform: uppercase; }
.case-subtitle-chip span { min-width: 0; overflow-wrap: anywhere; }
.toggle-row { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-start; align-items: center; width: 100%; max-width: 100%; padding-top: 12px; border-top: 1px solid rgba(255,255,255,0.08); color: var(--muted); }
.toggle-row label { display: inline-flex; flex: 0 0 auto; gap: 7px; align-items: center; min-height: 38px; white-space: nowrap; }
.toggle-row .ghost,
.toggle-row .mode-select { flex: 0 0 auto; }
.chain { display: flex; gap: 14px; overflow-x: auto; padding: 18px 2px 26px; min-height: 260px; }
.chain.empty { align-items: center; justify-content: center; color: var(--muted); border: 1px dashed var(--line); border-radius: 18px; }
.chain.split-chain { display: grid; gap: 16px; overflow: visible; padding: 8px 0 18px; }
.lane { position: relative; overflow: hidden; border: 1px solid rgba(255,255,255,0.1); border-radius: 22px; background: rgba(3, 13, 24, 0.58); }
.lane::before { content: ""; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(90deg, rgba(255,77,94,0.08), transparent 34%); }
.guarded-lane { border-color: rgba(62, 229, 139, 0.32); background: linear-gradient(90deg, rgba(62,229,139,0.08), rgba(3,13,24,0.58) 46%); }
.guarded-lane::before { background: linear-gradient(90deg, rgba(62,229,139,0.16), transparent 36%); }
.lane-head { position: relative; z-index: 1; display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; padding: 14px 16px 0; }
.lane h3 { margin: 0; font-size: 15px; letter-spacing: 0.04em; text-transform: uppercase; }
.lane-head small { max-width: min(640px, 62%); color: var(--muted); font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 11px; line-height: 1.35; text-align: right; overflow-wrap: anywhere; }
.lane-scroll { position: relative; z-index: 1; display: flex; gap: 14px; overflow-x: auto; padding: 16px 16px 22px; min-height: 250px; }
.split-chain .node-wrap { flex: 0 0 auto; }
.lane-empty { display: grid; place-items: center; min-width: 240px; min-height: 180px; color: var(--muted); border: 1px dashed var(--line); border-radius: 18px; }
.node-wrap { display: flex; align-items: center; gap: 14px; }
.risk-node { width: 250px; min-height: 246px; border: 1px solid var(--line); border-radius: 22px; padding: 14px; background: rgba(10, 22, 38, 0.9); position: relative; display: flex; flex-direction: column; cursor: pointer; transition: 180ms ease; box-shadow: inset 0 1px rgba(255,255,255,0.04); }
.risk-node:hover, .risk-node.active { transform: translateY(-3px); border-color: var(--cyan); box-shadow: 0 18px 38px rgba(0,0,0,0.32), 0 0 24px rgba(33,212,253,0.18); }
.risk-node.playing { animation: pulse 850ms ease; }
@keyframes pulse { 0% { transform: scale(0.98); } 55% { transform: scale(1.03); } 100% { transform: scale(1); } }
.live-node-top { position: relative; z-index: 1; display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; color: var(--muted); font-size: 12px; text-transform: uppercase; }
.live-node-top span { min-width: 0; overflow-wrap: anywhere; }
.live-node-top strong { flex: none; color: var(--text); font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 25px; line-height: 1; }
.live-node-action { position: relative; z-index: 1; margin: 12px 0 10px; font-weight: 900; line-height: 1.25; overflow-wrap: anywhere; }
.live-badges { position: relative; z-index: 1; display: flex; flex-wrap: wrap; gap: 7px; align-items: flex-start; margin: 0; padding-bottom: 12px; border-bottom: 1px solid rgba(255,255,255,0.08); }
.live-node-source-block { position: relative; z-index: 1; display: block; margin-top: 11px; padding: 9px 10px; border: 1px solid rgba(255,255,255,0.08); border-radius: 12px; background: rgba(3,12,22,0.34); }
.node-source-label { display: block; margin-bottom: 5px; color: var(--muted); font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 10px; line-height: 1; letter-spacing: 0.08em; text-transform: uppercase; }
.live-node-source { color: #cfe7ff; font-size: 12px; line-height: 1.42; overflow-wrap: anywhere; word-break: break-word; }
.node-rules { position: relative; z-index: 1; margin-top: 12px; display: flex; flex-wrap: wrap; gap: 6px; }
.arrow { color: var(--muted); display: grid; gap: 6px; justify-items: center; min-width: 56px; }
.arrow-line { width: 54px; height: 2px; background: linear-gradient(90deg, var(--cyan), var(--orange), var(--red)); box-shadow: 0 0 18px rgba(251,146,60,0.28); }
.arrow-label { font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 11px; }

.level-low { --level: var(--green); }
.level-medium { --level: var(--yellow); }
.level-high { --level: var(--orange); }
.level-critical, .level-realized { --level: var(--red); }
.level-closed, .level-none { --level: var(--green); }
.risk-node { border-color: color-mix(in srgb, var(--level, var(--cyan)) 60%, rgba(255,255,255,0.1)); }
.risk-node::before { content: ""; position: absolute; z-index: 0; inset: -1px; border-radius: inherit; background: radial-gradient(circle at 20% 0%, color-mix(in srgb, var(--level, var(--cyan)) 32%, transparent), transparent 48%); pointer-events: none; }
.level-chip { color: #06111e; background: var(--level, var(--cyan)); }

.projection-chip { border-color: rgba(184, 146, 255, 0.45); color: #eadcff; background: rgba(184, 146, 255, 0.14); }
.policy-chip { border-color: rgba(33, 212, 253, 0.34); color: #dff7ff; background: rgba(33, 212, 253, 0.1); }
.policy-deny_tool .policy-chip { color: #06111e; background: linear-gradient(90deg, var(--green), var(--cyan)); border-color: transparent; }
.policy-approve_required .policy-chip { color: #1d1202; background: var(--yellow); border-color: transparent; }
.policy-block_prompt .policy-chip { color: #06111e; background: linear-gradient(90deg, var(--green), #d9ff72); border-color: transparent; }
.event-projected_guard_decision { border-color: rgba(62,229,139,0.82); box-shadow: 0 0 0 1px rgba(62,229,139,0.18), 0 22px 44px rgba(0,0,0,0.3), 0 0 34px rgba(62,229,139,0.16); }
.event-projected_guard_decision::after { content: "GUARD"; position: absolute; top: -10px; right: 16px; padding: 4px 9px; border-radius: 999px; color: #06111e; background: var(--green); font-size: 10px; font-weight: 800; letter-spacing: 0.08em; }
.event-projected_outcome { width: 180px; min-height: 150px; border-style: dashed; background: linear-gradient(180deg, rgba(62,229,139,0.18), rgba(7,18,32,0.9)); }
.event-projected_outcome .node-action { color: var(--green); }
.event-actual_guard_scan { border-color: rgba(33,212,253,0.58); background: linear-gradient(180deg, rgba(33,212,253,0.14), rgba(10,22,38,0.92)); }
.event-actual_guard_decision { border-color: rgba(62,229,139,0.92); box-shadow: 0 0 0 1px rgba(62,229,139,0.24), 0 22px 44px rgba(0,0,0,0.3), 0 0 38px rgba(62,229,139,0.22); }
.event-actual_guard_decision::after { content: "ACTUAL"; position: absolute; top: -10px; right: 16px; padding: 4px 9px; border-radius: 999px; color: #06111e; background: #d9ff72; font-size: 10px; font-weight: 800; letter-spacing: 0.08em; }
.event-actual_guard_outcome { width: 190px; min-height: 150px; border-style: dashed; background: linear-gradient(180deg, rgba(62,229,139,0.2), rgba(7,18,32,0.9)); }
.event-actual_guard_outcome .node-action { color: var(--green); }
.mode-select { min-width: 176px; width: auto; border-radius: 999px; padding: 9px 12px; }
.detail-card:first-child { border-color: rgba(33, 212, 253, 0.32); background: linear-gradient(180deg, rgba(7, 36, 55, 0.88), rgba(7, 18, 32, 0.9)); }

.details-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 0.8fr) minmax(0, 1.2fr); gap: 14px; margin-top: 14px; }
.detail-card { padding: 16px; min-height: 220px; }
.detail-card h3 { margin: 0 0 10px; }
pre { margin: 0; white-space: pre-wrap; word-break: break-word; color: #cfe7ff; font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 12px; line-height: 1.55; }

@media (max-width: 1160px) {
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split, .workspace, .details-grid, .projected-summary { grid-template-columns: 1fr; }
  .project-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .case-list { position: static; max-height: none; }
  .lane-head { flex-direction: column; gap: 6px; align-items: flex-start; }
  .lane-head small { max-width: 100%; text-align: left; }
  .hero { flex-direction: column; }
  .toggle-row { justify-content: flex-start; }
}
