/* ============================================================================
   ALK FICHAJE — SISTEMA DE DISEÑO v4 (rediseño completo)
   Un solo archivo para todo el site: admin, empleado, login, PWA.
   Mobile-first. Tokens + componentes + vistas específicas.
   ============================================================================ */

/* ── 1. TOKENS ─────────────────────────────────────────────────────────────── */
:root {
  /* Superficies */
  --canvas:      #f2f5fa;
  --canvas-2:    #e9eefa;
  --surface:     #ffffff;
  --surface-2:   #f8fafc;
  --surface-3:   #f1f5f9;

  /* Texto */
  --ink:         #0f172a;
  --ink-2:       #334155;
  --ink-3:       #64748b;
  --ink-4:       #94a3b8;

  /* Marca */
  --brand:       #4f46e5;
  --brand-600:   #4338ca;
  --brand-700:   #3730a3;
  --brand-50:    #eef2ff;
  --brand-100:   #e0e7ff;

  /* Semánticos */
  --ok:          #15803d;
  --ok-bg:       #ecfdf5;
  --ok-line:     #bbf7d0;
  --warn:        #b45309;
  --warn-bg:     #fffbeb;
  --warn-line:   #fde68a;
  --bad:         #b91c1c;
  --bad-bg:      #fef2f2;
  --bad-line:    #fecaca;
  --info:        #1d4ed8;
  --info-bg:     #eff6ff;
  --info-line:   #bfdbfe;

  /* Líneas y sombras */
  --line:        #e4e9f2;
  --line-2:      #d5ddea;
  --shadow-xs:   0 1px 2px rgba(15, 23, 42, .05);
  --shadow-sm:   0 1px 3px rgba(15, 23, 42, .08), 0 1px 2px rgba(15, 23, 42, .04);
  --shadow-md:   0 6px 16px -4px rgba(15, 23, 42, .12), 0 2px 6px -2px rgba(15, 23, 42, .06);
  --shadow-lg:   0 18px 40px -12px rgba(15, 23, 42, .22), 0 6px 14px -6px rgba(15, 23, 42, .10);
  --ring:        0 0 0 3px rgba(79, 70, 229, .18);

  /* Radios */
  --r-xs: 6px;
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 20px;
  --r-2xl: 26px;
  --r-pill: 999px;

  /* Layout */
  --sidebar-w: 264px;
  --topbar-h: 68px;
  --content-max: 1320px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);

  /* Sidebar */
  --sb-bg: linear-gradient(185deg, #141c32 0%, #1b2440 100%);
  --sb-ink: #cbd5e1;
  --sb-ink-2: #8fa0bd;
  --sb-active: rgba(99, 102, 241, .22);

  /* Alias heredados (compatibilidad con estilos inline antiguos) */
  --navy: var(--ink);
  --navy-light: var(--ink-2);
  --gold: #b45309;
  --gold-light: #d97706;
  --cream: var(--canvas);
  --cream-dark: var(--line);
  --text: var(--ink);
  --text-primary: var(--ink);
  --text-secondary: var(--ink-2);
  --text-muted: var(--ink-3);
  --muted: var(--ink-3);
  --success: var(--ok);
  --success-bg: var(--ok-bg);
  --danger: var(--bad);
  --danger-bg: var(--bad-bg);
  --warning: var(--warn);
  --warning-bg: var(--warn-bg);

  --ease: cubic-bezier(.4, 0, .2, 1);
}

/* ── 2. RESET ──────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: var(--canvas);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.55;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

img, svg, video { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4, h5 { line-height: 1.25; font-weight: 700; letter-spacing: -.01em; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.08rem; }
h4 { font-size: .95rem; }
p  { margin: 0; }
ul, ol { list-style: none; }

:focus-visible {
  outline: none;
  box-shadow: var(--ring);
  border-radius: var(--r-sm);
}

::selection { background: var(--brand-100); color: var(--brand-700); }

/* Scrollbars discretas */
* { scrollbar-width: thin; scrollbar-color: #c6d0e0 transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: #c6d0e0;
  border: 3px solid transparent;
  background-clip: content-box;
  border-radius: var(--r-pill);
}
::-webkit-scrollbar-thumb:hover { background: #a9b7cd; background-clip: content-box; }

/* ── 3. LAYOUT ─────────────────────────────────────────────────────────────── */
.app-shell { display: block; min-height: 100dvh; }

.main {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  min-width: 0;
  background: var(--canvas);
}

.content {
  flex: 1;
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 1rem 1rem calc(5.5rem + var(--safe-bottom));
}

@media (min-width: 640px) {
  .content { padding: 1.25rem 1.5rem calc(5.5rem + var(--safe-bottom)); }
}

@media (min-width: 1024px) {
  .main { margin-left: var(--sidebar-w); }
  .content { padding: 1.5rem 2rem 2.5rem; }
}

/* ── 4. SIDEBAR ────────────────────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  background: var(--sb-bg);
  z-index: 200;
  overflow-y: auto;
  overscroll-behavior: contain;
  transition: transform .32s var(--ease);
  box-shadow: 1px 0 0 rgba(255, 255, 255, .04);
}

.sidebar-brand {
  padding: calc(1.35rem + var(--safe-top)) 1.25rem 1.15rem;
  border-bottom: 1px solid rgba(255, 255, 255, .07);
  flex-shrink: 0;
}

.sidebar-brand h1 {
  font-size: 1.12rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -.02em;
  display: flex;
  align-items: center;
  gap: .5rem;
}

.sidebar-brand h1 span { color: #a5b4fc; }

.sidebar-brand small {
  display: block;
  margin-top: .3rem;
  font-size: .66rem;
  font-weight: 600;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--sb-ink-2);
}

.sidebar-nav {
  flex: 1;
  padding: .6rem .7rem 1rem;
  overflow-y: auto;
}

.nav-section {
  display: block;
  padding: 1rem .75rem .4rem;
  font-size: .64rem;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--sb-ink-2);
}

.nav-section:first-child { padding-top: .5rem; }

.nav-item {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .62rem .75rem;
  margin-bottom: .15rem;
  min-height: 42px;
  border-radius: var(--r-md);
  color: var(--sb-ink);
  font-size: .875rem;
  font-weight: 500;
  transition: background .18s var(--ease), color .18s var(--ease), transform .18s var(--ease);
}

.nav-item .icon {
  width: 22px;
  font-size: 1.05rem;
  text-align: center;
  flex-shrink: 0;
  filter: saturate(.9);
}

.nav-item:hover {
  background: rgba(255, 255, 255, .07);
  color: #fff;
}

.nav-item.active {
  background: var(--sb-active);
  color: #fff;
  font-weight: 600;
  box-shadow: inset 0 0 0 1px rgba(129, 140, 248, .35);
}

.nav-item.active .icon { filter: none; }

.sidebar-user {
  flex-shrink: 0;
  margin: .5rem .7rem calc(.85rem + var(--safe-bottom));
  padding: .85rem .9rem;
  border-radius: var(--r-lg);
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .07);
}

.sidebar-user-name {
  color: #fff;
  font-size: .85rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-user-role,
.sidebar-user-info {
  font-size: .72rem;
  color: var(--sb-ink-2);
  margin-top: .1rem;
}

.btn-logout {
  width: 100%;
  margin-top: .7rem;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  padding: .5rem .75rem;
  border-radius: var(--r-md);
  border: 1px solid rgba(248, 113, 113, .28);
  background: rgba(248, 113, 113, .12);
  color: #fca5a5;
  font-size: .8rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .18s var(--ease), color .18s var(--ease);
}

.btn-logout:hover { background: rgba(248, 113, 113, .22); color: #fecaca; }

/* Overlay móvil */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .5);
  backdrop-filter: blur(3px);
  z-index: 190;
}

.sidebar-overlay.active { display: block; }

/* ── 5. BARRAS SUPERIORES ──────────────────────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  flex-wrap: wrap;
  min-height: 60px;
  padding: calc(.7rem + var(--safe-top)) 1rem .7rem;
  background: var(--sb-bg);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 95;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .06);
}

.topbar h2 {
  flex: 1;
  min-width: 0;
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-info {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.25;
  font-size: .72rem;
  color: var(--sb-ink-2);
  text-align: right;
}

.topbar-info strong {
  font-size: .95rem;
  font-weight: 700;
  color: #fff;
  font-variant-numeric: tabular-nums;
}

.topbar-time {
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
  font-variant-numeric: tabular-nums;
}

.topbar-date { font-size: .72rem; color: var(--sb-ink-2); text-align: right; }

.topbar-actions {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex: 0 1 auto;
  min-width: 0;
  flex-wrap: nowrap;
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding-bottom: 1px;
}

.topbar-actions::-webkit-scrollbar { display: none; }
.topbar-actions > * { flex: 0 0 auto; }

@media (min-width: 1024px) {
  .topbar {
    min-height: var(--topbar-h);
    padding: .85rem 2rem;
    background: rgba(255, 255, 255, .86);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line);
    box-shadow: none;
  }
  .topbar h2 { font-size: 1.25rem; color: var(--ink); flex: 0 1 auto; }
  .topbar-actions { flex-wrap: wrap; overflow: visible; }
  .topbar-info { color: var(--ink-3); }
  .topbar-info strong, .topbar-time { color: var(--ink); }
}

/* Barra móvil antigua (compatibilidad) */
.mobile-topbar,
.mobile-header { display: none; }

.hamburger,
.mobile-logout-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .35rem;
  min-width: 42px;
  min-height: 42px;
  padding: .35rem .6rem;
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: var(--r-md);
  background: rgba(255, 255, 255, .09);
  color: #fff;
  font-size: .8rem;
  font-weight: 600;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background .18s var(--ease);
}

.hamburger { font-size: 1.25rem; }
.hamburger:active,
.mobile-logout-btn:active { background: rgba(255, 255, 255, .18); }

@media (min-width: 1024px) {
  .hamburger { display: none; }
  .topbar-logout { display: none; }
}

/* Controles dentro de la barra oscura (móvil) */
@media (max-width: 1023px) {
  .topbar .btn-outline,
  .topbar .btn-ghost {
    color: #fff;
    border-color: rgba(255, 255, 255, .22);
    background: rgba(255, 255, 255, .08);
  }
  .topbar .btn-ghost:hover,
  .topbar .btn-outline:hover { background: rgba(255, 255, 255, .16); color: #fff; }

  .topbar .vista-tabs { background: rgba(255, 255, 255, .1); }
  .topbar .vista-tab { color: rgba(255, 255, 255, .72); }
  .topbar .vista-tab.active { background: rgba(255, 255, 255, .2); color: #fff; }

  .topbar select,
  .topbar input[type="text"],
  .topbar input[type="search"],
  .topbar input[type="date"] {
    background: rgba(255, 255, 255, .1);
    border-color: rgba(255, 255, 255, .22);
    color: #fff;
  }
  .topbar select option { color: var(--ink); background: #fff; }
  .topbar .badge-gray { background: rgba(255, 255, 255, .16); color: #fff; }
  .topbar .topbar-logout { margin: 0; }
  .topbar .topbar-logout .btn { color: #fff; border-color: rgba(255, 255, 255, .22); background: rgba(255, 255, 255, .08); }
}

/* ── 6. BOTTOM NAV ─────────────────────────────────────────────────────────── */
.bottom-nav {
  position: fixed;
  left: .75rem;
  right: .75rem;
  bottom: calc(.7rem + var(--safe-bottom));
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: .2rem;
  padding: .4rem;
  background: rgba(255, 255, 255, .94);
  backdrop-filter: blur(14px);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
  z-index: 150;
}

.bottom-nav a,
.bnav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .18rem;
  min-height: 50px;
  padding: .35rem .25rem;
  border-radius: var(--r-md);
  color: var(--ink-3);
  font-size: .64rem;
  font-weight: 600;
  -webkit-tap-highlight-color: transparent;
  transition: color .18s var(--ease), background .18s var(--ease);
}

.bnav-item .bnav-icon,
.bottom-nav a .bnav-icon { font-size: 1.2rem; line-height: 1; }

.bnav-item.active,
.bottom-nav a.active { color: var(--brand); background: var(--brand-50); }

@media (min-width: 1024px) {
  .bottom-nav { display: none; }
}

/* ── 7. ALERTAS ────────────────────────────────────────────────────────────── */
.alert {
  display: flex;
  align-items: flex-start;
  gap: .55rem;
  padding: .8rem 1rem;
  margin-bottom: 1rem;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: .875rem;
  font-weight: 500;
  line-height: 1.5;
}

.alert-success { background: var(--ok-bg);   border-color: var(--ok-line);   color: var(--ok); }
.alert-danger  { background: var(--bad-bg);  border-color: var(--bad-line);  color: var(--bad); }
.alert-warning { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn); }
.alert-info    { background: var(--info-bg); border-color: var(--info-line); color: var(--info); }

/* ── 8. TARJETAS ───────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 1.15rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow-sm);
  overflow-x: auto;
}

@media (min-width: 640px) {
  .card { padding: 1.5rem; border-radius: var(--r-xl); margin-bottom: 1.25rem; }
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .65rem;
  margin-bottom: 1rem;
  padding-bottom: .8rem;
  border-bottom: 1px solid var(--line);
}

.card-header h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: .45rem;
}

.card-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 1rem;
}

.card-icon { font-size: 1.2rem; }

.card-subtitle { font-size: .82rem; color: var(--ink-3); font-weight: 400; }

/* ── 9. KPIs Y ESTADÍSTICAS ───────────────────────────────────────────────── */
.kpi-grid,
.stats-grid,
.stats-row,
.stats-grid-4,
.stats-grid-3 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .75rem;
  margin-bottom: 1.25rem;
}

@media (min-width: 720px) {
  .kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stats-grid, .stats-row, .stats-grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (min-width: 1100px) {
  .kpi-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .stats-grid, .stats-row, .stats-grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

.kpi-card,
.stat-card,
.stat-mini {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 1rem;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: box-shadow .2s var(--ease), transform .2s var(--ease);
}

.kpi-card:hover,
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }

.kpi-card::before {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--brand);
}

.kpi-card.navy::before   { background: var(--brand); }
.kpi-card.gold::before   { background: #d97706; }
.kpi-card.green::before  { background: var(--ok); }
.kpi-card.orange::before { background: #ea580c; }
.kpi-card.red::before    { background: var(--bad); }

.kpi-icon { font-size: 1.15rem; margin-bottom: .4rem; line-height: 1; }

.kpi-value {
  font-size: 1.65rem;
  font-weight: 800;
  line-height: 1.1;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  letter-spacing: -.02em;
}

.kpi-label,
.stat-card .label,
.stat-mini .label,
.stat-mini .lbl {
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: .3rem;
}

.kpi-label { margin: .35rem 0 0; }
.kpi-sub,
.stat-card .sub,
.stat-mini .sub {
  font-size: .75rem;
  color: var(--ink-3);
  margin-top: .2rem;
}

.stat-card .value,
.stat-mini .val {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--ink);
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}

.stat-positive { color: var(--ok) !important; }
.stat-negative { color: var(--bad) !important; }

/* ── 10. REJILLAS DE CONTENIDO ────────────────────────────────────────────── */
.two-col,
.three-col,
.three-col-wide,
.edit-grid,
.cal-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

.full-col { margin-bottom: 1rem; }

@media (min-width: 900px) {
  .two-col { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.25rem; }
  .three-col { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 1.25rem; }
  .three-col-wide { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 1.25rem; }
  .edit-grid { grid-template-columns: minmax(0, 1fr) 330px; gap: 1.25rem; align-items: start; }
  .cal-layout { grid-template-columns: minmax(0, 1fr) 240px; gap: 1.25rem; align-items: start; }
}

/* ── 11. BOTONES ───────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  min-height: 40px;
  padding: .5rem 1rem;
  border-radius: var(--r-md);
  border: 1px solid var(--line-2);
  background: var(--surface);
  color: var(--ink-2);
  font-size: .845rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background .16s var(--ease), border-color .16s var(--ease),
              color .16s var(--ease), box-shadow .16s var(--ease), transform .1s var(--ease);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.btn:hover {
  background: var(--surface-2);
  border-color: var(--ink-4);
  color: var(--ink);
}

.btn:active { transform: translateY(1px); }

.btn-primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
  box-shadow: 0 1px 2px rgba(79, 70, 229, .25);
}
.btn-primary:hover { background: var(--brand-600); border-color: var(--brand-600); color: #fff; }

.btn-secondary {
  background: #0f172a;
  border-color: #0f172a;
  color: #fff;
}
.btn-secondary:hover { background: #1e293b; border-color: #1e293b; color: #fff; }

.btn-outline { background: transparent; border-color: var(--line-2); color: var(--ink-2); }
.btn-outline:hover { background: var(--surface-2); border-color: var(--ink-3); color: var(--ink); }

.btn-success { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn-success:hover { background: #166534; border-color: #166534; color: #fff; }

.btn-danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn-danger:hover { background: #991b1b; border-color: #991b1b; color: #fff; }

.btn-warning { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn); }
.btn-warning:hover { background: #fef3c7; border-color: #fcd34d; color: #92400e; }

.btn-navy { background: #0f172a; border-color: #0f172a; color: #fff; }
.btn-navy:hover { background: #1e293b; border-color: #1e293b; color: #fff; }

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--ink-3);
}
.btn-ghost:hover { background: var(--surface-3); color: var(--ink); }

.btn-export {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  min-height: 40px;
  padding: .5rem 1rem;
  border: none;
  border-radius: var(--r-md);
  background: var(--brand);
  color: #fff;
  font-size: .845rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}
.btn-export:hover { background: var(--brand-600); }

.btn-sm { min-height: 32px; padding: .3rem .65rem; font-size: .775rem; border-radius: var(--r-sm); gap: .3rem; }
.btn-lg { min-height: 48px; padding: .75rem 1.5rem; font-size: .95rem; border-radius: var(--r-lg); }
.btn-block { width: 100%; }

.btn[disabled], .btn.disabled { opacity: .55; cursor: not-allowed; }

/* ── 12. FORMULARIOS ───────────────────────────────────────────────────────── */
.form-group { margin-bottom: .95rem; }
.form-row,
.form-row-3 {
  display: grid;
  grid-template-columns: 1fr;
  gap: .85rem;
  margin-bottom: .95rem;
}
@media (min-width: 640px) {
  .form-row, .form-row-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-row-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

label {
  display: block;
  font-size: .76rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--ink-2);
  margin-bottom: .35rem;
}

label .req, .req { color: var(--bad); }

input[type="text"],
input[type="email"],
input[type="password"],
input[type="date"],
input[type="datetime-local"],
input[type="month"],
input[type="week"],
input[type="number"],
input[type="tel"],
input[type="time"],
input[type="search"],
input[type="url"],
select,
textarea {
  width: 100%;
  min-height: 42px;
  padding: .55rem .75rem;
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--ink);
  font-size: .9rem;
  transition: border-color .16s var(--ease), box-shadow .16s var(--ease), background .16s var(--ease);
  appearance: none;
  -webkit-appearance: none;
}

input::placeholder, textarea::placeholder { color: var(--ink-4); }

input:hover, select:hover, textarea:hover { border-color: var(--ink-4); }

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: var(--ring);
}

textarea { resize: vertical; min-height: 84px; line-height: 1.5; }

select {
  padding-right: 2rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right .65rem center;
  background-size: 14px;
  cursor: pointer;
}

input[type="checkbox"], input[type="radio"] {
  width: 18px;
  height: 18px;
  min-height: 0;
  accent-color: var(--brand);
  cursor: pointer;
  vertical-align: -3px;
  margin-right: .4rem;
}

input[type="range"] { width: 100%; accent-color: var(--brand); }

input[type="file"] {
  width: 100%;
  padding: .45rem;
  border: 1px dashed var(--line-2);
  border-radius: var(--r-md);
  background: var(--surface-2);
  font-size: .85rem;
}

.form-hint, .hint {
  font-size: .76rem;
  color: var(--ink-3);
  margin-top: .3rem;
  line-height: 1.45;
}

.form-input { width: 100%; }

/* ── 13. TABLAS ────────────────────────────────────────────────────────────── */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--r-md);
  margin: -.25rem;
  padding: .25rem;
}

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

th {
  text-align: left;
  padding: .6rem .7rem;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ink-3);
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

th:first-child { border-radius: var(--r-sm) 0 0 0; }
th:last-child { border-radius: 0 var(--r-sm) 0 0; }

td {
  padding: .65rem .7rem;
  border-bottom: 1px solid var(--line);
  color: var(--ink-2);
  vertical-align: middle;
}

tbody tr { transition: background .14s var(--ease); }
tbody tr:hover td { background: var(--surface-2); }
tbody tr:last-child td { border-bottom: none; }

td strong { color: var(--ink); font-weight: 600; }

.row-open td,
.incidencia-row td { background: var(--warn-bg); }
.row-modified td { background: var(--info-bg); }
.row-festivo td { background: var(--warn-bg); color: #92400e; }
.row-finde td { background: var(--surface-3); color: var(--ink-3); }

.actions-cell { display: flex; gap: .35rem; flex-wrap: wrap; }

/* ── 14. BADGES / PILLS ───────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  padding: .18rem .55rem;
  border-radius: var(--r-pill);
  font-size: .715rem;
  font-weight: 700;
  line-height: 1.5;
  white-space: nowrap;
}

.badge-green  { background: var(--ok-bg);    color: #166534; }
.badge-red    { background: var(--bad-bg);   color: #991b1b; }
.badge-yellow { background: var(--warn-bg);  color: #92400e; }
.badge-blue   { background: var(--info-bg);  color: #1e40af; }
.badge-gold   { background: #fef3c7;         color: #854d0e; }
.badge-navy   { background: var(--brand-50); color: var(--brand-700); }
.badge-gray   { background: var(--surface-3); color: var(--ink-2); }
.badge-purple { background: #f5f3ff; color: #6d28d9; }

.badge-count,
.badge-warning,
.badge-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  padding: .12rem .5rem;
  border-radius: var(--r-pill);
  font-size: .72rem;
  font-weight: 700;
}

.badge-count   { background: var(--brand-50); color: var(--brand-700); }
.badge-warning { background: var(--warn-bg); color: #92400e; }
.badge-danger  { background: var(--bad-bg); color: #991b1b; }

.pill-ok  { background: rgba(34, 197, 94, .16); color: #4ade80; border: 1px solid rgba(34, 197, 94, .3); padding: .25rem .7rem; border-radius: var(--r-pill); font-size: .72rem; font-weight: 700; }
.pill-off { background: rgba(255, 255, 255, .08); color: rgba(255, 255, 255, .6); border: 1px solid rgba(255, 255, 255, .16); padding: .25rem .7rem; border-radius: var(--r-pill); font-size: .72rem; font-weight: 700; }

/* ── 15. MODALES ───────────────────────────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  padding: 1rem;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, .55);
  backdrop-filter: blur(4px);
}

.modal-overlay.active { display: flex; }

.modal {
  width: 100%;
  max-width: 560px;
  max-height: 90dvh;
  overflow-y: auto;
  padding: 1.35rem;
  background: var(--surface);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
  animation: modalIn .22s var(--ease);
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(12px) scale(.98); }
  to   { opacity: 1; transform: none; }
}

.modal-sm { max-width: 420px; }
.modal-lg { max-width: 760px; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.15rem;
}

.modal-header h3 { font-size: 1.08rem; color: var(--ink); }

.modal-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: none;
  border-radius: var(--r-sm);
  background: var(--surface-3);
  color: var(--ink-3);
  font-size: 1rem;
  cursor: pointer;
  flex-shrink: 0;
}
.modal-close:hover { background: var(--line); color: var(--ink); }

.modal-footer {
  display: flex;
  gap: .6rem;
  justify-content: flex-end;
  flex-wrap: wrap;
  margin-top: 1.25rem;
  padding-top: 1.15rem;
  border-top: 1px solid var(--line);
}

/* ── 16. UTILIDADES ────────────────────────────────────────────────────────── */
.text-muted { color: var(--ink-3); }
.text-sm { font-size: .8rem; }
.text-xs { font-size: .72rem; }
.fw-bold { font-weight: 700; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.justify-between { justify-content: space-between; }
.gap-sm { gap: .5rem; }
.divider { height: 1px; background: var(--line); margin: 1.15rem 0; }

.empty-state {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--ink-3);
  font-size: .875rem;
}
.empty-state .icon { font-size: 2rem; margin-bottom: .4rem; line-height: 1; }
.empty-state p { font-size: .85rem; }

.legal-note {
  background: var(--info-bg);
  border: 1px solid var(--info-line);
  border-radius: var(--r-md);
  padding: .85rem 1rem;
  margin-top: 1.15rem;
  font-size: .79rem;
  line-height: 1.6;
  color: var(--info);
}

.legal-warning {
  background: var(--warn-bg);
  border: 1px solid var(--warn-line);
  border-radius: var(--r-md);
  padding: .75rem .9rem;
  font-size: .79rem;
  line-height: 1.55;
  color: #92400e;
  margin-bottom: .9rem;
}

.calc-note {
  background: var(--info-bg);
  border: 1px solid var(--info-line);
  border-radius: var(--r-md);
  padding: .75rem .9rem;
  font-size: .79rem;
  line-height: 1.55;
  color: var(--info);
  margin-bottom: 1rem;
}

.progress-bar {
  height: 6px;
  border-radius: var(--r-pill);
  background: var(--surface-3);
  overflow: hidden;
  margin-top: .35rem;
}

.progress-fill {
  height: 100%;
  border-radius: var(--r-pill);
  background: linear-gradient(90deg, var(--brand), #818cf8);
  transition: width .35s var(--ease);
}

.avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--brand-50);
  color: var(--brand-700);
  font-size: .78rem;
  font-weight: 700;
  flex-shrink: 0;
}

.emp-info {
  display: flex;
  align-items: center;
  gap: .6rem;
  min-width: 0;
}

.emp-info > div:last-child { min-width: 0; }

.pulse {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, .25);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(34, 197, 94, .25); }
  50%      { box-shadow: 0 0 0 6px rgba(34, 197, 94, .08); }
}

/* ── 17. FILTROS Y TOOLBAR ────────────────────────────────────────────────── */
.filters-bar,
.filters-card {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: .7rem;
  padding: .9rem;
  margin-bottom: 1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-xs);
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: .25rem;
  flex: 1 1 140px;
  min-width: 0;
}

.filter-group label {
  margin: 0;
  font-size: .66rem;
  letter-spacing: .06em;
  color: var(--ink-3);
}

.filters-bar .btn,
.filters-card .btn { flex: 0 0 auto; }

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .7rem;
  margin-bottom: 1rem;
}

.toolbar-filters {
  display: flex;
  align-items: center;
  gap: .6rem;
  flex-wrap: wrap;
}

/* ── 18. TABS ──────────────────────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: .25rem;
  margin-bottom: 1.25rem;
  padding: .25rem;
  background: var(--surface-3);
  border-radius: var(--r-md);
  overflow-x: auto;
}

.tab {
  padding: .5rem .95rem;
  border-radius: var(--r-sm);
  font-size: .845rem;
  font-weight: 600;
  color: var(--ink-3);
  white-space: nowrap;
  transition: background .16s var(--ease), color .16s var(--ease);
}

.tab:hover { color: var(--ink); }
.tab.active { background: var(--surface); color: var(--brand); box-shadow: var(--shadow-xs); }

.vista-tabs {
  display: inline-flex;
  padding: .22rem;
  background: var(--surface-3);
  border-radius: var(--r-md);
  gap: .15rem;
}

.vista-tab {
  padding: .38rem .8rem;
  border-radius: var(--r-sm);
  font-size: .8rem;
  font-weight: 600;
  color: var(--ink-3);
  white-space: nowrap;
}
.vista-tab:hover:not(.active) { color: var(--ink); background: var(--surface-2); }
.vista-tab.active { background: var(--surface); color: var(--brand); box-shadow: var(--shadow-xs); }

/* ── 19. CALENDARIO ───────────────────────────────────────────────────────── */
.cal-mini-mes { display: block; }
.cal-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: .25rem; }

.cal-mes,
.cal-semana {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
  min-width: 560px;
}

.cal-semana { min-width: 700px; gap: 5px; }

.cal-header-day {
  padding: .4rem 0;
  text-align: center;
  font-size: .66rem;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.cal-header-day.weekend { color: var(--ink-4); }

.cal-cell {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-height: 82px;
  padding: .4rem .45rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  transition: box-shadow .16s var(--ease), border-color .16s var(--ease);
}

.cal-cell:hover { border-color: var(--line-2); box-shadow: var(--shadow-sm); z-index: 1; position: relative; }
.cal-cell.otro-mes { opacity: .38; background: var(--surface-2); }
.cal-semana .cal-cell { min-height: 180px; }

@media (min-width: 1024px) {
  .cal-cell { min-height: 112px; }
}

.cal-day-num {
  font-size: .76rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.2;
  margin-bottom: 1px;
  font-variant-numeric: tabular-nums;
}

.cal-ausencia {
  padding: 1px 5px;
  border-radius: var(--r-xs);
  font-size: .66rem;
  font-weight: 600;
  line-height: 1.55;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cal-presence { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; }

.presence-dot { width: 7px; height: 7px; border-radius: 50%; }
.dot-ok { background: #22c55e; }
.dot-open { background: #f59e0b; }
.presence-more { font-size: .58rem; color: var(--ink-4); }

.cal-presence-count {
  font-size: .66rem;
  font-weight: 700;
  color: var(--ok);
}

.cal-anual-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: .9rem;
}

@media (min-width: 560px) { .cal-anual-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .cal-anual-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.cal-mini-header {
  margin-bottom: .45rem;
  text-align: center;
  font-size: .84rem;
  font-weight: 700;
  color: var(--ink);
  text-transform: capitalize;
}

.cal-mini-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 1px; }

.cal-mini-dow {
  padding: 2px 0;
  text-align: center;
  font-size: .56rem;
  font-weight: 700;
  color: var(--ink-4);
  text-transform: uppercase;
}

.cal-mini-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 30px;
  aspect-ratio: 1;
  padding: 1px;
  border: 1px solid transparent;
  border-radius: var(--r-xs);
  font-size: .62rem;
}
.cal-mini-cell:hover { border-color: var(--brand); background: var(--brand-50); }
.cal-mini-cell .cal-day-num { font-size: .62rem; }
.cal-mini-cell .cal-ausencia { font-size: .5rem; padding: 0 2px; }

.legend { display: flex; flex-wrap: wrap; gap: .45rem .9rem; margin-bottom: 1rem; }
.legend-item { display: flex; align-items: center; gap: .35rem; font-size: .74rem; color: var(--ink-2); }
.legend-dot { width: 11px; height: 11px; border-radius: 3px; flex-shrink: 0; }

.cal-sidebar { display: flex; flex-direction: column; gap: .7rem; }
@media (max-width: 899px) { .cal-sidebar { display: none; } }

.cal-sidebar .card,
.cal-sidebar .stat-mini { margin-bottom: 0; }

.ausencias-sidebar {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: .85rem;
}

.aus-item {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .35rem 0;
  border-bottom: 1px solid var(--line);
  font-size: .76rem;
  color: var(--ink-2);
}
.aus-item:last-child { border-bottom: none; }
.aus-dot { width: 9px; height: 9px; border-radius: 3px; flex-shrink: 0; }

/* ── 20. DASHBOARD ─────────────────────────────────────────────────────────── */
/* Bajas activas */
.baja-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .9rem;
  padding: .75rem .9rem;
  margin-bottom: .5rem;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-left: 3px solid var(--bad);
  border-radius: var(--r-md);
}
.baja-card:last-child { margin-bottom: 0; }
.baja-info { flex: 1; min-width: 0; }
.baja-nombre { font-size: .87rem; font-weight: 700; color: var(--ink); }
.baja-dpto { font-size: .74rem; color: var(--ink-3); margin-top: 1px; }
.baja-tipo { margin-top: .25rem; font-size: .72rem; }
.baja-dias-wrap { text-align: right; flex-shrink: 0; }
.baja-dias-num { font-size: 1.4rem; font-weight: 800; line-height: 1; color: var(--bad); font-variant-numeric: tabular-nums; }
.baja-dias-label { font-size: .65rem; color: var(--ink-3); }
.baja-desde { font-size: .68rem; color: var(--ink-4); margin-top: .1rem; }

/* Ausencias pendientes */
.pend-row {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  padding: .8rem 0;
  border-bottom: 1px solid var(--line);
}
.pend-row:first-child { padding-top: 0; }
.pend-row:last-child { border-bottom: none; padding-bottom: 0; }

.pend-tipo-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: var(--r-md);
  background: var(--surface-3);
  font-size: 1.1rem;
  flex-shrink: 0;
}

.pend-info { flex: 1; min-width: 0; }
.pend-nombre { font-size: .87rem; font-weight: 700; color: var(--ink); }
.pend-tipo { font-size: .75rem; color: var(--ink-3); }
.pend-fecha { font-size: .74rem; color: var(--ink-3); margin-top: .1rem; }
.pend-motivo {
  margin-top: .3rem;
  padding: .3rem .5rem;
  border-radius: var(--r-xs);
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-size: .74rem;
  color: var(--ink-2);
}
.pend-acciones { display: flex; align-items: center; gap: .35rem; flex-shrink: 0; flex-wrap: wrap; }

/* Próximas ausencias */
.proxima-row {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .55rem 0;
  border-bottom: 1px solid var(--line);
}
.proxima-row:last-child { border-bottom: none; }
.proxima-ico { font-size: 1rem; flex-shrink: 0; }
.proxima-info { flex: 1; min-width: 0; }
.proxima-nombre {
  font-size: .83rem;
  font-weight: 600;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.proxima-fecha { font-size: .72rem; color: var(--ink-3); }
.proxima-dias-badge {
  flex-shrink: 0;
  padding: .18rem .5rem;
  border-radius: var(--r-sm);
  background: var(--surface-3);
  color: var(--ink-2);
  font-size: .7rem;
  font-weight: 700;
}

.dept-bar { height: 6px; margin-top: .35rem; border-radius: var(--r-pill); background: var(--surface-3); overflow: hidden; }
.dept-fill { height: 100%; border-radius: var(--r-pill); background: linear-gradient(90deg, var(--brand), #818cf8); }

/* ── 21. FICHAR (empleado) ────────────────────────────────────────────────── */
.fichar-card {
  position: relative;
  overflow: hidden;
  padding: 1.75rem 1.25rem;
  margin-bottom: 1.15rem;
  border-radius: var(--r-2xl);
  background: linear-gradient(150deg, #1b2542 0%, #232f57 55%, #2b3a6b 100%);
  color: #fff;
  text-align: center;
  box-shadow: var(--shadow-lg);
}

.fichar-card::before {
  content: '';
  position: absolute;
  width: 320px;
  height: 320px;
  top: -140px;
  right: -100px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(129, 140, 248, .35), transparent 70%);
  pointer-events: none;
}

.fichar-card-inner { position: relative; z-index: 1; }

.fichar-card h3 {
  font-size: 1.3rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: .3rem;
}

.fichar-card p { font-size: .85rem; color: rgba(255, 255, 255, .65); margin-bottom: 1.25rem; }

.estado-badge {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  padding: .3rem .85rem;
  margin-bottom: 1rem;
  border-radius: var(--r-pill);
  font-size: .78rem;
  font-weight: 600;
}

.estado-activo {
  background: rgba(34, 197, 94, .18);
  color: #86efac;
  border: 1px solid rgba(34, 197, 94, .35);
}

.estado-inactivo {
  background: rgba(255, 255, 255, .08);
  color: rgba(255, 255, 255, .65);
  border: 1px solid rgba(255, 255, 255, .16);
}

.timer-display {
  font-size: clamp(2.6rem, 12vw, 3.4rem);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -.03em;
  color: #fff;
  font-variant-numeric: tabular-nums;
  margin-bottom: .25rem;
}

.timer-label { font-size: .78rem; color: rgba(255, 255, 255, .55); margin-bottom: 1.35rem; }

.btn-fichar {
  width: 100%;
  max-width: 340px;
  min-height: 54px;
  padding: .95rem 1.5rem;
  border: none;
  border-radius: var(--r-lg);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform .12s var(--ease), box-shadow .18s var(--ease), background .18s var(--ease);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.btn-fichar:active { transform: scale(.98); }
.btn-fichar.loading { opacity: .7; pointer-events: none; }

.btn-entrada {
  background: #fff;
  color: #1b2542;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .22);
}
.btn-entrada:hover { background: #f1f5ff; }

.btn-salida {
  background: #fbbf24;
  color: #422006;
  box-shadow: 0 10px 30px rgba(251, 191, 36, .28);
}
.btn-salida:hover { background: #f59e0b; }

/* Push / avisos */
.push-btn {
  display: flex;
  align-items: center;
  gap: .85rem;
  width: 100%;
  min-height: 64px;
  padding: .85rem 1rem;
  margin-bottom: 1.15rem;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-xs);
  cursor: pointer;
  transition: border-color .18s var(--ease), box-shadow .18s var(--ease);
}
.push-btn:hover { border-color: var(--brand); box-shadow: var(--shadow-sm); }

.push-btn-icon { font-size: 1.4rem; flex-shrink: 0; }
.push-btn-text { flex: 1; min-width: 0; }
.push-btn-text strong { display: block; font-size: .87rem; color: var(--ink); }
.push-btn-text span { font-size: .76rem; color: var(--ink-3); }

.push-pill {
  flex-shrink: 0;
  padding: .2rem .6rem;
  border-radius: var(--r-pill);
  font-size: .68rem;
  font-weight: 700;
  background: var(--ok-bg);
  color: #166534;
}
.push-pill.off { background: var(--surface-3); color: var(--ink-3); }

/* Diagnóstico push */
#push-diag {
  display: none;
  margin: -.35rem 0 1rem;
  padding: .6rem .75rem;
  border-radius: var(--r-md);
  background: #0f172a;
  color: #cbd5e1;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .72rem;
  line-height: 1.6;
  max-height: 180px;
  overflow-y: auto;
}
#push-diag.visible { display: block; }
#push-diag div.ok   { color: #86efac; }
#push-diag div.err  { color: #fca5a5; }
#push-diag div.warn { color: #fcd34d; }

#push-toast {
  display: none;
  position: fixed;
  left: 50%;
  bottom: calc(5.5rem + var(--safe-bottom));
  transform: translateX(-50%);
  z-index: 9999;
  max-width: calc(100vw - 2rem);
  padding: .7rem 1.15rem;
  border-radius: var(--r-md);
  background: #0f172a;
  color: #fff;
  font-size: .85rem;
  font-weight: 500;
  text-align: center;
  box-shadow: var(--shadow-lg);
}

/* ── 22. AUSENCIAS ────────────────────────────────────────────────────────── */
.vac-bar-wrap { height: 9px; border-radius: var(--r-pill); background: var(--surface-3); overflow: hidden; }
.vac-bar-fill { height: 100%; border-radius: var(--r-pill); transition: width .4s var(--ease); }
.vac-bar-ok { background: linear-gradient(90deg, var(--brand), #6366f1); }
.vac-bar-warning { background: linear-gradient(90deg, #f59e0b, #dc2626); }
.vac-bar-superado { background: var(--bad); }

.emp-card {
  display: block;
  padding: 1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  color: inherit;
  cursor: pointer;
  transition: border-color .18s var(--ease), box-shadow .18s var(--ease), transform .18s var(--ease);
}
.emp-card:hover { border-color: var(--brand); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.emp-card.has-alert { border-left: 3px solid var(--bad); }
.emp-card.has-warning { border-left: 3px solid #f59e0b; }

.mes-row {
  display: flex;
  align-items: flex-start;
  gap: .5rem;
  padding: .55rem 0;
  border-bottom: 1px solid var(--line);
}
.mes-row:last-child { border-bottom: none; }
.mes-label {
  width: 38px;
  flex-shrink: 0;
  padding-top: .15rem;
  font-size: .72rem;
  font-weight: 700;
  color: var(--ink-3);
  text-transform: uppercase;
}
.mes-pills { display: flex; flex-wrap: wrap; gap: .3rem; flex: 1; min-width: 0; }
.mes-pill {
  display: inline-flex;
  align-items: center;
  gap: .2rem;
  padding: .18rem .5rem;
  border-radius: var(--r-pill);
  font-size: .7rem;
  font-weight: 600;
}

.vac-summary {
  padding: 1.1rem;
  border-radius: var(--r-lg);
  background: linear-gradient(160deg, #1b2542, #2b3a6b);
  color: #fff;
}
.vac-summary h4 { font-size: 1rem; margin-bottom: .8rem; color: #fff; }
.vac-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: .45rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, .1);
  font-size: .84rem;
}
.vac-row:last-child { border-bottom: none; }
.vac-val { font-weight: 700; font-variant-numeric: tabular-nums; }
.vac-val.ok, .vac-val.warn, .vac-val.danger { color: #fff; }
.vac-val.ok { color: #86efac; }
.vac-val.warn { color: #fbbf24; }
.vac-val.danger { color: #fca5a5; }

.ajuste-row {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .35rem 0;
  border-bottom: 1px solid var(--line);
  font-size: .78rem;
  color: var(--ink-2);
}
.ajuste-row:last-child { border-bottom: none; }

/* Ficha de ausencia / edición */
.summary-box {
  padding: 1.1rem;
  border-radius: var(--r-lg);
  background: linear-gradient(160deg, #1b2542, #2b3a6b);
  color: #fff;
}
.summary-box h4, .summary-box h3 { color: #fff; margin-bottom: .6rem; font-size: .95rem; }
.summary-row {
  display: flex;
  justify-content: space-between;
  gap: .9rem;
  padding: .4rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, .1);
  font-size: .82rem;
}
.summary-row:last-child { border-bottom: none; }

.hist-item {
  margin-left: .35rem;
  padding: .3rem 0 .6rem .75rem;
  border-left: 3px solid var(--line);
}
.hist-item strong { font-size: .83rem; }
.hist-meta { font-size: .71rem; color: var(--ink-3); }

/* ── 23. INFORMES ─────────────────────────────────────────────────────────── */
.chart-bar {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 130px;
  padding: 0 .25rem;
}
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 0; }
.bar {
  width: 100%;
  border-radius: 4px 4px 0 0;
  background: linear-gradient(180deg, #818cf8 0%, var(--brand) 100%);
  transition: opacity .18s var(--ease);
}
.bar:hover { opacity: .82; }
.bar-label { font-size: .62rem; font-weight: 600; color: var(--ink-3); }
.bar-val { font-size: .62rem; font-weight: 700; color: var(--ink-2); }

.rank-bar { height: 7px; margin-top: .25rem; border-radius: var(--r-pill); background: var(--surface-3); overflow: hidden; }
.rank-fill { height: 100%; border-radius: var(--r-pill); background: linear-gradient(90deg, var(--brand), #818cf8); }

.festivo-tag {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  padding: .12rem .45rem;
  border-radius: var(--r-xs);
  background: var(--warn-bg);
  border: 1px solid var(--warn-line);
  color: #92400e;
  font-size: .7rem;
  font-weight: 600;
}

/* ── 24. EXPORTAR ─────────────────────────────────────────────────────────── */
.export-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

@media (min-width: 700px) { .export-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

.export-card {
  padding: 1.5rem 1.25rem;
  text-align: center;
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: var(--r-lg);
  cursor: pointer;
  transition: border-color .18s var(--ease), box-shadow .18s var(--ease), transform .18s var(--ease);
}
.export-card:hover { border-color: var(--brand); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.export-card.selected { border-color: var(--brand); background: var(--brand-50); }
.export-card .icon { font-size: 2rem; margin-bottom: .5rem; line-height: 1; }
.export-card h4 { font-size: 1rem; color: var(--ink); margin-bottom: .3rem; }
.export-card p { font-size: .79rem; color: var(--ink-3); line-height: 1.5; }

.formato-toggle {
  display: inline-flex;
  padding: .22rem;
  gap: .15rem;
  background: var(--surface-3);
  border-radius: var(--r-md);
}
.formato-btn {
  padding: .45rem 1.1rem;
  border: none;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--ink-3);
  font-size: .84rem;
  font-weight: 600;
  cursor: pointer;
}
.formato-btn.active { background: var(--surface); color: var(--brand); box-shadow: var(--shadow-xs); }

/* ── 25. NOTIFICACIONES / AJUSTES ─────────────────────────────────────────── */
.config-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  margin-bottom: .9rem;
  overflow: hidden;
}
.config-card-header {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .9rem 1.1rem;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}
.config-card-header .card-icon { font-size: 1.15rem; }
.config-card-header h3 { flex: 1; font-size: .95rem; color: var(--ink); }
.config-card-body { padding: 1rem 1.1rem; }

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .7rem 0;
  border-bottom: 1px solid var(--line);
}
.toggle-row:first-child { padding-top: 0; }
.toggle-row:last-child { border-bottom: none; padding-bottom: 0; }
.toggle-label { flex: 1; min-width: 0; }
.toggle-label strong { display: block; font-size: .86rem; font-weight: 600; color: var(--ink); }
.toggle-label span { font-size: .75rem; color: var(--ink-3); }

.toggle-wrap { position: relative; width: 46px; height: 27px; flex-shrink: 0; }
.toggle-wrap input {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.toggle-track {
  position: absolute;
  inset: 0;
  border-radius: var(--r-pill);
  background: var(--line-2);
  transition: background .22s var(--ease);
}
.toggle-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 21px;
  height: 21px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(15, 23, 42, .3);
  transition: transform .22s var(--ease);
  pointer-events: none;
}
.toggle-wrap input:checked ~ .toggle-track { background: var(--brand); }
.toggle-wrap input:checked ~ .toggle-thumb { transform: translateX(19px); }

.slider-row { padding-top: .75rem; }
.slider-wrap { display: flex; align-items: center; gap: .85rem; }
.slider-wrap input[type="range"] { flex: 1; }
.slider-value {
  min-width: 56px;
  padding: .3rem .5rem;
  border-radius: var(--r-sm);
  background: var(--brand-50);
  color: var(--brand-700);
  font-size: .82rem;
  font-weight: 700;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.dias-grid { display: flex; flex-wrap: wrap; gap: .45rem; padding-top: .7rem; }
.dia-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line-2);
  border-radius: 50%;
  background: var(--surface);
  color: var(--ink-3);
  font-size: .78rem;
  font-weight: 600;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: all .16s var(--ease);
}
.dia-btn:hover { border-color: var(--brand); color: var(--brand); }
.dia-btn.activo { background: var(--brand); border-color: var(--brand); color: #fff; }
.dias-label {
  display: block;
  padding-top: .7rem;
  margin-bottom: .35rem;
  font-size: .76rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--ink-2);
}

.push-status-card {
  display: flex;
  align-items: center;
  gap: .9rem;
  padding: 1.1rem;
  margin-bottom: .9rem;
  border-radius: var(--r-lg);
  background: linear-gradient(160deg, #1b2542, #2b3a6b);
  color: #fff;
}
.push-status-icon { font-size: 1.75rem; flex-shrink: 0; }
.push-status-text { flex: 1; min-width: 0; }
.push-status-text strong { display: block; font-size: .92rem; color: #fff; }
.push-status-text span { font-size: .75rem; color: rgba(255, 255, 255, .65); }
.push-status-pill {
  flex-shrink: 0;
  padding: .25rem .7rem;
  border-radius: var(--r-pill);
  font-size: .72rem;
  font-weight: 700;
}

.btn-save {
  width: 100%;
  min-height: 50px;
  margin-top: 1rem;
  padding: .85rem;
  border: none;
  border-radius: var(--r-md);
  background: var(--brand);
  color: #fff;
  font-size: .95rem;
  font-weight: 700;
  cursor: pointer;
  transition: background .18s var(--ease), transform .12s var(--ease);
}
.btn-save:hover { background: var(--brand-600); }
.btn-save:active { transform: scale(.99); }

/* ── 26. LOGIN / ACCESO ───────────────────────────────────────────────────── */
.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  padding: 1.25rem;
  background:
    radial-gradient(900px 500px at 15% -10%, #e4e9ff 0%, transparent 60%),
    radial-gradient(700px 400px at 110% 110%, #e6f7f1 0%, transparent 55%),
    var(--canvas);
}

.auth-card {
  width: 100%;
  max-width: 430px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-2xl);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: authIn .4s var(--ease);
}

@keyframes authIn {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}

.auth-head { padding: 2rem 1.75rem 1.5rem; text-align: center; }
.auth-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 58px;
  height: 58px;
  margin: 0 auto .9rem;
  border-radius: var(--r-lg);
  background: linear-gradient(150deg, var(--brand) 0%, var(--brand-700) 100%);
  color: #fff;
  font-size: 1.5rem;
  box-shadow: 0 10px 24px -8px rgba(79, 70, 229, .6);
}
.auth-title { font-size: 1.5rem; font-weight: 800; letter-spacing: -.02em; color: var(--ink); }
.auth-sub { margin-top: .3rem; font-size: .875rem; color: var(--ink-3); }

.auth-body { padding: 1.5rem 1.75rem 1.75rem; }

.auth-foot {
  padding: 1rem 1.75rem;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
  text-align: center;
  font-size: .75rem;
  color: var(--ink-3);
  line-height: 1.6;
}

.auth-page .form-input {
  min-height: 46px;
  padding: .7rem .85rem;
  font-size: .925rem;
}

.auth-page .btn-login {
  width: 100%;
  min-height: 48px;
  margin-top: .35rem;
  padding: .8rem 1.25rem;
  border: none;
  border-radius: var(--r-md);
  background: var(--brand);
  color: #fff;
  font-size: .925rem;
  font-weight: 700;
  cursor: pointer;
  transition: background .18s var(--ease), box-shadow .18s var(--ease), transform .12s var(--ease);
}
.auth-page .btn-login:hover { background: var(--brand-600); box-shadow: var(--shadow-md); }
.auth-page .btn-login:active { transform: translateY(1px); }

.auth-page .subtitle { font-size: .85rem; color: var(--ink-3); text-align: center; margin-bottom: 1.25rem; }
.auth-page .req-list {
  padding: .8rem .9rem;
  margin-bottom: 1rem;
  border-radius: var(--r-md);
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-size: .78rem;
  color: var(--ink-3);
  line-height: 1.8;
}
.auth-page .btn-link {
  display: block;
  width: 100%;
  margin-top: .9rem;
  border: none;
  background: none;
  color: var(--ink-3);
  font-size: .8rem;
  text-decoration: underline;
  cursor: pointer;
  text-align: center;
}

@media (max-width: 480px) {
  .auth-head { padding: 1.6rem 1.25rem 1.25rem; }
  .auth-body { padding: 1.25rem; }
  .auth-foot { padding: .9rem 1.25rem; }
}

/* ── 27. RESPONSIVE AJUSTES FINOS ─────────────────────────────────────────── */
@media (max-width: 1023px) {
  .sidebar { transform: translateX(-100%); box-shadow: none; }
  .sidebar.open { transform: translateX(0); box-shadow: 0 0 60px rgba(15, 23, 42, .45); }
}

@media (min-width: 1024px) {
  .sidebar-overlay { display: none !important; }
}

@media (max-width: 639px) {
  h1 { font-size: 1.35rem; }
  .card { padding: 1rem; }
  .card-header { margin-bottom: .8rem; padding-bottom: .65rem; }
  .kpi-value { font-size: 1.4rem; }
  .stat-card .value { font-size: 1.3rem; }
  .filters-bar, .filters-card { padding: .75rem; }
  .filter-group { flex: 1 1 100%; }
  .modal { padding: 1.1rem; border-radius: var(--r-lg); }
  .modal-footer .btn { flex: 1 1 auto; }
  .pend-acciones { width: 100%; margin-top: .35rem; }
  .pend-row { flex-wrap: wrap; }
  .baja-card { flex-wrap: wrap; }
  table { font-size: .82rem; }
  th, td { padding: .55rem .6rem; }
}

@media (max-width: 400px) {
  .content { padding: .8rem .8rem calc(5.5rem + var(--safe-bottom)); }
  .bottom-nav { left: .5rem; right: .5rem; }
  .dia-btn { width: 36px; height: 36px; }
}

/* Ajustes de impresión */
@media print {
  .sidebar, .bottom-nav, .mobile-topbar, .topbar, .filters-bar, .btn { display: none !important; }
  .main { margin-left: 0 !important; }
  .content { padding: 0 !important; max-width: none; }
  .card { box-shadow: none; border-color: #ccc; break-inside: avoid; }
  body { background: #fff; }
}
