/* Blueprint Inovare V8 §14 — Treinador IAs Atendimento (glass híbrido) */

:root {
  --bg: #050505;
  --panel: rgba(15, 15, 20, 0.6);
  --panel-2: rgba(25, 28, 41, 0.6);
  --border: rgba(255, 255, 255, 0.08);
  --muted: #94a3b8;
  --text: #f1f5f9;
  --primary: #6366f1;
  --accent: #ec4899;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --cta-grad: linear-gradient(135deg, #6366f1 0%, #ec4899 100%);
  --font-ui: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;
  --font-display: 'Space Grotesk', 'Inter', sans-serif;
  --topbar-bg: rgba(5, 5, 5, 0.4);
  --badge-bg: rgba(255, 255, 255, 0.05);
  --grid-line: rgba(99, 102, 241, 0.07);
}

/* M2.4 — Tema claro (override de variáveis) */
[data-theme="light"] {
  --bg: #f5f7fb;
  --panel: rgba(255, 255, 255, 0.78);
  --panel-2: rgba(241, 245, 249, 0.85);
  --border: rgba(15, 23, 42, 0.10);
  --muted: #475569;
  --text: #0f172a;
  --topbar-bg: rgba(255, 255, 255, 0.7);
  --badge-bg: rgba(15, 23, 42, 0.06);
  --grid-line: rgba(99, 102, 241, 0.10);
}
[data-theme="light"] .noise-overlay { opacity: 0.02; }

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

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.font-display { font-family: var(--font-display); letter-spacing: -0.02em; }
.font-mono    { font-family: var(--font-mono); }

/* Grid + noise background (fixed, behind everything) */
.grid-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background-color: var(--bg);
  background-image:
    linear-gradient(to right, var(--grid-line) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid-line) 1px, transparent 1px);
  background-size: 60px 60px;
  animation: gridShift 20s linear infinite;
}

.noise-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  opacity: 0.04;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

@keyframes gridShift {
  0%   { background-position: 0 0; }
  100% { background-position: 60px 60px; }
}

/* Reading progress (landing top bar) */
.reading-progress, #reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0%;
  z-index: 9999;
  background: linear-gradient(90deg, var(--primary), var(--accent), var(--primary));
  background-size: 300% 100%;
  animation: gradientMove 4s linear infinite;
  transition: width 0.1s linear;
}

@keyframes gradientMove {
  0%   { background-position: 0% 50%; }
  100% { background-position: 300% 50%; }
}

/* Sidebar — glass 260px */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: 260px;
  height: 100vh;
  padding: 24px 16px;
  background: var(--panel);
  backdrop-filter: blur(12px) saturate(160%);
  -webkit-backdrop-filter: blur(12px) saturate(160%);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 50;
}

.sidebar .brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1rem;
  padding: 8px 12px 20px;
  color: var(--text);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 8px;
  border-left: 3px solid transparent;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.92rem;
  transition: transform 0.2s ease, background 0.25s ease, color 0.2s ease;
}

.nav-item:hover {
  transform: translateX(4px);
  color: var(--text);
  background: rgba(255, 255, 255, 0.03);
}

.nav-item.active {
  background: linear-gradient(90deg, rgba(99, 102, 241, 0.15), transparent);
  border-left: 3px solid var(--primary);
  color: var(--text);
}

/* Glass card with staggered fade-in */
.glass-card {
  background: var(--panel-2);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 20px 50px -20px rgba(0, 0, 0, 0.6);
  opacity: 0;
  transform: translateY(20px);
  animation: fadeUp 0.6s ease forwards;
}

.glass-card:nth-child(1) { animation-delay: 0.05s; }
.glass-card:nth-child(2) { animation-delay: 0.15s; }
.glass-card:nth-child(3) { animation-delay: 0.25s; }
.glass-card:nth-child(4) { animation-delay: 0.35s; }
.glass-card:nth-child(5) { animation-delay: 0.45s; }
.glass-card:nth-child(6) { animation-delay: 0.55s; }

@keyframes fadeUp {
  to { opacity: 1; transform: translateY(0); }
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 999px;
  border: 1px solid transparent;
}

.badge-success { background: rgba(16, 185, 129, 0.12); color: var(--success); border-color: rgba(16, 185, 129, 0.3); }
.badge-danger  { background: rgba(239, 68, 68, 0.12);  color: var(--danger);  border-color: rgba(239, 68, 68, 0.3); }
.badge-warning { background: rgba(245, 158, 11, 0.12); color: var(--warning); border-color: rgba(245, 158, 11, 0.3); }
.badge-info    { background: rgba(99, 102, 241, 0.12); color: var(--primary); border-color: rgba(99, 102, 241, 0.3); }

/* Buttons */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border: none;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.92rem;
  color: #fff;
  cursor: pointer;
  background: var(--cta-grad);
  background-size: 200% 100%;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.3);
  transition: transform 0.2s ease, background-position 0.4s ease, box-shadow 0.3s ease;
}

.btn-primary:hover {
  transform: translateY(-2px);
  background-position: 100% 0;
  box-shadow: 0 8px 28px rgba(236, 72, 153, 0.45), 0 0 40px rgba(99, 102, 241, 0.3);
}

.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--text);
  background: transparent;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.btn-secondary:hover {
  border-color: rgba(99, 102, 241, 0.6);
  background: rgba(99, 102, 241, 0.06);
}

/* Toast top-right */
.toast {
  position: fixed;
  top: 20px;
  right: 20px;
  min-width: 300px;
  max-width: 380px;
  padding: 14px 18px;
  border-radius: 10px;
  background: var(--panel);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  color: var(--text);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
  z-index: 10000;
  animation: toastIn 0.3s ease forwards;
}

.toast.toast-success { border-left: 3px solid var(--success); }
.toast.toast-danger  { border-left: 3px solid var(--danger); }
.toast.toast-warning { border-left: 3px solid var(--warning); }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(40px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* QR Modal */
.qr-modal {
  position: fixed;
  inset: 0;
  background: rgba(5, 5, 5, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9000;
}

.qr-modal__box {
  position: relative;
  width: 360px;
  height: 360px;
  padding: 24px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
}

.qr-modal__label {
  font-size: 0.85rem;
  color: var(--muted);
  text-align: center;
}

.qr-modal__close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.qr-modal__close:hover { color: var(--text); border-color: var(--accent); }

/* Chat bubbles */
.chat-thread {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 480px;
  overflow-y: auto;
  padding: 8px;
}

.chat-thread::-webkit-scrollbar { width: 6px; }
.chat-thread::-webkit-scrollbar-track { background: transparent; }
.chat-thread::-webkit-scrollbar-thumb {
  background: rgba(99, 102, 241, 0.3);
  border-radius: 3px;
}

.chat-bubble {
  max-width: 75%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 0.9rem;
  line-height: 1.4;
  word-wrap: break-word;
}

.chat-bubble.in {
  align-self: flex-start;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-bottom-left-radius: 4px;
}

.chat-bubble.out {
  align-self: flex-end;
  background: rgba(99, 102, 241, 0.18);
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-bottom-right-radius: 4px;
}

.chat-bubble .meta {
  display: block;
  font-size: 0.7rem;
  color: var(--muted);
  margin-top: 4px;
}

/* Spinner */
.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(255, 255, 255, 0.08);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Reveal up (landing scroll-in) */
.reveal-up {
  opacity: 0;
  transform: translateY(30px);
  filter: blur(12px);
  transition: opacity 0.8s ease, transform 0.8s ease, filter 0.8s ease;
}

.reveal-up.active {
  opacity: 1;
  transform: translateY(0);
  filter: blur(0);
}

/* Glow text utility */
.glow-text {
  text-shadow: 0 0 8px rgba(99, 102, 241, 0.4), 0 0 20px rgba(236, 72, 153, 0.2);
}

/* Layout helper */
.app-main {
  margin-left: 260px;
  padding: 32px;
  min-height: 100vh;
}

@media (max-width: 768px) {
  .sidebar { width: 240px; transform: translateX(-100%); transition: transform 0.3s ease; }
  .sidebar.open { transform: translateX(0); }
  .app-main { margin-left: 0; padding: 20px; }
}

/* ============================================================
   PAINEL APP SHELL — classes usadas em app.html
   Estendido (não substitui o que está acima)
   ============================================================ */

/* Font utilities (Tailwind-style helpers usados no HTML) */
.font-inter { font-family: 'Inter', system-ui, -apple-system, sans-serif; }
.font-space { font-family: 'Space Grotesk', 'Inter', sans-serif; letter-spacing: -0.02em; }

/* Root shell layout */
.app-shell {
  display: flex;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

/* Sidebar glass — 260px fixo */
.sidebar-glass {
  width: 260px;
  flex-shrink: 0;
  background: rgba(15, 15, 20, 0.7);
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  border-right: 1px solid var(--border);
  padding: 1.5rem 1rem;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 50;
}

.sidebar-header {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.5rem;
}

.logo-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--cta-grad);
  display: grid;
  place-items: center;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
}

.logo-icon i,
.logo-icon svg {
  width: 22px;
  height: 22px;
}

.logo-text h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.15rem;
  color: var(--text);
  line-height: 1;
  font-weight: 700;
}

.logo-text .logo-sub {
  margin: 0.25rem 0 0;
  font-size: 0.7rem;
  color: var(--muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.sidebar-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

/* Override nav-item para variante botão dentro de .sidebar-nav */
.sidebar-nav .nav-item {
  display: flex;
  gap: 0.85rem;
  align-items: center;
  padding: 0.7rem 0.85rem;
  border-radius: 12px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-left: 3px solid transparent;
  cursor: pointer;
  font: inherit;
  font-size: 0.9rem;
  text-align: left;
  transition: background 0.25s ease, color 0.2s ease, transform 0.2s ease;
  width: 100%;
}

.sidebar-nav .nav-item i,
.sidebar-nav .nav-item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.sidebar-nav .nav-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  transform: translateX(3px);
}

.sidebar-nav .nav-item.active {
  background: linear-gradient(90deg, rgba(99, 102, 241, 0.18), transparent);
  color: #c7d2fe;
  border-left: 3px solid var(--primary);
  padding-left: calc(0.85rem - 3px);
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.75rem;
  color: var(--muted);
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.status-dot-pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.15);
  animation: pulse 2s infinite;
  flex-shrink: 0;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.5; }
}

/* Main area */
.main-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* Topbar */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 2rem;
  border-bottom: 1px solid var(--border);
  background: var(--topbar-bg);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar-title {
  font-size: 1.4rem;
  font-family: var(--font-display);
  color: var(--text);
  margin: 0;
  font-weight: 600;
}

.topbar-sub {
  font-size: 0.8rem;
  color: var(--muted);
  margin: 0.15rem 0 0;
}

/* Badge pill */
.badge-pill {
  display: inline-flex;
  gap: 0.5rem;
  align-items: center;
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  background: var(--badge-bg);
  border: 1px solid var(--border);
  font-size: 0.75rem;
  color: var(--text);
}

.badge-pill .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
  display: inline-block;
}

.badge-pill .dot.ok  { background: var(--success); box-shadow: 0 0 8px rgba(16, 185, 129, 0.45); }
.badge-pill .dot.err { background: var(--danger);  box-shadow: 0 0 8px rgba(239, 68, 68, 0.45); }

/* Content area */
.content-area {
  flex: 1;
  padding: 2rem;
  overflow: auto;
}

/* View show/hide */
.view { display: block; }
.view.hidden { display: none !important; }

/* Stat grid + cards */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.stat-card {
  padding: 1.5rem;
  border-radius: 18px;
  background: var(--panel);
  border: 1px solid var(--border);
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 20px 50px -20px rgba(0, 0, 0, 0.6);
  transition: transform 0.25s ease, border-color 0.25s ease;
}

.stat-card:hover {
  transform: translateY(-2px);
  border-color: rgba(99, 102, 241, 0.35);
}

@keyframes statPulse {
  0%   { transform: scale(1); box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.55); }
  50%  { transform: scale(1.03); box-shadow: 0 0 0 10px rgba(99, 102, 241, 0); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(99, 102, 241, 0); }
}

.stat-card.pulse {
  animation: statPulse 0.6s ease-out;
  border-color: rgba(99, 102, 241, 0.65);
}

.stat-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.75rem;
}

.stat-head i,
.stat-head svg {
  width: 16px;
  height: 16px;
  color: var(--primary);
}

.stat-label {
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.5rem;
}

.stat-value {
  font-family: var(--font-mono);
  font-size: 2rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.1;
}

.stat-delta {
  font-size: 0.75rem;
  margin-top: 0.5rem;
  color: var(--success);
}

/* Panel (genérico para views internas) */
.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.5rem;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  margin-bottom: 1.25rem;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  gap: 1rem;
}

.panel-title {
  margin: 0;
  font-size: 1.15rem;
  color: var(--text);
  font-weight: 600;
}

.panel-sub {
  color: var(--muted);
  font-size: 0.85rem;
  margin: 0 0 1rem;
}

.panel-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.panel-actions.end { justify-content: flex-end; }

.panel-divider {
  height: 1px;
  background: var(--border);
  margin: 1rem 0;
}

.panel.row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.row-left {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}

.kicker {
  font-size: 0.7rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  display: block;
  margin-bottom: 0.4rem;
}

/* Btn ghost + link */
.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--text);
  background: transparent;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.btn-ghost:hover {
  border-color: rgba(99, 102, 241, 0.6);
  background: rgba(99, 102, 241, 0.06);
}

.btn-ghost.hidden { display: none; }

.link-btn {
  background: transparent;
  border: 0;
  color: var(--primary);
  cursor: pointer;
  display: inline-flex;
  gap: 6px;
  align-items: center;
  font: inherit;
  font-size: 0.85rem;
}

.link-btn:hover { color: var(--accent); }

/* QR area */
.qr-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  padding: 1.5rem;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border);
  border-radius: 14px;
}

.qr-area.hidden { display: none; }

.qr-area img,
.wa-qr-img {
  display: block;
  margin: 0 auto;
  max-width: 320px;
  max-height: 320px;
  width: 100%;
  height: auto;
  border-radius: 16px;
  padding: 12px;
  background: #ffffff;
}

.qr-hint {
  font-size: 0.8rem;
  color: var(--muted);
  text-align: center;
  margin: 0;
}

.wa-action-btn {
  padding: 0.7rem 1.5rem;
  border: 0;
  border-radius: 10px;
  background: var(--cta-grad);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.3);
}

/* QR modal v2 (content variant em app.html) */
.qr-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 5, 5, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.qr-modal-content {
  position: relative;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  max-width: 360px;
  z-index: 1;
}

.qr-modal-label {
  font-size: 0.9rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

/* Section helpers */
.section-title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  margin: 0 0 1rem;
  color: var(--text);
  font-weight: 600;
}

.section-sub {
  color: var(--muted);
  margin: 0 0 1.5rem;
}

/* Tables */
.panel-table {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 0.5rem;
  overflow: auto;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.panel-table table,
.table-treinador {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.panel-table th,
.panel-table td,
.table-treinador th,
.table-treinador td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  font-size: 0.88rem;
}

.panel-table th,
.table-treinador th {
  color: var(--muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
}

.panel-table tr:hover td,
.table-treinador tr:hover td {
  background: rgba(255, 255, 255, 0.03);
}

/* Card list (conversas / qa / rag) */
.card-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* Conversations split layout (M3.1) */
.conversations-grid {
  display: grid;
  grid-template-columns: minmax(260px, 320px) 1fr;
  gap: 1rem;
  margin-top: 1rem;
}
@media (max-width: 900px) {
  .conversations-grid { grid-template-columns: 1fr; }
}
.conv-item {
  padding: 0.75rem 0.875rem;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  background: rgba(255,255,255,0.02);
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease;
}
.conv-item:hover { background: rgba(255,255,255,0.05); border-color: rgba(255,255,255,0.18); }
.conv-item.active { border-color: var(--accent, #22c55e); background: rgba(34,197,94,0.08); }
.conv-item .conv-jid { font-weight: 600; font-size: 0.85rem; }
.conv-item .conv-last { font-size: 0.78rem; opacity: 0.72; margin-top: 0.25rem; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-item .conv-meta { font-size: 0.7rem; opacity: 0.55; margin-top: 0.35rem; display: flex; justify-content: space-between; }

.card-list .empty,
.empty-state {
  padding: 3rem 1rem;
  text-align: center;
  color: var(--muted);
}

.empty {
  padding: 2rem 1rem;
  text-align: center;
  color: var(--muted);
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.75rem;
}

.empty .spinner {
  width: 18px;
  height: 18px;
  border-width: 2px;
}

/* Search row */
.search-row {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

/* Inputs */
.input-field,
.input-treinador {
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.input-field:focus,
.input-treinador:focus {
  outline: 2px solid var(--primary);
  outline-offset: 0;
  border-color: var(--primary);
  background: rgba(255, 255, 255, 0.06);
}

.textarea-treinador {
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  color: var(--text);
  font: inherit;
  min-height: 120px;
  resize: vertical;
}

textarea.input-field { min-height: 120px; resize: vertical; }

/* Code/chat output blocks */
.code-out,
.chat-out {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem;
  min-height: 200px;
  max-height: 400px;
  overflow: auto;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  white-space: pre-wrap;
  color: var(--text);
  margin: 0;
}

.code-emerald { color: #6ee7b7; }

/* Toast container */
#toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

#toast-container > * { pointer-events: auto; }

/* Responsive — sidebar colapsa em telas pequenas */
@media (max-width: 900px) {
  .sidebar-glass {
    width: 72px;
    padding: 1.25rem 0.5rem;
  }
  .logo-text,
  .sidebar-nav .nav-item span,
  .sidebar-footer span:last-child {
    display: none;
  }
  .sidebar-nav .nav-item { justify-content: center; padding: 0.7rem; }
  .topbar { padding: 1rem 1.25rem; }
  .content-area { padding: 1.25rem; }
}

/* ===========================================================================
   Landing — Resultados em números (stats)
   =========================================================================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
}

.stat-card {
  background: var(--panel-2);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 1.75rem 1.5rem;
  text-align: center;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 20px 50px -20px rgba(0, 0, 0, 0.6);
}

.stat-number {
  font-family: var(--font-mono);
  font-size: 3rem;
  font-weight: 600;
  line-height: 1;
  background: var(--cta-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin-bottom: 0.5rem;
}

.stat-label {
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.4;
}

/* ===========================================================================
   Landing — Para quem é (audience list)
   =========================================================================== */
.audience-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.audience-list li {
  position: relative;
  padding-left: 1.5rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.audience-list li::before {
  content: "›";
  position: absolute;
  left: 0;
  top: 0;
  color: var(--accent);
  font-weight: 700;
}

/* ===========================================================================
   Landing — Comparativo Antes / Depois
   =========================================================================== */
.compare-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
}

.compare-col {
  background: var(--panel-2);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 1.75rem;
}

.compare-col.bad  { border-left: 3px solid var(--danger); }
.compare-col.good { border-left: 3px solid var(--success); }

.compare-col ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.compare-col li {
  position: relative;
  padding-left: 1.75rem;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.compare-col.bad li::before {
  content: "✕";
  position: absolute;
  left: 0;
  top: 0;
  color: var(--danger);
  font-weight: 700;
}

.compare-col.good li::before {
  content: "✓";
  position: absolute;
  left: 0;
  top: 0;
  color: var(--success);
  font-weight: 700;
}

/* ===========================================================================
   Landing — Planos / Pricing
   =========================================================================== */
.pricing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  align-items: stretch;
}

.pricing-card {
  position: relative;
  background: var(--panel-2);
  backdrop-filter: blur(18px) saturate(180%);
  -webkit-backdrop-filter: blur(18px) saturate(180%);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 2rem 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 20px 50px -20px rgba(0, 0, 0, 0.6);
  transition: transform 0.25s ease, box-shadow 0.3s ease;
}

.pricing-card:hover { transform: translateY(-4px); }

.pricing-card.featured {
  transform: translateY(-12px);
  border: 1px solid transparent;
  background:
    linear-gradient(var(--panel-2), var(--panel-2)) padding-box,
    var(--cta-grad) border-box;
  box-shadow:
    0 0 0 1px rgba(236, 72, 153, 0.25),
    0 30px 80px -20px rgba(99, 102, 241, 0.45),
    0 20px 60px -20px rgba(236, 72, 153, 0.45);
}

.pricing-card.featured:hover { transform: translateY(-16px); }

.pricing-popular {
  position: absolute;
  top: -14px;
  left: 50%;
  transform: translateX(-50%);
  padding: 6px 14px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #fff;
  background: var(--cta-grad);
  border-radius: 999px;
  box-shadow: 0 8px 22px rgba(236, 72, 153, 0.45);
}

.pricing-badge {
  align-self: flex-start;
  padding: 4px 12px;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 999px;
  background: rgba(99, 102, 241, 0.12);
  color: var(--primary);
  border: 1px solid rgba(99, 102, 241, 0.3);
}

.pricing-value {
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
  font-family: var(--font-mono);
  margin: 0.25rem 0;
}

.pricing-currency {
  font-size: 1.1rem;
  color: var(--muted);
}

.pricing-amount {
  font-size: 3rem;
  font-weight: 600;
  line-height: 1;
  color: var(--text);
}

.pricing-period {
  font-size: 0.95rem;
  color: var(--muted);
}

.pricing-tagline {
  font-size: 0.9rem;
  color: var(--muted);
  margin: 0;
}

.pricing-features {
  list-style: none;
  padding: 0;
  margin: 0 0 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  flex: 1;
}

.pricing-features li {
  position: relative;
  padding-left: 1.6rem;
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.4;
}

.pricing-features li::before {
  content: "✓";
  position: absolute;
  left: 0;
  top: 0;
  color: var(--success);
  font-weight: 700;
}

.pricing-card .btn-primary { width: 100%; }

/* ===========================================================================
   Landing — Depoimentos
   =========================================================================== */
.testimonial-card {
  position: relative;
  background: var(--panel-2);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 2rem 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 20px 50px -20px rgba(0, 0, 0, 0.6);
}

.testimonial-quote {
  position: absolute;
  top: 0.5rem;
  left: 1.25rem;
  font-family: var(--font-display);
  font-size: 4.5rem;
  line-height: 1;
  background: var(--cta-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  opacity: 0.55;
}

.testimonial-text {
  position: relative;
  font-size: 0.95rem;
  color: var(--text);
  line-height: 1.55;
  margin: 1.5rem 0 0;
}

.testimonial-author {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.testimonial-avatar {
  width: 48px;
  height: 48px;
  border-radius: 9999px;
  background: var(--cta-grad);
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-weight: 700;
  color: #fff;
  font-size: 1.1rem;
  box-shadow: 0 8px 20px rgba(236, 72, 153, 0.35);
}

.testimonial-name {
  font-weight: 600;
  color: var(--text);
  font-size: 0.92rem;
}

.testimonial-role {
  font-size: 0.78rem;
  color: var(--muted);
}

/* ===========================================================================
   Landing — Garantia
   =========================================================================== */
.guarantee-banner {
  position: relative;
  background: var(--panel-2);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 2.5rem 2rem;
  text-align: center;
  overflow: hidden;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 20px 50px -20px rgba(0, 0, 0, 0.6);
}

.guarantee-banner::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 80% 20%, rgba(99, 102, 241, 0.18), transparent 60%),
    radial-gradient(circle at 20% 80%, rgba(236, 72, 153, 0.15), transparent 60%);
  pointer-events: none;
}

.guarantee-text {
  position: relative;
  font-size: 1rem;
  color: var(--muted);
  max-width: 540px;
  margin: 0 auto;
  line-height: 1.6;
}

.guarantee-seal {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 96px;
  height: 96px;
  border-radius: 9999px;
  background: var(--cta-grad);
  display: grid;
  place-items: center;
  text-align: center;
  color: #fff;
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.1;
  box-shadow: 0 12px 30px rgba(236, 72, 153, 0.45);
  transform: rotate(-8deg);
}

.guarantee-seal-top    { display: block; font-size: 1rem; }
.guarantee-seal-bottom { display: block; font-size: 0.7rem; opacity: 0.9; font-weight: 500; }

/* ===========================================================================
   Landing — CTA final
   =========================================================================== */
.cta-final {
  margin-top: 3rem;
  padding: 4rem 1.5rem;
  text-align: center;
  background:
    linear-gradient(135deg, rgba(99, 102, 241, 0.18) 0%, rgba(236, 72, 153, 0.18) 100%),
    radial-gradient(circle at 50% 0%, rgba(99, 102, 241, 0.25), transparent 70%);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.cta-final-text {
  font-size: 1.1rem;
  color: var(--muted);
  max-width: 560px;
  margin: 0 auto 2rem;
}

.cta-final-btn {
  padding: 14px 28px;
  font-size: 1rem;
}

@media (max-width: 640px) {
  .pricing-card.featured { transform: none; }
  .guarantee-seal { width: 76px; height: 76px; top: 0.5rem; right: 0.5rem; }
  .guarantee-seal-top { font-size: 0.85rem; }
  .guarantee-seal-bottom { font-size: 0.6rem; }
  .stat-number { font-size: 2.4rem; }
}

/* Loading skeleton (M2.1) */
.skeleton {
  display: inline-block;
  position: relative;
  overflow: hidden;
  background: linear-gradient(90deg, rgba(51,65,85,0.55) 0%, rgba(71,85,105,0.75) 50%, rgba(51,65,85,0.55) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
  border-radius: 6px;
  color: transparent !important;
  user-select: none;
}
.skeleton-text {
  min-width: 3ch;
  min-height: 1em;
  vertical-align: middle;
}
.stat-value .skeleton-text {
  display: inline-block;
  width: 4ch;
  height: 1.5rem;
}
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* =========================================================
 * M2.2 — Toast system (4 variants, queued, max 3 visible)
 * ======================================================= */
#toast-container.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9998;
  display: flex;
  flex-direction: column;
  gap: 12px;
  pointer-events: none;
  max-width: min(380px, calc(100vw - 40px));
}
.toast {
  pointer-events: auto;
  position: relative;
  display: grid;
  grid-template-columns: 28px 1fr 24px;
  gap: 10px;
  align-items: start;
  padding: 12px 14px 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-left-width: 4px;
  background: rgba(15, 23, 42, 0.78);
  backdrop-filter: blur(10px) saturate(140%);
  -webkit-backdrop-filter: blur(10px) saturate(140%);
  color: #e2e8f0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.4;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35), 0 2px 6px rgba(0, 0, 0, 0.2);
  animation: toast-in 240ms cubic-bezier(0.22, 1, 0.36, 1) both;
  will-change: transform, opacity;
}
.toast.toast-leaving {
  animation: toast-out 200ms cubic-bezier(0.4, 0, 1, 1) both;
}
.toast-success { border-left-color: #10b981; }
.toast-error   { border-left-color: #f43f5e; }
.toast-warning { border-left-color: #f59e0b; }
.toast-info    { border-left-color: #0ea5e9; }
.toast-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
}
.toast-success .toast-icon { background: rgba(16, 185, 129, 0.18); color: #34d399; }
.toast-error   .toast-icon { background: rgba(244, 63, 94, 0.18);  color: #fb7185; }
.toast-warning .toast-icon { background: rgba(245, 158, 11, 0.18); color: #fbbf24; }
.toast-info    .toast-icon { background: rgba(14, 165, 233, 0.18); color: #38bdf8; }
.toast-content {
  min-width: 0;
  word-wrap: break-word;
}
.toast-title {
  display: block;
  font-weight: 600;
  margin-bottom: 2px;
  color: #f1f5f9;
}
.toast-msg {
  display: block;
  color: #cbd5e1;
}
.toast-close {
  background: transparent;
  border: 0;
  color: #94a3b8;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 6px;
  transition: background 120ms ease, color 120ms ease;
  align-self: start;
}
.toast-close:hover { background: rgba(255, 255, 255, 0.08); color: #f1f5f9; }
.toast-close:focus-visible { outline: 2px solid #38bdf8; outline-offset: 2px; }
@keyframes toast-in {
  from { transform: translateX(24px); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}
@keyframes toast-out {
  from { transform: translateX(0);    opacity: 1; max-height: 200px; }
  to   { transform: translateX(24px); opacity: 0; max-height: 0; padding-top: 0; padding-bottom: 0; margin-top: 0; border-width: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .toast, .toast.toast-leaving { animation-duration: 1ms; }
}

/* M2.6 — Mobile drawer */
.sidebar-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  padding: 8px;
  margin-right: 8px;
  background: transparent;
  border: none;
  color: inherit;
  cursor: pointer;
  border-radius: 8px;
}
.sidebar-toggle i { width: 24px; height: 24px; }
.sidebar-backdrop { display: none; }

@media (max-width: 768px) {
  .sidebar-toggle { display: inline-flex; }
  .app-shell { grid-template-columns: 1fr; }
  .sidebar-glass {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(280px, 80vw);
    transform: translateX(-100%);
    transition: transform .25s ease;
    z-index: 50;
  }
  .sidebar-glass.is-open { transform: none; }
  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .45);
    z-index: 40;
    backdrop-filter: blur(2px);
  }
  .sidebar-backdrop[hidden] { display: none; }
}

@media (min-width: 769px) {
  .sidebar-toggle, .sidebar-backdrop { display: none !important; }
}

/* M2.7 — Pricing reveal */
.reveal-on-scroll {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity .6s cubic-bezier(.22,1,.36,1), transform .6s cubic-bezier(.22,1,.36,1);
  transition-delay: var(--reveal-delay, 0ms);
  will-change: opacity, transform;
}
.reveal-on-scroll.is-visible {
  opacity: 1;
  transform: none;
}
@media (prefers-reduced-motion: reduce) {
  .reveal-on-scroll {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* M2.3 — Confirm modal */
.confirm-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.confirm-modal[hidden] {
  display: none;
}
.confirm-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.confirm-modal-content {
  position: relative;
  z-index: 1;
  max-width: 420px;
  width: calc(100% - 32px);
  padding: 24px;
  border-radius: 14px;
  background: var(--surface, #0f1419);
  border: 1px solid var(--border, rgba(255, 255, 255, 0.12));
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.45);
  color: var(--text, #e6edf3);
}
.confirm-modal-title {
  margin: 0 0 8px 0;
  font-size: 18px;
  line-height: 1.3;
}
.confirm-modal-msg {
  margin: 0 0 20px 0;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-muted, #a0a8b3);
}
.confirm-modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  align-items: center;
}
.confirm-modal-actions button:focus-visible {
  outline: 2px solid var(--accent, #5eead4);
  outline-offset: 2px;
}
.confirm-modal-actions .btn-primary.danger {
  background: #b91c1c;
  border-color: #b91c1c;
  color: #fff;
}
.confirm-modal-actions .btn-primary.danger:hover {
  background: #991b1b;
  border-color: #991b1b;
}


/* ── M4-clone — Training split + prompt versions + scope badges ─────── */
.training-split {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 16px;
  margin-top: 16px;
}
@media (max-width: 900px) {
  .training-split { grid-template-columns: 1fr; }
}
.prompt-card {
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 10px;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, transform .15s ease;
}
.prompt-card:hover { background: rgba(255, 255, 255, 0.07); }
.prompt-card.is-selected {
  border-color: rgba(168, 85, 247, 0.7);
  background: linear-gradient(180deg, rgba(168, 85, 247, 0.08), rgba(168, 85, 247, 0.02));
}
.prompt-card-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 14px;
}
.prompt-card-head .kicker { margin-left: auto; font-size: 11px; }
.prompt-card-body {
  font-size: 12px;
  opacity: .75;
  line-height: 1.45;
  max-height: 4.5em;
  overflow: hidden;
  font-family: 'JetBrains Mono', monospace;
}
.prompt-card-actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}
.chip {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.chip-on {
  background: rgba(34, 197, 94, 0.15);
  color: #4ade80;
  border: 1px solid rgba(34, 197, 94, 0.35);
}
.scope-badge {
  display: inline-block;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 600;
  margin-right: 6px;
}
.scope-pro  { background: rgba(34, 197, 94, 0.15); color: #4ade80; border: 1px solid rgba(34, 197, 94, 0.35); }
.scope-pers { background: rgba(59, 130, 246, 0.15); color: #60a5fa; border: 1px solid rgba(59, 130, 246, 0.35); }
.scope-ign  { background: rgba(148, 163, 184, 0.15); color: #94a3b8; border: 1px solid rgba(148, 163, 184, 0.35); }
.scope-pend { background: rgba(250, 204, 21, 0.15); color: #facc15; border: 1px solid rgba(250, 204, 21, 0.35); }
.scope-select {
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
  color: inherit;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* WA — Connected number card */
.wa-connected { border-left: 3px solid rgba(16,185,129,.55); }
.wa-me-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin: 12px 0 4px;
}
.wa-me-cell {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.06);
  border-radius: 10px;
}
.wa-me-value {
  font-size: 15px;
  font-weight: 600;
  color: #e5e7eb;
}
.btn-ghost.danger { color: #fca5a5; border-color: rgba(248,113,113,.35); }
.btn-ghost.danger:hover { background: rgba(248,113,113,.08); }
@media (max-width: 640px) {
  .wa-me-grid { grid-template-columns: 1fr; }
}

/* A11y — focus + live region */
button,
a,
input,
textarea,
select,
[tabindex] {
  transition: outline-color 120ms ease, box-shadow 120ms ease;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid #34d399;
  outline-offset: 2px;
  border-radius: inherit;
  box-shadow: 0 0 0 4px rgba(52, 211, 153, 0.18);
}
*:focus:not(:focus-visible) {
  outline: none;
}
#toast-container:empty {
  pointer-events: none;
}
[data-stat-value].skeleton {
  display: inline-block;
  min-width: 48px;
}
@media (prefers-reduced-motion: reduce) {
  button,
  a,
  input,
  textarea,
  select,
  [tabindex] {
    transition: none;
  }
  button:focus-visible,
  a:focus-visible,
  input:focus-visible,
  textarea:focus-visible,
  select:focus-visible,
  [tabindex]:focus-visible {
    box-shadow: none;
  }
}

/* M2.4 — Botão toggle de tema */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  min-height: 40px;
  padding: 8px;
  margin-left: auto;
  margin-right: 12px;
  background: var(--badge-bg);
  border: 1px solid var(--border);
  color: var(--text);
  cursor: pointer;
  border-radius: 10px;
  transition: background .18s ease, transform .18s ease;
}
.theme-toggle:hover { transform: translateY(-1px); }
.theme-toggle i { width: 18px; height: 18px; }

/* M2.4 — Ajustes finos do tema claro para legibilidade */
[data-theme="light"] body { color: var(--text); }
[data-theme="light"] .code-out,
[data-theme="light"] pre.code-out {
  background: rgba(15, 23, 42, 0.04);
  color: #0f172a;
  border: 1px solid var(--border);
}
[data-theme="light"] .input-field,
[data-theme="light"] input.input-field,
[data-theme="light"] textarea.input-field,
[data-theme="light"] select.input-field {
  background: #ffffff;
  color: var(--text);
  border-color: var(--border);
}
[data-theme="light"] .btn-ghost {
  color: var(--text);
}
[data-theme="light"] .nav-item { color: var(--text); }
[data-theme="light"] .nav-item:hover { background: rgba(15, 23, 42, 0.05); }
[data-theme="light"] .kicker,
[data-theme="light"] .panel-sub,
[data-theme="light"] .topbar-sub { color: var(--muted); }

/* M-IncTrain — Opções avançadas de treino incremental */
.training-advanced {
  margin: 12px 0 4px;
  padding: 8px 12px;
  border: 1px solid var(--border, rgba(255,255,255,0.08));
  border-radius: 10px;
  background: var(--surface, rgba(255,255,255,0.02));
}
.training-advanced > summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  padding: 4px 0;
  outline: none;
}
.training-advanced[open] > summary { margin-bottom: 8px; }
.training-advanced-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px 14px;
}
.training-advanced-grid label {
  display: flex;
  flex-direction: column;
  font-size: 12px;
  gap: 4px;
  color: var(--muted, rgba(255,255,255,0.6));
}
.training-advanced-grid .input-field { width: 100%; }

/* M-IncTrain — Contador X/N conversas + versão atual */
.train-conv-counter {
  margin: 8px 0;
  padding: 10px 14px;
  border-radius: 10px;
  background: linear-gradient(90deg, rgba(99,102,241,0.12), rgba(99,102,241,0.04));
  border: 1px solid rgba(99,102,241,0.25);
  font-family: var(--font-mono, monospace);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.3px;
}
.train-conv-counter.hidden { display: none; }

/* M9.6 — ETA estimado */
.train-eta { font-size: 0.85em; color: var(--text-muted, #888); margin-top: 4px; font-variant-numeric: tabular-nums; }

/* M4.2 — Train progress bar */
.train-progress {
  padding: 12px 0;
}
.train-progress.hidden {
  display: none;
}
.train-progress-bar {
  height: 8px;
  border-radius: 999px;
  background: var(--border, rgba(255, 255, 255, 0.08));
  overflow: hidden;
}
.train-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(135deg, #34d399, #10b981);
  transition: width 0.35s ease;
  border-radius: 999px;
}
.train-progress-steps {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  list-style: none;
  padding: 0;
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--text-muted, #94a3b8);
}
.train-progress-steps li {
  flex: 1;
  text-align: center;
}
.train-progress-steps li.is-active {
  color: #34d399;
  font-weight: 600;
}
.train-progress-steps li.is-done {
  color: #10b981;
  text-decoration: underline;
}
@media (prefers-reduced-motion: reduce) {
  .train-progress-fill {
    transition: none;
  }
}

/* M2.8 — breadcrumb */
.breadcrumb {
  margin: 0 0 0.25rem 0;
  font-size: 0.78rem;
  line-height: 1;
}
.breadcrumb ol {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
  list-style: none;
  margin: 0;
  padding: 0;
  color: var(--text-muted);
}
.breadcrumb li {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-muted);
}
.breadcrumb li + li::before {
  content: "/";
  color: var(--text-muted);
  opacity: 0.6;
}
.breadcrumb a {
  color: var(--text-muted);
  text-decoration: none;
}
.breadcrumb a:hover {
  color: var(--text);
}
.breadcrumb li[aria-current="page"] {
  color: var(--text);
  font-weight: 600;
}

/* M4.4 — RAG Search */
.rag-search-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin: 0.5rem 0 0.75rem;
}
.rag-search-toolbar #rag-q { flex: 1 1 240px; min-width: 200px; }
.rag-search-toolbar #rag-topk { width: 160px; accent-color: var(--accent, #22c55e); }
.rag-topk-label { white-space: nowrap; }
.rag-result {
  padding: 0.75rem 0.875rem;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  background: rgba(255,255,255,0.02);
}
.rag-result-head { display: flex; justify-content: space-between; gap: 0.5rem; margin-bottom: 0.4rem; font-size: 0.78rem; }
.rag-score { font-weight: 700; color: var(--accent, #22c55e); font-family: var(--font-mono, ui-monospace, monospace); }
.rag-result-meta { opacity: 0.6; }
.rag-result pre { white-space: pre-wrap; word-break: break-word; margin: 0; font-size: 0.82rem; line-height: 1.4; }

/* M4.5 — Chat Tester */
.chat-tester-panel { display: flex; flex-direction: column; gap: 0.75rem; }
.chat-persona-header { display: flex; align-items: center; gap: 0.75rem; padding: 0.5rem 0.25rem; border-bottom: 1px solid rgba(255,255,255,0.06); }
.chat-avatar { width: 40px; height: 40px; border-radius: 50%; background: rgba(255,255,255,0.05); object-fit: cover; }
.chat-persona-meta { display: flex; flex-direction: column; line-height: 1.1; }
.chat-persona-name { font-weight: 600; font-size: 0.95rem; }
.chat-prompt-version { opacity: 0.65; font-size: 0.72rem; font-family: var(--font-mono, ui-monospace, monospace); }
.chat-ctx-toggle { margin-left: auto; font-size: 0.78rem; padding: 0.35rem 0.65rem; border-radius: 8px; background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.08); color: inherit; cursor: pointer; }
.chat-ctx-toggle:hover { background: rgba(255,255,255,0.08); }
.chat-tester-body { display: flex; gap: 0.75rem; align-items: stretch; }
.chat-tester-main { flex: 1 1 auto; min-width: 0; }
.chat-context-panel { flex: 0 0 0; width: 0; overflow: hidden; transition: width 220ms ease, padding 220ms ease; border-left: 1px solid rgba(255,255,255,0.06); padding: 0; }
.chat-context-panel.context-open { flex: 0 0 320px; width: 320px; padding: 0.5rem 0.5rem 0.5rem 0.75rem; }
.chat-context-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 0.5rem; }
.chat-context-list { display: flex; flex-direction: column; gap: 0.5rem; max-height: 60vh; overflow-y: auto; }
.ctx-chunk { padding: 0.5rem 0.6rem; border: 1px solid rgba(255,255,255,0.08); border-radius: 8px; background: rgba(255,255,255,0.02); }
.ctx-chunk-head { display: flex; gap: 0.5rem; align-items: center; margin-bottom: 0.3rem; font-size: 0.75rem; }
.ctx-score { font-weight: 700; color: var(--accent, #22c55e); font-family: var(--font-mono, ui-monospace, monospace); }
.ctx-id { opacity: 0.55; font-family: var(--font-mono, ui-monospace, monospace); }
.ctx-chunk pre { white-space: pre-wrap; word-break: break-word; margin: 0; font-size: 0.78rem; line-height: 1.35; opacity: 0.9; }
@media (max-width: 720px) { .chat-tester-body { flex-direction: column; } .chat-context-panel.context-open { width: 100%; flex-basis: auto; border-left: none; border-top: 1px solid rgba(255,255,255,0.06); padding-left: 0; } }

/* M4.6 prompt diff */
.prompt-diff-content { max-width: 880px; width: 92vw; }
.prompt-diff-controls { display: flex; gap: 0.6rem; align-items: flex-end; flex-wrap: wrap; margin-bottom: 0.6rem; }
.prompt-diff-label { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.78rem; opacity: 0.85; min-width: 160px; }
.diff-output { max-height: 55vh; overflow: auto; padding: 0.6rem; border-radius: 8px; border: 1px solid rgba(255,255,255,0.08); background: rgba(0,0,0,0.25); font-size: 0.78rem; line-height: 1.4; white-space: pre-wrap; word-break: break-word; }
.diff-add { display: block; background: rgba(46, 160, 67, 0.18); color: #4ade80; padding: 0 0.3rem; }
.diff-del { display: block; background: rgba(248, 81, 73, 0.18); color: #f87171; padding: 0 0.3rem; text-decoration: line-through; }
.diff-same { display: block; color: var(--text-muted, rgba(255,255,255,0.55)); padding: 0 0.3rem; }
.diff-output .diff-empty { color: var(--text-muted, rgba(255,255,255,0.55)); font-style: italic; }


/* M9.5 — Runs históricas */
.runs-history { margin-top: 0.75rem; display: flex; flex-direction: column; gap: 0.5rem; }
.runs-history__hdr { display: flex; justify-content: space-between; align-items: baseline; gap: 0.5rem; }
.runs-history__hdr h3 { margin: 0; }
.runs-tbl-wrap { overflow-x: auto; border: 1px solid rgba(255,255,255,0.08); border-radius: 8px; background: rgba(0,0,0,0.18); }
.runs-tbl { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.runs-tbl thead th { text-align: left; padding: 0.5rem 0.6rem; font-weight: 600; font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.03em; color: var(--text-muted, rgba(255,255,255,0.6)); border-bottom: 1px solid rgba(255,255,255,0.08); background: rgba(255,255,255,0.02); }
.runs-tbl tbody td { padding: 0.5rem 0.6rem; border-bottom: 1px solid rgba(255,255,255,0.05); vertical-align: middle; }
.runs-tbl tbody tr:last-child td { border-bottom: none; }
.runs-tbl .runs-empty { text-align: center; color: var(--text-muted, rgba(255,255,255,0.55)); font-style: italic; padding: 0.9rem; }
.runs-tbl .runs-id { font-family: var(--font-mono, ui-monospace, monospace); font-size: 0.78rem; opacity: 0.85; }
.run-status { display: inline-block; padding: 0.15rem 0.5rem; border-radius: 999px; font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; border: 1px solid rgba(255,255,255,0.08); }
.run-status[data-status="running"] { background: rgba(59,130,246,0.18); color: #60a5fa; }
.run-status[data-status="paused"]  { background: rgba(234,179,8,0.18);  color: #facc15; }
.run-status[data-status="done"]    { background: rgba(34,197,94,0.18);  color: #4ade80; }
.run-status[data-status="aborted"] { background: rgba(148,163,184,0.18);color: #cbd5e1; }
.run-status[data-status="failed"]  { background: rgba(248,81,73,0.18);  color: #f87171; }
.runs-resume-btn { padding: 0.25rem 0.55rem; font-size: 0.78rem; }

/* M10.1 — WhatsApp chunked sync progress */
.wa-sync-progress { margin: 12px 0; padding: 12px; border: 1px solid var(--border, #2a2a2a); border-radius: 8px; background: var(--card-bg, #1a1a1a); }
.wa-sync-progress__hdr { display: flex; justify-content: space-between; font-size: 0.9em; margin-bottom: 8px; }
.wa-sync-progress__bar { height: 6px; background: rgba(255,255,255,0.08); border-radius: 999px; overflow: hidden; }
.wa-sync-progress__fill { height: 100%; width: 0%; background: linear-gradient(90deg, #34d399, #10b981); transition: width .25s ease; }
.wa-sync-progress__log { list-style: none; padding: 0; margin: 8px 0 0; max-height: 120px; overflow-y: auto; font-size: 0.8em; font-variant-numeric: tabular-nums; }
.wa-sync-progress__log li { padding: 2px 0; color: var(--text-muted, #888); }

/* M11.3 — Chat Tester embed badge */
.chat-embed-badge {
  display: inline-block;
  padding: 2px 8px;
  margin-left: 6px;
  font-size: 0.75em;
  font-variant-numeric: tabular-nums;
  border-radius: 999px;
  background: rgba(52, 211, 153, 0.12);
  color: #34d399;
  border: 1px solid rgba(52, 211, 153, 0.3);
}
.chat-embed-badge[data-provider="gemini"] {
  background: rgba(96, 165, 250, 0.12);
  color: #60a5fa;
  border-color: rgba(96, 165, 250, 0.3);
}

/* M12.2 — Prompt preview modal */
.modal[hidden] { display: none; }
.modal { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; }
.modal__backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.6); backdrop-filter: blur(4px); }
.modal__card { position: relative; max-width: 80vw; max-height: 80vh; width: 720px; display: flex; flex-direction: column; background: var(--card-bg, #1a1a1a); border: 1px solid var(--border, #2a2a2a); border-radius: 12px; overflow: hidden; box-shadow: 0 24px 64px rgba(0,0,0,.45); }
.modal__hdr { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--border, #2a2a2a); }
.modal__hdr h3 { margin: 0; font-size: 1rem; }
.modal__ftr { padding: 12px 16px; border-top: 1px solid var(--border, #2a2a2a); display: flex; justify-content: flex-end; gap: 8px; }
.prompt-body { padding: 16px; margin: 0; overflow: auto; white-space: pre-wrap; word-break: break-word; font-size: 0.85em; line-height: 1.5; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; flex: 1; }
.btn-icon { background: transparent; border: 0; color: inherit; font-size: 1.4rem; line-height: 1; cursor: pointer; padding: 4px 8px; border-radius: 6px; }
.btn-icon:hover { background: rgba(255,255,255,.08); }
.training-legacy { margin-top: 16px; font-size: 0.85em; opacity: 0.75; }
.training-legacy summary { cursor: pointer; }
.prompt-preview-link { color: #60a5fa; text-decoration: underline; cursor: pointer; }
.prompt-preview-link:hover { color: #93c5fd; }

/* M13.1 — Training stages */
.training-stages {
  border: 1px solid var(--border, #2a2a2a);
  border-radius: 8px;
  padding: 12px 14px;
  margin: 12px 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.training-stages legend {
  padding: 0 6px;
  font-size: 0.85em;
  color: var(--text-muted, #888);
  font-weight: 600;
}
.stage-check {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}
.stage-check input[type="checkbox"] {
  accent-color: #34d399;
  width: 16px;
  height: 16px;
  cursor: pointer;
}
.stage-check:hover { color: #34d399; }
