/* NovaBrain Sentinel operational console. Dark ops dashboard, no build step. */

:root {
  --bg: #0b0f14;
  --panel: #131a23;
  --panel-2: #1b2531;
  --line: #232f3d;
  --text: #e6edf3;
  --muted: #9db0c2;
  --accent: #76b900;
  --ok: #3fb950;
  --warn: #d29922;
  --bad: #f85149;
  --info: #58a6ff;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 1.5rem 1.25rem 3rem;
  background: var(--bg);
  color: var(--text);
  font: 400 15px/1.55 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  max-width: 78rem;
  margin-inline: auto;
}

/* A utility, so it has to win over the display on the classes it is added to
   (.facts is a grid, .run-status is flex) regardless of source order. */
.is-hidden { display: none !important; }

h1, h2, h3 { margin: 0; letter-spacing: -0.01em; }

a { color: var(--accent); }

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

.topbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
  align-items: flex-end;
  justify-content: space-between;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  font: 600 0.7rem/1 var(--mono);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 0.5rem;
}

h1 { font-size: clamp(1.5rem, 3.4vw, 2.1rem); }

.subtitle { color: var(--muted); margin: 0.25rem 0 0; }

.health {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  font: 500 0.85rem/1 var(--mono);
  color: var(--muted);
}

#status-value { color: var(--muted); }

.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); flex: none; }
.dot-checking { background: var(--warn); }
.dot-online { background: var(--ok); box-shadow: 0 0 0 3px rgba(63, 185, 80, 0.18); }
.dot-offline { background: var(--bad); box-shadow: 0 0 0 3px rgba(248, 81, 73, 0.18); }

/* -- cognitive loop strip ------------------------------------------------ */

.loop { margin: 1.25rem 0 0.75rem; }

.strip-label {
  font: 600 0.68rem/1 var(--mono);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.6rem;
}

.stages {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.stages li { display: flex; align-items: center; gap: 0.4rem; }

.chip {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.3rem;
  font: 500 0.78rem/1 var(--mono);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-left-width: 3px;
  border-radius: 6px;
  padding: 0.45rem 0.6rem;
  color: var(--text);
  white-space: nowrap;
}

.chip.real { border-left-color: var(--ok); }
.chip.sim { border-left-color: var(--warn); color: #f0d68c; }
.chip.planned {
  border-left-color: var(--muted);
  border-style: dashed;
  color: var(--muted);
}

/* The gate is real and the action is not, so the stage gets both status
   colours on its left bar instead of one misleading label. */
.chip.mixed {
  border-left-color: transparent;
  background:
    linear-gradient(var(--ok) 0 50%, var(--warn) 50% 100%) left / 3px 100% no-repeat,
    var(--panel-2);
}

.chip-split {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font: 600 0.66rem/1 var(--mono);
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.chip-split .tag { padding: 0.2rem 0.32rem; border-radius: 4px; }
.chip-split .tag.real {
  color: #7ee787;
  background: rgba(63, 185, 80, 0.16);
  border: 1px solid rgba(63, 185, 80, 0.5);
}
.chip-split .tag.sim {
  color: #f0d68c;
  background: rgba(210, 153, 34, 0.14);
  border: 1px solid rgba(210, 153, 34, 0.5);
}
.chip-split .dot { color: var(--muted); }

.sep { color: var(--accent); }

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.9rem;
  margin: 0.6rem 0 0;
  font: 400 0.72rem/1 var(--mono);
  color: var(--muted);
}

.key { display: inline-block; width: 10px; height: 10px; border-radius: 3px; vertical-align: -1px; }
.key.real { background: var(--ok); }
.key.sim { background: var(--warn); }
.key.mixed { background: linear-gradient(var(--ok) 0 50%, var(--warn) 50% 100%); }
.key.planned { background: transparent; border: 1px dashed var(--muted); }

/* -- run bar ------------------------------------------------------------- */

.runbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.25rem;
  margin: 0.75rem 0 0;
  padding: 0.6rem 0.75rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font: 500 0.78rem/1 var(--mono);
  color: var(--muted);
}

.runbar-item span { color: var(--text); }

.run-status { display: flex; align-items: center; gap: 0.45rem; color: var(--accent); }
.run-status span { color: var(--accent); }

.spinner {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  border: 2px solid rgba(118, 185, 0, 0.25);
  border-top-color: var(--accent);
  animation: spin 0.9s linear infinite;
  flex: none;
}

@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  .spinner { animation: none; }
}

/* -- notices ------------------------------------------------------------- */

.notice {
  margin: 0.75rem 0 0;
  padding: 0.7rem 0.9rem;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--panel);
}

.notice-warn { border-color: rgba(210, 153, 34, 0.55); background: rgba(210, 153, 34, 0.08); }
.notice-error { border-color: rgba(248, 81, 73, 0.5); background: rgba(248, 81, 73, 0.08); }

.notice-title { margin: 0; font-weight: 600; }
.notice-detail { margin: 0.2rem 0 0; color: var(--muted); font-size: 0.85rem; }

/* -- console grid -------------------------------------------------------- */

.console {
  display: grid;
  grid-template-columns: minmax(0, 22rem) minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
  margin-top: 1rem;
}

.column { display: grid; gap: 1rem; }

@media (max-width: 60rem) {
  .console { grid-template-columns: minmax(0, 1fr); }
  /* The desktop layout pairs OBSERVE with ACT in one column, which would make a
     phone read 1, 4, 2, 3, 5, 6. Dissolving the columns lets the panels be put
     back in the order the loop actually runs. */
  .column { display: contents; }
  #panel-incident { order: 1; }
  #panel-assessment { order: 2; }
  #panel-approval { order: 3; }
  #panel-action { order: 4; }
  #panel-verification { order: 5; }
  #panel-audit { order: 6; }
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem;
}

.panel h2 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font: 600 0.8rem/1 var(--mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.75rem;
}

.panel h3 {
  font: 600 0.7rem/1 var(--mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 1rem 0 0.4rem;
}

.step {
  display: grid;
  place-items: center;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 50%;
  background: var(--accent);
  color: #06100a;
  font-size: 0.7rem;
  flex: none;
}

.panel-hint, .placeholder, .field-help, .safety { color: var(--muted); font-size: 0.82rem; margin: 0; }
.placeholder { font-style: italic; }
.panel-hint { margin-bottom: 0.85rem; }
.safety { margin-top: 0.85rem; border-top: 1px solid var(--line); padding-top: 0.7rem; }

.badge {
  display: inline-block;
  font: 600 0.68rem/1 var(--mono);
  letter-spacing: 0.12em;
  border-radius: 4px;
  padding: 0.35rem 0.5rem;
  margin: 0 0 0.75rem;
}

.badge.sim { color: #f0d68c; background: rgba(210, 153, 34, 0.14); border: 1px solid rgba(210, 153, 34, 0.5); }

/* -- form ---------------------------------------------------------------- */

.field { margin-bottom: 0.75rem; }

.field label {
  display: block;
  font: 500 0.72rem/1 var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.field-help { display: block; margin-top: 0.3rem; }

input, textarea, select {
  width: 100%;
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.5rem 0.6rem;
  font: 400 0.9rem/1.45 var(--mono);
}

textarea { resize: vertical; }

input:focus-visible, textarea:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

input:disabled, textarea:disabled, select:disabled { opacity: 0.55; }

.actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.9rem; }

.btn {
  font: 600 0.8rem/1 var(--mono);
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  padding: 0.6rem 0.8rem;
  cursor: pointer;
}

.btn:hover:not(:disabled) { border-color: var(--accent); }

.btn.primary { background: var(--accent); border-color: var(--accent); color: #06100a; }
.btn.warn { border-color: rgba(210, 153, 34, 0.6); color: #f0d68c; }
.btn.danger { border-color: rgba(248, 81, 73, 0.6); color: #ffb3ae; }
/* A disabled button must not keep the filled primary look: the gate being shut
   is the thing the demo has to show. */
.btn:disabled { color: var(--muted); background: var(--panel); border-color: var(--line); cursor: not-allowed; }

/* -- assessment ---------------------------------------------------------- */

.facts {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.3rem 0.9rem;
  margin: 0;
  padding: 0.7rem 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.facts dt {
  font: 500 0.7rem/1.6 var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.facts dd { margin: 0; font: 500 0.85rem/1.5 var(--mono); }

.sev { text-transform: uppercase; }
.sev-low { color: var(--ok); }
.sev-medium { color: var(--info); }
.sev-high { color: var(--warn); }
.sev-critical { color: var(--bad); }

.summary { margin: 0.85rem 0 0; font-size: 0.95rem; }

.bullets { margin: 0; padding-left: 1.1rem; }
.bullets li { margin-bottom: 0.3rem; }

.rationale {
  margin: 0;
  padding: 0.6rem 0.7rem;
  background: var(--panel-2);
  border-left: 3px solid var(--accent);
  border-radius: 4px;
  color: var(--muted);
  font-size: 0.85rem;
}

/* -- approval gate ------------------------------------------------------- */

.gate-flag {
  font: 600 0.85rem/1.3 var(--mono);
  letter-spacing: 0.06em;
  margin: 0;
  color: var(--muted);
}

.gate-closed { color: #f0d68c; }

.gate-explain { margin: 0.35rem 0 0; color: var(--muted); font-size: 0.85rem; }

.gate-decision {
  margin: 0.7rem 0 0;
  font: 400 0.75rem/1.4 var(--mono);
  color: var(--muted);
  border-top: 1px solid var(--line);
  padding-top: 0.6rem;
}

/* -- verification -------------------------------------------------------- */

.metrics { margin: 0; padding: 0; list-style: none; }

.metrics li {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.4rem 0;
  border-bottom: 1px dashed var(--line);
  font: 400 0.82rem/1.4 var(--mono);
}

.metrics li.moved { color: var(--text); }
.metrics li.flat { color: var(--muted); }

#v-status.ok { color: var(--ok); }
#v-status.bad { color: var(--bad); }

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

.trail { margin: 0; padding: 0; list-style: none; }

.trail li {
  border-left: 3px solid var(--line);
  padding: 0.15rem 0 0.5rem 0.7rem;
  margin-bottom: 0.35rem;
}

.trail li.actor-sentinel { border-left-color: var(--info); }
.trail li.actor-operator { border-left-color: var(--accent); }

.trail-head { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0; font-size: 0.82rem; }

.trail-event { font-weight: 600; }
.trail-actor {
  font: 500 0.68rem/1.6 var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-radius: 4px;
  padding: 0 0.4rem;
  color: #06100a;
  background: var(--accent);
}
.actor-sentinel .trail-actor { background: var(--info); color: #04101c; }
.trail-time { color: var(--muted); font: 400 0.7rem/1.6 var(--mono); margin-left: auto; }
.trail-details { margin: 0.15rem 0 0; color: var(--muted); font: 400 0.76rem/1.5 var(--mono); }

/* -- disclosure ---------------------------------------------------------- */

.disclosure {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

.disclosure-badge {
  display: inline-block;
  margin: 0 0 0.75rem;
  padding: 0.45rem 0.7rem;
  border-radius: 999px;
  background: rgba(118, 185, 0, 0.12);
  border: 1px solid rgba(118, 185, 0, 0.5);
  color: var(--accent);
  font: 600 0.78rem/1 var(--mono);
}

.disclosure-cols {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  gap: 1rem;
}

.disclosure-cols h3 {
  font: 600 0.7rem/1 var(--mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.4rem;
}

.disclosure-cols ul { margin: 0; padding-left: 1.1rem; font-size: 0.82rem; color: var(--text); }

.muted { color: var(--muted); font-size: 0.78rem; margin: 1rem 0 0; }

/* -- small screens ------------------------------------------------------- */

@media (max-width: 40rem) {
  body { padding: 1rem 0.75rem 2rem; font-size: 14px; }
  .topbar { align-items: flex-start; }
  .actions .btn { flex: 1 1 100%; }
  .stages { gap: 0.3rem; }
  .chip { font-size: 0.7rem; padding: 0.4rem 0.5rem; }
  .trail-time { margin-left: 0; flex-basis: 100%; }
  .facts { grid-template-columns: 1fr; gap: 0.1rem; }
  .facts dd { margin-bottom: 0.5rem; }
}
