/* EELVIN command center — JARVIS design language.
   Deep black / midnight blue, electric cyan + ice-blue highlights,
   glowing thin technical lines, glass panels, circular HUD presence.
   The only gold on screen is the EELVIN wordmark (brand accent).
   Animations are transform/opacity only and honor reduced motion. */
/* NEVER REMOVE: app.js shows/hides whole views via the `hidden`
   property (.gate, .cc, .grid, ...), but the display:flex/grid rules
   on those classes override the UA's [hidden] rule — in v1.3 that
   left the SECURE LINK gate on screen forever and rendered the
   command center invisibly beneath it. This guard makes `hidden`
   always win. */
[hidden] { display: none !important; }
:root {
  --bg0: #02040a;
  --bg1: #050b14;
  --panel: rgba(8, 20, 32, 0.62);
  --panel-solid: #08131d;
  --panel-2: rgba(14, 32, 48, 0.72);
  --border: rgba(64, 200, 255, 0.28);
  --border-dim: rgba(64, 200, 255, 0.14);
  --cyan: #2fd8ff;
  --cyan-deep: #0e6d8c;
  --ice: #bfefff;
  --text: #dff4fb;
  --muted: #7e97a8;
  --gold: #c9a227;
  --green: #2fe6a8;
  --amber: #ffb648;
  --red: #ff5d5d;
  --radius: 10px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  min-height: 100vh;
  background:
    radial-gradient(1100px 650px at 50% 28%, rgba(14, 90, 128, 0.28) 0%, rgba(2, 4, 10, 0) 62%),
    linear-gradient(180deg, var(--bg1) 0%, var(--bg0) 100%);
  background-color: var(--bg0);
}
/* faint technical grid over the whole viewport */
body::before {
  content: ""; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    repeating-linear-gradient(0deg, rgba(64, 200, 255, 0.045) 0 1px, transparent 1px 44px),
    repeating-linear-gradient(90deg, rgba(64, 200, 255, 0.045) 0 1px, transparent 1px 44px);
}
/* ambient glow (v1.3.7 parity port): a slow-breathing light behind the
   panels, so the whole room feels alive — not just the presence */
body::after {
  content: ""; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background: radial-gradient(720px 460px at 50% 30%, rgba(47, 216, 255, 0.10) 0%, rgba(47, 216, 255, 0) 70%);
  animation: ambient-breathe 7s ease-in-out infinite;
}
@keyframes ambient-breathe {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 1; }
}
code { color: var(--cyan); font-size: 0.92em; }
.muted { color: var(--muted); }
.error-text { color: var(--red); }
.mono {
  font-family: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas,
    "Liberation Mono", monospace;
  font-variant-numeric: tabular-nums;
}
h2 { font-size: 1.02rem; letter-spacing: 0.14em; margin: 0.6rem 0; font-weight: 600; }

/* ---------- shared bits ---------- */
.btn-primary {
  background: linear-gradient(180deg, #3fe0ff, #12a8d4);
  color: #03202e; border: 1px solid rgba(140, 235, 255, 0.7);
  border-radius: 8px; padding: 0.62rem 1.15rem;
  font-size: 0.98rem; font-weight: 700; letter-spacing: 0.08em;
  cursor: pointer; box-shadow: 0 0 14px rgba(47, 216, 255, 0.35);
  transition: box-shadow 0.25s ease, transform 0.15s ease, opacity 0.25s ease;
}
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.5; cursor: wait; box-shadow: none; }
/* while a command runs, Send breathes instead of sitting dead (v1.3.7) */
#sendBtn:disabled { animation: send-working 1.5s ease-in-out infinite; }
.btn-ghost {
  background: rgba(8, 20, 32, 0.5); color: var(--muted);
  border: 1px solid var(--border-dim); border-radius: 8px;
  padding: 0.5rem 0.9rem; font-size: 0.88rem; cursor: pointer;
  letter-spacing: 0.06em;
  transition: color 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease, transform 0.15s ease;
}
.btn-ghost:hover { color: var(--ice); border-color: var(--cyan-deep); }
.btn-ghost:active { transform: scale(0.97); }
.btn-small { padding: 0.38rem 0.75rem; font-size: 0.8rem; }
.badge { display: inline-block; padding: 0.08rem 0.55rem; border-radius: 999px; font-size: 0.76rem; border: 1px solid; white-space: nowrap; }
.badge-ok { color: var(--green); border-color: rgba(47, 230, 168, 0.55); }
.badge-bad { color: var(--red); border-color: rgba(255, 93, 93, 0.55); }
.badge-dim { color: var(--muted); border-color: var(--border-dim); }
.card {
  background: var(--panel-2); border: 1px solid var(--border-dim);
  border-radius: var(--radius); padding: 0.9rem; margin-bottom: 0.9rem;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}
.card:hover {
  border-color: var(--border);
  box-shadow: 0 0 14px rgba(47, 216, 255, 0.08);
}
.card h3 { font-size: 0.92rem; margin: 0 0 0.5rem 0; letter-spacing: 0.08em; }
.kv { display: grid; grid-template-columns: 118px 1fr; gap: 0.25rem 0.8rem; font-size: 0.92rem; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-word; }
.card ul { margin: 0.3rem 0 0; padding-left: 1.1rem; }
.card pre {
  background: rgba(2, 6, 12, 0.8); border: 1px solid var(--border-dim);
  border-radius: 8px; padding: 0.7rem; overflow: auto;
  font-size: 0.8rem; max-height: 260px;
}
input[type="password"], input[type="text"], select, textarea {
  background: rgba(2, 8, 14, 0.85); color: var(--text);
  border: 1px solid var(--border-dim); border-radius: 8px;
  padding: 0.62rem 0.75rem; font-size: 1rem;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--cyan);
  box-shadow: 0 0 10px rgba(47, 216, 255, 0.35);
}
.panel {
  position: relative; z-index: 1;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 0.95rem;
  backdrop-filter: blur(9px); -webkit-backdrop-filter: blur(9px);
  box-shadow: 0 0 18px rgba(47, 216, 255, 0.06),
    inset 0 0 26px rgba(47, 216, 255, 0.045);
  overflow-y: auto; min-height: 0;
  /* panels rise in on boot, staggered by area (v1.3.7) */
  animation: panel-in 0.55s cubic-bezier(0.2, 0.7, 0.3, 1) both;
}
.panel-head, .panel-sub {
  display: flex; align-items: center; gap: 0.7rem;
  color: var(--cyan); font-size: 0.78rem; font-weight: 700;
  letter-spacing: 0.3em; margin-bottom: 0.8rem;
  font-family: ui-monospace, Menlo, Consolas, monospace;
}
.panel-head::after, .panel-sub::after {
  content: ""; flex: 1; height: 1px;
  background: linear-gradient(90deg, var(--border), transparent);
}
.panel-sub { margin-top: 1.1rem; color: var(--ice); opacity: 0.85; }

/* ---------- SECURE LINK lock screen ---------- */
.gate {
  position: relative; z-index: 1;
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; padding: 1.2rem;
}
.gate-inner { text-align: center; max-width: 430px; width: 100%; animation: panel-in 0.6s ease both; }
.gate-core { width: 118px; height: 118px; margin: 0 auto 0.4rem; display: block; }
.gate-core .g-ring { fill: none; stroke: var(--cyan-deep); stroke-width: 1.5; }
.gate-core .g-ticks { stroke: var(--cyan); stroke-width: 5; opacity: 0.7; stroke-dasharray: 2 10.93; }
.gate-core .g-arc { stroke: var(--cyan); stroke-width: 2.5; opacity: 0.9; stroke-dasharray: 300 127.2; }
.gate-core .g-disc {
  fill: rgba(10, 26, 40, 0.9); stroke: var(--cyan); stroke-width: 1;
  transform-box: fill-box; transform-origin: center;
  animation: core-pulse 3.4s ease-in-out infinite;
}
/* the gate's rings turn while it waits for the token (v1.3.7) */
.gate-core .g-ticks {
  transform-box: fill-box; transform-origin: center;
  animation: core-spin 46s linear infinite reverse;
}
.gate-core .g-arc {
  transform-box: fill-box; transform-origin: center;
  animation: core-spin 13s linear infinite;
}
.gate-core .g-letter { fill: var(--cyan); font-size: 44px; font-weight: 700; }
.gate-word { color: var(--gold); letter-spacing: 0.55em; text-indent: 0.55em; font-weight: 700; font-size: 1.05rem; }
.gate-title {
  margin: 0.5rem 0 0.4rem; font-size: 1.5rem; letter-spacing: 0.42em; text-indent: 0.42em;
  color: var(--ice); font-weight: 600;
  text-shadow: 0 0 16px rgba(47, 216, 255, 0.55);
}
.gate-sub { font-size: 0.92rem; line-height: 1.5; }
.gate-form { display: flex; flex-direction: column; gap: 0.65rem; margin-top: 1.1rem; }
.gate-form input {
  font-family: ui-monospace, Menlo, Consolas, monospace;
  text-align: center; letter-spacing: 0.18em; font-size: 1.05rem;
  border-color: var(--cyan-deep);
  box-shadow: 0 0 12px rgba(47, 216, 255, 0.18), inset 0 0 14px rgba(47, 216, 255, 0.05);
}
.gate-note { font-size: 0.8rem; margin-top: 1rem; line-height: 1.5; }

/* ---------- command center frame ---------- */
.cc { position: relative; z-index: 1; display: flex; flex-direction: column; height: 100dvh; }
.topstrip {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
  padding: 0.55rem 1rem;
  background: rgba(3, 8, 14, 0.88); border-bottom: 1px solid var(--border);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.brand { display: flex; align-items: baseline; gap: 0.65rem; }
.brand-name { color: var(--gold); letter-spacing: 0.34em; font-weight: 700; font-size: 1.08rem; }
.brand-sub { color: var(--cyan); letter-spacing: 0.3em; font-size: 0.68rem; font-weight: 600; }
.syschips { display: flex; gap: 0.45rem; flex-wrap: wrap; flex: 1; }
.chip {
  font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 0.72rem;
  letter-spacing: 0.12em; color: var(--muted);
  border: 1px solid var(--border-dim); border-radius: 999px; padding: 0.22rem 0.65rem;
  background: rgba(8, 20, 32, 0.55);
  transition: color 0.35s ease, border-color 0.35s ease, box-shadow 0.35s ease;
}
.chip.ok { color: var(--green); border-color: rgba(47, 230, 168, 0.45); box-shadow: 0 0 8px rgba(47, 230, 168, 0.14); }
.chip.warn { color: var(--amber); border-color: rgba(255, 182, 72, 0.45); }
.chip.bad { color: var(--red); border-color: rgba(255, 93, 93, 0.45); }
.clockbox { text-align: right; margin-left: auto; }
.clock { font-size: 1.12rem; color: var(--ice); letter-spacing: 0.14em; line-height: 1.1; }
.dateline { font-size: 0.68rem; color: var(--muted); letter-spacing: 0.24em; }

.grid {
  flex: 1; display: grid; gap: 14px; padding: 14px; min-height: 0;
  grid-template-columns: 1fr;
  grid-template-areas: "center" "left" "right";
}
.panel-left { grid-area: left; overflow-y: auto; min-height: 0; overscroll-behavior: contain; }
.panel-center { grid-area: center; display: flex; flex-direction: column; overflow: hidden; }
.panel-right { grid-area: right; display: flex; flex-direction: column; overflow: hidden; }
.panel-left { animation-delay: 0.05s; }
.panel-center { animation-delay: 0.13s; }
.panel-right { animation-delay: 0.21s; }
/* thin HUD scrollbars for the independently scrolling panels (v1.3.7) */
.panel, .transcript, .activity {
  scrollbar-width: thin; scrollbar-color: rgba(47, 216, 255, 0.3) transparent;
}
.panel::-webkit-scrollbar, .transcript::-webkit-scrollbar, .activity::-webkit-scrollbar { width: 7px; }
.panel::-webkit-scrollbar-thumb, .transcript::-webkit-scrollbar-thumb, .activity::-webkit-scrollbar-thumb {
  background: rgba(47, 216, 255, 0.22); border-radius: 4px;
}
.panel::-webkit-scrollbar-track, .transcript::-webkit-scrollbar-track, .activity::-webkit-scrollbar-track {
  background: transparent;
}

@media (min-width: 760px) {
  .grid {
    grid-template-columns: 272px minmax(0, 1fr);
    grid-template-areas: "left center" "right right";
  }
  .panel-right { max-height: 260px; }
}
@media (min-width: 1120px) {
  .grid {
    grid-template-columns: 300px minmax(0, 1fr) 330px;
    grid-template-areas: "left center right";
  }
  .panel-right { max-height: none; }
}

/* ---------- left: agent network ---------- */
.core-card { border-color: rgba(201, 162, 39, 0.4); }
.core-card .core-name {
  color: var(--gold); letter-spacing: 0.26em; font-weight: 700; font-size: 1rem;
}
.core-card .core-roles {
  color: var(--cyan); font-size: 0.72rem; letter-spacing: 0.22em; margin: 0.3rem 0 0.55rem;
  font-family: ui-monospace, Menlo, Consolas, monospace;
}
.core-state-line { font-size: 0.88rem; margin: 0.2rem 0 0.5rem; }
.tile-link { display: inline-block; text-decoration: none; margin-top: 0.35rem; }
.prov + .prov { border-top: 1px solid var(--border-dim); margin-top: 0.7rem; padding-top: 0.7rem; }
.prov-head { display: flex; align-items: center; justify-content: space-between; font-weight: 600; letter-spacing: 0.04em; }
.prov-count { margin: 0.35rem 0 0; color: var(--muted); font-size: 0.84rem; }
.model-list { list-style: none; margin: 0.4rem 0 0; padding: 0; }
.model-list li {
  padding: 0.28rem 0; border-top: 1px dashed var(--border-dim);
  font-size: 0.9rem; word-break: break-word;
}
.model-list li:first-child { border-top: none; }
.host-kv { grid-template-columns: 86px 1fr; font-size: 0.88rem; }

/* ---------- center: presence ---------- */
.presence-wrap { text-align: center; padding: 0.4rem 0 0.6rem; flex: 0 0 auto; }
/* density (v1.3.2): on shorter viewports (laptop screens with browser
   chrome) shrink the presence so the panels and transcript get the room */
@media (max-height: 860px) {
  .presence { width: 136px; height: 136px; margin: 0.15rem auto 0.4rem; }
  .presence-wrap { padding: 0.2rem 0 0.35rem; }
}
.presence {
  --pc: var(--cyan);
  --pc-dim: var(--cyan-deep);
  position: relative; width: 176px; height: 176px; margin: 0.3rem auto 0.55rem;
  filter: drop-shadow(0 0 14px rgba(47, 216, 255, 0.25));
  transition: filter 0.5s ease;
}
.presence.health-warn { --pc: var(--amber); --pc-dim: #8a5f16; }
.presence.health-bad { --pc: var(--red); --pc-dim: #7c2d2d; }
/* the glow follows the health tint, not just the rings (v1.3.7) */
.presence.health-warn { filter: drop-shadow(0 0 14px rgba(255, 182, 72, 0.30)); }
.presence.health-bad { filter: drop-shadow(0 0 14px rgba(255, 93, 93, 0.32)); }
.presence-svg {
  width: 100%; height: 100%; display: block; overflow: visible; position: relative; z-index: 2;
  animation: svg-breathe 5.6s ease-in-out infinite;
}
.presence .ring { fill: none; stroke: var(--pc-dim); stroke-width: 1.5; }
.presence .ring-outer { opacity: 0.6; }
.presence .ring-ticks { stroke: var(--pc); stroke-width: 5; opacity: 0.75; stroke-dasharray: 2 10; }
.presence .ring-mid { stroke: var(--pc); stroke-width: 2.5; opacity: 0.9; stroke-dasharray: 300 139.8; }
.presence .ring-inner { stroke: var(--pc); opacity: 0.8; }
.presence .presence-disc {
  fill: rgba(8, 22, 36, 0.92); stroke: var(--pc); stroke-width: 1;
  transform-box: fill-box; transform-origin: center;
  animation: core-pulse 3.8s ease-in-out infinite;
}
.presence .presence-letter { fill: var(--pc); font-size: 44px; font-weight: 700; }
/* The Producer face (v1.4.2): head-only state faces over the disc,
   inside the rings — sized to the disc (r46 of the 200 viewBox) */
.presence-face {
  position: absolute; left: 50%; top: 50%; z-index: 3;
  width: 46%; height: 46%; transform: translate(-50%, -50%);
  border-radius: 50%; pointer-events: none;
}
.hero-banner { flex: 0 0 auto; margin-bottom: 0.35rem; }
.hero-banner img {
  width: 100%; height: 92px; display: block; object-fit: cover;
  object-position: center 28%; border-radius: 10px;
}
.presence .spin { transform-box: fill-box; transform-origin: center; animation: core-spin 48s linear infinite; }
.presence .spin-rev { animation-duration: 30s; animation-direction: reverse; }
.presence .sweep {
  position: absolute; inset: 5%; z-index: 1; border-radius: 50%;
  background: conic-gradient(from 0deg, rgba(47, 216, 255, 0.32), rgba(47, 216, 255, 0) 24%);
  animation: core-spin 11s linear infinite; opacity: 0.55;
}
.presence .ping {
  position: absolute; inset: 9%; z-index: 0; border-radius: 50%;
  border: 1px solid var(--pc); opacity: 0; pointer-events: none;
}
/* ambient halo (v1.3.7): a slow ring breathes out of the presence in
   every live state — quickens while processing/working, still when
   offline/boot, so idle no longer reads as frozen */
.presence .halo {
  position: absolute; inset: 1%; z-index: 0; border-radius: 50%;
  border: 1px solid var(--pc); opacity: 0; pointer-events: none;
  animation: halo-breathe 4.8s ease-out infinite;
}
.presence[data-state="thinking"] .halo { animation-duration: 2.1s; }
.presence[data-state="working"] .halo { animation-duration: 2.8s; }
.presence[data-state="offline"] .halo,
.presence[data-state="boot"] .halo { animation: none; opacity: 0; }
@keyframes core-spin { to { transform: rotate(360deg); } }
@keyframes core-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.045); opacity: 0.88; }
}
@keyframes ping-out {
  0% { transform: scale(0.82); opacity: 0.65; }
  100% { transform: scale(1.12); opacity: 0; }
}
@keyframes wave-bar {
  from { transform: scaleY(0.18); }
  to { transform: scaleY(1); }
}
/* ---- v1.3.7 parity-port motion: entrances + ambient life ---- */
@keyframes halo-breathe {
  0% { transform: scale(0.86); opacity: 0.5; }
  100% { transform: scale(1.16); opacity: 0; }
}
@keyframes svg-breathe {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.018); }
}
@keyframes panel-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes msg-in {
  from { opacity: 0; transform: translateY(6px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes event-in {
  from { opacity: 0; transform: translateX(10px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes pending-pulse {
  0%, 100% { opacity: 0.45; }
  50% { opacity: 1; }
}
@keyframes send-working {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 0.9; }
}
@keyframes state-flip {
  0% { opacity: 0; transform: translateY(5px); }
  100% { opacity: 1; transform: translateY(0); }
}
/* presence states — driven by real app events (see app.js) */
.presence[data-state="listening"] .ping-1 { animation: ping-out 1.5s ease-out infinite; }
.presence[data-state="listening"] .ping-2 { animation: ping-out 1.5s ease-out 0.75s infinite; }
.presence[data-state="listening"] .presence-disc { animation-duration: 1.4s; }
.presence[data-state="listening"] .sweep { animation-duration: 4.5s; opacity: 0.9; }
.presence[data-state="thinking"] .spin { animation-duration: 6.5s; }
.presence[data-state="thinking"] .spin-rev { animation-duration: 4.5s; }
.presence[data-state="thinking"] .sweep { animation-duration: 2.6s; opacity: 1; }
.presence[data-state="thinking"] .presence-disc { animation-duration: 1.05s; }
.presence[data-state="speaking"] .presence-disc { animation-duration: 2.1s; }
.presence[data-state="working"] .ring-ticks { animation: core-spin 3.2s linear infinite; transform-box: fill-box; transform-origin: center; }
.presence[data-state="offline"] .spin,
.presence[data-state="offline"] .sweep { animation-duration: 110s; }
.presence[data-state="offline"] .presence-disc { animation: none; opacity: 0.5; }
.presence[data-state="boot"] { --pc: var(--muted); --pc-dim: #33505f; }
/* PROCESSING gets its own hue (GFX audit §2.5): a violet shift while
   EELVIN is thinking — amber/red stay reserved for health, and a
   bad-health red is never masked by the processing color. */
.presence[data-state="thinking"]:not(.health-bad) { --pc: #b18cff; --pc-dim: #463a6e; }
.wave {
  position: absolute; left: 50%; bottom: 15%; transform: translateX(-50%);
  z-index: 3; display: flex; gap: 4px; align-items: center; height: 24px;
  opacity: 0; transition: opacity 0.3s ease;
}
.wave span {
  width: 3px; height: 22px; border-radius: 2px; background: var(--pc);
  transform-origin: center; transform: scaleY(0.18);
}
.presence[data-state="listening"] .wave,
.presence[data-state="speaking"] .wave { opacity: 1; }
.presence[data-state="listening"] .wave span,
.presence[data-state="speaking"] .wave span { animation: wave-bar 0.55s ease-in-out infinite alternate; }
/* while processing, the wave breathes faintly under the disc (v1.3.7) */
.presence[data-state="thinking"] .wave { opacity: 0.5; }
.presence[data-state="thinking"] .wave span { animation: wave-bar 0.95s ease-in-out infinite alternate; }
.wave span:nth-child(2) { animation-delay: 0.09s !important; }
.wave span:nth-child(3) { animation-delay: 0.18s !important; }
.wave span:nth-child(4) { animation-delay: 0.27s !important; }
.wave span:nth-child(5) { animation-delay: 0.36s !important; }
.wave span:nth-child(6) { animation-delay: 0.45s !important; }
.wave span:nth-child(7) { animation-delay: 0.54s !important; }
.presence-state {
  letter-spacing: 0.34em; text-indent: 0.34em;
  font-size: 0.95rem; font-weight: 700; color: var(--ice);
  text-shadow: 0 0 12px rgba(47, 216, 255, 0.45);
}
/* re-triggered by app.js on every real state change (v1.3.7) */
.state-flip { animation: state-flip 0.45s ease; }
.presence-sub { font-size: 0.84rem; margin-top: 0.25rem; }
.presence-updated { color: var(--muted); font-size: 0.72rem; margin-top: 0.3rem; letter-spacing: 0.14em; }

/* ---------- center: transcript ---------- */
.transcript {
  flex: 1; overflow-y: auto; min-height: 120px; overscroll-behavior: contain;
  display: flex; flex-direction: column; gap: 0.6rem;
  padding: 0.7rem 0.2rem 0.4rem; border-top: 1px solid var(--border-dim);
}
.msg {
  max-width: 88%; padding: 0.62rem 0.85rem; border-radius: var(--radius);
  white-space: pre-wrap; word-wrap: break-word; line-height: 1.45; font-size: 0.95rem;
  animation: msg-in 0.35s ease both;
}
/* the pending bubble breathes while the model generates (v1.3.7) */
.msg-pending {
  animation: msg-in 0.35s ease both, pending-pulse 1.25s ease-in-out 0.35s infinite;
}
.msg-user { align-self: flex-end; background: rgba(16, 44, 64, 0.85); border: 1px solid var(--cyan-deep); }
.msg-assistant { align-self: flex-start; background: rgba(6, 16, 26, 0.85); border: 1px solid var(--border-dim); }
.msg-system { align-self: center; color: var(--muted); font-size: 0.84rem; text-align: center; max-width: 95%; }
.msg-error { align-self: center; background: rgba(50, 14, 14, 0.85); border: 1px solid var(--red); color: #f3c1c1; font-size: 0.9rem; }
.msg-meta { display: block; margin-top: 0.45rem; color: var(--muted); font-size: 0.76rem; }

/* ---------- always-learning capture (v1.4.4) ---------- */
.capture-top { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
.capture-ctx { font-size: 0.78rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.capture-stats { display: flex; gap: 0.9rem; flex-wrap: wrap; font-size: 0.78rem; color: var(--muted); margin-top: 0.45rem; }
.capture-stats b { color: var(--ice); font-weight: 600; }
.capture-btns { display: flex; gap: 0.45rem; margin-top: 0.55rem; flex-wrap: wrap; }

/* ---------- right: activity ---------- */
.activity { flex: 1; overflow-y: auto; min-height: 0; overscroll-behavior: contain; display: flex; flex-direction: column; gap: 0.42rem; }
.event {
  display: flex; gap: 0.55rem; font-size: 0.8rem; line-height: 1.4;
  padding: 0.34rem 0.5rem; border-left: 2px solid var(--border-dim);
  background: rgba(4, 12, 20, 0.5); border-radius: 0 6px 6px 0;
  word-break: break-word;
  animation: event-in 0.4s ease both;
}
.event-time { color: var(--muted); flex: 0 0 auto; font-size: 0.74rem; padding-top: 0.08rem; }
.event-ok { border-left-color: var(--green); }
.event-warn { border-left-color: var(--amber); }
.event-error { border-left-color: var(--red); }
.event-cmd { border-left-color: var(--cyan); }
.event-reply { border-left-color: var(--ice); }
.event-boot { border-left-color: var(--gold); }

/* ---------- systems view ---------- */
.view-systems {
  position: relative; z-index: 1; flex: 1; width: 100%; max-width: 880px;
  margin: 0 auto; padding: 1rem;
}
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; flex-wrap: wrap; }
.row-actions { display: flex; gap: 0.5rem; }
.danger-zone { margin-top: 1.4rem; border-top: 1px solid var(--border-dim); padding-top: 1rem; }

/* ---------- bottom: command bar ---------- */
.commandbar {
  position: sticky; bottom: 0; z-index: 30;
  padding: 0.65rem 1rem calc(0.65rem + env(safe-area-inset-bottom));
  background: rgba(3, 8, 14, 0.92); border-top: 1px solid var(--border);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.command-form { display: flex; gap: 0.55rem; align-items: center; flex-wrap: wrap; }
.command-form select { flex: 0 1 210px; min-width: 130px; font-size: 0.9rem; }
.command-form input[type="text"] {
  flex: 1 1 180px; font-size: 1rem;
  border-color: var(--cyan-deep);
  box-shadow: inset 0 0 14px rgba(47, 216, 255, 0.05);
}
.btn-mic {
  flex: 0 0 auto; width: 44px; height: 44px; border-radius: 50%;
  background: rgba(8, 20, 32, 0.8); color: var(--cyan);
  border: 1px solid var(--cyan-deep); font-size: 0.85rem; cursor: pointer;
}
.btn-mic.listening {
  background: var(--cyan); color: #03202e;
  box-shadow: 0 0 16px rgba(47, 216, 255, 0.6);
  animation: core-pulse 1.15s ease-in-out infinite;
}
.voice-toggle {
  display: inline-flex; align-items: center; gap: 0.4rem;
  color: var(--muted); font-size: 0.74rem; letter-spacing: 0.14em; cursor: pointer;
  font-family: ui-monospace, Menlo, Consolas, monospace; white-space: nowrap;
}
.voice-toggle input { accent-color: var(--cyan); width: 16px; height: 16px; }
.picker-note { font-size: 0.82rem; min-height: 0; margin: 0.35rem 0 0; }
/* contextual notes only (§6.6): an empty note takes no space at all */
.picker-note:empty { display: none; }
/* agent roster + usage (v1.3.9, GFX audit §2.9 / §4.6) */
.agent-list { list-style: none; margin: 0.25rem 0 0; padding: 0; }
.agent-list li { padding: 0.28rem 0; border-bottom: 1px solid rgba(47, 216, 255, 0.08); }
.agent-list .a-name { color: var(--ice); font-size: 0.86rem; }
.agent-list .a-meta { color: var(--muted); font-size: 0.76rem; }
.sync-note { font-size: 0.74rem; margin-top: 0.4rem; }
/* stack bar + chips (v1.3.3) */
.stack-bar {
  display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap;
  margin-top: 0.5rem;
}
.stack-label { color: var(--ice); font-size: 0.78rem; letter-spacing: 0.14em; }
.stack-chips { display: inline-flex; gap: 0.4rem; flex-wrap: wrap; align-items: center; }
.stack-chip {
  display: inline-flex; align-items: center; gap: 0.35rem;
  border: 1px solid var(--border-dim); border-radius: 999px;
  padding: 0.14rem 0.4rem 0.14rem 0.6rem; font-size: 0.8rem; color: var(--ice);
  background: var(--surface-muted, rgba(47, 216, 255, 0.06));
  animation: msg-in 0.3s ease both;
}
.stack-chip button {
  background: none; border: none; color: inherit; cursor: pointer;
  font-size: 0.95rem; line-height: 1; padding: 0 0.1rem;
}
#stackToggle.active { border-color: var(--cyan); color: var(--cyan); }

@media (min-width: 700px) {
  .presence { width: 188px; height: 188px; }
}

@media (prefers-reduced-motion: reduce) {
  .presence .spin, .presence .sweep, .presence .presence-disc,
  .presence .ping, .presence .wave span, .gate-core .g-disc,
  .btn-mic.listening, .presence[data-state="working"] .ring-ticks {
    animation: none;
  }
  /* v1.3.7 additions honor reduced motion too: no ambient breathing,
     no entrances, no pulses — state still reads from color + labels */
  body::after, .presence .halo, .presence-svg, .gate-core .g-arc,
  .gate-core .g-ticks, #sendBtn:disabled, .msg-pending {
    animation: none;
  }
  .panel, .gate-inner, .msg, .event, .stack-chip, .state-flip {
    animation: none;
  }
  .presence[data-state="listening"] .wave,
  .presence[data-state="speaking"] .wave { opacity: 1; }
  .wave span { transform: scaleY(0.6); }
}
