/* ============================================================
   ZERO — Design System
   Dark premium · glassmorphism · presença digital animada
   ============================================================ */

:root {
  /* Paleta */
  --bg-0: #05070d;
  --bg-1: #0a0e18;
  --bg-2: #0e1422;
  --surface: rgba(18, 26, 42, 0.55);
  --surface-solid: #121a2a;
  --stroke: rgba(120, 160, 220, 0.14);
  --stroke-strong: rgba(120, 180, 240, 0.3);

  --txt-0: #eaf1ff;
  --txt-1: #aab8d4;
  --txt-2: #6b7a99;

  --cyan: #38e1d6;
  --cyan-soft: #5fe8df;
  --blue: #4a7dff;
  --violet: #8b6cff;
  --accent-grad: linear-gradient(135deg, #38e1d6 0%, #4a7dff 55%, #8b6cff 100%);

  --danger: #ff6b81;
  --ok: #46e5a0;

  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  --shadow-glow: 0 0 40px rgba(56, 225, 214, 0.25);

  --font-display: "Space Grotesk", system-ui, sans-serif;
  --font-body: "Inter", system-ui, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { height: 100%; }

body {
  font-family: var(--font-body);
  background: var(--bg-0);
  color: var(--txt-0);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  position: relative;
}

/* ---------- Fundo ---------- */
.bg-aurora {
  position: fixed; inset: 0; z-index: 0;
  background:
    radial-gradient(60% 50% at 20% 15%, rgba(74, 125, 255, 0.18), transparent 60%),
    radial-gradient(50% 45% at 85% 25%, rgba(139, 108, 255, 0.16), transparent 60%),
    radial-gradient(55% 50% at 60% 95%, rgba(56, 225, 214, 0.14), transparent 60%),
    var(--bg-0);
  animation: aurora 22s ease-in-out infinite alternate;
}
@keyframes aurora {
  0%   { filter: hue-rotate(0deg) saturate(1); transform: scale(1); }
  100% { filter: hue-rotate(18deg) saturate(1.15); transform: scale(1.06); }
}
.bg-grid {
  position: fixed; inset: 0; z-index: 0; opacity: 0.4;
  background-image:
    linear-gradient(rgba(120, 160, 220, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(120, 160, 220, 0.04) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(circle at 50% 40%, black, transparent 80%);
}

/* ---------- Glass ---------- */
.glass {
  background: var(--surface);
  backdrop-filter: blur(22px) saturate(1.2);
  -webkit-backdrop-filter: blur(22px) saturate(1.2);
  border: 1px solid var(--stroke);
  box-shadow: var(--shadow);
}

.is-hidden { display: none !important; }

/* ============================================================
   ORBE — Presença Digital
   ============================================================ */
.orb {
  position: relative;
  display: grid;
  place-items: center;
  --size: 64px;
  width: var(--size); height: var(--size);
  flex: 0 0 auto;
}
.orb--xs { --size: 30px; }
.orb--sm { --size: 84px; }
.orb--md { --size: 56px; }

.orb__core {
  position: absolute; inset: 22%;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 30%, #ffffff, var(--cyan-soft) 30%, var(--blue) 70%, #2a3a7a 100%);
  box-shadow: 0 0 24px rgba(56, 225, 214, 0.7), inset 0 0 14px rgba(255, 255, 255, 0.5);
  animation: corePulse 3.5s ease-in-out infinite;
}
@keyframes corePulse {
  0%, 100% { transform: scale(1); filter: brightness(1); }
  50%      { transform: scale(1.08); filter: brightness(1.18); }
}

.orb__ring {
  position: absolute; inset: 0;
  border-radius: 50%;
  border: 1.5px solid transparent;
  border-top-color: rgba(56, 225, 214, 0.7);
  border-bottom-color: rgba(74, 125, 255, 0.4);
  animation: spin linear infinite;
}
.orb__ring--1 { animation-duration: 6s; transform: rotateX(70deg); }
.orb__ring--2 { animation-duration: 9s; animation-direction: reverse; transform: rotateY(70deg); border-top-color: rgba(139, 108, 255, 0.6); }
.orb__ring--3 { animation-duration: 13s; transform: rotate(45deg); border-top-color: rgba(95, 232, 223, 0.5); }
@keyframes spin { to { transform: rotate(360deg); } }
.orb__ring--1 { animation-name: spin1; }
.orb__ring--2 { animation-name: spin2; }
@keyframes spin1 { to { transform: rotateX(70deg) rotate(360deg); } }
@keyframes spin2 { to { transform: rotateY(70deg) rotate(-360deg); } }

.orb__glow {
  position: absolute; inset: -20%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(56, 225, 214, 0.35), transparent 65%);
  filter: blur(8px);
  animation: glowPulse 3.5s ease-in-out infinite;
  z-index: -1;
}
@keyframes glowPulse {
  0%, 100% { opacity: 0.5; transform: scale(1); }
  50%      { opacity: 0.9; transform: scale(1.15); }
}

/* ============================================================
   ORBE — Estados Reativos
   ============================================================ */

/* Ouvindo: onda pulsante */
@keyframes orbWave {
  0%, 100% { transform: scale(1); }
  30%       { transform: scale(1.15); }
  70%       { transform: scale(0.91); }
}
.orb[data-state="listening"] .orb__core {
  animation: orbWave 1.1s ease-in-out infinite;
  background: radial-gradient(circle at 35% 30%, #fff, rgba(56,225,214,0.9) 30%, var(--cyan) 70%, #1a6060 100%);
}
.orb[data-state="listening"] .orb__ring { animation-duration: 1.8s !important; }
.orb[data-state="listening"] .orb__glow {
  background: radial-gradient(circle, rgba(56,225,214,0.7), transparent 65%);
  animation-duration: 1.1s;
}

/* Pensando: pulso rápido + violeta */
.orb[data-state="thinking"] .orb__core {
  animation-duration: 0.85s;
  background: radial-gradient(circle at 35% 30%, #fff, rgba(139,108,255,0.8) 30%, var(--violet,#8b6cff) 70%, #2a1a6a 100%);
}
.orb[data-state="thinking"] .orb__ring { animation-duration: 1.6s !important; }
.orb[data-state="thinking"] .orb__glow {
  background: radial-gradient(circle, rgba(139,108,255,0.65), transparent 65%);
  animation-duration: 0.85s;
}

/* Falando: reativo ao nível de áudio via --audio-level CSS var (0-1) */
.orb[data-state="speaking"] .orb__core {
  animation: none;
  background: radial-gradient(circle at 35% 30%, #fff, #8effe9 30%, var(--cyan) 70%, #1f7a72 100%);
  transform: scale(calc(1 + var(--audio-level, 0) * 0.38));
  filter: brightness(calc(1 + var(--audio-level, 0) * 0.45));
  transition: transform 0.055s linear, filter 0.055s linear;
}
.orb[data-state="speaking"] .orb__glow {
  animation: none;
  transform: scale(calc(1 + var(--audio-level, 0) * 0.6));
  opacity: calc(0.45 + var(--audio-level, 0) * 0.55);
  transition: transform 0.055s linear, opacity 0.055s linear;
}

/* ============================================================
   VOZ — Configurações UI
   ============================================================ */
.voz-current {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px; border-radius: var(--radius-sm);
  border: 1px solid var(--stroke); margin-bottom: 18px;
}
.voz-current__info { flex: 1; min-width: 0; }
.voz-current__info strong { display: block; font-size: 14px; color: var(--txt-0); }
.voz-current__info span  { font-size: 12px; color: var(--txt-2); }

.voz-providers {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 6px;
}
.voz-provider-card {
  display: flex; flex-direction: column; gap: 3px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--stroke); background: transparent;
  cursor: pointer; text-align: left; transition: 0.2s;
  color: var(--txt-0); font-family: var(--font-body);
}
.voz-provider-card:hover:not(.is-disabled) { border-color: var(--cyan); }
.voz-provider-card.is-active {
  border-color: var(--cyan);
  background: rgba(56,225,214,0.08);
}
.voz-provider-card.is-disabled { opacity: 0.45; cursor: not-allowed; }
.voz-provider-card strong { font-size: 13px; }
.voz-provider-card span   { font-size: 11px; color: var(--txt-2); line-height: 1.35; }

.voz-slider {
  width: 100%; height: 4px; border-radius: 2px; margin-top: 8px;
  accent-color: var(--cyan); cursor: pointer;
}
.voz-select {
  padding: 10px 12px; border-radius: var(--radius-sm);
  background: var(--surface); color: var(--txt-0);
  border: 1px solid var(--stroke); width: 100%; font-size: 13px;
}

/* ============================================================
   AUTENTICAÇÃO
   ============================================================ */
.auth-screen {
  position: relative; z-index: 2;
  height: 100%;
  display: grid;
  place-items: center;
  padding: 24px;
}
.auth-card {
  width: 100%; max-width: 420px;
  border-radius: var(--radius);
  padding: 38px 34px;
  animation: rise 0.6s cubic-bezier(0.2, 0.9, 0.3, 1);
}
@keyframes rise {
  from { opacity: 0; transform: translateY(18px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.auth-brand {
  display: flex; flex-direction: column; align-items: center;
  gap: 14px; margin-bottom: 26px; text-align: center;
}
.auth-brand__text h1 {
  font-family: var(--font-display);
  font-size: 34px; font-weight: 700; letter-spacing: 0.16em;
  background: var(--accent-grad);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.auth-brand__text p { color: var(--txt-1); font-size: 13.5px; margin-top: 2px; }

.auth-tabs {
  display: flex; gap: 6px; padding: 5px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--stroke);
  border-radius: var(--radius-sm);
  margin-bottom: 22px;
}
.auth-tab {
  flex: 1; padding: 10px; border: none; cursor: pointer;
  background: transparent; color: var(--txt-1);
  font-family: var(--font-body); font-size: 14px; font-weight: 600;
  border-radius: 9px; transition: 0.25s;
}
.auth-tab.is-active {
  background: var(--accent-grad); color: #04121a;
  box-shadow: var(--shadow-glow);
}

.auth-form { display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 7px; }
.field span { font-size: 12.5px; color: var(--txt-1); font-weight: 500; padding-left: 2px; }
.field input {
  padding: 13px 15px;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid var(--stroke);
  border-radius: var(--radius-sm);
  color: var(--txt-0); font-size: 15px; font-family: var(--font-body);
  transition: 0.2s;
}
.field input::placeholder { color: var(--txt-2); }
.field input:focus {
  outline: none;
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(56, 225, 214, 0.14);
}

.auth-error { color: var(--danger); font-size: 13px; text-align: center; min-height: 18px; }
.auth-foot { color: var(--txt-2); font-size: 12px; text-align: center; margin-top: 8px; }

/* ============================================================
   BOTÕES
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 18px; border: none; cursor: pointer;
  font-family: var(--font-body); font-size: 14.5px; font-weight: 600;
  border-radius: var(--radius-sm); transition: 0.2s;
  color: var(--txt-0);
}
.btn--block { width: 100%; }
.btn--primary {
  background: var(--accent-grad); color: #04121a; font-weight: 700;
  box-shadow: 0 8px 24px rgba(56, 225, 214, 0.22);
}
.btn--primary:hover { transform: translateY(-1px); box-shadow: 0 12px 30px rgba(56, 225, 214, 0.34); }
.btn--primary:active { transform: translateY(0); }
.btn--primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn--ghost {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--stroke);
  color: var(--txt-1); font-size: 13px; padding: 9px 14px;
}
.btn--ghost:hover { border-color: var(--stroke-strong); color: var(--txt-0); }
.icon-btn {
  display: grid; place-items: center; width: 36px; height: 36px;
  border: none; background: transparent; color: var(--txt-2);
  border-radius: 9px; cursor: pointer; transition: 0.2s;
}
.icon-btn:hover { background: rgba(255, 255, 255, 0.05); color: var(--txt-0); }

/* ============================================================
   APP SHELL
   ============================================================ */
.app {
  position: relative; z-index: 2;
  height: 100%;
  display: grid;
  grid-template-columns: 264px 1fr;
  gap: 16px;
  padding: 16px;
}

/* ---------- Sidebar ---------- */
.sidebar {
  border-radius: var(--radius);
  padding: 18px 16px;
  display: flex; flex-direction: column;
  gap: 18px;
  overflow: hidden;
}
.sidebar__brand {
  display: flex; align-items: center; gap: 10px;
  padding: 4px 6px 14px;
  border-bottom: 1px solid var(--stroke);
}
.sidebar__brand span {
  font-family: var(--font-display); font-weight: 700;
  font-size: 19px; letter-spacing: 0.18em;
  background: var(--accent-grad); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav__item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 13px; border: none; cursor: pointer;
  background: transparent; color: var(--txt-1);
  font-family: var(--font-body); font-size: 14.5px; font-weight: 500;
  border-radius: var(--radius-sm); transition: 0.18s; text-align: left;
}
.nav__item svg { color: var(--txt-2); transition: 0.18s; }
.nav__item:hover { background: rgba(255, 255, 255, 0.04); color: var(--txt-0); }
.nav__item.is-active {
  background: linear-gradient(100deg, rgba(56, 225, 214, 0.16), rgba(74, 125, 255, 0.08));
  color: var(--txt-0); box-shadow: inset 0 0 0 1px var(--stroke-strong);
}
.nav__item.is-active svg { color: var(--cyan); }

.sidebar__context { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.ctx-title { font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--txt-2); padding: 4px 6px; }
.ctx-item {
  padding: 9px 11px; background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--stroke); border-radius: 10px;
  font-size: 13px; color: var(--txt-1); line-height: 1.4;
}
.ctx-item strong { color: var(--txt-0); font-weight: 600; display: block; font-size: 12.5px; }
.ctx-empty { color: var(--txt-2); font-size: 12.5px; padding: 8px 6px; font-style: italic; }

.sidebar__user {
  display: flex; align-items: center; gap: 10px;
  padding-top: 14px; border-top: 1px solid var(--stroke);
}
.avatar {
  width: 38px; height: 38px; border-radius: 11px;
  display: grid; place-items: center; flex: 0 0 auto;
  background: var(--accent-grad); color: #04121a;
  font-family: var(--font-display); font-weight: 700; font-size: 16px;
}
.sidebar__user-info { flex: 1; min-width: 0; }
.sidebar__user-info strong { display: block; font-size: 13.5px; color: var(--txt-0); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar__user-info span { font-size: 11.5px; color: var(--txt-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }

/* ---------- Stage ---------- */
.stage {
  border-radius: var(--radius);
  position: relative;
  overflow: hidden;
  background: var(--surface);
  backdrop-filter: blur(22px) saturate(1.2);
  -webkit-backdrop-filter: blur(22px) saturate(1.2);
  border: 1px solid var(--stroke);
  box-shadow: var(--shadow);
}
.view { display: none; height: 100%; flex-direction: column; }
.view.is-active { display: flex; }

.stage__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 22px; border-bottom: 1px solid var(--stroke);
  flex: 0 0 auto;
}
.stage__head--simple { flex-direction: row; align-items: flex-end; }
.stage__head--simple h2 { font-family: var(--font-display); font-size: 21px; font-weight: 600; }
.stage__head--simple p { color: var(--txt-2); font-size: 13px; margin-top: 2px; }

.presence { display: flex; align-items: center; gap: 12px; }
.presence__text strong { font-family: var(--font-display); font-size: 16px; letter-spacing: 0.04em; }
.presence__text span { display: block; font-size: 12.5px; color: var(--cyan); margin-top: 1px; }

/* ---------- Chat ---------- */
.chat {
  flex: 1; overflow-y: auto;
  padding: 28px 22px;
  display: flex; flex-direction: column; align-items: center; gap: 20px;
  scroll-behavior: smooth;
}
.msg { display: flex; gap: 12px; width: 100%; max-width: 760px; animation: msgIn 0.4s cubic-bezier(0.2, 0.9, 0.3, 1); }
@keyframes msgIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.msg--zero { justify-content: flex-start; }
.msg--user { justify-content: flex-end; flex-direction: row-reverse; }
.msg__avatar {
  width: 32px; height: 32px; border-radius: 10px; flex: 0 0 auto;
  display: grid; place-items: center; font-size: 13px; font-weight: 700;
  font-family: var(--font-display);
}
.msg--zero .msg__avatar { background: var(--accent-grad); color: #04121a; }
.msg--user .msg__avatar { background: rgba(255, 255, 255, 0.08); color: var(--txt-1); border: 1px solid var(--stroke); }
.msg__bubble {
  padding: 13px 16px; border-radius: 16px; max-width: 82%;
  font-size: 14.5px; line-height: 1.6; color: var(--txt-0);
  white-space: pre-wrap; word-break: break-word;
}
.msg--zero .msg__bubble {
  background: rgba(56, 225, 214, 0.07);
  border: 1px solid rgba(56, 225, 214, 0.16);
  border-top-left-radius: 4px;
}
.msg--user .msg__bubble {
  background: rgba(74, 125, 255, 0.12);
  border: 1px solid rgba(74, 125, 255, 0.2);
  border-top-right-radius: 4px;
}
.msg__bubble strong { color: #fff; font-weight: 600; }
.msg__bubble code {
  background: rgba(0, 0, 0, 0.35); padding: 2px 6px; border-radius: 6px;
  font-family: ui-monospace, monospace; font-size: 13px; color: var(--cyan-soft);
}

/* Indicador de digitação */
.typing { display: flex; gap: 5px; padding: 4px 2px; }
.typing span {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--cyan); opacity: 0.5;
  animation: typing 1.2s infinite ease-in-out;
}
.typing span:nth-child(2) { animation-delay: 0.18s; }
.typing span:nth-child(3) { animation-delay: 0.36s; }
@keyframes typing { 0%, 60%, 100% { transform: translateY(0); opacity: 0.4; } 30% { transform: translateY(-5px); opacity: 1; } }

/* Estado vazio / boas-vindas */
.welcome {
  margin: auto; text-align: center; max-width: 460px;
  display: flex; flex-direction: column; align-items: center; gap: 18px;
  padding: 30px;
}
.welcome h2 { font-family: var(--font-display); font-size: 26px; font-weight: 600; }
.welcome p { color: var(--txt-1); font-size: 14.5px; line-height: 1.6; }
.suggestions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 6px; }
.chip {
  padding: 10px 15px; border-radius: 999px; cursor: pointer;
  background: rgba(255, 255, 255, 0.04); border: 1px solid var(--stroke);
  color: var(--txt-1); font-size: 13px; transition: 0.2s;
}
.chip:hover { border-color: var(--cyan); color: var(--txt-0); background: rgba(56, 225, 214, 0.08); }

/* ---------- Composer ---------- */
.composer {
  flex: 0 0 auto; display: flex; align-items: flex-end; gap: 10px;
  width: 100%; max-width: 800px; margin: 0 auto;
  padding: 14px 18px 18px;
}
.composer textarea {
  flex: 1; resize: none; max-height: 140px;
  padding: 13px 16px; background: rgba(0, 0, 0, 0.28);
  border: 1px solid var(--stroke); border-radius: 14px;
  color: var(--txt-0); font-size: 14.5px; font-family: var(--font-body); line-height: 1.5;
  transition: 0.2s;
}
.composer textarea::placeholder { color: var(--txt-2); }
.composer textarea:focus { outline: none; border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(56, 225, 214, 0.12); }
.btn--send { width: 48px; height: 48px; padding: 0; border-radius: 14px; flex: 0 0 auto; }

/* ---------- Listas (memória/tarefas/notas) ---------- */
.list { flex: 1; overflow-y: auto; padding: 18px 22px; display: flex; flex-direction: column; gap: 11px; }
.card {
  padding: 15px 17px; border-radius: 14px;
  background: rgba(0, 0, 0, 0.2); border: 1px solid var(--stroke);
  transition: 0.2s; animation: msgIn 0.35s ease;
}
.card:hover { border-color: var(--stroke-strong); transform: translateY(-1px); }
.card__top { display: flex; align-items: center; gap: 10px; margin-bottom: 7px; }
.tag {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.08em;
  padding: 3px 9px; border-radius: 999px; font-weight: 600;
  background: rgba(56, 225, 214, 0.14); color: var(--cyan-soft);
}
.tag--task { background: rgba(74, 125, 255, 0.14); color: #9bb6ff; }
.tag--high { background: rgba(255, 107, 129, 0.16); color: var(--danger); }
.card__title { font-size: 15px; font-weight: 600; color: var(--txt-0); flex: 1; }
.card__body { font-size: 13.5px; color: var(--txt-1); line-height: 1.55; }
.card__meta { font-size: 11.5px; color: var(--txt-2); margin-top: 8px; }
.card--done .card__title { text-decoration: line-through; color: var(--txt-2); }
.card__check {
  width: 22px; height: 22px; border-radius: 7px; cursor: pointer; flex: 0 0 auto;
  border: 1.5px solid var(--stroke-strong); background: transparent;
  display: grid; place-items: center; transition: 0.2s; color: transparent;
}
.card__check.is-done { background: var(--ok); border-color: var(--ok); color: #04121a; }

.quick-add { display: flex; gap: 8px; }
.quick-add input {
  padding: 10px 14px; background: rgba(0, 0, 0, 0.28);
  border: 1px solid var(--stroke); border-radius: 11px;
  color: var(--txt-0); font-size: 14px; font-family: var(--font-body); min-width: 220px;
}
.quick-add input:focus { outline: none; border-color: var(--cyan); }

.list-empty {
  margin: auto; text-align: center; color: var(--txt-2);
  display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 40px;
}
.list-empty svg { opacity: 0.4; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--surface-solid); border: 1px solid var(--stroke-strong);
  color: var(--txt-0); padding: 13px 20px; border-radius: 12px;
  font-size: 13.5px; box-shadow: var(--shadow); z-index: 50;
  opacity: 0; pointer-events: none; transition: 0.3s; max-width: 90vw;
}
.toast.is-show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast--error { border-color: rgba(255, 107, 129, 0.5); }

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: rgba(120, 160, 220, 0.18); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: rgba(120, 160, 220, 0.3); }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- Responsivo ---------- */
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 16px; top: 16px; bottom: 16px; width: 240px; z-index: 30; transform: translateX(-110%); transition: 0.3s; }
  .sidebar.is-open { transform: translateX(0); }
  .msg { max-width: 92%; }
}

/* ============================================================
   VOICE MODE
   ============================================================ */

/* Botão mic no composer */
.btn--mic {
  width: 48px; height: 48px; padding: 0; border-radius: 14px; flex: 0 0 auto;
  background: rgba(56, 225, 214, 0.1); border: 1px solid var(--stroke-strong);
  color: var(--cyan); transition: 0.2s;
}
.btn--mic:hover { background: rgba(56, 225, 214, 0.18); transform: scale(1.05); }
.btn--mic.is-active {
  background: var(--accent-grad); color: #04121a;
  box-shadow: 0 0 20px rgba(56, 225, 214, 0.4);
  animation: micPulse 1.5s ease-in-out infinite;
}
@keyframes micPulse {
  0%, 100% { box-shadow: 0 0 20px rgba(56, 225, 214, 0.4); }
  50%       { box-shadow: 0 0 36px rgba(56, 225, 214, 0.7); }
}

/* Overlay de modo voz */
.voice-mode {
  position: fixed; inset: 0; z-index: 100;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at 50% 40%, rgba(10, 14, 24, 0.96), rgba(5, 7, 13, 0.99));
  backdrop-filter: blur(30px);
  animation: voiceIn 0.4s cubic-bezier(0.2, 0.9, 0.3, 1);
}
@keyframes voiceIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* Centro com orbe */
.voice-center {
  display: flex; flex-direction: column; align-items: center; gap: 28px;
  flex: 1; justify-content: center;
  padding: 40px 24px 0;
}

/* Orbe grande de voz */
.orb--voice { --size: 200px; }

/* Ondas de escuta (expandem para fora) */
.orb__listen-ring {
  position: absolute; inset: 0; border-radius: 50%;
  border: 1.5px solid rgba(56, 225, 214, 0);
  pointer-events: none;
}
.orb__listen-ring--1 { animation: listenWave 2.2s ease-out infinite 0s; }
.orb__listen-ring--2 { animation: listenWave 2.2s ease-out infinite 0.5s; }
.orb__listen-ring--3 { animation: listenWave 2.2s ease-out infinite 1s; }
@keyframes listenWave {
  0%   { transform: scale(1);    border-color: rgba(56, 225, 214, 0.8); opacity: 1; }
  100% { transform: scale(1.85); border-color: rgba(56, 225, 214, 0);   opacity: 0; }
}

/* As ondas só aparecem no estado listening */
.orb--voice .orb__listen-ring { display: none; }
.orb--voice[data-state="listening"] .orb__listen-ring { display: block; }

/* Ondas de fala (speaking) */
.orb__speak-wave {
  position: absolute; inset: 0; border-radius: 50%;
  border: 2px solid rgba(95, 232, 223, 0);
  pointer-events: none;
}
.orb__speak-wave--1 { animation: speakWave 1.4s ease-out infinite 0s; }
.orb__speak-wave--2 { animation: speakWave 1.4s ease-out infinite 0.35s; }
.orb__speak-wave--3 { animation: speakWave 1.4s ease-out infinite 0.7s; }
@keyframes speakWave {
  0%   { transform: scale(1);   border-color: rgba(95, 232, 223, 0.6); opacity: 1; }
  100% { transform: scale(2.1); border-color: rgba(95, 232, 223, 0);   opacity: 0; }
}

.orb--voice .orb__speak-wave { display: none; }
.orb--voice[data-state="speaking"] .orb__speak-wave { display: block; }

/* Estados do orbe VOICE */

/* LISTENING — cyan brilhante, reativo ao volume */
.orb--voice[data-state="listening"] .orb__core {
  animation-duration: 0.7s;
  background: radial-gradient(circle at 35% 30%, #fff, #b8fffc 25%, var(--cyan) 65%, #0b5c58 100%);
  box-shadow: 0 0 50px rgba(56, 225, 214, 0.9), inset 0 0 24px rgba(255, 255, 255, 0.6);
}
.orb--voice[data-state="listening"] .orb__ring {
  border-top-color: rgba(56, 225, 214, 1) !important;
  border-bottom-color: rgba(95, 232, 223, 0.6) !important;
}
.orb--voice[data-state="listening"] .orb__ring--1 { animation-duration: 1.8s; }
.orb--voice[data-state="listening"] .orb__ring--2 { animation-duration: 2.8s; }
.orb--voice[data-state="listening"] .orb__ring--3 { animation-duration: 4s; }
.orb--voice[data-state="listening"] .orb__glow {
  background: radial-gradient(circle, rgba(56, 225, 214, 0.55), transparent 65%);
  transform: scale(calc(1 + var(--audio-level, 0) * 1.5));
  transition: transform 0.08s;
  animation: none;
  opacity: 0.9;
}

/* THINKING — violeta energético */
.orb--voice[data-state="thinking"] .orb__core {
  animation-duration: 0.5s;
  background: radial-gradient(circle at 35% 30%, #fff, #dac8ff 25%, var(--violet) 65%, #1a0b4a 100%);
  box-shadow: 0 0 50px rgba(139, 108, 255, 0.9), inset 0 0 24px rgba(255, 255, 255, 0.5);
}
.orb--voice[data-state="thinking"] .orb__ring--1 { animation-duration: 1s; border-top-color: rgba(139, 108, 255, 0.9) !important; }
.orb--voice[data-state="thinking"] .orb__ring--2 { animation-duration: 1.5s; border-top-color: rgba(74, 125, 255, 0.7) !important; }
.orb--voice[data-state="thinking"] .orb__ring--3 { animation-duration: 2s; border-top-color: rgba(56, 225, 214, 0.5) !important; }
.orb--voice[data-state="thinking"] .orb__glow {
  background: radial-gradient(circle, rgba(139, 108, 255, 0.6), transparent 65%);
  animation: thinkingGlow 0.5s ease-in-out infinite;
}
@keyframes thinkingGlow {
  0%, 100% { opacity: 0.5; transform: scale(1); }
  50%       { opacity: 1;   transform: scale(1.3); }
}

/* SPEAKING — verde-cyan com ondas */
.orb--voice[data-state="speaking"] .orb__core {
  animation-name: speakingCore;
  animation-duration: 0.4s;
  background: radial-gradient(circle at 35% 30%, #fff, #96fff7 25%, #1adfd4 65%, #085e59 100%);
  box-shadow: 0 0 55px rgba(26, 223, 212, 0.9), inset 0 0 24px rgba(255, 255, 255, 0.7);
}
@keyframes speakingCore {
  0%, 100% { transform: scale(1); filter: brightness(1); }
  25%       { transform: scale(1.06); filter: brightness(1.15); }
  75%       { transform: scale(0.97); filter: brightness(0.95); }
}
.orb--voice[data-state="speaking"] .orb__ring--1 { animation-duration: 1.3s; border-top-color: rgba(26, 223, 212, 1) !important; }
.orb--voice[data-state="speaking"] .orb__ring--2 { animation-duration: 2s; }
.orb--voice[data-state="speaking"] .orb__glow {
  background: radial-gradient(circle, rgba(26, 223, 212, 0.6), transparent 65%);
  animation: speakingGlow 0.4s ease-in-out infinite;
}
@keyframes speakingGlow {
  0%, 100% { transform: scale(1); opacity: 0.6; }
  50%       { transform: scale(1.4); opacity: 1; }
}

/* Label de estado */
.voice-status {
  font-family: var(--font-display); font-size: 18px; font-weight: 500;
  color: var(--txt-1); letter-spacing: 0.04em;
  transition: 0.3s; min-height: 28px; text-align: center;
}
.voice-status[data-state="listening"] { color: var(--cyan); }
.voice-status[data-state="thinking"]  { color: var(--violet); }
.voice-status[data-state="speaking"]  { color: #1adfd4; }

/* Transcrição do usuário */
.voice-transcript {
  font-size: 15px; color: var(--txt-1); text-align: center;
  max-width: 560px; min-height: 24px; line-height: 1.5;
  padding: 0 16px; transition: 0.3s;
}
.voice-transcript.interim { color: var(--txt-2); font-style: italic; }
.voice-transcript.final   { color: var(--txt-0); font-style: normal; }

/* Resposta da ZERO */
.voice-response {
  font-size: 15px; color: var(--txt-1); text-align: center;
  max-width: 600px; min-height: 24px; line-height: 1.6;
  padding: 12px 20px; border-radius: 16px;
  background: rgba(56, 225, 214, 0.06); border: 1px solid rgba(56, 225, 214, 0.1);
  opacity: 0; transition: opacity 0.4s;
}
.voice-response.is-visible { opacity: 1; }

/* Rodapé com controles */
.voice-footer {
  display: flex; align-items: center; justify-content: center; gap: 20px;
  padding: 32px 24px 40px;
  width: 100%;
}

/* Botão principal de falar */
.voice-tap-btn {
  width: 72px; height: 72px; border-radius: 50%;
  border: none; cursor: pointer;
  display: grid; place-items: center;
  background: var(--accent-grad);
  box-shadow: 0 8px 32px rgba(56, 225, 214, 0.35);
  color: #04121a; transition: 0.2s;
}
.voice-tap-btn:hover { transform: scale(1.06); box-shadow: 0 12px 40px rgba(56, 225, 214, 0.5); }
.voice-tap-btn:active { transform: scale(0.97); }
.voice-tap-btn.is-listening { animation: tapPulse 1s ease-in-out infinite; }
@keyframes tapPulse {
  0%, 100% { box-shadow: 0 8px 32px rgba(56, 225, 214, 0.35); }
  50%       { box-shadow: 0 8px 48px rgba(56, 225, 214, 0.7); }
}

/* Botão sair */
.voice-exit-btn {
  width: 48px; height: 48px; border-radius: 50%;
  border: 1px solid var(--stroke-strong); background: rgba(255, 255, 255, 0.04);
  color: var(--txt-1); cursor: pointer; transition: 0.2s;
  display: grid; place-items: center;
}
.voice-exit-btn:hover { background: rgba(255, 107, 129, 0.12); border-color: var(--danger); color: var(--danger); }

/* Aviso de não suporte */
.voice-unsupported {
  text-align: center; padding: 60px 32px;
  display: flex; flex-direction: column; align-items: center; gap: 16px;
}
.voice-unsupported svg { opacity: 0.3; }
.voice-unsupported h3 { font-family: var(--font-display); font-size: 20px; }
.voice-unsupported p { color: var(--txt-2); font-size: 14px; max-width: 360px; }

/* ============================================================
   VOICE PROFILE CREATOR — Modal lateral
   ============================================================ */
.vpc-overlay {
  position: fixed; inset: 0; z-index: 120;
  background: rgba(0, 0, 0, 0.55);
  display: flex; align-items: stretch; justify-content: flex-end;
  animation: fadeIn .2s ease;
}
.vpc-overlay.is-hidden { display: none; }

.vpc-panel {
  width: min(500px, 100vw);
  background: var(--bg-1);
  border-left: 1px solid var(--stroke-strong);
  display: flex; flex-direction: column; overflow: hidden;
}

.vpc-panel__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px; border-bottom: 1px solid var(--stroke);
  flex-shrink: 0;
}
.vpc-panel__title {
  font-family: var(--font-display); font-size: 16px; font-weight: 700; color: var(--txt-0);
}

/* Sub-abas */
.vpc-tabs {
  display: flex; gap: 6px; flex-wrap: wrap;
  padding: 12px 22px; border-bottom: 1px solid var(--stroke); flex-shrink: 0;
}
.vpc-tab {
  padding: 5px 14px; border-radius: 20px; font-size: 12px; font-weight: 600;
  border: 1px solid var(--stroke); background: transparent; color: var(--txt-2);
  cursor: pointer; transition: .15s;
}
.vpc-tab.is-active {
  border-color: var(--stroke-strong); background: rgba(74, 125, 255, 0.12); color: var(--blue);
}
.vpc-tab:hover:not(.is-active) { background: rgba(255,255,255,.04); color: var(--txt-1); }

/* Corpo scrollável */
.vpc-body { flex: 1; overflow-y: auto; padding: 20px 22px; }

.vpc-section { display: none; }
.vpc-section.is-active { display: block; }

.vpc-desc { font-size: 13px; color: var(--txt-2); margin-bottom: 18px; line-height: 1.55; }

/* Gravação */
.vpc-rec-bar { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.vpc-btn-rec {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 18px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 600;
  border: 1px solid var(--stroke-strong); background: rgba(74, 125, 255, 0.1); color: var(--blue);
  cursor: pointer; transition: .15s;
}
.vpc-btn-rec:hover { background: rgba(74, 125, 255, 0.2); }
.vpc-btn-rec.is-recording {
  border-color: rgba(255, 107, 129, 0.5); background: rgba(255, 107, 129, 0.1); color: var(--danger);
}
.vpc-dot {
  width: 10px; height: 10px; border-radius: 50%; background: var(--blue); flex-shrink: 0; transition: background .15s;
}
.vpc-dot.is-pulse { background: var(--danger); animation: tapPulse 1s ease-in-out infinite; }
.vpc-count { font-size: 12px; color: var(--txt-2); }

/* Lista de amostras */
.vpc-samples { display: flex; flex-direction: column; gap: 7px; }
.vpc-sample-item {
  display: flex; align-items: center; gap: 10px;
  border: 1px solid var(--stroke); border-radius: var(--radius-sm); padding: 9px 12px;
  background: rgba(255,255,255,.02); transition: border-color .15s;
}
.vpc-sample-item:hover { border-color: var(--stroke-strong); }
.vpc-play-btn {
  width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0;
  border: 1px solid var(--stroke); background: rgba(255,255,255,.04); color: var(--txt-2);
  cursor: pointer; display: grid; place-items: center; transition: .15s;
}
.vpc-play-btn:hover, .vpc-play-btn.is-playing {
  border-color: var(--stroke-strong); background: rgba(74, 125, 255, 0.12); color: var(--blue);
}
.vpc-sample-info { flex: 1; min-width: 0; }
.vpc-sample-name { font-size: 13px; color: var(--txt-0); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vpc-sample-meta { font-size: 11px; color: var(--txt-2); margin-top: 2px; }
.vpc-del-btn {
  width: 28px; height: 28px; border-radius: 8px; flex-shrink: 0;
  border: 1px solid var(--stroke); background: transparent; color: var(--txt-2);
  cursor: pointer; display: grid; place-items: center; transition: .15s;
}
.vpc-del-btn:hover { border-color: rgba(255, 107, 129, .4); color: var(--danger); }
.vpc-empty {
  padding: 32px 0; text-align: center; font-size: 13px; color: var(--txt-2);
  border: 1px dashed var(--stroke); border-radius: var(--radius-sm); line-height: 1.6;
}

/* Progresso treinamento */
.vpc-progress-wrap { border: 1px solid var(--stroke); border-radius: var(--radius-sm); padding: 14px; margin-bottom: 16px; background: rgba(255,255,255,.02); }
.vpc-progress-info { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; font-size: 13px; color: var(--txt-1); }
.vpc-progress-info strong { color: var(--blue); }
.vpc-progress-track { height: 4px; background: rgba(255,255,255,.08); border-radius: 4px; overflow: hidden; }
.vpc-progress-fill { height: 100%; background: var(--accent-grad); border-radius: 4px; transition: width .4s ease; }

/* Frases */
.vpc-phrase-list { display: flex; flex-direction: column; gap: 8px; }
.vpc-phrase {
  border: 1px solid var(--stroke); border-radius: var(--radius-sm); padding: 12px 14px;
  background: rgba(255,255,255,.02); transition: border-color .15s;
}
.vpc-phrase.is-recorded { border-color: rgba(74, 125, 255, 0.3); background: rgba(74, 125, 255, 0.04); }
.vpc-phrase.is-recording-now { border-color: rgba(255, 107, 129, 0.4); background: rgba(255, 107, 129, 0.05); }
.vpc-phrase-header { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 10px; }
.vpc-phrase-num {
  width: 22px; height: 22px; border-radius: 50%; flex-shrink: 0;
  border: 1px solid var(--stroke); background: rgba(255,255,255,.04); color: var(--txt-2);
  display: grid; place-items: center; font-size: 11px; font-weight: 700; margin-top: 2px;
}
.vpc-phrase.is-recorded .vpc-phrase-num { border-color: rgba(74, 125, 255, .5); background: rgba(74, 125, 255, .15); color: var(--blue); }
.vpc-phrase-text { font-size: 13px; color: var(--txt-1); line-height: 1.5; flex: 1; }
.vpc-phrase-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.vpc-phrase-rec-btn, .vpc-phrase-play-btn {
  padding: 5px 12px; border-radius: 8px; font-size: 11px; font-weight: 600;
  border: 1px solid var(--stroke-strong); background: rgba(74, 125, 255, .08); color: var(--blue);
  cursor: pointer; transition: .15s;
}
.vpc-phrase-rec-btn:hover { background: rgba(74, 125, 255, .18); }
.vpc-phrase-rec-btn.is-recording { border-color: rgba(255, 107, 129, .5); background: rgba(255, 107, 129, .1); color: var(--danger); }
.vpc-phrase-play-btn { border-color: var(--stroke); background: rgba(255,255,255,.04); color: var(--txt-2); }
.vpc-phrase-play-btn:hover, .vpc-phrase-play-btn.is-playing { border-color: var(--stroke-strong); background: rgba(74, 125, 255, .1); color: var(--blue); }

/* Biblioteca */
.vpc-lib-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.vpc-lib-card {
  border: 1px solid var(--stroke); border-radius: var(--radius-sm); padding: 14px;
  background: rgba(255,255,255,.02); transition: .15s; cursor: pointer;
}
.vpc-lib-card:hover:not(.is-disabled) { border-color: var(--stroke-strong); background: rgba(74, 125, 255, .06); }
.vpc-lib-card.is-selected { border-color: rgba(74, 125, 255, .5); background: rgba(74, 125, 255, .1); }
.vpc-lib-card.is-disabled { opacity: .4; cursor: not-allowed; }
.vpc-lib-name { font-size: 13px; font-weight: 700; color: var(--txt-0); margin-bottom: 4px; }
.vpc-lib-desc { font-size: 11px; color: var(--txt-2); line-height: 1.4; margin-bottom: 8px; }
.vpc-lib-footer { display: flex; align-items: center; justify-content: space-between; }
.vpc-lib-engine { font-size: 10px; color: var(--txt-2); text-transform: uppercase; letter-spacing: .06em; }
.vpc-badge {
  display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 10px; font-weight: 600;
}
.vpc-badge--active { border: 1px solid rgba(74, 125, 255, .5); background: rgba(74, 125, 255, .15); color: var(--blue); }
.vpc-badge--avail  { border: 1px solid rgba(139, 108, 255, .4); background: rgba(139, 108, 255, .1); color: var(--violet); }
.vpc-badge--soon   { border: 1px solid var(--stroke); background: transparent; color: var(--txt-2); }
.vpc-badge--check  { font-size: 11px; color: var(--cyan); }

/* Perfil */
.vpc-profile-form { border: 1px solid var(--stroke); border-radius: var(--radius-sm); padding: 18px; background: rgba(255,255,255,.02); margin-bottom: 18px; }
.vpc-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.vpc-field span { font-size: 11px; text-transform: uppercase; letter-spacing: .14em; color: var(--txt-2); }
.vpc-input {
  padding: 9px 12px; border-radius: 8px; font-size: 13px; font-family: inherit;
  border: 1px solid var(--stroke); background: rgba(255,255,255,.04); color: var(--txt-0);
  outline: none; transition: border-color .15s;
}
.vpc-input:focus { border-color: var(--stroke-strong); }
.vpc-textarea { resize: none; height: 80px; }
.vpc-meta-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 16px; }
.vpc-meta-item { border: 1px solid var(--stroke); border-radius: 8px; padding: 10px 12px; background: rgba(255,255,255,.02); display: flex; flex-direction: column; gap: 4px; }
.vpc-meta-item span { font-size: 10px; text-transform: uppercase; letter-spacing: .14em; color: var(--txt-2); }
.vpc-meta-item strong { font-size: 13px; color: var(--txt-1); }
.vpc-accent { color: var(--blue) !important; }
.vpc-engines { }
.vpc-engines__label { font-size: 10px; text-transform: uppercase; letter-spacing: .14em; color: var(--txt-2); margin-bottom: 8px; }
.vpc-engines__grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.vpc-engine-chip {
  border: 1px solid var(--stroke); border-radius: 8px; padding: 8px 4px; text-align: center;
  background: rgba(255,255,255,.02); display: flex; flex-direction: column; gap: 3px;
}
.vpc-engine-chip span { font-size: 11px; font-weight: 600; color: var(--txt-2); }
.vpc-engine-chip small { font-size: 9px; text-transform: uppercase; letter-spacing: .08em; color: rgba(107, 122, 153, .6); }

