/* CEL console -- dark, terminal-adjacent, no framework.
   Tailwind does layout; this file owns the things Tailwind cannot do cheaply:
   scanlines, glow, the alarm flash, and the terminal's scroll behaviour. */

:root {
  --bg:            #040706;
  --bg-panel:      #080d0b;
  --bg-raised:     #0b1210;
  --line:          #14211c;
  --line-bright:   #1e3329;
  --text:          #cfd8d3;
  --text-dim:      #6d7f76;
  --text-faint:    #44544c;
  --green:         #2bff88;
  --green-dim:     #17a85a;
  --red:           #ff3b57;
  --red-dim:       #8c1d2b;
  --amber:         #ffb020;
  --slate:         #7aa2ff;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", "JetBrains Mono", "Cascadia Code",
          Menlo, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--mono);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background-image:
    radial-gradient(900px 500px at 15% -10%, rgba(43, 255, 136, 0.07), transparent 60%),
    radial-gradient(700px 420px at 95% 0%, rgba(122, 162, 255, 0.05), transparent 60%);
  background-attachment: fixed;
}

/* ---------- ambient film ---------- */

.scanlines {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 40;
  background: repeating-linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0) 0px,
    rgba(0, 0, 0, 0) 2px,
    rgba(0, 0, 0, 0.28) 3px,
    rgba(0, 0, 0, 0) 4px
  );
  opacity: 0.35;
  mix-blend-mode: multiply;
}

.vignette {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 39;
  background: radial-gradient(ellipse at center, transparent 45%, rgba(0, 0, 0, 0.65) 100%);
}

/* ---------- top bar ---------- */

.topbar {
  position: relative;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 14px 22px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(8, 13, 11, 0.96), rgba(4, 7, 6, 0.82));
  backdrop-filter: blur(6px);
}

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

.logo {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.08em;
  color: var(--green);
  border: 1px solid var(--line-bright);
  border-radius: 10px;
  background: radial-gradient(circle at 30% 20%, rgba(43, 255, 136, 0.16), transparent 70%);
  box-shadow: 0 0 24px rgba(43, 255, 136, 0.12), inset 0 0 12px rgba(43, 255, 136, 0.06);
}

.brand-text h1 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #eafff4;
}

.brand-text p {
  margin: 3px 0 0;
  font-size: 11.5px;
  color: var(--text-dim);
  letter-spacing: 0.02em;
}

.topbar-right { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

.head-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-panel);
}

.chip-label {
  font-size: 9.5px;
  letter-spacing: 0.16em;
  color: var(--text-faint);
}

.head-chip code {
  font-size: 11px;
  color: var(--green-dim);
  font-family: var(--mono);
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 11px;
  letter-spacing: 0.14em;
  border: 1px solid var(--line-bright);
  transition: color .25s, border-color .25s, background .25s;
}

.pill .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 8px currentColor;
  animation: pulse 2.4s ease-in-out infinite;
}

.pill-healthy { color: var(--green); background: rgba(43, 255, 136, 0.06); }
.pill-warning { color: var(--amber); background: rgba(255, 176, 32, 0.08); border-color: rgba(255,176,32,.3); }
.pill-critical {
  color: var(--red);
  background: rgba(255, 59, 87, 0.1);
  border-color: rgba(255, 59, 87, 0.45);
  box-shadow: 0 0 22px rgba(255, 59, 87, 0.18);
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

/* ---------- layout ---------- */

.shell {
  position: relative;
  z-index: 10;
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.85fr) minmax(320px, 1fr);
  grid-template-rows: auto 1fr;
  gap: 14px;
  padding: 14px 22px 4px;
  align-items: stretch;
}

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

@media (max-width: 1020px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .metrics { grid-column: auto; }
}

/* ---------- panels ---------- */

.panel {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(180deg, var(--bg-panel), #060a09);
  padding: 14px 16px 16px;
  overflow: hidden;
}

.panel::before {
  /* a single lit edge, so panels read as hardware rather than boxes */
  content: "";
  position: absolute;
  top: 0; left: 14px; right: 14px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(43, 255, 136, 0.28), transparent);
}

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

.panel-head h2 {
  margin: 0;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #9fb5aa;
}

.tick { color: var(--green); opacity: .75; margin-right: 6px; }

.meta { font-size: 10.5px; color: var(--text-faint); letter-spacing: 0.06em; }

/* ---------- metrics ---------- */

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

@media (max-width: 860px) { .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 460px) { .metric-grid { grid-template-columns: minmax(0, 1fr); } }

.metric {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 13px 14px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg-raised);
  overflow: hidden;
}

.metric::after {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 2px;
  background: var(--accent, var(--line-bright));
  box-shadow: 0 0 14px var(--accent, transparent);
}

.metric-red     { --accent: var(--red); }
.metric-green   { --accent: var(--green); }
.metric-amber   { --accent: var(--amber); }
.metric-slate   { --accent: var(--slate); }

.metric-label {
  font-size: 10.5px;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  text-transform: uppercase;
}

.metric-value {
  font-size: 32px;
  line-height: 1.05;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--accent);
  text-shadow: 0 0 22px color-mix(in srgb, var(--accent) 35%, transparent);
  font-variant-numeric: tabular-nums;
}

.metric-sub {
  font-size: 9.5px;
  color: var(--text-faint);
  letter-spacing: 0.04em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bar {
  height: 3px;
  border-radius: 2px;
  background: #0f1a15;
  overflow: hidden;
}

.bar > i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--green-dim), var(--green));
  box-shadow: 0 0 10px rgba(43, 255, 136, 0.5);
  transition: width .5s ease, background .4s;
}

/* ---------- terminal ---------- */

.feed-panel { display: flex; flex-direction: column; min-height: 380px; }

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

.terminal {
  flex: 1;
  min-height: 300px;
  max-height: calc(100vh - 330px);
  overflow-y: auto;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background:
    linear-gradient(180deg, rgba(43, 255, 136, 0.02), transparent 120px),
    #030706;
  font-size: 12px;
  line-height: 1.62;
  scrollbar-width: thin;
  scrollbar-color: var(--line-bright) transparent;
}

.terminal::-webkit-scrollbar { width: 8px; }
.terminal::-webkit-scrollbar-thumb { background: var(--line-bright); border-radius: 4px; }

.term-line {
  display: flex;
  gap: 8px;
  align-items: baseline;
  padding: 1px 0;
  white-space: pre-wrap;
  word-break: break-word;
  animation: line-in .28s ease-out;
}

@keyframes line-in {
  from { opacity: 0; transform: translateY(-2px); }
  to   { opacity: 1; transform: none; }
}

.term-boot { color: var(--text-faint); }
.term-empty { color: var(--text-faint); font-style: italic; }

.t { color: var(--text-faint); flex: none; font-size: 11px; }
.seq { color: var(--text-faint); flex: none; font-size: 11px; }

.v-tag {
  flex: none;
  padding: 0 6px;
  border-radius: 3px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  border: 1px solid currentColor;
}

.v-pass    { color: var(--green); }
.v-fail    { color: var(--red); }
.v-invalid { color: var(--amber); }
.v-refused { color: #ff6fd8; }
/* Refuted outranks FAIL in colour: a FAIL was caught at the door, a REFUTED was
 * let through and then overturned. The second is the worse outcome. */
.v-refuted { color: #ff2d4d; text-decoration: line-through; text-decoration-thickness: 1px; }
.v-unlock  { color: var(--slate); }

.term-agent { color: #e6fff2; font-weight: 600; }
.term-intent { color: var(--text-dim); }
.term-tail { color: var(--text-faint); font-size: 11px; }

/* Evidence tag: the line must show what backs the verdict, not just the verdict.
   A digest is monospaced so a truncated hash still reads as a hash; a simulated
   preset is deliberately a different colour so it cannot be mistaken for one. */
.ev-tag {
  flex: none;
  font-size: 10px;
  padding: 0 5px;
  border-radius: 3px;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.ev-hash {
  color: var(--green);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  border: 1px dashed rgba(43, 255, 136, 0.45);
}
.ev-sim {
  color: var(--amber);
  border: 1px dashed rgba(255, 176, 32, 0.55);
}
.ev-none { color: var(--text-faint); border: 1px dotted rgba(255, 255, 255, 0.18); }
/* A refuted promise keeps the digest visible but struck through: the claim was
 * specific, and a reader has to be able to see *what* was claimed and failed. */
.ev-refuted {
  color: #ff2d4d;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  border: 1px solid rgba(255, 45, 77, 0.6);
  background: rgba(255, 45, 77, 0.08);
}

.term-line.is-fail { background: linear-gradient(90deg, rgba(255, 59, 87, 0.07), transparent 70%); }
.term-line.is-pass { background: linear-gradient(90deg, rgba(43, 255, 136, 0.045), transparent 70%); }
/* Applied on top of is-pass: the line was a pass and is now a refutation, so it
 * carries both its history and its current standing. */
.term-line.is-refuted {
  background: linear-gradient(90deg, rgba(255, 45, 77, 0.12), transparent 70%);
  border-left: 2px solid rgba(255, 45, 77, 0.65);
}
.term-line.is-refuted .term-intent,
.term-line.is-refuted .term-agent { opacity: 0.75; }

.term-tail-red { color: #ff6b81; }

/* The reconciliation affordance. Quiet, but not invisible: an opacity-0 button
 * is undiscoverable (and untouchable for anyone not using a mouse), which for
 * an audit control means it may as well not exist. Dim at rest, obvious on
 * hover. It is still not a moderation tool -- it only appears where a
 * refutation is actually possible. */
.verify-btn {
  flex: none;
  margin-left: 4px;
  padding: 0 6px;
  font-size: 10px;
  line-height: 16px;
  color: var(--text-faint);
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 3px;
  cursor: pointer;
  opacity: 0.4;
  transition: opacity .15s, color .15s, border-color .15s;
}
.term-line:hover .verify-btn,
.verify-btn:focus-visible { opacity: 1; }
.verify-btn:hover {
  color: #ff6b81;
  border-color: rgba(255, 45, 77, 0.55);
}
.verify-btn:focus-visible {
  outline: 1px solid rgba(255, 45, 77, 0.7);
  outline-offset: 1px;
}

.mark-new {
  flex: none;
  color: var(--green);
  font-size: 9px;
  letter-spacing: .1em;
  animation: fade-out 3s forwards;
}

@keyframes fade-out {
  0% { opacity: 1; }
  70% { opacity: 1; }
  100% { opacity: 0; }
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 10px;
  font-size: 10px;
  color: var(--text-faint);
  letter-spacing: 0.03em;
}

.legend b { font-weight: 700; margin-right: 4px; }

/* ---------- control panel ---------- */

.control { display: flex; flex-direction: column; gap: 12px; }

.hint {
  margin: 0;
  font-size: 11.5px;
  line-height: 1.6;
  color: var(--text-dim);
}

.danger-btn {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  padding: 14px 16px;
  border: 1px solid rgba(255, 59, 87, 0.42);
  border-radius: 10px;
  background:
    radial-gradient(120% 140% at 0% 0%, rgba(255, 59, 87, 0.18), transparent 70%),
    #150609;
  color: #ffdbe1;
  font-family: var(--mono);
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: transform .12s ease, box-shadow .2s, border-color .2s;
  box-shadow: 0 0 0 rgba(255, 59, 87, 0);
}

.danger-btn .bolt { position: absolute; right: 14px; top: 12px; font-size: 15px; color: var(--red); }
.danger-btn small { font-weight: 400; font-size: 10px; color: rgba(255, 190, 200, 0.6); letter-spacing: .06em; }

.danger-btn:hover {
  border-color: var(--red);
  box-shadow: 0 0 26px rgba(255, 59, 87, 0.22);
}

.danger-btn:active { transform: translateY(1px) scale(0.995); }
.danger-btn[disabled] { opacity: .45; cursor: progress; }

.secondary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.ghost-btn {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #070c0a;
  color: #a8bcb2;
  font-family: var(--mono);
  font-size: 11.5px;
  text-align: left;
  cursor: pointer;
  transition: border-color .18s, color .18s, background .18s;
  width: 100%;
}

.ghost-btn small { color: var(--text-faint); font-size: 9.5px; letter-spacing: .04em; }
.ghost-btn:hover { border-color: var(--line-bright); color: #eafff4; background: #0a1310; }
.ghost-btn[disabled] { opacity: .4; cursor: progress; }

/* ---------- auth ---------- */

.auth-banner {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 9px 11px;
  border: 1px solid rgba(255, 176, 32, 0.5);
  border-left-width: 3px;
  border-radius: 8px;
  background: rgba(255, 176, 32, 0.07);
  color: #ffe6b8;
  font-size: 11px;
  line-height: 1.5;
}

.auth-banner strong { font-size: 11.5px; letter-spacing: 0.04em; }
.auth-banner code {
  padding: 0 3px;
  border-radius: 3px;
  background: rgba(255, 176, 32, 0.14);
  color: var(--amber);
}
.auth-banner span { color: rgba(255, 230, 184, 0.78); }

.key-row {
  display: flex;
  align-items: center;
  gap: 7px;
}

.key-row label {
  flex: none;
  font-size: 9.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.key-row input {
  flex: 1;
  min-width: 0;
  padding: 6px 9px;
  border: 1px solid var(--line-bright);
  border-radius: 6px;
  background: #050a08;
  color: #d9ece3;
  font-family: var(--mono);
  font-size: 11px;
  outline: none;
  transition: border-color .18s, box-shadow .18s;
}

.key-row input:focus {
  border-color: var(--green-dim);
  box-shadow: 0 0 0 2px rgba(43, 255, 136, 0.1);
}

.key-row input::placeholder { color: #35504a; }

.key-row .ghost-btn {
  flex: none;
  width: auto;
  padding: 6px 11px;
  text-align: center;
}

.key-state {
  margin: 0;
  font-size: 10px;
  letter-spacing: 0.03em;
  color: var(--text-faint);
}

.key-state.is-ok   { color: var(--green-dim); }
.key-state.is-warn { color: var(--amber); }

/* ---------- verdict card ---------- */

.verdict-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  background: #060b09;
  animation: card-in .3s ease-out;
}

@keyframes card-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: none; }
}

.verdict-card.is-fail { border-color: rgba(255, 59, 87, 0.5); box-shadow: 0 0 24px rgba(255, 59, 87, .12) inset; }
.verdict-card.is-pass { border-color: rgba(43, 255, 136, 0.35); }
.verdict-card.is-invalid { border-color: rgba(255, 176, 32, 0.4); }
.verdict-card.is-refused { border-color: rgba(255, 111, 216, 0.45); }

.verdict-top { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }

.v-badge {
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid currentColor;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
}

.v-badge.v-fail    { color: var(--red); }
.v-badge.v-pass    { color: var(--green); }
.v-badge.v-invalid { color: var(--amber); }
.v-badge.v-refused { color: #ff6fd8; }

.verdict-top code { font-size: 11.5px; color: #dff7ea; }

.verdict-msg {
  margin: 0 0 10px;
  font-size: 11.5px;
  line-height: 1.55;
  color: #b9c9c1;
}

.verdict-facts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin: 0 0 10px;
}

.verdict-facts div { display: flex; flex-direction: column; gap: 2px; }
.verdict-facts dt { font-size: 9px; letter-spacing: .1em; color: var(--text-faint); text-transform: uppercase; }
.verdict-facts dd { margin: 0; font-size: 12.5px; color: #d9ece3; font-variant-numeric: tabular-nums; }

.verdict-hash { display: flex; gap: 8px; align-items: center; font-size: 9.5px; color: var(--text-faint); }
.verdict-hash code {
  color: var(--green-dim);
  font-size: 9.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- agents ---------- */

.agents-block { border-top: 1px dashed var(--line); padding-top: 10px; }

.agents-block h3 {
  margin: 0 0 8px;
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
  font-weight: 600;
}

/* ---------- independence (D5) ----------
   Deliberately quiet. This figure is reported, never enforced: nothing on the
   server refuses a request because of it, so nothing here may look like a
   refusal. Two tones only -- information for a computed value, absence for an
   uncalibrated one. Alert styling is tested against, not merely avoided. */

.independence {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 10px;
  margin: 0 0 8px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(122, 162, 255, 0.04);
  font-size: 11px;
  cursor: help;
}

.independence-label { color: var(--text-dim); }

.independence-value {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  font-weight: 600;
}
.independence-value.tone-calibrated   { color: var(--slate); }
.independence-value.tone-uncalibrated { color: var(--text-faint); }
.independence-value.tone-unknown      { color: var(--text-faint); }

.independence-detail { color: var(--text-faint); font-size: 10px; }

.independence-gate {
  flex-basis: 100%;
  color: var(--text-faint);
  font-size: 9.5px;
  line-height: 1.5;
  opacity: 0.85;
}

.agents-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }

.agents-empty { font-size: 10.5px; color: var(--text-faint); font-style: italic; }

.agent-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #060b09;
  font-size: 11px;
}

.agent-row.is-inflamed { border-color: rgba(255, 59, 87, 0.4); background: rgba(255, 59, 87, 0.05); }

.agent-name { color: #e2f4eb; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.agent-trust { color: var(--text-dim); font-variant-numeric: tabular-nums; }

.badge {
  font-size: 9px;
  letter-spacing: .08em;
  padding: 1px 5px;
  border-radius: 3px;
  border: 1px solid currentColor;
}
.badge.healthy  { color: var(--green); }
.badge.warning  { color: var(--amber); }
.badge.critical { color: var(--red); }
.badge.locked   { color: #ff6fd8; }

.unlock-btn {
  margin-left: auto;
  border: 1px solid var(--line-bright);
  border-radius: 4px;
  background: transparent;
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 9px;
  padding: 1px 6px;
  cursor: pointer;
}
.unlock-btn:hover { color: var(--slate); border-color: var(--slate); }

/* ---------- alarm ---------- */

body.alarm .panel { border-color: rgba(255, 59, 87, 0.35); }
body.alarm .topbar { border-bottom-color: rgba(255, 59, 87, 0.4); }

body.alarm::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 45;
  box-shadow: inset 0 0 90px rgba(255, 59, 87, 0.22);
  animation: alarm-fade .9s ease-out forwards;
}

@keyframes alarm-fade {
  0%   { opacity: 1; }
  100% { opacity: 0; }
}

.alarm-toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 60;
  max-width: 420px;
  padding: 12px 16px;
  border: 1px solid rgba(255, 59, 87, 0.55);
  border-left-width: 3px;
  border-radius: 8px;
  background: #140609;
  color: #ffdde3;
  font-size: 12px;
  line-height: 1.55;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .6), 0 0 30px rgba(255, 59, 87, .18);
  animation: toast-in .25s ease-out;
}

.alarm-toast.is-pass { border-color: rgba(43, 255, 136, .5); background: #04120b; color: #ccffe4; }
.alarm-toast.is-warn { border-color: rgba(255, 176, 32, .5); background: #150f04; color: #ffe6b8; }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

/* ---------- footer ---------- */

.footer {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 22px 14px;
  font-size: 10px;
  color: var(--text-faint);
  letter-spacing: 0.04em;
}

.sep { opacity: 0.4; }

/* ---------- a posteriori reconciliation modal ----------
 * The only control in this UI that destroys an existing record's standing.
 * Styled to feel like a form you have to fill in, not a button you press:
 * heavy border, explicit target recap, and the consequence stated in the body
 * rather than in a tooltip nobody reads.
 */

.falsify-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(2, 6, 10, .78);
  backdrop-filter: blur(3px);
}
.falsify-backdrop[hidden] { display: none; }

.falsify-modal {
  width: min(560px, 100%);
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  padding: 18px 20px 16px;
  border: 1px solid rgba(255, 45, 77, .45);
  border-radius: 6px;
  background: #070b10;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .75), 0 0 40px rgba(255, 45, 77, .12);
  animation: toast-in .2s ease-out;
}

.falsify-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.falsify-head h3 {
  margin: 0;
  font-size: 13px;
  letter-spacing: .04em;
  color: #ff8fa0;
  text-transform: uppercase;
}
.falsify-x {
  padding: 2px 7px;
  font-size: 12px;
  color: var(--text-faint);
  background: transparent;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 3px;
  cursor: pointer;
}
.falsify-x:hover { color: #fff; border-color: rgba(255, 255, 255, .3); }

.falsify-target {
  display: grid;
  gap: 4px;
  padding: 9px 11px;
  margin-bottom: 12px;
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 4px;
  background: rgba(255, 255, 255, .02);
}
.fs-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-size: 11px;
}
.fs-row > span {
  flex: none;
  width: 62px;
  color: var(--text-faint);
}
.fs-row > code {
  color: #cfe9dc;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  word-break: break-all;
}

.falsify-warn {
  margin: 0 0 14px;
  padding: 9px 11px;
  font-size: 11px;
  line-height: 1.6;
  color: #ffd9de;
  border-left: 2px solid rgba(255, 45, 77, .7);
  background: rgba(255, 45, 77, .07);
}
.falsify-warn b { color: #ff6b81; }

.falsify-reasons {
  margin: 0 0 12px;
  padding: 0;
  border: 0;
}
.falsify-reasons legend {
  padding: 0 0 6px;
  font-size: 10px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.fs-radio {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 8px 10px;
  margin-bottom: 6px;
  font-size: 12px;
  color: #dff2e8;
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 4px;
  cursor: pointer;
}
.fs-radio:hover { border-color: rgba(255, 45, 77, .4); }
.fs-radio:has(input:checked) {
  border-color: rgba(255, 45, 77, .6);
  background: rgba(255, 45, 77, .06);
}
.fs-radio input { margin-top: 2px; accent-color: #ff2d4d; }
.fs-radio small {
  display: block;
  margin-top: 2px;
  font-size: 10px;
  color: var(--text-faint);
}

.fs-field {
  display: block;
  margin-bottom: 12px;
}
.fs-field > span {
  display: block;
  margin-bottom: 5px;
  font-size: 10px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.fs-field b { color: #ff8fa0; }
.fs-field input,
.fs-field textarea {
  width: 100%;
  padding: 7px 9px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  color: #eafff3;
  background: #04080d;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 4px;
  resize: vertical;
}
.fs-field input:focus,
.fs-field textarea:focus {
  outline: none;
  border-color: rgba(255, 45, 77, .6);
}

.falsify-error {
  margin: 0 0 12px;
  padding: 8px 10px;
  font-size: 11px;
  line-height: 1.5;
  color: #ffd9de;
  border: 1px solid rgba(255, 45, 77, .45);
  border-radius: 4px;
  background: rgba(255, 45, 77, .08);
}
.falsify-error[hidden] { display: none; }

.falsify-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.refute-btn {
  padding: 8px 16px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .03em;
  color: #fff;
  background: linear-gradient(180deg, #a81730, #7d0f23);
  border: 1px solid rgba(255, 45, 77, .6);
  border-radius: 4px;
  cursor: pointer;
}
.refute-btn:hover { background: linear-gradient(180deg, #c01b38, #94112a); }
.refute-btn:disabled { opacity: .55; cursor: default; }

/* The PASS/FAIL/INVALID counter marks itself when something was refuted: a
 * refutation that changes no visible number is a refutation nobody notices. */
#m-verdicts.has-refuted { color: #ff6b81; }

/* ==========================================================================
   Developer portal
   --------------------------------------------------------------------------
   The landing surface is deliberately *not* a second dashboard. A dashboard
   sells certainty; a developer portal sells a tool, so the visual weight is on
   the command and on the fact that nothing is uploaded. The copy buttons exist
   because a command nobody can copy is a command nobody runs.
   ========================================================================== */

.portal {
  /* Full width, like .metrics. Without this the hero lands in the left column
   * of the two-column shell and the page reads as "a banner squeezed over the
   * feed" instead of "this page is a landing page". */
  grid-column: 1 / -1;
  position: relative;
  border: 1px solid var(--line-bright);
  border-left: 3px solid var(--green);
  border-radius: 10px;
  padding: 18px 20px 16px;
  background:
    radial-gradient(620px 200px at 0% 0%, rgba(43, 255, 136, 0.10), transparent 70%),
    linear-gradient(180deg, #08120d, #050a08);
  overflow: hidden;
}

.portal-eyebrow {
  font-size: 9.5px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--green-dim);
}

.portal-title {
  margin: 6px 0 4px;
  font-size: 25px;
  line-height: 1.15;
  letter-spacing: -0.015em;
  color: #eafff3;
  text-shadow: 0 0 22px rgba(43, 255, 136, 0.22);
}

.portal-sub {
  margin: 0;
  max-width: 78ch;
  font-size: 12.5px;
  line-height: 1.65;
  color: var(--text-dim);
}
.portal-sub b { color: var(--text); font-weight: 600; }

.portal-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 13px;
}

.portal-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  font: inherit;
  font-size: 11.5px;
  letter-spacing: 0.02em;
  color: var(--text);
  text-decoration: none;
  background: var(--bg-raised);
  border: 1px solid var(--line-bright);
  border-radius: 5px;
  cursor: pointer;
  transition: border-color .15s, color .15s, background .15s;
}
.portal-btn:hover {
  color: #eafff3;
  border-color: var(--green-dim);
  background: #0d1714;
}

.portal-btn-primary {
  color: #04120a;
  font-weight: 600;
  background: linear-gradient(180deg, #35ff9a, #17c96b);
  border-color: transparent;
}
.portal-btn-primary:hover {
  color: #04120a;
  background: linear-gradient(180deg, #52ffae, #22dd78);
}

.portal-meta {
  margin-left: auto;
  font-size: 10.5px;
  color: var(--text-faint);
}

/* ---------- developer section ---------- */

.dev-portal {
  grid-column: 1 / -1;
  scroll-margin-top: 14px;
}

.dev-lead {
  margin: 0 0 14px;
  max-width: 90ch;
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--text-dim);
}
.dev-lead b { color: var(--text); }

.dev-step {
  padding: 12px 0 4px;
  border-top: 1px dashed var(--line);
}
.dev-step:first-of-type { border-top: none; }

.dev-step-head {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 8px;
}

.dev-step-no {
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--green-dim);
  border: 1px solid var(--line-bright);
  border-radius: 3px;
  padding: 1px 5px;
}

.dev-step-head h3 {
  margin: 0;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text);
}

.copy-btn {
  margin-left: auto;
  flex: none;
  padding: 4px 10px;
  font: inherit;
  font-size: 10.5px;
  color: var(--text-dim);
  background: transparent;
  border: 1px solid var(--line-bright);
  border-radius: 4px;
  cursor: pointer;
  transition: color .15s, border-color .15s;
}
.copy-btn:hover { color: var(--green); border-color: var(--green-dim); }
.copy-btn.is-copied {
  color: var(--green);
  border-color: var(--green-dim);
}
.copy-btn.is-failed { color: var(--red); border-color: var(--red-dim); }

.codeblock {
  margin: 0;
  padding: 11px 13px;
  overflow-x: auto;
  font-size: 12px;
  line-height: 1.6;
  color: #d7ffe8;
  background: #030806;
  border: 1px solid var(--line);
  border-radius: 6px;
  tab-size: 2;
}
.codeblock code { font: inherit; white-space: pre; }

.dev-note {
  margin: 8px 0 0;
  font-size: 11px;
  line-height: 1.7;
  color: var(--text-faint);
}
.dev-note code {
  padding: 0 3px;
  border-radius: 3px;
  background: rgba(43, 255, 136, 0.09);
  color: var(--text-dim);
}

.dev-list {
  margin: 9px 0 0;
  padding-left: 17px;
  font-size: 11px;
  line-height: 1.8;
  color: var(--text-faint);
}
.dev-list li { margin: 2px 0; }
.dev-list b { color: var(--text-dim); }
.dev-list code {
  padding: 0 3px;
  border-radius: 3px;
  background: rgba(43, 255, 136, 0.09);
  color: var(--text-dim);
}
.dev-links a { color: var(--green-dim); text-decoration: none; }
.dev-links a:hover { color: var(--green); text-decoration: underline; }

.mcp-details summary {
  cursor: pointer;
  font-size: 11.5px;
  color: var(--text-dim);
  padding: 3px 0 9px;
  list-style: none;
}
.mcp-details summary::-webkit-details-marker { display: none; }
.mcp-details summary::before {
  content: "▸ ";
  color: var(--green-dim);
}
.mcp-details[open] summary::before { content: "▾ "; }
.mcp-details summary code {
  padding: 0 3px;
  border-radius: 3px;
  background: rgba(43, 255, 136, 0.09);
}

/* ---------- trial quota ---------- */

.trial-note {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 7px 10px;
  font-size: 11px;
  color: rgba(200, 255, 226, 0.8);
  border: 1px solid rgba(43, 255, 136, 0.24);
  border-left-width: 3px;
  border-radius: 4px;
  background: rgba(43, 255, 136, 0.05);
}
.trial-note[hidden] { display: none; }
.trial-note.is-spent {
  color: rgba(255, 230, 184, 0.85);
  border-color: rgba(255, 176, 32, 0.34);
  background: rgba(255, 176, 32, 0.06);
}
.trial-link {
  margin-left: auto;
  color: var(--green-dim);
  text-decoration: none;
  white-space: nowrap;
}
.trial-link:hover { color: var(--green); text-decoration: underline; }

.trial-exhausted {
  padding: 11px 12px;
  border: 1px solid rgba(255, 176, 32, 0.42);
  border-left-width: 3px;
  border-radius: 5px;
  background: rgba(255, 176, 32, 0.06);
}
.trial-exhausted[hidden] { display: none; }
.trial-exhausted strong {
  display: block;
  margin-bottom: 4px;
  font-size: 11.5px;
  letter-spacing: 0.04em;
  color: var(--amber);
}
.trial-exhausted p {
  margin: 0 0 9px;
  font-size: 11px;
  line-height: 1.7;
  color: rgba(255, 230, 184, 0.8);
}

/* A trial verdict was judged but not sealed. It must not look like a chain
 * entry: dashed, dimmed, and labelled in the line itself. */
.term-line.is-trial {
  border-left: 2px dashed rgba(255, 176, 32, 0.55);
  padding-left: 6px;
  opacity: 0.9;
}
.term-tail-trial { color: var(--amber); }

@media (max-width: 620px) {
  .portal-title { font-size: 20px; }
  .portal-meta { margin-left: 0; width: 100%; }
}

/* ---------- claims next to the tooling ---------- */

/* The simulate button and the real-model note are two different strengths of
 * evidence. They sit far apart on purpose (console vs developer portal), but
 * each has to say which one it is, because a dashboard FAIL is the more
 * memorable of the two and the easier to over-read. */

.sim-note {
  margin: 0;
  padding: 8px 10px;
  font-size: 11px;
  line-height: 1.7;
  color: var(--text-dim);
  border: 1px solid var(--line-bright);
  border-left: 3px solid var(--amber);
  border-radius: 4px;
  background: rgba(255, 176, 32, 0.04);
}
.sim-note-lead { color: var(--text); }
.sim-note code,
.contrast code,
.dev-claims code,
.claims-src code {
  padding: 0 3px;
  border-radius: 3px;
  background: rgba(43, 255, 136, 0.09);
}

.contrast {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--bg-raised);
}

.contrast-head {
  margin-bottom: 8px;
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--text-faint);
  text-transform: uppercase;
}

.contrast-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.contrast-col {
  padding-left: 9px;
  border-left: 1px solid var(--line-bright);
}

.contrast-col h4 {
  margin: 0 0 5px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text);
}
.contrast-col h4 small {
  margin-left: 6px;
  font-weight: 400;
  font-size: 10px;
  color: var(--text-faint);
}

.contrast-col ul {
  margin: 0;
  padding-left: 14px;
  font-size: 11px;
  line-height: 1.7;
  color: var(--text-dim);
}

.contrast-bound {
  margin: 9px 0 0;
  font-size: 10.5px;
  color: var(--text-faint);
}

/* The file names are the scenario's, not the reader's data. Mapping them here,
 * once, keeps the two columns readable without pretending the names matter. */
.contrast-scenes {
  margin: 4px 0 0;
  font-size: 10px;
  line-height: 1.6;
  color: var(--text-faint);
}
.contrast-scenes code {
  padding: 0 3px;
  border-radius: 3px;
  background: rgba(43, 255, 136, 0.07);
}

@media (max-width: 620px) {
  .contrast-grid { grid-template-columns: 1fr; }
}

.legend-note {
  margin: 9px 0 0;
  font-size: 10px;
  line-height: 1.7;
  color: var(--text-faint);
}
.legend-note b { color: var(--text-dim); }
.legend-note code {
  padding: 0 3px;
  border-radius: 3px;
  background: rgba(122, 162, 255, 0.10);
}

.dev-claims {
  margin: 0 0 14px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: rgba(122, 162, 255, 0.03);
}

.dev-claims summary {
  cursor: pointer;
  padding: 8px 11px;
  font-size: 11.5px;
  color: var(--text-dim);
  list-style: none;
}
.dev-claims summary::-webkit-details-marker { display: none; }
.dev-claims summary::before {
  content: "▸ ";
  color: var(--slate);
}
.dev-claims[open] summary::before { content: "▾ "; }

.claims-body {
  padding: 0 11px 11px;
  font-size: 11px;
  line-height: 1.75;
  color: var(--text-dim);
}
.claims-body p { margin: 0 0 7px; }
.claims-yes { color: var(--green-dim); }
.claims-no { color: var(--amber); }
.claims-body ul {
  margin: 0 0 8px;
  padding-left: 16px;
}
.claims-body li { margin: 2px 0; }
.claims-src {
  margin: 0;
  font-size: 10px;
  color: var(--text-faint);
}
