/* Hub Central-Visual · dark theme (SPEC §9). Sizes in rem so TV mode can scale everything. */

:root {
  --bg: #0e1220;
  --bg-2: #0b1020;
  --panel: rgba(14, 19, 34, 0.86);
  --panel-solid: #121829;
  --panel-2: #161e33;
  --line: #232c42;
  --line-2: #2e3a57;
  --text: #e6eaf2;
  --muted: #9aa3b2;
  --faint: #848da0; /* v1.0: was #6b7489 (3.5:1); now ≥ 4.97:1 on every panel */
  --focus: #9cc2ff;
  --accent: #6ca0ff;
  --amber: #ffb224;
  --red: #e5484d;
  --green: #3ddc97;
  --thinking: #a9b6d3;
  --radius: 0.625rem;
  --shadow: 0 0.5rem 2rem rgba(0, 0, 0, 0.45);
  --row-h: 3rem;
  --nav-h: 2.5rem;
  --topbar-h: calc(var(--row-h) + var(--nav-h));
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --gap: 0.5rem;
  --proj-w: 20rem; /* "Projetos" panel (left) */
  --insp-w: 22.5rem;
  --font: system-ui, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
  color-scheme: dark;
}

html.tv { font-size: 150%; --font-scale: 1.6; --topbar-h: var(--row-h); }

*, *::before, *::after { box-sizing: border-box; }

html, body { margin: 0; height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font: 0.875rem/1.4 var(--font);
  -webkit-font-smoothing: antialiased;
}

body.hub { overflow: hidden; }

button { font: inherit; color: inherit; }

a { color: var(--accent); }

[hidden] { display: none !important; }

kbd {
  display: inline-block;
  min-width: 1.2em;
  padding: 0 0.3em;
  border: 1px solid var(--line-2);
  border-bottom-width: 2px;
  border-radius: 0.25rem;
  background: var(--panel-2);
  color: var(--muted);
  font: 600 0.7rem/1.4 var(--mono);
  text-align: center;
}

.muted { color: var(--muted); }
.small { font-size: 0.75rem; }
.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* Focus ring: thick, light and haloed so it also shows over the 3D scene and the plaques. */
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; box-shadow: 0 0 0 5px rgba(11, 16, 32, 0.85); }
.palette-search:focus-within { box-shadow: inset 0 -2px 0 var(--focus); }

/* ---- state symbols (never color-only: always paired with text) ---- */
.sym {
  display: inline-grid;
  place-items: center;
  width: 1.15rem;
  height: 1.15rem;
  margin-right: 0.35rem;
  border-radius: 50%;
  background: var(--panel-2);
  font-size: 0.7rem;
  font-weight: 800;
  line-height: 1;
  flex: none;
}
.s-working { color: var(--green); }
.s-thinking { color: var(--thinking); }
.s-waiting { color: #0b1020; background: var(--amber); }
.s-error { color: #fff; background: var(--red); }
.s-idle { color: var(--muted); }
.s-empty { color: var(--faint); }

/* ---- 3D canvas and label layer ---- */
.app { position: fixed; inset: 0; }
.app canvas { display: block; width: 100%; height: 100%; outline: none; }

.labels-host { position: fixed; inset: 0; pointer-events: none; z-index: 1; overflow: hidden; }
.labels-layer { position: absolute; inset: 0 auto auto 0; pointer-events: none; }

.plaque {
  --dept: #6f6e77;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  max-width: 15rem;
  padding: 0.25rem 0.5rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-left: 0.2rem solid var(--dept);
  border-radius: 0.375rem;
  background: rgba(11, 16, 32, 0.84);
  color: var(--text);
  font-size: 0.75rem;
  white-space: nowrap;
  pointer-events: auto;
  cursor: pointer;
  box-shadow: 0 0.25rem 1rem rgba(0, 0, 0, 0.35);
}
.plaque:hover { border-color: rgba(255, 255, 255, 0.25); border-left-color: var(--dept); }
.plaque-head { display: flex; align-items: center; gap: 0.35rem; }
.plaque-sym {
  display: inline-grid;
  place-items: center;
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  background: #252d43;
  color: var(--faint);
  font-size: 0.625rem;
  font-weight: 800;
  flex: none;
}
.plaque-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.plaque-count { font-weight: 800; }
.plaque-count:not(:empty)::before { content: "· "; font-weight: 400; color: var(--muted); }
.plaque-over { color: var(--amber); font-weight: 700; }
.plaque-note { color: var(--muted); font-size: 0.6875rem; white-space: normal; }
.plaque[data-state="working"] .plaque-sym { background: var(--dept); color: #fff; }
.plaque[data-state="thinking"] .plaque-sym { background: #3a4767; color: var(--thinking); }
.plaque[data-state="idle"] .plaque-sym { background: #2b3348; color: var(--muted); }
.plaque[data-state="waiting"] { border-color: var(--amber); border-left-color: var(--amber); animation: plaque-pulse 1s ease-in-out infinite alternate; }
.plaque[data-state="waiting"] .plaque-sym { background: var(--amber); color: #0b1020; }
.plaque--covered:not(.is-occupied) { background: rgba(26, 30, 40, 0.8); color: var(--muted); }
.plaque--empty { border-style: dashed; border-left-style: solid; background: rgba(11, 16, 32, 0.7); color: var(--muted); }
.plaque--empty .plaque-sym { display: none; }
.plaque.is-selected { outline: 2px solid #fff; outline-offset: 1px; }

@keyframes plaque-pulse {
  from { box-shadow: 0 0 0 0 rgba(255, 178, 36, 0.15); }
  to { box-shadow: 0 0 0.9rem 0.15rem rgba(255, 178, 36, 0.55); }
}

.wing-sign {
  --dept: #6f6e77;
  min-width: 9rem;
  padding: 0.35rem 0.7rem;
  border-top: 0.2rem solid var(--dept);
  border-radius: 0.5rem;
  background: rgba(11, 16, 32, 0.9);
  text-align: center;
  white-space: nowrap;
  pointer-events: auto;
  cursor: pointer;
  box-shadow: var(--shadow);
}
.wing-sign-head { display: flex; gap: 0.4rem; align-items: baseline; justify-content: center; }
.wing-sign-key { font-weight: 800; font-size: 0.9rem; color: color-mix(in srgb, var(--dept) 70%, #fff); }
.wing-sign-name { font-size: 0.75rem; color: var(--text); }
.wing-sign-counts { font-size: 0.6875rem; color: var(--muted); }
.wing-sign-counts.has-waiting { color: var(--amber); font-weight: 700; }
/* Far away (overview, telão view): shrink to a chip so the signs don't crowd the hall. */
.wing-sign.is-compact { min-width: 0; padding: 0.15rem 0.45rem; border-top-width: 0.15rem; }
.wing-sign.is-compact .wing-sign-name,
.wing-sign.is-compact .wing-sign-counts:not(.has-waiting) { display: none; }
.wing-sign.is-compact .wing-sign-counts.has-waiting { font-size: 0.625rem; }
/* Wing view: the framed wing's sign hangs below its anchor, toward the camera, clear of the plaques. */
.wing-sign.is-below { border-top-width: 0; border-bottom: 0.15rem solid var(--dept); opacity: 0.92; }
body.is-flying .plaque, body.is-flying .wing-sign { pointer-events: none; }

.object-label {
  padding: 0.1rem 0.4rem;
  border-radius: 0.25rem;
  background: rgba(11, 16, 32, 0.72);
  color: var(--muted);
  font-size: 0.6875rem;
  white-space: nowrap;
}

.wb-title {
  max-width: 11rem;
  padding: 0.1rem 0.4rem;
  border-radius: 0.2rem;
  background: #eef1f6;
  color: #0b1020;
  font-size: 0.6875rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---- top bar: status row + navigation row ---- */
.topbar {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  height: var(--topbar-h);
  background: rgba(11, 16, 32, 0.88);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px);
}
.topbar-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  height: var(--row-h);
  padding: 0 0.75rem;
  min-width: 0;
}
.navbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  height: var(--nav-h);
  padding: 0 0.75rem 0.35rem;
  min-width: 0;
}
.nav-search {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  width: 15rem;
  flex: none;
  height: 1.95rem;
  padding: 0 0.45rem 0 0.6rem;
  border: 1px solid var(--line-2);
  border-radius: 0.5rem;
  background: rgba(22, 30, 51, 0.9);
  color: var(--muted);
  font-size: 0.82rem;
  cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s;
}
.nav-search:hover, .nav-search[aria-expanded="true"] { border-color: var(--accent); color: var(--text); background: rgba(108, 160, 255, 0.1); }
.nav-search-icon { font-size: 1rem; line-height: 1; color: var(--accent); }
.nav-search-text { flex: 1; text-align: left; font-weight: 600; color: var(--text); }

.crumbs { flex: 1; min-width: 0; }
.crumbs ol { display: flex; align-items: center; gap: 0; margin: 0; padding: 0; list-style: none; min-width: 0; overflow: hidden; }
.crumb { display: flex; align-items: center; min-width: 0; white-space: nowrap; font-size: 0.82rem; }
.crumb + .crumb::before { content: "›"; margin: 0 0.4rem; color: var(--faint); font-weight: 700; }
.crumb-btn, .crumb-here {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0.15rem 0.35rem;
  border: 1px solid transparent;
  border-radius: 0.35rem;
  background: none;
  color: var(--muted);
}
.crumb-btn { cursor: pointer; }
.crumb-btn:hover { color: var(--text); border-color: var(--line-2); background: var(--panel-2); }
.crumb-here { color: var(--text); font-weight: 600; }
.crumb--dept .crumb-btn, .crumb--dept .crumb-here { color: color-mix(in srgb, var(--dept) 72%, #fff); font-weight: 800; letter-spacing: 0.02em; }
.crumb.crumb-tag::before { content: none; }
.crumb-tag {
  margin-left: 0.5rem;
  padding: 0.05rem 0.45rem;
  border: 1px solid rgba(108, 160, 255, 0.5);
  border-radius: 999px;
  color: var(--accent);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.crumbs li:last-child { animation: crumb-in 0.25s var(--ease); }
@keyframes crumb-in { from { opacity: 0; translate: -0.3rem 0; } }

.view-tools { display: flex; gap: 0.3rem; flex: none; }
.group-count { font-variant-numeric: tabular-nums; }
.group-mode { color: var(--muted); font-size: 0.72rem; }
#btn-group[aria-pressed="true"] .group-mode { color: var(--text); }
body.is-flying #btn-fly { background: rgba(108, 160, 255, 0.28); border-color: var(--accent); }
.brand { display: flex; align-items: center; gap: 0.5rem; min-width: 0; flex: none; }
.brand-mark { width: 1.5rem; height: 1.5rem; flex: none; }
.brand h1 { margin: 0; font-size: 0.95rem; font-weight: 700; white-space: nowrap; }
.brand-sub { color: var(--muted); font-weight: 500; }

.counters { display: flex; gap: 0.35rem; margin: 0; padding: 0; list-style: none; min-width: 0; overflow: hidden; }
.counter {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-2);
  white-space: nowrap;
}
.counter b { font-variant-numeric: tabular-nums; }
.counter-sym { color: var(--muted); font-weight: 800; font-size: 0.75rem; }
.counter-label { color: var(--muted); font-size: 0.75rem; }
.counter--warn.is-active { border-color: var(--amber); background: rgba(255, 178, 36, 0.14); }
.counter--warn.is-active .counter-sym, .counter--warn.is-active b { color: var(--amber); }
.counter--err .counter-sym { color: var(--red); }

.status { display: flex; align-items: center; gap: 0.6rem; margin-left: auto; white-space: nowrap; }
.badge {
  padding: 0.1rem 0.5rem;
  border-radius: 0.3rem;
  background: var(--panel-2);
  border: 1px solid var(--line-2);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.05em;
}
.badge[data-mode="live"] { color: #ff8f93; border-color: rgba(229, 72, 77, 0.6); }
.badge[data-mode="live"]::before { content: "● "; }
.badge[data-mode="demo"] { color: #c7b2ff; border-color: rgba(179, 146, 240, 0.6); }
.conn { display: inline-flex; align-items: center; gap: 0.3rem; color: var(--muted); font-size: 0.75rem; }
.conn-dot { width: 0.55rem; height: 0.55rem; border-radius: 50%; background: var(--red); }
.conn[data-state="on"] .conn-dot { background: var(--green); }
.conn[data-state="off"] .conn-dot { animation: blink 1s steps(2, start) infinite; }
.clock { font-variant-numeric: tabular-nums; color: var(--text); font-weight: 600; }

.actions { display: flex; gap: 0.3rem; }
.actions button, .view-tools button, .icon-btn, .chip, .legend-dept, .btn {
  border: 1px solid var(--line-2);
  border-radius: 0.4rem;
  background: var(--panel-2);
  cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s;
}
.actions button, .view-tools button { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.3rem 0.55rem; font-size: 0.8rem; white-space: nowrap; }
.view-tools button { height: 1.95rem; }
.actions button:hover, .view-tools button:hover, .icon-btn:hover, .chip:hover, .legend-dept:hover, .btn:hover:not(:disabled) { border-color: var(--accent); }
.actions button[aria-pressed="true"], .view-tools button[aria-pressed="true"] { background: rgba(108, 160, 255, 0.18); border-color: var(--accent); }
.btn { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.3rem 0.65rem; font-size: 0.8rem; font-weight: 600; white-space: nowrap; }
.btn:disabled { opacity: 0.45; cursor: default; }

@keyframes blink { to { visibility: hidden; } }

/* ---- panels ---- */
.panel {
  position: fixed;
  z-index: 10;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  overflow: hidden;
}
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; padding: 0.55rem 0.75rem; border-bottom: 1px solid var(--line); }
.panel-head h2 { margin: 0; font-size: 0.9rem; font-weight: 700; overflow-wrap: anywhere; }
.icon-btn { width: 1.75rem; height: 1.75rem; display: grid; place-items: center; padding: 0; font-size: 1.1rem; line-height: 1; flex: none; }

/* "Projetos" panel (owner request 10/11/2026, revised): one card per project with its business result
   (central `perf`, ui/perf.js), the ones with failures first. Every status has a symbol, never color only. */
.projects { top: calc(var(--topbar-h) + var(--gap)); left: var(--gap); bottom: 6.5rem; width: var(--proj-w); }
.chips { display: flex; flex-wrap: wrap; gap: 0.25rem; padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--line); }
.chip { --dept: var(--line-2); padding: 0.1rem 0.45rem; font-size: 0.7rem; font-weight: 700; border-left: 0.2rem solid var(--dept); }
.chip[aria-pressed="true"] { background: color-mix(in srgb, var(--dept) 30%, var(--panel-2)); border-color: var(--dept); color: #fff; }
.proj-list {
  flex: 1;
  min-height: 0;
  margin: 0;
  padding: 0.35rem;
  display: grid;
  align-content: start;
  gap: 0.3rem;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  list-style: none;
}
.projects .empty-note.is-local { padding: 0.45rem 0.75rem; border-bottom: 1px solid var(--line); font-size: 0.75rem; }
.pcard-item { min-width: 0; }
.pcard {
  --dept: #6f6e77;
  display: grid;
  gap: 0.1rem;
  width: 100%;
  min-width: 0;
  padding: 0.4rem 0.55rem;
  border: 1px solid var(--line);
  border-left: 0.25rem solid var(--dept);
  border-radius: 0.4rem;
  background: rgba(22, 30, 51, 0.55);
  color: var(--text);
  font-size: 0.76rem;
  line-height: 1.35;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s;
}
.pcard:hover { border-color: var(--accent); border-left-color: var(--dept); background: var(--panel-2); }
.pcard.is-falha { border-color: #ff6b70; border-left-color: var(--dept); box-shadow: inset 0 0 0 1px #ff6b70; background: rgba(229, 72, 77, 0.08); }
.pcard.is-atencao { border-color: var(--amber); border-left-color: var(--dept); box-shadow: inset 0 0 0 1px var(--amber); }
.pcard.is-down { border-color: #ff6b70; border-left-color: var(--dept); box-shadow: inset 0 0 0 1px #ff6b70; }
.pcard.is-selected { background: rgba(108, 160, 255, 0.14); border-color: rgba(108, 160, 255, 0.7); border-left-color: var(--dept); }
.pcard.is-stale, .pcard.is-none { background: transparent; }
.pcard.is-none .pcard-name { color: #c3cad8; }
.pcard-head { display: flex; align-items: center; gap: 0.35rem; min-width: 0; }
.pchip { flex: none; padding: 0 0.3rem; border-radius: 0.25rem; background: var(--dept); color: #fff; font-weight: 800; font-size: 0.64rem; line-height: 1.45; letter-spacing: 0.02em; }
.pchip.is-light { color: #0b1020; }
.pcard-name { flex: 1; min-width: 0; font-weight: 700; font-size: 0.84rem; overflow-wrap: anywhere; }
.pcard .lamp { flex: none; margin-left: 0; }
.pcard-line { display: block; min-width: 0; color: var(--muted); overflow-wrap: anywhere; }
.pcard-sym { font-weight: 800; }
/* status of the system's result: ✓ funcionando · ! atenção · ✕ com falha · — sem dados */
.pcard-status { font-weight: 700; }
.pcard-status.is-ok .pcard-sym, .pcard-status.is-ok .pcard-status-text { color: var(--green); }
.pcard-status.is-atencao .pcard-sym, .pcard-status.is-atencao .pcard-status-text { color: var(--amber); }
.pcard-status.is-falha .pcard-sym, .pcard-status.is-falha .pcard-status-text { color: #ff8f93; }
.pcard-upd { font-weight: 400; }
.pcard-noperf { color: var(--faint); font-style: italic; }
/* ★ primary KPI (big), its target, up to 2 secondary KPIs */
.pcard-kpi { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 0.35rem; min-width: 0; margin-top: 0.1rem; }
.pcard-star { color: var(--amber); font-weight: 800; }
.pcard-big { font-size: 1.3rem; font-weight: 800; line-height: 1.15; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.pcard-kpi-label { min-width: 0; color: var(--muted); font-size: 0.74rem; overflow-wrap: anywhere; }
.pcard-target, .pcard-sec { font-size: 0.72rem; }
.pcard-arrow, .pcard-ksym { font-weight: 800; }
.pcard-arrow { color: var(--text); }
.pcard-target.is-atencao { color: var(--amber); }
.pcard-target.is-falha { color: #ff8f93; }
.pcard-ksym.is-ok { color: var(--green); }
.pcard-ksym.is-atencao { color: var(--amber); }
.pcard-ksym.is-falha { color: #ff8f93; }
/* problems: "✕ 2 problemas", then up to 2 "✕ Falha na geração (2) · há 5 min" */
.pcard-problems { display: grid; min-width: 0; }
.pcard-phead, .pcard-problem { font-size: 0.74rem; }
.pcard-phead { font-weight: 700; }
.pcard-phead.is-falha, .pcard-problem.is-falha { color: #ff8f93; }
.pcard-phead.is-atencao, .pcard-problem.is-atencao { color: var(--amber); }
.pcard-problem.is-falha { font-weight: 600; }
.pcard-alert { color: #ff8f93; font-weight: 700; }
.pcard-cost.is-warn { color: var(--amber); font-weight: 700; }
.pcard-cost.is-over { color: #ff6b70; font-weight: 700; }
.pcard-goal { color: var(--green); font-weight: 700; }
.pcard-goal.is-stale { color: var(--muted); }
/* stale data: everything grey; the "— sem dados · dados de hh:mm" line says why */
.pcard.is-stale .pcard-big, .pcard.is-stale .pcard-star, .pcard.is-stale .pcard-arrow, .pcard.is-stale .pcard-ksym,
.pcard.is-stale .pcard-target, .pcard.is-stale .pcard-phead, .pcard.is-stale .pcard-problem { color: var(--muted); }

/* room inspector: "Desempenho" first (central `perf`), "Agentes e atividade" collapsed below */
.insp-section.insp-perf { margin-top: 0; }
.psym { font-weight: 800; }
.perf-status { margin: 0 0 0.45rem; padding: 0.45rem 0.6rem; border-radius: 0.4rem; background: var(--panel-2); overflow-wrap: anywhere; }
.perf-status.is-ok .psym, .perf-status.is-ok b { color: var(--green); }
.perf-status.is-atencao .psym, .perf-status.is-atencao b { color: var(--amber); }
.perf-status.is-falha .psym, .perf-status.is-falha b { color: #ff8f93; }
.perf-status.is-sem-dados { color: var(--muted); }
.perf-upd { color: var(--muted); }
.perf-objective { margin: 0 0 0.5rem; font-size: 0.8rem; overflow-wrap: anywhere; }
.perf-kpis, .perf-problems { margin: 0 0 0.5rem; padding: 0; list-style: none; display: grid; gap: 0.25rem; }
.perf-kpi { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0 0.5rem; align-items: baseline; padding: 0.35rem 0.5rem; border: 1px solid var(--line); border-radius: 0.35rem; }
.perf-kpi.is-primary { border-color: var(--line-2); background: rgba(22, 30, 51, 0.6); }
.perf-kpi.is-atencao { border-left: 0.2rem solid var(--amber); }
.perf-kpi.is-falha { border-left: 0.2rem solid #ff6b70; }
.perf-kpi-label { min-width: 0; font-size: 0.8rem; overflow-wrap: anywhere; }
.perf-star { color: var(--amber); font-weight: 800; }
.perf-kpi-value { font-weight: 800; font-size: 1rem; font-variant-numeric: tabular-nums; text-align: right; overflow-wrap: anywhere; }
.perf-kpi.is-primary .perf-kpi-value { font-size: 1.25rem; }
.perf-kpi-meta { grid-column: 1 / -1; font-size: 0.72rem; color: var(--muted); overflow-wrap: anywhere; }
.perf-arrow { color: var(--text); font-weight: 800; }
.perf-ksym { font-weight: 800; }
.perf-ksym.is-ok { color: var(--green); }
.perf-ksym.is-atencao { color: var(--amber); }
.perf-ksym.is-falha { color: #ff8f93; }
.perf-sub { margin: 0.5rem 0 0.3rem; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.perf-problem { display: grid; padding: 0.3rem 0.5rem; border-left: 0.2rem solid var(--amber); border-radius: 0.3rem; background: rgba(255, 178, 36, 0.06); font-size: 0.8rem; }
.perf-problem.is-falha { border-left-color: #ff6b70; background: rgba(229, 72, 77, 0.08); }
.perf-psym { font-weight: 800; color: var(--amber); }
.perf-problem.is-falha .perf-psym { color: #ff8f93; }
.perf-problem-label { overflow-wrap: anywhere; }
.perf-problem-when { font-size: 0.72rem; color: var(--muted); }
.insp-perf.is-stale .perf-kpi-value, .insp-perf.is-stale .perf-ksym, .insp-perf.is-stale .perf-psym, .insp-perf.is-stale .perf-star { color: var(--muted); }
.insp-more-wrap { margin-top: 1rem; padding-top: 0.6rem; border-top: 1px solid var(--line); }
.insp-section h3.insp-more-h { margin: 0; font-size: 0.85rem; text-transform: none; letter-spacing: 0; color: var(--text); }
.insp-more { display: flex; align-items: center; gap: 0.4rem; width: 100%; padding: 0.4rem 0.55rem; border: 1px solid var(--line); border-radius: 0.35rem; background: transparent; font-weight: 700; text-align: left; cursor: pointer; }
.insp-more:hover { border-color: var(--accent); background: var(--panel-2); }
.insp-more-sym { flex: none; width: 1rem; text-align: center; color: var(--muted); }
.insp-more-body { padding-top: 0.6rem; }

/* room inspector: "Atividade da sala" (the room's own action history) */
.room-feed { --dept: #6f6e77; margin: 0; padding: 0; list-style: none; display: grid; gap: 0.1rem; }
.feed-btn {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  width: 100%;
  padding: 0.35rem 0.5rem;
  border: 0;
  border-left: 0.2rem solid var(--dept);
  border-radius: 0.3rem;
  background: transparent;
  text-align: left;
  cursor: pointer;
}
.feed-btn:hover { background: var(--panel-2); }
.feed-btn.is-static { cursor: default; }
.feed-btn.is-static:hover { background: transparent; }
.feed-head { display: flex; gap: 0.4rem; align-items: baseline; font-size: 0.7rem; color: var(--muted); min-width: 0; }
.feed-time { font-family: var(--mono); }
.feed-body { display: flex; flex-wrap: wrap; gap: 0.35rem; font-size: 0.8rem; }
.feed-agent { font-weight: 600; }
.feed-text { color: var(--text); overflow-wrap: anywhere; }
.feed-ok.good { color: var(--green); }
.feed-ok.bad { color: #ff8f93; font-weight: 700; }
.feed-item.is-error .feed-btn { background: rgba(229, 72, 77, 0.08); }
.feed-item.is-xfer .feed-btn { background: rgba(108, 160, 255, 0.06); }
.feed-xfer { color: var(--accent); font-weight: 800; }
.empty-note { margin: 0; padding: 0.75rem; color: var(--muted); }

.inspector { --dept: #6f6e77; top: calc(var(--topbar-h) + var(--gap)); right: var(--gap); bottom: var(--gap); width: var(--insp-w); border-top: 0.2rem solid var(--dept); }
.insp-body { flex: 1; overflow-y: auto; padding: 0.75rem; }
.insp-state { display: flex; align-items: center; padding: 0.5rem 0.6rem; margin-bottom: 0.6rem; border-radius: 0.4rem; background: var(--panel-2); overflow-wrap: anywhere; }
.insp-dl { display: grid; grid-template-columns: max-content 1fr; gap: 0.25rem 0.75rem; margin: 0 0 0.75rem; }
.insp-dl dt { color: var(--muted); }
.insp-dl dd { margin: 0; overflow-wrap: anywhere; }
.insp-section { margin-top: 0.75rem; }
.insp-section h3 { margin: 0 0 0.4rem; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.agent-list, .insp-actions { margin: 0; padding: 0; list-style: none; display: grid; gap: 0.2rem; }
.agent-row {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0 0.1rem;
  width: 100%;
  padding: 0.35rem 0.45rem;
  border: 1px solid var(--line);
  border-radius: 0.35rem;
  background: transparent;
  text-align: left;
  cursor: pointer;
}
.agent-row:hover { border-color: var(--accent); }
.agent-row .sym { grid-row: span 2; align-self: center; }
.agent-name { font-weight: 600; overflow-wrap: anywhere; }
.agent-act { color: var(--muted); font-size: 0.75rem; overflow-wrap: anywhere; }
.insp-actions li { display: flex; gap: 0.5rem; font-size: 0.8rem; }
.insp-actions time { color: var(--faint); font-family: var(--mono); flex: none; }
.insp-actions li.is-error { color: #ff9a9d; }
.spark { width: 100%; height: 3.75rem; background: var(--panel-2); border-radius: 0.35rem; }
.spark polyline { fill: none; stroke: var(--accent); stroke-width: 2; vector-effect: non-scaling-stroke; }
.mix-bar { display: flex; height: 0.6rem; border-radius: 0.3rem; overflow: hidden; background: var(--panel-2); }
.mix-seg { width: var(--w); background: var(--c); }
.mix-legend { display: flex; flex-wrap: wrap; gap: 0.2rem 0.75rem; margin: 0.4rem 0 0; padding: 0; list-style: none; font-size: 0.75rem; color: var(--muted); }
.mix-legend .swatch, .legend-dept .swatch { display: inline-block; width: 0.6rem; height: 0.6rem; margin-right: 0.3rem; border-radius: 0.15rem; background: var(--c, var(--dept)); }
.agent-helpers { color: var(--accent); font-weight: 700; font-size: 0.75rem; }

/* inspector v2: live screen, plan, integrations, transactions */
.insp-screen { display: grid; gap: 0.4rem; }
.insp-screen-canvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 10;
  border: 1px solid var(--line-2);
  border-radius: 0.4rem;
  background: #0b1020;
  box-shadow: 0 0 0 3px #1a2033, 0 0.4rem 1rem rgba(0, 0, 0, 0.4);
}
.insp-screen.is-off .insp-screen-canvas { opacity: 0.35; }
.insp-screen-bar { display: flex; align-items: center; gap: 0.5rem; }
.insp-screen-note { flex: 1; margin: 0; }
.plan-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 0.2rem; }
.plan-item { display: flex; gap: 0.45rem; align-items: baseline; font-size: 0.8rem; }
.plan-sym { flex: none; width: 1rem; text-align: center; font-weight: 800; color: var(--faint); }
.plan-item.is-completed .plan-text { color: var(--muted); text-decoration: line-through; text-decoration-color: rgba(154, 163, 178, 0.5); }
.plan-item.is-completed .plan-sym { color: var(--green); }
.plan-item.is-in_progress .plan-sym { color: var(--amber); }
.plan-item.is-in_progress .plan-text { color: var(--text); font-weight: 600; }
.plan-text { overflow-wrap: anywhere; }
.link-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 0.2rem; }
.link-row {
  --dept: #6f6e77;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0 0.5rem;
  width: 100%;
  padding: 0.3rem 0.5rem;
  border: 1px solid var(--line);
  border-left: 0.2rem solid var(--dept);
  border-radius: 0.35rem;
  background: transparent;
  text-align: left;
  cursor: pointer;
}
.link-row:hover { border-color: var(--accent); border-left-color: var(--dept); }
.link-row.is-base { border-left-style: dashed; }
.link-main { font-weight: 600; overflow-wrap: anywhere; }
.link-sub { grid-column: 1; color: var(--muted); font-size: 0.72rem; overflow-wrap: anywhere; }
.link-n { grid-column: 2; grid-row: 1 / span 2; align-self: center; color: var(--accent); font-variant-numeric: tabular-nums; }
.hub-row { display: grid; grid-template-columns: auto 1fr; gap: 0 0.45rem; padding: 0.3rem 0.5rem; border: 1px dashed var(--line-2); border-radius: 0.35rem; }
.hub-row .hub-sym { grid-row: span 2; color: var(--accent); }
.hub-row .link-sub { grid-column: 2; }

/* ---- toasts (aria-live region) ---- */
.toasts { position: fixed; top: calc(var(--topbar-h) + var(--gap)); right: var(--gap); z-index: 30; display: grid; gap: 0.4rem; width: min(20rem, calc(100vw - 1rem)); }
body:has(.inspector:not([hidden])) .toasts { right: calc(var(--insp-w) + 2 * var(--gap)); }
.toast-btn {
  display: grid;
  gap: 0.1rem;
  width: 100%;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--amber);
  border-left-width: 0.3rem;
  border-radius: 0.5rem;
  background: rgba(40, 28, 6, 0.94);
  text-align: left;
  cursor: pointer;
  box-shadow: var(--shadow);
  animation: toast-in 0.25s ease-out;
}
.toast-btn strong { color: var(--amber); }
.toast-btn span { overflow-wrap: anywhere; }
@keyframes toast-in { from { opacity: 0; translate: 0 -0.5rem; } }
.toast-note {
  margin: 0;
  padding: 0.5rem 0.75rem;
  border: 1px solid rgba(108, 160, 255, 0.55);
  border-left-width: 0.3rem;
  border-radius: 0.5rem;
  background: rgba(14, 24, 48, 0.95);
  box-shadow: var(--shadow);
  animation: toast-in 0.25s ease-out;
  overflow-wrap: anywhere;
}

/* ---- legend, tour badge, debug ---- */
.legend {
  position: fixed;
  left: var(--gap);
  bottom: var(--gap);
  z-index: 10;
  display: grid;
  gap: 0.35rem;
  max-width: min(var(--proj-w), calc(100vw - 1rem));
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  font-size: 0.72rem;
  color: var(--muted);
}
.legend ul { display: flex; flex-wrap: wrap; gap: 0.2rem 0.6rem; margin: 0; padding: 0; list-style: none; }
.legend-states li { display: flex; align-items: center; }
.legend .sym { width: 1rem; height: 1rem; margin-right: 0.2rem; }
.legend-depts { gap: 0.25rem !important; }
.legend-dept { --dept: #6f6e77; display: inline-flex; align-items: center; padding: 0.05rem 0.35rem; font-size: 0.68rem; font-weight: 700; }

.tour-badge {
  position: fixed;
  left: 50%;
  bottom: var(--gap);
  z-index: 10;
  margin: 0;
  padding: 0.35rem 0.8rem;
  translate: -50% 0;
  border: 1px solid var(--accent);
  border-radius: 999px;
  background: var(--panel);
  font-size: 0.8rem;
  white-space: nowrap;
}

.debug {
  position: fixed;
  top: calc(var(--topbar-h) + var(--gap));
  left: calc(var(--proj-w) + 2 * var(--gap));
  z-index: 15;
  margin: 0;
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 0.4rem;
  background: rgba(0, 0, 0, 0.72);
  color: #b6f5d4;
  font: 0.72rem/1.45 var(--mono);
  pointer-events: none;
}
body:has(.projects[hidden]) .debug { left: var(--gap); }

/* ---- help dialog and loading ---- */
.overlay { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 1rem; background: rgba(4, 6, 12, 0.6); }
.dialog { width: min(36rem, 100%); max-height: 100%; overflow: auto; border: 1px solid var(--line-2); border-radius: var(--radius); background: var(--panel-solid); box-shadow: var(--shadow); }
.dialog > p { margin: 0.75rem; }
.keys { display: grid; grid-template-columns: max-content 1fr; gap: 0.45rem 1rem; margin: 0.75rem; }
.keys dt { white-space: nowrap; }
.keys dd { margin: 0; color: var(--muted); }
.dialog--wide { width: min(64rem, 100%); }
.keys-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 19rem), 1fr)); gap: 0 0.5rem; }
.keys-cols h3 { margin: 0.75rem 0.75rem 0; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.keys-cols .keys { grid-template-columns: minmax(2.5rem, max-content) 1fr; gap: 0.45rem 0.75rem; }

/* ---- navigator (command palette) ---- */
.overlay--nav { place-items: start center; padding-top: calc(var(--topbar-h) + 2.5rem); background: rgba(4, 6, 12, 0.5); backdrop-filter: blur(2px); }
.palette {
  display: flex;
  flex-direction: column;
  width: min(40rem, 100%);
  max-height: min(36rem, calc(100vh - var(--topbar-h) - 4rem));
  border: 1px solid var(--line-2);
  border-radius: 0.75rem;
  background: var(--panel-solid);
  box-shadow: 0 1.5rem 4rem rgba(0, 0, 0, 0.6);
  overflow: hidden;
  animation: palette-in 0.16s var(--ease);
}
@keyframes palette-in { from { opacity: 0; translate: 0 -0.5rem; scale: 0.985; } }
.palette-search { display: flex; align-items: center; gap: 0.6rem; padding: 0.7rem 0.9rem; border-bottom: 1px solid var(--line); }
.palette-icon { font-size: 1.2rem; color: var(--accent); line-height: 1; }
.palette-search input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font: 500 1rem/1.4 var(--font);
}
.palette-search input::placeholder { color: var(--faint); }
.palette-search input:focus-visible { box-shadow: none; } /* the search row shows the focus instead */
.palette-list { flex: 1; overflow-y: auto; padding: 0.35rem; overscroll-behavior: contain; }
.nav-group { --dept: var(--line-2); padding-bottom: 0.25rem; }
.nav-group + .nav-group { border-top: 1px solid var(--line); padding-top: 0.25rem; }
.nav-group-head {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.55rem 0.2rem;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.nav-group-head kbd { margin-left: auto; }
.nav-dot { width: 0.6rem; height: 0.6rem; border-radius: 0.15rem; background: var(--dept); flex: none; }
.nav-group-title { color: color-mix(in srgb, var(--dept) 55%, #fff); }
.nav-group-meta { font-weight: 500; text-transform: none; letter-spacing: 0; color: var(--faint); }
.nav-item {
  --dept: transparent;
  display: flex;
  align-items: center;
  gap: 0.15rem;
  padding: 0.4rem 0.55rem;
  border-left: 0.2rem solid var(--dept);
  border-radius: 0.4rem;
  cursor: pointer;
  scroll-margin: 0.4rem;
}
.nav-item[aria-selected="true"] { background: rgba(108, 160, 255, 0.16); box-shadow: inset 0 0 0 1px rgba(108, 160, 255, 0.55); }
.nav-item.is-muted .nav-label { color: var(--muted); }
.nav-item--note { cursor: default; color: var(--faint); font-size: 0.78rem; }
.nav-main { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.nav-label { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-label mark { background: rgba(255, 178, 36, 0.28); color: inherit; border-radius: 0.15rem; }
.nav-sub { color: var(--muted); font-size: 0.75rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-badge { flex: none; padding: 0 0.4rem; border: 1px solid var(--line-2); border-radius: 999px; color: var(--muted); font-size: 0.68rem; font-weight: 700; }
.nav-badge.is-waiting { border-color: var(--amber); background: rgba(255, 178, 36, 0.16); color: var(--amber); }
.nav-go { flex: none; margin-left: 0.4rem; color: var(--accent); font-size: 0.72rem; font-weight: 700; opacity: 0; transition: opacity 0.12s; }
.nav-go::after { content: " ↵"; }
.nav-item[aria-selected="true"] .nav-go { opacity: 1; }
.nav-empty { margin: 0; padding: 1.25rem 1rem; color: var(--muted); text-align: center; }
.palette-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 0.3rem 1rem; margin: 0; padding: 0.45rem 0.9rem; border-top: 1px solid var(--line); color: var(--faint); font-size: 0.72rem; }
.palette-status { margin-left: auto; }

/* ---- free flight ---- */
.flight { position: fixed; inset: 0; z-index: 5; pointer-events: none; }
.crosshair {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 1.4rem;
  height: 1.4rem;
  translate: -50% -50%;
  border: 2px solid rgba(255, 255, 255, 0.85);
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.5), inset 0 0 0 1px rgba(0, 0, 0, 0.5);
}
.crosshair::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 4px;
  height: 4px;
  translate: -50% -50%;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.6);
}
body.is-flying-drag .crosshair { opacity: 0.55; }
.crosshair-label {
  position: absolute;
  left: 50%;
  top: calc(50% + 1.4rem);
  translate: -50% 0;
  max-width: min(28rem, 80vw);
  margin: 0;
  padding: 0.2rem 0.6rem;
  border-radius: 0.35rem;
  background: rgba(11, 16, 32, 0.82);
  color: var(--text);
  font-size: 0.8rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.flight-hud {
  position: absolute;
  left: 50%;
  bottom: var(--gap);
  translate: -50% 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.35rem 0.9rem;
  max-width: calc(100vw - 2rem);
  padding: 0.4rem 0.9rem;
  border: 1px solid rgba(108, 160, 255, 0.55);
  border-radius: 0.75rem;
  background: rgba(11, 16, 32, 0.88);
  box-shadow: var(--shadow);
  font-size: 0.75rem;
  color: var(--muted);
  animation: toast-in 0.25s ease-out;
}
.flight-title { color: var(--accent); font-weight: 800; font-size: 0.82rem; }
.flight-speed { color: var(--text); }
.flight-speed b { font-variant-numeric: tabular-nums; font-size: 0.95rem; }
.flight-keys { display: flex; flex-wrap: wrap; gap: 0.2rem 0.75rem; }
.flight-keys kbd { font-size: 0.62rem; }
.flight-mode:empty { display: none; }
.flight-mode { color: var(--amber); }
body.is-flying .tour-badge, body.is-flying .legend { display: none; }
/* keep the flight bar in the part of the screen the inspector leaves free */
body:has(.inspector:not([hidden])) .flight-hud {
  left: calc((100vw - var(--insp-w) - var(--gap)) / 2);
  max-width: calc(100vw - var(--insp-w) - 3 * var(--gap));
}

.loading { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; background: rgba(14, 18, 32, 0.92); }
.loading-card { display: grid; justify-items: center; gap: 0.6rem; padding: 1.5rem 2rem; text-align: center; }
.loading-card p { margin: 0; color: var(--muted); }
.spinner { width: 2rem; height: 2rem; border: 3px solid var(--line-2); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.9s linear infinite; }
@keyframes spin { to { rotate: 360deg; } }
.noscript { position: fixed; inset: auto 1rem 1rem; z-index: 60; padding: 1rem; background: var(--panel-solid); }

/* ---- TV (no pointer, read from afar) ---- */
html.tv .legend, html.tv .actions, html.tv .brand-sub, html.tv .view-tools, html.tv .nav-search { display: none; }
/* v1.0 wall display (/tv, 1080p, read from ~3 m): the tour caption replaces the breadcrumb row; plaques,
   wing signs and hall labels grow (agent tags grow through --font-scale); the cursor hides when idle. */
html.tv .navbar { display: none; }
html.tv .plaque { font-size: 0.95rem; max-width: 22rem; padding: 0.3rem 0.6rem; border-left-width: 0.3rem; }
html.tv .plaque-sym { width: 1.25rem; height: 1.25rem; font-size: 0.8rem; }
html.tv .plaque-note { font-size: 0.8rem; }
html.tv .wing-sign { padding: 0.45rem 0.9rem; border-top-width: 0.3rem; }
html.tv .wing-sign-key { font-size: 1.2rem; }
html.tv .wing-sign-name { font-size: 0.95rem; }
html.tv .wing-sign-counts { font-size: 0.85rem; color: #c3cad8; }
html.tv .wing-sign.is-compact { padding: 0.2rem 0.6rem; }
html.tv .wing-sign.is-compact .wing-sign-key { font-size: 1.05rem; }
html.tv .wing-sign.is-compact .wing-sign-counts.has-waiting { font-size: 0.8rem; }
html.tv .object-label, html.tv .wb-title { font-size: 0.8rem; }
html.tv .wb-title { max-width: 14rem; }
html.tv .tour-badge {
  max-width: calc(100vw - 2rem);
  padding: 0.35rem 1.1rem;
  overflow: hidden;
  text-overflow: ellipsis;
  border-width: 2px;
  font-size: 1.05rem;
  font-weight: 600;
}
html.tv .toasts { width: min(30rem, calc(100vw - 1rem)); }
html.tv.cursor-idle, html.tv.cursor-idle * { cursor: none !important; }

/* ---- watchdog (v1.0): offline overlay and reload notice ---- */
.offline {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(4, 6, 12, 0.74);
}
.offline-card {
  display: grid;
  justify-items: center;
  gap: 0.5rem;
  max-width: min(40rem, 100%);
  padding: 1.5rem 2.5rem;
  border: 2px solid var(--amber);
  border-radius: var(--radius);
  background: var(--panel-solid);
  box-shadow: var(--shadow);
  text-align: center;
}
.offline-icon {
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  background: var(--amber);
  color: #0b1020;
  font-size: 1.75rem;
  font-weight: 800;
}
.offline-title { margin: 0; font-size: 1.6rem; font-weight: 700; }
.offline-sub { margin: 0; color: var(--muted); font-size: 1.1rem; }
.wd-notice {
  position: fixed;
  right: var(--gap);
  bottom: var(--gap);
  z-index: 71;
  max-width: min(34rem, calc(100vw - 1rem));
  margin: 0;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--amber);
  border-radius: 0.5rem;
  background: var(--panel-solid);
  color: var(--text);
  font-size: 0.8rem;
}

/* ---- central mode (PLANO-VPS, versão enxuta): PC offline banner, system lamps, goal, logout ---- */
.actions form.logout { display: contents; }
.pc-banner {
  position: fixed;
  top: calc(var(--topbar-h) + var(--gap));
  left: 50%;
  z-index: 25;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: center;
  gap: 0.15rem 0.6rem;
  width: max-content;
  max-width: min(44rem, calc(100vw - 2rem));
  margin: 0;
  padding: 0.45rem 0.9rem;
  translate: -50% 0;
  border: 1px solid rgba(255, 178, 36, 0.55);
  border-left-width: 0.3rem;
  border-radius: 0.5rem;
  background: rgba(18, 24, 41, 0.94);
  box-shadow: var(--shadow);
  color: var(--text);
  text-align: center;
}
.pc-banner-icon { color: var(--amber); font-weight: 800; }
.pc-banner-text { font-weight: 700; }
.pc-banner-sub { color: var(--muted); font-size: 0.8rem; }
/* TV: a calm full-width strip right under the top bar (no pulse, no red) */
html.tv .pc-banner {
  left: 0;
  right: 0;
  top: var(--topbar-h);
  width: auto;
  max-width: none;
  translate: none;
  padding: 0.5rem 1.5rem;
  border-width: 0 0 2px;
  border-radius: 0;
  box-shadow: none;
  font-size: 1.05rem;
}
html.tv .pc-banner-sub { font-size: 0.85rem; }
/* 2D board: a card in the page flow */
body.board .pc-banner { position: static; width: auto; max-width: none; translate: none; justify-content: flex-start; text-align: left; box-shadow: none; }

.plaque-lamp {
  flex: none;
  margin-left: auto;
  padding-left: 0.3rem;
  font-size: 0.7rem;
  font-weight: 800;
  line-height: 1;
}
.plaque-lamp[data-health="up"], .lamp[data-health="up"] { color: var(--green); }
.plaque-lamp[data-health="down"], .lamp[data-health="down"] { color: #ff6b70; }
html.tv .plaque-lamp { font-size: 0.85rem; }
.lamp { margin-left: 0.4rem; font-size: 0.75rem; font-weight: 800; }
.counter--goal b { color: var(--green); }
.counter--goal.is-stale { border-color: rgba(255, 178, 36, 0.55); }
.counter--goal.is-stale b { color: var(--muted); }
.counter-stale { color: var(--amber); font-size: 0.75rem; font-weight: 700; }

/* ---- touch-only devices: no pointer lock / keyboard flight ---- */
@media (hover: none) and (pointer: coarse) {
  #btn-fly { display: none; }
}

/* ---- small screens ---- */
@media (max-width: 1500px) {
  .topbar .brand-sub, .topbar .counter-label, .topbar .conn-text { display: none; }
}
@media (max-width: 1180px) {
  .actions kbd, .view-tools kbd { display: none; }
  .nav-search { width: 11rem; }
}
@media (max-width: 760px) {
  :root { --proj-w: calc(100vw - 1rem); --insp-w: calc(100vw - 1rem); }
  .topbar-row, .navbar { gap: 0.5rem; overflow-x: auto; scrollbar-width: none; }
  .brand h1, .legend { display: none; }
  .counters { flex: none; overflow: visible; }
  .nav-search { width: auto; }
  .nav-search kbd, .group-mode { display: none; }
  .crumbs { min-width: 8rem; }
  .projects { bottom: var(--gap); }
  .toasts, body:has(.inspector:not([hidden])) .toasts { right: var(--gap); top: auto; bottom: var(--gap); }
  .overlay--nav { padding: calc(var(--topbar-h) + 0.5rem) 0.5rem 0.5rem; }
  .flight-keys { display: none; }
}

/* ===================================================================================
   2D board (/board)
   =================================================================================== */
body.board { min-height: 100%; overflow-x: hidden; }
.board-top {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  padding: 0.6rem 1rem;
  background: rgba(11, 16, 32, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px);
}
.board-top h1 { margin: 0; font-size: 1rem; }
.board-top .status { margin-left: 0; }
.board-top .actions { margin-left: auto; flex-wrap: wrap; }
.board-top .actions a, .board-top .actions button {
  display: inline-flex;
  align-items: center;
  padding: 0.3rem 0.6rem;
  border: 1px solid var(--line-2);
  border-radius: 0.4rem;
  background: var(--panel-2);
  color: var(--text);
  font-size: 0.8rem;
  text-decoration: none;
  cursor: pointer;
}
.board-main { display: grid; gap: 1rem; padding: 1rem; max-width: 100rem; margin: 0 auto; }
.board-summary { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0; padding: 0; list-style: none; }
.board-summary .counter-label { display: inline; }
.needs {
  padding: 0.75rem 1rem;
  border: 1px solid var(--amber);
  border-radius: var(--radius);
  background: rgba(255, 178, 36, 0.08);
}
.needs h2 { margin: 0 0 0.4rem; font-size: 0.95rem; color: var(--amber); }
.needs ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 0.25rem; }
.needs li { overflow-wrap: anywhere; }
.board-depts { display: grid; gap: 1.25rem; }
.dept-section { --dept: #6f6e77; min-width: 0; }
.dept-section > h2 {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem 0.6rem;
  margin: 0 0 0.5rem;
  padding-left: 0.6rem;
  border-left: 0.3rem solid var(--dept);
  font-size: 1rem;
}
.dept-section > h2 small { color: var(--muted); font-weight: 500; font-size: 0.8rem; }
.room-grid { display: grid; gap: 0.6rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 17rem), 1fr)); }
.room-card {
  --dept: #6f6e77;
  min-width: 0;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--line);
  border-top: 0.2rem solid var(--dept);
  border-radius: var(--radius);
  background: var(--panel-solid);
}
.room-card.is-waiting { border-color: var(--amber); box-shadow: 0 0 0 1px var(--amber) inset; }
.room-card.is-quiet { opacity: 0.72; }
.room-card h3 { display: flex; align-items: center; gap: 0.2rem; margin: 0; font-size: 0.9rem; overflow-wrap: anywhere; }
.room-meta { margin: 0.15rem 0 0.4rem; color: var(--muted); font-size: 0.75rem; overflow-wrap: anywhere; }
.room-agents { margin: 0; padding: 0; list-style: none; display: grid; gap: 0.3rem; }
.room-agents li { display: grid; grid-template-columns: auto 1fr; align-items: start; min-width: 0; }
.room-agents .agent-name { font-size: 0.82rem; }
.room-agents .agent-act { grid-column: 2; }
.room-agents li.is-waiting .agent-name { color: var(--amber); }
.board-foot { padding: 0 1rem 1.5rem; color: var(--faint); font-size: 0.75rem; text-align: center; }

/* ---- central mode: "Custos de IA" section (only when the central sends costs to this browser) ---- */
.costs { min-width: 0; padding: 0.75rem 1rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel-solid); }
.costs > h2 { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.25rem 0.5rem; margin: 0 0 0.6rem; font-size: 0.95rem; color: var(--accent); }
.costs > h2 small { color: var(--muted); font-weight: 500; font-size: 0.8rem; }
.costs-grid { display: grid; gap: 1rem 1.5rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr)); align-items: start; }
.costs-total { display: grid; gap: 0.15rem; min-width: 0; }
.costs-label { color: var(--muted); font-size: 0.8rem; }
.costs-amount { font-size: 2.2rem; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.costs-brl { color: #c6cedd; font-size: 1rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.costs-trend-wrap { display: grid; gap: 0.2rem; margin-top: 0.6rem; }
.costs-trend { width: 100%; height: 3rem; display: block; border-bottom: 2px solid var(--line); }
.costs-trend rect { fill: rgba(108, 160, 255, 0.6); }
.costs-trend rect.is-last { fill: var(--accent); }
.costs-trend-axis { display: flex; justify-content: space-between; gap: 0.5rem; color: var(--muted); font-size: 0.72rem; font-variant-numeric: tabular-nums; }
.costs-rooms { margin: 0; padding: 0; list-style: none; display: grid; gap: 0.7rem; min-width: 0; }
.costs-room { display: grid; gap: 0.25rem; min-width: 0; }
.costs-room-head { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 0.45rem; min-width: 0; }
.costs-room-name { font-weight: 700; overflow-wrap: anywhere; }
.costs-room-usd { margin-left: auto; font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.costs-bar { position: relative; height: 0.6rem; border-radius: 0.3rem; background: #151d33; }
.costs-bar > span { display: block; height: 100%; min-width: 0.3rem; max-width: 100%; border-radius: 0.3rem; }
.costs-bar.has-budget::after { content: ""; position: absolute; left: 80%; top: -0.2rem; bottom: -0.2rem; width: 2px; background: var(--amber); }
.costs-room.is-over .costs-bar { box-shadow: 0 0 0 2px #ff6b70; }
.costs-room-detail { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.1rem 0.4rem; margin: 0; color: #c6cedd; font-size: 0.8rem; }
.costs-sym { font-weight: 800; }
.costs-room.is-ok .costs-sym { color: var(--green); }
.costs-room.is-warn .costs-room-detail { color: var(--amber); font-weight: 700; }
.costs-room.is-over .costs-room-detail { color: #ff6b70; font-weight: 700; }
.costs-model { margin-left: auto; color: var(--muted); font-size: 0.75rem; font-weight: 400; font-family: var(--mono); overflow-wrap: anywhere; }
.costs-extras { display: flex; flex-wrap: wrap; gap: 0.3rem 1.5rem; margin: 0.8rem 0 0; padding-top: 0.6rem; border-top: 1px solid var(--line); font-size: 0.9rem; }
.costs-extra b { font-variant-numeric: tabular-nums; }
.costs-note { color: var(--muted); font-size: 0.8rem; }
.costs-foot { margin: 0.5rem 0 0; color: var(--muted); font-size: 0.78rem; }
.costs-foot.is-warn { color: var(--amber); font-weight: 700; }

/* ---- reduced motion ---- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
