/* Panel de gestión y páginas de acceso. Sobrio, pocos elementos: cada pantalla
   que genera dudas genera un ticket, y a 12 €/mes no hay soporte. */

:root {
    --azul: #2563eb;
    --azul-osc: #1d4ed8;
    --tinta: #0f172a;
    --gris: #64748b;
    --gris-cl: #94a3b8;
    --linea: #e2e8f0;
    --fondo: #f1f5f9;
    --panel: #ffffff;
    --verde: #16a34a;
    --rojo: #dc2626;
    --ambar: #d97706;
    --radio: 0.7rem;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
.oculto { display: none !important; }
body {
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    background: var(--fondo);
    color: var(--tinta);
    line-height: 1.5;
    -webkit-text-size-adjust: 100%;
}

a { color: var(--azul); }

/* ── Cabecera del panel ── */
.app-top {
    background: var(--panel);
    border-bottom: 1px solid var(--linea);
    position: sticky; top: 0; z-index: 20;
}
.app-top .wrap {
    max-width: 68rem; margin: 0 auto; padding: 0 1.25rem;
    display: flex; align-items: center; gap: 1.5rem; min-height: 3.5rem;
}
.app-marca { font-weight: 800; font-size: 1.15rem; text-decoration: none; color: var(--tinta); }
.app-marca span { color: var(--azul); }
.app-nav { display: flex; gap: 0.25rem; flex: 1; flex-wrap: wrap; }
.app-nav a {
    padding: 0.4rem 0.8rem; border-radius: 0.5rem; text-decoration: none;
    color: var(--gris); font-weight: 600; font-size: 0.95rem;
}
.app-nav a:hover { background: var(--fondo); color: var(--tinta); }
.app-nav a.activo { background: #eff6ff; color: var(--azul); }
.app-user { display: flex; align-items: center; gap: 0.75rem; font-size: 0.9rem; color: var(--gris); }
.app-user form { margin: 0; }

.app-main { max-width: 68rem; margin: 0 auto; padding: 1.75rem 1.25rem 4rem; }

h1 { font-size: 1.6rem; margin: 0 0 0.35rem; }
.sub { color: var(--gris); margin: 0 0 1.5rem; }

/* ── Tarjetas ── */
.card {
    background: var(--panel); border: 1px solid var(--linea);
    border-radius: var(--radio); padding: 1.5rem;
}
.card + .card { margin-top: 1.25rem; }

/* ── Formularios ── */
.campo { margin-bottom: 1.1rem; }
.campo label { display: block; font-weight: 600; margin-bottom: 0.35rem; font-size: 0.95rem; }
.campo .ayuda { color: var(--gris); font-size: 0.85rem; margin-top: 0.3rem; }
input[type=text], input[type=email], input[type=password], input[type=number], select, textarea {
    width: 100%; padding: 0.65rem 0.8rem; border: 1px solid var(--linea);
    border-radius: 0.55rem; font-size: 1rem; font-family: inherit; background: #fff; color: var(--tinta);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--azul); border-color: var(--azul); }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
    padding: 0.7rem 1.3rem; border: none; border-radius: 0.55rem;
    font-size: 1rem; font-weight: 700; cursor: pointer; text-decoration: none;
    background: var(--fondo); color: var(--tinta);
}
.btn-primary { background: var(--azul); color: #fff; }
.btn-primary:hover { background: var(--azul-osc); }
.btn-lg { padding: 0.85rem 1.6rem; font-size: 1.05rem; }
.btn-ghost { background: transparent; color: var(--gris); }
.btn-danger { background: transparent; color: var(--rojo); }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

/* ── Avisos ── */
.aviso { padding: 0.85rem 1.1rem; border-radius: 0.55rem; margin-bottom: 1.25rem; font-size: 0.95rem; }
.aviso-error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.aviso-ok { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.aviso-info { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }

/* ── Pantallas de acceso (alta / login), centradas ── */
.auth-wrap { min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 1.5rem; }
.auth-box { width: 100%; max-width: 26rem; }
.auth-box .marca { text-align: center; font-weight: 800; font-size: 1.6rem; margin-bottom: 1.5rem; }
.auth-box .marca span { color: var(--azul); }
.auth-box .card { padding: 1.75rem; }
.auth-alt { text-align: center; margin-top: 1.25rem; color: var(--gris); font-size: 0.95rem; }

/* ── Tabla editable de empleados ── */
table.tabla { width: 100%; border-collapse: collapse; }
table.tabla th, table.tabla td { text-align: left; padding: 0.55rem 0.6rem; border-bottom: 1px solid var(--linea); }
table.tabla th { font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.03em; color: var(--gris); font-weight: 700; }
table.tabla td input { border: 1px solid transparent; background: transparent; padding: 0.45rem 0.5rem; }
table.tabla td input:focus { border-color: var(--azul); background: #fff; }
table.tabla .col-borrar { width: 3rem; text-align: center; }
.icono-borrar { background: none; border: none; color: var(--gris-cl); cursor: pointer; font-size: 1.2rem; line-height: 1; }
.icono-borrar:hover { color: var(--rojo); }

.acciones { display: flex; gap: 0.75rem; align-items: center; margin-top: 1.25rem; flex-wrap: wrap; }
.pega-ayuda { color: var(--gris); font-size: 0.85rem; }

@media (max-width: 34rem) {
    .cuenta-grid { grid-template-columns: 1fr !important; }
}

/* ── Panel "Hoy" ── */
.hoy-lista { list-style: none; margin: 0; padding: 0; }
.hoy-fila { display: flex; align-items: center; gap: 0.9rem; padding: 1rem 1.25rem; border-bottom: 1px solid var(--linea); }
.hoy-fila:last-child { border-bottom: none; }
.hoy-punto { width: 0.7rem; height: 0.7rem; border-radius: 50%; flex: 0 0 auto; background: var(--gris-cl); }
.hoy-nombre { font-weight: 600; flex: 1; }
.hoy-estado { color: var(--gris); font-size: 0.95rem; text-align: right; }
.hoy-desde { color: var(--gris-cl); font-size: 0.85rem; display: block; }

.hoy-fila.estado-dentro .hoy-punto { background: var(--verde); }
.hoy-fila.estado-dentro .hoy-estado { color: var(--verde); font-weight: 600; }
/* En pausa: color propio (ámbar), distinto de "dentro". */
.hoy-fila.estado-pausa .hoy-punto { background: var(--ambar); }
.hoy-fila.estado-pausa .hoy-estado { color: var(--ambar); font-weight: 600; }
.hoy-fila.estado-fuera .hoy-punto { background: var(--gris-cl); }

/* Los que no han fichado: en rojo (la única alerta de la app). */
.hoy-fila.estado-no_fichado { background: #fef2f2; }
.hoy-fila.estado-no_fichado .hoy-punto { background: var(--rojo); }
.hoy-fila.estado-no_fichado .hoy-nombre { color: #991b1b; }
.hoy-fila.estado-no_fichado .hoy-estado { color: var(--rojo); font-weight: 700; }

/* ── Panel "Mes" (parrilla) ── */
.mes-leyenda { display: flex; gap: 1.25rem; flex-wrap: wrap; color: var(--gris); font-size: 0.85rem; margin-bottom: 1rem; }
.mes-leyenda span { display: inline-flex; align-items: center; gap: 0.4rem; }
.mk { width: 0.9rem; height: 0.9rem; border-radius: 0.2rem; display: inline-block; }
.mk-salida { background: #fecaca; border: 1px solid var(--rojo); }
.mk-exceso { background: #fde68a; border: 1px solid var(--ambar); }
.mk-falta { background: #e2e8f0; border: 1px solid var(--gris-cl); }

.mes-scroll { overflow-x: auto; border: 1px solid var(--linea); border-radius: var(--radio); background: var(--panel); }
.mes-tabla { border-collapse: collapse; font-size: 0.85rem; }
.mes-tabla th, .mes-tabla td { border-bottom: 1px solid var(--linea); border-right: 1px solid var(--linea); text-align: center; padding: 0.4rem; white-space: nowrap; }
.mes-tabla thead th { position: sticky; top: 0; background: #f8fafc; color: var(--gris); font-weight: 700; z-index: 2; }
.col-nombre { position: sticky; left: 0; background: var(--panel); text-align: left !important; font-weight: 600; min-width: 9rem; z-index: 1; }
.mes-tabla thead .col-nombre { z-index: 3; }
.col-dia { width: 2.2rem; min-width: 2.2rem; }
.col-total { font-weight: 700; min-width: 4.5rem; background: #f8fafc; }
.mes-tabla th.finde, .mes-tabla td.finde { background: #f1f5f9; color: var(--gris-cl); }
.celda { color: var(--tinta); font-variant-numeric: tabular-nums; }
.celda.hoy { box-shadow: inset 0 0 0 2px var(--azul); }
.celda[role=button] { cursor: pointer; }
.celda[role=button]:hover { background: #eff6ff; }
.celda.inc-salida { background: #fecaca; color: #991b1b; font-weight: 700; }
.celda.inc-exceso { background: #fde68a; color: #92400e; font-weight: 700; }
.celda.inc-falta { background: #e2e8f0; }
.celda.inc-falta::after { content: "–"; color: var(--gris); font-weight: 700; }
.col-total .saldo { display: block; font-size: 0.78rem; font-weight: 700; }
.col-total .saldo.pos { color: var(--verde); }
.col-total .saldo.neg { color: var(--rojo); }

/* ── Modal de corrección ── */
.modal-fondo { position: fixed; inset: 0; background: rgba(15,23,42,0.5); display: flex; align-items: center; justify-content: center; padding: 1rem; z-index: 50; }
.modal { background: var(--panel); border-radius: var(--radio); width: 100%; max-width: 30rem; max-height: 90vh; overflow: auto; }
.modal-cab { display: flex; justify-content: space-between; align-items: center; padding: 1.1rem 1.25rem; border-bottom: 1px solid var(--linea); }
.modal-x { background: none; border: none; font-size: 1.5rem; line-height: 1; color: var(--gris); cursor: pointer; }
.modal-cuerpo { padding: 1.25rem; }
.mc-registros { margin-bottom: 1.25rem; }
.mc-reg { display: flex; justify-content: space-between; padding: 0.5rem 0.7rem; border: 1px solid var(--linea); border-radius: 0.5rem; margin-bottom: 0.4rem; font-size: 0.92rem; }
.mc-reg.corregido { color: var(--gris-cl); text-decoration: line-through; }
.mc-reg .mc-tag { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; color: var(--azul); text-decoration: none; }
.mc-reg .mc-motivo { display: block; font-size: 0.78rem; color: var(--gris); text-decoration: none; }
.mc-vacio { color: var(--gris); font-size: 0.9rem; }
