/* ==========================================================================
   Guiadeo Panel — Design System v2.0
   Estética: Apple (claridad) + Lego/Imanix (modularidad) + Notion (contenido)
   Autor: design-creative agent — 2026-04-24
   Alcance: panel admin Harold (index.html, login.html, office.html,
            score.html, roadmap.html, contrato.html)
   NO afecta: dashboard/cliente/, dashboard/cartera/
   ========================================================================== */

/* ==========================================================================
   FUENTES
   ========================================================================== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Space+Grotesk:wght@500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

/* ==========================================================================
   TOKENS — TEMA OSCURO (default)
   ========================================================================== */
:root {
  /* Color primario — azul Guiadeo */
  --g-blue-50:  #eef7ff;
  --g-blue-100: #d9edff;
  --g-blue-200: #bce0ff;
  --g-blue-300: #8ecdff;
  --g-blue-400: #59b0ff;
  --g-blue-500: #338dff;
  --g-blue-600: #1a6df5;
  --g-blue-700: #1357e1;

  /* Acento Lego: saturado para CTAs y badges activos */
  --g-accent-lime:    #b8f23c;
  --g-accent-orange:  #ff6b35;
  --g-accent-violet:  #8b5cf6;
  --g-accent-green:   #22c55e;
  --g-accent-amber:   #f59e0b;
  --g-accent-rose:    #f43f5e;
  --g-accent-cyan:    #06b6d4;

  /* Superficies — dark mode */
  --g-bg:         #0f1117;
  --g-surface-1:  #161822;
  --g-surface-2:  #1e2130;
  --g-surface-3:  #272b3d;
  --g-surface-4:  #323750;

  /* Bordes */
  --g-border:       rgba(255,255,255,0.07);
  --g-border-hover: rgba(255,255,255,0.14);

  /* Texto */
  --g-text-primary:   #f3f4f6;
  --g-text-secondary: #9ca3af;
  --g-text-muted:     #6b7280;
  --g-text-disabled:  #4b5563;

  /* Tipografía */
  --g-font-display: 'Space Grotesk', system-ui, sans-serif;
  --g-font-body:    'Inter', system-ui, sans-serif;
  --g-font-mono:    'JetBrains Mono', monospace;

  /* Espaciado (múltiplos de 4px) */
  --g-space-1: 0.25rem;   /* 4px */
  --g-space-2: 0.5rem;    /* 8px */
  --g-space-3: 0.75rem;   /* 12px */
  --g-space-4: 1rem;      /* 16px */
  --g-space-5: 1.25rem;   /* 20px */
  --g-space-6: 1.5rem;    /* 24px */
  --g-space-8: 2rem;      /* 32px */
  --g-space-10: 2.5rem;   /* 40px */
  --g-space-12: 3rem;     /* 48px */

  /* Radios */
  --g-radius-sm:  0.375rem;  /* 6px — chips, badges pequeños */
  --g-radius-md:  0.625rem;  /* 10px — botones, inputs */
  --g-radius-lg:  0.875rem;  /* 14px — cards */
  --g-radius-xl:  1.25rem;   /* 20px — modales */
  --g-radius-full: 9999px;   /* píldoras */

  /* Sombras — sutil, Apple-like */
  --g-shadow-sm:  0 1px 2px rgba(0,0,0,0.3), 0 1px 6px rgba(0,0,0,0.2);
  --g-shadow-md:  0 4px 12px rgba(0,0,0,0.4), 0 1px 4px rgba(0,0,0,0.3);
  --g-shadow-lg:  0 12px 32px rgba(0,0,0,0.5), 0 4px 12px rgba(0,0,0,0.3);
  --g-shadow-xl:  0 24px 48px rgba(0,0,0,0.6);

  /* Transiciones */
  --g-transition-fast:   120ms cubic-bezier(0.4,0,0.2,1);
  --g-transition-normal: 200ms cubic-bezier(0.4,0,0.2,1);
  --g-transition-slow:   350ms cubic-bezier(0.4,0,0.2,1);

  /* Compatibilidad backward con variables legacy */
  --primary-400: var(--g-blue-400);
  --primary-500: var(--g-blue-500);
  --primary-600: var(--g-blue-600);
  --surface-900: var(--g-bg);
  --surface-800: var(--g-surface-1);
  --surface-700: var(--g-surface-2);
  --surface-600: var(--g-surface-3);
  --surface-500: var(--g-surface-4);
  --text-primary: var(--g-text-primary);
  --text-secondary: var(--g-text-secondary);
  --scrollbar-track: var(--g-surface-1);
  --scrollbar-thumb: var(--g-surface-4);
}

/* ==========================================================================
   TOKENS — TEMA CLARO
   ========================================================================== */
html.light {
  --g-bg:         #f8fafc;
  --g-surface-1:  #ffffff;
  --g-surface-2:  #f1f5f9;
  --g-surface-3:  #e2e8f0;
  --g-surface-4:  #cbd5e1;

  --g-border:       rgba(0,0,0,0.08);
  --g-border-hover: rgba(0,0,0,0.16);

  --g-text-primary:   #111827;
  --g-text-secondary: #4b5563;
  --g-text-muted:     #6b7280;
  --g-text-disabled:  #9ca3af;

  --g-shadow-sm:  0 1px 2px rgba(0,0,0,0.06), 0 1px 4px rgba(0,0,0,0.04);
  --g-shadow-md:  0 4px 12px rgba(0,0,0,0.08), 0 1px 4px rgba(0,0,0,0.04);
  --g-shadow-lg:  0 12px 32px rgba(0,0,0,0.10), 0 4px 12px rgba(0,0,0,0.05);
  --g-shadow-xl:  0 24px 48px rgba(0,0,0,0.12);

  --surface-900: var(--g-bg);
  --surface-800: var(--g-surface-1);
  --surface-700: var(--g-surface-2);
  --surface-600: var(--g-surface-3);
  --surface-500: var(--g-surface-4);
  --scrollbar-track: var(--g-surface-2);
  --scrollbar-thumb: var(--g-surface-4);
}

html.light body {
  background-color: var(--g-bg);
  color: var(--g-text-primary);
}

/* Overrides legacy clases en modo claro */
html.light .text-gray-100,
html.light .text-gray-200 { color: #1f2937 !important; }
html.light .text-gray-300 { color: #374151 !important; }
html.light .text-gray-400 { color: #4b5563 !important; }
html.light .text-gray-500 { color: #6b7280 !important; }
html.light .border-surface-600 { border-color: var(--g-surface-3) !important; }
html.light .bg-surface-900 { background-color: var(--g-bg) !important; }
html.light .bg-surface-800 { background-color: var(--g-surface-1) !important; }
html.light .bg-surface-700 { background-color: var(--g-surface-2) !important; }

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

body {
  font-family: var(--g-font-body);
  font-size: 0.875rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--g-surface-1); }
::-webkit-scrollbar-thumb { background: var(--g-surface-4); border-radius: 9999px; }
::-webkit-scrollbar-thumb:hover { background: var(--g-blue-500); }

/* ==========================================================================
   TIPOGRAFÍA — jerarquía Apple-like
   ========================================================================== */
.g-display {
  font-family: var(--g-font-display);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.g-title-lg {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--g-text-primary);
  letter-spacing: -0.01em;
}

.g-title-md {
  font-size: 1rem;
  font-weight: 600;
  color: var(--g-text-primary);
  letter-spacing: -0.005em;
}

.g-title-sm {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--g-text-primary);
}

.g-label {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--g-text-muted);
}

.g-mono {
  font-family: var(--g-font-mono);
  font-size: 0.8125rem;
}

/* ==========================================================================
   LAYOUT — Notion-like (contenido como prioridad)
   ========================================================================== */
.g-page {
  background-color: var(--g-bg);
  min-height: 100vh;
}

.g-header {
  background: var(--g-surface-1);
  border-bottom: 1px solid var(--g-border);
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

html.dark .g-header,
:root .g-header {
  background: rgba(22, 24, 34, 0.9);
}

html.light .g-header {
  background: rgba(255,255,255,0.92);
}

/* ==========================================================================
   CARDS — bloques Lego: modulares, bien delimitados
   ========================================================================== */
.g-card {
  background: var(--g-surface-1);
  border: 1px solid var(--g-border);
  border-radius: var(--g-radius-lg);
  padding: var(--g-space-5);
  transition: border-color var(--g-transition-fast),
              box-shadow var(--g-transition-fast);
}

.g-card:hover {
  border-color: var(--g-border-hover);
}

.g-card--interactive {
  cursor: pointer;
}

.g-card--interactive:hover {
  border-color: var(--g-blue-500);
  box-shadow: var(--g-shadow-sm), 0 0 0 1px rgba(51, 141, 255, 0.15);
}

/* Card métrica (dashboard KPIs) */
.g-metric-card {
  background: var(--g-surface-1);
  border: 1px solid var(--g-border);
  border-radius: var(--g-radius-lg);
  padding: var(--g-space-5);
  display: flex;
  flex-direction: column;
  gap: var(--g-space-2);
  position: relative;
  overflow: hidden;
  transition: border-color var(--g-transition-fast);
}

.g-metric-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--g-metric-accent, var(--g-blue-500));
  opacity: 0.6;
}

.g-metric-card:hover {
  border-color: var(--g-border-hover);
}

.g-metric-label {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--g-text-muted);
}

.g-metric-value {
  font-size: 1.75rem;
  font-weight: 700;
  font-family: var(--g-font-display);
  color: var(--g-text-primary);
  letter-spacing: -0.02em;
  line-height: 1;
}

.g-metric-delta {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--g-text-muted);
}

.g-metric-delta--up   { color: var(--g-accent-green); }
.g-metric-delta--down { color: var(--g-accent-rose); }

/* ==========================================================================
   BOTONES
   ========================================================================== */

/* Base compartida */
.g-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--g-space-2);
  font-family: var(--g-font-body);
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1;
  border: none;
  border-radius: var(--g-radius-md);
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--g-transition-fast),
              color var(--g-transition-fast),
              box-shadow var(--g-transition-fast),
              transform var(--g-transition-fast);
  text-decoration: none;
  padding: 0.5rem 0.875rem;
}

.g-btn:active { transform: scale(0.97); }
.g-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

/* Primario — azul saturado, el CTA principal */
.g-btn-primary {
  background: var(--g-blue-500);
  color: #ffffff;
}
.g-btn-primary:hover {
  background: var(--g-blue-600);
  box-shadow: 0 0 0 3px rgba(51, 141, 255, 0.25);
}

/* Secundario — outline neutro */
.g-btn-secondary {
  background: var(--g-surface-2);
  color: var(--g-text-secondary);
  border: 1px solid var(--g-border);
}
.g-btn-secondary:hover {
  background: var(--g-surface-3);
  color: var(--g-text-primary);
  border-color: var(--g-border-hover);
}

/* Ghost — sin fondo visible */
.g-btn-ghost {
  background: transparent;
  color: var(--g-text-muted);
}
.g-btn-ghost:hover {
  background: var(--g-surface-2);
  color: var(--g-text-primary);
}

/* Danger */
.g-btn-danger {
  background: rgba(244, 63, 94, 0.12);
  color: #f87171;
  border: 1px solid rgba(244, 63, 94, 0.2);
}
.g-btn-danger:hover {
  background: rgba(244, 63, 94, 0.2);
  color: #fb7185;
}

/* Success */
.g-btn-success {
  background: rgba(34, 197, 94, 0.12);
  color: #4ade80;
  border: 1px solid rgba(34, 197, 94, 0.2);
}
.g-btn-success:hover {
  background: rgba(34, 197, 94, 0.2);
  color: #4ade80;
}

/* Tamaños */
.g-btn-sm { padding: 0.3125rem 0.625rem; font-size: 0.75rem; border-radius: var(--g-radius-sm); }
.g-btn-lg { padding: 0.75rem 1.25rem; font-size: 0.9375rem; border-radius: var(--g-radius-lg); }
.g-btn-icon { padding: 0.5rem; width: 2.25rem; height: 2.25rem; }
.g-btn-icon.g-btn-sm { width: 1.875rem; height: 1.875rem; padding: 0.3125rem; }

/* ==========================================================================
   BADGES / CHIPS — Lego: colores saturados, bien legibles
   ========================================================================== */
.g-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 0.1875rem 0.5rem;
  border-radius: var(--g-radius-full);
  white-space: nowrap;
  letter-spacing: 0.01em;
}

/* Semánticos */
.g-badge--blue    { background: rgba(51,141,255,0.15); color: #59b0ff; }
.g-badge--green   { background: rgba(34,197,94,0.15);  color: #4ade80; }
.g-badge--amber   { background: rgba(245,158,11,0.15); color: #fbbf24; }
.g-badge--red     { background: rgba(244,63,94,0.15);  color: #f87171; }
.g-badge--violet  { background: rgba(139,92,246,0.15); color: #a78bfa; }
.g-badge--gray    { background: rgba(107,114,128,0.15); color: #9ca3af; }
.g-badge--cyan    { background: rgba(6,182,212,0.15);  color: #22d3ee; }
.g-badge--orange  { background: rgba(255,107,53,0.15); color: #fb923c; }
.g-badge--lime    { background: rgba(184,242,60,0.15); color: #a3e635; }

/* Modo claro: mismo hue, más oscuro */
html.light .g-badge--blue   { background: rgba(26,109,245,0.10); color: #1a6df5; }
html.light .g-badge--green  { background: rgba(22,163,74,0.10);  color: #16a34a; }
html.light .g-badge--amber  { background: rgba(217,119,6,0.10);  color: #d97706; }
html.light .g-badge--red    { background: rgba(220,38,38,0.10);  color: #dc2626; }
html.light .g-badge--violet { background: rgba(124,58,237,0.10); color: #7c3aed; }
html.light .g-badge--gray   { background: rgba(75,85,99,0.10);   color: #4b5563; }

/* Dot indicador */
.g-badge__dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

/* Badge contador (notification) */
.g-counter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  font-size: 10px;
  font-weight: 700;
  border-radius: var(--g-radius-full);
  padding: 0 4px;
  background: var(--g-accent-rose);
  color: #fff;
}

/* ==========================================================================
   TABLAS — Notion-like: limpia, zebra suave, hover, sticky header
   ========================================================================== */
.g-table-wrap {
  background: var(--g-surface-1);
  border: 1px solid var(--g-border);
  border-radius: var(--g-radius-lg);
  overflow: hidden;
}

.g-table {
  width: 100%;
  font-size: 0.8125rem;
  border-collapse: collapse;
}

.g-table thead {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--g-surface-2);
}

.g-table thead th {
  padding: 0.625rem var(--g-space-4);
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--g-text-muted);
  white-space: nowrap;
  border-bottom: 1px solid var(--g-border);
  text-align: left;
}

.g-table thead th:last-child { text-align: center; }

.g-table tbody tr {
  border-bottom: 1px solid var(--g-border);
  transition: background var(--g-transition-fast);
}

/* Zebra suave */
.g-table tbody tr:nth-child(even) {
  background: rgba(255,255,255,0.018);
}

html.light .g-table tbody tr:nth-child(even) {
  background: rgba(0,0,0,0.018);
}

.g-table tbody tr:last-child { border-bottom: none; }

.g-table tbody tr:hover {
  background: rgba(51, 141, 255, 0.06);
}

.g-table tbody td {
  padding: 0.625rem var(--g-space-4);
  color: var(--g-text-primary);
  vertical-align: middle;
}

/* Columna de acciones: siempre centrada, con botones inline */
.g-table .g-table-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--g-space-1);
}

/* ==========================================================================
   INPUTS Y FORMULARIOS
   ========================================================================== */
.g-input {
  background: var(--g-surface-2);
  border: 1px solid var(--g-border);
  border-radius: var(--g-radius-md);
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  font-family: var(--g-font-body);
  color: var(--g-text-primary);
  width: 100%;
  transition: border-color var(--g-transition-fast),
              box-shadow var(--g-transition-fast);
  outline: none;
}

.g-input::placeholder { color: var(--g-text-disabled); }

.g-input:focus {
  border-color: var(--g-blue-500);
  box-shadow: 0 0 0 3px rgba(51, 141, 255, 0.18);
}

.g-input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.g-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.5rem center;
  background-size: 1.25rem;
  padding-right: 2.25rem;
}

.g-label-text {
  display: block;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--g-text-muted);
  margin-bottom: 0.375rem;
}

/* ==========================================================================
   TABS — navegación limpia Notion
   ========================================================================== */
.g-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--g-border);
  overflow-x: auto;
  scrollbar-width: none;
}
.g-tabs::-webkit-scrollbar { display: none; }

.g-tab {
  padding: 0.625rem 1.125rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--g-text-muted);
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  cursor: pointer;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
  transition: color var(--g-transition-fast),
              border-color var(--g-transition-fast);
  margin-bottom: -1px;
}

.g-tab:hover { color: var(--g-text-primary); }

.g-tab.active {
  color: var(--g-blue-400);
  border-bottom-color: var(--g-blue-400);
  font-weight: 600;
}

html.light .g-tab.active {
  color: var(--g-blue-600);
  border-bottom-color: var(--g-blue-600);
}

/* Nav group (nivel 1 del panel) */
.g-nav-group {
  padding: 0.625rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--g-text-muted);
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  cursor: pointer;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
  transition: color var(--g-transition-fast),
              border-color var(--g-transition-fast);
  margin-bottom: -1px;
}

.g-nav-group:hover { color: var(--g-text-primary); }

.g-nav-group.active {
  color: var(--g-text-primary);
  border-bottom-color: var(--g-blue-400);
}

/* ==========================================================================
   SIDEBAR — limpio, iconos consistentes
   ========================================================================== */
.g-sidebar {
  position: fixed;
  top: 0;
  width: 15rem;
  height: 100vh;
  background: var(--g-surface-1);
  border-right: 1px solid var(--g-border);
  display: flex;
  flex-direction: column;
  z-index: 40;
  overflow-y: auto;
  padding-top: 3.5rem;
}

.g-sidebar-item {
  display: flex;
  align-items: center;
  gap: var(--g-space-3);
  padding: 0.625rem var(--g-space-4);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--g-text-muted);
  cursor: pointer;
  border-left: 2px solid transparent;
  transition: color var(--g-transition-fast),
              background var(--g-transition-fast),
              border-color var(--g-transition-fast);
  text-decoration: none;
  background: none;
  border-top: none;
  border-right: none;
  border-bottom: none;
  width: 100%;
}

.g-sidebar-item:hover {
  color: var(--g-text-primary);
  background: rgba(255,255,255,0.04);
}

.g-sidebar-item.active {
  color: var(--g-blue-400);
  background: rgba(51, 141, 255, 0.08);
  border-left-color: var(--g-blue-400);
}

/* ==========================================================================
   MODALES Y DRAWERS
   ========================================================================== */
.g-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 50;
}

.g-modal {
  background: var(--g-surface-1);
  border: 1px solid var(--g-border);
  border-radius: var(--g-radius-xl);
  box-shadow: var(--g-shadow-xl);
  overflow: hidden;
}

.g-modal-header {
  padding: var(--g-space-4) var(--g-space-6);
  border-bottom: 1px solid var(--g-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  background: var(--g-surface-1);
  z-index: 1;
}

.g-modal-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--g-text-primary);
  letter-spacing: -0.005em;
}

.g-modal-close {
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--g-radius-sm);
  color: var(--g-text-muted);
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.25rem;
  transition: color var(--g-transition-fast),
              background var(--g-transition-fast);
}

.g-modal-close:hover {
  color: var(--g-text-primary);
  background: var(--g-surface-2);
}

.g-modal-body {
  padding: var(--g-space-6);
}

.g-drawer {
  position: fixed;
  right: 0;
  top: 0;
  height: 100vh;
  width: 24rem;
  background: var(--g-surface-1);
  border-left: 1px solid var(--g-border);
  box-shadow: var(--g-shadow-lg);
  overflow-y: auto;
  z-index: 50;
  display: flex;
  flex-direction: column;
}

/* ==========================================================================
   ALERTAS / TOASTS — esquina inferior derecha
   ========================================================================== */
#g-toast-container {
  position: fixed;
  bottom: var(--g-space-6);
  right: var(--g-space-6);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: var(--g-space-2);
  pointer-events: none;
}

.g-toast {
  display: flex;
  align-items: flex-start;
  gap: var(--g-space-3);
  padding: var(--g-space-3) var(--g-space-4);
  border-radius: var(--g-radius-lg);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--g-text-primary);
  background: var(--g-surface-2);
  border: 1px solid var(--g-border);
  box-shadow: var(--g-shadow-md);
  pointer-events: all;
  max-width: 22rem;
  animation: g-toast-in 0.25s cubic-bezier(0.34,1.56,0.64,1) forwards;
}

.g-toast.g-toast--out {
  animation: g-toast-out 0.2s ease-in forwards;
}

.g-toast--success { border-left: 3px solid var(--g-accent-green); }
.g-toast--error   { border-left: 3px solid var(--g-accent-rose); }
.g-toast--warn    { border-left: 3px solid var(--g-accent-amber); }
.g-toast--info    { border-left: 3px solid var(--g-blue-400); }

.g-toast-icon { flex-shrink: 0; font-size: 1rem; line-height: 1.3; }
.g-toast-content { flex: 1; }
.g-toast-title { font-weight: 600; color: var(--g-text-primary); }
.g-toast-msg   { color: var(--g-text-secondary); margin-top: 1px; }

@keyframes g-toast-in {
  from { opacity: 0; transform: translateX(100%) scale(0.9); }
  to   { opacity: 1; transform: translateX(0) scale(1); }
}
@keyframes g-toast-out {
  from { opacity: 1; transform: translateX(0) scale(1); max-height: 200px; }
  to   { opacity: 0; transform: translateX(100%) scale(0.9); max-height: 0; padding: 0; margin: 0; }
}

/* Alertas inline */
.g-alert {
  display: flex;
  align-items: flex-start;
  gap: var(--g-space-3);
  padding: var(--g-space-3) var(--g-space-4);
  border-radius: var(--g-radius-md);
  font-size: 0.8125rem;
  border-left-width: 3px;
  border-left-style: solid;
}
.g-alert--info    { background: rgba(51,141,255,0.08);  border-color: var(--g-blue-400);    color: var(--g-blue-300); }
.g-alert--success { background: rgba(34,197,94,0.08);   border-color: var(--g-accent-green); color: #4ade80; }
.g-alert--warn    { background: rgba(245,158,11,0.08);  border-color: var(--g-accent-amber); color: #fbbf24; }
.g-alert--error   { background: rgba(244,63,94,0.08);   border-color: var(--g-accent-rose);  color: #f87171; }

html.light .g-alert--info    { color: var(--g-blue-600); }
html.light .g-alert--success { color: #16a34a; }
html.light .g-alert--warn    { color: #d97706; }
html.light .g-alert--error   { color: #dc2626; }

/* ==========================================================================
   EMPTY STATES — ilustración mínima + CTA
   ========================================================================== */
.g-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--g-space-12) var(--g-space-8);
  gap: var(--g-space-3);
  text-align: center;
}

.g-empty-icon {
  font-size: 2.5rem;
  opacity: 0.35;
  line-height: 1;
}

.g-empty-title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--g-text-secondary);
}

.g-empty-desc {
  font-size: 0.8125rem;
  color: var(--g-text-muted);
  max-width: 22rem;
  line-height: 1.5;
}

/* ==========================================================================
   LOADING SKELETONS
   ========================================================================== */
@keyframes g-shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.g-skeleton {
  background: linear-gradient(
    90deg,
    var(--g-surface-2) 25%,
    var(--g-surface-3) 50%,
    var(--g-surface-2) 75%
  );
  background-size: 200% 100%;
  animation: g-shimmer 1.6s ease-in-out infinite;
  border-radius: var(--g-radius-sm);
  color: transparent !important;
  user-select: none;
}

html.light .g-skeleton {
  background: linear-gradient(
    90deg,
    #e8ecf0 25%,
    #d1d9e0 50%,
    #e8ecf0 75%
  );
  background-size: 200% 100%;
}

/* Skeleton legacy — mantiene compatibilidad */
.skeleton {
  animation: g-shimmer 1.6s ease-in-out infinite;
  background: linear-gradient(
    90deg,
    var(--g-surface-2) 25%,
    var(--g-surface-3) 50%,
    var(--g-surface-2) 75%
  );
  background-size: 200% 100%;
}

/* Bloques de skeleton para rows de tabla */
.g-skeleton-row {
  display: flex;
  gap: var(--g-space-3);
  align-items: center;
  padding: 0.625rem var(--g-space-4);
  border-bottom: 1px solid var(--g-border);
}
.g-skeleton-cell {
  height: 0.875rem;
  border-radius: var(--g-radius-sm);
}
.g-skeleton-avatar {
  width: 2rem;
  height: 2rem;
  border-radius: var(--g-radius-full);
  flex-shrink: 0;
}

/* ==========================================================================
   CONFIRM DIALOG — uniforme en todo el panel
   ========================================================================== */
.g-confirm-dialog {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--g-space-4);
}

.g-confirm-box {
  background: var(--g-surface-1);
  border: 1px solid var(--g-border);
  border-radius: var(--g-radius-xl);
  box-shadow: var(--g-shadow-xl);
  padding: var(--g-space-6);
  max-width: 22rem;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: var(--g-space-4);
}

.g-confirm-icon {
  font-size: 2rem;
  text-align: center;
}

.g-confirm-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--g-text-primary);
  text-align: center;
}

.g-confirm-desc {
  font-size: 0.8125rem;
  color: var(--g-text-secondary);
  text-align: center;
  line-height: 1.5;
}

.g-confirm-actions {
  display: flex;
  gap: var(--g-space-2);
}

.g-confirm-actions .g-btn { flex: 1; justify-content: center; }

/* ==========================================================================
   KANBAN BOARD
   ========================================================================== */
.g-kanban {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--g-space-4);
}

@media (max-width: 768px) { .g-kanban { grid-template-columns: 1fr; } }

.g-kanban-col {
  background: var(--g-surface-1);
  border: 1px solid var(--g-border);
  border-radius: var(--g-radius-lg);
  display: flex;
  flex-direction: column;
  min-height: 12rem;
}

.g-kanban-header {
  padding: 0.75rem var(--g-space-4);
  font-size: 0.8125rem;
  font-weight: 600;
  border-bottom: 1px solid var(--g-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--g-text-primary);
}

.g-kanban-cards {
  padding: var(--g-space-2);
  display: flex;
  flex-direction: column;
  gap: var(--g-space-2);
  flex: 1;
}

.g-kanban-card {
  background: var(--g-surface-2);
  border: 1px solid var(--g-border);
  border-radius: var(--g-radius-md);
  padding: 0.625rem 0.75rem;
  border-left: 3px solid transparent;
  transition: border-color var(--g-transition-fast),
              box-shadow var(--g-transition-fast);
}

.g-kanban-card:hover { box-shadow: var(--g-shadow-sm); }
.g-kanban-card--done     { border-left-color: var(--g-accent-green); }
.g-kanban-card--progress { border-left-color: var(--g-accent-amber); }
.g-kanban-card--high     { border-left-color: var(--g-accent-rose); }
.g-kanban-card--medium   { border-left-color: var(--g-text-disabled); }

/* ==========================================================================
   PROGRESS BARS
   ========================================================================== */
.g-progress-bg {
  height: 0.375rem;
  background: var(--g-surface-3);
  border-radius: var(--g-radius-full);
  overflow: hidden;
}

.g-progress-fill {
  height: 100%;
  border-radius: var(--g-radius-full);
  background: var(--g-blue-500);
  transition: width 0.5s ease;
}

.g-progress-fill--green  { background: var(--g-accent-green); }
.g-progress-fill--amber  { background: var(--g-accent-amber); }
.g-progress-fill--rose   { background: var(--g-accent-rose); }
.g-progress-fill--violet { background: var(--g-accent-violet); }

/* ==========================================================================
   TOGGLE SWITCH
   ========================================================================== */
.g-toggle { position: relative; width: 2.5rem; height: 1.375rem; flex-shrink: 0; }
.g-toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
.g-toggle-track {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--g-surface-4);
  border-radius: var(--g-radius-full);
  transition: background var(--g-transition-normal);
}
.g-toggle-track::before {
  content: '';
  position: absolute;
  width: 1rem;
  height: 1rem;
  left: 3px;
  bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform var(--g-transition-normal);
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
.g-toggle input:checked + .g-toggle-track { background: var(--g-accent-green); }
.g-toggle input:checked + .g-toggle-track::before { transform: translateX(1.125rem); }
.g-toggle input:disabled + .g-toggle-track { opacity: 0.4; cursor: not-allowed; }

/* ==========================================================================
   HEALTH BAR — status del sistema
   ========================================================================== */
.g-health-bar {
  background: var(--g-surface-1);
  border-bottom: 1px solid var(--g-border);
  padding: 0.4rem var(--g-space-4);
  font-size: 0.75rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--g-space-4);
  color: var(--g-text-muted);
}

.g-health-item {
  display: flex;
  align-items: center;
  gap: var(--g-space-1);
}

.g-health-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--g-text-disabled);
}
.g-health-dot--ok     { background: var(--g-accent-green); }
.g-health-dot--warn   { background: var(--g-accent-amber); }
.g-health-dot--error  { background: var(--g-accent-rose); }

/* ==========================================================================
   AUTOCOMPLETE
   ========================================================================== */
.g-autocomplete { position: relative; }

.g-autocomplete-dropdown {
  position: absolute;
  top: calc(100% + 2px);
  left: 0;
  right: 0;
  z-index: 60;
  max-height: 15rem;
  overflow-y: auto;
  background: var(--g-surface-2);
  border: 1px solid var(--g-border);
  border-radius: var(--g-radius-md);
  box-shadow: var(--g-shadow-md);
  display: none;
}

.g-autocomplete-dropdown.visible { display: block; }

.g-autocomplete-item {
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  border-bottom: 1px solid var(--g-border);
  transition: background var(--g-transition-fast);
}
.g-autocomplete-item:last-child { border-bottom: none; }
.g-autocomplete-item:hover,
.g-autocomplete-item.active { background: var(--g-surface-3); }
.g-autocomplete-name   { font-size: 0.875rem; color: var(--g-text-primary); }
.g-autocomplete-detail { font-size: 0.75rem; color: var(--g-text-muted); margin-top: 1px; }

/* ==========================================================================
   PLAN DISTRIBUTION BARS
   ========================================================================== */
.g-plan-row {
  display: flex;
  align-items: center;
  gap: var(--g-space-3);
  margin-bottom: var(--g-space-2);
}
.g-plan-name {
  flex-shrink: 0;
  width: 40%;
  font-size: 0.8125rem;
  color: var(--g-text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ==========================================================================
   ANIMACIONES — sutiles, funcionales
   ========================================================================== */
@keyframes pulse-dim {
  0%, 100% { opacity: 0.4; }
  50%       { opacity: 0.7; }
}

@keyframes pulse-badge {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.6; }
}

@keyframes dot-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}

@keyframes fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes slide-in-right {
  from { opacity: 0; transform: translateX(1rem); }
  to   { opacity: 1; transform: translateX(0); }
}

.g-fade-in       { animation: fade-in 0.25s ease-out forwards; }
.g-slide-in-right { animation: slide-in-right 0.3s ease-out forwards; }
.g-dot-pulse     { animation: dot-pulse 2s ease-in-out infinite; }

/* Section fade (legacy compat) */
.section-fade { transition: opacity 0.2s ease; }

/* ==========================================================================
   LEAD STATUS BADGES — colores semánticos Lego
   ========================================================================== */
.lead-status {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.1875rem 0.5rem;
  border-radius: var(--g-radius-full);
  font-size: 0.6875rem;
  font-weight: 600;
}
.lead-status.new        { background: rgba(51,130,246,0.15);  color: #60a5fa; }
.lead-status.contacted  { background: rgba(234,179,8,0.15);   color: #facc15; }
.lead-status.responded  { background: rgba(34,197,94,0.15);   color: #4ade80; }
.lead-status.converted  { background: rgba(168,85,247,0.15);  color: #c084fc; }
.lead-status.rejected   { background: rgba(244,63,94,0.15);   color: #f87171; }

/* ==========================================================================
   STATUS BADGE (instancias WA, jobs, etc.)
   ========================================================================== */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.25rem 0.625rem;
  border-radius: var(--g-radius-full);
  font-size: 0.75rem;
  font-weight: 600;
}
.status-badge.connected   { background: rgba(34,197,94,0.15);  color: #4ade80; }
.status-badge.disconnected { background: rgba(244,63,94,0.15); color: #f87171; }
.status-badge.running     { background: rgba(34,197,94,0.15);  color: #4ade80; }
.status-badge.loading     { background: rgba(156,163,175,0.1); color: #9ca3af; }

html.light .status-badge.connected   { color: #16a34a; }
html.light .status-badge.disconnected { color: #dc2626; }

/* ==========================================================================
   BADGE LED (notification counter en nav)
   ========================================================================== */
.badge-led {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  background: var(--g-accent-rose);
  border-radius: var(--g-radius-full);
  padding: 0 4px;
  margin-left: var(--g-space-2);
  animation: pulse-badge 2.5s ease-in-out infinite;
}

/* ==========================================================================
   PREFERENCES PANEL
   ========================================================================== */
#prefs-panel {
  box-shadow: var(--g-shadow-lg);
}
html.light #prefs-panel {
  background: var(--g-surface-1);
  border-color: var(--g-surface-3);
}
#prefs-panel input[type="radio"],
#prefs-panel input[type="checkbox"],
html.light #prefs-panel input[type="radio"],
html.light #prefs-panel input[type="checkbox"] {
  accent-color: var(--g-blue-500);
}
html.light #prefs-panel select,
html.light #prefs-panel input[type="text"] {
  background-color: #ffffff;
  border-color: var(--g-surface-3);
  color: var(--g-text-primary);
}
html.light #prefs-panel h2,
html.light #prefs-panel h3 { color: var(--g-text-primary); }
html.light #prefs-panel label span { color: var(--g-text-secondary); }
html.light #prefs-overlay { background: rgba(0,0,0,0.35); }

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */
@media (max-width: 640px) {
  .g-metric-value { font-size: 1.4rem; }
  .g-drawer { width: 100%; border-left: none; border-top: 1px solid var(--g-border); }
}

/* ==========================================================================
   UTILITY — clases de acceso rápido
   ========================================================================== */
.g-text-primary   { color: var(--g-text-primary); }
.g-text-secondary { color: var(--g-text-secondary); }
.g-text-muted     { color: var(--g-text-muted); }
.g-surface-1      { background: var(--g-surface-1); }
.g-surface-2      { background: var(--g-surface-2); }
.g-border-default { border-color: var(--g-border); }
.g-divider        { border-top: 1px solid var(--g-border); }
