/* ============================================================
   FICHAJE WEB — hoja de estilos única
   Versión 2.0 — Mobile-first + PWA
   Incluir en TODAS las páginas (empleado + admin + login)
   <link rel="stylesheet" href="/assets/fichaje.css">
   ============================================================ */

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

:root {
  /* Paleta */
  --navy:        #0f1f3d;
  --navy-light:  #1a3160;
  --gold:        #c8962a;
  --gold-light:  #e8b84b;
  --cream:       #f9f5ef;
  --cream-dark:  #ede8df;
  --text:        #1a1a2e;
  --text-muted:  #6b7280;
  --success:     #16a34a;
  --success-bg:  #f0fdf4;
  --danger:      #dc2626;
  --danger-bg:   #fef2f2;
  --warning:     #d97706;
  --warning-bg:  #fffbeb;
  --info:        #1e40af;
  --info-bg:     #eff6ff;

  /* Layout */
  --sidebar-w:   260px;
  --radius-sm:   8px;
  --radius-md:   12px;
  --radius-lg:   16px;
  --radius-xl:   20px;

  /* Safe areas (notch / barra inferior iOS/Android) */
  --safe-top:    env(safe-area-inset-top,    0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left:   env(safe-area-inset-left,   0px);
  --safe-right:  env(safe-area-inset-right,  0px);
}

html { height: 100%; }

body {
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--cream);
  color: var(--text);
  min-height: 100dvh;        /* dvh: respeta la barra del navegador móvil */
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

/* ── TIPOGRAFÍA GLOBAL ───────────────────────────────────── */
h1, h2, h3, h4 {
  font-family: 'DM Serif Display', Georgia, serif;
  line-height: 1.2;
}
a { color: inherit; }
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font-family: inherit; }

/* ╔══════════════════════════════════════════════════════════╗
   ║  LAYOUT PRINCIPAL (sidebar + main)                      ║
   ╚══════════════════════════════════════════════════════════╝ */

/* Mobile: apilado vertical. Desktop: sidebar fijo + main desplazado */
.app-shell { display: flex; min-height: 100dvh; }

/* ── SIDEBAR ─────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--navy);
  display: flex;
  flex-direction: column;
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 200;
  overflow-y: auto;
  overscroll-behavior: contain;
  transition: transform 0.3s cubic-bezier(.4,0,.2,1);
}

/* En móvil el sidebar se oculta y activa con JS */
@media (max-width: 899px) {
  .sidebar {
    transform: translateX(-100%);
    box-shadow: 4px 0 24px rgba(0,0,0,.25);
  }
  .sidebar.open { transform: translateX(0); }

  /* Overlay semitransparente detrás del sidebar abierto */
  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 199;
    backdrop-filter: blur(2px);
  }
  .sidebar-overlay.active { display: block; }
}

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

.sidebar-brand {
  padding: 1.75rem 1.5rem;
  border-bottom: 1px solid rgba(255,255,255,.08);
  flex-shrink: 0;
}
.sidebar-brand h1 { color: #fff; font-size: 1.3rem; }
.sidebar-brand h1 span { color: var(--gold); }
.sidebar-brand small {
  display: block;
  color: rgba(255,255,255,.4);
  font-size: .7rem;
  margin-top: .2rem;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.sidebar-nav { padding: 1rem 0; flex: 1; }

.nav-section {
  padding: .5rem 1.5rem .25rem;
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: rgba(255,255,255,.3);
  font-weight: 600;
  margin-top: .5rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .75rem 1.5rem;
  color: rgba(255,255,255,.65);
  text-decoration: none;
  font-size: .9rem;
  font-weight: 500;
  transition: color .15s, background .15s;
  border-left: 3px solid transparent;
  min-height: 44px; /* área táctil mínima */
}
.nav-item:hover  { color: #fff; background: rgba(255,255,255,.06); }
.nav-item.active { color: #fff; background: rgba(255,255,255,.06); border-left-color: var(--gold); }
.nav-item .icon  { font-size: 1.1rem; width: 22px; text-align: center; flex-shrink: 0; }

.sidebar-user {
  padding: 1rem 1.5rem;
  border-top: 1px solid rgba(255,255,255,.08);
  flex-shrink: 0;
  padding-bottom: calc(1rem + var(--safe-bottom));
}
.sidebar-user-name { color: #fff; font-weight: 600; font-size: .9rem; }
.sidebar-user-role { font-size: .75rem; color: var(--gold); margin-top: 2px; }
.sidebar-user-info { font-size: .82rem; color: rgba(255,255,255,.65); margin-top: 1px; }

.btn-logout {
  width: 100%; margin-top: .75rem; padding: .5rem;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.12);
  color: rgba(255,255,255,.7);
  border-radius: var(--radius-sm);
  cursor: pointer; font-size: .85rem;
  transition: background .15s, color .15s;
  min-height: 44px;
}
.btn-logout:hover { background: rgba(220,38,38,.2); color: #fca5a5; }

/* ── MAIN ────────────────────────────────────────────────── */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  min-width: 0;
}

@media (min-width: 900px) {
  .main { margin-left: var(--sidebar-w); }
}

/* ── MOBILE TOPBAR (hamburguer + título) ─────────────────── */
.mobile-topbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: calc(.875rem + var(--safe-top)) 1rem .875rem;
  background: var(--navy);
  position: sticky;
  top: 0;
  z-index: 100;
}

@media (min-width: 900px) {
  .mobile-topbar { display: none; }
}

.mobile-topbar-title { color: #fff; font-size: 1.1rem; flex: 1; }
.mobile-topbar-title span { color: var(--gold); }

.hamburger {
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  padding: .25rem;
  font-size: 1.5rem;
  line-height: 1;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
}

/* ── DESKTOP TOPBAR ──────────────────────────────────────── */
.topbar {
  background: #fff;
  border-bottom: 1px solid var(--cream-dark);
  padding: 1rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .75rem;
}
.topbar h2 { font-size: 1.5rem; color: var(--navy); }
.topbar-time { font-size: 1.5rem; font-weight: 600; color: var(--navy); font-variant-numeric: tabular-nums; }
.topbar-date { font-size: .82rem; color: var(--text-muted); text-align: right; }

@media (max-width: 899px) {
  .topbar { display: none; }
}

/* ── CONTENT ─────────────────────────────────────────────── */
.content {
  padding: 1.25rem;
  padding-bottom: calc(5rem + var(--safe-bottom)); /* espacio para bottom-nav */
  flex: 1;
}

@media (min-width: 900px) {
  .content {
    padding: 2rem;
    padding-bottom: 2rem;
  }
}

/* ── BOTTOM NAV (solo móvil empleado) ───────────────────── */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--navy);
  display: grid;
  grid-template-columns: repeat(var(--bnav-cols, 3), 1fr);
  border-top: 1px solid rgba(255,255,255,.1);
  padding-bottom: var(--safe-bottom);
  z-index: 150;
}

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

.bnav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: .65rem .5rem;
  color: rgba(255,255,255,.5);
  text-decoration: none;
  font-size: .65rem;
  font-weight: 500;
  gap: .2rem;
  -webkit-tap-highlight-color: transparent;
  transition: color .15s;
  min-height: 56px;
}
.bnav-item .bnav-icon { font-size: 1.35rem; }
.bnav-item.active     { color: var(--gold); }
.bnav-item:active     { color: var(--gold); }

/* ╔══════════════════════════════════════════════════════════╗
   ║  LOGIN PAGE                                             ║
   ╚══════════════════════════════════════════════════════════╝ */

.login-shell {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: 1fr 1fr;
}

@media (max-width: 768px) {
  .login-shell { grid-template-columns: 1fr; }
  .brand-panel  { display: none; }
}

/* Panel izquierdo branding */
.brand-panel {
  background: var(--navy);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 3rem;
  position: relative;
  overflow: hidden;
}
.brand-panel::before {
  content: '';
  position: absolute;
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(200,150,42,.15) 0%, transparent 70%);
  top: -100px; left: -100px;
  pointer-events: none;
}
.brand-panel::after {
  content: '';
  position: absolute;
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(200,150,42,.1) 0%, transparent 70%);
  bottom: -50px; right: -80px;
  pointer-events: none;
}
.brand-content { position: relative; z-index: 1; text-align: center; }

.brand-logo {
  width: 80px; height: 80px;
  background: var(--gold);
  border-radius: 20px;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 2rem;
  font-size: 2rem;
  box-shadow: 0 20px 60px rgba(200,150,42,.3);
}
.brand-title {
  color: #fff;
  font-size: clamp(2rem, 4vw, 2.8rem);
  margin-bottom: 1rem;
}
.brand-subtitle {
  color: rgba(255,255,255,.6);
  font-size: 1rem;
  font-weight: 300;
  line-height: 1.6;
  max-width: 320px;
}
.law-badge {
  margin-top: 3rem;
  background: rgba(200,150,42,.15);
  border: 1px solid rgba(200,150,42,.3);
  border-radius: var(--radius-md);
  padding: 1rem 1.5rem;
  color: var(--gold-light);
  font-size: .8rem;
  font-weight: 500;
  text-align: left;
  max-width: 320px;
}
.law-badge strong { display: block; margin-bottom: .3rem; font-size: .85rem; }

/* Panel derecho formulario */
.login-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 2rem;
  background: var(--cream);
}
.login-box {
  width: 100%;
  max-width: 420px;
  animation: slideUp .45s ease both;
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}
.login-header { margin-bottom: 2rem; }
.login-header h2 { color: var(--navy); font-size: clamp(1.6rem, 4vw, 2rem); margin-bottom: .4rem; }
.login-header p  { color: var(--text-muted); font-size: .95rem; }
.login-footer {
  margin-top: 1.75rem;
  text-align: center;
  color: var(--text-muted);
  font-size: .8rem;
  line-height: 1.6;
}
.login-footer a { color: var(--navy); font-weight: 600; text-decoration: none; }

.show-password { position: relative; }
.show-password input { padding-right: 3rem; }
.toggle-pw {
  position: absolute; right: 1rem; top: 50%;
  transform: translateY(-50%);
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); font-size: 1.1rem;
  min-width: 44px; min-height: 44px;
  display: flex; align-items: center; justify-content: center;
}

/* ╔══════════════════════════════════════════════════════════╗
   ║  ALERTAS                                                ║
   ╚══════════════════════════════════════════════════════════╝ */
.alert {
  padding: .875rem 1rem;
  border-radius: var(--radius-md);
  margin-bottom: 1.25rem;
  font-weight: 500;
  font-size: .9rem;
}
.alert-success { background: var(--success-bg); border: 1px solid #bbf7d0; color: var(--success); }
.alert-danger  { background: var(--danger-bg);  border: 1px solid #fecaca; color: var(--danger); }
.alert-warning { background: var(--warning-bg); border: 1px solid #fde68a; color: var(--warning); }
.alert-info    { background: var(--info-bg);    border: 1px solid #bfdbfe; color: var(--info); }

/* Banner offline (fijo arriba) */
#offline-banner {
  display: none;
  position: sticky; top: 0; z-index: 99;
  background: #92400e; color: #fff;
  padding: .6rem 1rem;
  font-size: .85rem; font-weight: 500;
  text-align: center;
}

/* ╔══════════════════════════════════════════════════════════╗
   ║  CARDS                                                  ║
   ╚══════════════════════════════════════════════════════════╝ */
.card {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  border: 1px solid var(--cream-dark);
  margin-bottom: 1.25rem;
}
@media (min-width: 600px) {
  .card { padding: 1.5rem; margin-bottom: 1.5rem; }
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .75rem;
  margin-bottom: 1.1rem;
}
.card-header h3 { font-size: 1.1rem; color: var(--navy); }
.card-title    { font-size: 1.1rem; color: var(--navy); margin-bottom: 1.1rem; }

/* ╔══════════════════════════════════════════════════════════╗
   ║  STAT CARDS                                             ║
   ╚══════════════════════════════════════════════════════════╝ */
.stats-grid {
  display: grid;
  gap: .9rem;
  margin-bottom: 1.25rem;
}

/* Por defecto: 2 columnas en móvil */
.stats-grid { grid-template-columns: repeat(2, 1fr); }

/* Con clase extra para distintos conteos */
@media (min-width: 600px) {
  .stats-grid-3 { grid-template-columns: repeat(3, 1fr); }
  .stats-grid-4 { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 599px) {
  .stats-grid-3,
  .stats-grid-4 { grid-template-columns: repeat(2, 1fr); }
  /* El último hijo ocupa ancho completo si el número es impar */
  .stats-grid-3 > *:last-child:nth-child(odd),
  .stats-grid-4 > *:last-child:nth-child(odd) { grid-column: 1 / -1; }
}
@media (min-width: 900px) {
  .stats-grid-4 { grid-template-columns: repeat(4, 1fr); }
}

.stat-card {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 1rem 1.1rem;
  border: 1px solid var(--cream-dark);
}
@media (min-width: 600px) {
  .stat-card { padding: 1.25rem 1.5rem; }
}
.stat-card .label {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: .35rem;
}
.stat-card .value {
  font-size: clamp(1.4rem, 4vw, 1.9rem);
  font-weight: 700;
  color: var(--navy);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.stat-card .sub { font-size: .75rem; color: var(--text-muted); margin-top: .25rem; }
.stat-positive  { color: var(--success) !important; }
.stat-negative  { color: var(--danger)  !important; }

/* ╔══════════════════════════════════════════════════════════╗
   ║  GRIDS GENERALES                                        ║
   ╚══════════════════════════════════════════════════════════╝ */
.two-col {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
}
@media (min-width: 700px) {
  .two-col { grid-template-columns: 1fr 1fr; }
  .two-col-wide { grid-template-columns: 2fr 1fr; }
  .two-col-narrow { grid-template-columns: 360px 1fr; }
}

.three-col {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
}
@media (min-width: 700px)  { .three-col { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1000px) { .three-col { grid-template-columns: 1fr 1fr 1fr; } }

/* ╔══════════════════════════════════════════════════════════╗
   ║  FORMULARIOS                                            ║
   ╚══════════════════════════════════════════════════════════╝ */
.form-group { margin-bottom: 1rem; }

.form-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}
@media (min-width: 500px) {
  .form-row   { grid-template-columns: 1fr 1fr; }
  .form-row-3 { grid-template-columns: 1fr 1fr 1fr; }
}

label {
  display: block;
  font-size: .8rem;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: .35rem;
  text-transform: uppercase;
  letter-spacing: .05em;
}
label .req { color: var(--danger); }
.form-hint { font-size: .78rem; color: var(--text-muted); margin-top: .25rem; }

input[type="text"],
input[type="email"],
input[type="password"],
input[type="date"],
input[type="datetime-local"],
input[type="number"],
input[type="tel"],
input[type="time"],
select,
textarea {
  width: 100%;
  padding: .65rem .9rem;
  border: 1.5px solid var(--cream-dark);
  border-radius: var(--radius-sm);
  font-size: .9rem;
  color: var(--text);
  background: #fff;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  /* Altura mínima táctil */
  min-height: 44px;
  appearance: none;
  -webkit-appearance: none;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(15,31,61,.07);
}
/* Flecha select personalizada */
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236b7280' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right .75rem center;
  padding-right: 2.25rem;
  cursor: pointer;
}
textarea { resize: vertical; min-height: 80px; }

/* ╔══════════════════════════════════════════════════════════╗
   ║  BOTONES                                                ║
   ╚══════════════════════════════════════════════════════════╝ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  padding: .55rem 1.1rem;
  border-radius: var(--radius-sm);
  font-size: .875rem;
  font-weight: 600;
  border: 1.5px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s, color .15s, border-color .15s, transform .1s;
  white-space: nowrap;
  min-height: 44px;             /* área táctil */
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.btn:active { transform: scale(.97); }

.btn-primary   { background: var(--navy);    color: #fff;         border-color: var(--navy); }
.btn-primary:hover   { background: var(--navy-light); }
.btn-secondary { background: var(--gold);    color: var(--navy);  border-color: var(--gold); }
.btn-secondary:hover { background: var(--gold-light); }
.btn-outline   { background: transparent;    color: var(--navy);  border-color: var(--navy); }
.btn-outline:hover   { background: var(--navy); color: #fff; }
.btn-danger    { background: var(--danger);  color: #fff;         border-color: var(--danger); }
.btn-danger:hover    { background: #b91c1c; }
.btn-success   { background: var(--success); color: #fff;         border-color: var(--success); }
.btn-warning   { background: #fef3c7;        color: #92400e;      border-color: #fde68a; }
.btn-ghost     { background: transparent;    color: var(--text-muted); border-color: transparent; }
.btn-ghost:hover     { background: var(--cream-dark); color: var(--text); }

.btn-sm    { padding: .3rem .7rem; font-size: .78rem; min-height: 36px; }
.btn-lg    { padding: 1rem 1.75rem; font-size: 1rem; min-height: 52px; }
.btn-block { width: 100%; }

/* Botón de fichaje (grande, táctil) */
.btn-fichar {
  width: 100%; max-width: 340px;
  padding: 1.1rem 2rem;
  border: none; border-radius: var(--radius-xl);
  font-size: 1.1rem; font-weight: 700;
  cursor: pointer;
  transition: background .2s, transform .1s;
  letter-spacing: .02em;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  min-height: 60px;
}
.btn-fichar:active { transform: scale(.96); }
.btn-fichar.loading { opacity: .7; pointer-events: none; }

.btn-entrada { background: var(--gold);   color: var(--navy); box-shadow: 0 8px 30px rgba(200,150,42,.35); }
.btn-entrada:hover { background: var(--gold-light); }
.btn-salida  { background: #fff;          color: var(--navy); box-shadow: 0 8px 30px rgba(0,0,0,.12); }
.btn-salida:hover  { background: #f3f4f6; }

/* ╔══════════════════════════════════════════════════════════╗
   ║  TABLAS                                                 ║
   ╚══════════════════════════════════════════════════════════╝ */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-sm);
}
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left;
  padding: .55rem .75rem;
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-muted);
  font-weight: 600;
  border-bottom: 2px solid var(--cream-dark);
  white-space: nowrap;
}
td {
  padding: .7rem .75rem;
  font-size: .875rem;
  border-bottom: 1px solid var(--cream-dark);
}
tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--cream); }

/* En móvil muy pequeño: columnas compactas */
@media (max-width: 480px) {
  th, td { padding: .5rem; font-size: .8rem; }
}

/* ╔══════════════════════════════════════════════════════════╗
   ║  BADGES                                                 ║
   ╚══════════════════════════════════════════════════════════╝ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  padding: .2rem .6rem;
  border-radius: 100px;
  font-size: .72rem;
  font-weight: 700;
  white-space: nowrap;
}
.badge-green  { background: #dcfce7; color: #166534; }
.badge-red    { background: #fee2e2; color: #991b1b; }
.badge-yellow { background: #fef3c7; color: #92400e; }
.badge-blue   { background: #dbeafe; color: #1e40af; }
.badge-gold   { background: #fef9c3; color: #854d0e; }
.badge-navy   { background: #e0e7ff; color: var(--navy); }
.badge-gray   { background: #f3f4f6; color: #374151; }

/* ╔══════════════════════════════════════════════════════════╗
   ║  FICHAR CARD (empleado dashboard)                       ║
   ╚══════════════════════════════════════════════════════════╝ */
.fichar-card {
  background: var(--navy);
  border-radius: var(--radius-xl);
  padding: 2rem 1.5rem;
  text-align: center;
  margin-bottom: 1.25rem;
  position: relative;
  overflow: hidden;
}
@media (min-width: 600px) {
  .fichar-card { padding: 2.5rem; }
}
.fichar-card::before {
  content: '';
  position: absolute;
  width: 280px; height: 280px;
  background: radial-gradient(circle, rgba(200,150,42,.2) 0%, transparent 70%);
  top: -60px; right: -60px;
  pointer-events: none;
}
.fichar-card-inner { position: relative; z-index: 1; }

.estado-badge {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .35rem .9rem;
  border-radius: 100px;
  font-size: .82rem;
  font-weight: 600;
  margin-bottom: 1.1rem;
}
.estado-activo   { background: rgba(22,163,74,.2);    color: #4ade80; border: 1px solid rgba(22,163,74,.3); }
.estado-inactivo { background: rgba(255,255,255,.08); color: rgba(255,255,255,.6); border: 1px solid rgba(255,255,255,.15); }

.fichar-card h3 { color: #fff; font-size: clamp(1.3rem, 4vw, 1.6rem); margin-bottom: .4rem; }
.fichar-card p  { color: rgba(255,255,255,.55); font-size: .875rem; margin-bottom: 1.5rem; }

.timer-display {
  font-size: clamp(2.5rem, 10vw, 3.5rem);
  font-weight: 700;
  color: #fff;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.02em;
  margin-bottom: .2rem;
  line-height: 1;
}
.timer-label { color: rgba(255,255,255,.5); font-size: .82rem; margin-bottom: 1.5rem; }

/* ╔══════════════════════════════════════════════════════════╗
   ║  MODALES                                                ║
   ╚══════════════════════════════════════════════════════════╝ */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 500;
  align-items: flex-end; /* en móvil se desliza desde abajo */
  justify-content: center;
  backdrop-filter: blur(4px);
  padding: 0;
}
.modal-overlay.active { display: flex; }

@media (min-width: 600px) {
  .modal-overlay { align-items: center; padding: 1rem; }
}

.modal {
  background: #fff;
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  padding: 1.5rem;
  width: 100%;
  max-height: 90dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
}
@media (min-width: 600px) {
  .modal {
    border-radius: var(--radius-xl);
    max-width: 560px;
    width: 90%;
  }
  .modal-sm { max-width: 420px; }
  .modal-lg { max-width: 720px; }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}
.modal-header h3 { font-size: 1.2rem; color: var(--navy); }
.modal-close {
  background: none; border: none; font-size: 1.4rem;
  cursor: pointer; color: var(--text-muted);
  min-width: 44px; min-height: 44px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
}
.modal-close:hover { background: var(--cream-dark); }

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

/* ╔══════════════════════════════════════════════════════════╗
   ║  FILTROS / TOOLBAR                                      ║
   ╚══════════════════════════════════════════════════════════╝ */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .75rem;
  margin-bottom: 1.25rem;
}

.filters-bar {
  background: #fff;
  border-radius: var(--radius-md);
  padding: .875rem 1rem;
  border: 1px solid var(--cream-dark);
  margin-bottom: 1.25rem;
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  align-items: flex-end;
}
.filter-group { display: flex; flex-direction: column; gap: .3rem; }
.filter-group label {
  font-size: .72rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin: 0;
}

/* ╔══════════════════════════════════════════════════════════╗
   ║  MISCELÁNEA                                             ║
   ╚══════════════════════════════════════════════════════════╝ */
.empty-state {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--text-muted);
}
.empty-state .icon { font-size: 2.5rem; margin-bottom: .75rem; }
.empty-state p { font-size: .9rem; }

.legal-note {
  background: var(--info-bg);
  border: 1px solid #bfdbfe;
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  font-size: .82rem;
  color: var(--info);
  line-height: 1.6;
  margin-top: 1.25rem;
}
.legal-warning {
  background: var(--warning-bg);
  border: 1px solid #fde68a;
  border-radius: var(--radius-sm);
  padding: .75rem 1rem;
  font-size: .82rem;
  color: #92400e;
  line-height: 1.6;
}

.progress-bar { background: var(--cream-dark); border-radius: 100px; height: 6px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 100px; background: linear-gradient(90deg, var(--navy), var(--gold)); transition: width .4s; }

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

.divider { height: 1px; background: var(--cream-dark); margin: 1.25rem 0; }

.text-muted  { color: var(--text-muted); }
.text-sm     { font-size: .8rem; }
.text-xs     { font-size: .72rem; }
.fw-bold     { font-weight: 700; }
.fw-semi     { font-weight: 600; }

.flex          { display: flex; }
.flex-center   { display: flex; align-items: center; gap: .75rem; }
.flex-between  { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.flex-wrap     { flex-wrap: wrap; }
.gap-sm        { gap: .5rem; }
.gap-md        { gap: 1rem; }

/* PWA install banner */
#pwa-install-btn {
  display: none;
  align-items: center; gap: .75rem;
  background: rgba(200,150,42,.12);
  border: 1px solid rgba(200,150,42,.3);
  border-radius: var(--radius-lg);
  padding: .9rem 1rem;
  margin-bottom: 1.25rem;
  cursor: pointer;
  width: 100%;
  -webkit-tap-highlight-color: transparent;
}
#pwa-install-btn .pwa-icon { font-size: 1.4rem; flex-shrink: 0; }
#pwa-install-btn .pwa-text { flex: 1; text-align: left; }
#pwa-install-btn .pwa-text strong { display: block; color: var(--gold); font-size: .9rem; }
#pwa-install-btn .pwa-text span   { font-size: .78rem; color: var(--text-muted); }
#pwa-install-btn .pwa-arrow       { color: var(--gold); font-size: 1.2rem; flex-shrink: 0; }

/* ── Print básico ────────────────────────────────────────── */
@media print {
  .sidebar, .mobile-topbar, .bottom-nav,
  .btn-logout, .btn-fichar, #pwa-install-btn { display: none !important; }
  .main { margin-left: 0 !important; }
  .content { padding: 0 !important; }
  body { background: #fff; }
}
