/* =========================================
   ALPES CRM — Estilos Globais
   Identidade Visual: Azul Royal Alpes
   Logo: azul elétrico glossy #0e55cc → #1b6fe8
   ========================================= */

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

:root {
  /* ── Cores Alpes (extraídas do logo) ── */
  --alpes-blue-deep:   #06235F;   /* azul escuro contorno */
  --alpes-blue:        #0E55CC;   /* azul principal */
  --alpes-blue-mid:    #1B6FE8;   /* azul médio brilhante */
  --alpes-blue-light:  #3B89FF;   /* azul highlight */
  --alpes-blue-bright: #5BA0FF;   /* azul mais claro */
  --alpes-white:       #F7F2EA;   /* branco-creme outline */

  /* Alias de compatibilidade — dourado para valores monetários */
  --alpes-accent:        #B45309;
  --alpes-accent-light:  #D97706;

  /* Gradiente do logo */
  --alpes-gradient: linear-gradient(160deg, #3B89FF 0%, #1B6FE8 35%, #0E55CC 70%, #06235F 100%);
  --alpes-gradient-btn: linear-gradient(135deg, #1B6FE8 0%, #0E55CC 100%);
  --alpes-gradient-hover: linear-gradient(135deg, #3B89FF 0%, #1B6FE8 100%);

  /* Superfícies */
  --surface-0:  #FFFFFF;
  --surface-1:  #F0F4FB;   /* levíssimo azulado Alpes */
  --surface-2:  #DDE6F5;
  --surface-3:  #C2D3EE;

  /* Texto */
  --text-primary:   #0A1628;   /* quase preto com tom azul */
  --text-secondary: #2C4A7A;
  --text-muted:     #6E88B0;

  /* Status */
  --color-success:  #16A34A;
  --color-warning:  #D97706;
  --color-danger:   #DC2626;
  --color-info:     #0284C7;

  /* Layout */
  --sidebar-width:  252px;
  --header-height:  64px;
  --radius-sm:      7px;
  --radius-md:      12px;
  --radius-lg:      18px;
  --shadow-sm:      0 1px 4px rgba(14,85,204,0.08);
  --shadow-md:      0 4px 20px rgba(14,85,204,0.13);
  --shadow-lg:      0 8px 40px rgba(14,85,204,0.18);
  --shadow-blue:    0 4px 20px rgba(27,111,232,0.35);

  --transition: 0.22s ease;
}

/* ====== RESET & BASE ====== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; scroll-behavior: smooth; }
body {
  font-family: 'Inter', 'Segoe UI', Arial, sans-serif;
  background: var(--surface-1);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
}
a { text-decoration: none; color: inherit; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; }

/* ====== SIDEBAR ====== */
.sidebar {
  width: var(--sidebar-width);
  min-height: 100vh;
  background: var(--alpes-blue-deep);
  background: linear-gradient(180deg, #06235F 0%, #071A44 100%);
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0; top: 0; bottom: 0;
  z-index: 100;
  transition: transform var(--transition);
  border-right: 1px solid rgba(59,137,255,0.15);
}

/* ── Logo area ── */
.sidebar-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 18px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  background: rgba(0,0,0,0.18);
}

.sidebar-logo .logo-img {
  height: 48px;
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 2px 8px rgba(27,111,232,0.5));
  transition: filter var(--transition);
}
.sidebar-logo .logo-img:hover {
  filter: drop-shadow(0 3px 14px rgba(91,160,255,0.7));
}

.sidebar-logo .logo-crm-tag {
  margin-left: 10px;
  background: rgba(27,111,232,0.25);
  border: 1px solid rgba(91,160,255,0.3);
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--alpes-blue-bright);
  white-space: nowrap;
  align-self: flex-end;
  margin-bottom: 4px;
}

/* ── Nav ── */
.sidebar-nav {
  flex: 1;
  padding: 14px 0;
  overflow-y: auto;
}

.sidebar-section {
  padding: 0 10px 4px;
  margin-top: 10px;
}

.sidebar-section-label {
  font-size: 0.63rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(91,160,255,0.55);
  padding: 4px 10px 6px;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,0.65);
  font-size: 0.86rem;
  font-weight: 500;
  transition: all var(--transition);
  margin-bottom: 1px;
}
.sidebar-nav a i {
  width: 18px;
  text-align: center;
  font-size: 0.88rem;
  flex-shrink: 0;
  opacity: 0.8;
}
.sidebar-nav a:hover {
  background: rgba(27,111,232,0.18);
  color: #FFFFFF;
}
.sidebar-nav a:hover i { opacity: 1; }

.sidebar-nav a.active {
  background: var(--alpes-gradient-btn);
  color: #FFFFFF;
  font-weight: 600;
  box-shadow: 0 2px 12px rgba(27,111,232,0.4);
}
.sidebar-nav a.active i { opacity: 1; }

.sidebar-nav a .badge {
  margin-left: auto;
  background: rgba(255,255,255,0.15);
  color: #fff;
  font-size: 0.64rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 100px;
}

/* ── Sidebar footer ── */
.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid rgba(255,255,255,0.07);
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(0,0,0,0.12);
}

.user-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--alpes-gradient-btn);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(27,111,232,0.4);
}
.user-info { flex: 1; min-width: 0; }
.user-name {
  font-size: 0.8rem;
  font-weight: 600;
  color: white;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.user-role {
  font-size: 0.67rem;
  color: rgba(91,160,255,0.65);
}

/* ====== LAYOUT PRINCIPAL ====== */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ====== TOPBAR ====== */
.topbar {
  height: var(--header-height);
  background: var(--surface-0);
  border-bottom: 2px solid var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 2px 12px rgba(14,85,204,0.07);
}

/* Linha azul decorativa no topo */
.topbar::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--alpes-gradient);
}

.topbar-left { display: flex; align-items: center; gap: 14px; }
.topbar-title {
  font-size: 1.08rem;
  font-weight: 800;
  color: var(--alpes-blue-deep);
  letter-spacing: -0.01em;
}
.topbar-subtitle { font-size: 0.78rem; color: var(--text-muted); }

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

.topbar-search {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface-1);
  border: 1.5px solid var(--surface-2);
  border-radius: var(--radius-md);
  padding: 7px 13px;
  min-width: 230px;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.topbar-search:focus-within {
  border-color: var(--alpes-blue-light);
  box-shadow: 0 0 0 3px rgba(27,111,232,0.12);
}
.topbar-search input {
  border: none; background: none; outline: none;
  font-size: 0.84rem; color: var(--text-primary); width: 100%;
}
.topbar-search input::placeholder { color: var(--text-muted); }
.topbar-search i { color: var(--text-muted); font-size: 0.82rem; }

/* Notificações */
.notif-btn {
  position: relative;
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 1.5px solid var(--surface-2);
  background: var(--surface-0);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary);
  font-size: 0.92rem;
  transition: all var(--transition);
}
.notif-btn:hover {
  background: var(--surface-1);
  border-color: var(--alpes-blue-light);
  color: var(--alpes-blue);
  box-shadow: 0 2px 8px rgba(14,85,204,0.12);
}
.notif-btn .notif-dot {
  position: absolute;
  top: 5px; right: 5px;
  width: 9px; height: 9px;
  background: var(--color-danger);
  border-radius: 50%;
  border: 2px solid white;
}

/* ====== PAGE CONTENT ====== */
.page-content { flex: 1; padding: 28px; }

/* ====== KPI CARDS ====== */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.kpi-card {
  background: var(--surface-0);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  border: 1.5px solid var(--surface-2);
  display: flex;
  align-items: center;
  gap: 16px;
  transition: box-shadow var(--transition), transform var(--transition), border-color var(--transition);
  position: relative;
  overflow: hidden;
}
.kpi-card::after {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 4px; height: 100%;
  background: var(--alpes-gradient-btn);
  opacity: 0;
  transition: opacity var(--transition);
}
.kpi-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  border-color: var(--surface-3);
}
.kpi-card:hover::after { opacity: 1; }

.kpi-icon {
  width: 50px; height: 50px;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
}
.kpi-icon.blue   { background: linear-gradient(135deg,#EBF2FF,#D5E5FF); color: var(--alpes-blue); }
.kpi-icon.bright { background: linear-gradient(135deg,#DDEEFF,#C0D9FF); color: var(--alpes-blue-mid); }
.kpi-icon.green  { background: linear-gradient(135deg,#DCFCE7,#BBF7D0); color: var(--color-success); }
.kpi-icon.orange { background: linear-gradient(135deg,#FEF3C7,#FDE68A); color: var(--color-warning); }
.kpi-icon.red    { background: linear-gradient(135deg,#FEE2E2,#FECACA); color: var(--color-danger); }
.kpi-icon.gold   { background: linear-gradient(135deg,#FEF9E7,#FDE68A); color: #B45309; }

.kpi-data { flex: 1; min-width: 0; }
.kpi-value {
  font-size: 1.55rem;
  font-weight: 800;
  color: var(--alpes-blue-deep);
  line-height: 1.15;
  letter-spacing: -0.02em;
}
.kpi-label { font-size: 0.76rem; color: var(--text-muted); margin-top: 3px; font-weight: 500; }
.kpi-delta {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 0.7rem; font-weight: 700;
  margin-top: 5px; padding: 2px 7px;
  border-radius: 100px;
}
.kpi-delta.up   { background: #DCFCE7; color: var(--color-success); }
.kpi-delta.down { background: #FEE2E2; color: var(--color-danger); }

/* ====== CARDS / PANELS ====== */
.card {
  background: var(--surface-0);
  border-radius: var(--radius-md);
  border: 1.5px solid var(--surface-2);
  box-shadow: var(--shadow-sm);
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1.5px solid var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--alpes-blue-deep);
  display: flex;
  align-items: center;
  gap: 7px;
}

.card-body { padding: 20px; }

/* ====== BOTÕES ====== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 17px;
  border-radius: var(--radius-sm);
  font-size: 0.83rem;
  font-weight: 600;
  border: none;
  transition: all var(--transition);
  white-space: nowrap;
  letter-spacing: 0.01em;
}

.btn-primary {
  background: var(--alpes-gradient-btn);
  color: white;
  box-shadow: 0 2px 10px rgba(14,85,204,0.3);
}
.btn-primary:hover {
  background: var(--alpes-gradient-hover);
  box-shadow: var(--shadow-blue);
  transform: translateY(-1px);
}

.btn-accent {
  background: linear-gradient(135deg,#2563EB,#1D4ED8);
  color: white;
}
.btn-accent:hover {
  background: linear-gradient(135deg,#3B82F6,#2563EB);
  box-shadow: 0 3px 12px rgba(37,99,235,0.4);
}

.btn-outline {
  background: transparent;
  border: 1.5px solid var(--surface-3);
  color: var(--text-secondary);
}
.btn-outline:hover {
  border-color: var(--alpes-blue-light);
  color: var(--alpes-blue);
  background: rgba(14,85,204,0.05);
}

.btn-danger {
  background: var(--color-danger);
  color: white;
}
.btn-danger:hover { opacity: 0.88; }

.btn-sm { padding: 5px 12px; font-size: 0.77rem; border-radius: 6px; }
.btn-lg { padding: 11px 24px; font-size: 0.94rem; }
.btn-icon { padding: 7px; border-radius: var(--radius-sm); }

/* ====== TABELAS ====== */
.table-wrap { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; font-size: 0.84rem; }

table thead th {
  background: var(--surface-1);
  color: var(--text-secondary);
  font-weight: 700;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  padding: 10px 14px;
  text-align: left;
  border-bottom: 2px solid var(--surface-2);
  white-space: nowrap;
}

table tbody tr {
  border-bottom: 1px solid var(--surface-1);
  transition: background var(--transition);
}
table tbody tr:hover { background: #F0F5FF; }
table tbody td { padding: 10px 14px; color: var(--text-primary); vertical-align: middle; }

/* ====== BADGES / STATUS ====== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 100px;
  font-size: 0.71rem;
  font-weight: 700;
  white-space: nowrap;
}

.badge-blue    { background: rgba(14,85,204,0.10);  color: var(--alpes-blue); border: 1px solid rgba(14,85,204,0.15); }
.badge-bright  { background: rgba(27,111,232,0.10); color: var(--alpes-blue-mid); }
.badge-gold    { background: rgba(180,83,9,0.10);   color: #92400E; border: 1px solid rgba(180,83,9,0.15); }
.badge-green   { background: rgba(22,163,74,0.10);  color: #14532D; border: 1px solid rgba(22,163,74,0.15); }
.badge-orange  { background: rgba(217,119,6,0.10);  color: #78350F; border: 1px solid rgba(217,119,6,0.15); }
.badge-red     { background: rgba(220,38,38,0.10);  color: #7F1D1D; border: 1px solid rgba(220,38,38,0.15); }
.badge-gray    { background: rgba(100,116,139,0.10); color: #334155; border: 1px solid rgba(100,116,139,0.15); }
.badge-purple  { background: rgba(124,58,237,0.10); color: #4C1D95; border: 1px solid rgba(124,58,237,0.15); }

/* ====== FORMULÁRIOS ====== */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group.full { grid-column: 1 / -1; }

.form-label {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--text-secondary);
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.form-control {
  padding: 8px 12px;
  border: 1.5px solid var(--surface-3);
  border-radius: var(--radius-sm);
  font-size: 0.84rem;
  color: var(--text-primary);
  background: var(--surface-0);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
  width: 100%;
}
.form-control:focus {
  border-color: var(--alpes-blue-light);
  box-shadow: 0 0 0 3px rgba(14,85,204,0.12);
}
textarea.form-control { resize: vertical; min-height: 80px; }

/* ====== MODAL ====== */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(6,35,95,0.45);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  opacity: 0; visibility: hidden;
  transition: all var(--transition);
}
.modal-overlay.open { opacity: 1; visibility: visible; }

.modal {
  background: var(--surface-0);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 60px rgba(6,35,95,0.25);
  width: 100%; max-width: 640px;
  max-height: 90vh; overflow-y: auto;
  transform: translateY(20px) scale(0.98);
  transition: transform var(--transition);
  border: 1.5px solid var(--surface-2);
}
.modal-overlay.open .modal { transform: translateY(0) scale(1); }

.modal-header {
  padding: 20px 24px 16px;
  border-bottom: 1.5px solid var(--surface-2);
  display: flex; align-items: center; justify-content: space-between;
  background: linear-gradient(135deg, #F0F4FB, #FFFFFF);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.modal-title {
  font-size: 1rem;
  font-weight: 800;
  color: var(--alpes-blue-deep);
  display: flex; align-items: center; gap: 8px;
}

.modal-close {
  background: none; border: none;
  font-size: 1rem; color: var(--text-muted);
  width: 30px; height: 30px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
}
.modal-close:hover { background: var(--surface-1); color: var(--alpes-blue); }

.modal-body { padding: 20px 24px; }
.modal-footer {
  padding: 14px 24px 20px;
  border-top: 1.5px solid var(--surface-2);
  display: flex; justify-content: flex-end; gap: 10px;
}

/* ====== KANBAN ====== */
.kanban-board {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 20px;
  min-height: 60vh;
}

.kanban-col {
  flex-shrink: 0; width: 245px;
  background: var(--surface-1);
  border-radius: var(--radius-md);
  border: 1.5px solid var(--surface-2);
  display: flex; flex-direction: column;
  max-height: calc(100vh - 200px);
}

.kanban-col-header {
  padding: 12px 14px;
  border-bottom: 1.5px solid var(--surface-2);
  display: flex; align-items: center; justify-content: space-between;
}

.kanban-col-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--alpes-blue-deep);
  display: flex; align-items: center; gap: 7px;
}
.kanban-col-title::before {
  content: '';
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--col-color, var(--alpes-blue));
  flex-shrink: 0;
}

.kanban-col-count {
  font-size: 0.7rem; font-weight: 700;
  background: var(--surface-2);
  color: var(--text-secondary);
  padding: 2px 8px;
  border-radius: 100px;
}

.kanban-cards {
  flex: 1; overflow-y: auto;
  padding: 10px;
  display: flex; flex-direction: column; gap: 8px;
}

.kanban-card {
  background: var(--surface-0);
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--surface-2);
  padding: 12px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: box-shadow var(--transition), transform var(--transition), border-color var(--transition);
}
.kanban-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  border-color: var(--alpes-blue-light);
}

.kanban-card-title { font-size: 0.83rem; font-weight: 600; color: var(--text-primary); margin-bottom: 6px; line-height: 1.35; }
.kanban-card-value { font-size: 0.82rem; font-weight: 800; color: var(--alpes-blue); margin-bottom: 6px; }
.kanban-card-meta { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.kanban-card-tag { font-size: 0.67rem; color: var(--text-muted); display: flex; align-items: center; gap: 3px; }

.kanban-col-total {
  font-size: 0.72rem; color: var(--text-muted);
  padding: 5px 12px; text-align: right;
  border-top: 1px solid var(--surface-2);
  background: var(--surface-1);
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  font-weight: 600;
}

/* ====== PROGRESS BAR ====== */
.progress-bar {
  height: 6px; background: var(--surface-2);
  border-radius: 100px; overflow: hidden;
}
.progress-fill {
  height: 100%; border-radius: 100px;
  background: var(--alpes-gradient-btn);
  transition: width 0.4s ease;
}
.progress-fill.green  { background: linear-gradient(90deg,#16A34A,#22C55E); }
.progress-fill.gold   { background: linear-gradient(90deg,#D97706,#F59E0B); }
.progress-fill.orange { background: linear-gradient(90deg,#D97706,#F59E0B); }
.progress-fill.red    { background: linear-gradient(90deg,#DC2626,#EF4444); }

/* ====== TIMELINE ====== */
.timeline { display: flex; flex-direction: column; gap: 0; }
.timeline-item {
  display: flex; gap: 14px;
  padding-bottom: 20px;
  position: relative;
}
.timeline-item:not(:last-child)::before {
  content: '';
  position: absolute;
  left: 18px; top: 38px; bottom: 0;
  width: 2px;
  background: var(--surface-2);
}
.timeline-icon {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.85rem;
  flex-shrink: 0; z-index: 1;
}
.timeline-body {
  flex: 1;
  background: var(--surface-0);
  border: 1.5px solid var(--surface-2);
  border-radius: var(--radius-md);
  padding: 12px 16px;
}
.timeline-header {
  display: flex; justify-content: space-between;
  align-items: flex-start; gap: 10px; margin-bottom: 6px;
}
.timeline-title { font-size: 0.88rem; font-weight: 700; color: var(--alpes-blue-deep); }
.timeline-date  { font-size: 0.72rem; color: var(--text-muted); white-space: nowrap; }
.timeline-text  { font-size: 0.82rem; color: var(--text-secondary); }

/* ====== ALERTAS ====== */
.alert-banner {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 13px 18px;
  border-radius: var(--radius-md);
  border-left: 4px solid;
  margin-bottom: 10px;
  font-size: 0.83rem;
}
.alert-banner.warning { background: rgba(217,119,6,0.07); border-color: var(--color-warning); }
.alert-banner.danger  { background: rgba(220,38,38,0.07); border-color: var(--color-danger); }
.alert-banner.success { background: rgba(22,163,74,0.07);  border-color: var(--color-success); }
.alert-banner.info    { background: rgba(2,132,199,0.07);  border-color: var(--color-info); }
.alert-banner.warning i { color: var(--color-warning); }
.alert-banner.danger  i { color: var(--color-danger); }
.alert-banner.success i { color: var(--color-success); }
.alert-banner.info    i { color: var(--color-info); }

/* ====== TOGGLE ====== */
.toggle {
  width: 40px; height: 22px;
  background: var(--surface-3);
  border-radius: 100px; position: relative;
  cursor: pointer; transition: background var(--transition); border: none;
}
.toggle::after {
  content: '';
  position: absolute;
  top: 3px; left: 3px;
  width: 16px; height: 16px;
  background: white; border-radius: 50%;
  transition: transform var(--transition);
  box-shadow: var(--shadow-sm);
}
.toggle.on { background: var(--alpes-blue); }
.toggle.on::after { transform: translateX(18px); }

/* ====== FILTROS ====== */
.filter-bar {
  display: flex; align-items: center;
  flex-wrap: wrap; gap: 10px;
  margin-bottom: 20px;
}
.filter-bar select,
.filter-bar input {
  padding: 7px 12px;
  border: 1.5px solid var(--surface-3);
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  color: var(--text-primary);
  background: var(--surface-0);
  outline: none; min-width: 140px;
  transition: border-color var(--transition);
}
.filter-bar select:focus,
.filter-bar input:focus { border-color: var(--alpes-blue-light); }

/* ====== EMPTY STATE ====== */
.empty-state {
  text-align: center; padding: 48px 24px;
  color: var(--text-muted);
}
.empty-state i { font-size: 2.2rem; margin-bottom: 12px; display: block; color: var(--surface-3); }
.empty-state p { font-size: 0.86rem; }

/* ====== GRIDS & UTILS ====== */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 16px; }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }

.gap-12 { gap: 12px; }
.gap-20 { gap: 20px; }
.mb-12  { margin-bottom: 12px; }
.mb-20  { margin-bottom: 20px; }
.mb-28  { margin-bottom: 28px; }
.mt-20  { margin-top: 20px; }

.flex         { display: flex; }
.flex-center  { display: flex; align-items: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-wrap    { flex-wrap: wrap; }
.flex-1       { flex: 1; }
.text-right   { text-align: right; }
.fw-700       { font-weight: 700; }
.fw-800       { font-weight: 800; }
.text-muted   { color: var(--text-muted); font-size: 0.8rem; }
.text-sm      { font-size: 0.8rem; }
.text-blue    { color: var(--alpes-blue); }
.text-danger  { color: var(--color-danger); }

/* ====== SCROLLBAR ====== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--surface-1); }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 100px; }
::-webkit-scrollbar-thumb:hover { background: var(--alpes-blue-light); }

/* ====== ANIMAÇÕES ====== */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fade-in { animation: fadeIn 0.32s ease forwards; }

@keyframes spin { to { transform: rotate(360deg); } }
.spinning { animation: spin 0.7s linear infinite; }

@keyframes skeleton-loading {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.skeleton {
  background: linear-gradient(90deg, var(--surface-1) 25%, var(--surface-2) 50%, var(--surface-1) 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.4s infinite;
  border-radius: var(--radius-sm);
}

/* ====== TOAST ====== */
#toast-container {
  position: fixed; bottom: 24px; right: 24px;
  z-index: 9999;
  display: flex; flex-direction: column; gap: 10px;
}
.toast {
  background: var(--alpes-blue-deep);
  color: white;
  padding: 12px 18px;
  border-radius: var(--radius-md);
  font-size: 0.83rem;
  box-shadow: var(--shadow-lg);
  display: flex; align-items: center; gap: 10px;
  min-width: 270px;
  animation: fadeIn 0.3s ease;
  border-left: 4px solid var(--alpes-blue-light);
}
.toast.success { border-color: var(--color-success); }
.toast.warning { border-color: var(--color-warning); }
.toast.error   { border-color: var(--color-danger); }

/* ====== RESPONSIVO ====== */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .page-content { padding: 16px; }
  #sidebar-toggle { display: flex !important; }
  .topbar-logo-m { display: block !important; }
  /* Overlay escuro ao abrir sidebar mobile */
  .sidebar-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(6,35,95,0.45);
    z-index: 99;
  }
  .sidebar-overlay.visible { display: block; }
}
@media (max-width: 560px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .topbar { padding: 0 14px; }
  .topbar-search { display: none; }
  .topbar-title { font-size: 0.95rem; }
}

/* ====== HERO ALPES — linha decorativa azul no topo ====== */
.alpes-stripe {
  height: 4px;
  background: var(--alpes-gradient);
  width: 100%;
}
