:root {
  --magenta: #B11E84;
  --berry: #BA2F7D;
  --navy: #004390;
  --blue: #2857B2;
  --gradient: linear-gradient(90deg, #B11E84 0%, #BA2F7D 30%, #2857B2 70%, #004390 100%);

  --ink: #14182B;
  --ink-2: #3D4459;
  --muted: #6A7187;
  --line: #E4E7EF;
  --line-2: #EEF0F5;
  --canvas: #F5F6FA;
  --card: #FFFFFF;

  --magenta-tint: #FBEFF7;
  --berry-tint: #FCF0F6;
  --navy-tint: #EAF1FA;
  --blue-tint: #EDF2FC;
  --grey-tint: #F1F2F6;

  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(20, 24, 43, .05), 0 6px 24px -12px rgba(20, 24, 43, .14);
  --shadow-lift: 0 2px 4px rgba(20, 24, 43, .06), 0 18px 40px -18px rgba(0, 67, 144, .30);
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: 15px/1.55 Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--navy); }
button, input, select, textarea { font: inherit; color: inherit; }

/* ---------- chrome ---------- */
.ribbon { height: 4px; background: var(--gradient); }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 28px; background: var(--card); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink); }
.brand-mark { width: 32px; height: 32px; border-radius: 9px; background: var(--gradient); display: grid; place-items: center; box-shadow: 0 6px 16px -8px rgba(177, 30, 132, .55); }
.brand-mark svg { width: 18px; height: 18px; fill: none; stroke: #fff; stroke-width: 1.7; stroke-linejoin: round; stroke-linecap: round; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-size: 16px; letter-spacing: -.01em; }
.brand-text small { color: var(--muted); font-size: 12px; }
.conn { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.conn .dot { width: 8px; height: 8px; border-radius: 50%; background: #C3C8D4; }
.conn.ok .dot { background: #1F9D6B; box-shadow: 0 0 0 4px rgba(31, 157, 107, .14); }
.conn.bad .dot { background: var(--berry); }

.shell { display: grid; grid-template-columns: 300px minmax(0, 1fr); min-height: calc(100vh - 66px); }
.sidebar { border-right: 1px solid var(--line); background: var(--card); padding: 22px 18px; }
.side-title {
  margin: 26px 6px 10px; font-size: 11px; font-weight: 600; letter-spacing: .08em;
  text-transform: uppercase; color: var(--muted);
}
.runs { display: flex; flex-direction: column; gap: 4px; }
.run-link {
  display: flex; flex-direction: column; gap: 4px; padding: 10px 12px; border-radius: var(--radius-sm);
  text-decoration: none; color: var(--ink); border: 1px solid transparent;
}
.run-link:hover { background: var(--canvas); }
.run-link.active { background: var(--navy-tint); border-color: #D3E1F3; }
.run-link .row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.run-link .case { font-weight: 600; font-size: 13.5px; }
.run-link .when { color: var(--muted); font-size: 12px; }
.side-empty { color: var(--muted); font-size: 13px; padding: 6px; }

.main { padding: 30px 36px 140px; max-width: 1120px; width: 100%; min-width: 0; outline: none; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--card); font-weight: 600; font-size: 14px; cursor: pointer; text-decoration: none;
  color: var(--ink); transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
}
.btn svg { width: 16px; height: 16px; stroke: currentColor; stroke-width: 2; fill: none; stroke-linecap: round; }
.btn:hover { box-shadow: var(--shadow); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; box-shadow: none; }
.btn-block { width: 100%; }
.btn-primary { background: var(--magenta); border-color: var(--magenta); color: #fff; }
.btn-primary:hover { background: #9C1874; }
.btn-navy { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn-navy:hover { background: #003675; }
.btn-ghost { background: transparent; }
.btn-danger { color: var(--berry); border-color: #EBC6D9; }
.btn-danger:hover { background: var(--berry-tint); }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; border-radius: 8px; }

/* ---------- chips ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--grey-tint); color: var(--ink-2);
}
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .85; }
.chip.plain::before { display: none; }
.chip.running, .chip.processing { background: var(--blue-tint); color: var(--blue); }
.chip.running::before, .chip.processing::before { animation: pulse 1.4s ease-in-out infinite; }
.chip.review { background: var(--magenta-tint); color: var(--magenta); }
.chip.delivered { background: var(--navy-tint); color: var(--navy); }
.chip.rejected, .chip.aborted, .chip.unavailable { background: var(--grey-tint); color: var(--muted); }
.chip.escalated, .chip.failed, .chip.delivery_failed { background: var(--berry-tint); color: var(--berry); }
@keyframes pulse { 50% { opacity: .25; } }

.disp { display: inline-flex; align-items: center; height: 26px; padding: 0 11px; border-radius: 7px; font-size: 12.5px; font-weight: 600; }
.disp-update_not_completed { background: var(--berry); color: #fff; }
.disp-no_sufficient_proof { background: var(--navy); color: #fff; }
.disp-updated_correctly { background: var(--blue); color: #fff; }
.disp-insufficient_evidence_to_determine { background: #E7E8EF; color: var(--ink-2); }

.conf { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: 3px 8px; border-radius: 6px; }
.conf-high { background: var(--navy-tint); color: var(--navy); }
.conf-medium { background: var(--blue-tint); color: var(--blue); }
.conf-low { background: var(--berry-tint); color: var(--berry); }
.ex { font-family: var(--mono); font-size: 11.5px; padding: 1px 6px; border-radius: 5px; background: var(--navy-tint); color: var(--navy); white-space: nowrap; }

/* ---------- cards & type ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.pad { padding: 22px 24px; }
h1.page { font-size: 26px; letter-spacing: -.02em; margin: 0 0 6px; }
.lede { color: var(--ink-2); margin: 0 0 26px; max-width: 64ch; }
h3.sec { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 34px 0 12px; font-weight: 600; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-size: 13px; }

/* ---------- hero ---------- */
.hero { position: relative; overflow: hidden; }
.hero::after { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--gradient); }
.hero-top { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; flex-wrap: wrap; }
.hero h1 { margin: 2px 0 6px; font-size: 24px; letter-spacing: -.02em; }
.meta { display: flex; flex-wrap: wrap; gap: 18px; color: var(--muted); font-size: 13px; }
.meta b { color: var(--ink-2); font-weight: 600; }
.hero-actions { display: flex; gap: 8px; align-items: center; }

/* ---------- pipeline ---------- */
.pipeline { display: grid; grid-template-columns: repeat(7, 1fr); gap: 0; margin-top: 22px; }
.stage { position: relative; text-align: center; padding-top: 30px; }
.stage::before {
  content: ""; position: absolute; top: 10px; left: 50%; width: 100%; height: 2px; background: var(--line);
}
.stage:last-child::before { display: none; }
.stage.done::before { background: var(--blue); }
.stage .node {
  position: absolute; top: 2px; left: calc(50% - 9px); width: 18px; height: 18px; border-radius: 50%;
  background: var(--card); border: 2px solid #C9CED9; z-index: 1;
}
.stage.done .node { background: var(--blue); border-color: var(--blue); }
.stage.done .node::after {
  content: ""; position: absolute; left: 4.5px; top: 1.5px; width: 4px; height: 8px;
  border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg);
}
.stage.active .node { border-color: var(--magenta); background: var(--magenta); box-shadow: 0 0 0 6px rgba(177, 30, 132, .15); animation: pulse 1.6s ease-in-out infinite; }
.stage .label { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.stage .t { font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ---------- callouts ---------- */
.callout { border-radius: var(--radius); padding: 16px 18px; display: flex; gap: 14px; margin-top: 18px; }
.callout svg { flex: none; width: 22px; height: 22px; margin-top: 1px; stroke-width: 2; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.callout h4 { margin: 0 0 4px; font-size: 14.5px; }
.callout p, .callout ul { margin: 0; color: var(--ink-2); font-size: 14px; }
.callout ul { padding-left: 18px; }
.callout li + li { margin-top: 4px; }
.callout.decide { background: var(--magenta-tint); border: 1px solid #F1CCE4; }
.callout.decide svg { stroke: var(--magenta); }
.callout.warn { background: var(--berry-tint); border: 1px solid #EFCFE0; }
.callout.warn svg { stroke: var(--berry); }
.callout.good { background: var(--navy-tint); border: 1px solid #CFDDF0; }
.callout.good svg { stroke: var(--navy); }
.callout.info { background: var(--blue-tint); border: 1px solid #D5E0F5; }
.callout.info svg { stroke: var(--blue); }

/* ---------- dispositions ---------- */
.accounts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(360px, 100%), 1fr)); gap: 14px; }
.account .top { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; }
.account .num { font-family: var(--mono); font-size: 15px; font-weight: 500; }
.account .furn { color: var(--muted); font-size: 13px; margin-bottom: 10px; }
.kv { display: flex; gap: 6px 18px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); margin-bottom: 12px; }
.kv b { color: var(--ink-2); }
.clamp { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; color: var(--ink-2); font-size: 14px; }
.clamp.open { -webkit-line-clamp: unset; }
.linkish { background: none; border: 0; padding: 0; color: var(--blue); font-weight: 600; font-size: 13px; cursor: pointer; margin-top: 6px; }

.two { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: 12px 0; border-top: 1px solid var(--line-2); font-size: 14px; color: var(--ink-2); }
.list li:first-child { border-top: 0; padding-top: 2px; }
.list .tag { font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; margin-right: 6px; }
.sev-blocks_determination { color: var(--berry); }
.sev-reduces_confidence { color: var(--blue); }
.sev-informational { color: var(--muted); }

/* ---------- sections ---------- */
.sections { display: flex; flex-direction: column; gap: 10px; }
details.section { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
details.section[open] { box-shadow: var(--shadow); }
details.section summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; gap: 12px; padding: 16px 20px;
}
details.section summary::-webkit-details-marker { display: none; }
details.section summary .title { font-weight: 600; flex: 1; }
details.section summary .caret { width: 18px; height: 18px; stroke: var(--muted); fill: none; stroke-width: 2; transition: transform .15s; }
details.section[open] summary .caret { transform: rotate(90deg); }
.flag { font-size: 12px; font-weight: 600; color: var(--magenta); }
.section-body { padding: 2px 22px 20px; border-top: 1px solid var(--line-2); }
.section-body p { margin: 14px 0 0; color: var(--ink-2); max-width: 78ch; }
.reasons { margin: 14px 0 0; padding: 12px 14px; background: var(--canvas); border-radius: var(--radius-sm); font-size: 13px; color: var(--ink-2); }
.reasons ul { margin: 6px 0 0; padding-left: 18px; }
.cites { margin-top: 14px; }
.cites summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--blue); }
blockquote.cite {
  margin: 10px 0 0; padding: 10px 14px; border-left: 3px solid var(--blue); background: var(--blue-tint);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0; font-size: 13px; color: var(--ink-2); white-space: pre-wrap;
}
blockquote.cite .ex { margin-right: 8px; }

/* ---------- evidence table ---------- */
table.evid { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.evid th { text-align: left; font-size: 11px; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); font-weight: 600; padding: 0 12px 10px; }
table.evid td { padding: 11px 12px; border-top: 1px solid var(--line-2); color: var(--ink-2); }
table.evid td:first-child { font-family: var(--mono); color: var(--navy); }

/* ---------- decision bar ---------- */
.decision {
  position: fixed; left: 300px; right: 0; bottom: 0; z-index: 15;
  background: rgba(255, 255, 255, .94); backdrop-filter: blur(10px); border-top: 1px solid var(--line);
  box-shadow: 0 -12px 30px -18px rgba(20, 24, 43, .25);
}
.decision-inner { max-width: 1120px; padding: 14px 36px; display: flex; gap: 14px; align-items: center; }
.decision textarea {
  flex: 1; min-height: 44px; max-height: 120px; resize: vertical; padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--card); font-size: 14px;
}
.decision textarea:focus, .field input:focus, .field select:focus { outline: 2px solid rgba(40, 87, 178, .35); border-color: var(--blue); }
.decision .btns { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- new write-up ---------- */
.cases { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(230px, 100%), 1fr)); gap: 12px; }
.case-card {
  text-align: left; cursor: pointer; padding: 16px 18px; border-radius: var(--radius); border: 1.5px solid var(--line);
  background: var(--card); transition: border-color .12s, box-shadow .12s, transform .12s;
}
.case-card:hover { box-shadow: var(--shadow-lift); transform: translateY(-1px); }
.case-card.selected { border-color: var(--magenta); box-shadow: 0 0 0 4px rgba(177, 30, 132, .12); }
.case-card .name { font-weight: 600; font-family: var(--mono); font-size: 13.5px; }
.case-card .sub { color: var(--muted); font-size: 12.5px; margin-top: 4px; }
.files { margin: 14px 0 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px; }
.files li { display: flex; gap: 10px; align-items: center; padding: 9px 12px; background: var(--canvas); border-radius: var(--radius-sm); font-size: 13px; color: var(--ink-2); }
.files .ext { font-family: var(--mono); font-size: 10.5px; font-weight: 500; padding: 2px 6px; border-radius: 4px; background: var(--card); border: 1px solid var(--line); color: var(--navy); text-transform: uppercase; }
.form { display: grid; grid-template-columns: 160px 1fr 1fr; gap: 14px; margin-top: 4px; }
.field label { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.field input, .field select { width: 100%; height: 42px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); }
.form-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 20px; gap: 16px; }

/* ---------- states ---------- */
.empty { text-align: center; padding: 70px 20px; }
.empty .halo {
  width: 72px; height: 72px; margin: 0 auto 18px; border-radius: 22px; background: var(--gradient);
  box-shadow: var(--shadow-lift); display: grid; place-items: center;
}
.empty .halo svg { width: 32px; height: 32px; stroke: #fff; stroke-width: 2; fill: none; }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid var(--blue-tint); border-top-color: var(--blue); animation: spin .8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton { height: 14px; border-radius: 6px; background: linear-gradient(90deg, var(--line-2), #F8F9FC, var(--line-2)); background-size: 200% 100%; animation: shimmer 1.4s infinite; margin-top: 10px; }
@keyframes shimmer { to { background-position: -200% 0; } }

.toast {
  position: fixed; right: 24px; bottom: 24px; z-index: 50; max-width: 420px; padding: 12px 16px; border-radius: 12px;
  background: var(--ink); color: #fff; font-size: 14px; box-shadow: var(--shadow-lift);
  opacity: 0; transform: translateY(8px); transition: .2s; pointer-events: none;
}
.toast.show { opacity: 1; transform: none; }
.toast.err { background: var(--berry); }

@media (max-width: 980px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .topbar { padding: 12px 16px; }
  .conn span:last-child, .brand-text small { display: none; }
  .card.pad:has(table.evid) { overflow-x: auto; }
  .hero h1 { font-size: 20px; overflow-wrap: anywhere; }
  .sidebar { border-right: 0; border-bottom: 1px solid var(--line); }
  .decision { left: 0; }
  .two, .form { grid-template-columns: 1fr; }
  .pipeline { grid-template-columns: repeat(4, 1fr); row-gap: 18px; }
  .main { padding: 22px 16px 200px; }
  .decision-inner { flex-direction: column; align-items: stretch; padding: 12px 16px; }
}

/* ---------- static-console additions ---------- */
.top-right { display: flex; align-items: center; gap: 14px; }
.stack { display: grid; gap: 16px; max-width: 720px; }
.form-foot .btns { display: flex; gap: 8px; }
.facts { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.fact { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 14px; min-width: 120px; }
.fact > span { display: block; font-size: 11px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.fact b { font-weight: 600; font-size: 14px; color: var(--ink); }
.live { display: flex; align-items: center; gap: 10px; margin-top: 10px !important; font-size: 13px; color: var(--blue); }
.callout .btn-sm { text-decoration: none; }
.foot { text-align: center; color: var(--muted); font-size: 12px; padding: 18px 0 90px; }
.account .clamp p:first-child { margin-top: 0; }
.account .clamp p { margin: 8px 0 0; }
.run-link .row .chip { flex: none; }
.brand-logo { width: 36px; height: 36px; border-radius: 8px; object-fit: contain; }
.foot a { color: var(--muted); }
