:root {
  --black: #080808;
  --black-2: #101010;
  --black-3: #171717;
  --ivory: #f2f0e8;
  --paper: #e8e6de;
  --muted: #9b9a94;
  --line: #33332f;
  --line-soft: #232321;
  --blue: #5368ff;
  --blue-soft: #9ba7ff;
  --amber: #d7a84a;
  --red: #b85b58;
  --green: #72a083;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  --sans: Inter, Arial, Helvetica, sans-serif;
}

* { box-sizing: border-box; }

html { color-scheme: dark; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--black);
  color: var(--ivory);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.45;
}

button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

button:focus-visible, a:focus-visible, input:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--blue-soft);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 10px;
  left: 10px;
  padding: 10px 14px;
  color: var(--black);
  background: var(--ivory);
  transform: translateY(-150%);
}

.skip-link:focus { transform: translateY(0); }

.app-header {
  min-height: 72px;
  padding: 0 28px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(8, 8, 8, 0.96);
  backdrop-filter: blur(12px);
}

.brand {
  display: inline-flex;
  width: max-content;
  align-items: center;
  gap: 14px;
  color: var(--ivory);
  text-decoration: none;
  letter-spacing: 0.17em;
  font-size: 13px;
}

.brand img { width: 34px; height: 42px; object-fit: cover; }

.product-name {
  display: flex;
  gap: 12px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.product-name .slash { color: var(--line); }

.header-cta {
  justify-self: end;
  padding: 12px 15px;
  border: 1px solid var(--line);
  color: var(--ivory);
  text-decoration: none;
  font-size: 12px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  transition: background 160ms ease, color 160ms ease;
}

.header-cta:hover { background: var(--ivory); color: var(--black); }

.loading, .error {
  min-height: calc(100vh - 72px);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--muted);
  font-family: var(--mono);
  letter-spacing: 0.06em;
}

.error { flex-direction: column; }
.error strong { color: var(--ivory); }

.loading-dot, .status-dot {
  width: 9px;
  height: 9px;
  display: inline-block;
  border-radius: 50%;
  background: var(--blue);
  box-shadow: 0 0 16px rgba(83, 104, 255, 0.9);
}

.loading-dot { animation: pulse 1.25s ease-in-out infinite; }

@keyframes pulse { 50% { opacity: 0.28; transform: scale(0.72); } }

.proof-intro {
  min-height: 252px;
  padding: 48px clamp(24px, 4vw, 64px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 48px;
  align-items: end;
  border-bottom: 1px solid var(--line);
}

.eyebrow, .section-label {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

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

.proof-intro h1 {
  max-width: 900px;
  margin: 22px 0 12px;
  font-size: clamp(40px, 6vw, 82px);
  line-height: 0.94;
  letter-spacing: -0.055em;
  font-weight: 500;
}

.proof-intro p {
  max-width: 800px;
  margin: 0;
  color: #b8b7b0;
  font-size: clamp(16px, 1.6vw, 21px);
}

.proof-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(120px, 1fr));
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.proof-metric {
  min-width: 150px;
  padding: 18px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.proof-metric strong { display: block; font-size: 30px; font-weight: 400; letter-spacing: -0.04em; }
.proof-metric span { color: var(--muted); font-family: var(--mono); font-size: 10px; text-transform: uppercase; letter-spacing: 0.09em; }

.lens-nav {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-bottom: 1px solid var(--line);
}

.lens {
  min-height: 64px;
  padding: 0 28px;
  display: flex;
  align-items: center;
  gap: 16px;
  border: 0;
  border-right: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  font-size: 12px;
}

.lens:last-child { border-right: 0; }
.lens span { font-family: var(--mono); font-size: 10px; }
.lens:hover { color: var(--ivory); }
.lens.active { color: var(--black); background: var(--ivory); }

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(580px, 1fr) 340px;
  min-height: 780px;
  border-bottom: 1px solid var(--line);
}

.case-rail, .inspector { background: var(--black-2); }
.case-rail { border-right: 1px solid var(--line); overflow: hidden; }
.inspector { border-left: 1px solid var(--line); padding: 22px; }

.rail-heading {
  min-height: 78px;
  padding: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line-soft);
}

.rail-heading strong { display: block; margin-top: 5px; font-size: 15px; font-weight: 500; }

.text-button {
  padding: 0;
  border: 0;
  background: none;
  color: var(--blue-soft);
  cursor: pointer;
  font-size: 12px;
}

.search-field {
  margin: 14px;
  height: 42px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border: 1px solid var(--line);
  color: var(--muted);
}

.search-field:focus-within { border-color: var(--blue); }

.search-field input {
  min-width: 0;
  flex: 1;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ivory);
  font-size: 12px;
}

.case-list { max-height: 720px; overflow: auto; border-top: 1px solid var(--line-soft); }

.case-item {
  width: 100%;
  padding: 15px 17px;
  display: block;
  border: 0;
  border-bottom: 1px solid var(--line-soft);
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.case-item:hover { background: var(--black-3); }
.case-item.active { background: var(--ivory); color: var(--black); }

.case-top { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.case-file { font-family: var(--mono); font-size: 12px; }
.case-stops { color: var(--muted); font-size: 10px; white-space: nowrap; }
.case-item.active .case-stops { color: #66645e; }
.case-status { margin-top: 7px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.case-dept { margin-top: 4px; color: var(--muted); font-size: 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.case-item.active .case-dept { color: #66645e; }
.empty-list { padding: 24px 18px; color: var(--muted); font-size: 12px; }

.map-column { min-width: 0; }

.view-heading {
  min-height: 124px;
  padding: 22px 26px;
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: end;
  border-bottom: 1px solid var(--line);
}

.view-heading h2 { margin: 7px 0 4px; font-size: 27px; font-weight: 500; letter-spacing: -0.035em; }
.view-heading p { max-width: 650px; margin: 0; color: var(--muted); }
.view-actions { display: flex; gap: 8px; flex: 0 0 auto; }

.primary-button, .secondary-button {
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line);
  cursor: pointer;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.primary-button { border-color: var(--ivory); background: var(--ivory); color: var(--black); }
.secondary-button { background: transparent; color: var(--ivory); }
.primary-button:disabled { opacity: 0.35; cursor: not-allowed; }
.primary-button:not(:disabled):hover, .secondary-button:hover { border-color: var(--blue); }

.view-panel { min-height: 654px; }

.graph-toolbar {
  height: 48px;
  padding: 0 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--line-soft);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.legend { display: flex; gap: 18px; }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.legend-line { width: 18px; height: 1px; background: #666660; }
.legend-node { width: 7px; height: 7px; border-radius: 50%; background: var(--amber); }
.legend-node.complete { background: var(--green); }

.graph-viewport {
  height: 570px;
  overflow: auto;
  background-color: #0b0b0b;
  background-image: linear-gradient(var(--line-soft) 1px, transparent 1px), linear-gradient(90deg, var(--line-soft) 1px, transparent 1px);
  background-size: 28px 28px;
  scrollbar-color: #444 transparent;
}

.graph-arena { position: relative; min-width: 1260px; min-height: 570px; }
#edge-canvas, .node-layer { position: absolute; inset: 0; }
.node-layer { pointer-events: none; }

.graph-node {
  position: absolute;
  width: 230px;
  min-height: 78px;
  padding: 13px 14px 12px 18px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 5px 10px;
  border: 1px solid #484844;
  background: rgba(15, 15, 15, 0.97);
  color: var(--ivory);
  text-align: left;
  cursor: pointer;
  pointer-events: auto;
  box-shadow: 5px 5px 0 #050505;
  transition: border 140ms ease, background 140ms ease, opacity 140ms ease;
}

.graph-node:hover, .graph-node.selected { border-color: var(--blue); }
.graph-node.path { background: #171926; border-color: var(--blue); }
.graph-node.dimmed { opacity: 0.28; }
.graph-node.entry { background: var(--ivory); color: var(--black); border-color: var(--ivory); }
.graph-node::before { content: ""; position: absolute; left: -5px; top: 35px; width: 8px; height: 8px; border: 1px solid #777; border-radius: 50%; background: var(--black); }
.graph-node::after { content: ""; position: absolute; right: -5px; top: 35px; width: 8px; height: 8px; border: 1px solid #777; border-radius: 50%; background: var(--black); }
.graph-node.entry::before, .graph-node.entry::after { background: var(--ivory); border-color: var(--black); }
.node-label { font-size: 13px; font-weight: 600; line-height: 1.2; }
.node-count { font-family: var(--mono); font-size: 11px; color: var(--muted); }
.graph-node.entry .node-count { color: #65635d; }
.node-detail { grid-column: 1 / -1; color: var(--muted); font-family: var(--mono); font-size: 10px; text-transform: uppercase; letter-spacing: 0.07em; }
.node-detail.held { color: var(--amber); }
.node-detail.completed { color: var(--green); }
.node-detail.stopped { color: var(--red); }

.edge-label {
  position: absolute;
  z-index: 2;
  padding: 2px 5px;
  background: #0b0b0b;
  color: #777772;
  font-family: var(--mono);
  font-size: 9px;
  pointer-events: none;
}

.replay-token {
  width: 13px;
  height: 13px;
  display: none;
  position: absolute;
  z-index: 8;
  border: 2px solid #dce0ff;
  border-radius: 50%;
  background: var(--blue);
  box-shadow: 0 0 18px rgba(83, 104, 255, 0.95);
  transform: translate(-50%, -50%);
}

.graph-footnote {
  min-height: 36px;
  padding: 9px 16px;
  display: flex;
  gap: 22px;
  flex-wrap: wrap;
  border-top: 1px solid var(--line-soft);
  color: #74736f;
  font-family: var(--mono);
  font-size: 9px;
}

.inspector-empty h3, .case-detail h3 { margin: 12px 0; font-size: 22px; line-height: 1.1; letter-spacing: -0.03em; }
.inspector-empty p, .case-detail > p { color: var(--muted); }
.authority-pill, .status-pill {
  width: max-content;
  padding: 5px 7px;
  border: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.authority-pill { color: var(--blue-soft); border-color: #39428a; }
.status-pill { color: var(--ivory); }

.source-card { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line-soft); }
.source-card strong { display: block; margin-bottom: 5px; font-size: 12px; font-weight: 500; }
.source-card span { color: var(--muted); font-family: var(--mono); font-size: 9px; text-transform: uppercase; }
.source-card a, .source-link { color: var(--blue-soft); text-decoration: none; }
.source-card a:hover, .source-link:hover { text-decoration: underline; }

.case-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; margin: 18px 0; background: var(--line-soft); border: 1px solid var(--line-soft); }
.case-meta div { padding: 10px; background: var(--black-2); }
.case-meta span { display: block; color: var(--muted); font-family: var(--mono); font-size: 8px; text-transform: uppercase; letter-spacing: 0.06em; }
.case-meta strong { display: block; margin-top: 4px; font-size: 11px; font-weight: 500; }
.event-timeline { position: relative; margin: 20px 0; padding-left: 18px; border-left: 1px solid var(--line); }
.event-row { position: relative; padding: 0 0 20px 12px; }
.event-row::before { content: ""; position: absolute; left: -22px; top: 4px; width: 7px; height: 7px; border-radius: 50%; border: 1px solid var(--blue); background: var(--black-2); }
.event-row strong { display: block; font-size: 12px; }
.event-row p { margin: 4px 0; color: #b4b3ac; font-size: 11px; }
.event-row time, .evidence-hash { color: var(--muted); font-family: var(--mono); font-size: 9px; }
.evidence-hash { display: block; margin-top: 5px; overflow-wrap: anywhere; }

.sop-view, .automation-view { padding: clamp(24px, 4vw, 52px); background: var(--paper); color: var(--black); }
.sop-summary { display: flex; justify-content: space-between; gap: 28px; align-items: start; margin-bottom: 40px; }
.sop-summary p { max-width: 650px; margin: 8px 0 0; color: #66645e; }
.light-stat { min-width: 150px; padding: 14px; border: 1px solid #b9b7ae; }
.light-stat strong { display: block; font-size: 29px; font-weight: 500; }
.light-stat span { color: #66645e; font-family: var(--mono); font-size: 9px; text-transform: uppercase; }
.sop-chain { display: grid; grid-template-columns: repeat(var(--step-count), minmax(160px, 1fr)); gap: 24px; margin: 24px 0 42px; }
.sop-step { position: relative; min-height: 190px; padding: 18px; border: 1px solid #9f9d94; background: #f3f1e9; }
.sop-step:not(:last-child)::after { content: "→"; position: absolute; top: 42%; right: -20px; color: #68665f; }
.sop-step .number { font-family: var(--mono); font-size: 10px; color: #6c6a64; }
.sop-step h3 { margin: 32px 0 8px; font-size: 18px; line-height: 1.1; }
.sop-step p { color: #66645e; font-size: 12px; }
.sop-step small { position: absolute; bottom: 15px; font-family: var(--mono); color: #66645e; }
.variant-table { border-top: 1px solid #a9a79e; }
.variant-row { padding: 12px 0; display: grid; grid-template-columns: 1fr auto; gap: 20px; border-bottom: 1px solid #c4c2b9; font-size: 12px; }
.variant-row span:last-child { font-family: var(--mono); white-space: nowrap; }

.automation-card { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(280px, 0.9fr); border: 1px solid #aaa89f; background: #f3f1e9; }
.automation-main, .automation-basis { padding: clamp(24px, 4vw, 42px); }
.automation-main { border-right: 1px solid #aaa89f; }
.automation-main h3 { max-width: 600px; margin: 14px 0; font-size: clamp(32px, 5vw, 58px); line-height: 0.95; letter-spacing: -0.05em; }
.automation-main > p { max-width: 620px; color: #64625c; font-size: 16px; }
.automation-section { margin-top: 30px; padding-top: 18px; border-top: 1px solid #c4c2b9; }
.automation-section h4 { margin: 0 0 12px; font-family: var(--mono); font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; }
.automation-section ol { margin: 0; padding-left: 20px; }
.automation-section li { margin: 8px 0; }
.basis-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: #b7b5ac; border: 1px solid #b7b5ac; }
.basis-stat { padding: 18px; background: var(--paper); }
.basis-stat strong { display: block; font-size: 28px; }
.basis-stat span { color: #66645e; font-family: var(--mono); font-size: 9px; text-transform: uppercase; }
.delivery-box { margin-top: 24px; padding: 18px; background: var(--black); color: var(--ivory); }
.delivery-box strong { display: block; margin: 8px 0; font-size: 17px; }
.delivery-box p { margin: 0; color: #aaa9a2; font-size: 12px; }
.delivery-tags { margin-top: 13px; display: flex; flex-wrap: wrap; gap: 7px; }
.delivery-tags span { padding: 5px 7px; border: 1px solid #3e3e3a; font-family: var(--mono); font-size: 9px; text-transform: uppercase; }

.source-bar {
  min-height: 86px;
  padding: 18px 28px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 28px;
  align-items: center;
  color: var(--muted);
  font-size: 11px;
}
.source-list { display: flex; gap: 28px; flex-wrap: wrap; }
.source-list a { color: var(--ivory); text-decoration: none; }
.source-list a:hover { color: var(--blue-soft); }
.method-note { max-width: 520px; text-align: right; font-family: var(--mono); font-size: 9px; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

@media (max-width: 1180px) {
  .app-shell { grid-template-columns: 250px minmax(0, 1fr); }
  .inspector { grid-column: 1 / -1; border-left: 0; border-top: 1px solid var(--line); }
  .case-detail { display: grid; grid-template-columns: 260px 1fr; gap: 24px; }
  .case-detail .event-timeline { margin-top: 0; }
  .proof-intro { grid-template-columns: 1fr; }
  .proof-metrics { width: 100%; grid-template-columns: repeat(4, 1fr); }
  .proof-metric { min-width: 0; }
}

@media (max-width: 760px) {
  .app-header { min-height: 64px; padding: 0 16px; grid-template-columns: 1fr auto; }
  .brand img { width: 27px; height: 34px; }
  .brand span { display: none; }
  .product-name { justify-self: start; }
  .header-cta { padding: 10px; font-size: 0; }
  .header-cta span { font-size: 16px; }
  .proof-intro { min-height: auto; padding: 38px 20px; gap: 30px; }
  .proof-intro h1 { font-size: 46px; }
  .proof-metrics { grid-template-columns: repeat(2, 1fr); }
  .lens { padding: 0 12px; justify-content: center; font-size: 10px; }
  .lens span { display: none; }
  .app-shell { display: block; }
  .case-rail { border-right: 0; border-bottom: 1px solid var(--line); }
  .case-list { max-height: 290px; }
  .view-heading { min-height: auto; padding: 20px; display: block; }
  .view-actions { margin-top: 18px; }
  .graph-toolbar { height: auto; min-height: 48px; align-items: start; padding: 12px; gap: 12px; }
  .legend { gap: 10px; flex-wrap: wrap; }
  .graph-toolbar > span { display: none; }
  .graph-viewport { height: 520px; }
  .graph-footnote span:nth-child(2) { display: none; }
  .case-detail { display: block; }
  .sop-view, .automation-view { padding: 24px 18px; }
  .sop-summary { display: block; }
  .light-stat { margin-top: 20px; }
  .sop-chain { grid-template-columns: 1fr; }
  .sop-step:not(:last-child)::after { content: "↓"; top: auto; right: 50%; bottom: -23px; }
  .automation-card { grid-template-columns: 1fr; }
  .automation-main { border-right: 0; border-bottom: 1px solid #aaa89f; }
  .source-bar { grid-template-columns: 1fr; }
  .method-note { text-align: left; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
