/* ═══════════════════════════════════════════════════════════
   IPTV SaaS — Design System v2
   Estética: Stripe / Linear / Vercel — Premium & Functional
   ═══════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/* ── TOKENS: DARK MODE (padrão) ────────────────────────── */
:root {
  /* Paleta base — Fundo em cinza noturno (não preto puro) */
  --bg:           #0f1117;
  --surface:      #161b27;
  --surface-2:    #1c2233;
  --card:         #1a2030;
  --card-hover:   #1f2840;
  --border:       rgba(255, 255, 255, 0.07);
  --border-hover: rgba(255, 255, 255, 0.14);

  /* Acento principal — Índigo controlado (não neon) */
  --primary:         #5b6cf1;
  --primary-light:   #7c8ff5;
  --primary-bg:      rgba(91, 108, 241, 0.1);
  --primary-border:  rgba(91, 108, 241, 0.25);

  /* Semânticas */
  --green:         #22c55e;
  --green-light:   #4ade80;
  --green-bg:      rgba(34, 197, 94, 0.1);
  --green-border:  rgba(34, 197, 94, 0.2);

  --yellow:        #f59e0b;
  --yellow-bg:     rgba(245, 158, 11, 0.1);
  --yellow-border: rgba(245, 158, 11, 0.2);

  --red:           #ef4444;
  --red-bg:        rgba(239, 68, 68, 0.1);
  --red-border:    rgba(239, 68, 68, 0.2);

  --cyan:          #06b6d4;
  --cyan-bg:       rgba(6, 182, 212, 0.1);
  --cyan-border:   rgba(6, 182, 212, 0.2);

  /* Tipografia */
  --text:          #f1f5f9;
  --text-secondary:#94a3b8;
  --muted:         #4b5569;
  --font:          'Inter', system-ui, -apple-system, sans-serif;

  /* Layout */
  --sidebar-w:     248px;
  --sidebar-collapsed-w: 64px;

  /* Shapes */
  --radius-sm:  6px;
  --radius-md:  10px;
  --radius-lg:  14px;
  --radius-xl:  20px;

  /* Sombras minimalistas (sem glow exagerado) */
  --shadow-xs:  0 1px 3px rgba(0,0,0,0.25);
  --shadow-sm:  0 2px 8px rgba(0,0,0,0.35);
  --shadow-md:  0 4px 16px rgba(0,0,0,0.4);
  --shadow-lg:  0 8px 30px rgba(0,0,0,0.5);

  /* Transitions */
  --ease:  cubic-bezier(0.4, 0, 0.2, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ── TOKENS: LIGHT MODE ────────────────────────────────── */
[data-theme="light"] {
  --bg:           #f5f6fa;
  --surface:      #ffffff;
  --surface-2:    #f1f3f9;
  --card:         #ffffff;
  --card-hover:   #f8faff;
  --border:       rgba(0, 0, 0, 0.08);
  --border-hover: rgba(0, 0, 0, 0.15);

  --primary:         #4f5fe8;
  --primary-light:   #6b7af0;
  --primary-bg:      rgba(79, 95, 232, 0.08);
  --primary-border:  rgba(79, 95, 232, 0.2);

  --green:         #16a34a;
  --green-light:   #22c55e;
  --green-bg:      rgba(22, 163, 74, 0.08);
  --green-border:  rgba(22, 163, 74, 0.2);

  --yellow:        #d97706;
  --yellow-bg:     rgba(217, 119, 6, 0.08);
  --yellow-border: rgba(217, 119, 6, 0.2);

  --red:           #dc2626;
  --red-bg:        rgba(220, 38, 38, 0.08);
  --red-border:    rgba(220, 38, 38, 0.2);

  --cyan:          #0891b2;
  --cyan-bg:       rgba(8, 145, 178, 0.08);
  --cyan-border:   rgba(8, 145, 178, 0.2);

  --text:          #0f172a;
  --text-secondary:#475569;
  --muted:         #94a3b8;

  --shadow-xs:  0 1px 3px rgba(0,0,0,0.06);
  --shadow-sm:  0 2px 8px rgba(0,0,0,0.09);
  --shadow-md:  0 4px 16px rgba(0,0,0,0.1);
  --shadow-lg:  0 8px 30px rgba(0,0,0,0.12);
}

/* ── RESET & BASE ──────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.55;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  transition: background 0.3s var(--ease), color 0.3s var(--ease);
}

/* ── LAYOUT PRINCIPAL ──────────────────────────────────── */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ═══════════════════════════════════════════════════════════
   SIDEBAR
   ═══════════════════════════════════════════════════════════ */
.sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  height: 100vh;
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  z-index: 200;
  transition: width 0.25s var(--ease);
  flex-shrink: 0;
  overflow: hidden;
}

.sidebar.collapsed { width: var(--sidebar-collapsed-w); }

.sidebar.collapsed .logo-text,
.sidebar.collapsed .nav-section-title,
.sidebar.collapsed .nav-text,
.sidebar.collapsed .user-info-text,
.sidebar.collapsed .sidebar-copyright { display: none; }

.sidebar.collapsed .nav-item {
  justify-content: center;
  padding: 10px;
}

/* Cabeçalho */
.sidebar-header {
  padding: 16px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  min-height: 57px;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  letter-spacing: -0.2px;
}

.sidebar-brand .logo-icon {
  width: 28px;
  height: 28px;
  background: var(--primary);
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}

.logo-glow {
  color: var(--primary);
}

.btn-sidebar-collapse {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  width: 26px;
  height: 26px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  transition: all 0.18s var(--ease);
  flex-shrink: 0;
}

.btn-sidebar-collapse:hover {
  background: var(--primary-bg);
  border-color: var(--primary-border);
  color: var(--primary);
}

/* Corpo da Sidebar */
.sidebar-body {
  padding: 12px 10px;
  overflow-y: auto;
  flex: 1;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.nav-section { margin-bottom: 22px; }

.nav-section-title {
  font-size: 10px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.9px;
  padding: 0 10px 5px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  user-select: none;
  margin-bottom: 1px;
}

.nav-item:hover {
  background: var(--surface-2);
  color: var(--text);
}

.nav-item.active {
  background: var(--primary-bg);
  color: var(--primary);
  font-weight: 600;
}

.nav-item.active .nav-icon { opacity: 1; }

.nav-icon {
  font-size: 15px;
  width: 18px;
  text-align: center;
  flex-shrink: 0;
  opacity: 0.75;
}

.nav-item:hover .nav-icon,
.nav-item.active .nav-icon { opacity: 1; }

.nav-badge {
  margin-left: auto;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 8px;
  color: var(--text-secondary);
}

/* Rodapé da Sidebar */
.sidebar-footer {
  padding: 12px 10px;
  border-top: 1px solid var(--border);
}

.user-profile-card {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 10px;
  background: var(--surface-2);
  border-radius: var(--radius-md);
  margin-bottom: 8px;
}

.user-avatar-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.user-info-text { overflow: hidden; }

.user-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.user-email {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.btn-sidebar-logout {
  width: 100%;
  background: transparent !important;
  color: var(--text-secondary) !important;
  border: 1px solid var(--border) !important;
  padding: 8px 10px;
  border-radius: var(--radius-md);
  font-size: 12px;
  font-weight: 500;
  font-family: var(--font);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  cursor: pointer;
  transition: all 0.18s var(--ease);
}

.btn-sidebar-logout:hover {
  background: var(--red-bg) !important;
  color: var(--red) !important;
  border-color: var(--red-border) !important;
}

.sidebar-copyright {
  text-align: center;
  font-size: 10px;
  color: var(--muted);
  margin-top: 8px;
}

/* ═══════════════════════════════════════════════════════════
   MAIN CONTENT & TOPBAR
   ═══════════════════════════════════════════════════════════ */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 100vh;
}

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 57px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.mobile-menu-btn {
  display: none;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  align-items: center;
  justify-content: center;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.15s;
}

.mobile-menu-btn:hover {
  background: var(--surface-2);
  border-color: var(--border-hover);
}

.badge-total {
  background: var(--surface-2);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 500;
  padding: 3px 9px;
  border-radius: 20px;
  border: 1px solid var(--border);
}

/* ── INTERRUPTOR SWITCH TEMA CLARO / ESCURO ── */
.theme-switch-pill {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 3px;
  cursor: pointer;
  user-select: none;
  transition: all 0.2s var(--ease);
  height: 32px;
}

.theme-switch-pill:hover {
  border-color: var(--border-hover);
}

.theme-switch-item {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  z-index: 2;
  transition: color 0.2s ease;
  pointer-events: none;
}

.theme-switch-item.active {
  color: var(--text);
}

.theme-switch-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: calc(50% - 3px);
  height: calc(100% - 6px);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.2s;
  z-index: 1;
}

[data-theme="light"] .theme-switch-thumb {
  transform: translateX(100%);
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.12);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

/* ── BOTÃO MODO CONFIDENCIAL / PRIVACIDADE ── */
.btn-privacy-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  user-select: none;
  transition: all 0.2s var(--ease);
  height: 32px;
}

.btn-privacy-pill:hover {
  background: var(--card-hover);
  color: var(--text);
  border-color: var(--border-hover);
}

.btn-privacy-pill.active {
  background: rgba(91, 108, 241, 0.15);
  border-color: var(--primary);
  color: var(--primary-light);
  box-shadow: 0 0 12px rgba(91, 108, 241, 0.2);
}

/* ── EFEITO DE MÁSCARA CONFIDENCIAL EM DADOS SENSÍVEIS (TOTALMENTE OCULTO, SEM REVELAR NO HOVER) ── */
body.privacy-mode .privacy-mask,
body.privacy-mode .col-name,
body.privacy-mode .col-name strong,
body.privacy-mode .col-username,
body.privacy-mode .col-username span,
body.privacy-mode .col-whatsapp,
body.privacy-mode .col-whatsapp span,
body.privacy-mode #clients-table-body td:nth-child(1),
body.privacy-mode #clients-table-body td:nth-child(2),
body.privacy-mode #clients-table-body td:nth-child(3),
body.privacy-mode #modal-client-name,
body.privacy-mode #modal-client-user,
body.privacy-mode #modal-client-whatsapp,
body.privacy-mode #modal-client-notes,
body.privacy-mode #auto-schedule-table-body td:nth-child(3),
body.privacy-mode #auto-schedule-table-body td:nth-child(4),
body.privacy-mode #dispatch-history-table-body td:nth-child(2),
body.privacy-mode #dispatch-history-table-body td:nth-child(3),
body.privacy-mode #sidebar-user-name,
body.privacy-mode #sidebar-user-email,
body.privacy-mode #user-display-name,
body.privacy-mode .stat-value,
body.privacy-mode .stat-sub,
body.privacy-mode #dash-servers-distribution,
body.privacy-mode #dash-panels-total-badge,
body.privacy-mode #dash-active-ratio,
body.privacy-mode #badge-total,
body.privacy-mode .table-stats,
body.privacy-mode .nav-badge {
  filter: blur(10px) !important;
  opacity: 0.25 !important;
  user-select: none !important;
  pointer-events: none !important; /* impede seleção, clique ou revelação no hover */
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.user-badge {
  display: flex;
  align-items: center;
  gap: 7px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 4px 11px;
  border-radius: 20px;
  font-size: 12px;
}

.user-badge .u-name {
  font-weight: 600;
  color: var(--text);
}

.plan-chip {
  background: var(--green-bg);
  color: var(--green);
  border: 1px solid var(--green-border);
  padding: 1px 7px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

/* ═══════════════════════════════════════════════════════════
   BOTÕES
   ═══════════════════════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  padding: 7px 14px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.18s var(--ease);
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
}

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

.btn-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  box-shadow: 0 1px 3px rgba(91, 108, 241, 0.3), inset 0 1px 0 rgba(255,255,255,0.1);
}

.btn-primary:hover {
  background: var(--primary-light);
  border-color: var(--primary-light);
  box-shadow: 0 3px 10px rgba(91, 108, 241, 0.35);
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border);
}

.btn-ghost:hover {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--border-hover);
}

.btn-danger {
  background: var(--red-bg);
  color: var(--red);
  border-color: var(--red-border);
}

.btn-danger:hover {
  background: var(--red);
  color: #fff;
  border-color: var(--red);
}

.btn-sm {
  padding: 5px 11px;
  font-size: 12px;
  border-radius: var(--radius-sm);
}

.btn-full { width: 100%; }

/* ═══════════════════════════════════════════════════════════
   AUTH VIEW
   ═══════════════════════════════════════════════════════════ */
.auth-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
  background: var(--bg);
}

.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 36px 32px;
  width: 420px;
  max-width: 100%;
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
}

.auth-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--primary), var(--primary-light));
}

.auth-header {
  text-align: center;
  margin-bottom: 26px;
}

.auth-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
}

.auth-logo-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #080a10;
  padding: 14px 28px;
  border-radius: 18px;
  border: 1px solid rgba(91, 108, 241, 0.35);
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.4), 0 0 24px rgba(91, 108, 241, 0.2);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.auth-logo-badge:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 38px rgba(0, 0, 0, 0.45), 0 0 30px rgba(91, 108, 241, 0.3);
}

.auth-logo-img {
  height: 72px;
  max-width: 280px;
  width: auto;
  object-fit: contain;
  display: block;
}

.auth-logo-icon {
  width: 32px;
  height: 32px;
  background: var(--primary);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
}

.auth-logo-text { font-weight: 700; color: var(--text); }

.auth-access-badge {
  display: inline-block;
  background: var(--primary-bg);
  color: var(--primary);
  border: 1px solid var(--primary-border);
  padding: 2px 11px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 12px;
}

.auth-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
  letter-spacing: -0.3px;
}

.auth-sub {
  color: var(--text-secondary);
  font-size: 13px;
}

.auth-error {
  color: var(--red);
  font-size: 12px;
  margin: 8px 0;
  min-height: 16px;
  text-align: center;
  font-weight: 500;
}

.btn-auth-submit {
  font-size: 14px;
  padding: 11px;
  font-weight: 600;
}

.auth-footer-security {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--muted);
}

/* ═══════════════════════════════════════════════════════════
   FORMULÁRIOS & INPUTS
   ═══════════════════════════════════════════════════════════ */
.form-group {
  margin-bottom: 16px;
  width: 100%;
}

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
  letter-spacing: 0.1px;
}

input, select, textarea {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-md);
  padding: 9px 12px;
  font-size: 13px;
  font-family: var(--font);
  outline: none;
  transition: border-color 0.18s, box-shadow 0.18s, background 0.18s;
  width: 100% !important;
  box-sizing: border-box !important;
  display: block;
}

input:hover, select:hover { border-color: var(--border-hover); }

input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-bg);
  background: var(--card);
}

.input-with-eye {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.input-with-eye input { padding-right: 38px; width: 100%; }

.eye-btn {
  position: absolute;
  right: 8px;
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color 0.18s;
  opacity: 0.7;
}

.eye-btn:hover { color: var(--primary); opacity: 1; }

/* Inline editable fields na tabela */
.custom-field-input {
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 3px 7px;
  font-size: 12px;
  font-family: var(--font);
  width: 100%;
  transition: all 0.18s var(--ease);
}

.custom-field-input:hover {
  background: var(--surface-2);
  border-color: var(--border);
}

.custom-field-input:focus {
  background: var(--card);
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-bg);
  outline: none;
}

.custom-field-input::placeholder {
  color: var(--muted);
  font-weight: 400;
}

/* ═══════════════════════════════════════════════════════════
   STAT CARDS (DASHBOARD & MINI-CARDS CLIENTES)
   ═══════════════════════════════════════════════════════════ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
  padding: 20px 24px 12px;
}

.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  transition: border-color 0.18s, box-shadow 0.18s, transform 0.18s;
  position: relative;
  overflow: hidden;
}

.stat-card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.stat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.stat-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-icon { font-size: 15px; opacity: 0.7; }

.stat-value {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.8px;
  color: var(--text);
  margin-bottom: 3px;
  font-variant-numeric: tabular-nums;
}

.stat-card.blue  .stat-value { color: var(--cyan); }
.stat-card.green .stat-value { color: var(--green); }
.stat-card.yellow .stat-value { color: var(--yellow); }
.stat-card.red   .stat-value { color: var(--red); }
.stat-card.cyan  .stat-value { color: var(--cyan); }

.stat-sub {
  font-size: 11px;
  color: var(--muted);
  font-weight: 400;
}

/* Barra indicadora colorida no topo do card */
.stat-card::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: transparent;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.stat-card.blue::after  { background: var(--cyan); }
.stat-card.green::after { background: var(--green); }
.stat-card.yellow::after { background: var(--yellow); }
.stat-card.red::after   { background: var(--red); }
.stat-card.cyan::after  { background: var(--cyan); }

/* ═══════════════════════════════════════════════════════════
   FILTROS & QUICK CHIPS
   ═══════════════════════════════════════════════════════════ */
.control-section {
  padding: 10px 24px 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.filters-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.quick-chips-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  padding-bottom: 2px;
}

.chip-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  font-family: var(--font);
  padding: 4px 11px;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.15s var(--ease);
  user-select: none;
  white-space: nowrap;
}

.chip-btn:hover {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--border-hover);
}

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

.chip-btn.chip-danger.active {
  background: var(--red-bg);
  color: var(--red);
  border-color: var(--red-border);
}

.chip-btn.chip-warn.active {
  background: var(--yellow-bg);
  color: var(--yellow);
  border-color: var(--yellow-border);
}

.chip-btn.chip-ok.active {
  background: var(--green-bg);
  color: var(--green);
  border-color: var(--green-border);
}

/* ═══════════════════════════════════════════════════════════
   TABELA DE CLIENTES
   ═══════════════════════════════════════════════════════════ */
.table-wrap {
  padding: 0 24px 24px;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

thead { background: var(--surface-2); }

th {
  padding: 11px 14px;
  text-align: left;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  user-select: none;
}

th[onclick] { cursor: pointer; }
th[onclick]:hover { color: var(--text-secondary); }

tbody tr { transition: background 0.12s; }
tbody tr:hover { background: var(--surface-2); }

tbody td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  vertical-align: middle;
}

tbody tr:last-child td { border-bottom: none; }

.user-cell {
  display: flex;
  align-items: center;
  gap: 9px;
}

.user-avatar {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  background: var(--primary-bg);
  border: 1px solid var(--primary-border);
  color: var(--primary);
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.user-details { display: flex; flex-direction: column; }

.user-name-title {
  font-weight: 600;
  color: var(--text);
  font-size: 13px;
}

.user-server-sub {
  font-size: 11px;
  color: var(--muted);
}

.panel-badge {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
}

/* ── WhatsApp Input ─────────────────────────── */
.wa-input-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.wa-input {
  width: 140px;
  padding: 5px 9px;
  font-size: 12px;
  font-family: var(--font);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  transition: all 0.18s;
  outline: none;
}

.wa-input:hover { border-color: var(--border-hover); }

.wa-input.saved {
  border-color: var(--green-border);
  color: var(--green);
}

.wa-input:focus {
  width: 155px;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-bg);
  background: var(--card);
}

/* ═══════════════════════════════════════════════════════════
   STATUS BADGES & DAYS
   ═══════════════════════════════════════════════════════════ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.2px;
}

.badge-active {
  background: var(--green-bg);
  color: var(--green);
  border: 1px solid var(--green-border);
}

.badge-expired {
  background: var(--red-bg);
  color: var(--red);
  border: 1px solid var(--red-border);
}

.days-badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 600;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.days-expired { background: var(--red-bg);    color: var(--red);    border: 1px solid var(--red-border); }
.days-urgent  { background: var(--red-bg);    color: var(--red);    border: 1px solid var(--red-border); font-weight: 700; animation: pulseUrgent 2s ease-in-out infinite; }
.days-warn    { background: var(--yellow-bg); color: var(--yellow); border: 1px solid var(--yellow-border); }
.days-ok      { background: var(--surface-2); color: var(--muted);  border: 1px solid var(--border); }

@keyframes pulseUrgent {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.65; }
}

/* ── Ações da tabela ───────────────────────── */
.actions-cell {
  display: flex;
  align-items: center;
  gap: 5px;
}

.btn-wa-action {
  background: var(--green-bg);
  color: var(--green);
  border: 1px solid var(--green-border);
  padding: 4px 9px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: all 0.18s var(--ease);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  text-decoration: none;
}

.btn-wa-action:hover {
  background: var(--green);
  color: #fff;
  border-color: var(--green);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(34, 197, 94, 0.25);
}

.expires-date { color: var(--text-secondary); font-size: 12px; }
.expires-time { color: var(--muted); font-size: 11px; }

/* ═══════════════════════════════════════════════════════════
   MODAIS
   ═══════════════════════════════════════════════════════════ */
.modal-bg {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 1000;
  animation: fadeIn .2s ease-out;
}

.modal-bg.open { display: flex; }

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 26px;
  width: 520px;
  max-width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  position: relative;
  animation: slideUp .22s var(--ease-spring);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.modal-header h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.2px;
}

.modal-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes slideUp {
  from { transform: translateY(14px) scale(0.98); opacity: 0; }
  to   { transform: translateY(0) scale(1); opacity: 1; }
}

/* ═══════════════════════════════════════════════════════════
   TOAST NOTIFICATION
   ═══════════════════════════════════════════════════════════ */
#toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 8px;
  transform: translateY(80px);
  opacity: 0;
  transition: all 0.28s var(--ease);
  z-index: 9999;
  max-width: 340px;
  pointer-events: none;
}

#toast.show  { transform: translateY(0); opacity: 1; }

#toast.success {
  border-color: var(--green-border);
  background: var(--green-bg);
  color: var(--green);
}

#toast.error {
  border-color: var(--red-border);
  background: var(--red-bg);
  color: var(--red);
}

@media (max-width: 600px) {
  #toast {
    bottom: 12px;
    right: 12px;
    left: 12px;
    max-width: none;
    font-size: 12px;
    padding: 8px 12px;
    border-radius: var(--radius-md);
  }
}

/* ═══════════════════════════════════════════════════════════
   PAGINAÇÃO & EMPTY STATE
   ═══════════════════════════════════════════════════════════ */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 14px;
}

.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-secondary);
}

.empty-icon {
  font-size: 36px;
  margin-bottom: 10px;
  opacity: 0.5;
}

/* ═══════════════════════════════════════════════════════════
   DASHBOARD DISTRIBUTION CARDS
   ═══════════════════════════════════════════════════════════ */
#dash-servers-distribution {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  padding: 16px 24px;
}

/* ═══════════════════════════════════════════════════════════
   WA TEMPLATE CARDS
   ═══════════════════════════════════════════════════════════ */
.wa-template-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: all 0.18s var(--ease);
}

.wa-template-card:hover {
  background: var(--primary-bg);
  border-color: var(--primary-border);
}

.wa-template-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 3px;
}

.wa-template-preview {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* ═══════════════════════════════════════════════════════════
   LOADING
   ═══════════════════════════════════════════════════════════ */
.loading-wrap {
  text-align: center;
  padding: 32px;
  color: var(--muted);
  font-size: 13px;
}

/* ═══════════════════════════════════════════════════════════
   MOBILE BACKDROP
   ═══════════════════════════════════════════════════════════ */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(3px);
  z-index: 150;
}

/* ═══════════════════════════════════════════════════════════
   RESPONSIVO COMPLETO: TABLETS E CELULARES (≤ 900px)
   ═══════════════════════════════════════════════════════════ */
@media (max-width: 900px) {
  /* Prevenção de overflow e toques mobile */
  body, html {
    overflow-x: hidden;
    width: 100%;
    -webkit-tap-highlight-color: transparent;
  }

  button, .btn, .chip-btn, .nav-item, select, input {
    touch-action: manipulation;
  }

  /* Previne zoom no iPhone ao focar em inputs */
  input[type="text"],
  input[type="password"],
  input[type="email"],
  input[type="number"],
  select,
  textarea {
    font-size: 16px !important;
  }

  /* Sidebar vira drawer deslizante */
  .mobile-menu-btn {
    display: inline-flex;
    width: 40px;
    height: 40px;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text);
    cursor: pointer;
    font-size: 18px;
  }

  .sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: 280px !important;
    max-width: 85vw !important;
    transform: translateX(-100%);
    box-shadow: var(--shadow-lg);
    transition: transform 0.28s cubic-bezier(0.34, 1.2, 0.64, 1);
    z-index: 200;
  }

  .sidebar.open { transform: translateX(0); }
  .sidebar-backdrop.open { display: block; }

  /* Topbar compacto e ajustado para celular */
  .topbar {
    padding: 0 12px;
    height: 54px;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
  }

  .topbar-left { gap: 8px; }
  .user-badge { display: none; }
  .badge-total { display: none; }

  .topbar-right {
    gap: 6px;
  }

  #btn-sync {
    padding: 6px 10px;
    font-size: 11.5px;
    height: 32px;
  }

  .btn-privacy-pill {
    padding: 4px 9px;
    font-size: 11px;
    height: 32px;
  }

  .theme-switch-pill {
    padding: 2px;
    height: 30px;
  }

  .theme-switch-item {
    padding: 2px 6px;
    font-size: 10px;
  }

  /* ── DASHBOARD MOBILE ── */
  #view-dashboard > div:first-child {
    padding: 12px 14px 4px 14px !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
  }

  #dash-filter-painel, #dash-filter-status {
    flex: 1 1 calc(50% - 6px) !important;
    min-width: 140px !important;
    padding: 8px 10px !important;
  }

  .stats-grid {
    padding: 10px 14px !important;
    gap: 8px !important;
    grid-template-columns: 1fr 1fr !important;
  }

  .stat-card {
    padding: 12px 12px !important;
    border-radius: var(--radius-md) !important;
  }

  .stat-value { font-size: 20px !important; }
  .stat-label { font-size: 10px !important; }
  .stat-sub { font-size: 10.5px !important; }

  /* Distribuição e saúde da base em 1 coluna */
  #view-dashboard > div:last-child {
    padding: 0 14px 20px 14px !important;
    grid-template-columns: 1fr !important;
    gap: 14px !important;
  }

  /* ── GERIR CLIENTES MOBILE ── */
  .control-section {
    padding: 12px 14px 6px !important;
  }

  .filters-bar {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 8px !important;
    margin-bottom: 12px !important;
  }

  .filters-bar input[type="text"],
  .filters-bar select,
  .filters-bar button {
    width: 100% !important;
    min-height: 42px !important;
    box-sizing: border-box !important;
  }

  /* Mini cards na aba de clientes */
  #view-clients .stats-grid {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 6px !important;
    margin-bottom: 10px !important;
  }

  #view-clients .stats-grid .stat-card:nth-child(4),
  #view-clients .stats-grid .stat-card:nth-child(5) {
    grid-column: span 1;
  }

  /* Quick chips com rolagem suave horizontal */
  .quick-chips-bar {
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    padding: 4px 0 10px 0 !important;
    gap: 6px !important;
    scrollbar-width: none !important;
  }

  .quick-chips-bar::-webkit-scrollbar { display: none !important; }

  .chip-btn {
    flex-shrink: 0 !important;
    padding: 7px 14px !important;
    font-size: 12px !important;
    border-radius: 20px !important;
  }

  /* ── TABELA TRANSFORMADA EM CARDS ELEGANTES ── */
  .table-wrap {
    padding: 0 14px 24px !important;
    overflow-x: visible !important;
  }

  table, thead, tbody, th, td, tr { display: block !important; }
  thead { display: none !important; }

  table {
    background: transparent !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
  }

  tbody tr {
    background: var(--surface) !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--radius-lg) !important;
    margin-bottom: 12px !important;
    padding: 14px 14px 12px !important;
    position: relative !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15) !important;
  }

  tbody tr:hover {
    border-color: var(--border-hover) !important;
    background: var(--surface) !important;
  }

  tbody td {
    padding: 0 !important;
    border: none !important;
    margin-bottom: 10px !important;
    font-size: 13px !important;
  }

  tbody td:last-child { margin-bottom: 0 !important; }

  /* Badge do painel no canto superior */
  tbody td:nth-child(1) {
    position: absolute !important;
    top: 14px !important;
    right: 14px !important;
    margin: 0 !important;
  }

  /* Nome do cliente */
  tbody td:nth-child(2) {
    margin-bottom: 10px !important;
    padding-right: 95px !important;
  }

  /* Campo de nota */
  tbody td:nth-child(3) { margin-bottom: 10px !important; }
  tbody td:nth-child(3) .custom-field-input {
    width: 100% !important;
    background: var(--surface-2) !important;
    border-color: var(--border) !important;
    padding: 9px 12px !important;
    font-size: 13.5px !important;
    border-radius: var(--radius-sm) !important;
  }

  /* WhatsApp */
  tbody td:nth-child(4) { margin-bottom: 10px !important; }
  .wa-input { width: 100% !important; min-height: 40px !important; }
  .wa-input-wrap { width: 100% !important; }

  /* Vencimento + Dias + Status */
  tbody td:nth-child(5),
  tbody td:nth-child(6),
  tbody td:nth-child(7) {
    display: inline-flex !important;
    align-items: center !important;
    width: auto !important;
    margin-right: 6px !important;
    margin-bottom: 8px !important;
    vertical-align: middle !important;
  }

  /* Plano */
  tbody td:nth-child(8) {
    display: block !important;
    font-size: 11.5px !important;
    color: var(--muted) !important;
    margin-bottom: 10px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  /* Ações do cliente (Botões touch-friendly) */
  tbody td:nth-child(9) {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 6px !important;
    margin-top: 4px !important;
    padding-top: 10px !important;
    border-top: 1px solid var(--border) !important;
  }

  tbody td:nth-child(9) .btn {
    min-height: 38px !important;
    justify-content: center !important;
    font-size: 12.5px !important;
  }

  /* ── CENTRAL DE DISPAROS MOBILE ── */
  .dispatch-subview {
    padding: 12px 14px !important;
  }

  #view-dispatch > div:first-child,
  #dispatch-sub-auto > div:first-child,
  #dispatch-sub-manual > div:first-child,
  #dispatch-sub-history > div:first-child {
    padding: 14px 14px 12px 14px !important;
  }

  .wizard-step-labels {
    display: none !important;
  }

  .wizard-step-item.active .wizard-step-labels {
    display: flex !important;
  }

  .wizard-step-line {
    margin: 0 4px !important;
  }

  .auto-wizard-pane {
    padding: 14px 14px !important;
    gap: 14px !important;
  }

  .auto-wizard-pane > div:first-child {
    grid-template-columns: 1fr !important;
  }

  /* Modal como Bottom-Sheet suave */
  .modal-bg {
    padding: 0 !important;
    align-items: flex-end !important;
    background: rgba(0, 0, 0, 0.75) !important;
    backdrop-filter: blur(4px) !important;
  }

  .modal {
    border-radius: 24px 24px 0 0 !important;
    max-height: 90vh !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    padding: 22px 18px env(safe-area-inset-bottom, 28px) !important;
    width: 100% !important;
    animation: slideUpMobile 0.28s var(--ease-spring) !important;
  }

  /* Botões rápidos de renovação */
  .renew-pill-grid {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 6px !important;
  }

  .renew-pill {
    padding: 10px 4px !important;
    font-size: 12px !important;
    min-height: 42px !important;
  }

  /* Auth Card em celular */
  .auth-screen {
    padding: 16px !important;
    align-items: center !important;
  }

  .auth-card {
    padding: 28px 20px !important;
    width: 100% !important;
    border-radius: var(--radius-xl) !important;
  }

  /* Paginação */
  .pagination {
    flex-wrap: wrap !important;
    gap: 8px !important;
    justify-content: center !important;
  }

  .pagination .btn {
    flex: 1 1 calc(50% - 6px) !important;
    min-height: 40px !important;
  }

  .pagination span {
    width: 100% !important;
    text-align: center !important;
    order: -1 !important;
  }
}

/* ═══════════════════════════════════════════════════════════
   SCROLLBAR PERSONALIZADA
   ═══════════════════════════════════════════════════════════ */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-hover); }

/* ═══════════════════════════════════════════════════════════
   SELEÇÃO DE TEXTO
   ═══════════════════════════════════════════════════════════ */
::selection { background: var(--primary-bg); color: var(--primary); }

/* ═══════════════════════════════════════════════════════════
   OVERLAY DE SINCRONIZAÇÃO ANIMADO
   ═══════════════════════════════════════════════════════════ */

.sync-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(4, 5, 15, 0.88);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: syncFadeIn 0.4s ease;
}

@keyframes syncFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.sync-card {
  background: linear-gradient(145deg, rgba(15,16,35,0.98) 0%, rgba(22,24,52,0.98) 100%);
  border: 1px solid rgba(99, 102, 241, 0.25);
  border-radius: 24px;
  padding: 48px 52px;
  max-width: 520px;
  width: 92%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  box-shadow:
    0 0 0 1px rgba(99,102,241,0.08),
    0 30px 80px rgba(0,0,0,0.6),
    inset 0 1px 0 rgba(255,255,255,0.05);
  animation: syncCardSlide 0.45s cubic-bezier(0.34,1.56,0.64,1);
}

@keyframes syncCardSlide {
  from { transform: translateY(28px) scale(0.95); opacity: 0; }
  to   { transform: translateY(0) scale(1); opacity: 1; }
}

.sync-icon-wrap {
  position: relative;
  width: 90px;
  height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 4px;
}

.sync-core {
  font-size: 36px;
  z-index: 2;
  filter: drop-shadow(0 0 18px rgba(99,102,241,0.8));
  animation: syncPulse 2s ease-in-out infinite;
}

@keyframes syncPulse {
  0%, 100% { transform: scale(1);    filter: drop-shadow(0 0 18px rgba(99,102,241,0.8)); }
  50%       { transform: scale(1.12); filter: drop-shadow(0 0 32px rgba(139,92,246,1));   }
}

.sync-orbit {
  position: absolute;
  border-radius: 50%;
  border: 2px solid transparent;
  border-top-color: rgba(99,102,241,0.7);
  border-right-color: rgba(99,102,241,0.2);
  animation: orbitSpin 1.4s linear infinite;
}

.sync-orbit         { width: 76px; height: 76px; }
.sync-orbit-2       { width: 92px; height: 92px; border-top-color: rgba(139,92,246,0.5); border-right-color: transparent; animation-duration: 2.2s; animation-direction: reverse; }

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

.sync-title {
  font-size: 20px;
  font-weight: 800;
  color: #fff;
  text-align: center;
  margin: 0;
  letter-spacing: -0.3px;
}

.sync-subtitle {
  font-size: 13px;
  color: var(--muted, #6b7280);
  text-align: center;
  margin: 0;
}

.sync-msg-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(99,102,241,0.08);
  border: 1px solid rgba(99,102,241,0.18);
  border-radius: 50px;
  padding: 8px 18px;
  font-size: 13px;
  color: rgba(255,255,255,0.8);
  min-height: 38px;
  width: 100%;
  justify-content: center;
  transition: all 0.3s ease;
}

.sync-msg-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #6366f1;
  flex-shrink: 0;
  animation: dotBlink 1.2s ease-in-out infinite;
}

@keyframes dotBlink {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.3; transform: scale(0.7); }
}

.sync-progress-track {
  width: 100%;
  height: 8px;
  background: rgba(255,255,255,0.07);
  border-radius: 99px;
  overflow: hidden;
}

.sync-progress-bar {
  height: 100%;
  width: 0%;
  border-radius: 99px;
  background: linear-gradient(90deg, #6366f1 0%, #8b5cf6 50%, #a78bfa 100%);
  transition: width 0.6s cubic-bezier(0.4,0,0.2,1);
  box-shadow: 0 0 12px rgba(99,102,241,0.6);
}

.sync-progress-labels {
  display: flex;
  justify-content: space-between;
  width: 100%;
  font-size: 11px;
  color: var(--muted, #6b7280);
  margin-top: -8px;
}

.sync-steps {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

.sync-step {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 12px;
  transition: all 0.4s ease;
}

.sync-step.step-active {
  background: rgba(99,102,241,0.1);
  border-color: rgba(99,102,241,0.3);
  box-shadow: 0 0 20px rgba(99,102,241,0.1);
}

.sync-step.step-done {
  background: rgba(16,185,129,0.06);
  border-color: rgba(16,185,129,0.2);
}

.sync-step-icon { font-size: 16px; }
.sync-step-text { flex: 1; font-size: 13px; color: rgba(255,255,255,0.7); }
.sync-step.step-active .sync-step-text { color: #fff; font-weight: 600; }
.sync-step.step-done   .sync-step-text { color: rgba(255,255,255,0.5); }
.sync-step-status { font-size: 14px; transition: all 0.3s; }

.sync-success-state, .sync-error-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  animation: syncFadeIn 0.5s ease;
}

.sync-success-icon {
  font-size: 52px;
  animation: successPop 0.5s cubic-bezier(0.34,1.56,0.64,1);
}

@keyframes successPop {
  from { transform: scale(0); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

.sync-success-msg { font-size: 16px; font-weight: 700; color: #10b981; text-align: center; margin: 0; }
.sync-error-icon  { font-size: 40px; }
.sync-error-msg   { font-size: 13px; color: #f87171; text-align: center; margin: 0; }

@media (max-width: 580px) {
  .sync-card  { padding: 36px 24px; }
  .sync-title { font-size: 17px; }
}




/* -----------------------------------------------------------
   MODAL DE CONEX�O DE PAINEL � DESIGN PROFISSIONAL
   ----------------------------------------------------------- */

/* Cabe�alho com identidade do painel */
.panel-form-header {
  background: linear-gradient(135deg, rgba(99,102,241,0.08) 0%, rgba(139,92,246,0.05) 100%);
  border: 1px solid rgba(99,102,241,0.15);
  border-radius: 14px;
  padding: 18px 20px;
  margin-bottom: 20px;
  margin-top: 8px;
}

.panel-form-brand {
  display: flex;
  align-items: center;
  gap: 16px;
}

.panel-form-brand-icon {
  font-size: 32px;
  line-height: 1;
  transition: all 0.3s ease;
}

.panel-form-brand-title {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
}

.panel-form-brand-sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

/* Barra de passos */
.panel-steps {
  display: flex;
  align-items: center;
  margin-bottom: 22px;
  gap: 0;
}

.panel-step {
  display: flex;
  align-items: center;
  gap: 8px;
  opacity: 0.35;
  transition: opacity 0.3s;
}

.panel-step.panel-step-active { opacity: 1; }
.panel-step.panel-step-done   { opacity: 0.7; }

.panel-step-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(99,102,241,0.15);
  border: 1.5px solid rgba(99,102,241,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: #a5b4fc;
  flex-shrink: 0;
}

.panel-step.panel-step-active .panel-step-num {
  background: rgba(99,102,241,0.3);
  border-color: #6366f1;
  color: #fff;
  box-shadow: 0 0 12px rgba(99,102,241,0.4);
}

.panel-step.panel-step-done .panel-step-num {
  background: rgba(16,185,129,0.2);
  border-color: #10b981;
  color: #10b981;
}

.panel-step-label {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
}

.panel-step.panel-step-active .panel-step-label {
  color: #fff;
  font-weight: 600;
}

.panel-step-line {
  flex: 1;
  height: 1px;
  background: rgba(255,255,255,0.08);
  margin: 0 10px;
  min-width: 20px;
}

/* Selo de seguran�a */
.panel-security-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(16,185,129,0.06);
  border: 1px solid rgba(16,185,129,0.18);
  border-radius: 10px;
  padding: 10px 16px;
  margin-top: 16px;
}

.panel-sec-icon { font-size: 16px; flex-shrink: 0; }

.panel-sec-text {
  font-size: 12px;
  color: rgba(16,185,129,0.9);
  font-weight: 500;
  line-height: 1.4;
}

/* �cone do painel por tipo */
@keyframes brandPop {
  from { transform: scale(0.8); opacity: 0.5; }
  to   { transform: scale(1);   opacity: 1; }
}

.panel-form-brand-icon.brand-updated {
  animation: brandPop 0.35s cubic-bezier(0.34,1.56,0.64,1);
}

@media (max-width: 600px) {
  .panel-steps { flex-wrap: wrap; gap: 8px; }
  .panel-step-line { display: none; }
}

/* -----------------------------------------------------------
   MODAL DE RELAT�RIO DE ERROS DA SINCRONIZA��O
   ----------------------------------------------------------- */

.sync-report-card {
  background: linear-gradient(145deg, rgba(20, 22, 40, 0.98) 0%, rgba(28, 30, 58, 0.98) 100%);
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: 20px;
  padding: 32px 36px;
  max-width: 540px;
  width: 92%;
  display: flex;
  flex-direction: column;
  gap: 18px;
  box-shadow:
    0 0 0 1px rgba(245, 158, 11, 0.1),
    0 24px 60px rgba(0, 0, 0, 0.7),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  animation: syncCardSlide 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.sync-report-header {
  display: flex;
  align-items: center;
  gap: 16px;
}

.sync-report-icon {
  font-size: 36px;
  line-height: 1;
  filter: drop-shadow(0 0 14px rgba(245, 158, 11, 0.5));
  flex-shrink: 0;
}

.sync-report-title {
  font-size: 17px;
  font-weight: 700;
  color: #fff;
  line-height: 1.3;
}

.sync-report-sub {
  font-size: 13px;
  color: var(--text-secondary, #9ca3af);
  margin-top: 3px;
}

.sync-report-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 240px;
  overflow-y: auto;
  padding-right: 4px;
}

.sync-report-list::-webkit-scrollbar {
  width: 6px;
}
.sync-report-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 6px;
}

.sync-report-item {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.22);
  border-radius: 12px;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sync-report-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.sync-report-item-name {
  font-size: 14px;
  font-weight: 600;
  color: #fca5a5;
  display: flex;
  align-items: center;
  gap: 6px;
}

.sync-report-item-dom {
  font-size: 11px;
  color: var(--muted, #6b7280);
}

.sync-report-item-reason {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.85);
  line-height: 1.4;
  margin-top: 2px;
}

.sync-report-note {
  font-size: 12px;
  color: #fbbf24;
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.2);
  border-radius: 10px;
  padding: 10px 14px;
  line-height: 1.4;
}

.sync-report-ok-btn {
  width: 100%;
  padding: 12px;
  font-size: 14px;
  font-weight: 600;
  border-radius: 10px;
  cursor: pointer;
  margin-top: 4px;
}


/* ── MENU EXPANSÍVEL LATERAL (CENTRAL DE DISPARO) ── */
.nav-expandable {
  display: flex;
  flex-direction: column;
}

.nav-expandable-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
}

.nav-chevron {
  font-size: 10px;
  color: var(--muted);
  transition: transform 0.2s ease;
  margin-left: auto;
}

.nav-expandable.open .nav-chevron {
  transform: rotate(180deg);
}

.nav-subgroup {
  display: none;
  flex-direction: column;
  gap: 2px;
  margin-top: 2px;
  padding-left: 10px;
  border-left: 2px solid rgba(255, 255, 255, 0.08);
  margin-left: 18px;
}

.nav-expandable.open .nav-subgroup {
  display: flex;
}

.nav-subitem {
  font-size: 12px;
  padding: 8px 12px;
}

/* ── BOTÃO PULSANTE DE ATIVAÇÃO ── */
@keyframes pulse-primary {
  0% {
    box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.6);
    transform: scale(1);
  }
  70% {
    box-shadow: 0 0 0 16px rgba(99, 102, 241, 0);
    transform: scale(1.02);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(99, 102, 241, 0);
    transform: scale(1);
  }
}

.btn-pulse-primary {
  animation: pulse-primary 2.4s infinite cubic-bezier(0.4, 0, 0.6, 1);
}

/* ── CARDS DE ESCOLHA DE TIPO DE PAINEL ── */
.panel-choice-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin: 20px 0;
}

@media (max-width: 680px) {
  .panel-choice-grid {
    grid-template-columns: 1fr;
  }
}

.panel-choice-card {
  background: var(--surface-2, rgba(255, 255, 255, 0.03));
  border: 1px solid var(--border);
  border-radius: var(--radius-md, 12px);
  padding: 20px 16px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.panel-choice-card:hover {
  transform: translateY(-3px);
  border-color: var(--primary, #6366f1);
  background: rgba(99, 102, 241, 0.08);
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.15);
}

.panel-choice-icon {
  font-size: 32px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.05);
}

.panel-choice-title {
  font-weight: 700;
  font-size: 14px;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.panel-choice-desc {
  font-size: 11.5px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.panel-choice-badge {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 20px;
  margin-top: 12px;
  background: rgba(99, 102, 241, 0.2);
  color: #a5b4fc;
}

/* ── DROPZONE PARA PLANILHAS CSV / XLSX ── */
.panel-dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-md, 12px);
  padding: 28px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  background: rgba(255, 255, 255, 0.02);
  margin-bottom: 16px;
}

.panel-dropzone:hover, .panel-dropzone.dragover {
  border-color: var(--primary, #6366f1);
  background: rgba(99, 102, 241, 0.06);
}

.panel-dropzone-icon {
  font-size: 36px;
  margin-bottom: 10px;
}

.panel-dropzone-text {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.panel-dropzone-sub {
  font-size: 11px;
  color: var(--muted);
}

.panel-file-info {
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: var(--radius-sm, 8px);
  padding: 12px 14px;
  margin-bottom: 16px;
  font-size: 12px;
  color: #34d399;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ── BADGES DE TIPO DE PAINEL NA TABELA ── */
.badge-panel-type {
  font-size: 10.5px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.badge-panel-api {
  background: rgba(99, 102, 241, 0.15);
  color: #818cf8;
  border: 1px solid rgba(99, 102, 241, 0.3);
}

.badge-panel-csv {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-panel-manual {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}


/* ── STATUS DOTS (SUBSTITUTO PROFISSIONAL DE EMOJIS) ── */
.status-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
}
.status-dot.green { background: #22c55e; box-shadow: 0 0 6px rgba(34, 197, 94, 0.4); }
.status-dot.red { background: #ef4444; box-shadow: 0 0 6px rgba(239, 68, 68, 0.4); }
.status-dot.yellow { background: #f59e0b; box-shadow: 0 0 6px rgba(245, 158, 11, 0.4); }
.status-dot.cyan { background: #06b6d4; box-shadow: 0 0 6px rgba(6, 182, 212, 0.4); }
.status-dot.primary { background: #5b6cf1; box-shadow: 0 0 6px rgba(91, 108, 241, 0.4); }

/* ── 🎫 MÓDULO DE SUPORTE & TICKETS ──────────────────────── */
.ticket-cat-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
}

.ticket-status-badge {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
}

.chat-message-row {
  animation: fadeIn 0.2s ease-in-out;
}

.chat-message-row.msg-bubble-admin {
  align-self: flex-start;
}

.chat-message-row.msg-bubble-user {
  align-self: flex-end;
}

@media (max-width: 900px) {
  .modal-ticket-thread-box {
    width: 100% !important;
    max-width: 100% !important;
    height: 92vh !important;
    max-height: 92vh !important;
    border-radius: 20px 20px 0 0 !important;
  }
}
