:root {
  --fondo: #f4f6f8;
  --tarjeta: #ffffff;
  --texto: #1d2530;
  --suave: #5d6b7a;
  --borde: #dde3e9;
  --primario: #1f5f99;
  --primario-oscuro: #174a78;
  --verde: #1e8a4c;
  --ambar: #c27c0e;
  --rojo: #b3261e;
  --fila-aviso: #fff6e5;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--fondo);
  color: var(--texto);
  line-height: 1.45;
}
a { color: var(--primario); }

.barra {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 20px;
  padding: 12px 20px; background: var(--primario-oscuro); color: #fff;
}
.barra a { color: #fff; text-decoration: none; }
.marca { font-weight: 700; }
.marca span { font-weight: 400; opacity: .8; }
.barra nav { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; font-size: .95rem; }
.barra nav a:hover, .barra .enlace:hover { text-decoration: underline; }

main { max-width: 1000px; margin: 0 auto; padding: 20px 16px 40px; }
h1 { font-size: 1.4rem; margin: 0 0 14px; }
h2 { font-size: 1.1rem; margin: 0 0 12px; }

.tarjeta {
  background: var(--tarjeta); border: 1px solid var(--borde); border-radius: 10px;
  padding: 20px; margin-bottom: 18px;
}
.tarjeta.estrecha { max-width: 420px; margin: 40px auto; }
.cabecera-seccion { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; }

.aviso { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; border: 1px solid; }
.aviso.ok { background: #e8f5ec; border-color: #b5dcc2; color: #14522e; }
.aviso.error { background: #fbeaea; border-color: #eab8b5; color: #7d1a14; }
.aviso.info { background: #e8f0f8; border-color: #b9cfe6; color: #173f66; }
.nota { color: var(--suave); font-size: .88rem; margin-top: 14px; }
.vacio { color: var(--suave); text-align: center; padding: 14px; }

button, .boton {
  display: inline-block; font: inherit; cursor: pointer; text-decoration: none;
  padding: 8px 16px; border-radius: 7px; border: 1px solid var(--primario);
  background: var(--primario); color: #fff;
}
button:hover, .boton:hover { background: var(--primario-oscuro); }
button.secundario, .boton.secundario { background: #fff; color: var(--primario); }
button.secundario:hover, .boton.secundario:hover { background: #eef4fa; }
button.enlace { background: none; border: none; color: inherit; padding: 0; }
.en-linea { display: inline; }
.botones { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }

.formulario { display: flex; flex-direction: column; gap: 12px; }
.formulario.rejilla { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.formulario .ancho { grid-column: 1 / -1; }
.formulario .acciones { grid-column: 1 / -1; display: flex; gap: 10px; }
label { display: flex; flex-direction: column; gap: 4px; font-size: .9rem; color: var(--suave); }
input, select {
  font: inherit; color: var(--texto); padding: 8px 10px;
  border: 1px solid var(--borde); border-radius: 7px; background: #fff;
}
.filtros { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; margin-bottom: 16px; }

.tabla-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .93rem; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--borde); vertical-align: top; }
thead th { background: #eef2f6; font-weight: 600; }
tfoot th { border-bottom: none; }
tr.fila-incidencia td { background: var(--fila-aviso); }
tr.anulado td { color: var(--suave); }
tr.anulado td:first-child, tr.anulado td:nth-child(2) { text-decoration: line-through; }
tr.inactivo td { color: var(--suave); }
td.detalle { font-size: .85rem; color: var(--suave); }
form.anular { display: flex; gap: 6px; }
form.anular input { width: 130px; padding: 5px 8px; }
form.anular button { padding: 5px 10px; }
.etiqueta {
  display: inline-block; font-size: .75rem; padding: 1px 7px; border-radius: 10px;
  background: #e8f0f8; color: #173f66; white-space: nowrap;
}

.fichaje { text-align: center; }
.fecha-hoy { color: var(--suave); margin: 0; }
.estado { font-size: 1.6rem; font-weight: 700; margin: 6px 0 18px; }
.estado-trabajando { color: var(--verde); }
.estado-pausa { color: var(--ambar); }
.estado-fuera { color: var(--suave); }
.botones-fichaje { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-bottom: 22px; }
.botones-fichaje button { font-size: 1.15rem; padding: 16px 28px; min-width: 180px; border-radius: 10px; }
.boton-entrada { background: var(--verde); border-color: var(--verde); }
.boton-entrada:hover { background: #176b3b; }
.boton-pausa_inicio, .boton-pausa_fin { background: var(--ambar); border-color: var(--ambar); }
.boton-pausa_inicio:hover, .boton-pausa_fin:hover { background: #9e650b; }
.boton-salida { background: var(--rojo); border-color: var(--rojo); }
.boton-salida:hover { background: #8f1e18; }
.contadores { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px 36px; }
.contadores div { display: flex; flex-direction: column; }
.contadores span { color: var(--suave); font-size: .85rem; }
.contadores strong { font-size: 1.4rem; font-variant-numeric: tabular-nums; }

.lista-eventos { list-style: none; padding: 0; margin: 0; }
.lista-eventos li { padding: 6px 0; border-bottom: 1px solid var(--borde); }
.lista-eventos time { font-weight: 600; font-variant-numeric: tabular-nums; margin-right: 8px; }
.lista-eventos .incidencia { color: var(--ambar); }
.lista-simple li { padding: 3px 0; }

.punto { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 7px; background: currentColor; }

h3 { font-size: 1rem; margin: 22px 0 10px; }
h2.separado { margin-top: 26px; }
.suave { color: var(--suave); font-size: .88rem; }
textarea {
  font: inherit; color: var(--texto); padding: 8px 10px; width: 100%;
  border: 1px solid var(--borde); border-radius: 7px; resize: vertical;
}
.actual {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px;
  padding: 12px 14px; border-radius: 8px; background: #e8f5ec; border: 1px solid #b5dcc2;
}
.buscador { width: 100%; margin-bottom: 8px; }
.lista-tareas { list-style: none; padding: 0; margin: 0; max-height: 360px; overflow-y: auto;
  border: 1px solid var(--borde); border-radius: 8px; }
.lista-tareas li { border-bottom: 1px solid var(--borde); }
.lista-tareas li:last-child { border-bottom: none; }
.lista-tareas form { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 12px; }
.lista-tareas button { padding: 5px 12px; flex-shrink: 0; }
.tarea-texto { min-width: 0; }
.tarea-texto .suave { display: block; }
.en-curso { color: var(--verde); font-weight: 600; font-size: .88rem; flex-shrink: 0; }
.resumen-texto { white-space: pre-line; margin-top: 4px; }
.etiqueta.auto { background: #eef6ea; color: #1e6b3a; }
