* { box-sizing: border-box; }

/* Barra de rolagem seguindo o tema - sem isso o navegador usa a barra clara
   padrao por cima do fundo escuro, feio e sem contraste. */
html { scrollbar-color: var(--border) var(--bg); }
*::-webkit-scrollbar { width: 12px; height: 12px; }
*::-webkit-scrollbar-track { background: var(--bg); }
*::-webkit-scrollbar-thumb { background: var(--border); border-radius: 8px; border: 2px solid var(--bg); }
*::-webkit-scrollbar-thumb:hover { background: var(--text-faint); }

:root {
  --accent: #2563eb;
  --accent-dark: #1d4ed8;
  --accent-hover: #1d4ed8;
  --accent-50: #eff6ff;
  --accent-100: #dbeafe;
  --bg: #f7f7fb;
  --sidebar-bg: #ffffff;
  --card-bg: #ffffff;
  --border: #ececf3;
  --text: #1a1a2e;
  --text-muted: #6b7280;
  --text-faint: #9ca3af;
  --green-bg: #d1fae5;
  --green-text: #065f46;
  --msg-out-bg: #d9fdd3;
  --msg-out-text: #111b21;
  --msg-assistant-bg: #dbeafe;
  --msg-assistant-text: #1e3a8a;

  /* Botao da marca (.btn-brand). O preenchimento e o azul escuro da marca
     (~5:1 com branco, mesma familia do --accent-dark), o que passa AA com
     texto branco. --brand-blue-line e usada no texto/borda do secundario e
     clareia no tema escuro pra manter contraste AA. */
  --brand-blue: #1d4ed8;
  --brand-blue-hover: #1e40af;
  --brand-blue-line: #1d4ed8;
  --brand-blue-soft: rgba(29, 78, 216, 0.10);
  --brand-blue-ring: rgba(29, 78, 216, 0.40);
}

[data-theme="dark"] {
  --accent: #3b82f6;
  --accent-dark: #93c5fd;
  --accent-hover: #2563eb;
  --accent-50: rgba(59, 130, 246, 0.12);
  --accent-100: rgba(59, 130, 246, 0.22);
  --bg: #0d0d0d;
  --sidebar-bg: #141414;
  --card-bg: #1c1c1c;
  --border: #333333;
  --text: #f0f0f0;
  --text-muted: #a3a3a3;
  --text-faint: #787878;
  --green-bg: rgba(59, 130, 246, 0.16);
  --green-text: #93c5fd;
  --msg-out-bg: #2b2b2b;
  --msg-out-text: #f0f0f0;
  --msg-assistant-bg: #0f2a40;
  --msg-assistant-text: #93c5fd;

  --brand-blue-hover: #2563eb;
  --brand-blue-line: #60a5fa;
  --brand-blue-soft: rgba(96, 165, 250, 0.15);
  --brand-blue-ring: rgba(96, 165, 250, 0.45);
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}

#error-toast-container {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); z-index: 3000;
  display: flex; flex-direction: column; gap: 0.5rem; align-items: center;
  max-width: 90vw; pointer-events: none;
}
.error-toast {
  background: #7f1d1d; color: white; font-size: 0.85rem; text-align: center;
  padding: 0.7rem 1.1rem; border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,0.35);
  max-width: 480px; opacity: 1; transition: opacity 0.4s ease;
}
.error-toast.error-toast-hide { opacity: 0; }
[data-theme="dark"] .error-toast { background: #1c1c1c; color: var(--accent-dark); border: 1px solid var(--accent); }

/* --- Modo do painel por tipo de negócio (clínica x loja) ---
   body[data-biz="loja"] esconde o que é só de clínica (agenda, procedimentos,
   profissionais…) e mostra os blocos exclusivos de loja. Os textos que mudam
   usam data-biz-label="rótulo clínica|rótulo loja" e são trocados no app.js. */
.biz-loja-only { display: none; }
body[data-biz="loja"] .biz-clinica-only { display: none !important; }
body[data-biz="loja"] .stat-card.biz-loja-only { display: flex; }
body[data-biz="loja"] p.biz-loja-only,
body[data-biz="loja"] div.biz-loja-only,
body[data-biz="loja"] li.biz-loja-only { display: block; }

/* --- Plano Grátis (CRM + Meta + atendimento humano) ---
   [data-plan-paid]  -> some no plano grátis (cards sem dado, botões sem função)
   [data-plan-lock]  -> FICA visível, com cadeado; clicar abre o modal de venda
   [data-plan-free]  -> blocos que só aparecem no plano grátis (a venda em si) */
body[data-plan="free"] [data-plan-paid] { display: none !important; }

/* NADA de venda aparece fora do plano grátis. O !important trava isso de
   propósito: as classes dos próprios blocos (.upsell-strip, .unlock-cta) são
   definidas mais abaixo no arquivo e, com a mesma especificidade do gate,
   ganhavam no desempate por ordem - foi assim que a venda vazou pros planos
   pagos. Só o gate abaixo controla o display desses blocos. */
[data-plan-free] { display: none !important; }
body[data-plan="free"] [data-plan-free] { display: block !important; }
body[data-plan="free"] .upsell-strip[data-plan-free] { display: flex !important; }
body[data-plan="free"] .stat-card.biz-loja-only { display: flex; }

body[data-plan="free"] [data-plan-lock] { position: relative; opacity: 0.62; }
body[data-plan="free"] [data-plan-lock]::after {
  content: "🔒"; font-size: 0.72em; margin-left: 0.35rem; line-height: 1;
}
body[data-plan="free"] [data-plan-lock]:hover { opacity: 1; }
body[data-plan="free"] .nav-item[data-plan-lock] .nav-label::after { content: ""; }

/* Bloco grande de venda no Início */
.upsell-hero {
  border-radius: 14px; padding: 1.25rem 1.4rem; margin-bottom: 1rem;
  background: linear-gradient(135deg, var(--brand-blue) 0%, #7c2d12 100%);
  color: #fff; box-shadow: 0 10px 30px rgba(124, 45, 18, 0.25);
}
.upsell-tag {
  display: inline-block; font-size: 0.68rem; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; background: rgba(255, 255, 255, 0.18);
  padding: 0.2rem 0.55rem; border-radius: 999px; margin-bottom: 0.6rem;
}
.upsell-hero h2 { margin: 0 0 0.4rem; font-size: 1.45rem; line-height: 1.2; color: #fff; }
.upsell-hero p { margin: 0; color: rgba(255, 255, 255, 0.9); font-size: 0.92rem; line-height: 1.5; }
.upsell-close { margin-top: 0.9rem !important; font-weight: 500; }
.upsell-metrics { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 1rem; }
.upsell-metric {
  background: rgba(255, 255, 255, 0.13); border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 10px; padding: 0.6rem 0.85rem; min-width: 118px;
}
.upsell-metric--warn { background: rgba(255, 255, 255, 0.22); border-color: rgba(255, 255, 255, 0.4); }
.upsell-metric-n { font-size: 1.5rem; font-weight: 700; line-height: 1.1; }
.upsell-metric-l { font-size: 0.72rem; color: rgba(255, 255, 255, 0.85); margin-top: 0.15rem; }
.upsell-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 1.1rem; }

.upsell-btn {
  display: inline-block; background: #fff; color: var(--brand-blue); border: 0;
  border-radius: 9px; padding: 0.6rem 1.1rem; font-weight: 700; font-size: 0.88rem;
  cursor: pointer; text-decoration: none; text-align: center;
}
.upsell-btn:hover { background: #fff7ed; }
.upsell-btn--sm { padding: 0.45rem 0.9rem; font-size: 0.8rem; white-space: nowrap; }
.upsell-btn--block { display: block; width: 100%; margin-top: 0.9rem; background: var(--brand-blue); color: #fff; }
.upsell-btn--block:hover { background: var(--brand-blue-hover); }
.upsell-btn-ghost {
  background: transparent; color: #fff; border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 9px; padding: 0.6rem 1.1rem; font-weight: 600; font-size: 0.88rem; cursor: pointer;
}
.upsell-btn-ghost:hover { background: rgba(255, 255, 255, 0.12); }

/* Faixa de venda no topo do Chat / CRM / Contatos.
   Sem `display` aqui: quem liga/desliga é o gate [data-plan-free] lá em cima. */
.upsell-strip {
  align-items: center; justify-content: space-between; gap: 1rem;
  flex-wrap: wrap; border: 1px solid var(--brand-blue-ring);
  background: var(--brand-blue-soft); border-left: 3px solid var(--brand-blue);
  border-radius: 10px; padding: 0.7rem 0.95rem; margin-bottom: 0.9rem;
}
.upsell-strip strong { display: block; color: var(--text); font-size: 0.9rem; }
.upsell-strip span { display: block; color: var(--text-muted); font-size: 0.82rem; margin-top: 0.15rem; }
.upsell-strip .upsell-btn { background: var(--brand-blue); color: #fff; }
.upsell-strip .upsell-btn:hover { background: var(--brand-blue-hover); }

/* Botão fixo na barra lateral (display fica com o gate [data-plan-free]) */
.unlock-cta {
  width: 100%; text-align: left; cursor: pointer; margin-bottom: 0.5rem;
  background: linear-gradient(135deg, var(--brand-blue) 0%, #7c2d12 100%);
  color: #fff; border: 0; border-radius: 10px; padding: 0.6rem 0.75rem;
}
.unlock-cta:hover { filter: brightness(1.08); }
.unlock-cta-top { display: block; font-size: 0.64rem; text-transform: uppercase; letter-spacing: 0.06em; opacity: 0.85; }
.unlock-cta-main { display: block; font-size: 0.95rem; font-weight: 700; line-height: 1.25; }
.unlock-cta-sub { display: block; font-size: 0.7rem; opacity: 0.85; margin-top: 0.1rem; }

/* Modal de upgrade */
.upsell-modal { max-width: 520px; }
.upsell-modal-lead { color: var(--text-muted); font-size: 0.9rem; line-height: 1.55; margin: 0 0 0.9rem; }
.upsell-list { margin: 0; padding: 0; list-style: none; }
.upsell-list li {
  position: relative; padding: 0.3rem 0 0.3rem 1.5rem; font-size: 0.88rem; color: var(--text);
}
.upsell-list li::before {
  content: "✓"; position: absolute; left: 0; top: 0.3rem;
  color: var(--brand-blue); font-weight: 700;
}
.upsell-modal-proof {
  margin-top: 1rem; border: 1px solid var(--border); border-radius: 10px;
  padding: 0.75rem 0.9rem; background: var(--bg);
}
.upsell-proof-title {
  font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-faint); font-weight: 700; margin-bottom: 0.4rem;
}
.upsell-modal-proof p { margin: 0.25rem 0; font-size: 0.85rem; color: var(--text); line-height: 1.45; }
.upsell-modal-proof strong { color: var(--brand-blue); }
.upsell-modal-foot { margin: 0.7rem 0 0; text-align: center; }

@media (max-width: 640px) {
  .upsell-hero h2 { font-size: 1.2rem; }
  .upsell-strip { flex-direction: column; align-items: flex-start; }
  .upsell-strip .upsell-btn { width: 100%; }
}

/* --- Shell / Sidebar --- */
.app-shell { display: flex; min-height: 100vh; }

/* Barra superior + backdrop do menu: só aparecem no mobile (ver @media). */
.mobile-topbar { display: none; }
.sidebar-backdrop { display: none; }
.chat-back { display: none; }

.sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 1.1rem 0.8rem;
  gap: 1rem;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.brand { display: flex; align-items: center; gap: 0.6rem; padding: 0 0.3rem; }
.brand-logo {
  width: 34px; height: 34px; border-radius: 9px;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: white; display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 1rem; flex-shrink: 0;
}
.brand-logo--img { background: none; padding: 0; object-fit: contain; }
/* Tema escuro: personagem laranja ganha um selo branco pra nao sumir no fundo preto */
[data-theme="dark"] .brand-logo--img { background: #fff; padding: 3px; }

.auth-logo { display: block; height: 46px; width: auto; margin: 0 auto 0.9rem; }
/* Logo do login troca pela versao branca no tema escuro (a preta some) */
.auth-logo--dark { display: none; }
[data-theme="dark"] .auth-logo--light { display: none; }
[data-theme="dark"] .auth-logo--dark { display: block; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; overflow: hidden; }
.brand-text strong { font-size: 0.95rem; }
.brand-text span { font-size: 0.72rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.clinic-select {
  width: 100%; background: var(--bg); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px;
  padding: 0.45rem 0.6rem; font-size: 0.82rem;
}

.side-nav { display: flex; flex-direction: column; gap: 1.1rem; overflow-y: auto; flex: 1; }
.nav-group { display: flex; flex-direction: column; gap: 0.15rem; }
.nav-group-label {
  font-size: 0.68rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.04em; color: var(--text-faint); padding: 0 0.6rem; margin-bottom: 0.2rem;
}
.nav-item {
  display: flex; align-items: center; gap: 0.6rem;
  background: transparent; border: none; text-align: left;
  padding: 0.5rem 0.6rem; border-radius: 8px; cursor: pointer;
  font-size: 0.85rem; color: var(--text); font-family: inherit;
}
.nav-item:hover { background: var(--accent-50); }
.nav-item.active { background: var(--accent-100); color: var(--accent-dark); font-weight: 600; }
.nav-count-badge {
  margin-left: auto; flex-shrink: 0; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 999px; background: #b91c1c; color: #fff;
  font-size: 0.7rem; font-weight: 700; display: inline-flex; align-items: center; justify-content: center;
}
.nav-icon { width: 18px; height: 18px; flex-shrink: 0; display: inline-flex; color: inherit; }
.nav-icon svg { width: 100%; height: 100%; }

.sidebar-footer { border-top: 1px solid var(--border); padding-top: 0.7rem; }
.theme-toggle {
  display: flex; align-items: center; gap: 0.5rem; width: 100%;
  background: transparent; border: 1px solid var(--border); border-radius: 8px;
  padding: 0.5rem 0.6rem; cursor: pointer; font-size: 0.82rem; color: var(--text); font-family: inherit;
}
.theme-toggle:hover { background: var(--accent-50); }

/* --- Main content --- */
main { flex: 1; padding: 1.6rem 2rem 3rem; max-width: 1600px; min-width: 0; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1.2rem; }
.page-header h1 { margin: 0; font-size: 1.4rem; }
.page-subtitle { margin: 0.2rem 0 0; color: var(--text-muted); font-size: 0.88rem; }

.badge { display: inline-block; padding: 0.25rem 0.7rem; border-radius: 999px; font-size: 0.75rem; font-weight: 600; }
.badge-green { background: var(--green-bg); color: var(--green-text); }
.badge-neutral { background: var(--bg); color: var(--text-muted); border: 1px solid var(--border); }
.badge-red { background: #7f1d1d; color: white; }
.badge-amber { background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; }
.badge-plan { background: var(--accent); color: white; }

/* Aviso de plano vencido/vencendo no topo da aba Clínicas (painel adm). */
.plan-alert {
  background: #fef3c7; border: 1px solid #fcd34d; color: #92400e;
  border-radius: 10px; padding: 0.8rem 1rem; margin-bottom: 1rem;
  font-size: 0.85rem; line-height: 1.5;
}
.plan-alert.plan-alert--danger { background: #fee2e2; border-color: #fca5a5; color: #991b1b; }
.plan-alert strong { display: block; margin-bottom: 0.2rem; }

.page-header > button, .page-header > .header-actions {
  background: var(--accent); color: white; border: none; border-radius: 8px;
  padding: 0.55rem 1rem; cursor: pointer; font-weight: 600; font-size: 0.85rem; white-space: nowrap;
}
.page-header > button:hover { background: var(--accent-hover); }

.toolbar { display: flex; gap: 0.6rem; margin-bottom: 1rem; flex-wrap: wrap; align-items: center; }
.search-input {
  flex: 1; min-width: 220px; padding: 0.5rem 0.8rem; border: 1px solid var(--border); border-radius: 8px;
  background: var(--card-bg); color: var(--text); font-family: inherit; font-size: 0.85rem;
}
.toolbar select {
  padding: 0.5rem 0.7rem; border: 1px solid var(--border); border-radius: 8px;
  background: var(--card-bg); color: var(--text); font-family: inherit; font-size: 0.85rem;
}

.contact-name-cell { display: flex; align-items: center; gap: 0.6rem; }

.view-toggle { display: flex; background: var(--card-bg); border: 1px solid var(--border); border-radius: 8px; padding: 0.2rem; }
.view-toggle button {
  background: transparent; border: none; padding: 0.4rem 0.9rem; border-radius: 6px; cursor: pointer;
  font-size: 0.8rem; color: var(--text-muted); font-family: inherit;
}
.view-toggle button.active { background: var(--accent); color: white; font-weight: 600; }

/* --- Agenda: grid de calendario --- */
.agenda-grid-card { padding: 0; overflow-x: auto; }
.agenda-grid { display: grid; min-width: 600px; }
.agenda-grid-header { position: sticky; top: 0; background: var(--card-bg); font-size: 0.72rem; font-weight: 600; color: var(--text-muted); text-align: center; padding: 0.6rem 0.3rem; border-bottom: 1px solid var(--border); border-left: 1px solid var(--border); }
.agenda-grid-header .day-date { font-size: 0.95rem; color: var(--text); font-weight: 700; }
.agenda-grid-header.today .day-date { color: var(--accent); }
.agenda-hour-label { font-size: 0.68rem; color: var(--text-faint); text-align: right; padding: 0 0.5rem; border-top: 1px solid var(--border); transform: translateY(-0.5em); }
.agenda-cell {
  border-top: 1px solid var(--border); border-left: 1px solid var(--border); position: relative; min-height: 46px;
  background-image: repeating-linear-gradient(to right, var(--border) 0 4px, transparent 4px 9px);
  background-repeat: no-repeat; background-size: 100% 1px; background-position: 0 50%;
}
/* Uma camada por dia coluna, atras da grade de horas, onde os agendamentos
   sao posicionados em pixel absoluto (nao mais por celula de hora) - e o que
   permite calcular sobreposicao entre horarios vizinhos (ex: 14:00 e 14:15
   de profissionais diferentes) e coloca-los lado a lado em vez de "grudados". */
.agenda-day-overlay { position: relative; }
.agenda-appt {
  position: absolute;
  background: var(--accent-100); border-left: 3px solid var(--accent); color: var(--accent-dark);
  border-radius: 4px; padding: 0.2rem 0.4rem; font-size: 0.72rem; overflow: hidden; cursor: pointer;
}
.agenda-appt:hover { filter: brightness(0.95); outline: 1px solid var(--accent); }
.agenda-appt .t { font-weight: 700; }
.agenda-appt.st-cancelled { opacity: 0.55; text-decoration: line-through; }
.agenda-appt .ap-icons { display: flex; gap: 0.15rem; align-items: center; }
.agenda-appt .ap-src { width: 12px; height: 12px; opacity: 0.7; }
.agenda-empty-msg { padding: 1.5rem; text-align: center; color: var(--text-faint); font-size: 0.85rem; }

/* --- Agenda estilo calendario (toolbar + filtros + lateral) --- */
.ag-toolbar { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; justify-content: space-between; margin-bottom: 0.8rem; }
.ag-toolbar-nav { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.ag-toolbar-actions { display: flex; gap: 0.4rem; }
.ag-arrow {
  background: var(--card-bg); border: 1px solid var(--border); color: var(--text-muted);
  width: 30px; height: 30px; border-radius: 7px; cursor: pointer; font-size: 1.1rem; line-height: 1;
}
.ag-arrow:hover { border-color: var(--accent); color: var(--text); }
.ag-range-label { font-weight: 700; font-size: 0.95rem; text-transform: capitalize; }
.ag-filters { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 0.7rem; }
.ag-filters select { border: 1px solid var(--border); background: var(--card-bg); color: var(--text); border-radius: 8px; padding: 0.45rem 0.7rem; font-family: inherit; font-size: 0.85rem; }
.ag-filters .search-input { flex: 1; min-width: 220px; }
.ag-legend {
  display: flex; flex-wrap: wrap; gap: 0.4rem 1rem; align-items: center;
  background: var(--card-bg); border: 1px solid var(--border); border-radius: 999px;
  padding: 0.5rem 1rem; font-size: 0.78rem; color: var(--text-muted); margin-bottom: 0.8rem;
}
.ag-legend .lg { display: inline-flex; align-items: center; gap: 0.35rem; }
.ag-legend .dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.ag-legend svg { width: 14px; height: 14px; }

.ag-main { display: grid; grid-template-columns: 1fr 264px; gap: 0.9rem; align-items: start; }
.ag-main-col { min-width: 0; }
.ag-side { display: flex; flex-direction: column; gap: 0.8rem; }
.ag-side-block { padding: 0.9rem 1rem; }
.ag-side-title { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); margin-bottom: 0.5rem; display: flex; align-items: center; justify-content: space-between; }
#ag-prof-filter label { display: flex; align-items: center; gap: 0.45rem; font-size: 0.84rem; padding: 0.22rem 0; cursor: pointer; }
#ag-prof-filter .dot { width: 9px; height: 9px; border-radius: 50%; }
.ag-day-appt { border-left: 3px solid var(--accent); background: var(--accent-50); border-radius: 5px; padding: 0.35rem 0.5rem; margin-bottom: 0.35rem; font-size: 0.8rem; cursor: pointer; }
.ag-day-appt .h { font-weight: 700; }
.ag-day-appt .m { color: var(--text-muted); font-size: 0.74rem; }

.ag-minical { padding: 0.8rem; }
.ag-minical-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.5rem; }
.ag-minical-head strong { font-size: 0.85rem; text-transform: capitalize; }
.ag-minical-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.ag-minical-grid .wd { font-size: 0.62rem; color: var(--text-faint); text-align: center; padding: 0.2rem 0; }
.ag-minical-grid button {
  aspect-ratio: 1; border: none; background: none; color: var(--text); font-family: inherit;
  font-size: 0.74rem; border-radius: 50%; cursor: pointer; position: relative;
}
.ag-minical-grid button:hover { background: var(--accent-50); }
.ag-minical-grid button.other { color: var(--text-faint); }
.ag-minical-grid button.today { outline: 1px solid var(--accent); }
.ag-minical-grid button.sel { background: var(--accent); color: #fff; }
.ag-minical-grid button.has::after {
  content: ""; position: absolute; bottom: 3px; left: 50%; transform: translateX(-50%);
  width: 4px; height: 4px; border-radius: 50%; background: var(--accent);
}
.ag-minical-grid button.sel.has::after { background: #fff; }

@media (max-width: 900px) {
  .ag-main { grid-template-columns: 1fr; }
  .ag-side { flex-direction: row; flex-wrap: wrap; }
  .ag-side > * { flex: 1; min-width: 220px; }
}

/* --- Personalizar Alana: abas horizontais --- */
.settings-tabs {
  display: flex; gap: 0.3rem; overflow-x: auto; border-bottom: 1px solid var(--border);
  margin-bottom: 1.2rem; padding-bottom: 1px;
}
.settings-tabs button {
  background: transparent; border: none; padding: 0.6rem 0.9rem; cursor: pointer;
  font-size: 0.82rem; color: var(--text-muted); font-family: inherit; white-space: nowrap;
  border-bottom: 2px solid transparent; flex-shrink: 0;
}
.settings-tabs button.active { color: var(--accent-dark); border-bottom-color: var(--accent); font-weight: 600; }
.settings-subpanel { display: none; }
.settings-subpanel.active { display: block; }
.channel-card { max-width: 360px; }
#channel-qr-img { width: 220px; height: 220px; border: 1px solid var(--border); border-radius: 8px; margin-top: 0.8rem; display: block; }

.coming-soon {
  background: var(--card-bg); border: 1px dashed var(--border); border-radius: 10px;
  padding: 1.5rem; text-align: center; color: var(--text-faint); font-size: 0.85rem;
}

/* --- Tour guiado --- */
.tour-overlay { position: fixed; inset: 0; z-index: 2000; pointer-events: none; }
.tour-spotlight {
  position: fixed; border-radius: 10px; border: 2px solid var(--accent);
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.55);
  transition: top 0.2s ease, left 0.2s ease, width 0.2s ease, height 0.2s ease;
  pointer-events: none;
}
.tour-popover {
  position: fixed; z-index: 2001; background: var(--card-bg); color: var(--text);
  border-radius: 10px; padding: 1rem 1.1rem; width: 340px; max-width: calc(100vw - 24px);
  max-height: calc(100vh - 24px); overflow-y: auto;
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
  pointer-events: auto;
}
.tour-progress { height: 3px; border-radius: 999px; background: var(--border); overflow: hidden; margin-bottom: 0.7rem; }
.tour-progress-bar { height: 100%; width: 0; background: var(--accent); border-radius: 999px; transition: width 0.25s ease; }
.tour-step-label { display: block; font-size: 0.68rem; font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: 0.04em; }
.tour-popover h4 { margin: 0.3rem 0 0.4rem; font-size: 0.98rem; line-height: 1.3; }
.tour-popover p { margin: 0 0 0.9rem; font-size: 0.83rem; color: var(--text-muted); line-height: 1.5; }
.tour-actions { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.tour-actions-right { display: flex; gap: 0.4rem; }
.tour-btn-ghost {
  background: transparent; border: 1px solid var(--border); color: var(--text-muted);
  border-radius: 6px; padding: 0.4rem 0.7rem; cursor: pointer; font-size: 0.78rem; font-family: inherit;
}
.tour-actions #tour-next { border: none; background: var(--accent); color: white; border-radius: 6px; padding: 0.4rem 0.9rem; cursor: pointer; font-size: 0.78rem; font-weight: 600; }

/* --- Card --- */
.card { background: var(--card-bg); border: 1px solid var(--border); border-radius: 12px; padding: 1.1rem 1.2rem; }
.card-title-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.6rem; }
.card-title-row h3 { margin: 0; font-size: 0.95rem; }

/* --- Dashboard --- */
.period-row { display: flex; gap: 0.4rem; margin-bottom: 1.2rem; flex-wrap: wrap; }
.period-btn {
  background: var(--card-bg); border: 1px solid var(--border); color: var(--text-muted);
  border-radius: 999px; padding: 0.35rem 0.9rem; font-size: 0.8rem; cursor: pointer; font-family: inherit;
}
.period-btn.active { background: var(--accent); border-color: var(--accent); color: white; font-weight: 600; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 1.2rem; }
.stat-card { display: flex; flex-direction: column; gap: 0.3rem; }
.stat-card-header { display: flex; align-items: center; justify-content: space-between; }
.stat-label { font-size: 0.78rem; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.02em; }
.stat-icon { width: 18px; height: 18px; color: var(--accent); }
.stat-icon svg { width: 100%; height: 100%; }
.stat-value { font-size: 1.9rem; font-weight: 700; }
.stat-hint { font-size: 0.76rem; color: var(--text-faint); }

.dash-columns { display: grid; grid-template-columns: 2fr 1fr; gap: 1rem; }
.chart-total { font-size: 0.78rem; color: var(--text-muted); }
.dash-chart { display: flex; align-items: flex-end; gap: 0.4rem; height: 160px; padding-top: 0.5rem; }
.dash-bar-wrap { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 0.3rem; height: 100%; justify-content: flex-end; }
.dash-bar { width: 100%; max-width: 22px; background: var(--accent-100); border-radius: 4px 4px 0 0; position: relative; }
.dash-bar.has-value { background: var(--accent); }
.dash-bar-label { font-size: 0.62rem; color: var(--text-faint); }

/* --- Mapa de leads por estado (dashboard) --- */
.dash-map-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 200px; gap: 1rem; align-items: center; }
.dash-br-map svg { width: 100%; height: auto; display: block; max-width: 360px; margin: 0 auto; }
.dash-br-map .br-tile { transition: fill-opacity 0.2s ease; cursor: default; }
.dash-br-map .br-tile-label { font-size: 8px; font-weight: 700; fill: currentColor; pointer-events: none; }
.dash-map-rank { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.4rem; }
.dash-map-rank li { display: flex; align-items: center; gap: 0.5rem; font-size: 0.82rem; }
.dash-map-rank .mr-uf { font-weight: 700; width: 1.8rem; flex-shrink: 0; }
.dash-map-rank .mr-bar { flex: 1; height: 6px; background: var(--accent-50); border-radius: 999px; overflow: hidden; }
.dash-map-rank .mr-fill { height: 100%; background: var(--accent); border-radius: 999px; }
.dash-map-rank .mr-n { color: var(--text-muted); flex-shrink: 0; min-width: 1.5rem; text-align: right; }
.dash-map-empty { color: var(--text-faint); font-size: 0.85rem; padding: 1.5rem 0; text-align: center; }
@media (max-width: 640px) {
  .dash-map-wrap { grid-template-columns: 1fr; }
}

/* --- Relatorios --- */
.rp-bars { display: flex; flex-direction: column; gap: 0.55rem; margin-top: 0.6rem; }
.rp-bar-row { font-size: 0.82rem; }
.rp-bar-top { display: flex; justify-content: space-between; gap: 0.5rem; margin-bottom: 0.2rem; }
.rp-bar-top .v { color: var(--text-muted); white-space: nowrap; }
.rp-bar-track { height: 8px; background: var(--accent-50); border-radius: 999px; overflow: hidden; }
.rp-bar-fill { height: 100%; background: var(--accent); border-radius: 999px; min-width: 2px; }
.rp-nps-big { display: flex; gap: 1.5rem; align-items: baseline; flex-wrap: wrap; margin: 0.4rem 0 0.8rem; }
.rp-nps-big .n { font-size: 2rem; font-weight: 700; }
.rp-nps-big .l { font-size: 0.78rem; color: var(--text-muted); }
.rp-comment { border-left: 3px solid var(--border); padding: 0.3rem 0.7rem; margin: 0.4rem 0; font-size: 0.84rem; }
.rp-comment .who { font-size: 0.74rem; color: var(--text-muted); }

.mini-calendar { display: grid; grid-template-columns: repeat(7, 1fr); gap: 0.25rem; margin-top: 0.6rem; }
.mini-calendar .dow { font-size: 0.65rem; color: var(--text-faint); text-align: center; padding-bottom: 0.2rem; }
.mini-calendar .day {
  aspect-ratio: 1; display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem; border-radius: 6px; color: var(--text-muted);
}
.mini-calendar .day.today { border: 1px solid var(--accent); color: var(--text); }
.mini-calendar .day.has-appt { background: var(--accent-100); color: var(--accent-dark); font-weight: 600; }
.mini-calendar .day.empty { visibility: hidden; }

/* --- Tables --- */
table { width: 100%; border-collapse: collapse; }
.card table { margin: -0.2rem -0.2rem 0; width: calc(100% + 0.4rem); }
th, td { text-align: left; padding: 0.6rem 0.7rem; border-bottom: 1px solid var(--border); font-size: 0.85rem; }
th { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.03em; color: var(--text-faint); font-weight: 600; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--accent-50); }

.btn-icon-danger {
  width: 30px; height: 30px; padding: 0; border-radius: 6px; flex-shrink: 0;
  background: transparent; border: 1px solid transparent; color: var(--text-faint);
  display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.btn-icon-danger .nav-icon { width: 16px; height: 16px; }
.btn-icon-danger:hover { background: #fee2e2; border-color: #fecaca; color: #b91c1c; }
[data-theme="dark"] .btn-icon-danger:hover { background: var(--accent-50); border-color: var(--accent-100); color: var(--accent-dark); }

/* --- CRM board --- */
.crm-board { display: flex; gap: 1rem; overflow-x: auto; padding-bottom: 1rem; }
.crm-column {
  min-width: 250px; max-height: calc(100vh - 240px); background: var(--card-bg); border: 1px solid var(--border);
  border-radius: 12px; padding: 0.8rem; flex-shrink: 0; display: flex; flex-direction: column;
}
.crm-column-header { display: flex; align-items: center; gap: 0.5rem; font-size: 0.85rem; font-weight: 600; margin-bottom: 0.7rem; }
.crm-column-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.crm-column-count { color: var(--text-faint); font-weight: 400; }
.crm-card { background: var(--bg); border-radius: 8px; padding: 0.6rem 0.7rem; margin-bottom: 0.5rem; font-size: 0.85rem; border: 1px solid var(--border); cursor: grab; }
.crm-card.dragging { opacity: 0.4; }
.crm-cards-drop { flex: 1; min-height: 60px; overflow-y: auto; border-radius: 8px; transition: background-color 0.1s; }
.crm-cards-drop.drag-over { background: var(--accent-50); outline: 2px dashed var(--accent); outline-offset: -2px; }
.crm-card-top { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.4rem; }
.crm-avatar {
  width: 26px; height: 26px; border-radius: 50%; background: var(--accent-100); color: var(--accent-dark);
  display: flex; align-items: center; justify-content: center; font-size: 0.72rem; font-weight: 700; flex-shrink: 0;
}
.crm-card .name { font-weight: 600; }
.crm-card .phone { color: var(--text-muted); font-size: 0.78rem; margin-bottom: 0.5rem; }
.crm-card select { width: 100%; font-size: 0.78rem; padding: 0.3rem; border-radius: 6px; border: 1px solid var(--border); background: var(--card-bg); color: var(--text); }
/* Aviso de dado faltando no card (ex: a Alana moveu pra "venda ganha" sem o valor). */
.crm-card-alert { font-size: 0.74rem; font-weight: 600; color: #92400e; background: #fef3c7; border: 1px solid #fcd34d; border-radius: 6px; padding: 0.25rem 0.4rem; margin-bottom: 0.45rem; }

.funnel-config { margin-top: 1rem; }
.funnel-config summary { cursor: pointer; font-weight: 600; font-size: 0.9rem; }
.funnel-config table { margin-top: 0.8rem; }
#stages-body input[type="text"] { width: 100%; padding: 0.3rem; border: 1px solid var(--border); border-radius: 6px; background: var(--card-bg); color: var(--text); }
#stages-body input[type="number"] { width: 4rem; padding: 0.3rem; border: 1px solid var(--border); border-radius: 6px; background: var(--card-bg); color: var(--text); }
#stages-body input[type="color"] { width: 2.5rem; height: 1.8rem; padding: 0; border: 1px solid var(--border); border-radius: 6px; }
#stages-body select { padding: 0.3rem; border: 1px solid var(--border); border-radius: 6px; background: var(--card-bg); color: var(--text); }

/* --- Chat --- */
.chat-card { padding: 0; overflow: hidden; }
.chat-layout { display: grid; grid-template-columns: 300px 1fr; height: calc(100vh - 240px); min-height: 420px; }
.chat-list-pane { display: flex; flex-direction: column; border-right: 1px solid var(--border); min-height: 0; }
.chat-filter-tabs { display: flex; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.chat-filter-tabs button {
  flex: 1; background: transparent; border: none; padding: 0.6rem 0.4rem; cursor: pointer;
  font-size: 0.8rem; color: var(--text-muted); font-family: inherit; border-bottom: 2px solid transparent;
}
.chat-filter-tabs button.active { color: var(--accent-dark); border-bottom-color: var(--accent); font-weight: 600; }
#conversations-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; }
#conversations-list li { display: flex; align-items: center; gap: 0.7rem; padding: 0.7rem 0.9rem; border-bottom: 1px solid var(--border); cursor: pointer; }
#conversations-list li:hover { background: var(--accent-50); }
#conversations-list li.active { background: var(--accent-100); }
#conversations-list li.needs-human { background: #fef2f2; box-shadow: inset 3px 0 0 #dc2626; }
#conversations-list li.needs-human:hover { background: #fee2e2; }
#conversations-list li.needs-human.active { background: #fee2e2; }
:root:not([data-theme="light"]) #conversations-list li.needs-human,
:root[data-theme="dark"] #conversations-list li.needs-human { background: rgba(220, 38, 38, 0.14); }
#conversations-list .conv-dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: #dc2626; margin-right: 5px; vertical-align: middle; flex-shrink: 0;
}
#conversations-list li.unread .name { font-weight: 700; }
#conversations-list li.unread .preview { color: #b91c1c; font-weight: 600; }
#conversations-list .conv-unread-pill {
  flex-shrink: 0; font-size: 0.62rem; font-weight: 700; letter-spacing: 0.02em;
  text-transform: uppercase; color: #fff; background: #dc2626;
  border-radius: 999px; padding: 0.1rem 0.4rem; align-self: center;
}
#conversations-list .conv-text { min-width: 0; flex: 1; }
#conversations-list .conv-top-row { display: flex; align-items: baseline; justify-content: space-between; gap: 0.5rem; }
#conversations-list .name { font-weight: 600; font-size: 0.88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#conversations-list .conv-time { font-size: 0.7rem; color: var(--text-faint); flex-shrink: 0; }
#conversations-list .preview { font-size: 0.78rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-contact-btn {
  flex-shrink: 0; align-self: center; background: var(--card-bg); border: 1px solid var(--border);
  color: var(--text-muted); border-radius: 6px; padding: 0.25rem 0.55rem; font-size: 0.72rem;
  font-family: inherit; cursor: pointer; opacity: 0; transition: opacity 0.12s;
}
#conversations-list li:hover .conv-contact-btn { opacity: 1; }
.conv-contact-btn:hover { border-color: var(--accent); color: var(--text); }
@media (hover: none) { .conv-contact-btn { opacity: 1; } }

#conversations-list .conv-actions { display: flex; flex-direction: column; gap: 0.25rem; align-self: center; flex-shrink: 0; }
.conv-archive-btn {
  background: var(--card-bg); border: 1px solid var(--border); color: var(--text-muted);
  border-radius: 6px; padding: 0.2rem 0.4rem; font-size: 0.78rem; cursor: pointer; opacity: 0; transition: opacity 0.12s;
}
#conversations-list li:hover .conv-archive-btn { opacity: 1; }
.conv-archive-btn:hover { border-color: var(--accent); color: var(--text); }
@media (hover: none) { .conv-archive-btn { opacity: 1; } }
#conversations-list .conv-tags, .chat-header-id .conv-tags { display: flex; flex-wrap: wrap; gap: 0.25rem; margin-top: 0.25rem; }
.conv-tag {
  font-size: 0.62rem; font-weight: 600; color: #fff; border-radius: 999px;
  padding: 0.06rem 0.4rem; white-space: nowrap;
}
#conversations-list .conv-empty { padding: 1.4rem 1rem; text-align: center; color: var(--text-faint); font-size: 0.82rem; }
/* Barra de uso (limite de atendimentos do plano) */
.usage-bar { margin: 0 0 1rem; padding: 0.7rem 0.9rem; border: 1px solid var(--border); border-radius: 10px; background: var(--card-bg); }
.usage-bar--near { border-color: #f59e0b; background: #fffbeb; }
.usage-bar--over { border-color: #dc2626; background: #fef2f2; }
.usage-bar-top { display: flex; justify-content: space-between; gap: 0.6rem; flex-wrap: wrap; font-size: 0.82rem; }
.usage-bar-note { color: var(--text-muted); }
.usage-bar--over .usage-bar-note { color: #b91c1c; font-weight: 600; }
.usage-track { margin-top: 0.45rem; height: 7px; border-radius: 999px; background: var(--border); overflow: hidden; }
.usage-fill { height: 100%; background: var(--accent); border-radius: 999px; transition: width 0.3s; }
.usage-bar--near .usage-fill { background: #f59e0b; }
.usage-bar--over .usage-fill { background: #dc2626; }

/* Aprendizado da Alana */
.learning-card { margin-top: 0.7rem; }
.learning-head { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.learning-badge { font-size: 0.66rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.02em; color: #fff; border-radius: 999px; padding: 0.12rem 0.5rem; }
.learning-ev { font-size: 0.72rem; color: var(--text-faint); }
.learning-text { width: 100%; margin: 0.4rem 0; min-height: 3.5rem; }
.learning-actions { display: flex; align-items: center; gap: 0.4rem; margin-top: 0.5rem; flex-wrap: wrap; }

#chat-bulk-bar { padding: 0.5rem 0.7rem; border-bottom: 1px solid var(--border); background: var(--sidebar-bg); }
.chat-bulk-btn {
  width: 100%; padding: 0.45rem 0.6rem; border: 1px dashed var(--border); border-radius: 8px;
  background: var(--card-bg); color: var(--text-muted); font-size: 0.78rem; font-family: inherit; cursor: pointer;
}
.chat-bulk-btn:hover:not(:disabled) { border-color: var(--accent); color: var(--text); }
.chat-bulk-btn:disabled { opacity: 0.6; }

.conv-tag-menu {
  position: fixed; z-index: 200; width: 250px; max-height: 60vh; overflow-y: auto;
  background: var(--card-bg); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.18); padding: 0.5rem;
}
.conv-tag-menu-list { display: flex; flex-direction: column; gap: 0.15rem; }
.conv-tag-opt { display: flex; align-items: center; gap: 0.2rem; border-radius: 6px; }
.conv-tag-opt:hover { background: var(--accent-50); }
.conv-tag-pick {
  display: flex; align-items: center; gap: 0.4rem; flex: 1; min-width: 0; text-align: left;
  background: transparent; border: none; padding: 0.4rem 0.5rem; border-radius: 6px;
  cursor: pointer; font-size: 0.82rem; color: var(--text); font-family: inherit;
}
.conv-tag-pick.on { font-weight: 600; }
.conv-tag-check { margin-left: auto; color: var(--accent-dark); }
.conv-tag-del {
  flex-shrink: 0; background: transparent; border: none; cursor: pointer; padding: 0.3rem 0.4rem;
  font-size: 0.8rem; opacity: 0.35; border-radius: 6px;
}
.conv-tag-del:hover { opacity: 1; background: #fee2e2; }
.conv-tag-new { display: flex; flex-direction: column; gap: 0.4rem; margin-top: 0.5rem; padding-top: 0.5rem; border-top: 1px solid var(--border); }
.conv-tag-new-input { width: 100%; padding: 0.4rem 0.55rem; border: 1px solid var(--border); border-radius: 7px; font-size: 0.8rem; background: var(--card-bg); color: var(--text); font-family: inherit; }
.conv-tag-create { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.conv-tag-create:empty { display: none; }
.conv-tag-create .lbl { font-size: 0.78rem; color: var(--text-muted); }

.avatar-img { width: 100%; height: 100%; object-fit: cover; display: block; }
#conversations-list .avatar {
  width: 44px; height: 44px; border-radius: 50%; background: var(--accent-100); color: var(--accent-dark);
  display: flex; align-items: center; justify-content: center; font-size: 0.85rem; font-weight: 700; flex-shrink: 0;
  overflow: hidden;
}
.chat-avatar {
  width: 42px; height: 42px; border-radius: 50%; background: var(--accent-100); color: var(--accent-dark);
  display: flex; align-items: center; justify-content: center; font-size: 0.9rem; font-weight: 700; flex-shrink: 0;
  overflow: hidden;
}

#chat-window { display: flex; flex-direction: column; min-height: 0; position: relative; }
.chat-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.7rem; color: var(--text-faint); }
.chat-empty .nav-icon { width: 46px; height: 46px; }
.chat-empty p { font-size: 0.88rem; margin: 0; }
#chat-header { display: flex; align-items: center; gap: 0.7rem; padding: 0.8rem 1rem; border-bottom: 1px solid var(--border); flex-shrink: 0; background: var(--sidebar-bg); }
#chat-header .name { font-weight: 600; font-size: 0.92rem; }
#chat-header .phone { font-size: 0.78rem; color: var(--text-muted); }
.chat-header-actions { margin-left: auto; display: flex; gap: 0.4rem; }
.btn-chat-action {
  background: var(--card-bg); border: 1px solid var(--border); color: var(--text-muted);
  border-radius: 6px; padding: 0.35rem 0.7rem; cursor: pointer; font-size: 0.76rem; font-family: inherit;
}
.btn-chat-action:hover { border-color: var(--accent); color: var(--text); }
.btn-chat-action:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-chat-action:disabled:hover { border-color: var(--border); color: var(--text-muted); }

/* --- Painel de contato no chat (drawer com fundo borrado) --- */
.contact-panel-overlay {
  position: fixed; inset: 0; z-index: 2000; display: flex; justify-content: flex-end;
  background: rgba(15, 15, 20, 0.32);
  -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
}
.contact-panel-overlay[hidden] { display: none; }
.contact-panel {
  position: relative; width: 380px; max-width: 92vw; height: 100%;
  background: var(--card-bg); border-left: 1px solid var(--border);
  display: flex; flex-direction: column; box-shadow: -14px 0 40px rgba(0,0,0,0.25);
  animation: cp-slide-in 0.18s ease;
}
@keyframes cp-slide-in { from { transform: translateX(24px); opacity: 0.6; } to { transform: none; opacity: 1; } }
.contact-panel-head { display: flex; align-items: flex-start; justify-content: space-between; padding: 0.9rem 1rem; border-bottom: 1px solid var(--border); }
.contact-panel-title strong { display: block; font-size: 0.95rem; }
.contact-panel-tabs { display: flex; gap: 0.3rem; padding: 0.6rem 1rem; border-bottom: 1px solid var(--border); flex-wrap: wrap; align-items: center; }
.contact-panel-tabs button[data-cpt] {
  background: transparent; border: none; color: var(--text-muted); font-family: inherit;
  font-size: 0.8rem; padding: 0.3rem 0.5rem; border-radius: 6px; cursor: pointer;
}
.contact-panel-tabs button[data-cpt].active { background: var(--accent); color: #fff; }
#cp-open-chat { margin-left: auto; }
.contact-panel-body { display: none; padding: 1rem; overflow-y: auto; flex: 1; }
.contact-panel-body.active { display: block; }
.contact-panel-body label { display: block; font-size: 0.78rem; color: var(--text-muted); margin-bottom: 0.7rem; }
.contact-panel-body label input, .contact-panel-body label textarea, .contact-panel-body label select {
  display: block; width: 100%; margin-top: 0.2rem; border: 1px solid var(--border); border-radius: 6px;
  padding: 0.4rem 0.5rem; background: var(--bg); color: var(--text); font-family: inherit; font-size: 0.85rem;
}
.cp-crm-row { display: flex; gap: 0.7rem; }
.cp-crm-row label { flex: 1; min-width: 0; }
.cp-section-title { font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; color: var(--text-muted); margin-bottom: 0.5rem; }
.cp-tags-block { margin: 0.4rem 0 1rem; }
.cp-tags-title { font-size: 0.78rem; font-weight: 600; color: var(--text-muted); }
.cp-tags { display: flex; flex-wrap: wrap; gap: 0.3rem; margin: 0.4rem 0; }
.cp-tag { display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.74rem; font-weight: 600; padding: 0.15rem 0.2rem 0.15rem 0.55rem; border-radius: 999px; color: #fff; }
.cp-tag button {
  background: rgba(255,255,255,0.28); border: none; color: #fff; cursor: pointer;
  font-size: 0.8rem; line-height: 1; width: 15px; height: 15px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; padding: 0;
}
.cp-tag button:hover { background: rgba(255,255,255,0.5); }
.cp-tag-suggestions { display: flex; flex-direction: column; margin-top: 0.35rem; border: 1px solid var(--border); border-radius: 9px; overflow: hidden; max-height: 15rem; overflow-y: auto; }
.cp-tag-suggestions:empty { display: none; }
.cp-tag-opt { display: flex; align-items: center; gap: 0.15rem; background: var(--card-bg); border-top: 1px solid var(--border); }
.cp-tag-opt > button:first-child {
  flex: 1; min-width: 0; text-align: left; background: transparent; border: none;
  padding: 0.5rem 0.65rem; font-size: 0.82rem; font-family: inherit; color: var(--text); cursor: pointer;
  display: flex; align-items: center; gap: 0.5rem;
}
.cp-tag-opt > button:first-child.on { font-weight: 600; }
.cp-tag-opt:hover { background: var(--accent-50); }
.cp-tag-suggestions > *:first-child { border-top: none; }
.cp-tag-check { margin-left: auto; color: var(--accent-dark); }
.cp-tag-del {
  flex-shrink: 0; background: transparent; border: none; cursor: pointer; padding: 0.4rem 0.5rem;
  font-size: 0.82rem; opacity: 0.35; border-radius: 6px;
}
.cp-tag-del:hover { opacity: 1; background: #fee2e2; }
.cp-tag-suggestions .contact-tag-dot { width: 11px; height: 11px; border-radius: 50%; flex-shrink: 0; display: inline-block; }
.cp-tag-create-row { display: flex; align-items: center; gap: 0.55rem; flex-wrap: wrap; padding: 0.5rem 0.65rem; background: var(--card-bg); border-top: 1px solid var(--border); }
.cp-tag-create-row .lbl { font-size: 0.8rem; color: var(--text-muted); }
.cp-tag-swatches { display: flex; gap: 0.3rem; flex-wrap: wrap; }
.cp-tag-swatch { width: 18px; height: 18px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; padding: 0; flex-shrink: 0; }
.cp-tag-swatch:hover { border-color: var(--text-faint); transform: scale(1.12); }
.cp-appt-row { border: 1px solid var(--border); border-radius: 8px; padding: 0.5rem 0.6rem; margin-bottom: 0.4rem; font-size: 0.82rem; }
.cp-appt-row .when { font-weight: 600; }
.cp-appt-row .meta { color: var(--text-muted); font-size: 0.76rem; }
.cp-auto-row { display: flex; justify-content: space-between; gap: 0.5rem; border-bottom: 1px solid var(--border); padding: 0.4rem 0; font-size: 0.8rem; }
.cp-auto-row .k { color: var(--accent); font-weight: 600; font-size: 0.72rem; }

.cp-timeline-row { border: 1px solid var(--border); border-radius: 8px; padding: 0.5rem 0.6rem; margin-bottom: 0.5rem; font-size: 0.82rem; }
.cp-timeline-row .cp-tl-top { display: flex; justify-content: space-between; gap: 0.5rem; align-items: baseline; }
.cp-timeline-row .title { font-weight: 600; }
.cp-timeline-row .when { color: var(--text-faint); font-size: 0.72rem; white-space: nowrap; }
.cp-timeline-row .desc { color: var(--text-muted); font-size: 0.78rem; margin-top: 0.2rem; }
.cp-timeline-row .actor { color: var(--text-faint); font-size: 0.72rem; margin-top: 0.2rem; }

.contact-panel-footer {
  display: flex; align-items: center; justify-content: space-between; gap: 0.6rem;
  padding: 0.75rem 1rem; border-top: 1px solid var(--border); flex-shrink: 0;
}
.cp-footer-right { display: flex; align-items: center; gap: 0.6rem; }
.btn-danger-solid {
  background: #ef4444; border: 1px solid #ef4444; color: #fff; border-radius: 8px;
  padding: 0.5rem 0.9rem; cursor: pointer; font-size: 0.82rem; font-weight: 600; font-family: inherit;
}
.btn-danger-solid:hover { background: #dc2626; border-color: #dc2626; }
.contact-tags { display: inline-flex; gap: 0.25rem; flex-wrap: wrap; vertical-align: middle; }
.contact-tag-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; }
.contact-tag-chip { font-size: 0.68rem; padding: 0.08rem 0.4rem; border-radius: 999px; color: #fff; }
#chat-messages {
  flex: 1; overflow-y: auto; padding: 1rem; display: flex; flex-direction: column; gap: 0.35rem;
  background-color: var(--bg);
  background-image: radial-gradient(var(--border) 1px, transparent 1px);
  background-size: 20px 20px;
}
.chat-date-sep {
  align-self: center; background: var(--card-bg); border: 1px solid var(--border); color: var(--text-muted);
  font-size: 0.72rem; padding: 0.25rem 0.8rem; border-radius: 999px; margin: 0.5rem 0;
}
.chat-event {
  align-self: center; max-width: 85%; display: flex; align-items: flex-start; gap: 0.5rem;
  background: var(--card-bg); border: 1px solid var(--accent-100); color: var(--accent-dark);
  border-radius: 10px; padding: 0.5rem 0.7rem; font-size: 0.78rem; margin: 0.3rem 0;
}
.chat-event .nav-icon { width: 15px; height: 15px; margin-top: 0.1rem; flex-shrink: 0; }
.chat-event-text { font-weight: 600; }
.chat-event-meta { color: var(--text-faint); font-size: 0.72rem; margin-top: 0.1rem; }
.msg {
  position: relative; max-width: 68%; padding: 0.5rem 0.7rem 0.4rem; border-radius: 10px; font-size: 0.88rem;
  display: flex; flex-direction: column; gap: 0.2rem; box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}
.msg-text { white-space: pre-wrap; word-break: break-word; }
.msg-time { align-self: flex-end; font-size: 0.68rem; color: var(--text-faint); }
.msg-media { max-width: 100%; max-height: 320px; border-radius: 8px; cursor: pointer; display: block; }
.msg-media-wrap { position: relative; display: inline-block; }
.msg-media-wrap video { cursor: default; }
.msg-media-expand { position: absolute; top: 6px; right: 6px; font-size: 0.7rem; padding: 0.2rem 0.45rem; border: 0; border-radius: 6px; background: rgba(0,0,0,0.6); color: #fff; cursor: pointer; }
.msg-media-expand:hover { background: rgba(0,0,0,0.8); }

/* Visualizador de anexo em tela cheia (imagem e video). */
.media-viewer { position: fixed; inset: 0; z-index: 1000; background: rgba(0,0,0,0.88); display: flex; align-items: center; justify-content: center; padding: 2.5rem 1rem; }
.media-viewer-item { max-width: 95vw; max-height: 85vh; border-radius: 10px; display: block; }
.media-viewer-close { position: absolute; top: 0.6rem; right: 0.9rem; font-size: 2rem; line-height: 1; background: none; border: 0; color: #fff; cursor: pointer; padding: 0.2rem 0.6rem; }
.media-viewer-download { position: absolute; bottom: 1rem; left: 50%; transform: translateX(-50%); color: #fff; font-size: 0.85rem; text-decoration: none; background: rgba(255,255,255,0.15); padding: 0.4rem 1rem; border-radius: 999px; }
.media-viewer-download:hover { background: rgba(255,255,255,0.28); }
.msg-audio { max-width: 240px; }
.msg-file {
  display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.4rem 0.6rem; border-radius: 8px;
  background: rgba(0,0,0,0.06); color: inherit; text-decoration: none; font-size: 0.82rem; word-break: break-all;
}
.msg-file .nav-icon { width: 16px; height: 16px; flex-shrink: 0; }
.msg-author { font-size: 0.72rem; font-weight: 700; opacity: 0.75; }
.msg.user { align-self: flex-start; background: var(--card-bg); border-bottom-left-radius: 2px; }
.msg.user::after {
  content: ""; position: absolute; left: -7px; bottom: 0; border-style: solid;
  border-width: 0 8px 8px 0; border-color: transparent var(--card-bg) transparent transparent;
}
.msg.assistant { align-self: flex-end; background: var(--msg-assistant-bg); color: var(--msg-assistant-text); border-bottom-right-radius: 2px; }
.msg.assistant::after {
  content: ""; position: absolute; right: -7px; bottom: 0; border-style: solid;
  border-width: 0 0 8px 8px; border-color: transparent transparent transparent var(--msg-assistant-bg);
}
.msg.human { align-self: flex-end; background: var(--msg-out-bg); color: var(--msg-out-text); border-bottom-right-radius: 2px; }
.msg.human::after {
  content: ""; position: absolute; right: -7px; bottom: 0; border-style: solid;
  border-width: 0 0 8px 8px; border-color: transparent transparent transparent var(--msg-out-bg);
}
#chat-controls { border-top: 1px solid var(--border); padding: 0.6rem 1rem; display: flex; flex-direction: column; gap: 0.5rem; background: var(--sidebar-bg); }
#chat-form { display: flex; gap: 0.5rem; align-items: center; }
#chat-input { flex: 1; padding: 0.6rem 1rem; border: 1px solid var(--border); border-radius: 999px; background: var(--card-bg); color: var(--text); }
#chat-send-btn {
  width: 40px; height: 40px; padding: 0; border-radius: 50%; flex-shrink: 0;
  background: var(--accent); color: white; display: flex; align-items: center; justify-content: center;
}
#chat-send-btn .nav-icon { width: 18px; height: 18px; }
#chat-send-btn:disabled { opacity: 0.5; }
#btn-chat-attach {
  width: 38px; height: 38px; padding: 0; border-radius: 50%; flex-shrink: 0; cursor: pointer;
  background: var(--card-bg); border: 1px solid var(--border); color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
}
#btn-chat-attach:hover, #btn-chat-mic:hover { color: var(--accent-dark); border-color: var(--accent-100); }
#btn-chat-attach .nav-icon, #btn-chat-mic .nav-icon { width: 18px; height: 18px; }
#btn-chat-mic {
  width: 38px; height: 38px; padding: 0; border-radius: 50%; flex-shrink: 0; cursor: pointer;
  background: var(--card-bg); border: 1px solid var(--border); color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
}
#btn-chat-mic.recording { background: #dc2626; border-color: #dc2626; color: #fff; animation: micpulse 1s infinite; }
@keyframes micpulse { 0%,100% { opacity: 1; } 50% { opacity: 0.55; } }
.chat-attach-audio { max-width: 200px; height: 34px; }

/* Barra "Gravando..." */
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: #dc2626; flex-shrink: 0; animation: recpulse 1s ease-in-out infinite; }
@keyframes recpulse { 0%,100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.5); opacity: 0.4; } }
.rec-label { font-size: 0.82rem; color: #b91c1c; font-weight: 600; }
.rec-time { font-size: 0.82rem; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.rec-stop {
  flex-shrink: 0; width: 30px; height: 30px; border-radius: 50%; border: none; cursor: pointer;
  background: #dc2626; color: #fff; font-size: 0.7rem; display: flex; align-items: center; justify-content: center;
}
.rec-stop:hover { background: #b91c1c; }

/* Player compacto do áudio anexado */
.chat-audio-mini { display: inline-flex; align-items: center; gap: 0.5rem; }
.chat-audio-play {
  flex-shrink: 0; width: 30px; height: 30px; border-radius: 50%; border: none; cursor: pointer;
  background: var(--accent); color: #fff; font-size: 0.72rem; display: flex; align-items: center; justify-content: center;
}
.chat-audio-time { font-size: 0.78rem; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.chat-audio-wave {
  width: 46px; height: 16px; flex-shrink: 0;
  background: repeating-linear-gradient(90deg, var(--accent) 0 2px, transparent 2px 5px);
  -webkit-mask: linear-gradient(90deg, #000 0 100%);
  opacity: 0.5;
}
#chat-attach-preview {
  display: flex; align-items: center; gap: 0.6rem; padding: 0.5rem 0.7rem;
  background: var(--card-bg); border: 1px solid var(--border); border-radius: 10px;
}
.chat-attach-thumb { width: 44px; height: 44px; object-fit: cover; border-radius: 6px; }
.chat-attach-file { font-size: 0.82rem; word-break: break-all; }
.chat-attach-hint { font-size: 0.74rem; color: var(--text-faint); flex: 1; }
.chat-attach-x {
  flex-shrink: 0; width: 24px; height: 24px; border-radius: 50%; border: none; cursor: pointer;
  background: rgba(0,0,0,0.08); color: var(--text-muted); font-size: 1rem; line-height: 1;
}
#btn-toggle-human { align-self: flex-start; background: var(--accent-50); border: 1px solid var(--accent-100); color: var(--accent-dark); border-radius: 8px; padding: 0.3rem 0.7rem; cursor: pointer; font-size: 0.8rem; }

/* --- Forms / buttons --- */

/* Base de TODO campo de digitação do painel (dashboard + login). Antes cada
   modal tinha que ser listado por id na mão, e os que faltavam ficavam com o
   input cru do navegador (textarea monoespaçada, label colada, etc). */
.app-shell input,
.app-shell select,
.app-shell textarea,
.auth-gate input {
  width: 100%;
  font-family: inherit;
  font-size: 0.9rem;
  line-height: 1.4;
  color: var(--text);
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 0.6rem 0.75rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.app-shell textarea,
.auth-gate textarea {
  min-height: 5rem;
  resize: vertical;
  line-height: 1.55;
}
.app-shell input::placeholder,
.app-shell textarea::placeholder,
.auth-gate input::placeholder { color: var(--text-faint); }

.app-shell input:focus,
.app-shell select:focus,
.app-shell textarea:focus,
.auth-gate input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-50);
}

.app-shell input[type="checkbox"],
.app-shell input[type="radio"] {
  width: auto;
  padding: 0;
  accent-color: var(--accent);
}
.app-shell input[type="color"] { padding: 0.15rem; height: 2.4rem; cursor: pointer; }
.app-shell input[type="number"] { max-width: 100%; }

/* seta própria no select (o triângulo padrão fica feio e desalinhado) */
.app-shell select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 2.1rem;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.7rem center;
  cursor: pointer;
}

/* Labels que embrulham um campo viram coluna (texto em cima, campo embaixo).
   As linhas de checkbox / dias da semana mantêm o layout em linha (têm
   !important próprio mais abaixo). */
.app-shell form > label,
.app-shell .broadcast-form > label,
.modal-card form label,
.modal-form-row label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
}

.broadcast-form { display: flex; flex-direction: column; gap: 0.8rem; margin-bottom: 1.2rem; }
.broadcast-form-row { display: flex; align-items: flex-end; gap: 1rem; flex-wrap: wrap; }
.broadcast-form-row label { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.8rem; color: var(--text-muted); }
.broadcast-form-row select, .broadcast-form-row input[type="datetime-local"], .broadcast-form-row input[type="text"] {
  padding: 0.45rem 0.6rem; border: 1px solid var(--border); border-radius: 8px; background: var(--card-bg); color: var(--text);
}
.weekday-picker { display: flex; gap: 0.6rem; flex-wrap: wrap; }
.weekday-picker label { flex-direction: row !important; align-items: center; gap: 0.3rem !important; font-size: 0.8rem; }
.weekday-picker input { width: auto; }

button { font-family: inherit; }

/* =======================================================================
   .btn-brand — botao reutilizavel da area administrativa
   Uso:  <button class="btn-brand btn-brand--primary">Salvar</button>
         <button class="btn-brand btn-brand--secondary btn-brand--sm">Cancelar</button>
   Icone a esquerda:  <span class="nav-icon" data-icon="plus"></span> + texto
   Variantes: --primary (laranja solido) | --secondary (contorno laranja)
   Tamanhos:  (padrao = md, ~44px) | --sm (~36px)
   So icone:  adicione --icon e um aria-label no botao.
   ======================================================================= */
.btn-brand {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: inherit;
  font-weight: 600;
  font-size: 0.875rem;
  line-height: 1;
  min-height: 44px;               /* area de clique >= 44px */
  padding: 0 1.375rem;            /* ~22px */
  border-radius: 9999px;          /* pill */
  border: 1.5px solid transparent;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 150ms ease, color 150ms ease,
              border-color 150ms ease, box-shadow 150ms ease, transform 150ms ease;
}
.btn-brand .nav-icon,
.btn-brand svg { width: 18px; height: 18px; flex-shrink: 0; }

.btn-brand--sm { min-height: 36px; padding: 0 1rem; font-size: 0.8rem; gap: 0.4rem; }
.btn-brand--sm .nav-icon,
.btn-brand--sm svg { width: 16px; height: 16px; }

.btn-brand--icon { padding: 0; width: 44px; }
.btn-brand--icon.btn-brand--sm { width: 36px; }

/* Variante primaria — laranja solido, texto branco.
   Seletor com 2 classes de proposito: precisa vencer `button[type=submit]`
   e `.broadcast-form-row button` do CSS base. */
.btn-brand.btn-brand--primary {
  background: var(--brand-blue);
  color: #fff;
  box-shadow: 0 1px 2px rgba(0,0,0,0.12), 0 4px 10px var(--brand-blue-soft);
}
.btn-brand.btn-brand--primary:hover {
  background: var(--brand-blue-hover);
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0,0,0,0.14), 0 8px 18px var(--brand-blue-soft);
}
.btn-brand.btn-brand--primary:active { transform: translateY(0); box-shadow: 0 1px 2px rgba(0,0,0,0.12); }

/* Variante secundaria — contorno laranja, preenche no hover */
.btn-brand.btn-brand--secondary {
  background: transparent;
  color: var(--brand-blue-line);
  border-color: var(--brand-blue-line);
}
.btn-brand.btn-brand--secondary:hover {
  background: var(--brand-blue-soft);
  transform: translateY(-1px);
}
.btn-brand.btn-brand--secondary:active { transform: translateY(0); }

.btn-brand:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--brand-blue-ring);
}
.btn-brand:disabled,
.btn-brand[disabled],
.btn-brand.is-disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
  pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
  .btn-brand,
  .btn-brand:hover,
  .btn-brand:active { transform: none; }
}

button[type="submit"]:not(.btn-brand), .broadcast-form-row button:not(.btn-brand) {
  background: var(--accent); color: white; border: none; border-radius: 8px;
  padding: 0.55rem 1.2rem; cursor: pointer; height: fit-content; font-weight: 600; font-size: 0.85rem;
}
button[type="submit"]:not(.btn-brand):hover, .broadcast-form-row button:not(.btn-brand):hover { background: var(--accent-hover); }

.btn-save { background: var(--accent); color: white; border: none; border-radius: 6px; padding: 0.4rem 0.8rem; cursor: pointer; font-size: 0.8rem; }
.btn-approve { background: #10b981; color: white; border: none; border-radius: 6px; padding: 0.3rem 0.8rem; cursor: pointer; font-size: 0.78rem; }
.btn-discard { background: transparent; border: 1px solid var(--border); color: var(--text-muted); border-radius: 6px; padding: 0.3rem 0.8rem; cursor: pointer; font-size: 0.78rem; }
.btn-cancel { background: transparent; border: 1px solid #ef4444; color: #ef4444; border-radius: 6px; padding: 0.3rem 0.6rem; cursor: pointer; font-size: 0.78rem; }
[data-theme="dark"] .btn-approve { background: var(--accent); }
[data-theme="dark"] .btn-cancel { border-color: var(--border); color: var(--accent-dark); }
td.actions { display: flex; gap: 0.4rem; }

/* Personalizar Alana: sub-abas e cartões */
.rules-panel { display: none; }
.rules-panel.active { display: block; }
.rules-cat-filter { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.6rem 0 1rem; }
.rules-cat-filter button {
  background: var(--card-bg); border: 1px solid var(--border); color: var(--text-muted);
  border-radius: 999px; padding: 0.3rem 0.8rem; font-size: 0.78rem; cursor: pointer; font-family: inherit;
}
.rules-cat-filter button.active { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.rule-cat-hints { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.rule-cat-hint { cursor: pointer; }

.rules-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 0.9rem; }
.rule-card-2 {
  background: var(--card-bg); border: 1px solid var(--border); border-radius: 12px; padding: 1rem 1.1rem;
  display: flex; flex-direction: column; gap: 0.5rem;
}
.rule-card-2 .rc-top { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.rule-card-2 .rc-title { font-weight: 700; font-size: 0.95rem; }
.rule-card-2 .rc-body { font-size: 0.88rem; color: var(--text-muted); white-space: pre-wrap; }
.rule-card-2 .rc-when { font-size: 0.78rem; color: var(--text-faint); }
.rule-card-2 .rc-actions { display: flex; gap: 0.5rem; margin-top: 0.2rem; }
.rc-tag {
  font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em;
  padding: 0.15rem 0.5rem; border-radius: 999px; background: var(--accent-50); color: var(--accent-dark);
}
.rc-tag.muted { background: var(--bg); color: var(--text-faint); }

/* Histórico de atividades */
.activity-item { display: flex; gap: 0.8rem; padding: 0.9rem 0.2rem; border-bottom: 1px solid var(--border); }
.activity-item:last-child { border-bottom: none; }
.activity-icon {
  width: 34px; height: 34px; flex-shrink: 0; border-radius: 9px;
  background: var(--accent-50); color: var(--accent);
  display: flex; align-items: center; justify-content: center;
}
.activity-icon svg { width: 18px; height: 18px; }
.activity-body { flex: 1; min-width: 0; }
.activity-head { display: flex; justify-content: space-between; gap: 1rem; align-items: baseline; }
.activity-head strong { font-size: 0.92rem; }
.activity-time { font-size: 0.78rem; color: var(--text-faint); white-space: nowrap; }
.activity-desc { font-size: 0.86rem; color: var(--text-muted); margin: 0.2rem 0; }
.activity-meta { display: flex; flex-wrap: wrap; gap: 0.2rem 1.2rem; font-size: 0.8rem; color: var(--text-muted); }
.activity-meta b { color: var(--text-faint); font-weight: 600; }

.chat-birthdate-wrap { display: inline-flex; align-items: center; gap: 0.3rem; margin-left: auto; font-size: 0.85rem; }
.chat-birthdate { border: 1px solid var(--border); border-radius: 6px; padding: 0.25rem 0.4rem; background: var(--bg); color: var(--text); font-family: inherit; font-size: 0.8rem; }

/* --- Modal --- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 1500; background: rgba(0, 0, 0, 0.45);
  display: flex; align-items: center; justify-content: center; padding: 1rem;
}
.modal-card { background: var(--card-bg); border: 1px solid var(--border); border-radius: 14px; width: 100%; max-width: 460px; padding: 1.4rem; max-height: 90vh; overflow-y: auto; }
.modal-card-lg { max-width: 680px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.1rem; }
.modal-header h3 { margin: 0; font-size: 1.1rem; font-weight: 700; }
.modal-close { background: transparent; border: none; color: var(--text-muted); font-size: 1.4rem; line-height: 1; cursor: pointer; padding: 0; }
/* Layout de qualquer form dentro de modal — vale pra todos, sem listar id. */
.modal-card form { display: flex; flex-direction: column; gap: 0.85rem; }
.modal-card form > label { margin: 0; }
.modal-actions { display: flex; justify-content: flex-end; gap: 0.6rem; margin-top: 0.6rem; }
.modal-actions .btn-cancel { margin-right: auto; }

.modal-inline-title { margin: 0 0 0.3rem; font-weight: 700; font-size: 1rem; }
.crm-inline-modal label { display: block; font-size: 0.78rem; color: var(--text-muted); margin-bottom: 0.7rem; }
.crm-inline-modal label input, .crm-inline-modal label select {
  display: block; width: 100%; margin-top: 0.25rem; border: 1px solid var(--border); border-radius: 6px;
  padding: 0.45rem 0.55rem; background: var(--bg); color: var(--text); font-family: inherit; font-size: 0.88rem;
}

.modal-form-row { display: flex; gap: 0.8rem; flex-wrap: wrap; }
.modal-form-row label { flex: 1 1 8rem; }
.modal-section {
  display: flex; flex-direction: column; gap: 0.6rem; background: var(--bg); border: 1px solid var(--border);
  border-radius: 10px; padding: 0.8rem; margin: 0.2rem 0;
}
.section-header-sm { font-size: 0.85rem; font-weight: 700; color: var(--text); }
.checkbox-row { flex-direction: row !important; align-items: center; gap: 0.4rem !important; }
.checkbox-row input { width: auto; }
.char-counter { text-align: right; margin: -0.4rem 0 0; }

.payment-methods-grid { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.payment-method-btn {
  background: var(--bg); border: 1px solid var(--border); color: var(--text-muted);
  border-radius: 8px; padding: 0.4rem 0.8rem; font-size: 0.8rem; cursor: pointer;
}
.payment-method-btn.active { background: var(--accent-50); border-color: var(--accent); color: var(--accent-dark); font-weight: 600; }

.photo-dropzone {
  border: 1.5px dashed var(--border); border-radius: 10px; padding: 1.2rem; text-align: center;
  cursor: pointer; color: var(--text-muted); font-size: 0.85rem; background: var(--bg);
}
.photo-dropzone:hover { border-color: var(--accent); }
.photo-dropzone .nav-icon { width: 22px; height: 22px; color: var(--accent); margin-bottom: 0.3rem; }
.photo-dropzone p { margin: 0; }
#pd-photo-preview { max-width: 100%; max-height: 140px; border-radius: 8px; }

.list-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 0.8rem; flex-wrap: wrap; }
.list-count { font-weight: 700; font-size: 1rem; }
.list-toolbar-actions { display: flex; gap: 0.6rem; align-items: center; }
.list-toolbar-actions input {
  padding: 0.45rem 0.7rem; border: 1px solid var(--border); border-radius: 8px; background: var(--card-bg); color: var(--text); font-family: inherit;
}
.product-thumb { width: 36px; height: 36px; border-radius: 6px; object-fit: cover; background: var(--bg); display: block; }
.payment-badge {
  display: inline-block; background: var(--accent-50); color: var(--accent-dark); border-radius: 999px;
  padding: 0.15rem 0.55rem; font-size: 0.72rem; margin: 0.1rem 0.2rem 0.1rem 0;
}
.cell-truncate { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.professionals-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; }
.professional-card { background: var(--card-bg); border: 1px solid var(--border); border-radius: 10px; padding: 1rem; }
.professional-card-header { display: flex; align-items: flex-start; gap: 0.7rem; }
.professional-avatar {
  width: 44px; height: 44px; border-radius: 50%; object-fit: cover; display: flex; align-items: center;
  justify-content: center; color: white; font-weight: 700; font-size: 0.95rem; flex-shrink: 0;
}
.professional-card-info { flex: 1; min-width: 0; }
.professional-card-info .name { font-weight: 700; }
.professional-card-info .instagram { color: var(--text-muted); font-size: 0.8rem; }
.professional-card-bio { color: var(--text-muted); font-size: 0.82rem; margin: 0.6rem 0; }
.professional-card-procedures { display: flex; flex-wrap: wrap; gap: 0.3rem; border-top: 1px solid var(--border); padding-top: 0.6rem; margin-top: 0.4rem; }
.professional-card-procedures .label { width: 100%; font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; color: var(--text-faint); }

.color-swatch-grid { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 0.6rem; }
.color-swatch { width: 26px; height: 26px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; padding: 0; }
.color-swatch.active { border-color: var(--text); }

.spinner {
  display: inline-block; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid var(--border); border-top-color: var(--accent);
  animation: spin 0.7s linear infinite; flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

.import-stats-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 0.8rem;
  margin: 1rem 0; padding: 0.9rem; border: 1px solid var(--border); border-radius: 8px; background: var(--bg);
}

.uazapi-config-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 0.8rem;
}

@media (max-width: 720px) {
  .uazapi-config-grid { grid-template-columns: 1fr; }
}
.import-stats-grid div { display: flex; flex-direction: column; gap: 0.1rem; }
.import-stats-grid span { font-size: 1.4rem; font-weight: 700; color: var(--accent-dark); }
.import-stats-grid label { font-size: 0.72rem; color: var(--text-muted); }

.procedures-checklist { display: flex; flex-wrap: wrap; gap: 0.5rem; max-height: 140px; overflow-y: auto; border: 1px solid var(--border); border-radius: 8px; padding: 0.6rem; background: var(--bg); }
.procedures-checklist label { flex-direction: row !important; align-items: center; gap: 0.3rem !important; font-size: 0.8rem; }
.procedures-checklist input { width: auto; }

.procedure-photos-grid { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-bottom: 0.6rem; }
.procedure-photo-item { position: relative; width: 96px; }
.procedure-photo-item img { width: 96px; height: 96px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); display: block; }
.procedure-photo-item input { width: 96px; margin-top: 0.3rem; font-size: 0.7rem; padding: 0.2rem 0.35rem; }
.procedure-photo-remove { position: absolute; top: -6px; right: -6px; width: 20px; height: 20px; border-radius: 50%; border: none; background: #dc2626; color: #fff; font-size: 0.75rem; line-height: 1; cursor: pointer; display: flex; align-items: center; justify-content: center; }

/* --- Auth gate (tela de login que bloqueia o painel inteiro) --- */
.auth-gate { position: fixed; inset: 0; z-index: 2000; background: var(--bg); display: flex; align-items: center; justify-content: center; padding: 1rem; }
.auth-gate-card { width: 100%; max-width: 360px; text-align: center; }
.auth-gate-card h1 { margin: 0 0 0.3rem; font-size: 1.4rem; }
.auth-gate-card form { display: flex; flex-direction: column; gap: 0.8rem; text-align: left; margin-top: 1rem; }
.auth-gate-card label { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.8rem; color: var(--text-muted); }
.auth-gate-card input {
  padding: 0.55rem 0.7rem; border: 1px solid var(--border); border-radius: 8px; background: var(--card-bg); color: var(--text); font-family: inherit;
}
.auth-gate-card button[type="submit"] { width: 100%; }

/* --- Misc --- */
.hint { color: var(--text-muted); font-size: 0.85rem; margin-top: -0.6rem; margin-bottom: 1rem; }

.section-header {
  display: flex; align-items: center; gap: 0.5rem; font-size: 0.78rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.03em; color: var(--text-muted); margin-bottom: 0.6rem;
}
.section-header .nav-icon { width: 16px; height: 16px; color: var(--accent); }

.location-card { position: relative; margin-bottom: 1rem; }
.location-card-header { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 0.8rem; flex-wrap: wrap; }
.location-card-header .badge-primary { font-size: 0.68rem; font-weight: 700; color: var(--accent-dark); text-transform: uppercase; letter-spacing: 0.03em; }
.location-card-header .spacer { flex: 1; }
.location-card-header label.active-toggle { display: flex; align-items: center; gap: 0.4rem; font-size: 0.8rem; color: var(--text-muted); flex-direction: row !important; }
.btn-icon-plain {
  width: 30px; height: 30px; padding: 0; border-radius: 6px; border: 1px solid var(--border);
  background: var(--card-bg); color: var(--text-muted); display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.btn-icon-plain .nav-icon { width: 15px; height: 15px; }
.btn-icon-plain:hover { background: var(--accent-50); }
.btn-icon-plain:disabled { opacity: 0.35; cursor: default; }
.location-card .full-address-preview { font-size: 0.78rem; color: var(--text-faint); margin: 0.4rem 0 0; }
.btn-add-unit {
  width: 100%; background: transparent; border: 1px dashed var(--border); color: var(--accent-dark);
  border-radius: 10px; padding: 0.8rem; cursor: pointer; font-weight: 600; font-size: 0.85rem; margin-bottom: 1rem;
}
.btn-add-unit:hover { background: var(--accent-50); }
h3 { font-size: 1rem; margin: 1.4rem 0 0.6rem; }

.rule-card { background: var(--card-bg); border: 1px solid var(--border); border-radius: 10px; padding: 0.8rem 1rem; margin-bottom: 0.7rem; }
.rule-card.pending { border-left: 4px solid #f59e0b; }
.rule-card .category { font-size: 0.72rem; text-transform: uppercase; color: var(--text-faint); font-weight: 600; }
.rule-card .raw { font-size: 0.78rem; color: var(--text-faint); margin: 0.2rem 0; }
.rule-card .instruction, .rule-card .question { font-size: 0.9rem; margin: 0.3rem 0 0.6rem; }
.rule-card .actions { display: flex; gap: 0.5rem; }

#followup-body textarea { width: 100%; min-height: 3.5rem; font-family: inherit; font-size: 0.85rem; padding: 0.4rem; border-radius: 6px; border: 1px solid var(--border); resize: vertical; background: var(--card-bg); color: var(--text); }
#followup-body input[type="number"] { width: 4.5rem; padding: 0.3rem; border-radius: 6px; border: 1px solid var(--border); background: var(--card-bg); color: var(--text); }

#procedures-body input[type="text"] { width: 100%; padding: 0.3rem; border: 1px solid var(--border); border-radius: 6px; background: var(--card-bg); color: var(--text); }
#procedures-body input[type="number"] { width: 5rem; padding: 0.3rem; border: 1px solid var(--border); border-radius: 6px; background: var(--card-bg); color: var(--text); }

code { background: var(--accent-50); color: var(--accent-dark); padding: 0.1rem 0.35rem; border-radius: 4px; font-size: 0.85em; }

@media (max-width: 1300px) {
  .dash-columns { grid-template-columns: 1fr; }
  .chat-layout { grid-template-columns: 240px 1fr; }
}

/* =====================================================================
   MOBILE (<= 860px): sidebar vira gaveta, chat vira painel único,
   tabelas rolam na horizontal, modais viram folha de baixo.
   ===================================================================== */
@media (max-width: 860px) {
  .app-shell { flex-direction: column; }

  .mobile-topbar {
    display: flex; align-items: center; gap: 0.7rem;
    position: sticky; top: 0; z-index: 90;
    background: var(--sidebar-bg); border-bottom: 1px solid var(--border);
    padding: 0.55rem 0.85rem;
  }
  .mobile-topbar-logo { width: 26px; height: 26px; border-radius: 7px; object-fit: contain; flex-shrink: 0; }
  [data-theme="dark"] .mobile-topbar-logo { background: #fff; padding: 2px; }
  .mobile-topbar strong { font-size: 0.95rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .mobile-nav-toggle {
    width: 38px; height: 38px; flex-shrink: 0; cursor: pointer;
    border: 1px solid var(--border); border-radius: 9px; background: var(--card-bg);
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  }
  .mobile-nav-toggle span { width: 18px; height: 2px; border-radius: 2px; background: var(--text); }

  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 120;
    width: 80vw; max-width: 300px; height: 100%;
    flex-direction: column; flex-wrap: nowrap;
    transform: translateX(-100%); transition: transform 0.22s ease;
    box-shadow: 0 0 44px rgba(0, 0, 0, 0.28);
  }
  .side-nav { flex-direction: column; flex-wrap: nowrap; overflow-y: auto; }
  #app-root.nav-open .sidebar { transform: none; }

  .sidebar-backdrop {
    display: block; position: fixed; inset: 0; z-index: 110;
    background: rgba(0, 0, 0, 0.42);
    opacity: 0; pointer-events: none; transition: opacity 0.2s ease;
  }
  #app-root.nav-open .sidebar-backdrop { opacity: 1; pointer-events: auto; }
  #app-root.nav-open .panel-ai-fab { opacity: 0; pointer-events: none; }

  main { padding: 1rem 0.85rem 4rem; }

  .page-header { flex-wrap: wrap; }
  .page-header h1 { font-size: 1.2rem; }
  .page-header > button, .page-header > .header-actions { font-size: 0.8rem; padding: 0.5rem 0.85rem; }

  .stat-grid { grid-template-columns: 1fr 1fr; }
  .dash-columns { grid-template-columns: 1fr; }
  .crm-column { max-height: none; min-width: 78vw; }

  /* Tabelas: rolam na horizontal dentro do card em vez de estourar a página. */
  .card table { display: block; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  th, td { padding: 0.5rem 0.55rem; font-size: 0.82rem; white-space: nowrap; }

  /* Chat: um painel de cada vez (lista OU conversa). */
  .chat-layout { grid-template-columns: 1fr; height: calc(100dvh - 200px); min-height: 380px; }
  .chat-list-pane { border-right: none; }
  #chat-window { display: none; }
  .chat-layout--conv .chat-list-pane { display: none; }
  .chat-layout--conv #chat-window { display: flex; }
  .chat-back {
    display: block; flex-shrink: 0; text-align: left;
    background: var(--sidebar-bg); border: none; border-bottom: 1px solid var(--border);
    color: var(--accent-dark); font-family: inherit; font-size: 0.85rem; font-weight: 600;
    padding: 0.55rem 0.9rem; cursor: pointer;
  }
  .conv-contact-btn { opacity: 1; }

  .contact-panel { width: 100%; max-width: 100%; }

  /* Modais: folha ancorada embaixo, ocupa a largura toda. */
  .modal-overlay { padding: 0; align-items: flex-end; }
  .modal-card, .modal-card-lg { max-width: 100%; border-radius: 16px 16px 0 0; max-height: 92vh; }
  .modal-actions { flex-wrap: wrap; }
}

@media (max-width: 460px) {
  .stat-grid { grid-template-columns: 1fr; }
  main { padding: 0.9rem 0.7rem 4rem; }
}

/* --- Assistente de ajuda: visivel somente dentro do app autenticado --- */
.panel-ai-fab {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 60px;
  height: 60px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  box-shadow: 0 14px 36px rgba(194, 65, 12, 0.34);
  cursor: pointer;
  z-index: 2200;
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}
.panel-ai-fab:hover { transform: translateY(-2px) scale(1.03); }
.panel-ai-fab:focus-visible { outline: 3px solid var(--brand-blue-ring); outline-offset: 4px; }
.panel-ai-fab img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: #fff;
  object-fit: contain;
}
.panel-ai-fab-label {
  position: absolute;
  right: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%);
  padding: 9px 13px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--card-bg);
  color: var(--text);
  box-shadow: 0 8px 24px rgba(0,0,0,0.14);
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
  pointer-events: none;
  transition: opacity 0.16s ease, transform 0.16s ease;
}
.panel-ai-fab.is-open .panel-ai-fab-label { opacity: 0; transform: translate(6px, -50%); }

.panel-ai-window {
  position: fixed;
  right: 24px;
  bottom: 96px;
  width: min(390px, calc(100vw - 32px));
  height: min(580px, calc(100vh - 128px));
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--card-bg);
  box-shadow: 0 24px 72px rgba(0,0,0,0.28);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(14px) scale(0.98);
  pointer-events: none;
  z-index: 2201;
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.panel-ai-window.is-open { opacity: 1; transform: none; pointer-events: auto; }

.panel-ai-head {
  padding: 14px 15px;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
}
.panel-ai-identity { display: flex; align-items: center; gap: 10px; min-width: 0; }
.panel-ai-identity img { width: 38px; height: 38px; border-radius: 50%; background: #fff; padding: 2px; }
.panel-ai-identity strong { display: block; font-size: 0.94rem; }
.panel-ai-identity span { display: block; margin-top: 2px; font-size: 0.72rem; opacity: 0.88; }
.panel-ai-close {
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: rgba(255,255,255,0.16);
  color: #fff;
  font: 400 1.35rem/1 system-ui, sans-serif;
  cursor: pointer;
  flex-shrink: 0;
}
.panel-ai-close:hover { background: rgba(255,255,255,0.28); }

.panel-ai-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.panel-ai-message {
  max-width: 86%;
  padding: 10px 13px;
  border-radius: 14px;
  font-size: 0.88rem;
  line-height: 1.48;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.panel-ai-message--assistant {
  align-self: flex-start;
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
  background: var(--card-bg);
  color: var(--text);
}
.panel-ai-message--user {
  align-self: flex-end;
  border-bottom-right-radius: 4px;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: #fff;
}
.panel-ai-typing { display: flex; align-items: center; gap: 4px; width: fit-content; }
.panel-ai-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-faint);
  animation: panel-ai-bounce 1s infinite ease-in-out;
}
.panel-ai-typing span:nth-child(2) { animation-delay: 0.15s; }
.panel-ai-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes panel-ai-bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.5; }
  40% { transform: translateY(-5px); opacity: 1; }
}

.panel-ai-form {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--border);
  background: var(--card-bg);
  flex-shrink: 0;
}
.panel-ai-form input {
  flex: 1;
  min-width: 0;
  height: 40px;
  padding: 0 13px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 0.86rem;
  outline: none;
}
.panel-ai-form input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--brand-blue-soft); }
.panel-ai-form button {
  min-width: 68px;
  height: 40px;
  padding: 0 13px;
  border: 0;
  border-radius: 999px;
  background: var(--brand-blue);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}
.panel-ai-form button:hover { background: var(--brand-blue-hover); }
.panel-ai-form button:disabled { cursor: wait; opacity: 0.65; }
.panel-ai-note {
  margin: 0;
  padding: 0 12px 10px;
  background: var(--card-bg);
  color: var(--text-faint);
  font-size: 0.66rem;
  text-align: center;
  flex-shrink: 0;
}

@media (max-width: 600px) {
  .panel-ai-fab { right: 16px; bottom: 16px; width: 56px; height: 56px; }
  .panel-ai-fab-label { display: none; }
  .panel-ai-window {
    right: 10px;
    left: 10px;
    bottom: 10px;
    width: auto;
    height: min(72vh, 560px);
  }
}
@media (prefers-reduced-motion: reduce) {
  .panel-ai-fab, .panel-ai-fab-label, .panel-ai-window { transition: none; }
  .panel-ai-typing span { animation: none; }
}
