/* ==========================================================================
   seurobô Design System — Estúdio de Avatares (Operate Mode)
   Tokens oficiais de DESIGNseurobo.md + padrões de acabamento Impeccable
   ========================================================================== */

:root {
  /* Cores oficiais seurobô */
  --color-primary: #1b54f0;
  --color-primary-hover: #1544c9;
  --color-primary-focus: #4f7dff;
  --color-primary-on-dark: #7ea2ff;
  --color-primary-tint: #e8eefe;

  --color-ink: #0c2a3c;
  --color-ink-soft: #3d5563;
  --color-ink-muted: #5a6e7a;

  --color-canvas: #ffffff;
  --color-areia: #f5eede;
  --color-nevoa: #f3f6f7;
  --color-noite-0: #071a26;
  --color-noite-1: #0c2a3c;
  --color-noite-2: #123447;

  --color-hairline: #dce3e7;
  --color-divider-soft: #ecf0f2;
  --color-hairline-on-dark: #24475a;
  --color-body-muted-on-dark: #a9bac4;

  --color-ok: #0b7a4b;
  --color-ok-tint: #e6f4ec;
  --color-ok-on-dark: #3ddc97;

  --color-warn: #9a5b00;
  --color-warn-tint: #fbf0dc;
  --color-warn-on-dark: #ffb84d;

  --color-error: #c22f2f;
  --color-error-hover: #a62626;
  --color-error-tint: #fbe9e9;
  --color-error-on-dark: #ff7a7a;

  /* Tipografia */
  --font-display: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-text: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  /* Espaçamento (base 4px) */
  --space-4: 4px;
  --space-8: 8px;
  --space-12: 12px;
  --space-16: 16px;
  --space-20: 20px;
  --space-24: 24px;
  --space-32: 32px;

  /* Raios */
  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --radius-pill: 9999px;
  --radius-full: 9999px;

  /* Sombras (somente elementos flutuantes) */
  --shadow-floating: 0 8px 32px rgba(7, 26, 38, 0.12);

  /* Movimento */
  --motion-fast: 120ms;
  --motion-base: 200ms;
  --motion-slow: 320ms;
  --motion-easing: cubic-bezier(0.2, 0, 0, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

::selection {
  background: var(--color-primary-tint);
  color: var(--color-ink);
}

html,
body {
  height: 100%;
  background: var(--color-nevoa);
  color: var(--color-ink);
  font-family: var(--font-text);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.4;
  letter-spacing: -0.1px;
  caret-color: var(--color-primary);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

:focus-visible {
  outline: 2px solid var(--color-primary-focus);
  outline-offset: 2px;
}

/* Scrollbar sutil alinhada à paleta Tinta/Névoa */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--color-hairline);
  border-radius: var(--radius-pill);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--color-ink-muted);
}

/* Ícones (traço 1.5px, pontas arredondadas) */
.icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-sm {
  width: 16px;
  height: 16px;
}

/* ==================== SHELL PRINCIPAL ==================== */

.app-shell {
  display: grid;
  grid-template-rows: 56px 1fr;
  height: 100vh;
}

/* app-topbar: branco 56px, linha inferior de fio */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-24);
  background: var(--color-canvas);
  border-bottom: 1px solid var(--color-hairline);
  z-index: 10;
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--space-16);
}

.brand-logo {
  height: 26px;
  width: auto;
  display: block;
}

.brand-sep {
  width: 1px;
  height: 20px;
  background: var(--color-hairline);
}

.brand-area {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.2px;
  color: var(--color-ink);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: var(--space-12);
}

/* Ponto de sinal (8px) — pulsa somente quando ativo */
@keyframes signalPulse {
  0% {
    transform: scale(1);
    opacity: 0.55;
  }
  100% {
    transform: scale(2.2);
    opacity: 0;
  }
}

.signal-dot {
  position: relative;
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background: var(--color-ink-muted);
  flex-shrink: 0;
}

.signal-dot::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--radius-full);
  background: inherit;
  opacity: 0;
  pointer-events: none;
}

/* status-badge: mono-label em MAIÚSCULAS, rounded.xs (6px) */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--space-8);
  padding: 5px 10px;
  border-radius: var(--radius-xs);
  background: var(--color-nevoa);
  color: var(--color-ink-muted);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: 0.9px;
  text-transform: uppercase;
}

.status-pill.connected {
  background: var(--color-ok-tint);
  color: var(--color-ok);
}

.status-pill.connected .signal-dot {
  background: var(--color-ok);
}

.status-pill.connected .signal-dot::after {
  animation: signalPulse 2000ms var(--motion-easing) infinite;
}

.status-pill.local {
  background: var(--color-primary-tint);
  color: var(--color-primary);
}

.status-pill.local .signal-dot {
  background: var(--color-primary);
}

.status-pill.local .signal-dot::after {
  animation: signalPulse 2000ms var(--motion-easing) infinite;
}

.status-pill.connecting {
  background: var(--color-warn-tint);
  color: var(--color-warn);
}

.status-pill.connecting .signal-dot {
  background: var(--color-warn);
}

.workspace {
  display: grid;
  grid-template-columns: 1fr 428px;
  min-height: 0;
  overflow: hidden;
  background: var(--color-nevoa);
}

/* ==================== COLUNA DO PALCO (OPERAR) ==================== */

.stage-column {
  display: flex;
  flex-direction: column;
  padding: var(--space-24);
  gap: var(--space-16);
  min-height: 0;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
}

.stage-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-16);
  flex-wrap: wrap;
}

.stage-title-group {
  display: flex;
  align-items: baseline;
  gap: var(--space-12);
  flex-wrap: wrap;
}

.stage-title {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.3px;
  color: var(--color-ink);
}

.telemetry-inline {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: 0.9px;
  text-transform: uppercase;
  color: var(--color-ink-muted);
  font-variant-numeric: tabular-nums;
}

.stage-telemetry-bar {
  display: flex;
  align-items: center;
  gap: var(--space-16);
}

.lip-meter-wrap {
  display: inline-flex;
  align-items: center;
  gap: var(--space-8);
}

.lip-bar-track {
  width: 64px;
  height: 6px;
  border-radius: var(--radius-pill);
  background: var(--color-hairline);
  overflow: hidden;
}

.lip-bar-fill {
  height: 100%;
  width: 0%;
  border-radius: var(--radius-pill);
  background: var(--color-primary);
  transition: width 40ms linear;
}

.latency-readout {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 400;
  color: var(--color-ink-soft);
  font-variant-numeric: tabular-nums;
  min-width: 52px;
  text-align: right;
}

/* Alerta de atenção (sem border-left grosso, respeitando craft-floor) */
.alert-banner {
  display: none;
  align-items: center;
  gap: var(--space-12);
  padding: 12px 16px;
  border-radius: var(--radius-md);
  background: var(--color-warn-tint);
  border: 1px solid #edd6ad;
  color: var(--color-warn);
  font-size: 13.5px;
  line-height: 1.45;
}

.alert-banner.visible {
  display: flex;
  justify-content: space-between;
}

.alert-banner-text {
  flex: 1;
}

/* Modal oficial seurobô: branco, rounded.xl 28px, padding 32px, max-width 480px, flutuante */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(7, 26, 38, 0.42);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-16);
  z-index: 80;
}

.modal-backdrop[hidden] {
  display: none;
}

.modal-card {
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--color-canvas);
  color: var(--color-ink);
  border-radius: var(--radius-xl);
  padding: var(--space-32);
  box-shadow: var(--shadow-floating);
  display: flex;
  flex-direction: column;
  gap: var(--space-16);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-12);
}

.modal-title {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.3px;
  color: var(--color-ink);
}

.modal-desc {
  font-size: 14px;
  color: var(--color-ink-soft);
  line-height: 1.5;
}

.modal-fields {
  display: flex;
  flex-direction: column;
  gap: var(--space-12);
}

.key-input-row {
  display: flex;
  align-items: center;
  gap: var(--space-8);
}

.key-input-row input,
.key-input-row select {
  flex: 1;
  min-width: 0;
}

.key-badge {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.6px;
  padding: 2px 7px;
  border-radius: var(--radius-xs);
  background: var(--color-nevoa);
  color: var(--color-ink-muted);
}

.key-badge.ok {
  background: var(--color-ok-tint);
  color: var(--color-ok);
}

.modal-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-8);
  padding-top: var(--space-8);
}

/* media-frame: rounded.xl (28px), 1px hairline, fundo noite-0 para o vídeo 3D */
.stage-wrapper {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.stage-frame {
  position: relative;
  width: 100%;
  max-height: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-xl);
  overflow: hidden;
  border: 1px solid var(--color-hairline);
  background: var(--color-noite-0);
}

#avatarCanvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* Lower-third discreto sobre o vídeo (Noite 0 a 80%, sem gradiente decorativo) */
.lower-third {
  position: absolute;
  left: 20px;
  bottom: 20px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  background: rgba(7, 26, 38, 0.84);
  border: 1px solid var(--color-hairline-on-dark);
  pointer-events: none;
}

.lower-third.hidden {
  display: none;
}

.lower-third-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background: var(--color-body-muted-on-dark);
  flex-shrink: 0;
}

.lower-third-name {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  color: var(--color-canvas);
  line-height: 1.2;
}

.lower-third-role {
  font-size: 12px;
  color: var(--color-body-muted-on-dark);
  margin-top: 2px;
}

/* Dock de controle humano (cartão plano branco rounded.lg 20px, sem sombra) */
.control-dock {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-12);
  padding: 14px 18px;
  border-radius: var(--radius-lg);
  background: var(--color-canvas);
  border: 1px solid var(--color-hairline);
  flex-wrap: wrap;
}

.dock-group {
  display: flex;
  align-items: center;
  gap: var(--space-8);
  flex-wrap: wrap;
}

/* ==================== BOTÕES (GRAMÁTICA DE APLICATIVO) ==================== */

.btn[hidden] {
  display: none !important;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-8);
  height: 36px;
  padding: 0 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-hairline);
  background: var(--color-canvas);
  color: var(--color-ink);
  font-family: var(--font-text);
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.1px;
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--motion-fast) var(--motion-easing),
    border-color var(--motion-fast) var(--motion-easing),
    color var(--motion-fast) var(--motion-easing),
    transform var(--motion-fast) var(--motion-easing);
}

.btn:hover:not(:disabled) {
  background: var(--color-nevoa);
  border-color: #c5d1d8;
}

.btn:active:not(:disabled) {
  transform: scale(0.97);
}

.btn:disabled {
  background: var(--color-nevoa);
  border-color: var(--color-hairline);
  color: var(--color-ink-muted);
  cursor: not-allowed;
}

/* button-app primário: Sinal #1b54f0, sem gradiente e sem sombra */
.btn-primary {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: var(--color-canvas);
}

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

.btn-primary:disabled {
  background: var(--color-hairline);
  border-color: var(--color-hairline);
  color: var(--color-ink-muted);
}

/* button-app-danger: vermelho de status apenas para parar/excluir */
.btn-danger {
  background: var(--color-error);
  border-color: var(--color-error);
  color: var(--color-canvas);
}

.btn-danger:hover:not(:disabled) {
  background: var(--color-error-hover);
  border-color: var(--color-error-hover);
}

.btn-danger-ghost {
  background: var(--color-canvas);
  border-color: var(--color-hairline);
  color: var(--color-error);
}

.btn-danger-ghost:hover:not(:disabled) {
  background: var(--color-error-tint);
  border-color: #f0c2c2;
}

.btn-active {
  background: var(--color-primary-tint);
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.btn-active:hover:not(:disabled) {
  background: #dce6fe;
  border-color: var(--color-primary);
}

.btn-sm {
  height: 32px;
  padding: 0 12px;
  font-size: 13px;
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--radius-sm);
}

.btn-icon-sm {
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: var(--radius-sm);
}

/* ==================== PAINEL DE CONTROLE LATERAL ==================== */

.sidebar {
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--color-hairline);
  background: var(--color-canvas);
  min-height: 0;
}

/* Barra fixa de seleção e persistência do robô */
.agent-bar {
  display: flex;
  align-items: center;
  gap: var(--space-8);
  padding: 12px 16px;
  border-bottom: 1px solid var(--color-divider-soft);
  background: var(--color-canvas);
}

.agent-bar select {
  flex: 1;
  min-width: 0;
  height: 36px;
  background: var(--color-canvas);
  border: 1px solid var(--color-hairline);
  border-radius: var(--radius-sm);
  color: var(--color-ink);
  font-family: var(--font-text);
  font-size: 13.5px;
  font-weight: 600;
  padding: 0 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  transition: border-color var(--motion-fast) var(--motion-easing);
}

.agent-bar select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-tint);
}

/* Navegação em abas (flex proporcional para respiro uniforme entre nomes curtos e longos) */
.tabs {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 0 16px;
  border-bottom: 1px solid var(--color-hairline);
  background: var(--color-canvas);
}

.tab-btn {
  position: relative;
  height: 42px;
  padding: 0 4px;
  border: none;
  background: transparent;
  color: var(--color-ink-muted);
  font-family: var(--font-text);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: color var(--motion-fast) var(--motion-easing);
}

.tab-btn:hover {
  color: var(--color-ink);
}

.tab-btn.active {
  color: var(--color-primary);
  font-weight: 600;
}

.tab-btn.active::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: var(--color-primary);
  border-radius: 2px 2px 0 0;
}

.tab-body {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-16);
  background: var(--color-nevoa);
  display: flex;
  flex-direction: column;
  gap: var(--space-16);
}

.tab-pane {
  display: none;
  flex-direction: column;
  gap: var(--space-16);
}

.tab-pane.active {
  display: flex;
}

/* app-card: branco, rounded.lg (20px), borda 1px hairline, padding 20px, sem sombra */
.section-card {
  background: var(--color-canvas);
  border: 1px solid var(--color-hairline);
  border-radius: var(--radius-lg);
  padding: var(--space-20);
  display: flex;
  flex-direction: column;
  gap: var(--space-12);
}

/* Títulos em frase normal Manrope 600 (sem maiúsculas nem kicker!) */
.section-title {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.2px;
  color: var(--color-ink);
}

/* Subgrupo plano dentro de um app-card (separado por divisor suave, nunca cartão aninhado!) */
.sub-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: var(--space-12);
  border-top: 1px solid var(--color-divider-soft);
}

.sub-group-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-ink);
}

/* Galeria dos 10 bonecos */
.persona-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-8);
  max-height: 256px;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 2px;
}

.choice-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  min-width: 0;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-hairline);
  background: var(--color-canvas);
  color: var(--color-ink);
  cursor: pointer;
  text-align: left;
  transition: background var(--motion-fast) var(--motion-easing),
    border-color var(--motion-fast) var(--motion-easing),
    transform var(--motion-fast) var(--motion-easing);
}

.choice-card:hover {
  background: var(--color-nevoa);
}

.choice-card:active {
  transform: scale(0.98);
}

.choice-card.active {
  border-color: var(--color-primary);
  background: var(--color-primary-tint);
}

.choice-swatch {
  width: 24px;
  height: 24px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
  border: 1px solid rgba(12, 42, 60, 0.14);
}

.choice-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.choice-card strong {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.choice-card.active strong {
  color: var(--color-primary);
}

.choice-card span {
  font-size: 11.5px;
  color: var(--color-ink-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Grade de chips (fundos, emoções, estados) */
.chip-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-8);
}

.chip-btn {
  min-height: 36px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-hairline);
  background: var(--color-canvas);
  color: var(--color-ink);
  font-family: var(--font-text);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: background var(--motion-fast) var(--motion-easing),
    border-color var(--motion-fast) var(--motion-easing),
    color var(--motion-fast) var(--motion-easing);
}

.chip-btn:hover {
  background: var(--color-nevoa);
}

.chip-btn.active {
  border-color: var(--color-primary);
  background: var(--color-primary-tint);
  color: var(--color-primary);
  font-weight: 600;
}

/* ==================== FORMULÁRIOS E TOGGLES ==================== */

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field label {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-ink);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-8);
}

.field-value-mono {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 400;
  color: var(--color-ink-muted);
  font-variant-numeric: tabular-nums;
}

.field input[type='text'],
.field input[type='url'],
.field input[type='password'],
.field select,
.field textarea {
  width: 100%;
  background: var(--color-canvas);
  border: 1px solid var(--color-hairline);
  border-radius: var(--radius-sm);
  color: var(--color-ink);
  font-family: var(--font-text);
  font-size: 14px;
  padding: 8px 12px;
  outline: none;
  transition: border-color var(--motion-fast) var(--motion-easing),
    box-shadow var(--motion-fast) var(--motion-easing);
}

.field input[type='text'],
.field input[type='url'],
.field input[type='password'],
.field select {
  height: 40px;
}

.field input::placeholder,
.field textarea::placeholder {
  color: var(--color-ink-muted);
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-tint);
}

.field textarea {
  min-height: 104px;
  resize: vertical;
  line-height: 1.5;
}

.field input[type='range'] {
  width: 100%;
  height: 20px;
  accent-color: var(--color-primary);
  cursor: pointer;
}

/* Toggle oficial seurobô: 40x24px pill, hairline -> primary, bolinha branca 20px */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-12);
  font-size: 14px;
  font-weight: 500;
  color: var(--color-ink);
  cursor: pointer;
}

.toggle-row input[type='checkbox'],
.py-tool-item input[type='checkbox'] {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  width: 40px;
  height: 24px;
  flex-shrink: 0;
  border-radius: var(--radius-pill);
  background: var(--color-hairline);
  cursor: pointer;
  transition: background var(--motion-base) var(--motion-easing);
}

.toggle-row input[type='checkbox']::after,
.py-tool-item input[type='checkbox']::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: var(--radius-full);
  background: var(--color-canvas);
  transition: transform var(--motion-base) var(--motion-easing);
}

.toggle-row input[type='checkbox']:checked,
.py-tool-item input[type='checkbox']:checked {
  background: var(--color-primary);
}

.toggle-row input[type='checkbox']:checked::after,
.py-tool-item input[type='checkbox']:checked::after {
  transform: translateX(16px);
}

/* ==================== FERRAMENTAS, LOGS E TRANSCRIÇÃO ==================== */

.helper-hint {
  font-size: 12.5px;
  color: var(--color-ink-soft);
  line-height: 1.45;
}

.helper-hint code {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--color-ink);
  background: var(--color-nevoa);
  padding: 2px 5px;
  border-radius: var(--radius-xs);
}

.tool-list {
  display: flex;
  flex-direction: column;
}

.py-tool-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-12);
  padding: 12px 0;
  border-bottom: 1px solid var(--color-divider-soft);
  cursor: pointer;
}

.py-tool-item:first-child {
  padding-top: 2px;
}

.py-tool-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.py-tool-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.py-tool-name {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--color-ink);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.py-tool-badge {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  padding: 2px 6px;
  border-radius: var(--radius-xs);
  background: var(--color-nevoa);
  color: var(--color-ink-soft);
}

.py-tool-desc {
  font-size: 12.5px;
  color: var(--color-ink-muted);
  line-height: 1.4;
}

/* Itens de webhook como blocos separados por divisor (sem cartão aninhado) */
.webhook-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 0;
  border-top: 1px solid var(--color-divider-soft);
}

.webhook-card:first-child {
  border-top: none;
  padding-top: 4px;
}

.webhook-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-8);
}

.webhook-row-2 {
  display: grid;
  grid-template-columns: 1fr 96px;
  gap: var(--space-8);
}

.param-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-8);
}

.param-row {
  display: grid;
  grid-template-columns: 1fr 92px 32px;
  gap: 6px;
  align-items: center;
}

.param-row input,
.param-row select {
  height: 34px !important;
  padding: 6px 8px !important;
  font-size: 12.5px !important;
}

.param-desc-row {
  display: flex;
  align-items: center;
  gap: var(--space-8);
  margin-top: 4px;
}

.param-desc-row input[type='text'] {
  flex: 1;
  height: 34px !important;
  padding: 6px 8px !important;
  font-size: 12.5px !important;
}

.template-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* Logs de atividade e transcrição */
.transcript-box,
.tool-log-box {
  background: var(--color-nevoa);
  border: 1px solid var(--color-divider-soft);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  min-height: 88px;
  max-height: 200px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 13px;
}

.transcript-empty {
  color: var(--color-ink-muted);
  font-size: 13px;
}

.transcript-item {
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: var(--color-canvas);
  border: 1px solid var(--color-hairline);
  line-height: 1.45;
}

.transcript-item.assistant {
  background: var(--color-primary-tint);
  border-color: #cfdcfe;
}

.transcript-role {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.7px;
  text-transform: uppercase;
  color: var(--color-ink-muted);
  margin-bottom: 3px;
}

.tool-log-entry {
  padding: 8px 10px;
  border-radius: var(--radius-xs);
  background: var(--color-canvas);
  border: 1px solid var(--color-hairline);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--color-ink);
  word-break: break-word;
  font-variant-numeric: tabular-nums;
}

.tool-log-entry.success {
  background: var(--color-ok-tint);
  border-color: #c2e3d1;
  color: var(--color-ok);
}

.tool-log-entry.error {
  background: var(--color-error-tint);
  border-color: #f0c2c2;
  color: var(--color-error);
}

.tool-log-entry.running {
  background: var(--color-warn-tint);
  border-color: #edd6ad;
  color: var(--color-warn);
}

.notes-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
}

.note-pill {
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: var(--color-ok-tint);
  color: var(--color-ink);
}

.note-pill strong {
  color: var(--color-ok);
  font-weight: 600;
}

/* URL OBS / Recall */
.recall-actions {
  display: flex;
  align-items: center;
  gap: var(--space-8);
  flex-wrap: wrap;
}

.recall-actions .btn-primary {
  flex: 1;
}

.recall-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-8);
}

.recall-bots-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-8);
}

.recall-bot-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--color-nevoa);
  border: 1px solid var(--color-divider-soft);
}

.recall-bot-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-8);
}

.recall-bot-name {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--color-ink);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recall-bot-url {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--color-ink-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recall-bot-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-8);
}

.recall-bot-meta {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--color-ink-muted);
  font-variant-numeric: tabular-nums;
}

.recall-code-block {
  margin: 0;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--color-nevoa);
  border: 1px solid var(--color-divider-soft);
  font-family: var(--font-mono);
  font-size: 11.5px;
  line-height: 1.45;
  color: var(--color-ink-soft);
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.code-copy-box {
  display: flex;
  gap: var(--space-8);
  align-items: center;
}

.code-copy-box input {
  flex: 1;
  font-family: var(--font-mono) !important;
  font-size: 12px !important;
  background: var(--color-nevoa) !important;
}

.guide-list {
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 13.5px;
  color: var(--color-ink-soft);
  line-height: 1.5;
}

.guide-list strong {
  color: var(--color-ink);
  font-weight: 600;
}

/* Toast oficial: surface-noite-0, texto branco, rounded.md (14px), shadow-floating */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(14px);
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--color-noite-0);
  color: var(--color-canvas);
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  opacity: 0;
  pointer-events: none;
  box-shadow: var(--shadow-floating);
  transition: opacity var(--motion-base) var(--motion-easing),
    transform var(--motion-base) var(--motion-easing);
  z-index: 99;
}

.toast::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background: var(--color-ok-on-dark);
  flex-shrink: 0;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ==================== MODO CALL / OBS (?mode=call) ==================== */

body.call-mode .topbar,
body.call-mode .sidebar,
body.call-mode .stage-header,
body.call-mode .control-dock,
body.call-mode .alert-banner {
  display: none !important;
}

body.call-mode .app-shell,
body.call-mode .workspace,
body.call-mode .stage-column,
body.call-mode .stage-wrapper {
  display: block;
  padding: 0;
  margin: 0;
  max-width: none;
  height: 100vh;
}

body.call-mode .stage-frame {
  width: 100vw;
  height: 100vh;
  max-height: none;
  aspect-ratio: auto;
  border-radius: 0;
  border: none;
}

.call-unlock-overlay {
  display: none;
}

body.call-mode .call-unlock-overlay.visible {
  display: flex;
  position: fixed;
  inset: 0;
  background: rgba(7, 26, 38, 0.52);
  align-items: center;
  justify-content: center;
  z-index: 50;
}

/* ==================== RESPONSIVO & ACESSIBILIDADE ==================== */

@media (max-width: 1023px) {
  html,
  body {
    overflow: auto;
  }

  .app-shell {
    height: auto;
    min-height: 100vh;
  }

  .workspace {
    grid-template-columns: 1fr;
    overflow: visible;
  }

  .stage-column {
    padding: var(--space-16);
  }

  .sidebar {
    border-left: none;
    border-top: 1px solid var(--color-hairline);
  }
}

@media (max-width: 767px) {
  .topbar {
    padding: 0 var(--space-16);
  }

  .brand-sep,
  .brand-area {
    display: none;
  }

  .btn {
    height: 44px;
  }

  .btn-sm {
    height: 40px;
  }

  .persona-grid {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
