/* Secure Context Pipeline — dark security console.
   Palette and state colors are fixed by the design brief; entity-group
   colors are mirrored in app.js (GROUP_COLOR) so chips stay in sync. */

:root {
  --bg: #0E1116;
  --surface: #161B22;
  --raised: #1C232D;
  --untrusted: #13171C;
  --text: #E6EDF3;
  --text-dim: #8B949E;
  --hairline: #30363D;
  --gold: #C9A227;

  --teal: #2DD4BF;      /* encrypted / at-rest */
  --amber: #D9A441;     /* detected */
  --green: #3FB950;     /* obfuscated / safe */
  --red: #F85149;       /* blocked / fail-closed */
  --blue: #58A6FF;      /* restored */

  --grp-pii: #D9A441;
  --grp-phi: #9B7BD4;
  --grp-fin: #3FA6A0;
  --grp-legal: #5B7DB1;
  --grp-generic: #6B7280;

  --mono: ui-monospace, "JetBrains Mono", "SF Mono", "Cascadia Code", Menlo, monospace;
  --sans: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --ease: cubic-bezier(0.22, 1, 0.36, 1); /* ease-out-quint */
  --dur: 220ms;

  --radius: 10px;
  --radius-sm: 6px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
code { font-family: var(--mono); }

button { font-family: inherit; cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.45; }

/* ---------------------------------------------------------------- topbar */

.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--hairline);
}

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

.brand-mark {
  width: 38px; height: 38px;
  flex: none;
  border-radius: 9px;
  background: radial-gradient(circle at 30% 25%, #20303a, #0d1419);
  border: 1px solid var(--hairline);
  display: grid;
  place-items: center;
}
.brand-glyph {
  width: 16px; height: 16px;
  border-radius: 3px;
  border: 2px solid var(--teal);
  box-shadow: 0 0 10px -2px var(--teal);
  position: relative;
}
.brand-glyph::after {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 1px;
  background: var(--teal);
  opacity: 0.35;
}

.brand-text .eyebrow {
  display: block;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--gold);
  margin-bottom: 3px;
}
.brand-text h1 { font-size: 17px; }
.tagline {
  margin: 3px 0 0;
  font-size: 12px;
  color: var(--text-dim);
  max-width: 62ch;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 16px;
}

.control-group { display: flex; flex-direction: column; gap: 6px; }
.control-group.actions { flex-direction: row; align-items: flex-end; }

.control-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text-dim);
}

.fixture-buttons { display: flex; flex-wrap: wrap; gap: 6px; }

.text-input, .select-input {
  background: var(--bg);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 7px 10px;
  font-size: 13px;
  font-family: inherit;
  transition: border-color var(--dur) var(--ease);
}
.text-input { min-width: 300px; }
.text-input:focus, .select-input:focus {
  outline: none;
  border-color: var(--blue);
}

/* ------------------------------------------------------------- buttons */

.btn {
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  background: var(--raised);
  color: var(--text);
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 500;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.btn:hover:not(:disabled) { border-color: var(--text-dim); }
.btn:active:not(:disabled) { transform: translateY(1px); }

.btn-primary { background: var(--blue); border-color: var(--blue); color: #06121f; }
.btn-primary:hover:not(:disabled) { background: #6db0ff; border-color: #6db0ff; }

.btn-ghost { background: transparent; }

.fixture-btn {
  border: 1px solid var(--hairline);
  background: var(--bg);
  color: var(--text);
  padding: 6px 11px;
  border-radius: 999px;
  font-size: 12px;
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.fixture-btn:hover { border-color: var(--text-dim); }
.fixture-btn.selected {
  border-color: var(--teal);
  background: color-mix(in srgb, var(--teal) 14%, transparent);
  color: var(--text);
}
.fixture-btn.danger {
  border-color: color-mix(in srgb, var(--red) 55%, var(--hairline));
  color: #ffb3ae;
}
.fixture-btn.danger.selected {
  border-color: var(--red);
  background: color-mix(in srgb, var(--red) 16%, transparent);
}

/* ------------------------------------------------------------ dropzone */

.dropzone {
  margin: 14px 24px 0;
  border: 1px dashed var(--hairline);
  border-radius: var(--radius);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-dim);
  font-size: 13px;
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.dropzone:hover, .dropzone:focus-visible { border-color: var(--text-dim); outline: none; }
.dropzone.dragover {
  border-color: var(--teal);
  background: color-mix(in srgb, var(--teal) 8%, transparent);
  color: var(--text);
}
.dropzone.staged {
  border-style: solid;
  border-color: var(--teal);
  color: var(--text);
}
.dropzone-icon {
  width: 18px; height: 18px;
  flex: none;
  border: 1.5px solid currentColor;
  border-radius: 4px;
  position: relative;
}
.dropzone-icon::after {
  content: "";
  position: absolute;
  left: 50%; top: 4px;
  width: 1.5px; height: 8px;
  background: currentColor;
  transform: translateX(-50%);
}
.dropzone-icon::before {
  content: "";
  position: absolute;
  left: 50%; top: 4px;
  width: 7px; height: 7px;
  border-left: 1.5px solid currentColor;
  border-top: 1.5px solid currentColor;
  transform: translate(-50%, 0) rotate(45deg);
}

/* --------------------------------------------------------- stage board */

.stage-board {
  position: relative;
  margin: 18px 24px 0;
  padding: 26px 22px 30px;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  overflow: hidden;
}

/* Cooler tint over the untrusted half (everything past the seam). */
.zone-tint-untrusted {
  position: absolute;
  top: 0; bottom: 0;
  right: 0;
  width: var(--untrusted-width, 42%);
  background: var(--untrusted);
  border-left: 1px solid color-mix(in srgb, var(--gold) 30%, transparent);
  pointer-events: none;
  z-index: 0;
}

.stages {
  position: relative;
  z-index: 1;
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 6px;
}

/* Connector line running through the node row. */
.stages::before {
  content: "";
  position: absolute;
  left: 4%;
  right: 4%;
  top: 27px;
  height: 2px;
  background: var(--hairline);
  z-index: -1;
}

.stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  flex: 1 1 0;
  min-width: 0;
}

.node {
  position: relative;
  width: 56px; height: 56px;
  border-radius: 14px;
  background: var(--raised);
  border: 1px solid var(--hairline);
  display: grid;
  place-items: center;
  transition: transform var(--dur) var(--ease), border-color var(--dur) var(--ease),
              box-shadow var(--dur) var(--ease), background var(--dur) var(--ease);
}

.node-index {
  position: absolute;
  top: -7px; left: -7px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--bg);
  border: 1px solid var(--hairline);
  font-size: 10px;
  display: grid;
  place-items: center;
  color: var(--text-dim);
}

.node-label { font-size: 12px; color: var(--text-dim); transition: color var(--dur) var(--ease); }

.node-latency {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-dim);
  min-height: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  opacity: 0;
  transition: opacity var(--dur) var(--ease);
}
.node-latency.show { opacity: 1; }
.node-latency .lat-note { color: var(--text-dim); opacity: 0.7; font-size: 9px; }

/* relative latency bar */
.lat-bar {
  width: 38px; height: 3px;
  border-radius: 2px;
  background: var(--hairline);
  overflow: hidden;
}
.lat-bar > span {
  display: block;
  height: 100%;
  background: var(--blue);
  width: 0;
  transition: width 320ms var(--ease);
}

.node-check {
  position: absolute;
  bottom: -6px; right: -6px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--green);
  display: none;
  place-items: center;
}
.node-check::after {
  content: "";
  width: 5px; height: 9px;
  border: solid #06120a;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) translate(-0.5px, -1px);
}

/* stage states */
.stage.active .node {
  transform: translateY(-6px) scale(1.04);
  border-color: var(--blue);
  box-shadow: 0 0 0 1px var(--blue), 0 10px 26px -10px color-mix(in srgb, var(--blue) 70%, transparent);
}
.stage.active .node-label { color: var(--text); }
.stage.done .node { border-color: color-mix(in srgb, var(--green) 55%, var(--hairline)); }
.stage.done .node-check { display: grid; }
.stage.done .node-label { color: var(--text); }

/* per-stage accent on the active node icon glow */
.stage[data-stage="store"].active .node { box-shadow: 0 0 0 1px var(--teal), 0 10px 26px -10px var(--teal); border-color: var(--teal); }
.stage[data-stage="detect"].active .node { box-shadow: 0 0 0 1px var(--amber), 0 10px 26px -10px var(--amber); border-color: var(--amber); }
.stage[data-stage="obfuscate"].active .node,
.stage[data-stage="guard"].active .node { box-shadow: 0 0 0 1px var(--green), 0 10px 26px -10px var(--green); border-color: var(--green); }

/* guard block: red + shake, gate stays shut */
.stage[data-stage="guard"].blocked .node {
  border-color: var(--red);
  background: color-mix(in srgb, var(--red) 16%, var(--raised));
  box-shadow: 0 0 0 1px var(--red), 0 0 26px -6px var(--red);
  animation: shake 420ms var(--ease);
}
.stage[data-stage="guard"].blocked .node-check { display: none; }

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-5px); }
  40% { transform: translateX(5px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(3px); }
}

/* --------------------------------------------------------- trust seam */

.trust-seam {
  flex: 0 0 auto;
  align-self: stretch;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  padding: 0 8px;
  min-height: 86px;
}
.seam-line {
  flex: 1;
  width: 2px;
  background: linear-gradient(var(--gold), color-mix(in srgb, var(--gold) 20%, transparent));
  box-shadow: 0 0 8px -1px color-mix(in srgb, var(--gold) 60%, transparent);
}
.seam-label {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-size: 9px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold);
  white-space: nowrap;
}

/* the gate "doors" sit on the seam and clamp shut on block */
.trust-seam.shut .seam-line { box-shadow: 0 0 14px 0 var(--red); background: linear-gradient(var(--red), color-mix(in srgb, var(--red) 30%, transparent)); }
.trust-seam.shut .seam-label { color: var(--red); }

/* ----------------------------------------------------------- packet */

.packet {
  position: absolute;
  z-index: 2;
  top: 18px;
  left: 0;
  width: 26px; height: 32px;
  opacity: 0;
  pointer-events: none;
  transform: translateX(0);
  transition: transform 520ms var(--ease), opacity 200ms var(--ease);
}
.packet.show { opacity: 1; }
.packet-doc {
  display: block;
  width: 100%; height: 100%;
  border-radius: 3px 3px 3px 0;
  background: var(--blue);
  position: relative;
  box-shadow: 0 6px 16px -6px var(--blue);
}
.packet-doc::before {
  content: "";
  position: absolute;
  top: 0; right: 0;
  border-width: 0 8px 8px 0;
  border-style: solid;
  border-color: transparent var(--bg) transparent transparent;
}
/* packet recolors to reflect the value it carries */
.packet.scrubbed .packet-doc { background: var(--green); box-shadow: 0 6px 16px -6px var(--green); }
.packet.restored .packet-doc { background: var(--blue); box-shadow: 0 6px 16px -6px var(--blue); }
.packet.frozen { animation: pulse 1.8s var(--ease) infinite; }
@keyframes pulse {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.4); }
}

/* ------------------------------------------------------- boundary gate */

.boundary-gate {
  margin: 16px 24px 0;
  border: 1px solid color-mix(in srgb, var(--gold) 45%, var(--hairline));
  border-radius: var(--radius);
  background:
    linear-gradient(color-mix(in srgb, var(--gold) 5%, transparent), transparent),
    var(--surface);
  animation: rise var(--dur) var(--ease);
}
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.gate-inner { padding: 18px 22px; display: flex; flex-direction: column; gap: 12px; }
.gate-eyebrow {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--gold);
}
.gate-banner { font-size: 18px; display: flex; align-items: center; gap: 10px; }
.gate-banner::before {
  content: "";
  width: 14px; height: 14px;
  border-radius: 50%;
  flex: none;
}
.gate-banner.pending { color: var(--text-dim); }
.gate-banner.pending::before { background: var(--gold); animation: pulse 1.2s var(--ease) infinite; }
.gate-banner.clear { color: var(--green); }
.gate-banner.clear::before {
  background: var(--green);
  box-shadow: 0 0 10px -1px var(--green);
}
.gate-detail { margin: 0; color: var(--text-dim); max-width: 78ch; font-size: 13px; }
.gate-hash-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.gate-hash-label, .error-detail-label {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.09em; color: var(--text-dim);
}
.gate-hash, .error-hash {
  font-size: 12px;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  word-break: break-all;
}
.btn-boundary {
  align-self: flex-start;
  background: var(--gold);
  border-color: var(--gold);
  color: #1a1402;
  font-weight: 600;
  padding: 10px 18px;
}
.btn-boundary:hover:not(:disabled) { background: #ddb73b; border-color: #ddb73b; }

/* --------------------------------------------------------- error card */

.error-card {
  margin: 16px 24px 0;
  border: 1px solid var(--red);
  border-radius: var(--radius);
  background: linear-gradient(color-mix(in srgb, var(--red) 8%, transparent), transparent), var(--surface);
  animation: rise var(--dur) var(--ease);
}
.error-inner { padding: 18px 22px; display: flex; flex-direction: column; gap: 12px; }
.error-eyebrow {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--red);
}
.error-title { font-size: 18px; color: var(--text); }
.error-message { margin: 0; color: var(--text-dim); max-width: 78ch; }
.error-detail { display: flex; flex-wrap: wrap; gap: 24px; }
.error-violations ul { margin: 6px 0 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 6px; }
.error-violations li {
  font-family: var(--mono);
  font-size: 12px;
  background: color-mix(in srgb, var(--red) 14%, var(--bg));
  border: 1px solid color-mix(in srgb, var(--red) 45%, var(--hairline));
  color: #ffb3ae;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
}
.error-hash-row { display: flex; flex-direction: column; gap: 6px; }

/* ---------------------------------------------------------- workspace */

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 16px;
  margin: 18px 24px 0;
}

.panels {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.panel {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  min-height: 280px;
  overflow: hidden;
}
.panel-untrusted { background: var(--untrusted); border-color: color-mix(in srgb, var(--gold) 22%, var(--hairline)); }
.panel-restored { border-color: color-mix(in srgb, var(--blue) 22%, var(--hairline)); }

/* committed panel during the hero moment */
.panel.committed { box-shadow: 0 0 0 1px var(--blue); }
.panel-untrusted.committed { box-shadow: 0 0 0 1px var(--gold); }

.panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--hairline);
}
.panel-head h3 { font-size: 13px; }
.panel-sub { font-size: 11px; color: var(--text-dim); }

.panel-body {
  flex: 1;
  padding: 14px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 12.5px;
  line-height: 1.65;
  max-height: 460px;
}
.panel-placeholder { color: var(--text-dim); font-family: var(--sans); margin: 0; }

/* entity chips in the original panel */
.chip {
  border-radius: 4px;
  padding: 0 3px;
  border: 1px solid currentColor;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
  transition: background var(--dur) var(--ease);
}
.chip[data-grp="pii"] { color: var(--grp-pii); background: color-mix(in srgb, var(--grp-pii) 16%, transparent); }
.chip[data-grp="phi"] { color: var(--grp-phi); background: color-mix(in srgb, var(--grp-phi) 18%, transparent); }
.chip[data-grp="fin"] { color: var(--grp-fin); background: color-mix(in srgb, var(--grp-fin) 18%, transparent); }
.chip[data-grp="legal"] { color: var(--grp-legal); background: color-mix(in srgb, var(--grp-legal) 20%, transparent); }
.chip[data-grp="generic"] { color: var(--grp-generic); background: color-mix(in srgb, var(--grp-generic) 22%, transparent); }
.chip-text { color: var(--text); }

/* token chips on the provider panel: styled by strategy */
.tok { border-radius: 4px; padding: 0 3px; box-decoration-break: clone; -webkit-box-decoration-break: clone; }
.tok[data-grp="pii"] { --tc: var(--grp-pii); }
.tok[data-grp="phi"] { --tc: var(--grp-phi); }
.tok[data-grp="fin"] { --tc: var(--grp-fin); }
.tok[data-grp="legal"] { --tc: var(--grp-legal); }
.tok[data-grp="generic"] { --tc: var(--grp-generic); }

/* pseudonymize: solid-ish fill, slanted */
.tok[data-strat="pseudonymize"] {
  background: color-mix(in srgb, var(--tc) 24%, transparent);
  color: var(--text);
  font-style: oblique 10deg;
  border-bottom: 1px solid var(--tc);
}
/* tokenize: monospace bracketed */
.tok[data-strat="tokenize"] {
  color: var(--tc);
  border: 1px dashed var(--tc);
  background: color-mix(in srgb, var(--tc) 8%, transparent);
}
/* redact: solid block, value visually removed */
.tok[data-strat="redact"] {
  background: var(--tc);
  color: var(--tc);
  border-radius: 2px;
}

/* ------------------------------------------------------------- audit */

.audit-rail {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  overflow: hidden;
  max-height: 632px;
}
.audit-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 11px 14px;
  border-bottom: 1px solid var(--hairline);
}
.audit-head h3 { font-size: 13px; }
.audit-status { font-size: 11px; color: var(--text-dim); display: flex; align-items: center; gap: 6px; }
.audit-status.verified { color: var(--green); }
.audit-status.broken { color: var(--red); }
.audit-status::before {
  content: ""; width: 9px; height: 9px; border-radius: 50%; background: currentColor; display: none;
}
.audit-status.verified::before, .audit-status.broken::before { display: inline-block; }

.audit-rows {
  list-style: none;
  margin: 0;
  padding: 6px 0;
  overflow: auto;
  flex: 1;
}
.audit-row {
  display: grid;
  grid-template-columns: 18px 1fr auto;
  gap: 8px;
  align-items: start;
  padding: 7px 14px;
  position: relative;
  animation: slideIn var(--dur) var(--ease);
}
@keyframes slideIn { from { opacity: 0; transform: translateX(10px); } to { opacity: 1; transform: none; } }

/* chain link: a connecting line between consecutive rows */
.audit-link {
  position: relative;
  display: flex;
  justify-content: center;
}
.audit-link::before {
  content: "";
  width: 9px; height: 9px;
  margin-top: 4px;
  border: 1.5px solid var(--teal);
  border-radius: 3px;
}
.audit-row:not(:last-child) .audit-link::after {
  content: "";
  position: absolute;
  top: 17px;
  bottom: -7px;
  width: 1.5px;
  background: color-mix(in srgb, var(--teal) 40%, transparent);
}
.audit-row.alarm .audit-link::before { border-color: var(--red); }
.audit-row.alarm { background: color-mix(in srgb, var(--red) 9%, transparent); }

.audit-body { min-width: 0; }
.audit-kind { font-size: 12px; font-weight: 600; }
.audit-row.alarm .audit-kind { color: var(--red); }
.audit-meta {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--text-dim);
  word-break: break-word;
  margin-top: 2px;
}
.audit-hash {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--teal);
  white-space: nowrap;
  align-self: start;
  margin-top: 1px;
}
.audit-row.alarm .audit-hash { color: var(--red); }

.audit-empty { padding: 16px 14px; color: var(--text-dim); font-size: 12px; }

/* ---------------------------------------------------------- summary */

.summary {
  margin: 18px 24px 28px;
  padding: 14px 18px;
  background: var(--raised);
  border: 1px solid color-mix(in srgb, var(--green) 30%, var(--hairline));
  border-radius: var(--radius);
  animation: rise var(--dur) var(--ease);
}
.summary-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 22px;
  font-family: var(--mono);
  font-size: 13px;
}
.summary-stats .stat { color: var(--text); }
.summary-stats .stat b { color: var(--green); font-weight: 700; }
.summary-stats .stat.sep { color: var(--text-dim); }
.summary-stats .stat.intact { color: var(--green); }
.summary-stats .stat.broken { color: var(--red); }

/* ------------------------------------------------------- node icons */

.node-icon { width: 22px; height: 22px; display: block; color: var(--text-dim); }
.stage.active .node-icon, .stage.done .node-icon { color: var(--text); }

.icon-lock { border: 2px solid currentColor; border-radius: 3px; width: 16px; height: 13px; margin-top: 5px; position: relative; }
.icon-lock::before { content: ""; position: absolute; top: -8px; left: 50%; transform: translateX(-50%); width: 9px; height: 9px; border: 2px solid currentColor; border-bottom: none; border-radius: 6px 6px 0 0; }
.stage[data-stage="store"].active .icon-lock, .stage[data-stage="store"].done .icon-lock { color: var(--teal); }

.icon-scan { border: 2px solid currentColor; border-radius: 50%; width: 14px; height: 14px; position: relative; }
.icon-scan::after { content: ""; position: absolute; bottom: -4px; right: -4px; width: 7px; height: 2px; background: currentColor; transform: rotate(45deg); transform-origin: left; }
.stage[data-stage="detect"].active .icon-scan { color: var(--amber); }

.icon-mask { width: 18px; height: 12px; border: 2px solid currentColor; border-radius: 9px 9px 7px 7px; position: relative; }
.icon-mask::before, .icon-mask::after { content: ""; position: absolute; top: 3px; width: 4px; height: 4px; border-radius: 50%; background: currentColor; }
.icon-mask::before { left: 3px; } .icon-mask::after { right: 3px; }
.stage[data-stage="obfuscate"].active .icon-mask { color: var(--green); }

.icon-gate { width: 16px; height: 16px; border: 2px solid currentColor; position: relative; }
.icon-gate::before { content: ""; position: absolute; top: 2px; bottom: 2px; left: 50%; width: 2px; background: currentColor; transform: translateX(-50%); }
.stage[data-stage="guard"].active .icon-gate { color: var(--green); }
.stage[data-stage="guard"].blocked .icon-gate { color: var(--red); }

.icon-cloud { width: 20px; height: 11px; background: currentColor; border-radius: 8px; position: relative; margin-top: 4px; }
.icon-cloud::before { content: ""; position: absolute; top: -6px; left: 4px; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.icon-cloud::after { content: ""; position: absolute; top: -4px; right: 4px; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.icon-unmask { width: 18px; height: 12px; border: 2px dashed currentColor; border-radius: 9px; }
.stage[data-stage="deobfuscate"].active .icon-unmask { color: var(--blue); }

.icon-you { width: 10px; height: 10px; border-radius: 50%; border: 2px solid currentColor; position: relative; margin-top: 2px; }
.icon-you::after { content: ""; position: absolute; top: 11px; left: 50%; transform: translateX(-50%); width: 16px; height: 8px; border: 2px solid currentColor; border-bottom: none; border-radius: 9px 9px 0 0; }
.stage[data-stage="you"].active .icon-you, .stage[data-stage="you"].done .icon-you { color: var(--blue); }

/* ------------------------------------------------------------- evals */

/* Full-width overlay that sits above the pipeline view. The pipeline DOM is
   left untouched underneath; this simply covers it while open. */
.evals {
  position: fixed;
  inset: 0;
  z-index: 10;
  background: var(--bg);
  overflow-y: auto;
  animation: rise var(--dur) var(--ease);
}
.evals-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 28px 24px 40px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.evals-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}
.evals-headings { display: flex; flex-direction: column; gap: 6px; }
.evals-eyebrow {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--teal);
}
.evals-title { font-size: 19px; }
.evals-caption { margin: 0; color: var(--text-dim); max-width: 80ch; font-size: 13px; }

.evals-state {
  padding: 26px 18px;
  text-align: center;
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 13px;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
}
.evals-state.failed {
  color: #ffb3ae;
  border-color: color-mix(in srgb, var(--red) 45%, var(--hairline));
  background: linear-gradient(color-mix(in srgb, var(--red) 8%, transparent), transparent), var(--surface);
}

.evals-content { display: flex; flex-direction: column; gap: 26px; }

/* headline metric cards */
.evals-cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}
.evals-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 18px 18px 16px;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  border-top: 3px solid var(--hairline);
}
.evals-card[data-band="high"] { border-top-color: var(--green); }
.evals-card[data-band="mid"] { border-top-color: var(--amber); }
.evals-card[data-band="low"] { border-top-color: var(--red); }
.evals-card-value {
  font-family: var(--mono);
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
}
.evals-card-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.09em; color: var(--text);
}
.evals-card-sub { font-size: 11px; color: var(--text-dim); }

.evals-section { display: flex; flex-direction: column; gap: 12px; }
.evals-subhead { font-size: 13px; color: var(--text); }

.evals-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  background: var(--surface);
}
.evals-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}
.evals-table th, .evals-table td {
  padding: 9px 14px;
  text-align: left;
  border-bottom: 1px solid var(--hairline);
}
.evals-table th {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  font-weight: 600;
}
.evals-table tbody tr:last-child td { border-bottom: none; }
.evals-table .num { text-align: right; font-family: var(--mono); }
.evals-table .evals-type { color: var(--text); font-weight: 500; }

/* color-coded F1 cell */
.evals-f1 {
  font-weight: 700;
}
.evals-f1[data-band="high"] { color: var(--green); }
.evals-f1[data-band="mid"] { color: var(--amber); }
.evals-f1[data-band="low"] { color: var(--red); }

/* missed list: alarm/amber treatment */
.evals-missed { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.evals-missed-item {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 12px;
  background: color-mix(in srgb, var(--amber) 9%, transparent);
  border: 1px solid color-mix(in srgb, var(--amber) 40%, var(--hairline));
  border-left: 3px solid var(--amber);
  border-radius: var(--radius-sm);
  font-size: 12.5px;
}
.evals-missed-type {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--amber);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.evals-missed-dash { color: var(--text-dim); }
.evals-missed-value { color: var(--text); font-family: var(--mono); }
.evals-missed-doc { color: var(--text-dim); font-size: 11.5px; }
.evals-missed-empty {
  padding: 12px 14px;
  color: var(--text-dim);
  font-size: 12.5px;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
}

.evals-note {
  margin: 0;
  color: var(--text-dim);
  font-size: 12px;
  max-width: 80ch;
  border-left: 2px solid color-mix(in srgb, var(--teal) 50%, var(--hairline));
  padding-left: 12px;
}

#evalsBtn[aria-pressed="true"] {
  border-color: var(--teal);
  color: var(--teal);
}

/* ---------------------------------------------------------- responsive */

@media (max-width: 1080px) {
  .workspace { grid-template-columns: 1fr; }
  .audit-rail { max-height: 360px; }
  .panels { grid-template-columns: 1fr; }
  .text-input { min-width: 220px; }
  .evals-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  .stages { overflow-x: auto; }
  .node { width: 46px; height: 46px; }
  .seam-label { font-size: 8px; }
}

/* ------------------------------------------------------- reduced motion */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .packet { transition: none; }
}
