/* =========================================================
   CRM — Estilos globales
   Paleta corporativa azul · Inter · Modo claro/oscuro
   ========================================================= */

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

:root {
  --brand-50:  #eff6ff;
  --brand-100: #dbeafe;
  --brand-200: #bfdbfe;
  --brand-300: #93c5fd;
  --brand-400: #60a5fa;
  --brand-500: #3b82f6;
  --brand-600: #2563eb;
  --brand-700: #1d4ed8;
  --brand-800: #1e40af;
  --brand-900: #1e3a8a;

  --success: #10b981;
  --warning: #f59e0b;
  --danger:  #ef4444;
  --info:    #0ea5e9;

  --bg:        #f8fafc;
  --bg-alt:    #f1f5f9;
  --surface:   #ffffff;
  --border:    #e2e8f0;
  --border-2:  #cbd5e1;
  --text:      #0f172a;
  --text-soft: #475569;
  --text-mute: #94a3b8;

  --shadow-sm: 0 1px 2px 0 rgb(15 23 42 / 0.05);
  --shadow:    0 1px 3px 0 rgb(15 23 42 / 0.08), 0 1px 2px -1px rgb(15 23 42 / 0.06);
  --shadow-md: 0 4px 6px -1px rgb(15 23 42 / 0.08), 0 2px 4px -2px rgb(15 23 42 / 0.06);
  --shadow-lg: 0 10px 15px -3px rgb(15 23 42 / 0.10), 0 4px 6px -4px rgb(15 23 42 / 0.08);
  --shadow-xl: 0 20px 25px -5px rgb(15 23 42 / 0.12), 0 8px 10px -6px rgb(15 23 42 / 0.08);

  --r-sm: 6px;
  --r:    10px;
  --r-md: 14px;
  --r-lg: 18px;
  --r-xl: 24px;
  --r-full: 9999px;

  --sidebar-w: 260px;
  --topbar-h:  64px;

  --t-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --t:      250ms cubic-bezier(0.4, 0, 0.2, 1);
  --t-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
  --bg:        #0b1220;
  --bg-alt:    #0f172a;
  --surface:   #111c33;
  --border:    #1e293b;
  --border-2:  #334155;
  --text:      #f1f5f9;
  --text-soft: #cbd5e1;
  --text-mute: #64748b;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.4);
  --shadow:    0 1px 3px 0 rgb(0 0 0 / 0.5);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.5);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.5);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.6);
}

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

html, body {
  margin: 0;
  padding: 0;
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background var(--t), color var(--t);
}

a { color: var(--brand-600); text-decoration: none; transition: color var(--t-fast); }
a:hover { color: var(--brand-700); }

h1, h2, h3, h4, h5 { color: var(--text); font-weight: 700; letter-spacing: -0.02em; margin: 0 0 .5rem; }
h1 { font-size: 1.85rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.2rem; }

p { color: var(--text-soft); margin: 0 0 1rem; }

/* Layout con sidebar */
.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

.app-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.app-content {
  flex: 1;
  padding: 28px 32px 48px;
  max-width: 100%;
}

.topbar {
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 30;
  backdrop-filter: saturate(180%) blur(8px);
}

.topbar-title { font-size: 1rem; font-weight: 600; color: var(--text); }
.topbar-actions { display: flex; align-items: center; gap: 12px; }

@media (max-width: 1024px) {
  .app-shell { grid-template-columns: 1fr; }
  .app-content { padding: 20px 16px 40px; }
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--border-2);
  border-radius: var(--r-full);
  border: 2px solid var(--bg);
}
::-webkit-scrollbar-thumb:hover { background: var(--text-mute); }

.grid-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.stack-sm > * + * { margin-top: 8px; }
.stack    > * + * { margin-top: 16px; }
.stack-lg > * + * { margin-top: 24px; }

.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-mute   { color: var(--text-mute); font-size: .875rem; }
.text-soft   { color: var(--text-soft); }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fade-in { animation: fadeIn var(--t) both; }

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

@keyframes pulse-soft {
  0%, 100% { opacity: 1; }
  50%      { opacity: .55; }
}
.pulse { animation: pulse-soft 1.6s ease-in-out infinite; }