:root {
  --primary: #4f46e5;
  --primary-2: #6d28d9;
  --sidebar-bg: #101426;
  --sidebar-hover: rgba(255, 255, 255, 0.06);
  --bg: #f1f3f9;
  --card: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --border: #e5e7eb;
  --success: #16a34a;
  --warning: #d97706;
  --danger: #dc2626;
  --info: #0284c7;
  --radius: 16px;
  --shadow: 0 10px 30px -12px rgba(17, 24, 39, 0.18);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 0.925rem;
}

a { text-decoration: none; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 258px;
  background: var(--sidebar-bg);
  color: #cbd5e1;
  display: flex;
  flex-direction: column;
  z-index: 1040;
  transition: transform .25s ease;
}

.sidebar-brand {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 22px 20px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.brand-logo {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  box-shadow: 0 6px 18px -6px rgba(79, 70, 229, 0.8);
  flex-shrink: 0;
}

.brand-title { font-weight: 700; color: #f1f5f9; font-size: .95rem; line-height: 1.1; }
.brand-sub { font-size: .72rem; color: #94a3b8; }

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 14px 12px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: 12px;
  color: #cbd5e1;
  font-weight: 500;
  font-size: .88rem;
  margin-bottom: 4px;
  transition: background .15s ease, color .15s ease;
}

.nav-item i { font-size: 1.05rem; width: 22px; text-align: center; }
.nav-item:hover { background: var(--sidebar-hover); color: #fff; }
.nav-item.activo {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff;
  box-shadow: 0 8px 20px -8px rgba(79, 70, 229, 0.9);
}
.nav-item.salir:hover { background: rgba(220, 38, 38, .25); color: #fecaca; }
.sidebar-foot { padding: 12px; border-top: 1px solid rgba(255, 255, 255, .08); }

.principal {
  margin-left: 258px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 1020;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 28px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.btn-menu { display: none; border: none; background: transparent; font-size: 1.5rem; line-height: 1; }

.topbar-titulo { font-size: 1.15rem; font-weight: 700; margin: 0; flex: 1; }
.topbar-fecha { color: var(--muted); font-size: .8rem; }

.usuario-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 999px;
  padding: 6px 14px 6px 6px;
  cursor: pointer;
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 700;
  font-size: .8rem;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
}

.rol-tag {
  font-size: .68rem;
  color: var(--primary);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.contenido {
  flex: 1;
  padding: 26px 28px 40px;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
}

.pie {
  text-align: center;
  color: var(--muted);
  font-size: .78rem;
  padding: 18px;
  border-top: 1px solid var(--border);
}

.tarjeta, .card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.card-header-titulos { font-size: .95rem; font-weight: 700; margin: 0; }

.stat-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
  height: 100%;
}

.stat-icono {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  font-size: 1.35rem;
  color: #fff;
  flex-shrink: 0;
}

.g-indigo  { background: linear-gradient(135deg, #4f46e5, #7c3aed); }
.g-verde   { background: linear-gradient(135deg, #059669, #10b981); }
.g-azul    { background: linear-gradient(135deg, #0284c7, #38bdf8); }
.g-naranja { background: linear-gradient(135deg, #d97706, #f59e0b); }
.g-rojo    { background: linear-gradient(135deg, #dc2626, #f87171); }

.stat-dato { font-size: 1.55rem; font-weight: 800; line-height: 1.05; }
.stat-etiqueta { color: var(--muted); font-size: .78rem; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.stat-pie { font-size: .75rem; color: var(--muted); }

.chart-box { position: relative; height: 300px; }

.badge-soft-success { background: #dcfce7; color: #15803d; }
.badge-soft-danger  { background: #fee2e2; color: #b91c1c; }
.badge-soft-warning { background: #fef3c7; color: #b45309; }
.badge-soft-primary { background: #e0e7ff; color: #4338ca; }
.badge-soft-info    { background: #e0f2fe; color: #0369a1; }
.badge-soft-secondary { background: #f3f4f6; color: #4b5563; }

.progress { height: 8px; border-radius: 99px; background: #eef1f6; }
.progress-thin { height: 6px; }

.tabla-panel thead th {
  background: #f8fafc;
  color: var(--muted);
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  border-bottom: 1px solid var(--border) !important;
  white-space: nowrap;
}

.tabla-panel td { vertical-align: middle; }

.lista-iconos { list-style: none; margin: 0; padding: 0; }
.lista-iconos li {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px dashed var(--border);
}
.lista-iconos li:last-child { border-bottom: none; }

.icono-burbuja {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 1.05rem;
  flex-shrink: 0;
}

.estado-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 6px;
}

.vacio {
  text-align: center;
  color: var(--muted);
  padding: 34px 10px;
}
.vacio i { font-size: 2rem; opacity: .5; display: block; margin-bottom: 8px; }

.filtros-barra {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: end;
}

.asis-radio { display: flex; flex-wrap: wrap; gap: 6px; }
.form-check-input:checked[type="radio"] { background-color: var(--primary); border-color: var(--primary); }

.login-cuerpo {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
  background:
    radial-gradient(1000px 500px at 85% -10%, rgba(109, 40, 217, .35), transparent 60%),
    radial-gradient(800px 500px at -10% 110%, rgba(2, 132, 199, .30), transparent 60%),
    #0f1226;
}

.login-tarjeta {
  width: 100%;
  max-width: 420px;
  background: rgba(255, 255, 255, 0.97);
  border-radius: 22px;
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .6);
  padding: 42px 38px 34px;
}

.login-logo {
  width: 68px;
  height: 68px;
  border-radius: 20px;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 1.3rem;
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  margin: 0 auto 16px;
  box-shadow: 0 14px 30px -10px rgba(79, 70, 229, .8);
}

.demo-caja {
  background: #eef2ff;
  border: 1px dashed #c7d2fe;
  border-radius: 12px;
  font-size: .78rem;
  padding: 10px 14px;
  color: #3730a3;
}

.boletin-doc { background: #fff; padding: 34px; border: 1px solid var(--border); border-radius: var(--radius); }
.boletin-head { display: flex; justify-content: space-between; gap: 16px; border-bottom: 3px double #111827; padding-bottom: 14px; margin-bottom: 20px; }
.boletin-tabla th, .boletin-tabla td { font-size: .82rem; }

.backdrop-menu {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .45);
  z-index: 1035;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease;
}

.modal .form-label { font-size: .8rem; font-weight: 600; color: var(--muted); }

@media (max-width: 991.98px) {
  .btn-menu { display: block; }
  .principal { margin-left: 0; }
  .sidebar { transform: translateX(-100%); box-shadow: none; }
  body.menu-abierto .sidebar { transform: translateX(0); box-shadow: 0 0 60px rgba(0,0,0,.35); }
  body.menu-abierto .backdrop-menu { opacity: 1; pointer-events: auto; }
  .contenido { padding: 18px 14px 30px; }
  .topbar { padding: 12px 16px; }
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #cdd5e0; border-radius: 99px; border: 2px solid var(--bg); }
.sidebar::-webkit-scrollbar-thumb { background: #334155; border-color: var(--sidebar-bg); }

@media print {
  .sidebar, .topbar, .pie, .no-print, .backdrop-menu { display: none !important; }
  .principal { margin-left: 0 !important; }
  body { background: #fff; }
  .contenido { padding: 0 !important; max-width: 100%; }
  .boletin-doc { border: none; padding: 0; border-radius: 0; }
  .tarjeta { box-shadow: none !important; border: none !important; }
}
