:root {
  --brand-1: #4f46e5;
  --brand-2: #6366f1;
  --brand-dark: #1e1b4b;
  --sidebar-w: 260px;
}

body {
  background-color: #f4f5fb;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
}

/* Sidebar */
.admin-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-w);
  background: linear-gradient(180deg, var(--brand-dark) 0%, #312e81 100%);
  color: #e5e7eb;
  z-index: 1030;
  display: flex;
  flex-direction: column;
}

.admin-sidebar .brand {
  padding: 1.25rem 1.5rem;
  font-weight: 700;
  font-size: 1.15rem;
  color: #fff;
  display: flex;
  align-items: center;
  gap: .6rem;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}

.admin-sidebar .nav-link {
  color: #c7d2fe;
  padding: .65rem 1.5rem;
  border-radius: 0;
  display: flex;
  align-items: center;
  gap: .75rem;
  font-size: .93rem;
  font-weight: 500;
  transition: background-color .15s ease, color .15s ease;
}

.admin-sidebar .nav-link i {
  font-size: 1.05rem;
  width: 1.25rem;
  text-align: center;
}

.admin-sidebar .nav-link:hover {
  background-color: rgba(255, 255, 255, .06);
  color: #fff;
}

.admin-sidebar .nav-link.active {
  background-color: rgba(255, 255, 255, .12);
  color: #fff;
  border-right: 3px solid #a5b4fc;
}

/* Main area */
.admin-main {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.admin-topbar {
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
  padding: .85rem 1.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 1020;
}

.admin-content {
  padding: 1.75rem;
  flex: 1;
}

.avatar-circle {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-1), #a855f7);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: .9rem;
}

.card {
  border: none;
  border-radius: .9rem;
  box-shadow: 0 1px 3px rgba(15, 23, 42, .06), 0 1px 2px rgba(15, 23, 42, .04);
}

.stat-card {
  border-radius: 1rem;
  color: #fff;
  padding: 1.5rem;
  background: linear-gradient(135deg, var(--brand-1), #7c3aed);
  box-shadow: 0 8px 20px -6px rgba(79, 70, 229, .45);
}

.stat-card.stat-green { background: linear-gradient(135deg, #059669, #10b981); box-shadow: 0 8px 20px -6px rgba(5, 150, 105, .45); }
.stat-card.stat-amber { background: linear-gradient(135deg, #d97706, #f59e0b); box-shadow: 0 8px 20px -6px rgba(217, 119, 6, .45); }

.stat-card .stat-value { font-size: 2rem; font-weight: 700; }
.stat-card .stat-label { opacity: .9; font-size: .85rem; }

.btn-brand {
  background: linear-gradient(135deg, var(--brand-1), var(--brand-2));
  border: none;
  color: #fff;
}
.btn-brand:hover { color: #fff; filter: brightness(1.07); }

.table thead th {
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .03em;
  color: #6b7280;
  border-bottom-width: 1px;
}

.badge-estado-activo { background-color: #dcfce7; color: #166534; }
.badge-estado-inactivo { background-color: #fee2e2; color: #991b1b; }

.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at top left, #4f46e5, #1e1b4b 60%);
}

.login-card {
  border-radius: 1.1rem;
  overflow: hidden;
  max-width: 420px;
  width: 100%;
}

.dia-row.dia-inactivo {
  opacity: .55;
}

/* KPI tiles (status palette) */
.kpi-tile {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.1rem 1.25rem;
  border-radius: .9rem;
  background: #fff;
  box-shadow: 0 1px 3px rgba(15, 23, 42, .06), 0 1px 2px rgba(15, 23, 42, .04);
  border-left: 4px solid transparent;
}

.kpi-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
}

.kpi-value { font-size: 1.6rem; font-weight: 700; line-height: 1; color: #0b0b0b; }
.kpi-label { font-size: .8rem; color: #52514e; margin-top: .2rem; }

.kpi-good { border-left-color: #0ca30c; }
.kpi-good .kpi-icon { background: #e7f8e7; color: #0ca30c; }

.kpi-critical { border-left-color: #d03b3b; }
.kpi-critical .kpi-icon { background: #fbe9e9; color: #d03b3b; }

.kpi-muted { border-left-color: #898781; }
.kpi-muted .kpi-icon { background: #f0efec; color: #52514e; }

/* Bar chart (marcaciones por dia) */
.chart-dias-wrap { position: relative; }
.chart-dias { width: 100%; }
.chart-svg { display: block; overflow: visible; }
.chart-bar { fill: #2a78d6; pointer-events: none; }
.chart-hit { fill: transparent; cursor: pointer; }
.chart-hit:hover + .chart-bar,
.chart-hit:focus + .chart-bar { fill: #1c5cab; }
.chart-grid { stroke: #e1e0d9; stroke-width: 1; }
.chart-tick { fill: #898781; font-size: 9px; text-anchor: middle; }

.chart-tooltip {
  position: absolute;
  transform: translate(-50%, -100%);
  background: #1e1b4b;
  color: #fff;
  border-radius: .5rem;
  padding: .4rem .65rem;
  font-size: .78rem;
  pointer-events: none;
  white-space: nowrap;
  box-shadow: 0 6px 16px rgba(0, 0, 0, .25);
  z-index: 10;
}
.chart-tooltip-valor { font-weight: 700; }
.chart-tooltip-fecha { color: #c7d2fe; text-transform: capitalize; }

@media (max-width: 991.98px) {
  .admin-sidebar { transform: translateX(-100%); transition: transform .2s ease; }
  .admin-sidebar.show { transform: translateX(0); }
  .admin-main { margin-left: 0; }
}
