@layer reset {
  button, input, select, textarea { font: inherit; }
}

:root {
  color-scheme: dark;
  --bg: #111113;
  --panel-rgb: 25, 25, 29;
  --panel-alpha: 0.94;
  --glass-blur: 12px;
  --drawer-w: 396px;
  --drawer-shift: 0px;
  --panel: rgba(var(--panel-rgb), var(--panel-alpha));
  --panel-solid: #1b1b20;
  --panel-border: rgba(255, 255, 255, 0.12);
  --text: #f6f4f0;
  --muted: #b4b1b9;
  --gold: #f4cc7a;
  --cyan: #7ccbf3;
  --green: #73d5a0;
  --pink: #f398c3;
  --orange: #fb923c;
  --danger: #fca5a5;
  --radius: 16px;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);
  --workspace-inset: clamp(14px, 1.55vw, 26px);
  --workspace-gap: 12px;
  --topbar-h: 66px;
  --stage-top: calc(var(--topbar-h) + var(--workspace-gap));
  --stage-bottom: var(--desktop-stage-bottom, 126px);
  --stage-right: calc(var(--workspace-inset) + var(--drawer-shift));
  --mobile-nav-size: 58px;
}

html { background: #111113; }
body { --panel: rgba(var(--panel-rgb), var(--panel-alpha)); }

body[data-ui-theme="obsidiana"] { --bg: #07090f; --panel-rgb: 12, 17, 30; --panel-solid: #0f1526; --muted: #9aa7c2; }
body[data-ui-theme="noite"] { --bg: #070a19; --panel-rgb: 13, 21, 46; --panel-solid: #111b3b; --muted: #9eb0d6; }
body[data-ui-theme="grafite"] { --bg: #111113; --panel-rgb: 25, 25, 29; --panel-solid: #1b1b20; --muted: #b4b1b9; }
body[data-ui-theme="ambar"] { --bg: #140c08; --panel-rgb: 31, 18, 12; --panel-solid: #26160e; --muted: #cbb4a0; }
body[data-ui-theme="roxo-suave"] { --bg: #151034; --panel-rgb: 28, 21, 62; --panel-solid: #22194c; --muted: #bfb4e0; }

* { box-sizing: border-box; }
html, body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}

canvas#bg-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 0;
  pointer-events: none;
  opacity: 0.78;
}

canvas#c {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 1;
  touch-action: none;
  cursor: grab;
}
canvas#c.arrasta { cursor: grabbing; }
canvas#c.modo-mover { cursor: move; }

#camada {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 5;
}
#bg-canvas, .map-grid {
  clip-path: inset(var(--stage-top) var(--stage-right) var(--stage-bottom) var(--workspace-inset) round var(--radius));
}
#c, #camada {
  clip-path: inset(var(--map-head-bottom, var(--stage-top)) var(--stage-right) var(--map-foot-inset, var(--stage-bottom)) var(--workspace-inset));
}

.map-grid {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: radial-gradient(rgba(238, 227, 199, 0.18) 0.7px, transparent 0.7px);
  background-size: 24px 24px;
  mask-image: radial-gradient(ellipse, #000 15%, transparent 78%);
}

#camada.hide-zz .balao.st-ocioso { opacity: 0 !important; pointer-events: none !important; }
#camada.hide-bubbles .balao { opacity: 0 !important; pointer-events: none !important; }

/* ---------- Etiquetas limpas no mapa (somente estado discreto + nome) ---------- */
.etq {
  position: absolute;
  left: 0;
  top: 0;
  pointer-events: auto;
  cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(22, 22, 27, 0.91);
  color: var(--text);
  backdrop-filter: blur(8px);
  border-radius: 999px;
  padding: 3px 9px 3px 7px;
  font-size: 11px;
  line-height: 14px;
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
  opacity: 0;
  transition: opacity 160ms var(--ease-out), border-color 160ms var(--ease-out);
}
.etq.on { opacity: 1; }
.etq.atenuado { opacity: 0.18 !important; }
.etq:hover { border-color: rgba(255, 255, 255, 0.5); z-index: 22; }
.etq.selecionado {
  border-color: var(--cyan);
  background: rgba(12, 42, 68, 0.94);
  color: #e0f2fe;
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.5), 0 6px 18px rgba(56, 189, 248, 0.28);
  z-index: 28;
}
.etq.orch {
  border-color: var(--gold);
  background: rgba(45, 31, 14, 0.94);
  box-shadow: 0 0 18px rgba(255, 209, 102, 0.32);
  color: #fff6db;
  font-size: 12px;
  padding: 4px 11px 4px 8px;
  z-index: 24;
}
.etq.orch.selecionado {
  border-color: var(--cyan);
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.65), 0 0 18px rgba(255, 209, 102, 0.4);
  z-index: 29;
}
.etq.enfase-destaque { border-color: var(--cyan); }
.etq.enfase-foco { border-color: var(--pink); box-shadow: 0 0 16px rgba(244, 114, 182, 0.34); }
.etq.is-offline { opacity: 0.68; border-style: dashed; }
.etq.is-demo { border-style: dotted; }

.etq .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--cyan); flex: none; }
.etq[data-e="em_andamento"] .dot, .etq[data-e="trabalhando"] .dot { background: var(--cyan); }
.etq[data-e="pensando"] .dot { background: #fbbf24; }
.etq[data-e="preparando_resposta"] .dot { background: #a78bfa; }
.etq[data-e="esperando"] .dot { background: var(--pink); }
.etq[data-e="ocioso"] .dot { background: #948eb0; }
.etq[data-e="offline"] .dot { background: #8591a4; }
.etq[data-e="respondeu"] .dot, .etq[data-e="terminou"] .dot { background: var(--green); }
.etq[data-e="corrigindo"] .dot { background: var(--cyan); }

.etq .nm { font-weight: 700; max-width: 112px; overflow: hidden; text-overflow: ellipsis; }
.etq.compacta { padding: 2px 7px 2px 6px; font-size: 10px; gap: 4px; }
.etq.compacta .nm { max-width: 82px; }
.etq.compacta:hover { font-size: 11.5px; padding: 3px 10px 3px 7px; z-index: 35; }
.etq.compacta:hover .nm { max-width: 180px; }

#camada[data-label-density="markers"] .etq:not(.orch, .selecionado, :focus-visible) {
  width: 24px;
  height: 24px;
  justify-content: center;
  padding: 0;
  backdrop-filter: none;
}
#camada[data-label-density="markers"] .etq:not(.orch, .selecionado, :focus-visible) .nm {
  display: none;
}
#camada[data-label-density="markers"] .balao:not(.clickable-resp, :focus-visible) {
  visibility: hidden;
  pointer-events: none;
}
#camada[data-label-density="short"] .etq:not(.orch, .selecionado, :focus-visible) {
  padding: 2px 5px;
  gap: 3px;
}
#camada[data-label-density="short"] .etq:not(.orch, .selecionado, :focus-visible) .nm {
  max-width: 7ch;
}
#camada:is([data-label-density="markers"], [data-label-density="short"]) .etq:focus-visible {
  z-index: 36;
}
#camada:is([data-label-density="markers"], [data-label-density="short"]) .etq:is(.orch, .selecionado, :focus-visible) .nm {
  max-width: min(180px, 42vw);
}

/* Balões de estado no robô (mesmo estilo de ícones de traço da Colmeia Office) */
.balao {
  position: absolute;
  left: 0;
  top: 0;
  opacity: 0;
  transition: opacity 180ms var(--ease-out);
  pointer-events: auto;
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  z-index: 16;
}
.balao.on { opacity: 1; }
.balao > div {
  transform: translate(-50%, -100%) scale(0.92);
  transform-origin: 50% 100%;
  transition: transform 180ms var(--ease-out), box-shadow 150ms ease;
  min-width: 28px;
  height: 24px;
  padding: 0 7px;
  border-radius: 12px;
  background: rgba(25, 25, 30, 0.94);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-weight: 800;
  font-size: 10.5px;
  position: relative;
}
.balao.on > div { transform: translate(-50%, -100%) scale(1); }
.balao > div svg { width: 14px; height: 14px; display: block; }
.balao > div::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -4px;
  width: 6px;
  height: 6px;
  background: inherit;
  border-right: inherit;
  border-bottom: inherit;
  transform: translateX(-50%) rotate(45deg);
}
.balao.st-ocioso > div {
  background: transparent;
  color: rgba(216, 206, 255, 0.72);
  border-color: transparent;
  box-shadow: none;
  height: 18px;
  min-width: 20px;
  padding: 0 3px;
  text-shadow: 0 1px 6px rgba(10, 6, 24, 0.92);
}
.balao.st-ocioso > div::after { display: none; }
.balao.st-ocioso:hover > div { color: #ede9fe; }
.zz-mark { display: inline-flex; align-items: baseline; gap: 1px; font-size: 10.5px; font-weight: 800; letter-spacing: -0.02em; }
.zz-mark span:last-child { font-size: 8.5px; opacity: 0.72; }

.balao.st-trabalhando > div,
.balao.st-em_andamento > div,
.balao.st-corrigindo > div {
  background: rgba(12, 50, 76, 0.94);
  color: #7dd3fc;
  border-color: rgba(56, 189, 248, 0.55);
}
.balao.st-pensando > div {
  background: rgba(56, 38, 12, 0.94);
  color: #fde68a;
  border-color: rgba(251, 191, 36, 0.55);
}
.balao.st-preparando_resposta > div {
  background: rgba(48, 28, 86, 0.94);
  color: #ddd6fe;
  border-color: rgba(167, 139, 250, 0.6);
}
.typing-dots { display: inline-flex; gap: 3px; align-items: center; }
.typing-dots em { width: 4px; height: 4px; border-radius: 50%; background: currentColor; }

.balao.st-respondeu > div,
.balao.st-terminou > div {
  background: rgba(14, 68, 42, 0.96);
  color: #86efac;
  border-color: rgba(74, 222, 128, 0.75);
  box-shadow: 0 0 14px rgba(74, 222, 128, 0.32);
}
.balao.clickable-resp:hover > div {
  transform: translate(-50%, -108%) scale(1.08);
  box-shadow: 0 0 18px rgba(74, 222, 128, 0.55);
}
.balao.st-esperando > div {
  background: rgba(84, 20, 58, 0.95);
  color: #fbcfe8;
  border-color: rgba(244, 114, 182, 0.7);
}
.balao.st-offline > div {
  background: rgba(26, 32, 46, 0.92);
  color: #94a3b8;
  border-color: rgba(148, 163, 184, 0.38);
  border-style: dashed;
}

/* Balão curto de comemoração de entrega aprovada de primeira */
.balao-festa {
  position: absolute;
  left: 0;
  top: 0;
  pointer-events: none;
  z-index: 25;
  opacity: 0;
  transition: opacity 0.25s;
  transform-origin: 50% 100%;
  background: linear-gradient(135deg, rgba(255, 209, 102, 0.96), rgba(245, 158, 11, 0.95));
  color: #1c122e;
  font-size: 11px;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
  box-shadow: 0 6px 20px rgba(255, 209, 102, 0.45);
  margin-left: -46px;
}
.balao-festa.on { opacity: 1; }

.drag-ghost {
  position: fixed;
  transform: translate(14px, -24px);
  z-index: 95;
  pointer-events: none;
  background: rgba(15, 11, 36, 0.94);
  border: 1px solid var(--gold);
  color: var(--gold);
  padding: 7px 12px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 700;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}

/* Barra operacional */
.topbar {
  position: fixed;
  inset: 0 0 auto;
  z-index: 38;
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto minmax(300px, 1fr);
  align-items: center;
  gap: 12px;
  padding: 12px var(--workspace-inset);
  background: var(--bg);
  border-bottom: 1px solid var(--panel-border);
}

.glass {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  backdrop-filter: blur(var(--glass-blur));
  border-radius: var(--radius);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.22);
}

.brand-bar, .topbar-utilities, .operation-nav, .connection-status {
  display: flex;
  align-items: center;
}

.brand-bar { gap: 10px; min-width: 0; }
.logo-hex {
  display: grid;
  place-items: center;
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(244, 204, 122, 0.39);
  border-radius: 11px;
  background: linear-gradient(145deg, #4a3926, #30261f);
  color: #f7d894;
}
.logo-hex .ico { width: 23px; height: 23px; stroke-width: 1.6; }
.brand-txt { min-width: 0; line-height: 1.15; }
.brand-txt strong { display: block; font-size: 1rem; letter-spacing: -0.035em; }
.brand-txt small { display: block; margin-top: 4px; color: var(--muted); font-size: 0.75rem; }

.operation-nav { gap: 3px; min-width: 0; }
.operation-nav .btn { border-color: transparent; background: transparent; }
.operation-nav .btn.has-pending { color: var(--gold); }
.operation-nav .ico { color: var(--muted); }
.topbar-utilities { justify-content: flex-end; gap: 6px; min-width: 0; }
.connection-status { gap: 4px; padding-right: 7px; border-right: 1px solid var(--panel-border); }
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.2;
  font-weight: 600;
  padding: 4px 6px;
  white-space: nowrap;
}
.status-pill i, .map-key i {
  width: 6px;
  height: 6px;
  flex: 0 0 6px;
  border-radius: 50%;
  background: #77747e;
}
.status-pill.on { color: var(--text); }
.status-pill.on i { background: var(--green); }
.status-pill.gold { color: var(--gold); }

.map-stage {
  position: fixed;
  inset: var(--stage-top) var(--stage-right) var(--stage-bottom) var(--workspace-inset);
  z-index: 7;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  pointer-events: none;
  container-type: inline-size;
}
.map-head, .map-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 14px 16px; }
.map-head { align-items: flex-start; }
.map-title { min-width: 0; }
.map-title h2 { margin: 0; font-size: clamp(1.18rem, 1.55vw, 1.48rem); letter-spacing: -0.045em; line-height: 1.12; }
.map-overflow { display: inline-block; margin-top: 5px; color: var(--danger); font-size: 0.75rem; }
.map-title p { margin: 5px 0 0; color: var(--muted); font-size: 0.77rem; line-height: 1.35; }
.map-controls, .map-actions, .orch-picker-wrap, .orch-picker-label {
  display: flex;
  align-items: center;
  gap: 5px;
}
.map-controls { flex-wrap: wrap; justify-content: flex-end; }
.map-controls button, .map-controls label { pointer-events: auto; }
.orch-picker-wrap {
  border: 1px solid var(--panel-border);
  background: var(--panel);
  border-radius: 10px;
  padding: 3px 4px 3px 8px;
  min-width: 0;
}
.orch-picker-label { color: var(--gold); font-size: 0.75rem; min-width: 0; }
.orch-caption { color: var(--muted); }
#select-orchestrator {
  max-width: 155px;
  min-width: 0;
  padding: 4px 6px;
  background: transparent;
  border-color: transparent;
  font-size: 0.82rem;
  text-overflow: ellipsis;
}
#btn-top-new-agent { min-height: 28px; padding: 4px 6px; }
.map-actions .btn { background: var(--panel); }
.map-actions .btn.cyan { color: var(--gold); border-color: rgba(244, 204, 122, 0.35); }
.map-actions .btn[aria-expanded="true"] { background: rgba(244, 204, 122, 0.17); border-color: var(--gold); }

.map-foot { padding-block: 11px; }
.map-key { display: flex; flex-wrap: wrap; gap: 6px 15px; }
.map-key span { display: inline-flex; align-items: center; gap: 6px; }
.map-key, .map-hint { color: var(--muted); font-size: 0.75rem; }
.map-key .map-key-work { background: var(--cyan); }
.map-key .map-key-wait { background: var(--pink); }
.map-key .map-key-done { background: var(--green); }
.map-view-tools, .map-zoom { display: flex; align-items: center; gap: 8px; }
.map-hint { margin: 0; text-align: right; }
.map-zoom {
  pointer-events: auto;
  flex: none;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--panel-border);
  border-radius: 11px;
  background: var(--panel);
}
.map-zoom .btn {
  width: 36px;
  min-height: 34px;
  justify-content: center;
  padding: 0;
  border-color: transparent;
  background: transparent;
}
.map-zoom .btn[aria-disabled="true"] { opacity: 0.48; }
.map-zoom .ico { width: 17px; height: 17px; }
.map-zoom-level {
  width: 4ch;
  color: var(--muted);
  font-size: 0.8rem;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.map-zoom .map-zoom-fit { border-left-color: var(--panel-border); margin-left: 3px; border-radius: 0 7px 7px 0; }
body:has(#c:focus-visible) .map-stage { outline: 2px solid var(--cyan); outline-offset: 2px; }

.fps-badge {
  position: fixed;
  left: var(--workspace-inset);
  bottom: calc(var(--stage-bottom) + 40px);
  z-index: 28;
  margin-left: 12px;
  padding: 5px 10px;
  font-size: 0.75rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #86efac;
  border-radius: 99px;
  pointer-events: none;
}

.btn {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.07);
  color: var(--text);
  border-radius: 10px;
  padding: 6px 10px;
  font-size: 0.85rem;
  min-height: 36px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background-color 160ms var(--ease-out), border-color 160ms var(--ease-out), transform 120ms var(--ease-out);
  white-space: nowrap;
}
.btn:active:not(:disabled), .mode-btn:active, .tab-btn:active { transform: scale(0.97); }
.btn:focus-visible, select:focus-visible, input:focus-visible, textarea:focus-visible, .tab-btn:focus-visible, .mode-btn:focus-visible, .etq:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}
.ico {
  width: 14px;
  height: 14px;
  flex: none;
  display: inline-block;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

/* ---------- Menu de sessão / Mais e Faixa Modo Mover ---------- */
.menu-wrap { position: relative; }
.dropdown-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 9px);
  min-width: 224px;
  transform-origin: top right;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  z-index: 60;
}
@media (prefers-reduced-motion: no-preference) {
  .dropdown-menu:not(.hidden) { animation: show-menu 150ms var(--ease-out); }
  @keyframes show-menu { from { opacity: 0; transform: scale(0.97); } }
}
.dropdown-menu .btn {
  width: 100%;
  justify-content: flex-start;
  background: transparent;
  border-color: transparent;
}
.dropdown-menu .btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(255, 255, 255, 0.12);
}

.move-banner {
  position: fixed;
  top: var(--map-head-bottom, calc(var(--stage-top) + 62px));
  left: 50%;
  transform: translateX(-50%);
  z-index: 36;
  padding: 7px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-color: rgba(255, 209, 102, 0.55);
  background: rgba(42, 28, 14, 0.94);
  color: #fef3c7;
  font-size: 12px;
  max-width: calc(100vw - 24px);
}

/* ---------- Estúdio de Personalização & Performance ---------- */
.customize-panel {
  position: fixed;
  top: calc(var(--topbar-h, 62px) + 12px);
  right: 14px;
  width: 364px;
  max-width: calc(100vw - 24px);
  max-height: calc(100vh - 140px);
  overflow-y: auto;
  z-index: 46;
  padding: 13px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  border-color: rgba(167, 139, 250, 0.38);
}
.studio-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  background: rgba(8, 6, 20, 0.55);
  padding: 3px;
  border-radius: 11px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.studio-tab-btn {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 700;
  padding: 6px 4px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.studio-tab-btn.active { background: rgba(255, 209, 102, 0.18); color: var(--gold); }
.studio-pane { display: flex; flex-direction: column; gap: 9px; }
.theme-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
}
.theme-grid-3 { grid-template-columns: repeat(3, 1fr); }
.bg-mode-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
}
.theme-opt, .bg-mode-opt, .perf-opt {
  border: 1px solid rgba(255, 255, 255, 0.13);
  background: rgba(255, 255, 255, 0.045);
  color: var(--text);
  border-radius: 10px;
  padding: 7px 6px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  transition: background 0.15s, border-color 0.15s, transform 0.12s;
}
.theme-opt:hover, .bg-mode-opt:hover, .perf-opt:hover { background: rgba(255, 255, 255, 0.1); }
.theme-opt.active, .bg-mode-opt.active, .perf-opt.active {
  border-color: var(--gold);
  background: rgba(255, 209, 102, 0.17);
  color: var(--gold);
}
.slider-field { display: flex; flex-direction: column; gap: 3px; margin-bottom: 7px; }
.slider-field label { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); }
.slider-field label strong { color: var(--text); font-variant-numeric: tabular-nums; }
.slider-field input[type="range"] { width: 100%; accent-color: var(--gold); cursor: pointer; }
.chk-row { display: flex; align-items: center; gap: 8px; font-size: 11.5px; margin-top: 6px; cursor: pointer; line-height: 1.35; }
.btn:hover:not(:disabled) { background: rgba(255, 255, 255, 0.14); border-color: rgba(255, 255, 255, 0.28); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; }
.btn.active { background: rgba(255, 209, 102, 0.2); border-color: var(--gold); color: var(--gold); }
.btn.primary { background: var(--gold); border-color: transparent; color: #17130e; font-weight: 750; }
.btn.primary:hover:not(:disabled) { background: color-mix(in srgb, var(--gold) 82%, white); color: #17130e; }
.btn.cyan { background: rgba(56, 189, 248, 0.18); border-color: rgba(56, 189, 248, 0.5); color: #7dd3fc; }
.btn.danger { background: rgba(248, 113, 113, 0.15); border-color: rgba(248, 113, 113, 0.4); color: #fca5a5; }
.btn.sm { min-height: 34px; padding: 4px 8px; font-size: 0.8rem; border-radius: 8px; }
.btn.recording { background: rgba(244, 63, 94, 0.25); border-color: #fb7185; color: #ffe4e6; }

select, input[type="text"], input[type="email"], input[type="password"], input[type="number"], textarea {
  background: rgba(0, 0, 0, 0.26);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: var(--text);
  border-radius: 10px;
  padding: 7px 10px;
  font-size: 0.875rem;
  font-family: inherit;
  outline: none;
}
select:focus, input:focus, textarea:focus { border-color: var(--cyan); }

.map-search-dialog {
  inset: min(14vh, 120px) 0 auto;
  width: min(520px, calc(100% - 24px));
  max-height: 76dvh;
  margin: 0 auto;
  overflow: auto;
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 14px;
  color: var(--text);
  background: var(--panel-solid);
  box-shadow: 0 18px 55px rgba(0, 0, 0, 0.34);
}
.map-search-dialog::backdrop { background: rgba(8, 8, 10, 0.62); }
.map-search-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.map-search-head h2 { margin: 0; font-size: 1.12rem; letter-spacing: -0.025em; }
.map-search-input {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 45px;
  padding-inline: 10px;
  color: var(--muted);
  background: rgba(0, 0, 0, 0.24);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
}
.map-search-input:focus-within { outline: 2px solid var(--cyan); outline-offset: 2px; }
.map-search-input > input {
  min-width: 0;
  flex: 1;
  padding-block: 8px;
  color: var(--text);
  background: transparent;
  border: 0;
  outline: none;
  font-size: 1rem;
}
.map-search-results {
  display: grid;
  gap: 4px;
  max-height: 43dvh;
  overflow: auto;
  overscroll-behavior: contain;
  margin-top: 10px;
}
.map-search-result {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) minmax(0, 105px);
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 6px 9px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--text);
  background: transparent;
  cursor: pointer;
  text-align: left;
}
.map-search-result > .ico { color: var(--gold); }
.map-search-result strong, .map-search-result small { display: block; overflow-wrap: anywhere; }
.map-search-result strong { font-size: 0.89rem; }
.map-search-result small, .map-search-result-state { color: var(--muted); font-size: 0.78rem; }
.map-search-result-state { text-align: right; }
.map-search-result:focus-visible { outline: none; border-color: var(--cyan); background: rgba(255, 255, 255, 0.08); }
@media (hover: hover) { .map-search-result:hover { background: rgba(255, 255, 255, 0.08); } }
.map-search-status { margin: 9px 0 0; color: var(--muted); font-size: 0.8rem; }

/* ---------- Ficha Compacta Contextual do Quarto ---------- */
.agent-popover {
  position: fixed;
  z-index: 42;
  width: 292px;
  overflow-y: auto;
  max-width: calc(100vw - 24px);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-color: rgba(255, 209, 102, 0.35);
}
.popover-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}
.popover-title {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13.5px;
  font-weight: 800;
}
.popover-title h2 { margin: 0; font: inherit; overflow-wrap: anywhere; }
.popover-role {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
}
.popover-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 11px;
}
.popover-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 2px;
}

/* ---------- Painel Lateral Flutuante Sob Demanda (Harness & Inspetor) ---------- */
.drawer {
  position: fixed;
  top: var(--stage-top);
  right: var(--workspace-inset);
  bottom: var(--workspace-inset);
  width: var(--drawer-w, 396px);
  max-width: calc(100vw - 24px);
  z-index: 34;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: transform 210ms var(--ease-out), opacity 180ms var(--ease-out);
}
.drawer.collapsed {
  transform: translateX(calc(100% + 24px));
  opacity: 0;
  pointer-events: none;
}
.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 14px 8px;
  gap: 8px;
}
.drawer-title-group { display: grid; gap: 3px; min-width: 0; }
.drawer-title-group > span { color: var(--muted); font-size: 0.75rem; font-weight: 600; }
#drawer-title {
  font-size: 1rem;
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
}
.tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 6px 8px 8px;
  border-bottom: 1px solid var(--panel-border);
}
.tab-btn {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 0.79rem;
  font-weight: 700;
  min-height: 35px;
  padding: 5px 3px;
  border-radius: 9px;
  cursor: pointer;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active { background: rgba(244, 204, 122, 0.13); color: var(--gold); }

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overscroll-behavior: contain;
}
.drawer-body::-webkit-scrollbar { width: 6px; }
.drawer-body::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.16); border-radius: 99px; }

.card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 10px;
}
.card h4 { margin: 0 0 8px; font-size: 0.89rem; color: var(--text); display: flex; justify-content: space-between; align-items: center; gap: 6px; }

.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 8px; }
.field label { font-size: 0.8rem; color: var(--muted); font-weight: 600; }

.quick-list { display: flex; flex-direction: column; gap: 5px; max-height: 200px; overflow-y: auto; }
.quick-row {
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
  padding: 6px 8px; border-radius: 9px; background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.07); cursor: pointer; font-size: 11.5px; color: var(--text); text-align: left;
}
.quick-row:hover { border-color: var(--cyan); background: rgba(56, 189, 248, 0.1); }
.quick-row.active { border-color: var(--gold); background: rgba(255, 209, 102, 0.12); }

.swatch-row { display: flex; gap: 6px; flex-wrap: wrap; }
.swatch { width: 24px; height: 24px; border-radius: 8px; border: 2px solid transparent; cursor: pointer; }
.swatch.active { border-color: #fff; transform: scale(1.1); }

.list-item {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 9px;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.list-item-head { display: flex; justify-content: space-between; align-items: center; gap: 6px; font-size: 12px; }
.badge { font-size: 10px; font-weight: 800; padding: 2px 6px; border-radius: 6px; text-transform: uppercase; }
.badge.codex { background: rgba(251, 146, 60, 0.2); color: #fdba74; }
.badge.claude { background: rgba(192, 132, 252, 0.22); color: #e9d5ff; }
.badge.gemini { background: rgba(56, 189, 248, 0.2); color: #7dd3fc; }
.badge.ok { background: rgba(74, 222, 128, 0.18); color: #86efac; }
.badge.warn { background: rgba(251, 191, 36, 0.2); color: #fde68a; }
.badge.err { background: rgba(248, 113, 113, 0.2); color: #fca5a5; }

.quota-bar { height: 6px; border-radius: 99px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.quota-bar > div { height: 100%; background: linear-gradient(90deg, var(--cyan), var(--green)); }

.msg-bubble {
  padding: 8px 10px;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.05);
  border-left: 3px solid var(--gold);
  font-size: 12px;
  line-height: 1.42;
}
.msg-bubble.correcao { border-left-color: var(--cyan); }
.msg-bubble.resposta { border-left-color: var(--green); }
.msg-bubble.broadcast { border-left-color: var(--pink); }
.msg-meta { display: flex; justify-content: space-between; font-size: 10.5px; color: var(--muted); margin-bottom: 3px; }

/* ---------- Sub-abas, Código, Imagens e Ciclo ---------- */
.subtabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; margin-bottom: 8px; }
.subtab-btn {
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  border-radius: 8px;
  padding: 5px 6px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}
.subtab-btn.active { background: rgba(56, 189, 248, 0.18); border-color: rgba(56, 189, 248, 0.45); color: #e0f2fe; }

.code-block { margin: 6px 0; border-radius: 10px; background: #0b081c; border: 1px solid rgba(255, 255, 255, 0.12); overflow: hidden; }
.code-block-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 4px 8px; background: rgba(255, 255, 255, 0.05);
  font-size: 10px; color: var(--muted); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.code-block pre {
  margin: 0; padding: 8px 10px; overflow: auto; max-height: 190px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11.5px; line-height: 1.45; color: #e2e8f0; white-space: pre;
}

.att-grid { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.att-thumb {
  display: flex; flex-direction: column; gap: 3px; max-width: 136px;
  background: rgba(255, 255, 255, 0.04); border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 9px; padding: 4px; cursor: pointer;
}
.att-thumb img { width: 100%; height: 74px; object-fit: cover; border-radius: 6px; display: block; }
.att-thumb span { font-size: 10px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.dest-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap;
  font-size: 11.5px; padding: 5px 9px; border-radius: 9px;
  background: rgba(255, 209, 102, 0.1); border: 1px solid rgba(255, 209, 102, 0.25); color: #fef3c7;
}
.dest-bar.readonly { background: rgba(248, 113, 113, 0.12); border-color: rgba(248, 113, 113, 0.35); color: #fecaca; }

.caps-strip { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.cap-chip { font-size: 10px; padding: 2px 6px; border-radius: 6px; background: rgba(255, 255, 255, 0.06); color: var(--muted); }
.cap-chip.on { background: rgba(74, 222, 128, 0.15); color: #86efac; }

.delivery-badge { font-size: 10px; font-weight: 800; padding: 2px 7px; border-radius: 999px; white-space: nowrap; }
.delivery-badge.rascunho { background: rgba(148, 163, 184, 0.2); color: #cbd5e1; }
.delivery-badge.aceito_colmeia { background: rgba(251, 191, 36, 0.2); color: #fde68a; }
.delivery-badge.recebido_openbot { background: rgba(56, 189, 248, 0.2); color: #7dd3fc; }
.delivery-badge.em_execucao { background: rgba(192, 132, 252, 0.22); color: #e9d5ff; }
.delivery-badge.concluido { background: rgba(74, 222, 128, 0.2); color: #86efac; }
.delivery-badge.falha { background: rgba(248, 113, 113, 0.22); color: #fca5a5; }

/* ---------- Compositor Inferior Central (Chat real + Modo Missão separado) ---------- */
.dock-wrap {
  position: fixed;
  left: var(--workspace-inset);
  right: var(--stage-right);
  bottom: var(--workspace-inset);
  z-index: 32;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: calc(55dvh - var(--workspace-inset));
  overflow-x: hidden;
  overflow-y: auto;
  padding: 2px;
  margin-inline: -2px;
  padding-bottom: 2px;
  margin-bottom: -2px;
  scrollbar-width: thin;
}
.dock-wrap > * { flex: 0 0 auto; }
.dock-wrap > .recent-drawer { flex: 0 1 auto; min-height: 56px; }

.chat-att-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  border-radius: 10px;
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.3);
  font-size: 11px;
}
.chat-att-bar img {
  width: 34px;
  height: 34px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

/* ---------- Central de Pendências e Modal Avaliar Entrega ---------- */
.pending-panel {
  position: fixed;
  top: calc(var(--topbar-h, 62px) + 10px);
  left: 50%;
  transform: translateX(-50%);
  width: min(400px, calc(100vw - 24px));
  max-height: calc(100vh - 150px);
  overflow-y: auto;
  z-index: 46;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-color: rgba(255, 209, 102, 0.45);
}
.pending-item {
  width: 100%;
  text-align: left;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.045);
  color: var(--text);
  border-radius: 10px;
  padding: 8px 10px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
}
.pending-item:hover { background: rgba(255, 209, 102, 0.12); border-color: rgba(255, 209, 102, 0.4); }

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 130;
  background: rgba(8, 6, 20, 0.72);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal-card {
  width: min(420px, 100%);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  border-color: rgba(255, 209, 102, 0.42);
}
.btn.has-pending {
  background: rgba(255, 209, 102, 0.18);
  border-color: rgba(255, 209, 102, 0.55);
  color: var(--gold);
}

.recent-drawer {
  max-height: 240px;
  overflow-y: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.recent-drawer::-webkit-scrollbar { width: 6px; }
.recent-drawer::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.16); border-radius: 99px; }

.route-preview {
  display: grid;
  gap: 10px;
  padding: 11px 13px;
  border-color: rgba(244, 204, 122, 0.34);
}
.mission-feedback-head, .mission-feedback-title {
  display: flex;
  align-items: flex-start;
  gap: 9px;
}
.mission-feedback-head { justify-content: space-between; }
.mission-feedback-title { flex-wrap: wrap; min-width: 0; }
.mission-feedback-title .delivery-badge {
  margin-top: 2px;
  font-size: 0.73rem;
  white-space: normal;
}
.mission-feedback-title p { margin: 0; color: var(--muted); font-size: 0.79rem; }
.mission-feedback-title h2 { margin: 1px 0 0; font-size: 1rem; line-height: 1.3; overflow-wrap: anywhere; }
.mission-feedback-head > .btn { min-width: 34px; justify-content: center; }
.mission-plan-fields, .mission-delivery-fields dl {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px 12px;
  margin: 0;
}
.mission-delivery-fields dl { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.route-preview dt { color: var(--muted); font-size: 0.76rem; }
.route-preview dd { margin: 3px 0 0; font-size: 0.85rem; overflow-wrap: anywhere; }
#mission-delivery-detail { margin: 8px 0 0; color: var(--muted); font-size: 0.79rem; line-height: 1.35; }

@media (max-width: 780px) {
  .mission-plan-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.dock {
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.dock-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}
.mode-switch {
  display: inline-flex;
  background: rgba(0, 0, 0, 0.24);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  padding: 3px;
  gap: 3px;
}
.mode-btn {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
  padding: 5px 9px;
  min-height: 29px;
  border-radius: 7px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.mode-btn.active { background: rgba(255, 209, 102, 0.22); color: var(--gold); }

.dest-inline {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  color: var(--text);
  flex-wrap: wrap;
}
.dest-inline.readonly { color: #fca5a5; }

.dock-row {
  display: flex;
  gap: 7px;
  align-items: flex-end;
}
.dock-textarea {
  flex: 1;
  min-width: 0;
  resize: none;
  min-height: 42px;
  max-height: 110px;
  line-height: 1.4;
  padding: 8px 11px;
  font-size: 0.94rem;
}
.dock-controls {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
  font-size: 11px;
  color: var(--muted);
}
.dock-controls select { padding: 4px 7px; font-size: 0.8rem; }
.dock-row > .btn { min-height: 42px; justify-content: center; }
.dictation-status { font-size: 11px; color: #7dd3fc; }

/* Autenticação */
.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  overflow-y: auto;
  background: #141416;
  padding: clamp(12px, 4vw, 48px);
}
.auth-shell {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  width: min(1060px, 100%);
  min-height: min(650px, 82dvh);
  border: 1px solid #3b3732;
  border-radius: 24px;
  overflow: hidden;
  background: #1a191c;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.39);
}
.auth-art {
  background:
    linear-gradient(180deg, rgba(14, 12, 11, 0.03) 60%, rgba(14, 12, 11, 0.36)),
    url("../assets/colmeia-access.webp") center / cover no-repeat,
    radial-gradient(ellipse at 50% 45%, #3a2a1d, #1b1816 53%, #121113 88%);
  border-right: 1px solid #3b3732;
}
.auth-card {
  align-self: center;
  min-width: 0;
  padding: clamp(27px, 4vw, 60px);
}
.auth-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 32px; }
.auth-brand strong { font-size: 1.02rem; letter-spacing: -0.03em; }
.auth-card h1 { margin: 8px 0 9px; font-size: clamp(2.1rem, 3.3vw, 3rem); letter-spacing: -0.065em; line-height: 1.03; }
.auth-card p { margin: 0 0 23px; color: var(--muted); font-size: 1rem; line-height: 1.5; }
.auth-badge { display: inline-flex; align-items: center; gap: 6px; font-size: 0.78rem; color: #d9c7a4; }
.auth-badge .ico { width: 14px; height: 14px; }
.auth-card .field { gap: 6px; margin-bottom: 15px; }
.auth-card .field label { color: var(--text); font-size: 0.875rem; }
.auth-card input { width: 100%; min-height: 44px; font-size: 1rem; padding-inline: 12px; }
.auth-card .btn { min-height: 44px; }
.auth-card .btn.primary { margin-top: 4px; }

.otp-input { text-align: center; font-size: 26px !important; letter-spacing: 0.35em; font-weight: 800; padding: 12px !important; }
.dev-otp-box { background: rgba(56, 189, 248, 0.14); border: 1px dashed var(--cyan); color: #bae6fd; padding: 10px 12px; border-radius: 10px; font-size: 12px; margin-bottom: 12px; }
.err-text { color: var(--danger); font-size: 12px; min-height: 18px; margin-top: 6px; }

/* ---------- Lightbox e Toast ---------- */
.img-lightbox {
  position: fixed; inset: 0; z-index: 150; background: rgba(8, 6, 20, 0.9);
  display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 20px; gap: 10px;
}
.img-lightbox img { max-width: min(92vw, 900px); max-height: 78vh; border-radius: 12px; border: 1px solid rgba(255, 255, 255, 0.2); }

#toast {
  position: fixed; left: 50%; top: 68px; transform: translate(-50%, -14px) scale(0.97); opacity: 0; pointer-events: none; z-index: 120;
  background: var(--panel-solid); border: 1px solid rgba(244, 204, 122, 0.38); color: var(--text);
  padding: 9px 16px; border-radius: 12px; font-size: 12.5px; font-weight: 600;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  transition: opacity 150ms var(--ease-out), transform 150ms var(--ease-out);
}
#toast.on {
  opacity: 1;
  transform: translate(-50%, 0) scale(1);
  transition: opacity 240ms var(--ease-out), transform 240ms var(--ease-out);
}

.hidden { display: none !important; }
.mobile-nav { display: none; }

/* ---------- Prévia 3D interativa do robô, Upgrades, Fluxo, Tarefas e Harness ---------- */
.tabs.tabs-4 { grid-template-columns: repeat(4, 1fr); }
.tabs.tabs-4 .tab-btn { font-size: 10.5px; padding: 6px 2px; }
.tabs.tabs-5 { grid-template-columns: repeat(5, 1fr); }
.tabs.tabs-5 .tab-btn { font-size: 10.5px; padding: 6px 2px; }

.live-comm-ticker {
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 11.5px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-color: rgba(56, 189, 248, 0.36);
  cursor: pointer;
  transition: transform 0.16s ease, border-color 0.16s ease;
}
.live-comm-ticker:hover { border-color: var(--gold); transform: translateY(-1px); }
.live-comm-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 8px var(--cyan);
  flex: none;
}

.task-filter-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
}
.task-filter-btn {
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  border-radius: 8px;
  padding: 5px 4px;
  font-size: 10.5px;
  font-weight: 700;
  cursor: pointer;
}
.task-filter-btn.active { background: rgba(56, 189, 248, 0.18); border-color: rgba(56, 189, 248, 0.5); color: #e0f2fe; }

.harness-task-card {
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 13px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  transition: border-color 0.15s, background 0.15s;
}
.harness-task-card:hover { border-color: rgba(255, 209, 102, 0.35); background: rgba(255, 255, 255, 0.065); }
.harness-steps {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  margin-top: 2px;
}
.harness-step {
  font-size: 9.5px;
  font-weight: 700;
  text-align: center;
  padding: 3px 4px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
  border: 1px solid rgba(255, 255, 255, 0.07);
}
.harness-step.done { background: rgba(74, 222, 128, 0.16); border-color: rgba(74, 222, 128, 0.4); color: #86efac; }
.harness-step.active { background: rgba(56, 189, 248, 0.2); border-color: rgba(56, 189, 248, 0.55); color: #7dd3fc; }
.harness-step.err { background: rgba(248, 113, 113, 0.2); border-color: rgba(248, 113, 113, 0.5); color: #fca5a5; }

.delegate-checklist {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 5px;
  max-height: 180px;
  overflow-y: auto;
  padding: 4px;
  border-radius: 10px;
  background: rgba(17, 17, 19, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.1);
}
.delegate-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  padding: 5px 7px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
}
.delegate-item:hover { background: rgba(124, 203, 243, 0.12); }

.quick-row-actions {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.mini-crown-btn {
  border: 1px solid rgba(244, 204, 122, 0.35);
  background: rgba(244, 204, 122, 0.12);
  color: var(--gold);
  border-radius: 6px;
  padding: 2px 5px;
  font-size: 10px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
}
.mini-crown-btn:hover { background: rgba(244, 204, 122, 0.25); }

.robot-preview-box {
  background: radial-gradient(circle at 50% 25%, rgba(244, 204, 122, 0.10), rgba(18, 18, 22, 0.94));
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 12px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* ---------- Bloco humano "Júnior e equipe ao vivo" ---------- */
.live-orch-hub {
  border-color: rgba(244, 204, 122, 0.24);
  background: rgba(255, 255, 255, 0.035);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.live-working-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.live-work-chip {
  border: 1px solid rgba(115, 213, 160, 0.34);
  background: rgba(115, 213, 160, 0.10);
  color: #d1fae5;
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.live-work-chip i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
}
.live-work-chip:hover { border-color: var(--gold); }
.live-pair-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 9px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.08);
  cursor: pointer;
  text-align: left;
  color: var(--text);
  font-size: 11.5px;
  width: 100%;
}
.live-pair-row:hover { border-color: rgba(244, 204, 122, 0.42); background: rgba(255, 255, 255, 0.06); }
.landscape-only { display: none; }
.robot-preview-stage {
  width: 100%;
  height: 126px;
  border-radius: 9px;
  overflow: hidden;
  position: relative;
}
.robot-preview-canvas {
  width: 100%;
  height: 100%;
  display: block;
  cursor: grab;
  touch-action: none;
}
.robot-preview-canvas.grabbing { cursor: grabbing; }
.robot-preview-controls {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  justify-content: center;
}

.popover-subcard {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 209, 102, 0.34);
  border-radius: 10px;
  padding: 7px 8px;
  font-size: 11px;
  line-height: 1.4;
}
.upgrade-options-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
  margin-top: 6px;
}
.upgrade-opt-btn {
  border: 1px solid rgba(255, 209, 102, 0.35);
  background: rgba(255, 209, 102, 0.1);
  color: #fef3c7;
  border-radius: 8px;
  padding: 6px 5px;
  font-size: 10.5px;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  transition: background 0.15s, border-color 0.15s;
}
.upgrade-opt-btn:hover { background: rgba(255, 209, 102, 0.24); border-color: var(--gold); }

.notice-strip {
  margin: 0 0 8px;
  padding: 6px 8px;
  border-radius: 9px;
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.3);
  font-size: 11px;
  color: #bae6fd;
  line-height: 1.4;
}

.flow-current-task {
  background: rgba(17, 17, 20, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 10px;
  padding: 8px 9px;
  font-size: 12px;
  line-height: 1.45;
  margin-bottom: 7px;
}
.flow-highlights {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}
.flow-pill {
  font-size: 10.5px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
}
.flow-pill.em_andamento { background: rgba(56, 189, 248, 0.16); border-color: rgba(56, 189, 248, 0.45); color: #7dd3fc; }
.flow-pill.concluido { background: rgba(74, 222, 128, 0.16); border-color: rgba(74, 222, 128, 0.45); color: #86efac; }
.flow-pill.espera_acao { background: rgba(255, 209, 102, 0.18); border-color: rgba(255, 209, 102, 0.5); color: var(--gold); }

.flow-new-pill {
  width: 100%;
  justify-content: center;
  margin-bottom: 8px;
  position: sticky;
  top: 0;
  z-index: 6;
}
.flow-timeline {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.flow-item {
  border-radius: 11px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-left: 3px solid rgba(255, 255, 255, 0.25);
  font-size: 12px;
  line-height: 1.45;
}
.flow-item.bucket-em_andamento { border-left-color: var(--cyan); background: rgba(56, 189, 248, 0.08); }
.flow-item.bucket-concluido { border-left-color: var(--green); background: rgba(74, 222, 128, 0.07); }
.flow-item.bucket-espera_acao { border-left-color: var(--gold); background: rgba(255, 209, 102, 0.1); }
.flow-item.focused-resp { box-shadow: 0 0 0 2px rgba(74, 222, 128, 0.65); }
.flow-item.clickable-comm { cursor: pointer; transition: border-color 0.15s, background 0.15s; }
.flow-item.clickable-comm:hover { border-color: var(--cyan); background: rgba(56, 189, 248, 0.13); }
.comm-group-list { margin: 5px 0 0; padding-left: 14px; font-size: 11px; color: var(--muted); display: flex; flex-direction: column; gap: 3px; }
.flow-item-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
  font-size: 11px;
}

@container (max-width: 780px) {
  .map-actions .btn > span, .orch-caption { display: none; }
  .map-actions .btn { width: 36px; justify-content: center; padding-inline: 0; }
  .map-hint { display: none; }
}
@container (max-width: 520px) {
  .map-head { flex-direction: column; align-items: stretch; padding: 12px; }
  .map-controls { justify-content: space-between; }
  .map-foot { flex-wrap: wrap; padding: 7px 10px; }
  .map-view-tools { margin-left: auto; }
}
@container (max-width: 315px) {
  .orch-picker-wrap { flex: 1 1 100%; }
  .map-actions { margin-left: auto; }
  .map-key { gap: 6px 9px; }
  .map-foot { justify-content: flex-end; }
  .map-key { margin-right: auto; }
}

@media (max-width: 1100px) {
  .topbar { grid-template-columns: minmax(145px, 1fr) auto minmax(245px, 1fr); gap: 6px; }
  #btn-open-customize > span { display: none; }
}

@media (max-width: 880px) {
  :root { --topbar-h: 95px; }
  .topbar { grid-template-columns: minmax(145px, 1fr) auto; padding-block: 8px; }
  .operation-nav { grid-row: 2; grid-column: 1 / -1; }
}

@media (max-width: 780px) and (orientation: portrait) {
  :root {
    --workspace-inset: 8px;
    --workspace-gap: 6px;
    --topbar-h: calc(52px + max(6px, env(safe-area-inset-top)));
    --stage-right: var(--workspace-inset);
    --mobile-dock-bottom: calc(var(--mobile-nav-size) + var(--workspace-inset) + env(safe-area-inset-bottom));
    --stage-bottom: var(--mobile-dock-bottom);
  }

  .topbar {
    grid-template-columns: 1fr auto;
    column-gap: 6px;
    padding: max(6px, env(safe-area-inset-top)) 10px 6px;
  }
  .operation-nav { display: none; }
  .topbar .btn, .map-actions .btn { min-height: 36px; }
  .map-actions .btn { width: 38px; }
  .topbar-utilities { gap: 4px; }
  .connection-status { gap: 0; padding-right: 2px; }
  #pill-ws, #pill-vps { display: none; }
  .status-pill { padding-inline: 6px; }
  .brand-bar { gap: 7px; }
  .logo-hex { flex-basis: 30px; width: 30px; height: 30px; }
  .brand-txt strong { font-size: 0.9rem; }
  .brand-txt small { display: none; }
  #btn-toggle-drawer { display: none; }
  .orch-picker-label, #select-orchestrator { min-height: 32px; }
  #select-orchestrator { max-width: min(135px, 34vw); }
  #btn-top-new-agent { min-height: 32px; }
  .map-key { font-size: 0.72rem; }

  .mobile-nav {
    position: fixed;
    inset: auto var(--workspace-inset) calc(var(--workspace-inset) + env(safe-area-inset-bottom));
    z-index: 45;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
    padding: 5px;
  }
  .mobile-nav .btn { min-height: 42px; font-size: 11px; padding-inline: 4px; gap: 4px; }
  .map-zoom .btn { width: 40px; min-height: 40px; }
  .drawer {
    inset: var(--stage-top) var(--workspace-inset) var(--mobile-dock-bottom);
    width: auto;
    max-width: none;
  }
  .drawer-body { overflow-x: hidden; }
  .dock-wrap {
    inset: auto var(--workspace-inset) var(--mobile-dock-bottom);
    left: var(--workspace-inset);
    right: var(--workspace-inset);
    transform: none;
    width: auto;
    max-width: none;
    max-height: 50dvh;
  }
  .dock { padding: 8px; }
  .dock-row { flex-wrap: wrap; }
  .dock-textarea { flex: 1 1 100%; width: 100%; font-size: 0.95rem; min-height: 42px; }
  .dock-row .btn { flex: 1 1 auto; min-height: 40px; }
  .dock-controls select { max-width: 150px; }
  .dock-header .mode-switch { flex-wrap: nowrap; }

  /* Em pé: ao abrir Conversar, o mapa 3D fica vivo na parte de cima e o chat ancorado embaixo sobre a barra mobile! */
  body.mob-view-composer {
    --stage-bottom: calc(50dvh + var(--mobile-dock-bottom) + 6px);
  }
  body.mob-view-composer .map-foot { display: none; }
  body.mob-view-composer .map-title p { display: none; }
  body.mob-view-composer .recent-drawer { max-height: 155px; }
  body.mob-view-composer .live-comm-ticker { display: none; }

  body.mob-view-map .drawer,
  body.mob-view-map .dock-wrap,
  body.mob-view-inspector .dock-wrap,
  body.mob-view-tasks .dock-wrap,
  body.mob-view-composer .drawer { display: none !important; }

  body.mob-view-inspector .map-stage,
  body.mob-view-inspector .move-banner,
  body.mob-view-inspector .map-grid,
  body.mob-view-inspector #bg-canvas,
  body.mob-view-inspector #camada,
  body.mob-view-inspector #fps-badge,
  body.mob-view-inspector #c,
  body.mob-view-tasks .map-stage,
  body.mob-view-tasks .move-banner,
  body.mob-view-tasks .map-grid,
  body.mob-view-tasks #bg-canvas,
  body.mob-view-tasks #camada,
  body.mob-view-tasks #fps-badge,
  body.mob-view-tasks #c { display: none !important; }

  body.mob-view-inspector .drawer,
  body.mob-view-tasks .drawer { transform: none; opacity: 1; pointer-events: auto; }
}

/* ---------- Celular Deitado (Landscape): Split-Screen Mapa à esquerda + Conversa & Equipe ao vivo à direita ---------- */
@media (orientation: landscape) and (max-height: 540px) and (max-width: 1050px) {
  :root {
    --workspace-inset: 8px;
    --workspace-gap: 6px;
    --topbar-h: 42px;
    --landscape-pane-w: 44vw;
    --stage-right: calc(var(--landscape-pane-w) + 14px);
    --stage-bottom: 8px;
  }

  .landscape-only { display: inline-flex; }
  .mobile-nav { display: none !important; }

  .topbar {
    grid-template-columns: auto 1fr auto;
    height: 42px;
    padding: 4px max(10px, env(safe-area-inset-right)) 4px max(10px, env(safe-area-inset-left));
    gap: 6px;
  }
  .operation-nav { display: none; }
  .brand-txt small, #pill-ws, #pill-vps, #btn-open-customize > span { display: none; }
  .logo-hex { width: 26px; height: 26px; flex-basis: 26px; }
  .brand-txt strong { font-size: 0.84rem; }
  .topbar .btn { min-height: 30px; padding: 3px 8px; font-size: 11px; }

  .map-stage {
    top: calc(var(--topbar-h) + 6px);
    left: max(8px, env(safe-area-inset-left));
    right: var(--stage-right);
    bottom: 8px;
  }
  .map-head { padding: 6px 10px; gap: 6px; }
  .map-title h2, .map-title p, .orch-caption, .map-actions .btn > span { display: none; }
  .map-foot { display: none; }
  #btn-toggle-drawer { display: none; }

  .drawer {
    top: calc(var(--topbar-h) + 6px);
    right: max(8px, env(safe-area-inset-right));
    bottom: 122px;
    width: var(--landscape-pane-w);
    transform: none !important;
    opacity: 1 !important;
    pointer-events: auto !important;
  }
  .drawer-header { padding: 5px 8px 2px; }
  .drawer-body { padding: 7px; gap: 7px; overflow-x: hidden; }
  .tabs.tabs-5 .tab-btn { padding: 4px 2px; font-size: 10px; }

  .dock-wrap {
    left: auto;
    right: max(8px, env(safe-area-inset-right));
    bottom: 8px;
    transform: none;
    width: var(--landscape-pane-w);
    max-width: var(--landscape-pane-w);
    gap: 4px;
  }
  .dock-wrap .recent-drawer,
  .dock-wrap .live-comm-ticker { display: none !important; }
  .dock { padding: 6px 8px; gap: 5px; }
  .dock-header { gap: 4px; }
  .dock-header .mode-btn { padding: 3px 7px; font-size: 10px; }
  #btn-toggle-recent { display: none; }
  .dest-inline { font-size: 10.5px; }
  .dock-textarea { min-height: 36px; max-height: 52px; padding: 6px 8px; font-size: 12px; }
  .dock-row > .btn { min-height: 36px; padding: 4px 8px; font-size: 11px; }

  /* Botão "Mapa inteiro" no celular deitado recolhe a coluna direita para ver 100% dos quartos */
  body.landscape-full-map {
    --stage-right: max(8px, env(safe-area-inset-right));
  }
  body.landscape-full-map .drawer,
  body.landscape-full-map .dock-wrap { display: none !important; }
  body.landscape-full-map .map-foot { display: flex; padding: 5px 8px; }
}

@media (max-width: 720px) {
  .auth-shell { grid-template-columns: 1fr; width: min(440px, 100%); min-height: 0; }
  .auth-art { height: clamp(110px, 25dvh, 190px); border-right: 0; border-bottom: 1px solid #3b3732; background-position: center 46%; }
  .auth-brand { margin-bottom: 20px; }
}

@media (max-width: 410px) {
  .topbar { grid-template-columns: 1fr auto; }
  .topbar .status-pill { font-size: 0.69rem; }
  .brand-txt small { display: none; }
  .operation-nav .btn { padding-inline: 5px; gap: 4px; }
}

@media (max-width: 360px) {
  #pill-vps { display: none; }
}

@media (max-width: 360px) {
  .operation-nav { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .operation-nav .btn { justify-content: center; padding-inline: 2px; }
  .operation-nav .ico { display: none; }
}

@media (max-height: 530px) and (min-width: 781px) {
  .map-head, .map-foot { padding-block: 7px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ---------- Polimento Design Engineering (emil-design-eng — todos os 10 itens) ---------- */
.btn, .mode-btn, .tab-btn, .studio-tab-btn, .theme-opt, .bg-mode-opt, .perf-opt, .task-filter-btn, .live-work-chip, .live-pair-row {
  transition: transform 150ms var(--ease-out), background-color 160ms ease, border-color 160ms ease, color 160ms ease;
}
.btn:active:not(:disabled),
.mode-btn:active,
.tab-btn:active,
.live-work-chip:active,
.live-pair-row:active {
  transform: scale(0.97);
}
.drawer {
  transition: transform 280ms var(--ease-drawer), opacity 200ms var(--ease-out);
}
.drawer.dragging {
  transition: none !important;
  user-select: none;
}
.drawer-grab-bar {
  display: none;
  justify-content: center;
  padding: 7px 0 2px;
  cursor: grab;
  touch-action: none;
}
.drawer-grab-bar span {
  width: 38px;
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.24);
}
@media (max-width: 780px) and (orientation: portrait) {
  .drawer-grab-bar { display: flex; }
}

.customize-panel {
  transform-origin: top right;
  transition: transform 180ms var(--ease-out), opacity 160ms var(--ease-out);
}
.agent-popover {
  transform-origin: var(--pop-origin-x, 50%) var(--pop-origin-y, 20%);
  transition: transform 180ms var(--ease-out), opacity 160ms var(--ease-out);
}
.pending-panel {
  transform-origin: top center;
  transition: transform 180ms var(--ease-out), opacity 160ms var(--ease-out);
}
.modal-card {
  transform-origin: center;
  transition: transform 200ms var(--ease-out), opacity 180ms var(--ease-out);
}
@starting-style {
  .customize-panel:not(.hidden),
  .agent-popover:not(.hidden),
  .pending-panel:not(.hidden),
  .modal-card {
    opacity: 0;
    transform: scale(0.96);
  }
}

/* Indicador deslizante GPU (transform only) nas abas e seletor do compositor */
.tabs, .mode-switch { position: relative; }
.tab-pill-bg {
  position: absolute;
  left: 0;
  top: 4px;
  bottom: 4px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.11);
  pointer-events: none;
  z-index: 0;
  transform-origin: left center;
  transition: transform 200ms var(--ease-out);
}
.mode-switch .tab-pill-bg {
  top: 2px;
  bottom: 2px;
  border-radius: 999px;
  background: rgba(244, 204, 122, 0.20);
}
.tabs.has-pill .tab-btn,
.mode-switch.has-pill .mode-btn { position: relative; z-index: 1; background: transparent; }

/* Crossfade com blur sutil no estado do botão Enviar */
.btn-label-morph {
  display: inline-block;
  transition: filter 160ms ease, opacity 160ms ease;
}
.btn-label-morph.morphing {
  filter: blur(2px);
  opacity: 0.62;
}

/* Stagger curto e não-uniforme na entrada de itens ao abrir aba */
.stagger-enter {
  opacity: 0;
  transform: translateY(6px);
  animation: emilStaggerIn 220ms var(--ease-out) forwards;
}
.stagger-enter:nth-child(1) { animation-delay: 0ms; }
.stagger-enter:nth-child(2) { animation-delay: 35ms; }
.stagger-enter:nth-child(3) { animation-delay: 65ms; }
.stagger-enter:nth-child(4) { animation-delay: 90ms; }
.stagger-enter:nth-child(5) { animation-delay: 115ms; }
@keyframes emilStaggerIn {
  to { opacity: 1; transform: translateY(0); }
}

/* Ações por teclado instantâneas (0ms — estilo Raycast) */
body.kb-instant .drawer,
body.kb-instant .agent-popover,
body.kb-instant .customize-panel,
body.kb-instant .pending-panel,
body.kb-instant .modal-card,
body.kb-instant .tab-pill-bg {
  transition-duration: 0ms !important;
}

/* Padrão Hold-to-confirm com clip-path assimétrico (1.4s linear ao segurar, 200ms ease-out ao soltar) */
.hold-confirm {
  position: relative;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}
.hold-confirm > .hold-fill {
  position: absolute;
  inset: 0;
  background: rgba(248, 113, 113, 0.38);
  clip-path: inset(0 100% 0 0);
  pointer-events: none;
  transition: clip-path 200ms var(--ease-out);
  z-index: 0;
}
.hold-confirm.holding > .hold-fill {
  clip-path: inset(0 0 0 0);
  transition: clip-path 1400ms linear;
}
.hold-confirm > *:not(.hold-fill) { position: relative; z-index: 1; }

/* Gating de hover estritamente em dispositivos de mouse fino (zero hover grudado no touch) */
@media (hover: none), (pointer: coarse) {
  .btn:hover:not(:disabled),
  .etq:hover,
  .live-comm-ticker:hover,
  .quick-row:hover,
  .harness-task-card:hover,
  .live-pair-row:hover,
  .live-work-chip:hover,
  .flow-item.clickable-comm:hover,
  .pending-item:hover,
  .upgrade-opt-btn:hover,
  .theme-opt:hover,
  .bg-mode-opt:hover,
  .perf-opt:hover {
    transform: none;
    background-color: inherit;
    border-color: inherit;
  }
}

/* ---------- Formatação Markdown limpa nas respostas ---------- */
.md-p {
  margin: 0 0 6px;
  line-height: 1.5;
}
.md-p:last-child { margin-bottom: 0; }
.md-h {
  font-weight: 700;
  font-size: 12.5px;
  color: var(--gold);
  margin: 8px 0 4px;
  letter-spacing: 0.01em;
}
.md-h:first-child { margin-top: 0; }
.md-list {
  margin: 4px 0 7px;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  line-height: 1.48;
}
.md-list:last-child { margin-bottom: 0; }
.md-inline-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.88em;
  padding: 1px 5px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #f8e5b8;
}
#btn-follow-action.active {
  border-color: rgba(244, 204, 122, 0.52);
  background: rgba(244, 204, 122, 0.15);
  color: var(--gold);
}

/* ---------- Rede Multi-Colmeia (Constelação 3D, Cadeia de Aprovação & Entregas Finais) ---------- */
.hive-constellation-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 12px 7px;
  margin-bottom: auto;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(15, 15, 19, 0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  pointer-events: auto;
  flex-wrap: wrap;
}
.hive-chips-scroll {
  display: flex;
  align-items: center;
  gap: 5px;
  overflow-x: auto;
  scrollbar-width: none;
  min-width: 0;
  flex: 1 1 auto;
  padding-right: 4px;
}
.hive-chips-scroll::-webkit-scrollbar { display: none; }
.hive-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
  cursor: pointer;
  transition: transform 150ms var(--ease-out), background-color 160ms ease, border-color 160ms ease;
}
.hive-chip:active { transform: scale(0.97); }
.hive-chip.active {
  background: rgba(244, 204, 122, 0.14);
  border-color: var(--chip-accent, rgba(244, 204, 122, 0.55));
  color: #fff;
}
.hive-chip em {
  font-style: normal;
  font-size: 10px;
  opacity: 0.72;
  padding: 0 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}
.hive-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}
.hive-bar-actions {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}

/* Rótulo flutuante de cada Mini-Colmeia no mapa 3D */
.etq.council-lead {
  border-color: rgba(244, 204, 122, 0.45);
  background: rgba(22, 20, 28, 0.94);
  color: #fef3c7;
}

/* ---------- Zoom Semântico (LOD): visão ampla limpa; nomes completos aparecem ao aproximar ou no hover ---------- */
#camada[data-zoom-lod="far"] .etq:not(.orch):not(.council-lead):not(.selecionado):not(:hover):not(:focus-visible) {
  padding: 4px;
  gap: 0;
  border-radius: 50%;
  background: rgba(16, 16, 22, 0.88);
  border-color: rgba(255, 255, 255, 0.22);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}
#camada[data-zoom-lod="far"] .etq:not(.orch):not(.council-lead):not(.selecionado):not(:hover):not(:focus-visible) .nm {
  display: none;
}
#camada[data-zoom-lod="far"] .etq.council-lead:not(.selecionado):not(:hover):not(:focus-visible) {
  font-size: 9.5px;
  padding: 2px 7px 2px 5px;
  gap: 4px;
  z-index: 20;
}
#camada[data-zoom-lod="far"] .etq.council-lead:not(.selecionado):not(:hover):not(:focus-visible) .nm {
  max-width: 9ch;
}
#camada[data-zoom-lod="far"] .etq:hover,
#camada[data-zoom-lod="far"] .etq:focus-visible {
  z-index: 38;
  padding: 3px 9px 3px 7px;
  gap: 5px;
  border-radius: 999px;
  border-color: rgba(244, 204, 122, 0.72);
}
#camada[data-zoom-lod="far"] .etq:hover .nm,
#camada[data-zoom-lod="far"] .etq:focus-visible .nm {
  display: inline;
  max-width: 180px;
}
#camada[data-zoom-lod="mid"] .etq:not(.orch):not(.selecionado):not(:hover):not(:focus-visible) {
  font-size: 10px;
  padding: 2px 6px 2px 5px;
  gap: 4px;
}
#camada[data-zoom-lod="mid"] .etq:not(.orch):not(.selecionado):not(:hover):not(:focus-visible) .nm {
  max-width: 9.5ch;
}

/* Selo discreto de Modo Demonstração no topo */
body.is-demo-mode #btn-open-archived,
body.is-demo-mode .connection-status {
  display: none !important;
}
.demo-mode-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid rgba(244, 204, 122, 0.45);
  background: rgba(244, 204, 122, 0.14);
  color: var(--gold);
  font-size: 11px;
  font-weight: 600;
}
.demo-login-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 12px 0 10px;
  font-size: 11px;
  color: var(--muted);
}
.demo-login-divider::before,
.demo-login-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: rgba(255, 255, 255, 0.1);
}
.hive-cluster-badge {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 18;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--hive-accent, #ffd166) 65%, transparent);
  background: rgba(12, 12, 17, 0.94);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
  color: #f8fafc;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease, border-color 160ms ease;
}
.hive-cluster-badge.on {
  opacity: 1;
  pointer-events: auto;
}
.hive-cluster-badge.is-council {
  background: rgba(34, 26, 12, 0.92);
  color: var(--gold);
}
.hive-cluster-badge.active {
  border-color: var(--hive-accent, #ffd166);
  box-shadow: 0 0 0 1px var(--hive-accent, #ffd166);
}
.hive-cluster-badge .hive-dot {
  background: var(--hive-accent, #ffd166);
}
.hive-cluster-badge em {
  font-style: normal;
  font-size: 9.5px;
  opacity: 0.78;
}

/* Cadeia de aprovação (stepper visual) */
.chain-stepper {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  margin: 4px 0;
}
.chain-step {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
}
.chain-step.done {
  border-color: rgba(74, 222, 128, 0.4);
  background: rgba(74, 222, 128, 0.12);
  color: #86efac;
}
.chain-step.current {
  border-color: rgba(244, 204, 122, 0.58);
  background: rgba(244, 204, 122, 0.16);
  color: var(--gold);
}
.chain-step.rework {
  border-color: rgba(248, 113, 113, 0.55);
  background: rgba(248, 113, 113, 0.15);
  color: #fca5a5;
}
.chain-card.is-rework {
  border-color: rgba(248, 113, 113, 0.35);
}
.chain-card.is-final {
  border-color: rgba(74, 222, 128, 0.35);
}
.org-tpl-card {
  padding: 9px 10px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
}
.org-link-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  font-size: 11.5px;
}
.final-delivery-body {
  font-size: 12px;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 9px;
  padding: 8px 10px;
}
@media (max-width: 780px) and (orientation: portrait) {
  .hive-constellation-bar { padding: 5px 8px; gap: 5px; }
  .hive-bar-actions .btn { min-height: 28px; font-size: 10.5px; padding: 3px 7px; }
}
@media (orientation: landscape) and (max-height: 540px) and (max-width: 1050px) {
  .hive-constellation-bar { padding: 4px 8px; }
  .hive-bar-actions { display: none; }
}


/* ---------- Chat Dinâmico Ao Vivo + Prévia Visual Instagram + Lightbox ---------- */
.recent-drawer {
  max-height: 330px;
}
.chat-quick-bar {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
  padding: 2px 0 4px;
}
.chat-quick-pill {
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease, transform 120ms ease;
}
.chat-quick-pill:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: var(--pill-c, var(--gold));
}
.chat-quick-pill.active {
  background: rgba(244, 204, 122, 0.16);
  border-color: var(--pill-c, var(--gold));
  color: #fff;
}
.chat-quick-pill.is-cta {
  border-color: rgba(225, 48, 108, 0.55);
  background: rgba(225, 48, 108, 0.16);
  color: #fbcfe8;
}
.chat-quick-pill.is-cta:hover {
  background: rgba(225, 48, 108, 0.28);
}

.chat-delivery-card {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(52, 211, 153, 0.1);
  border: 1px solid rgba(52, 211, 153, 0.32);
}
.chat-delivery-thumb {
  width: 56px;
  height: 70px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  cursor: zoom-in;
  flex-shrink: 0;
}
.chat-inline-gallery {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 6px;
}
.chat-inline-img {
  width: 84px;
  height: 105px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  cursor: zoom-in;
}

.ig-preview-box {
  margin: 8px 0 10px;
  padding: 9px;
  border-radius: 12px;
  background: rgba(12, 10, 28, 0.72);
  border: 1px solid rgba(225, 48, 108, 0.34);
}
.ig-preview-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: #fbcfe8;
  font-weight: 700;
  margin-bottom: 7px;
}
.ig-preview-stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 180px;
}
.ig-preview-img {
  max-width: 100%;
  max-height: 360px;
  border-radius: 10px;
  object-fit: contain;
  border: 1px solid rgba(255, 255, 255, 0.14);
  cursor: zoom-in;
  background: #090814;
}
.ig-preview-caption-file {
  margin-top: 6px;
  font-size: 10.5px;
  color: var(--muted);
  text-align: center;
}
.ig-publish-bar {
  margin-top: 10px;
  padding: 10px;
  border-radius: 11px;
  background: rgba(225, 48, 108, 0.08);
  border: 1px solid rgba(225, 48, 108, 0.3);
}
.ig-publish-controls {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.ig-publish-controls select,
.ig-publish-controls input {
  flex: 1 1 160px;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(11, 10, 24, 0.8);
  color: var(--text);
  font-size: 11.5px;
}

.media-lightbox {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(6, 5, 16, 0.84);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.media-lightbox.hidden {
  display: none !important;
}
.media-lightbox-inner {
  max-width: min(92vw, 920px);
  max-height: 90dvh;
  padding: 12px;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.media-lightbox-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  font-size: 12.5px;
  color: var(--gold);
}
.media-lightbox-inner img {
  max-width: 100%;
  max-height: 78dvh;
  object-fit: contain;
  border-radius: 10px;
  background: #070612;
}
