/* ======================================================
   Shyder Traffic — Design System
   Matching dashboard-template-1 layout model exactly
   Icon-centric sidebar, fixed header, dark-first
   ====================================================== */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&family=JetBrains+Mono:wght@400;500&display=swap');

/* ─── CSS Variables ──────────────────────────────────── */
:root {
  --primary:         #A00101;
  --primary-dark:    #500000;
  --primary-light:   #A00101;
  --primary-surface: rgba(160,1,1,0.10);
  --primary-border:  rgba(160,1,1,0.20);
  --primary-glow:    rgba(160,1,1,0.30);

  --bg-primary:    #f8fafc;
  --bg-secondary:  #ffffff;
  --bg-tertiary:   #f1f5f9;
  --bg-card:       #ffffff;
  --bg-hover:      rgba(0,0,0,0.03);
  --bg-input:      #ffffff;

  --border:         transparent;
  --border-input:   #e2e8f0;
  --border-table:   #e2e8f0;
  --border-shell:   #e2e8f0;

  --text-primary:    #0f172a;
  --text-secondary:  #475569;
  --text-muted:      #64748b;
  --text-placeholder:#94a3b8;

  --success: #10b981;
  --warning: #f59e0b;
  --danger:  #ef4444;
  --info:    #3b82f6;

  --sidebar-w: 228px;
  --sidebar-w-expanded: 240px;
  --header-h: 64px;

  --radius-sm:  6px;
  --radius-md:  8px;
  --radius-lg:  12px;
  --radius-xl:  16px;
  --radius-2xl: 20px;

  --shadow-sm:  0 1px 2px rgba(0,0,0,.05);
  --shadow-md:  0 4px 12px rgba(0,0,0,.08);
  --shadow-lg:  0 10px 30px rgba(0,0,0,.12);
  --shadow-xl:  0 20px 50px rgba(0,0,0,.15);

  --font-sans: 'DM Sans', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --transition: 200ms ease;
  --transition-slow: 300ms ease-in-out;
}

.dark {
  --bg-primary:    #030303;
  --bg-secondary:  #0a0a0a;
  --bg-tertiary:   #141414;
  --bg-card:       #0a0a0a;
  --bg-hover:      rgba(255,255,255,0.06);
  --bg-input:      rgba(20,20,20,0.9);

  --border:        #1e1e1e;
  --border-input:  #2a2a2a;
  --border-table:  #2a2a2a;
  --border-shell:  #1e1e1e;

  --text-primary:    #ffffff;
  --text-secondary:  #e0e0e0;
  --text-muted:      rgba(255,255,255,0.65);
  --text-placeholder:#6b6b6b;
}

/* ─── Reset ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; scroll-behavior: smooth; height: 100%; }
body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font-family: inherit; }
img { max-width: 100%; }
button { cursor: pointer; }

/* ─── Scrollbar ──────────────────────────────────────── */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #a2abb1; border-radius: 20px; }
::-webkit-scrollbar-thumb:hover { background: #8c959b; }

/* ─── Layout Shell ───────────────────────────────────── */
.layout {
  display: flex;
  min-height: 100vh;
  max-width: 1920px;
  margin: 0 auto;
}

/* ═══════════════════════════════════════════════════════
   SIDEBAR — Horizontal layout (icon + label em linha)
   ═══════════════════════════════════════════════════════ */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-shell);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 30;
  overflow: hidden;
  transition: width 0.22s ease;
  overflow-y: auto;
  scrollbar-width: none;
}
.sidebar::-webkit-scrollbar { display: none; }

/* Logo area */
.sidebar-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 20px 16px 18px;
  border-bottom: 1px solid var(--border-shell);
  margin-bottom: 10px;
}
.sidebar-logo .logo-img {
  width: 140px;
  height: auto;
  max-height: 56px;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 2px 8px rgba(224,16,16,0.3));
}
.sidebar-logo .logo-favicon {
  display: none;
  width: 32px;
  height: 32px;
  object-fit: contain;
  flex-shrink: 0;
}
.sidebar-logo .logo-icon {
  width: 40px; height: 40px;
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  border-radius: var(--radius-xl);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 0 12px rgba(160,1,1,0.4);
}
.sidebar-logo .logo-icon svg { color: #fff; }
.sidebar-title { display: none; }

/* Nav container */
.sidebar-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 10px;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
}
.sidebar-nav::-webkit-scrollbar { display: none; }

/* Nav item — horizontal: icon à esquerda, label à direita */
.nav-item {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
  text-align: left;
  width: 100%;
  border: none;
  background: none;
  position: relative;
  text-decoration: none;
}
.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

/* Ícone — pequeno, inline */
.nav-item .nav-icon {
  width: 20px; height: 20px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: none;
  background: transparent;
  border: none;
}
.nav-item:hover .nav-icon { background: transparent; box-shadow: none; }

.nav-item svg { flex-shrink: 0; width: 17px; height: 17px; stroke-width: 1.5; }
.nav-label { flex: 1; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; }

/* Estado ativo — gradiente + glow lateral */
.nav-item.active {
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  color: #fff;
  box-shadow:
    inset 2px 0 0 rgba(255,80,80,0.55),
    inset -2px 0 0 rgba(255,60,60,0.18),
    0 0 14px rgba(160,1,1,0.28);
}
.nav-item.active .nav-icon { background: transparent; border: none; }
.nav-item.active:hover {
  background: linear-gradient(135deg, #600000, #B50202);
  box-shadow:
    inset 2px 0 0 rgba(255,100,100,0.6),
    inset -2px 0 0 rgba(255,80,80,0.22),
    0 0 18px rgba(160,1,1,0.35);
}

/* Remove barra lateral (não usada no estilo horizontal) */
.nav-item.active::before { display: none; }

/* Badge de pendentes */
.nav-badge {
  margin-left: auto;
  background: rgba(255,255,255,0.25);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 99px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 5px;
}
.nav-item:not(.active) .nav-badge {
  background: var(--danger);
}

/* ─── Nav Group (colapsável) ─────────────────────────── */
.nav-group { width: 100%; }

.nav-group-toggle {
  cursor: pointer;
  user-select: none;
}

/* Caret no lado direito */
.nav-group-caret {
  margin-left: auto;
  width: 14px; height: 14px;
  flex-shrink: 0;
  color: var(--text-muted);
  transition: transform 0.2s ease;
}
.nav-group.open .nav-group-caret { transform: rotate(180deg); }

/* Pai aberto — leve destaque sem background ativo */
.nav-group.open .nav-group-toggle {
  color: var(--text-primary);
  background: var(--bg-hover);
}

/* Itens filhos */
.nav-group-items {
  display: none;
  flex-direction: column;
  gap: 1px;
  padding: 3px 0 4px 0;
}
.nav-group.open .nav-group-items { display: flex; }

.nav-child {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  padding: 8px 12px 8px 42px;  /* indent para alinhar com label do pai */
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  width: 100%;
  text-align: left;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nav-child:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}
.nav-child.active {
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  color: #fff;
  font-weight: 600;
  box-shadow: inset 2px 0 0 rgba(255,80,80,0.45), 0 0 10px rgba(160,1,1,0.2);
}
.nav-child.active:hover {
  background: linear-gradient(135deg, #600000, #B50202);
}

.nav-child-dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
  opacity: 0.6;
}
.nav-child.active .nav-child-dot { opacity: 1; }

/* Bolinha colorida para grupos (cor definida inline via style="background:...") */
.nav-group-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  opacity: 0.85;
  transition: opacity 0.15s, box-shadow 0.15s;
}
.nav-child.active .nav-group-dot {
  opacity: 1;
  box-shadow: 0 0 6px currentColor;
}

/* Separador opcional entre grupos de nav */
.nav-separator {
  height: 1px;
  background: var(--border-shell);
  margin: 8px 0;
}

/* Sidebar footer */
.sidebar-footer {
  display: flex;
  justify-content: stretch;
  padding: 8px 10px 16px;
  margin-top: auto;
  border-top: 1px solid var(--border-shell);
}
.sidebar-footer form { width: 100%; }
.sidebar-footer .nav-item { border: none; background: none; width: 100%; }

/* ─── Sidebar Toggle Button ──────────────────────────── */
.sidebar-collapse-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 1px solid var(--border-shell);
  background: var(--bg-secondary);
  color: var(--text-muted);
  cursor: pointer;
  transition: left 0.22s ease, background 0.15s, border-color 0.15s, color 0.15s, transform 0.15s;
  flex-shrink: 0;
  position: fixed;
  left: calc(var(--sidebar-w) - 14px);
  top: 72px;
  z-index: 40;
  box-shadow: var(--shadow-sm);
}
.sidebar-collapse-btn:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  transform: scale(1.05);
}
.sidebar-collapse-btn svg { width: 13px; height: 13px; transition: transform 0.22s; }

/* ─── Estado Colapsado ───────────────────────────────── */
body.sidebar-collapsed .sidebar { width: 64px; overflow: visible; }
body.sidebar-collapsed .main    { margin-left: 64px; }

/* Esconde labels e elementos desnecessários */
body.sidebar-collapsed .nav-label,
body.sidebar-collapsed .nav-group-caret,
body.sidebar-collapsed .nav-child { display: none !important; }

/* Nav group: só mostra o ícone pai */
body.sidebar-collapsed .nav-group-items  { display: none !important; }
body.sidebar-collapsed .nav-group-toggle { border-radius: var(--radius-md); }

/* Centraliza o ícone */
body.sidebar-collapsed .sidebar-nav { padding: 8px 6px; align-items: center; }
body.sidebar-collapsed .nav-item    { justify-content: center; padding: 10px 8px; }
body.sidebar-collapsed .nav-item .nav-icon { width: 22px; height: 22px; }

/* Logo: só favicon quando recolhido */
body.sidebar-collapsed .sidebar-logo { padding: 16px 8px; justify-content: center; }
body.sidebar-collapsed .sidebar-logo .logo-full { display: none !important; }
body.sidebar-collapsed .sidebar-logo .logo-favicon { display: block !important; }
body.sidebar-collapsed .sidebar-footer { justify-content: center; padding: 8px 6px 16px; }

/* Rota o ícone e move o botão quando colapsado */
body.sidebar-collapsed .sidebar-collapse-btn { left: calc(64px - 14px); }
body.sidebar-collapsed .sidebar-collapse-btn svg { transform: rotate(180deg); }

/* Tooltip nativo via title — mostra o label no hover quando colapsado */
body.sidebar-collapsed .nav-item[title]:hover::after {
  content: attr(title);
  position: absolute;
  left: calc(100% + 12px);
  top: 50%;
  transform: translateY(-50%);
  background: #1e1e1e;
  color: #fff;
  font-size: 12px;
  font-weight: 500;
  padding: 5px 10px;
  border-radius: 6px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 9999;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  border: 1px solid rgba(255,255,255,0.08);
}

/* ═══════════════════════════════════════════════════════
   MAIN CONTENT
   ═══════════════════════════════════════════════════════ */
.main {
  margin-left: var(--sidebar-w);
  transition: margin-left 0.22s ease;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left var(--transition-slow);
}

/* ═══════════════════════════════════════════════════════
   HEADER — Fixed top bar matching template
   ═══════════════════════════════════════════════════════ */
.header {
  height: var(--header-h);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-shell);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 20;
}
.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 1;
}
.header-right {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Page title in header (like template) */
.header-title {
  font-size: 22px;
  font-weight: 400;
  color: var(--text-secondary);
}

.header-divider {
  width: 1px;
  height: 24px;
  background: var(--border-shell);
  margin: 0 8px;
}

.btn-icon {
  width: 38px; height: 38px;
  border-radius: var(--radius-xl);
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  transition: all var(--transition);
}
.btn-icon:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  transform: scale(1.05);
}
.btn-icon:active { transform: scale(0.95); }
.btn-icon svg { width: 18px; height: 18px; stroke-width: 1.5; }

.avatar {
  width: 36px; height: 36px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}
.avatar-group {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-lg);
  transition: background var(--transition);
  position: relative;
}
.avatar-group:hover { background: var(--bg-hover); }
.avatar-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
}

/* ─── User Dropdown ──────────────────────────────────── */
.user-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  min-width: 210px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-shell);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  z-index: 100;
  overflow: hidden;
  display: none;
  animation: dropIn 150ms ease;
}
.user-dropdown.open { display: block; }

@keyframes dropIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.user-dropdown-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 14px 12px;
}
.user-dropdown-divider {
  height: 1px;
  background: var(--border-shell);
  margin: 2px 0;
}
.user-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: background var(--transition), color var(--transition);
  font-family: var(--font-sans);
}
.user-dropdown-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}
.user-dropdown-item svg { flex-shrink: 0; color: var(--text-muted); }
.user-dropdown-logout { color: var(--danger); }
.user-dropdown-logout svg { color: var(--danger); }
.user-dropdown-logout:hover { background: rgba(239,68,68,0.08); color: var(--danger); }

/* ═══════════════════════════════════════════════════════
   PAGE CONTENT
   ═══════════════════════════════════════════════════════ */
.page-content {
  padding: 24px;
  flex: 1;
}
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
  flex-wrap: wrap;
}
.page-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
}
.page-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ─── Stat Cards ─────────────────────────────────────── */
.stat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-2xl);
  padding: 20px;
  position: relative;
  overflow: hidden;
  min-height: 120px;
  transition: background-color var(--transition), border-color var(--transition), box-shadow var(--transition);
}
.stat-card:hover { box-shadow: var(--shadow-sm); }

.stat-icon {
  width: 32px; height: 32px;
  border-radius: var(--radius-md);
  background: var(--bg-tertiary);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  margin-bottom: 12px;
}
.stat-icon svg { width: 16px; height: 16px; }

.stat-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 8px;
  line-height: 1.4;
}
.stat-value {
  font-size: 26px;
  font-weight: 600;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}
.stat-value.positive { color: var(--success); }
.stat-value.negative { color: var(--danger); }
.stat-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
  font-weight: 500;
}
.stat-change {
  font-size: 12px;
  font-weight: 500;
  margin-top: 4px;
}
.stat-change.up { color: #4ade80; }
.stat-change.down { color: #f87171; }

/* ─── Cards ──────────────────────────────────────────── */
.card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 24px;
  transition: background-color var(--transition), border-color var(--transition);
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.card-title { font-size: 15px; font-weight: 600; color: var(--text-primary); }
.card-subtitle { font-size: 12px; color: var(--text-muted); }

/* ─── Buttons ────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: var(--radius-lg);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
  white-space: nowrap;
}
.btn:active { transform: scale(0.97); }
.btn-primary {
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  color: #fff;
  box-shadow: 0 0 12px rgba(160,1,1,0.4);
}
.btn-primary:hover {
  box-shadow: 0 0 20px rgba(160,1,1,0.6);
  background: linear-gradient(135deg, #600000, #B50202);
}
.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-shell);
}
.btn-ghost:hover { background: var(--bg-hover); color: var(--text-primary); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { opacity: 0.88; }
.btn-sm { padding: 6px 12px; font-size: 12px; border-radius: var(--radius-md); }
.btn svg { width: 14px; height: 14px; }

/* ─── Forms ──────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border-input);
  border-radius: var(--radius-lg);
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 14px;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.form-control::placeholder { color: var(--text-placeholder); }
.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-surface);
}
.form-control:disabled { opacity: 0.5; cursor: not-allowed; }
select.form-control { cursor: pointer; }

/* ─── Table ──────────────────────────────────────────── */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-xl);
  border: 1px solid var(--border);
  overflow: hidden;
}
table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead th {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 13px;
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border-table);
  white-space: nowrap;
}
tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-table);
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background var(--transition); }
tbody tr:hover td { background: var(--bg-hover); }
.td-right  { text-align: right; }
.td-center { text-align: center; }
.text-success { color: var(--success); }
.text-danger  { color: var(--danger); }
.text-muted   { color: var(--text-muted); }
.text-mono    { font-family: var(--font-mono); }
.fw-600 { font-weight: 600; }

/* ─── Badges ─────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 500;
}
.badge-success { background: rgba(16,185,129,.12); color: var(--success); }
.badge-danger  { background: rgba(239,68,68,.12);  color: var(--danger); }
.badge-warning { background: rgba(245,158,11,.12); color: var(--warning); }
.badge-info    { background: rgba(59,130,246,.12); color: var(--info); }
.badge-orange  { background: var(--primary-surface); color: var(--primary); }

/* ─── Tabs ───────────────────────────────────────────── */
.tabs {
  display: flex; gap: 4px;
  border-bottom: 1px solid var(--border-shell);
  margin-bottom: 24px;
}
.tab-btn {
  padding: 10px 18px; font-size: 13px; font-weight: 500;
  color: var(--text-muted); cursor: pointer; border: none; background: none;
  border-bottom: 2px solid transparent; transition: all var(--transition);
  margin-bottom: -1px; display: inline-flex; align-items: center; gap: 6px;
}
.tab-btn:hover { color: var(--text-primary); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ─── Filters Bar ────────────────────────────────────── */
.filters-bar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 20px;
}
.filters-bar .form-control { width: auto; }

/* ─── Modal ──────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.6); backdrop-filter: blur(4px);
  z-index: 200; display: flex; align-items: center; justify-content: center;
  padding: 16px; opacity: 0; pointer-events: none; transition: opacity 200ms;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: var(--radius-xl); width: 100%; max-width: 480px;
  max-height: 90vh; overflow-y: auto; padding: 28px;
  transform: translateY(12px) scale(0.97); transition: transform 200ms ease;
  box-shadow: var(--shadow-xl);
}
.modal-overlay.open .modal { transform: translateY(0) scale(1); }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.modal-title { font-size: 18px; font-weight: 600; }
.modal-close {
  width: 32px; height: 32px; border-radius: var(--radius-md); border: none;
  background: var(--bg-tertiary); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); transition: all var(--transition);
}
.modal-close:hover { background: var(--bg-hover); color: var(--text-primary); }
.modal-footer {
  display: flex; gap: 10px; justify-content: flex-end;
  margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--border-shell);
}

/* ─── Toast ──────────────────────────────────────────── */
.toast-container {
  position: fixed; bottom: 24px; right: 24px; z-index: 9999;
  display: flex; flex-direction: column; gap: 10px;
}
.toast {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 14px 18px;
  font-size: 13px; font-weight: 500; display: flex; align-items: center;
  gap: 10px; box-shadow: var(--shadow-lg); animation: slideInRight 250ms ease; max-width: 340px;
}
.toast.success { border-left: 3px solid var(--success); }
.toast.error   { border-left: 3px solid var(--danger); }
@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

/* ─── Dólar Bar ──────────────────────────────────────── */
.dolar-bar {
  display: flex; align-items: center; gap: 8px;
  background: var(--primary-surface); border: 1px solid var(--primary-border);
  border-radius: var(--radius-lg); padding: 8px 14px;
  font-size: 13px; font-weight: 500; color: var(--primary);
}
.dolar-bar input {
  background: transparent; border: none; color: var(--primary);
  font-weight: 700; font-size: 13px; width: 72px; text-align: center;
}
.dolar-bar input:focus { outline: none; }

/* ─── Planilha (spreadsheet-style table) ─────────────── */
.sheet-section { margin-bottom: 28px; }
.sheet-date-header { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.sheet-date-badge {
  background: var(--primary-surface); color: var(--primary);
  border: 1px solid var(--primary-border); border-radius: var(--radius-md);
  padding: 5px 14px; font-size: 12px; font-weight: 600; font-family: var(--font-mono);
}
.sheet-dolar-badge {
  background: var(--bg-tertiary); color: var(--text-muted);
  border-radius: var(--radius-md); padding: 5px 12px; font-size: 11px; font-family: var(--font-mono);
}
.num-cell { font-family: var(--font-mono); font-size: 12px; text-align: right; }
.num-cell.lucro-pos { color: var(--success); font-weight: 600; }
.num-cell.lucro-neg { color: var(--danger);  font-weight: 600; }

/* ─── Empty State ────────────────────────────────────── */
.empty-state {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; padding: 60px 24px; color: var(--text-muted); gap: 16px;
}
.empty-state svg { opacity: 0.2; }
.empty-state p { font-size: 14px; color: var(--text-muted); }

/* ─── Auth Pages ─────────────────────────────────────── */
.auth-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: var(--bg-primary); padding: 24px; position: relative; overflow: hidden;
}
.auth-page::before {
  content: ''; position: absolute; inset: 0; opacity: 0.04; pointer-events: none;
  background-image:
    linear-gradient(var(--border-shell) 1px, transparent 1px),
    linear-gradient(90deg, var(--border-shell) 1px, transparent 1px);
  background-size: 50px 50px;
}
.dark .auth-page::before { opacity: 0.06; }
.auth-page::after {
  content: ''; position: absolute; top: -50%; left: -25%; width: 150%; height: 150%;
  background: radial-gradient(ellipse at 50% 50%, var(--primary-glow) 0%, transparent 60%);
  opacity: 0.15; pointer-events: none; animation: authGlow 12s ease-in-out infinite alternate;
}
@keyframes authGlow {
  0%   { transform: translate(0, 0) scale(1); }
  100% { transform: translate(5%, -5%) scale(1.1); }
}
.auth-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-xl); padding: 32px; width: 100%; max-width: 420px;
  box-shadow: var(--shadow-xl); position: relative; z-index: 1;
}
.auth-logo {
  display: flex; flex-direction: column; align-items: center;
  text-align: center; margin-bottom: 28px;
}
.auth-logo .logo-icon {
  width: 56px; height: 56px;
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  border-radius: var(--radius-xl); display: flex; align-items: center; justify-content: center;
  margin-bottom: 16px; box-shadow: 0 0 16px rgba(160,1,1,0.45);
}
.auth-logo .logo-icon svg { color: #fff; width: 28px; height: 28px; }
.auth-logo-title { font-size: 20px; font-weight: 700; color: var(--text-primary); }
.auth-title { font-size: 24px; font-weight: 700; margin-bottom: 8px; text-align: center; }
.auth-sub { font-size: 14px; color: var(--text-muted); margin-bottom: 28px; text-align: center; line-height: 1.5; }
.alert-error {
  background: var(--bg-secondary); border: 1px solid var(--danger); color: var(--danger);
  border-radius: var(--radius-lg); padding: 12px 16px; font-size: 13px; margin-bottom: 20px;
}

/* ─── Dashboard Grid ─────────────────────────────────── */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 24px;
}

/* ─── Responsive ─────────────────────────────────────── */
@media (max-width: 1024px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0 !important; }
  .sidebar-toggle { display: none; }
  .dashboard-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .page-content { padding: 16px; }
  .header { padding: 0 16px; }
  .stat-cards { grid-template-columns: 1fr; }
  .page-header { flex-direction: column; }
  .auth-card { padding: 24px; }
  .avatar-name { display: none; }
}

/* ─── Utilities ──────────────────────────────────────── */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.w-full { width: 100%; }
.hidden { display: none !important; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.animate-in { animation: fadeIn 300ms ease-out; }

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