/* CrediSan Control · panel administrativo
   Mobile first: el panel se usa desde el teléfono tanto como desde el
   escritorio, así que la navegación vive abajo y los toques miden 48 px. */

/* ── Acceso ──────────────────────────────────────────────────────────── */
.acceso {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 1.5rem 1rem;
  background: var(--morado);
}
.acceso__caja {
  width: 100%; max-width: 380px;
  background: var(--blanco);
  border-radius: var(--radio);
  padding: 1.75rem 1.5rem;
  box-shadow: 0 8px 40px rgba(0,0,0,.25);
}
.acceso__logo { width: 200px; margin: 0 auto 1.75rem; display: block; }

/* ── Campos ──────────────────────────────────────────────────────────── */
.campo { margin-bottom: 1rem; }
.campo label {
  display: block;
  font-size: .82rem; font-weight: 600;
  margin-bottom: .35rem; color: var(--texto);
}
.campo input, .campo select {
  width: 100%; min-height: 46px;
  padding: .6rem .75rem;
  border: 1.5px solid var(--linea); border-radius: 10px;
  font-family: inherit; font-size: 1rem; color: var(--texto);
  background: var(--blanco);
}
.campo input:focus, .campo select:focus {
  outline: none; border-color: var(--morado);
  box-shadow: 0 0 0 3px rgba(102,45,145,.12);
}
.campo input:disabled { background: #F1EEF5; color: var(--texto-suave); }
.campo--mitad { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.campo--mitad > div { margin: 0; }
.ayuda { font-size: .78rem; color: var(--texto-suave); margin-top: .3rem; }

/* ── Avisos ──────────────────────────────────────────────────────────── */
.aviso {
  padding: .8rem .9rem; border-radius: 10px;
  font-size: .88rem; margin-bottom: 1rem;
  border-left: 4px solid;
}
.aviso[data-t="error"] { background: #FDECEA; border-color: var(--rojo);  color: #8A2A1F; }
.aviso[data-t="ok"]    { background: #E8F5EA; border-color: var(--verde); color: #14622B; }
.aviso[data-t="info"]  { background: #F3EDF9; border-color: var(--morado);color: #4A1F6B; }
.aviso[hidden] { display: none; }

/* ── Estructura del panel ────────────────────────────────────────────── */
.cabecera {
  background: var(--morado); color: var(--blanco);
  padding: .9rem 1rem;
  display: flex; align-items: center; gap: .75rem;
  position: sticky; top: 0; z-index: 10;
}
.cabecera__logo { height: 26px; width: auto; }
.cabecera__quien { margin-left: auto; text-align: right; line-height: 1.25; }
.cabecera__quien strong { display: block; font-size: .85rem; font-weight: 600; }
.cabecera__quien span   { font-size: .72rem; color: var(--amarillo); }
.cabecera__salir {
  background: rgba(255,255,255,.14); border: 0; color: var(--blanco);
  width: 40px; height: 40px; border-radius: 10px;
  font-size: 1.1rem; cursor: pointer;
}

.vista { max-width: 760px; margin: 0 auto; padding: 1rem 1rem 6rem; }
.vista[hidden] { display: none; }
.vista h1 { font-size: 1.25rem; margin: .25rem 0 1rem; }

/* ── Navegación inferior ─────────────────────────────────────────────── */
.nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 20;
  display: flex;
  background: var(--blanco);
  border-top: 1px solid var(--linea);
  padding-bottom: env(safe-area-inset-bottom);
}
.nav button {
  flex: 1; min-height: 58px;
  border: 0; background: none; cursor: pointer;
  font-family: inherit; font-size: .72rem; font-weight: 600;
  color: var(--texto-suave);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .15rem;
  position: relative;            /* para la insignia de novedades pendientes */
}
.nav button span { font-size: 1.15rem; line-height: 1; }
.nav button[aria-current="true"] { color: var(--morado); }
.nav button[hidden] { display: none; }

/* ── Listas ──────────────────────────────────────────────────────────── */
.ficha {
  background: var(--blanco); border-radius: 12px;
  box-shadow: var(--sombra);
  padding: .9rem 1rem; margin-bottom: .65rem;
  display: flex; align-items: center; gap: .85rem;
}
.ficha__inicial {
  flex: 0 0 40px; width: 40px; height: 40px; border-radius: 50%;
  background: var(--morado); color: var(--blanco);
  display: grid; place-items: center; font-weight: 700; font-size: .95rem;
}
.ficha__cuerpo { flex: 1; min-width: 0; }
.ficha__cuerpo strong { display: block; font-size: .95rem; }
.ficha__cuerpo span   { font-size: .82rem; color: var(--texto-suave); }
.ficha__accion {
  border: 1.5px solid var(--linea); background: var(--blanco);
  border-radius: 8px; padding: .4rem .6rem;
  font-family: inherit; font-size: .78rem; font-weight: 600;
  color: var(--morado); cursor: pointer; white-space: nowrap;
}

.pastilla {
  display: inline-block; padding: .15rem .5rem; border-radius: 999px;
  font-size: .7rem; font-weight: 700; letter-spacing: .02em;
}
.pastilla--activo   { background: #E8F5EA; color: #14622B; }
.pastilla--inactivo { background: #F1EEF5; color: var(--texto-suave); }
.pastilla--pin      { background: #FFF9CC; color: #7A6A00; }
.pastilla--horario  { background: #EAE3F5; color: var(--morado); }
.pastilla--documento { background: #E8F5EA; color: #14622B; }
.pastilla--falta     { background: #FDECEC; color: #97231F; }

/* Aviso a administración: cuántas novedades esperan en el botón */
.insignia {
  position: absolute; top: .3rem; left: 50%; margin-left: .55rem;
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
  background: #C0392B; color: #fff; font-size: .68rem; font-weight: 700;
  font-style: normal; line-height: 18px; text-align: center;
}
.insignia[hidden] { display: none; }

/* ── Horarios ────────────────────────────────────────────────────────── */
.dia {
  background: var(--blanco); border-radius: 12px;
  box-shadow: var(--sombra); padding: .9rem 1rem; margin-bottom: .65rem;
}
.dia__cabeza { display: flex; align-items: center; gap: .75rem; }
.dia__cabeza strong { flex: 1; font-size: .95rem; }
.dia__horas { margin-top: .85rem; display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.dia__horas[hidden] { display: none; }
.dia__horas label { font-size: .75rem; color: var(--texto-suave); display: block; margin-bottom: .2rem; }
.dia__horas input { width: 100%; min-height: 42px; padding: .4rem .5rem;
  border: 1.5px solid var(--linea); border-radius: 8px; font-family: inherit; font-size: .95rem; }

/* Interruptor */
.suiche { position: relative; width: 46px; height: 26px; flex: 0 0 46px; }
.suiche input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.suiche i {
  position: absolute; inset: 0; border-radius: 999px;
  background: #CFC7D8; transition: background .18s; pointer-events: none;
}
.suiche i::after {
  content: ''; position: absolute; top: 3px; left: 3px;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--blanco); transition: transform .18s;
}
.suiche input:checked + i { background: var(--morado); }
.suiche input:checked + i::after { transform: translateX(20px); }
.suiche input:focus-visible + i { box-shadow: 0 0 0 3px rgba(102,45,145,.25); }

/* ── Varios ──────────────────────────────────────────────────────────── */
.vacio { text-align: center; color: var(--texto-suave); padding: 2.5rem 1rem; font-size: .9rem; }
.cargando { text-align: center; color: var(--texto-suave); padding: 2rem; font-size: .9rem; }
.boton--secundario { background: var(--blanco); color: var(--morado); border: 1.5px solid var(--morado); }
.boton--secundario:hover { background: #F7F2FC; }
.fila-botones { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; margin-top: 1rem; }
.encabezado-vista { display: flex; align-items: center; gap: .75rem; margin-bottom: 1rem; }
.encabezado-vista h1 { margin: 0; flex: 1; }
.encabezado-vista .boton { width: auto; min-height: 40px; padding: .5rem .9rem; font-size: .85rem; }

/* ── Tableros ────────────────────────────────────────────────────────── */

/* Selector de período: Hoy · Semana · Mes */
.periodos {
  display: flex; gap: .4rem; margin-bottom: 1rem;
  background: rgba(102,45,145,.07); padding: .3rem; border-radius: 12px;
}
.periodos button {
  flex: 1; min-height: 40px; border: 0; border-radius: 9px;
  background: none; color: var(--texto-suave);
  font-family: inherit; font-size: .88rem; font-weight: 600; cursor: pointer;
}
.periodos button[aria-current="true"] {
  background: var(--blanco); color: var(--morado);
  box-shadow: 0 1px 4px rgba(74,31,107,.12);
}

/* Cifras grandes: se leen de un vistazo, que es para lo que están */
.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: .6rem; }
@media (min-width: 560px) { .kpis { grid-template-columns: repeat(4, 1fr); } }

.kpi {
  background: var(--blanco); border-radius: 12px;
  box-shadow: var(--sombra); padding: .9rem;
  text-align: center;
  border-top: 3px solid var(--linea);
}
.kpi strong {
  display: block; font-size: 1.9rem; font-weight: 700; line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.kpi span { display: block; font-size: .76rem; color: var(--texto-suave); margin-top: .15rem; }
.kpi[data-t="bien"]  { border-top-color: var(--verde); }
.kpi[data-t="bien"] strong  { color: var(--verde); }
.kpi[data-t="aviso"] { border-top-color: var(--ambar); }
.kpi[data-t="aviso"] strong { color: var(--ambar); }
.kpi[data-t="mal"]   { border-top-color: var(--rojo); }
.kpi[data-t="mal"] strong   { color: var(--rojo); }
.kpi[data-t="info"]  { border-top-color: var(--morado); }
.kpi[data-t="info"] strong  { color: var(--morado); }

/* Estado de cada trabajador en la lista de hoy */
.estado-punto {
  flex: 0 0 10px; width: 10px; height: 10px; border-radius: 50%;
  background: var(--texto-suave); margin-top: .45rem;
}
.estado-punto[data-e="presente"]   { background: var(--verde); }
.estado-punto[data-e="completo"]   { background: var(--verde); }
.estado-punto[data-e="anticipado"] { background: var(--verde); }
.estado-punto[data-e="retrasado"]  { background: var(--ambar); }
.estado-punto[data-e="faltante"]   { background: var(--rojo); }
.estado-punto[data-e="esperado"]   { background: #CFC7D8; }
.estado-punto[data-e="descanso"]   { background: #E3DEE9; }

.horas {
  font-variant-numeric: tabular-nums;
  font-size: .82rem; color: var(--texto-suave); white-space: nowrap;
}
.horas strong { color: var(--texto); font-weight: 600; }

/* Barra de comparación entre sedes */
.barra {
  height: 6px; border-radius: 999px; background: rgba(102,45,145,.12);
  margin-top: .45rem; overflow: hidden;
}
.barra i { display: block; height: 100%; background: var(--morado); border-radius: 999px; }

/* Novedades */
.novedad { background: var(--blanco); border-radius: 12px; box-shadow: var(--sombra);
  padding: .9rem 1rem; margin-bottom: .65rem; border-left: 4px solid var(--linea); }
.novedad[data-e="pendiente"] { border-left-color: var(--ambar); }
.novedad[data-e="aprobada"]  { border-left-color: var(--verde); }
.novedad[data-e="rechazada"] { border-left-color: var(--rojo); }
.novedad h3 { margin: 0 0 .15rem; font-size: .95rem; }
.novedad p  { margin: 0 0 .35rem; font-size: .88rem; color: var(--texto-suave); }
.novedad__pie { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap;
  font-size: .76rem; color: var(--texto-suave); }
.novedad__acciones { display: flex; gap: .5rem; margin-top: .7rem; }
.novedad__acciones button { flex: 1; min-height: 40px; border-radius: 9px;
  font-family: inherit; font-size: .85rem; font-weight: 600; cursor: pointer; border: 1.5px solid; }
.btn-aprobar { background: var(--blanco); color: var(--verde); border-color: var(--verde); }
.btn-rechazar { background: var(--blanco); color: var(--rojo); border-color: var(--rojo); }

/* ── Fase 5 · cierres, auditoría y el menú «Más» ───────────────────── */

/* Una ficha que además es botón: mismo aspecto, pero pulsable */
.ficha--boton {
  width: 100%; text-align: left; border: none; cursor: pointer;
  font: inherit; color: inherit;
}
.ficha--boton:hover  { border-color: var(--morado); }
.ficha--boton:active { transform: scale(.995); }
.ficha--boton .ficha__inicial { font-size: 1.15rem; }

/* Las tres cifras gruesas de cada cierre semanal */
.cierre-cifras {
  display: flex; flex-wrap: wrap; gap: .25rem 1.1rem;
  margin: .5rem 0 .35rem; font-size: .84rem; color: var(--texto-suave);
}
.cierre-cifras strong {
  color: var(--negro); font-variant-numeric: tabular-nums; font-size: .98rem;
}

/* El antes y el después de cada cambio auditado */
.cambios {
  list-style: none; margin: .6rem 0 0; padding: .6rem 0 0;
  border-top: 1px solid var(--linea); font-size: .8rem;
}
.cambios li { margin-bottom: .25rem; word-break: break-word; }
.cambios b  { color: var(--morado); font-weight: 600; }
.cambios s  { color: var(--texto-suave); text-decoration-color: var(--rojo); }
.cambios i  { color: var(--negro); font-style: normal; font-weight: 600; }

/* La foto de ficha dentro del círculo de iniciales */
.ficha__inicial[data-con-foto] { padding: 0; overflow: hidden; }
.ficha__inicial img {
  width: 100%; height: 100%; object-fit: cover; display: block; border-radius: inherit;
}

/* El «ver foto» de una marcación: discreto, pero visible */
.ver-foto {
  font-size: .72rem; color: var(--morado); font-weight: 600;
  white-space: nowrap;
}
