/* ============================================================
   ANONYMOUS console — futuristic dark/neon skin
   ============================================================ */
:root {
  --bg: #04060c;
  --panel: rgba(12, 18, 32, 0.72);
  --line: rgba(80, 220, 255, 0.16);
  --line-hot: rgba(80, 220, 255, 0.45);
  --cyan: #29e0ff;
  --cyan-dim: #0e93ad;
  --magenta: #ff4fd8;
  --violet: #9b6bff;
  --lime: #7dffb2;
  --amber: #ffcc66;
  --red: #ff5570;
  --text: #d8e8ff;
  --text-dim: #7f92b4;
  --grey: #9aa6bb;
  --mono: "JetBrains Mono", "Cascadia Code", "Fira Code", ui-monospace, Consolas, monospace;
  --sans: "Inter", "Segoe UI", system-ui, sans-serif;
  --radius: 14px;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.55);
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

body {
  display: grid;
  grid-template-rows: auto auto auto 1fr auto;
  gap: 10px;
  padding: 12px 18px 10px;
}

/* ---------- animated backdrop ---------- */
.bg-grid, .bg-glow, .bg-scan { position: fixed; inset: 0; pointer-events: none; }

.bg-grid {
  background-image:
    linear-gradient(rgba(41, 224, 255, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(41, 224, 255, 0.055) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: radial-gradient(ellipse 90% 80% at 50% 0%, #000 20%, transparent 75%);
  animation: drift 28s linear infinite;
}
@keyframes drift { to { background-position: 46px 46px, 46px 46px; } }

.bg-glow {
  background:
    radial-gradient(760px 420px at 12% -8%, rgba(41, 224, 255, 0.16), transparent 62%),
    radial-gradient(680px 420px at 88% 4%, rgba(255, 79, 216, 0.12), transparent 60%),
    radial-gradient(900px 620px at 50% 118%, rgba(155, 107, 255, 0.14), transparent 66%);
}

.bg-scan {
  background: repeating-linear-gradient(to bottom,
    rgba(255, 255, 255, 0.022) 0 1px, transparent 1px 3px);
  opacity: 0.55;
}

/* ---------- top bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 10px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(120deg, rgba(10, 16, 30, 0.92), rgba(14, 22, 40, 0.72));
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(14px);
  position: relative;
  z-index: 2;
}
.topbar::after {
  content: "";
  position: absolute; left: 18px; right: 18px; bottom: -1px; height: 1px;
  background: linear-gradient(90deg, transparent, var(--cyan), var(--magenta), transparent);
  opacity: 0.6;
}

.brand { display: flex; align-items: center; gap: 14px; }
.brand-logo {
  height: 46px; width: auto; max-width: 140px;
  object-fit: contain; border-radius: 10px;
  filter: drop-shadow(0 0 12px rgba(41, 224, 255, 0.55))
          drop-shadow(0 0 26px rgba(255, 79, 216, 0.22));
  animation: logo-breathe 5.5s ease-in-out infinite;
}
@keyframes logo-breathe {
  50% {
    filter: drop-shadow(0 0 18px rgba(41, 224, 255, 0.85))
            drop-shadow(0 0 42px rgba(255, 79, 216, 0.4));
  }
}
.sigil {
  font-size: 26px; color: var(--cyan);
  text-shadow: 0 0 14px rgba(41, 224, 255, 0.9), 0 0 34px rgba(41, 224, 255, 0.4);
  animation: pulse 3.4s ease-in-out infinite;
}
@keyframes pulse { 50% { opacity: 0.55; transform: scale(0.94); } }

.brand-text h1 {
  margin: 0;
  font-family: var(--mono);
  font-size: 20px;
  letter-spacing: 0.32em;
  font-weight: 700;
  color: #eaf7ff;
  text-shadow: 0 0 18px rgba(41, 224, 255, 0.5);
  position: relative;
}
.brand-text h1::before,
.brand-text h1::after {
  content: attr(data-text);
  position: absolute; inset: 0; opacity: 0;
}
.brand-text h1::before { color: var(--magenta); animation: glitch 6.5s infinite; }
.brand-text h1::after  { color: var(--cyan); animation: glitch 7.4s infinite reverse; }
@keyframes glitch {
  0%, 92%, 100% { transform: translate(0); opacity: 0; }
  93% { transform: translate(-2px, 1px); opacity: 0.75; }
  95% { transform: translate(2px, -1px); opacity: 0.55; }
}
.brand-text p {
  margin: 3px 0 0; font-family: var(--mono); font-size: 10.5px;
  letter-spacing: 0.28em; text-transform: uppercase; color: var(--text-dim);
}

.status { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

.pill {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.06em;
  padding: 6px 11px; border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(8, 14, 26, 0.8);
  color: var(--text-dim);
  white-space: nowrap;
  max-width: 340px; overflow: hidden; text-overflow: ellipsis;
}
.pill .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--text-dim); box-shadow: 0 0 8px currentColor;
}
.pill.ok { color: var(--lime); border-color: rgba(125, 255, 178, 0.35); }
.pill.ok .dot { background: var(--lime); }
.pill.warn { color: var(--amber); border-color: rgba(255, 204, 102, 0.35); }
.pill.warn .dot { background: var(--amber); }
.pill.bad { color: var(--red); border-color: rgba(255, 85, 112, 0.4); }
.pill.bad .dot { background: var(--red); }
.pill.magenta { color: var(--magenta); border-color: rgba(255, 79, 216, 0.42); }
.pill.magenta .dot { background: var(--magenta); box-shadow: 0 0 10px var(--magenta); }

/* ---------- buttons ---------- */
.btn {
  font-family: var(--mono); font-size: 11.5px; letter-spacing: 0.12em;
  text-transform: uppercase; cursor: pointer;
  padding: 8px 15px; border-radius: 9px;
  border: 1px solid var(--line-hot);
  background: rgba(41, 224, 255, 0.06);
  color: var(--cyan);
  transition: transform 0.12s ease, box-shadow 0.18s ease, background 0.18s ease, color 0.18s ease;
}
.btn:hover { background: rgba(41, 224, 255, 0.16); box-shadow: 0 0 22px rgba(41, 224, 255, 0.28); }
.btn:active { transform: translateY(1px) scale(0.99); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; box-shadow: none; }
.btn.ghost { border-color: var(--line); color: var(--text-dim); background: transparent; }
.btn.ghost:hover { color: var(--cyan); border-color: var(--line-hot); }
.btn.danger { border-color: rgba(255, 85, 112, 0.35); color: var(--red); }
.btn.danger:hover { background: rgba(255, 85, 112, 0.14); box-shadow: 0 0 20px rgba(255, 85, 112, 0.25); }
.btn.primary {
  color: #03131a;
  background: linear-gradient(120deg, var(--cyan), #a5f4ff 45%, var(--violet));
  border: none; font-weight: 700;
  box-shadow: 0 0 26px rgba(41, 224, 255, 0.4);
}
.btn.primary:hover { box-shadow: 0 0 36px rgba(41, 224, 255, 0.62); }

/* ---------- scrollbars ---------- */
::selection { background: rgba(41, 224, 255, 0.28); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: linear-gradient(var(--cyan-dim), rgba(155, 107, 255, 0.6));
  border-radius: 999px; border: 2px solid var(--bg);
}

/* ---------- target bar ---------- */
.targetbar {
  position: relative; z-index: 2;
  padding: 12px 18px 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(160deg, rgba(13, 20, 36, 0.9), rgba(8, 12, 22, 0.78));
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(12px);
}
.targetbar-head {
  display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; margin-bottom: 9px;
}
.targetbar label {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.26em;
  color: var(--cyan); text-transform: uppercase;
}
.targetbar-note { font-size: 11.5px; color: var(--text-dim); }

.targetbar-row { display: flex; gap: 9px; }
.targetbar-row input {
  flex: 1 1 auto; min-width: 0;
  font-family: var(--mono); font-size: 13.5px;
  padding: 11px 14px; border-radius: 10px;
  color: var(--text);
  background: rgba(3, 7, 14, 0.85);
  border: 1px solid var(--line);
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
.targetbar-row input::placeholder { color: #4d6280; }
.targetbar-row input:focus {
  border-color: var(--line-hot);
  box-shadow: 0 0 0 3px rgba(41, 224, 255, 0.12), 0 0 22px rgba(41, 224, 255, 0.16);
}
.targetbar-row select {
  font-family: var(--mono); font-size: 12px;
  padding: 0 12px; border-radius: 10px;
  color: var(--cyan); background: rgba(3, 7, 14, 0.9);
  border: 1px solid var(--line); outline: none; cursor: pointer;
}
.targetbar-row select:focus { border-color: var(--line-hot); }

.hint { font-family: var(--mono); font-size: 11.5px; color: var(--text-dim); min-height: 0; margin-top: 6px; }
.hint:empty { display: none; }
.hint.error { color: var(--red); }
.hint.good { color: var(--lime); }

/* ---------- target chips ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; }
.chips:empty { display: none; }
.chip {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--mono); font-size: 11.5px;
  padding: 5px 6px 5px 11px; border-radius: 999px;
  border: 1px solid rgba(125, 255, 178, 0.3);
  background: rgba(125, 255, 178, 0.07);
  color: var(--lime);
  animation: chipIn 0.28s ease both;
}
@keyframes chipIn { from { opacity: 0; transform: translateY(-4px) scale(0.96); } }
.chip.recon { border-color: rgba(255, 204, 102, 0.32); background: rgba(255, 204, 102, 0.07); color: var(--amber); }
.chip.suggested {
  border-style: dashed; border-color: rgba(125, 255, 178, 0.28);
  background: transparent; color: rgba(125, 255, 178, 0.72);
}
.chip.suggested .mode { color: inherit; opacity: 0.6; }
.chip.suggested button:hover { background: rgba(125, 255, 178, 0.85); color: #06110a; }
.chip .mode {
  font-size: 9px; letter-spacing: 0.12em; text-transform: uppercase;
  opacity: 0.75; padding-left: 2px;
}
.chip button {
  all: unset; cursor: pointer; width: 17px; height: 17px; border-radius: 50%;
  display: grid; place-items: center; font-size: 11px; line-height: 1;
  color: inherit; background: rgba(255, 255, 255, 0.08);
  transition: background 0.15s ease, color 0.15s ease;
}
.chip button:hover { background: rgba(255, 85, 112, 0.85); color: #12040a; }

/* ---------- the swarm: the workers' own conversation, above the chat box ---------- */
.swarm {
  display: flex; flex-direction: column; gap: 8px;
  max-height: 26vh; min-height: 0;
  padding: 8px 12px 10px;
  border: 1px solid var(--line);
  border-left: 2px solid var(--magenta);
  border-radius: var(--radius);
  background: linear-gradient(100deg, rgba(255, 79, 216, 0.1), rgba(10, 16, 30, 0.62) 46%, rgba(10, 16, 30, 0.24));
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(12px);
  position: relative; z-index: 2;
}
.swarm[hidden] { display: none; }
.swarm-head {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--mono); font-size: 10px;
  letter-spacing: 0.22em; text-transform: uppercase;
}
.swarm-title { color: var(--magenta); text-shadow: 0 0 14px rgba(255, 79, 216, 0.4); }
.swarm-sub { color: var(--text-dim); letter-spacing: 0.12em; text-transform: none; }
.swarm-spacer { flex: 1; }
/* The screen is a screen: it prints what the VM and its workers said and ran,
   and nothing typed into it reaches the machine. The label says so out loud. */
.swarm-ro {
  color: var(--text-dim); letter-spacing: 0.16em;
  border: 1px dashed var(--line); border-radius: 6px; padding: 1px 6px;
}
.swarm-view[aria-readonly="true"] { cursor: default; user-select: text; }
#btn-vm-screen.on, #swarm-follow.on { color: var(--lime); border-color: rgba(140, 255, 120, 0.4); }
.swarm-tabs { display: flex; flex-wrap: wrap; gap: 5px; }
.swarm-tab {
  display: flex; align-items: baseline; gap: 6px;
  padding: 3px 9px; cursor: pointer;
  font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.08em;
  color: var(--text-dim); background: rgba(9, 14, 25, 0.7);
  border: 1px solid var(--line); border-radius: 8px;
}
.swarm-tab b { color: var(--cyan); font-weight: 700; }
.swarm-tab.on { border-color: var(--magenta); color: var(--text); background: rgba(255, 79, 216, 0.12); }
.swarm-tab.done b { color: var(--lime); }
.swarm-tab.bad b { color: var(--red); }
.swarm-view {
  flex: 1; min-height: 0; margin: 0; overflow-y: auto;
  font-family: var(--mono); font-size: 11.5px; line-height: 1.55;
  color: #e7c8f6; white-space: pre-wrap; word-break: break-word;
}
.swarm.closed .swarm-tabs, .swarm.closed .swarm-view { display: none; }
@media (max-width: 760px) {
  .swarm { max-height: 22vh; padding: 6px 10px 8px; }
  .swarm-sub { display: none; }
  /* The counters ride in the tab colours on a phone: the head has no room for
     three chips beside VIEW ONLY, FOLLOW, HIDE and CLEAR. */
  .swarm-stats { display: none; }
}

/* ---------- chat ---------- */
.chat {
  position: relative; z-index: 1;
  overflow-y: auto; overflow-x: hidden;
  display: flex; flex-direction: column; gap: 14px;
  padding: 4px 6px 8px 2px;
  scroll-behavior: smooth;
}

.empty {
  margin: auto; text-align: center; color: var(--text-dim);
  font-family: var(--mono); font-size: 12.5px; line-height: 1.9;
  animation: fadeUp 0.6s ease both;
}
.empty .ascii {
  color: var(--cyan-dim); font-size: 11px; margin: 0 0 18px;
  text-shadow: 0 0 22px rgba(41, 224, 255, 0.4);
}
.empty-logo {
  display: block; margin: 0 auto 16px;
  width: 148px; height: auto; max-height: 148px;
  object-fit: contain; border-radius: 18px;
  filter: drop-shadow(0 0 22px rgba(41, 224, 255, 0.45));
  opacity: 0.96;
}
.empty p { margin: 2px 0; }
.empty b { color: var(--cyan); }
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } }

.msg {
  display: flex; flex-direction: column; gap: 6px;
  max-width: min(980px, 92%);
  animation: fadeUp 0.26s ease both;
}
.msg.user { align-self: flex-end; align-items: flex-end; }
.msg.assistant, .msg.system { align-self: flex-start; }

.msg .role {
  font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.28em;
  text-transform: uppercase; color: var(--text-dim); padding: 0 3px;
}
.msg.user .role { color: var(--violet); }
.msg.assistant .role { color: var(--cyan); }

.bubble {
  padding: 12px 15px;
  border-radius: 13px;
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  font-size: 14.2px; line-height: 1.62;
  overflow-wrap: anywhere;
}
.msg.user .bubble {
  border-color: rgba(155, 107, 255, 0.34);
  background: linear-gradient(135deg, rgba(58, 34, 92, 0.65), rgba(24, 18, 44, 0.78));
  border-bottom-right-radius: 4px;
}
.msg.assistant .bubble { border-bottom-left-radius: 4px; }
.msg.final .bubble {
  border-color: rgba(255, 79, 216, 0.45);
  box-shadow: 0 0 34px rgba(255, 79, 216, 0.16), var(--shadow);
}
.msg.error .bubble { border-color: rgba(255, 85, 112, 0.5); color: #ffc2cd; background: rgba(46, 12, 20, 0.7); }
.msg.system { max-width: 100%; }
.msg.system .bubble {
  font-family: var(--mono); font-size: 11.5px; color: var(--text-dim);
  background: rgba(9, 14, 25, 0.6); border-style: dashed; padding: 8px 12px;
  white-space: pre-wrap; word-break: break-word;
}

/* ---------- THOUGHT and RESULT: labelled, separated, one colour each ----------
   The thought is GREY: it is the scratchpad, so it sits back and lets the
   operator's eye land on the result, which keeps its full-weight colour. */
.seg { margin: 0 0 13px; padding-left: 10px; }
.seg:last-child { margin-bottom: 0; }
.seg-label {
  display: inline-block;
  font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.26em;
  text-transform: uppercase; padding: 1px 7px; margin-bottom: 6px;
  border-radius: 6px; border: 1px solid currentColor;
}
.seg.thought { border-left: 2px solid rgba(154, 166, 187, 0.45); }
.seg.thought .seg-label { color: var(--grey); }
.seg.thought .seg-body { color: var(--grey); }
.seg.thought .seg-body strong { color: #c3ccdb; }
.seg.result { border-left: 2px solid rgba(125, 255, 178, 0.45); }
.seg.result .seg-label { color: var(--lime); }
.seg.result .seg-body { color: #e8fff4; }
.seg.plain { padding-left: 0; }

/* ---------- the status beat: the third colour ---------- */
.msg.status { align-self: flex-start; max-width: min(980px, 96%); }
.msg.status .role { color: var(--amber); }
.msg.status .bubble {
  border-color: rgba(255, 204, 102, 0.3);
  border-left: 2px solid var(--amber);
  background: rgba(26, 20, 8, 0.62);
}
.status-plain { margin: 0 0 7px; color: var(--amber); font-size: 13.6px; line-height: 1.5; }
.status-detail {
  margin: 0; font-family: var(--mono); font-size: 11.4px; line-height: 1.5;
  color: var(--text-dim); white-space: pre-wrap; word-break: break-word;
}

/* markdown-ish content */
.bubble h1, .bubble h2, .bubble h3 {
  font-family: var(--mono); color: #eaf7ff; margin: 14px 0 7px;
  letter-spacing: 0.04em; font-size: 15px;
}
.bubble h1:first-child, .bubble h2:first-child, .bubble h3:first-child { margin-top: 0; }
.bubble p { margin: 0 0 9px; }
.bubble p:last-child { margin-bottom: 0; }
.bubble ul, .bubble ol { margin: 6px 0 10px; padding-left: 22px; }
.bubble li { margin: 3px 0; }
.bubble code {
  font-family: var(--mono); font-size: 12.6px;
  background: rgba(41, 224, 255, 0.1);
  border: 1px solid rgba(41, 224, 255, 0.16);
  padding: 1px 5px; border-radius: 5px; color: #9be9ff;
}
.bubble pre {
  font-family: var(--mono); font-size: 12.4px; line-height: 1.5;
  background: rgba(2, 5, 11, 0.92);
  border: 1px solid var(--line); border-left: 2px solid var(--cyan-dim);
  border-radius: 9px; padding: 11px 13px; margin: 10px 0;
  overflow-x: auto; white-space: pre-wrap; word-break: break-word;
  color: #b9e9f7;
}
.bubble pre code { background: none; border: none; padding: 0; color: inherit; }
.bubble strong { color: #ffffff; }
.bubble table { border-collapse: collapse; margin: 10px 0; font-size: 13px; }
.bubble th, .bubble td { border: 1px solid var(--line); padding: 5px 9px; text-align: left; }
.bubble th { background: rgba(41, 224, 255, 0.09); font-family: var(--mono); font-size: 11.5px; }
.bubble a { color: var(--cyan); }

.cursor {
  display: inline-block; width: 8px; height: 15px; margin-left: 2px;
  background: var(--cyan); vertical-align: text-bottom;
  animation: blink 1.05s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* ---------- tool call cards ---------- */
.tool {
  border: 1px solid var(--line);
  border-left: 2px solid var(--cyan-dim);
  border-radius: 11px;
  background: rgba(7, 12, 22, 0.82);
  overflow: hidden;
  max-width: min(1040px, 96%);
  animation: fadeUp 0.22s ease both;
}
.tool-head {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 13px; cursor: pointer;
  font-family: var(--mono); font-size: 12px; user-select: none;
}
.tool-head:hover { background: rgba(41, 224, 255, 0.05); }
.tool-head .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 9px currentColor; }
.tool-head .name { color: var(--cyan); letter-spacing: 0.06em; }
.tool-head .meta { margin-left: auto; color: var(--text-dim); font-size: 10.5px; letter-spacing: 0.05em; }
.tool-head .caret { color: var(--text-dim); font-size: 10px; transition: transform 0.18s ease; }
.tool.collapsed .caret { transform: rotate(-90deg); }
.tool.collapsed .tool-body { display: none; }
.tool-body { padding: 0 13px 12px; }
.tool-args {
  font-family: var(--mono); font-size: 11.5px; line-height: 1.5;
  color: #8fb3d9; white-space: pre-wrap; word-break: break-word;
  padding: 6px 0 8px;
}
.tool pre {
  font-family: var(--mono); font-size: 11.8px; line-height: 1.5;
  max-height: 340px; overflow: auto; margin: 0;
  background: rgba(2, 5, 11, 0.9);
  border: 1px solid rgba(41, 224, 255, 0.1);
  border-radius: 8px; padding: 10px 12px;
  color: #a9dbe9; white-space: pre-wrap; word-break: break-word;
}
.tool.bad { border-left-color: var(--red); }
.tool.bad .tool-head .dot { background: var(--red); }
.tool.bad .tool-head .name { color: #ff8ea1; }
.tool.denied { border-left-color: var(--amber); }
.tool.denied .tool-head .dot { background: var(--amber); }
.tool.denied .tool-head .name { color: var(--amber); }
.tool.running .dot { animation: pulse 1s ease-in-out infinite; }

/* ---------- AGENT2, the assistant exploit specialist ---------- */
.tool.anon { border-left-color: var(--magenta); }
.tool.anon .tool-head .dot { background: var(--magenta); }
.tool.anon .tool-head .name { color: var(--magenta); letter-spacing: 0.14em; }
.tool.anon .tool-body { padding-top: 9px; }
.tool.anon .anon-out { max-height: 380px; color: #e7c8f6; }

/* ---------- approval cards ---------- */
.approval {
  border: 1px solid rgba(255, 204, 102, 0.45);
  border-radius: 13px;
  padding: 14px 16px;
  background: linear-gradient(135deg, rgba(48, 36, 11, 0.9), rgba(20, 16, 8, 0.92));
  box-shadow: 0 0 30px rgba(255, 204, 102, 0.12), var(--shadow);
  max-width: min(900px, 96%);
  animation: cardIn 0.3s ease both;
}
@keyframes cardIn { from { opacity: 0; transform: scale(0.97) translateY(6px); } }
.approval h4 {
  margin: 0; font-family: var(--mono); font-size: 11px;
  letter-spacing: 0.2em; color: var(--amber); text-transform: uppercase;
}
.approval .host {
  font-family: var(--mono); font-size: 17px; color: #fff;
  margin: 8px 0 6px; word-break: break-all;
}
.approval .reason { font-size: 13px; color: #cfd8e8; line-height: 1.55; }
.approval .badges { display: flex; gap: 7px; margin-top: 10px; flex-wrap: wrap; }
.badge {
  font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.14em;
  text-transform: uppercase; padding: 3px 8px; border-radius: 999px;
  border: 1px solid var(--line); color: var(--text-dim);
}
.badge.high { color: var(--red); border-color: rgba(255, 85, 112, 0.45); }
.badge.medium { color: var(--amber); border-color: rgba(255, 204, 102, 0.45); }
.badge.low { color: var(--lime); border-color: rgba(125, 255, 178, 0.45); }
.approval .actions { display: flex; gap: 9px; margin-top: 14px; }
.approval.resolved { border-color: var(--line); box-shadow: var(--shadow); opacity: 0.85; }
.approval.resolved .actions { display: none; }
.approval.resolved::after {
  content: attr(data-verdict);
  display: block; margin-top: 10px;
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.16em;
  text-transform: uppercase;
}
.approval.approved::after { color: var(--lime); }
.approval.denied::after { color: var(--red); }
.approval.expired::after { color: var(--text-dim); }

/* ---------- composer ---------- */
/* Compact on purpose: this footer used to eat a whole band of the window.
   It is the chat box and nothing else now - one line tall when idle, growing
   with what you type - so the conversation above it keeps every other pixel. */
.composer { position: relative; z-index: 2; display: flex; flex-direction: column; gap: 2px; }
#chat-form {
  display: flex; align-items: flex-end; gap: 6px;
  padding: 3px 6px 3px 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(160deg, rgba(11, 17, 30, 0.95), rgba(7, 11, 20, 0.9));
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
#chat-form:focus-within {
  border-color: var(--line-hot);
  box-shadow: 0 0 0 3px rgba(41, 224, 255, 0.1), 0 0 30px rgba(41, 224, 255, 0.14);
}
#chat-input {
  flex: 1 1 auto; min-width: 0;
  resize: none; min-height: 26px; max-height: 220px;
  background: transparent; border: none; outline: none;
  color: var(--text); font-family: var(--mono); font-size: 13px; line-height: 1.45;
  padding: 4px 0;
}
#chat-input::placeholder { color: #46587a; }
.btn.send { align-self: stretch; padding-inline: 24px; }
.btn.stop {
  align-self: stretch; padding-inline: 18px;
  border-color: rgba(255, 85, 112, 0.55);
  color: var(--red);
  background: rgba(255, 85, 112, 0.1);
}
.btn.stop:hover {
  background: rgba(255, 85, 112, 0.22);
  box-shadow: 0 0 26px rgba(255, 85, 112, 0.35);
}
.btn.stop[disabled] { opacity: 0.6; cursor: progress; }
.btn.vmdel {
  align-self: stretch; padding-inline: 14px;
  border-color: rgba(255, 85, 112, 0.4);
}
.btn.vmdel[disabled] { opacity: 0.55; cursor: progress; box-shadow: none; }
.btn[hidden], .btn.stop[hidden] { display: none; }

/* MIC and VOICE: the two buttons that make the console listen and speak.
   MIC records while it says STOP; VOICE is lit while ANONYMOUS reads aloud. */
.btn.mic, .btn.speak {
  align-self: stretch; padding-inline: 14px;
  font-size: 10.5px; letter-spacing: 0.14em;
  min-width: 74px;
}
.btn.mic.live {
  border-color: rgba(255, 85, 112, 0.6);
  color: var(--red);
  background: rgba(255, 85, 112, 0.14);
  box-shadow: 0 0 22px rgba(255, 85, 112, 0.35);
  animation: micPulse 1.1s ease-in-out infinite;
}
.btn.speak.live {
  border-color: rgba(125, 255, 178, 0.5);
  color: var(--lime);
  background: rgba(125, 255, 178, 0.1);
  box-shadow: 0 0 20px rgba(125, 255, 178, 0.26);
}
/* STATUS: the SYSTEM status stream on the console - the 15 s beat and the
   one-line notices about the playbook library. Lit while the console is
   printing them; dark when the operator has silenced the report. The work
   itself is never switched off, only the reporting of it. */
.btn.status { font-size: 10.5px; letter-spacing: 0.14em; }
.btn.status.live {
  border-color: rgba(125, 255, 178, 0.5);
  color: var(--lime);
  background: rgba(125, 255, 178, 0.1);
  box-shadow: 0 0 18px rgba(125, 255, 178, 0.24);
}
.btn.status.live:hover { box-shadow: 0 0 26px rgba(125, 255, 178, 0.36); }
@keyframes micPulse {
  50% { box-shadow: 0 0 34px rgba(255, 85, 112, 0.6); }
}

/* ---------- the reel: one small window, closed by the clip ---------- */
.reel {
  position: fixed; right: 20px; bottom: 118px; z-index: 22;
  width: 320px; max-width: 38vw;
  display: flex; flex-direction: column;
  border: 1px solid var(--line-hot); border-radius: 12px;
  background: rgba(6, 10, 18, 0.96);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.6), 0 0 26px rgba(41, 224, 255, 0.18);
  overflow: hidden;
  animation: reelIn 0.18s ease-out;
}
.reel[hidden] { display: none; }
@keyframes reelIn {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to { opacity: 1; transform: none; }
}
.reel-head {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px 6px 10px;
  background: linear-gradient(90deg, rgba(41, 224, 255, 0.14), transparent);
  border-bottom: 1px solid var(--line);
}
.reel-title {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--cyan);
}
.reel-moment {
  flex: 1 1 auto; min-width: 0;
  font-family: var(--mono); font-size: 9.5px; color: var(--text-dim);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.reel-close {
  flex: 0 0 auto; width: 18px; height: 18px; line-height: 1;
  border: 1px solid var(--line); border-radius: 5px;
  background: transparent; color: var(--text-dim);
  font-size: 13px; cursor: pointer;
}
.reel-close:hover { color: var(--red); border-color: rgba(255, 85, 112, 0.5); }
.reel video { display: block; width: 100%; height: auto; background: #000; }
.reel-sound {
  position: absolute; right: 8px; bottom: 8px;
  padding: 3px 9px; border-radius: 6px;
  border: 1px solid var(--line-hot); background: rgba(4, 6, 12, 0.85);
  color: var(--cyan); font-family: var(--mono); font-size: 9.5px;
  letter-spacing: 0.14em; cursor: pointer;
}
.reel-sound[hidden] { display: none; }

/* usage, link state and the keyboard hint ride in the header now: the footer
   carries nothing but the box, so nothing below it can grow the footer. */
.stat {
  display: inline-flex; align-items: center; gap: 5px;
  font-family: var(--mono); font-size: 10px; line-height: 1.2; color: var(--text-dim);
  letter-spacing: 0.06em; white-space: nowrap;
}
.stat.kbd-hint { gap: 3px; opacity: 0.75; }
.conn.ok { color: var(--lime); }
.conn.bad { color: var(--red); }
kbd {
  font-family: var(--mono); font-size: 10px;
  border: 1px solid var(--line); border-radius: 4px;
  padding: 1px 5px; color: var(--text);
  background: rgba(255, 255, 255, 0.05);
}

/* ---------- tools drawer ---------- */
.drawer {
  position: fixed; inset: 0; z-index: 60;
  display: grid; place-items: center;
  background: rgba(2, 4, 9, 0.74);
  backdrop-filter: blur(7px);
  animation: fadeUp 0.18s ease both;
}
.drawer[hidden] { display: none; }
.drawer-panel {
  width: min(940px, 93vw); max-height: 86vh;
  display: flex; flex-direction: column;
  border: 1px solid var(--line-hot); border-radius: 16px;
  background: rgba(9, 14, 25, 0.98);
  box-shadow: 0 0 60px rgba(41, 224, 255, 0.16), 0 30px 80px rgba(0, 0, 0, 0.7);
}
.drawer-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid var(--line);
}
.drawer-head h2 {
  margin: 0; font-family: var(--mono); font-size: 12px;
  letter-spacing: 0.28em; color: var(--cyan); text-transform: uppercase;
}
.drawer-body {
  overflow: auto; padding: 16px 18px;
  display: flex; flex-direction: column; gap: 12px;
}
.about-text {
  margin: 0; padding: 14px 16px;
  font-family: var(--mono); font-size: 12.2px; line-height: 1.6;
  color: #cfe6ff; white-space: pre-wrap; word-break: break-word;
  border: 1px solid var(--line); border-left: 2px solid var(--magenta);
  border-radius: 11px; background: rgba(6, 10, 18, 0.72);
}
#about-credit a { color: var(--magenta); text-decoration: none; }
#about-credit a:hover { text-decoration: underline; }
.tool-doc {
  border: 1px solid var(--line); border-left: 2px solid var(--cyan-dim);
  border-radius: 11px; padding: 12px 14px;
  background: rgba(6, 10, 18, 0.7);
}
.tool-doc h3 {
  margin: 0 0 5px; font-family: var(--mono); font-size: 13px;
  color: var(--cyan); letter-spacing: 0.08em;
}
.tool-doc .sig {
  font-family: var(--mono); font-size: 11.5px; color: #9be9ff;
  background: rgba(41, 224, 255, 0.08); border-radius: 6px;
  padding: 6px 9px; margin: 7px 0; overflow-x: auto; white-space: pre;
}
.tool-doc p { margin: 6px 0; font-size: 13px; color: var(--text-dim); line-height: 1.55; }
.tool-doc ul { margin: 6px 0; padding-left: 20px; font-size: 12.5px; color: var(--text-dim); }
.tool-doc code { font-family: var(--mono); font-size: 11.8px; color: #bde9f7; }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 20px);
  z-index: 80; opacity: 0; pointer-events: none;
  font-family: var(--mono); font-size: 12px; letter-spacing: 0.06em;
  padding: 10px 18px; border-radius: 10px;
  border: 1px solid var(--line-hot);
  background: rgba(8, 14, 26, 0.97);
  color: var(--cyan);
  box-shadow: 0 0 30px rgba(41, 224, 255, 0.22);
  transition: opacity 0.22s ease, transform 0.22s ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { border-color: rgba(255, 85, 112, 0.5); color: var(--red); }

/* ---------- responsive ---------- */
/* The keyboard hint is the first thing the header drops when width is tight:
   the shortcuts still work, and the pills keep the room they need. */
@media (max-width: 1180px) {
  .kbd-hint { display: none; }
}
@media (max-width: 980px) {
  body { padding: 10px 10px 8px; gap: 9px; }
  .topbar { flex-direction: column; align-items: flex-start; gap: 10px; }
  .status { justify-content: flex-start; }
  .brand-text h1 { font-size: 17px; letter-spacing: 0.3em; }
  .targetbar-row { flex-wrap: wrap; }
  .targetbar-row input { flex: 1 1 100%; }
  .kbd-hint { display: none; }
  .msg { max-width: 100%; }
}

/* ---------- rules of engagement ---------- */
.roe-state {
  margin: 0; font-family: var(--mono); font-size: 11.5px; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--amber);
  border-left: 2px solid var(--amber); padding-left: 9px;
}
.roe-state.signed { border-left-color: var(--lime); color: var(--lime); }
.roe-state.expired { border-left-color: var(--red); color: var(--red); }
.roe-field { display: flex; flex-direction: column; gap: 6px; }
.roe-field.short { max-width: 170px; }
.roe-field span {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--text-dim);
}
.roe-field input, .roe-field textarea {
  width: 100%; font-family: var(--mono); font-size: 12.5px; color: var(--text);
  background: rgba(6, 10, 18, 0.85); border: 1px solid var(--line);
  border-radius: 9px; padding: 9px 11px; resize: vertical;
}
.roe-field input:focus, .roe-field textarea:focus {
  outline: none; border-color: var(--line-hot);
  box-shadow: 0 0 0 2px rgba(41, 224, 255, 0.12);
}
.roe-actions { display: flex; gap: 10px; flex-wrap: wrap; }
#btn-roe.signed { color: var(--lime); border-color: rgba(125, 255, 178, 0.35); }
#btn-roe.expired { color: var(--red); border-color: rgba(255, 85, 112, 0.4); }
/* THE SCOPE WALL, in one word. Open is the doctrine default, so the dim ghost
   is the quiet state; armed strictness is amber, because a wall that is up is
   the state worth noticing. */
#btn-strict.on { color: var(--amber); border-color: rgba(255, 204, 102, 0.45); }

/* ---------------------------------------------------------------------------
   SYSTEM STATUS: a switch, in a track and a thumb
   The operator asked for a switch, not a button that happens to say STATUS. It
   is the one control in this product that silences a report, so it reads as a
   control: the words, the track, and ON/OFF beside it.
   --------------------------------------------------------------------------- */
.switch {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  flex: 0 0 auto;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid var(--line-hot);
  background: rgba(41, 224, 255, 0.05);
  color: var(--text-dim);
  transition: color 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}
.switch:hover { color: var(--text); }
.switch-track {
  position: relative;
  display: inline-block;
  width: 34px;
  height: 16px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  transition: background 0.18s ease, border-color 0.18s ease;
}
.switch-thumb {
  position: absolute;
  top: 1px;
  left: 1px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--text-dim);
  transition: transform 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}
.switch-state { min-width: 20px; color: inherit; }
.switch[aria-pressed="true"] {
  color: var(--lime);
  border-color: rgba(125, 255, 178, 0.45);
  box-shadow: 0 0 18px rgba(125, 255, 178, 0.16);
}
.switch[aria-pressed="true"] .switch-track {
  background: rgba(125, 255, 178, 0.26);
  border-color: rgba(125, 255, 178, 0.55);
}
.switch[aria-pressed="true"] .switch-thumb {
  transform: translateX(18px);
  background: var(--lime);
  box-shadow: 0 0 10px var(--lime);
}

/* ---------------------------------------------------------------------------
   THE VM SCREEN: black glass, every command
   The pop-up the operator asked to have back.  Black, monospace, one line per
   command with its owner in front of it, and the output underneath.
   --------------------------------------------------------------------------- */
.vm-pop {
  position: fixed;
  inset: 0;
  z-index: 85;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(2, 3, 6, 0.74);
  backdrop-filter: blur(3px);
}
.vm-pop[hidden] { display: none; }
.vm-pop-box {
  width: min(1080px, 95vw);
  height: min(78vh, 800px);
  display: flex;
  flex-direction: column;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(125, 255, 178, 0.28);
  background: #000;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.82),
              0 0 0 1px rgba(255, 255, 255, 0.04),
              0 0 70px rgba(125, 255, 178, 0.08);
}
.vm-pop-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 9px 12px;
  background: #06090d;
  border-bottom: 1px solid rgba(125, 255, 178, 0.18);
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.vm-pop-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-dim); }
.vm-pop-dot.live {
  background: var(--lime);
  box-shadow: 0 0 10px var(--lime);
  animation: pulse 2.6s ease-in-out infinite;
}
.vm-pop-title { color: var(--lime); letter-spacing: 0.24em; }
.vm-pop-meta { color: var(--text-dim); text-transform: none; letter-spacing: 0.04em; }
.vm-pop-spacer { flex: 1; }
.vm-pop-btn {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  padding: 5px 9px;
  border-radius: 6px;
  cursor: pointer;
  border: 1px solid rgba(125, 255, 178, 0.25);
  background: rgba(125, 255, 178, 0.06);
  color: #9dffc6;
}
.vm-pop-btn:hover { background: rgba(125, 255, 178, 0.14); color: #d6ffe6; }
.vm-pop-btn.on {
  border-color: rgba(125, 255, 178, 0.6);
  color: #d6ffe6;
  box-shadow: 0 0 14px rgba(125, 255, 178, 0.25);
}
.vm-pop-btn.close {
  border-color: rgba(255, 85, 112, 0.45);
  background: rgba(255, 85, 112, 0.08);
  color: #ff9db0;
}
.vm-pop-screen {
  flex: 1;
  margin: 0;
  padding: 14px 16px;
  overflow: auto;
  font-family: var(--mono);
  font-size: 12.6px;
  line-height: 1.55;
  color: #bff7d3;
  background: #000;
  white-space: pre-wrap;
  word-break: break-word;
  text-shadow: 0 0 8px rgba(125, 255, 178, 0.18);
  cursor: text;
  user-select: text;
}

/* ---------------------------------------------------------------------------
   THE SWARM'S COUNTERS: spawned / landed / failed, by priority
   The read-only screen used to describe the crew; now it counts it.
   --------------------------------------------------------------------------- */
.swarm-stats { display: flex; gap: 6px; flex-wrap: wrap; }
.swarm-stat {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  padding: 3px 7px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--text-dim);
}
.swarm-stat b { color: var(--cyan); }
.swarm-stat.ok b { color: var(--lime); }
.swarm-stat.bad { border-color: rgba(255, 85, 112, 0.35); }
.swarm-stat.bad b { color: var(--red); }

/* ---------------------------------------------------------------------------
   THE DOOR: no wallet, no console
   --------------------------------------------------------------------------- */
.gate {
  position: fixed;
  inset: 0;
  z-index: 95;
  display: grid;
  place-items: center;
  padding: 18px;
  background:
    radial-gradient(700px 420px at 50% 28%, rgba(255, 79, 216, 0.12), transparent 70%),
    rgba(3, 5, 10, 0.95);
  backdrop-filter: blur(7px);
}
.gate[hidden] { display: none; }
.gate-box {
  width: min(560px, 93vw);
  text-align: center;
  padding: 26px 26px 22px;
  border-radius: var(--radius);
  border: 1px solid var(--line-hot);
  border-top: 2px solid var(--magenta);
  background: linear-gradient(160deg, rgba(10, 16, 30, 0.98), rgba(14, 22, 40, 0.94));
  box-shadow: var(--shadow), 0 0 70px rgba(255, 79, 216, 0.14);
}
.gate-logo { height: 54px; width: auto; margin-bottom: 6px; }
.gate-box h2 {
  margin: 6px 0 10px;
  font-family: var(--mono);
  font-size: 17px;
  letter-spacing: 0.3em;
  color: #eaf7ff;
}
.gate-lead { margin: 0 0 15px; color: var(--text); font-size: 14px; }
.gate-list {
  margin: 0 auto 18px;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 7px;
  max-width: 440px;
}
.gate-list li { font-size: 13px; color: var(--text-dim); }
.gate-list b { color: var(--amber); }
.gate-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.gate-note {
  margin: 15px 0 0;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--text-dim);
}
.gate-note.ok { color: var(--lime); }
.gate-note.bad { color: var(--red); }

@media (max-width: 980px) {
  .vm-pop-box { height: 84vh; }
  .switch { font-size: 10px; }
}




