/* ─── Design System ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* Prevent flash of unstyled content on theme load */
html { color-scheme: light dark; }

:root {
  /* ── Semânticas (fixas em todos os temas) ────── */
  --danger:       #dc2626;
  --danger-light: #fef2f2;
  --success:      #16a34a;
  --success-light:#f0fdf4;
  --info:         #0ea5e9;
  --info-light:   #f0f9ff;

  /* ── Estrutura (fixa) ────────────────────────── */
  --radius-sm:    6px;
  --radius:       12px;
  --radius-lg:    16px;
  --shadow-sm:    0 1px 2px rgba(0,0,0,.06), 0 1px 3px rgba(0,0,0,.08);
  --shadow:       0 4px 8px rgba(0,0,0,.08), 0 2px 4px rgba(0,0,0,.04);
  --shadow-md:    0 12px 20px rgba(0,0,0,.1),  0 4px 8px rgba(0,0,0,.06);
  --nav-height:    60px;
  --sidebar-width: 240px;
  --font:          -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ══════════════════════════════════════════════════
   TEMA 1 — CLARO  (índigo · fundo frio)
   Padrão inicial e fallback
   ══════════════════════════════════════════════════ */
:root,
[data-theme="light"] {
  --primary:      #6366f1;   /* indigo-500 */
  --primary-dark: #4f46e5;   /* indigo-600 */
  --primary-light:#eef2ff;   /* indigo-50  */
  --warning:      #f59e0b;   /* amber-500  */
  --warning-light:#fffbeb;   /* amber-50   */
  --navy:         #0f172a;   /* slate-900  */
  --navy-mid:     #1e293b;   /* slate-800  */
  --bg:           #f8fafc;   /* slate-50   */
  --card:         #ffffff;
  --input-bg:     #f8fafc;
  --text:         #0f172a;   /* slate-900  */
  --text-muted:   #64748b;   /* slate-500  */
  --border:       #94a3b8;   /* slate-400 (increased contrast) */
  --border-focus: #4f46e5;   /* indigo-600 (increased contrast) */
}

/* ══════════════════════════════════════════════════
   TEMA 2 — VIOLETA  (violet · fundo quente stone)
   ══════════════════════════════════════════════════ */
[data-theme="ambar"] {
  --primary:      #8b5cf6;   /* violet-500 */
  --primary-dark: #7c3aed;   /* violet-600 */
  --primary-light:#f5f3ff;   /* violet-50  */
  --warning:      #d97706;   /* amber-600  */
  --warning-light:#fffbeb;   /* amber-50   */
  --navy:         #1c1917;   /* stone-900  */
  --navy-mid:     #292524;   /* stone-800  */
  --bg:           #fafaf9;   /* stone-50   */
  --card:         #ffffff;
  --input-bg:     #fafaf9;
  --text:         #1c1917;   /* stone-900  */
  --text-muted:   #78716c;   /* stone-500  */
  --border:       #a39d96;   /* stone-400 (increased contrast) */
  --border-focus: #7c3aed;   /* violet-600 (increased contrast) */
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 14px;
}

/* ─── Scrollbar ─────────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ─── Sidebar ───────────────────────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  left: 0; top: 0; bottom: 0;
  width: var(--sidebar-width);
  background: var(--navy);
  display: flex;
  flex-direction: column;
  z-index: 1000;
  overflow: hidden;
  transition: transform .25s cubic-bezier(.4,0,.2,1);
  box-shadow: 2px 0 12px rgba(0,0,0,.18);
}

.sidebar-header {
  padding: 20px 18px 16px;
  border-bottom: 1px solid rgba(255,255,255,.07);
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--navy);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}
.sidebar-brand img  { height: 32px; width: auto; flex-shrink: 0; }
.sidebar-brand-text { display: flex; flex-direction: column; }
.sidebar-brand-name { font-size: 15px; font-weight: 700; color: #fff; letter-spacing: -.2px; line-height: 1.2; }
.sidebar-brand-sub  { font-size: 10px; color: #64748b; font-weight: 500; text-transform: uppercase; letter-spacing: .08em; margin-top: 1px; }

.sidebar-nav {
  flex: 1;
  padding: 12px 10px;
  overflow-y: auto;
  overflow-x: hidden;
}

/* Thin scrollbar inside sidebar-nav */
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.12); border-radius: 2px; }

.sidebar-section {
  margin-bottom: 2px;
}
.sidebar-section-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: #94a3b8;
  text-transform: none;
  letter-spacing: 0;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  transition: color .15s, background .15s;
}
.sidebar-section-toggle:hover {
  color: var(--primary);
  background: rgba(234,88,12,.08);
}
.sidebar-section-toggle.open {
  color: var(--primary);
}
.section-chevron {
  width: 12px;
  height: 12px;
  transition: transform .2s ease;
  flex-shrink: 0;
}
.sidebar-section-toggle.open .section-chevron {
  transform: rotate(0deg);
}
.sidebar-section-toggle:not(.open) .section-chevron {
  transform: rotate(-90deg);
}
.sidebar-section-items {
  overflow: hidden;
  transition: max-height .22s ease, opacity .18s ease;
  max-height: 400px;
  opacity: 1;
}
.sidebar-section-items.collapsed {
  max-height: 0;
  opacity: 0;
  pointer-events: none;
}

.sidebar-nav ul {
  list-style: none;
}

.sidebar-nav li a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: #94a3b8;
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: all .15s;
  white-space: nowrap;
  margin-bottom: 2px;
}
.sidebar-nav li a:hover  { color: #e2e8f0; background: rgba(255,255,255,.07); }
.sidebar-nav li a.active { color: #fff;    background: var(--primary); box-shadow: 0 2px 8px rgba(37,99,235,.35); }

.sidebar-nav li a .nav-icon {
  width: 16px; height: 16px;
  flex-shrink: 0;
  opacity: .75;
}
.sidebar-nav li a:hover  .nav-icon { opacity: 1; }
.sidebar-nav li a.active .nav-icon { opacity: 1; }

.sidebar-footer {
  padding: 12px 10px;
  border-top: 1px solid rgba(255,255,255,.07);
  flex-shrink: 0;
  position: sticky;
  bottom: 0;
  z-index: 10;
  background: var(--navy);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 12px;
  margin-bottom: 4px;
}
.sidebar-user-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: #fff; flex-shrink: 0;
}
.sidebar-user-name { font-size: 12px; color: #94a3b8; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.sidebar-logout {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: #f87171;
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: all .15s;
  width: 100%;
}
.sidebar-logout:hover { background: rgba(239,68,68,.12); color: #fca5a5; }
.sidebar-logout .nav-icon { width: 16px; height: 16px; flex-shrink: 0; }

/* ─── Sidebar Overlay (mobile) ──────────────────────────────────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 999;
  backdrop-filter: blur(2px);
}
.sidebar-overlay.open { display: block; }

/* ─── Mobile Topbar ─────────────────────────────────────────────────────────── */
.topbar {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-height);
  background: var(--navy);
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 998;
  box-shadow: 0 2px 8px rgba(0,0,0,.2);
}
.topbar-brand {
  font-size: 15px; font-weight: 700; color: #fff; letter-spacing: -.2px;
}
.topbar-toggle {
  background: none; border: none; color: #fff; font-size: 22px; cursor: pointer;
  padding: 4px; display: flex; align-items: center; border-radius: 6px;
  transition: background .15s;
}
.topbar-toggle:hover { background: rgba(255,255,255,.1); }

/* ─── Main Content ──────────────────────────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-width);
  width: calc(100vw - var(--sidebar-width));
  max-width: none;
  padding: 28px 28px;
  min-height: 100vh;
  box-sizing: border-box;
}

.main-content--contained {
  max-width: 1400px;
}

.main-content--fluid {
  max-width: none;
  width: calc(100vw - var(--sidebar-width));
  box-sizing: border-box;
}

/* ─── Page Header ───────────────────────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}
.page-header h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--navy-mid);
  letter-spacing: -.3px;
  margin: 0;
}
.page-header p { color: var(--text-muted); margin-top: 3px; font-size: 13px; }

/* ─── Cards ─────────────────────────────────────────────────────────────────── */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 24px;
  margin-bottom: 20px;
  border: 1px solid var(--border);
}
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
  flex-wrap: wrap;
  gap: 12px;
}
.card h2 {
  font-size: 15px;
  font-weight: 600;
  color: var(--navy-mid);
  margin-bottom: 16px;
}

/* ─── Alerts ────────────────────────────────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 18px;
  font-size: 13px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  line-height: 1.5;
}
.alert-success { background: var(--success-light); color: #166534; border: 1px solid #bbf7d0; }
.alert-error,
.alert-danger  { background: var(--danger-light);  color: #b91c1c; border: 1px solid #fecaca; }
.alert-warning { background: var(--warning-light); color: #92400e; border: 1px solid #fde68a; }
.alert-info    { background: var(--info-light);    color: #0369a1; border: 1px solid #bae6fd; }

/* ─── Buttons ───────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: all .18s;
  white-space: nowrap;
  font-family: var(--font);
  letter-spacing: .01em;
}
.btn:hover { filter: brightness(.92); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary   { background: var(--primary);   color: #fff; box-shadow: 0 1px 3px rgba(37,99,235,.3); }
.btn-secondary { background: #e2e8f0; color: var(--text); border: 1px solid #94a3b8; }
.btn-secondary:hover { background: #cbd5e1; filter: none; }
.btn-danger    { background: var(--danger);    color: #fff; }
.btn-success   { background: #16a34a;          color: #fff; }
.btn-info      { background: #0ea5e9;          color: #fff; }
.btn-warning   { background: var(--warning);   color: #fff; box-shadow: 0 1px 3px rgba(217,119,6,.3); }
.btn-sm        { padding: 5px 12px; font-size: 12px; height: 32px; }
.btn-lg        { padding: 12px 28px; font-size: 15px; }
.btn-block     { width: 100%; }
.btn-outline   { background: transparent; border: 1.5px solid var(--primary); color: var(--primary); }
.btn-outline:hover { background: var(--primary); color: #fff; filter: none; }

/* ─── Forms ─────────────────────────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.form-group label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.form-group input,
.form-group select,
.form-group textarea,
.form-control {
  padding: 9px 13px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: var(--font);
  color: var(--text);
  background: var(--input-bg);
  transition: border-color .18s, box-shadow .18s;
  outline: none;
  width: 100%;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus,
.form-control:focus {
  border-color: var(--border-focus);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(59,130,246,.12);
}
.form-group input[readonly] { background: #f1f5f9; cursor: default; color: var(--text-muted); }
.form-group small,
.form-group .hint,
small { color: var(--text-muted); font-size: 12px; margin-top: 3px; }

.form-row   { display: flex; gap: 16px; align-items: flex-end; flex-wrap: wrap; }
.form-row .form-group { margin-bottom: 0; }
.form-group-btn { align-self: flex-end; }
.form-grid  { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.form-actions { display: flex; gap: 12px; margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--border); }
.form-group-full { grid-column: 1 / -1; }
.required { color: var(--danger); }

/* Form sections */
.form-section {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
  background: var(--input-bg);
}

/* ─── Notification / toggle cards ──────────────────────────────────────────── */
.notif-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  background: var(--card);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.notif-card + .notif-card { margin-top: 14px; }
.notif-card:hover { border-color: #94a3b8; }
.notif-card-title {
  font-weight: 700;
  font-size: 14px;
  color: var(--text);
  margin-bottom: 6px;
}
.notif-card-desc {
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.55;
  margin-bottom: 14px;
}
.notif-card-desc p { margin: 0; }
.notif-card-control {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  user-select: none;
}
.notif-card-control strong { font-size: 13.5px; font-weight: 700; color: var(--text); }

/* Toggle switch (iOS-like pill) */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 52px;
  height: 28px;
  flex-shrink: 0;
}
.toggle-switch input {
  position: absolute;
  opacity: 0;
  width: 0; height: 0;
  pointer-events: none;
}
.toggle-switch .toggle-slider {
  position: absolute;
  inset: 0;
  background: #94a3b8;
  border-radius: 999px;
  transition: background .2s ease;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 7px;
}
.toggle-switch .toggle-slider::before {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,.25);
  transition: transform .2s ease;
  z-index: 2;
}
.toggle-switch .toggle-icon-on,
.toggle-switch .toggle-icon-off {
  color: #fff;
  font-size: 12px;
  line-height: 1;
  opacity: 0;
  transition: opacity .2s ease;
  pointer-events: none;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
}
.toggle-switch .toggle-icon-off { opacity: 1; margin-left: auto; }
.toggle-switch input:checked + .toggle-slider {
  background: #22c55e;
}
.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(24px);
}
.toggle-switch input:checked + .toggle-slider .toggle-icon-on  { opacity: 1; }
.toggle-switch input:checked + .toggle-slider .toggle-icon-off { opacity: 0; }
.toggle-switch input:focus-visible + .toggle-slider {
  box-shadow: 0 0 0 3px rgba(37,99,235,.25);
}
[data-theme="dark"] .notif-card { background: var(--card); }

.form-section h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--navy-mid);
  margin: 0 0 16px 0;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

/* ─── Stats Grid ────────────────────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}
.stat-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 16px;
  transition: box-shadow .2s;
}
.stat-card:hover { box-shadow: var(--shadow); }
.stat-icon  { font-size: 28px; line-height: 1; }
.stat-value { font-size: 26px; font-weight: 700; color: var(--navy-mid); line-height: 1; }
.stat-label { font-size: 12px; color: var(--text-muted); margin-top: 3px; }

/* ─── Tables ────────────────────────────────────────────────────────────────── */
.table-responsive { overflow-x: auto; border-radius: var(--radius-sm); }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th {
  background: var(--input-bg);
  padding: 11px 14px;
  text-align: left;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.data-table td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; color: var(--text); }
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover td { background: var(--input-bg); }
.no-data { text-align: center; color: var(--text-muted); padding: 48px !important; font-style: italic; }
.mono      { font-family: 'SFMono-Regular', Consolas, monospace; font-size: 12px; }
.small-text { font-size: 12px; }
.amount    { font-weight: 600; color: #16a34a; }
.currency  { font-size: 11px; color: var(--text-muted); }

/* ─── Badges ────────────────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .02em;
}
.badge-success { background: #dcfce7; color: #166534; }
.badge-danger  { background: var(--danger-light); color: #b91c1c; }
.badge-warning { background: var(--warning-light); color: #92400e; }
.badge-info    { background: var(--primary-light); color: #1e40af; }
.badge-secondary { background: #f1f5f9; color: var(--text-muted); }

.platform-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  text-transform: capitalize;
}

/* ─── Platform Cards ────────────────────────────────────────────────────────── */
.platform-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.platform-card {
  background: var(--card);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  border-left: 4px solid #94a3b8;
  border: 1px solid var(--border);
  border-left-width: 4px;
  transition: box-shadow .2s;
}
.platform-card:hover { box-shadow: var(--shadow); }
.platform-name  { font-size: 13px; font-weight: 600; text-transform: capitalize; color: var(--navy-mid); }
.platform-total { font-size: 18px; font-weight: 700; color: var(--primary); }
.platform-count { font-size: 11px; color: var(--text-muted); }

/* ─── Charts ────────────────────────────────────────────────────────────────── */
.chart-container      { position: relative; max-height: 350px; }
.chart-container-wide { max-height: 400px; }
.charts-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 768px) { .charts-grid { grid-template-columns: 1fr; } }

/* ─── Pagination ────────────────────────────────────────────────────────────── */
.pagination { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 16px 0 0; flex-wrap: wrap; }
.page-info  { color: var(--text-muted); font-size: 13px; }
.pagination a, .pagination span {
  padding: 6px 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  text-decoration: none;
  color: var(--text);
  transition: all .15s;
}
.pagination a:hover    { background: #f1f5f9; border-color: #94a3b8; }
.pagination span.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.pagination span.dots   { border: none; color: var(--text-muted); padding: 6px 4px; }

/* ─── Filter Card ───────────────────────────────────────────────────────────── */
.filter-card { padding: 18px 24px; }
.filter-card .action-buttons { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.table-search input {
  padding: 8px 13px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  min-width: 240px;
  outline: none;
  background: var(--input-bg);
  transition: border-color .18s;
}
.table-search input:focus { border-color: var(--border-focus); }

/* ─── Modal ─────────────────────────────────────────────────────────────────── */
.modal {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-content {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  max-width: 500px;
  width: 100%;
  box-shadow: var(--shadow-md);
}
.modal-content h2 { font-size: 18px; margin-bottom: 10px; color: var(--text); }
.modal-content p  { color: var(--text-muted); margin-bottom: 20px; font-size: 13px; }
.modal-buttons    { display: flex; gap: 10px; margin-top: 20px; }
.code-textarea {
  width: 100%; font-family: 'SFMono-Regular', Consolas, monospace;
  font-size: 12px; padding: 12px; border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); background: var(--bg); color: var(--text); resize: vertical; outline: none;
}

/* ─── Settings ──────────────────────────────────────────────────────────────── */
.settings-card      { margin-bottom: 20px; }
.license-status     { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; font-weight: 500; font-size: 14px; }
.license-info       { color: var(--text-muted); font-size: 13px; }
.license-form       { display: flex; flex-direction: column; gap: 14px; max-width: 420px; }

.accordion-item { border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 8px; overflow: hidden; }
.accordion-header {
  width: 100%; text-align: left; padding: 13px 16px;
  background: var(--input-bg); border: none; cursor: pointer; font-size: 13px; font-family: var(--font);
  display: flex; align-items: center; gap: 10px; justify-content: space-between;
  font-weight: 600; color: var(--text); transition: background .15s;
}
.accordion-header:hover { background: var(--border); }
.accordion-body { padding: 16px; border-top: 1px solid var(--border); background: var(--card); }
.platform-dot   { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.accordion-arrow { font-size: 11px; color: var(--text-muted); }

.webhook-list { display: flex; flex-direction: column; gap: 8px; }
.webhook-item {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  background: var(--input-bg); border-radius: var(--radius-sm); flex-wrap: wrap;
  border: 1px solid var(--border);
}
.webhook-platform { font-weight: 600; text-transform: capitalize; min-width: 100px; font-size: 13px; }
.webhook-url { font-family: monospace; font-size: 12px; color: var(--primary); flex: 1; word-break: break-all; }

.danger-zone { border: 1px solid #fecaca !important; }
.danger-zone h2 { color: var(--danger) !important; }
.danger-actions { display: flex; flex-direction: column; gap: 12px; }
.danger-action  {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px; background: var(--danger-light); border-radius: var(--radius-sm);
  gap: 12px; flex-wrap: wrap; border: 1px solid #fecaca;
}
.danger-action h4 { margin-bottom: 3px; font-size: 13px; color: var(--navy-mid); }
.danger-action p  { font-size: 12px; color: var(--text-muted); }

/* ─── Conversion Indicators ─────────────────────────────────────────────────── */
.conversion-indicator { font-size: 14px; }
.converted     { color: #16a34a; }
.not-converted { color: #d1d5db; }

/* ─── Login / Register Pages ────────────────────────────────────────────────── */
.login-body {
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px 16px;
}
.login-container {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 36px 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-md);
}
.login-logo {
  text-align: center;
  margin-bottom: 28px;
}
.login-logo img { height: 48px; width: auto; margin-bottom: 10px; }
.login-logo h1  { font-size: 22px; font-weight: 800; color: var(--navy-mid); margin: 0 0 4px; letter-spacing: -.3px; }
.login-logo p   { font-size: 13px; color: var(--text-muted); margin: 0; }
.login-form .btn { margin-top: 8px; }
.login-footer {
  text-align: center;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-muted);
}
.login-footer a { color: var(--primary); text-decoration: none; font-weight: 600; }
.login-footer a:hover { text-decoration: underline; }
.login-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 0;
  color: var(--text-muted);
  font-size: 12px;
}
.login-divider::before,
.login-divider::after { content: ''; flex: 1; border-top: 1px solid var(--border); }

/* ─── Error Page ────────────────────────────────────────────────────────────── */
.error-page { text-align: center; padding: 80px 20px; }
.error-page h1 { font-size: 56px; font-weight: 800; color: var(--navy-mid); margin-bottom: 16px; }
.error-page p  { color: var(--text-muted); margin-bottom: 24px; font-size: 16px; }

/* ─── Responsive ────────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .sidebar   { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .topbar    { display: flex; }
  .main-content {
    margin-left: 0;
    padding: 20px 16px;
    padding-top: calc(var(--nav-height) + 20px);
  }
  .main-content--fluid {
    width: 100%;
  }
  .form-row { flex-direction: column; }
  .form-row .form-group { width: 100%; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .main-content { padding: 16px 12px; padding-top: calc(var(--nav-height) + 16px); }
  .card { padding: 16px; }
  .page-header h1 { font-size: 18px; }
}

/* ══════════════════════════════════════════════════
   TEMA 2 — VIOLETA  overrides de componentes
   ══════════════════════════════════════════════════ */
[data-theme="ambar"] .btn-secondary       { background: #f5f4f3; color: var(--text); border-color: var(--border); }
[data-theme="ambar"] .btn-secondary:hover { background: #ebe9e7; filter: none; }
[data-theme="ambar"] .btn-warning         { color: #1c1917; }
[data-theme="ambar"] .btn-primary         { box-shadow: 0 1px 3px rgba(139,92,246,.35); }
[data-theme="ambar"] .btn-outline         { border-color: var(--primary); color: var(--primary); }
[data-theme="ambar"] .btn-outline:hover   { background: var(--primary-light); color: var(--primary); filter: none; }

/* Formulários */
[data-theme="ambar"] .form-group input:focus,
[data-theme="ambar"] .form-group select:focus,
[data-theme="ambar"] .form-group textarea:focus,
[data-theme="ambar"] .form-control:focus  { box-shadow: 0 0 0 3px rgba(139,92,246,.15); }

/* Badges — tons stone + violet */
[data-theme="ambar"] .badge-info          { background: #f5f3ff; color: #7c3aed; }
[data-theme="ambar"] .badge-secondary     { background: #f5f4f3; color: var(--text-muted); }

/* Alertas */
[data-theme="ambar"] .alert-info          { background: #f5f3ff; color: #7c3aed; border-color: #ddd6fe; }

/* Nav item ativo — sombra violet */
[data-theme="ambar"] .sidebar-nav li a.active { box-shadow: 0 2px 8px rgba(139,92,246,.35); }

/* ─── Seletores de tema (3 botões redondos) ─────────────────────────────────── */
.theme-switcher {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
}
.theme-switcher-label {
  font-size: 11px;
  color: #64748b;
  font-weight: 500;
  flex: 1;
}
.theme-dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform .15s, border-color .15s, box-shadow .15s;
  flex-shrink: 0;
  position: relative;
}
.theme-dot:hover { transform: scale(1.2); }
.theme-dot.active {
  border-color: #ffffff;
  box-shadow: 0 0 0 1px rgba(255,255,255,.35);
  transform: scale(1.15);
}
.theme-dot-light  { background: linear-gradient(135deg, #e2e8f0 50%, #6366f1 50%); }
.theme-dot-dark   { background: linear-gradient(135deg, #18181b 50%, #818cf8 50%); }
.theme-dot-ambar  { background: linear-gradient(135deg, #fafaf9 50%, #8b5cf6 50%); }

/* ─── Theme Toggle Button ───────────────────────────────────────────────────── */
.theme-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: #94a3b8;
  background: none;
  border: none;
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font);
  cursor: pointer;
  transition: all .15s;
  width: 100%;
  text-align: left;
  margin-bottom: 2px;
}
.theme-toggle:hover { color: #e2e8f0; background: rgba(255,255,255,.07); }
.theme-toggle .nav-icon { width: 16px; height: 16px; flex-shrink: 0; opacity: .75; }
.theme-toggle:hover .nav-icon { opacity: 1; }

.topbar-spacer {
  width: 30px;
}

.sidebar-section-label {
  display: flex;
  align-items: center;
  gap: 8px;
}
.sidebar-section-label .nav-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.hide-on-error.is-hidden {
  display: none !important;
}

/* ══════════════════════════════════════════════════
   TEMA 3 — ESCURO  (zinc neutro + índigo)
   ══════════════════════════════════════════════════ */
[data-theme="dark"] {
  --bg:           #09090b;   /* zinc-950 — neutro, sem tom quente */
  --card:         #18181b;   /* zinc-900 */
  --text:         #fafafa;   /* zinc-50  */
  --text-muted:   #a1a1aa;   /* zinc-400 */
  --border:       #27272a;   /* zinc-800 */
  --border-focus: #818cf8;   /* indigo-400 */
  --input-bg:     #18181b;   /* zinc-900 */
  --navy:         #09090b;   /* zinc-950 */
  --navy-mid:     #fafafa;   /* texto na sidebar */
  --primary:      #818cf8;   /* indigo-400 — brilhante no escuro */
  --primary-dark: #6366f1;   /* indigo-500 */
  --primary-light:#1e1b4b;   /* indigo-950 */
  --warning:      #fbbf24;   /* amber-400  */
  --warning-light:#451a03;   /* amber-950  */
  --success-light:#052e16;   /* green-950  */
  --danger-light: #450a0a;   /* red-950    */
  --info-light:   #082f49;   /* sky-950    */
  --shadow-sm:    0 1px 3px rgba(0,0,0,.8),  0 1px 2px rgba(0,0,0,.6);
  --shadow:       0 4px 8px rgba(0,0,0,.8),  0 2px 4px rgba(0,0,0,.6);
  --shadow-md:    0 12px 20px rgba(0,0,0,.8), 0 4px 8px rgba(0,0,0,.6);
}

/* Scrollbar */
[data-theme="dark"] ::-webkit-scrollbar-track { background: var(--bg); }
[data-theme="dark"] ::-webkit-scrollbar-thumb { background: var(--border); }
[data-theme="dark"] ::-webkit-scrollbar-thumb:hover { background: #3f3f46; }

/* Forms */
[data-theme="dark"] .form-group input:focus,
[data-theme="dark"] .form-group select:focus,
[data-theme="dark"] .form-group textarea:focus,
[data-theme="dark"] .form-control:focus { background: #27272a; box-shadow: 0 0 0 3px rgba(129,140,248,.2); }
[data-theme="dark"] .form-group input[readonly] { background: var(--bg); color: var(--text-muted); }
[data-theme="dark"] .code-textarea { background: var(--input-bg); color: var(--text); border-color: var(--border); }

/* Buttons */
[data-theme="dark"] .btn-secondary { background: #27272a; color: var(--text); border-color: var(--border); }
[data-theme="dark"] .btn-secondary:hover { background: #3f3f46; filter: none; }
[data-theme="dark"] .btn-warning { background: #b45309; }
[data-theme="dark"] .btn-outline { border-color: var(--primary); color: var(--primary); }
[data-theme="dark"] .btn-outline:hover { background: var(--primary-light); color: #818cf8; filter: none; }

/* Alerts */
[data-theme="dark"] .alert-success { background: #052e16; color: #4ade80; border-color: #14532d; }
[data-theme="dark"] .alert-error,
[data-theme="dark"] .alert-danger  { background: #450a0a; color: #f87171; border-color: #7f1d1d; }
[data-theme="dark"] .alert-warning { background: #451a03; color: #fbbf24; border-color: #92400e; }
[data-theme="dark"] .alert-info    { background: #082f49; color: #38bdf8; border-color: #0c4a6e; }

/* Badges */
[data-theme="dark"] .badge-success   { background: #052e16; color: #4ade80; }
[data-theme="dark"] .badge-danger    { background: #450a0a; color: #f87171; }
[data-theme="dark"] .badge-warning   { background: #451a03; color: #fbbf24; }
[data-theme="dark"] .badge-info      { background: #082f49; color: #38bdf8; }
[data-theme="dark"] .badge-secondary { background: #27272a; color: var(--text-muted); }

/* Pagination */
[data-theme="dark"] .pagination a,
[data-theme="dark"] .pagination span { border-color: var(--border); color: var(--text); }
[data-theme="dark"] .pagination a:hover { background: var(--border); }
[data-theme="dark"] .pagination span.dots { color: var(--text-muted); border: none; }

/* Search */
[data-theme="dark"] .table-search input { background: var(--input-bg); color: var(--text); border-color: var(--border); }
[data-theme="dark"] .table-search input:focus { border-color: var(--border-focus); }

/* Notif cards */
[data-theme="dark"] .toggle-switch .toggle-slider { background: #3f3f46; }

/* Danger zone */
[data-theme="dark"] .danger-zone { border-color: #7f1d1d !important; }
[data-theme="dark"] .danger-zone h2 { color: #f87171 !important; }
[data-theme="dark"] .danger-action { background: #450a0a; border-color: #7f1d1d; }
[data-theme="dark"] .danger-action h4 { color: var(--text); }

/* Modal */
[data-theme="dark"] .modal { background: rgba(0,0,0,.75); }
[data-theme="dark"] .modal-content { background: var(--card); border: 1px solid var(--border); }
[data-theme="dark"] .modal-content h2 { color: var(--text); }
[data-theme="dark"] .modal-content p  { color: var(--text-muted); }

/* Stat cards */
[data-theme="dark"] .stat-value { color: var(--text); }

/* Page header */
[data-theme="dark"] .page-header h1 { color: var(--text); }
[data-theme="dark"] .card h2 { color: var(--text); }

/* Topbar (mobile) */
[data-theme="dark"] .topbar { background: var(--navy); box-shadow: 0 2px 8px rgba(0,0,0,.6); }

/* ─── ClicVetor Logo — Theme-aware switching ─────────────────────────────────
   Use classes cv-logo-light / cv-logo-dark and cv-icon-light / cv-icon-dark.
   Default = light theme: show light variant, hide dark variant.
   Inline display:none should NOT be set on these elements — let CSS control it.
   ─────────────────────────────────────────────────────────────────────────── */
.cv-logo-dark,
.cv-icon-dark { display: none; }

.cv-logo-light,
.cv-icon-light { display: inline-block; }

[data-theme="dark"] .cv-logo-light,
[data-theme="dark"] .cv-icon-light { display: none; }

[data-theme="dark"] .cv-logo-dark,
[data-theme="dark"] .cv-icon-dark  { display: inline-block; }

/* Ambar: background is light, so use the light logo */
[data-theme="ambar"] .cv-logo-light,
[data-theme="ambar"] .cv-icon-light { display: inline-block; }
[data-theme="ambar"] .cv-logo-dark,
[data-theme="ambar"] .cv-icon-dark  { display: none; }
