/* ── Variables ──────────────────────────────────────────────────────────────── */
:root {
  --sidebar-w: 240px;
  --sidebar-bg: #0f172a;
  --sidebar-hover: #1e293b;
  --sidebar-active: #2563eb;
  --topbar-h: 60px;
  --accent: #2563eb;
  --accent-light: #dbeafe;
  --orange: #f97316;
  --body-bg: #f1f5f9;
}

/* ── Reset ──────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--body-bg); font-family: 'Segoe UI', system-ui, sans-serif; font-size: .9375rem; color: #1e293b; }

/* ── Sidebar ────────────────────────────────────────────────────────────────── */
#sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  z-index: 1000;
  transition: transform .25s ease;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 18px 16px;
  color: #fff;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: .3px;
}
.brand-icon { font-size: 1.4rem; }

.sidebar-divider { border-color: #1e293b; margin: 4px 16px; }

.sidebar-section-label {
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: 1.2px;
  color: #64748b;
  padding: 8px 18px 4px;
  margin: 0;
  text-transform: uppercase;
}

#sidebar .nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 18px;
  color: #94a3b8;
  border-radius: 8px;
  margin: 2px 10px;
  font-size: .9rem;
  transition: background .15s, color .15s;
  text-decoration: none;
}
#sidebar .nav-link:hover { background: var(--sidebar-hover); color: #e2e8f0; }
#sidebar .nav-link.active { background: var(--sidebar-active); color: #fff; }
#sidebar .nav-link i { font-size: 1.1rem; }

.sidebar-footer {
  margin-top: auto;
  padding: 12px 10px 10px;
  border-top: 1px solid #1e293b;
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px 4px;
}
.sidebar-user-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--sidebar-active);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .9rem;
  flex-shrink: 0;
}
.sidebar-user-name { font-size: .85rem; font-weight: 600; color: #e2e8f0; }
.sidebar-user-role { font-size: .72rem; color: #64748b; text-transform: capitalize; }
.sidebar-logout { color: #ef4444 !important; font-size: .85rem !important; margin-top: 2px !important; }
.sidebar-logout:hover { background: #450a0a !important; color: #fca5a5 !important; }

/* Mobile sidebar */
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 999;
}
.sidebar-overlay.open { display: block; }

/* ── Main ───────────────────────────────────────────────────────────────────── */
#main {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left .25s ease;
}

/* ── Topbar ─────────────────────────────────────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  height: var(--topbar-h);
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 24px;
  z-index: 100;
}
.topbar-toggle { display: none; color: #64748b; background: none; border: none; padding: 4px; }
.topbar-title { font-size: 1.1rem; font-weight: 600; flex: 1; color: #0f172a; margin: 0; }
.topbar-actions { display: flex; gap: 8px; }

/* ── Page content ───────────────────────────────────────────────────────────── */
.page-content { padding: 24px; flex: 1; }

/* ── Cards & Stats ──────────────────────────────────────────────────────────── */
.stat-card {
  background: #fff;
  border-radius: 12px;
  padding: 20px 22px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 4px rgba(0,0,0,.04);
  transition: transform .15s, box-shadow .15s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,.08); }
.stat-number { font-size: 2.2rem; font-weight: 700; line-height: 1; margin-bottom: 4px; }
.stat-label  { font-size: .82rem; color: #64748b; text-transform: uppercase; letter-spacing: .5px; }
.stat-icon   { font-size: 2rem; opacity: .2; }

.stat-primary { border-left: 4px solid var(--accent); }
.stat-success { border-left: 4px solid #16a34a; }
.stat-warning { border-left: 4px solid #f59e0b; }
.stat-danger  { border-left: 4px solid #dc2626; }
.stat-dark    { border-left: 4px solid #334155; }
.stat-orange  { border-left: 4px solid var(--orange); }

/* ── Table ──────────────────────────────────────────────────────────────────── */
.table-card {
  background: #fff;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,.04);
}
.table-card .table { margin: 0; }
.table-card .table th {
  background: #f8fafc;
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: #64748b;
  border-bottom: 2px solid #e2e8f0;
  white-space: nowrap;
}
.table-card .table td { vertical-align: middle; border-color: #f1f5f9; }
.table-card .table tbody tr:hover { background: #f8fafc; }

/* ── Forms ──────────────────────────────────────────────────────────────────── */
.form-card {
  background: #fff;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  padding: 28px;
  box-shadow: 0 1px 4px rgba(0,0,0,.04);
}
.form-section-title {
  font-size: .8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: #64748b;
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 8px;
  margin-bottom: 18px;
  margin-top: 24px;
}
.form-section-title:first-child { margin-top: 0; }

/* ── Filters bar ────────────────────────────────────────────────────────────── */
.filters-bar {
  background: #fff;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  padding: 16px 20px;
  margin-bottom: 20px;
  box-shadow: 0 1px 4px rgba(0,0,0,.04);
}

/* ── Lead detail ────────────────────────────────────────────────────────────── */
.detail-card {
  background: #fff;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 4px rgba(0,0,0,.04);
  overflow: hidden;
}
.detail-header {
  background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 100%);
  color: #fff;
  padding: 22px 28px;
}
.detail-body { padding: 24px 28px; }
.detail-label { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: #94a3b8; margin-bottom: 3px; }
.detail-value { font-size: .95rem; color: #1e293b; margin-bottom: 16px; }

/* ── Acepta buttons ─────────────────────────────────────────────────────────── */
.acepta-btn-group .btn { font-weight: 600; padding: 8px 20px; }
.acepta-btn-group .btn.active-acepta { box-shadow: 0 0 0 3px rgba(22,163,74,.35); }
.acepta-btn-group .btn.active-rechaza { box-shadow: 0 0 0 3px rgba(220,38,38,.35); }

/* ── Login page ─────────────────────────────────────────────────────────────── */
.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 60%, #1d4ed8 100%);
  padding: 20px;
}
.login-card {
  background: #fff;
  border-radius: 20px;
  padding: 44px 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.login-logo { font-size: 2.8rem; text-align: center; margin-bottom: 8px; }
.login-title { font-size: 1.5rem; font-weight: 700; text-align: center; color: #0f172a; margin-bottom: 4px; }
.login-subtitle { font-size: .85rem; text-align: center; color: #64748b; margin-bottom: 28px; }
.login-card .form-control { padding: 11px 14px; border-radius: 10px; border: 1.5px solid #e2e8f0; }
.login-card .form-control:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37,99,235,.15); }
.login-card .btn-primary { border-radius: 10px; padding: 11px; font-weight: 600; }

/* ── Responsive ─────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  #sidebar { transform: translateX(calc(-1 * var(--sidebar-w))); }
  #sidebar.open { transform: translateX(0); }
  #main { margin-left: 0; }
  .topbar-toggle { display: block; }
  .page-content { padding: 16px; }
}
