:root {
  color-scheme: light;
  --ink: #16202a;
  --muted: #5d6a78;
  --line: #d9e1e7;
  --paper: #f7f9fb;
  --panel: #ffffff;
  --navy: #123344;
  --cyan: #00a7bd;
  --green: #18a058;
  --amber: #c27803;
  --red: #c93636;
  --violet: #6657d8;
  --shadow: 0 18px 45px rgba(21, 36, 48, 0.12);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  border-radius: 8px;
  min-height: 40px;
  padding: 0 14px;
  cursor: pointer;
}

button:hover {
  border-color: var(--cyan);
}

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(240px, 290px) 1fr;
}

.sidebar {
  background: var(--navy);
  color: #f3fbff;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

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

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: #f6fdff;
  color: var(--navy);
  font-weight: 800;
}

.brand h1 {
  margin: 0;
  font-size: 18px;
  line-height: 1.1;
}

.brand p,
.eyebrow,
.section-title p,
.model-badge,
.status-strip {
  color: var(--muted);
}

.brand p {
  margin: 5px 0 0;
  color: #b5c8d4;
  font-size: 13px;
}

.nav {
  display: grid;
  gap: 8px;
}

.nav-button {
  width: 100%;
  justify-content: flex-start;
  text-align: left;
  background: transparent;
  color: #cfe4ee;
  border-color: rgba(255, 255, 255, 0.12);
}

.nav-button.active,
.nav-button:hover {
  background: #f6fdff;
  color: var(--navy);
  border-color: #f6fdff;
}

.status-strip {
  margin-top: auto;
  display: grid;
  gap: 10px;
  color: #cfe4ee;
}

.status-strip div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  padding-top: 10px;
}

.status-strip dt,
.status-strip dd {
  margin: 0;
}

.status-strip dd {
  font-weight: 700;
  color: #ffffff;
}

.workspace {
  padding: 24px;
  overflow: hidden;
}

.topbar,
.section-title {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 22px;
}

.eyebrow {
  margin: 0 0 5px;
  font-size: 12px;
  text-transform: uppercase;
  font-weight: 800;
}

h2,
h3,
h4 {
  margin: 0;
}

.topbar h2,
.section-title h2 {
  font-size: clamp(24px, 3vw, 36px);
  line-height: 1.05;
}

.section-title p {
  flex: 1;
  margin: 8px 0 0;
  max-width: 720px;
}

.section-title h2 {
  min-width: 240px;
}

.model-badge {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 12px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.pulse {
  width: 9px;
  height: 9px;
  border-radius: 99px;
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(24, 160, 88, 0.15);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.triage-grid,
.ledger-layout,
.packet-grid,
.judge-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 0.78fr);
  gap: 16px;
  align-items: stretch;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 18px;
}

.wide {
  grid-column: 1 / -1;
}

.panel-head,
.button-row,
.decision-line,
.field-grid,
.metrics,
.scenario-band,
.tag-row,
.notes-grid {
  display: flex;
  gap: 12px;
}

.panel-head {
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.panel-head span {
  color: var(--muted);
  font-size: 13px;
}

.field {
  display: grid;
  gap: 7px;
}

.field span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

textarea,
input,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
  color: var(--ink);
  padding: 11px 12px;
}

textarea {
  resize: vertical;
  min-height: 154px;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 12px;
}

.button-row {
  margin-top: 16px;
  flex-wrap: wrap;
}

.primary {
  background: var(--navy);
  color: #ffffff;
  border-color: var(--navy);
}

.result-panel {
  display: grid;
  gap: 16px;
}

.decision-line {
  align-items: flex-start;
}

.decision-line p {
  margin: 7px 0 0;
  color: var(--muted);
}

.decision {
  border-radius: 999px;
  padding: 8px 10px;
  color: #ffffff;
  font-weight: 900;
  font-size: 12px;
  min-width: 72px;
  text-align: center;
}

.decision.deny {
  background: var(--red);
}

.decision.review {
  background: var(--amber);
}

.decision.allow {
  background: var(--green);
}

.metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.metrics div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.metrics span {
  display: block;
  font-size: 22px;
  font-weight: 900;
}

.metrics small {
  color: var(--muted);
}

.evidence-block {
  border-top: 1px solid var(--line);
  padding-top: 13px;
}

.evidence-block h4 {
  margin-bottom: 8px;
}

#evidence-list {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
}

#action-text {
  margin: 0;
  color: var(--muted);
}

.scenario-band {
  margin-top: 16px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.scenario-card {
  min-width: 210px;
  height: 78px;
  display: grid;
  align-content: center;
  text-align: left;
  background: var(--panel);
}

.scenario-card.active {
  border-color: var(--navy);
  box-shadow: inset 0 0 0 1px var(--navy);
}

.scenario-card span {
  color: var(--muted);
  margin-top: 4px;
}

.radar-table {
  display: grid;
  gap: 10px;
}

.radar-row {
  display: grid;
  grid-template-columns: 1.1fr 0.55fr 0.5fr 0.5fr 1fr;
  gap: 12px;
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.radar-row strong {
  display: block;
}

.radar-row small {
  color: var(--muted);
}

.score-bar {
  height: 9px;
  border-radius: 999px;
  background: #e8edf2;
  overflow: hidden;
}

.score-bar span {
  display: block;
  height: 100%;
  background: var(--cyan);
}

.gate-list {
  display: grid;
  gap: 10px;
}

.judge-layout {
  align-items: start;
}

.review-path {
  margin: 0;
  padding-left: 20px;
}

.review-path li + li {
  margin-top: 12px;
}

.review-path p,
.scorecard p,
.edge p {
  color: var(--muted);
  margin: 5px 0 0;
}

.scorecard-list,
.edge-grid {
  display: grid;
  gap: 10px;
}

.scorecard,
.edge {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px;
  background: #fbfdff;
}

.scorecard div {
  display: flex;
  gap: 10px;
  justify-content: space-between;
  align-items: center;
}

.scorecard span {
  color: var(--cyan);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.edge-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.gate {
  border-left: 4px solid var(--violet);
  padding: 10px 12px;
  background: #f8f8ff;
  border-radius: 8px;
}

.gate strong {
  display: block;
  margin-bottom: 4px;
}

.gate span,
.timeline p {
  color: var(--muted);
}

.timeline {
  margin: 0;
  padding-left: 20px;
}

.timeline li + li {
  margin-top: 12px;
}

.timeline strong {
  display: block;
}

.timeline p {
  margin: 4px 0 0;
}

.tag-row {
  flex-wrap: wrap;
}

.tag {
  border-radius: 999px;
  border: 1px solid var(--line);
  padding: 8px 10px;
  background: #fbfdff;
  color: var(--muted);
}

pre {
  white-space: pre-wrap;
  overflow: auto;
  margin: 0;
  color: var(--ink);
  line-height: 1.5;
  font-size: 14px;
}

.notes-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.note {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px;
}

.note strong {
  display: block;
  margin-bottom: 5px;
}

.note p {
  color: var(--muted);
  margin: 0;
}

@media (max-width: 980px) {
  .shell,
  .triage-grid,
  .ledger-layout,
  .packet-grid,
  .judge-layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    min-height: auto;
  }

  .status-strip {
    margin-top: 0;
  }

  .field-grid,
  .metrics,
  .notes-grid,
  .edge-grid {
    grid-template-columns: 1fr 1fr;
  }

  .radar-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .workspace,
  .sidebar {
    padding: 16px;
  }

  .topbar,
  .section-title {
    display: block;
  }

  .section-title h2 {
    min-width: 0;
  }

  .model-badge {
    margin-top: 12px;
  }

  .field-grid,
  .metrics,
  .notes-grid,
  .edge-grid {
    grid-template-columns: 1fr;
  }
}
