:root {
  color-scheme: light;
  --bg: #f4f4f2; --surface: #fcfcfb; --surface-2: #f0efec; --border: #e2e1dc;
  --text: #0b0b0b; --text-2: #52514e; --muted: #7a7974;
  --accent: #2a78d6; --accent-soft: #e3eefb;
  --good: #0a7d0a; --bad: #c22f2f; --warn-bg: #fff4d6; --warn-text: #6b4a00;
  --radius: 12px; --shadow: 0 1px 2px rgba(0,0,0,.05), 0 2px 8px rgba(0,0,0,.04);
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #121211; --surface: #1a1a19; --surface-2: #232321; --border: #33332f;
    --text: #f0efec; --text-2: #c3c2b7; --muted: #8f8e86;
    --accent: #3987e5; --accent-soft: #1d2b3d;
    --good: #4cc24c; --bad: #ff7b7b; --warn-bg: #3a2f12; --warn-text: #f3d48a;
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
.app { max-width: 560px; margin: 0 auto; height: 100%; display: flex; flex-direction: column; position: relative; }
header { background: var(--surface); border-bottom: 1px solid var(--border); padding: calc(10px + env(safe-area-inset-top)) 16px 10px; flex: none; }
.fila-cab { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 30px; }
.titulo { font-weight: 650; font-size: 17px; }
.ojo { border: 1px solid var(--border); background: var(--surface-2); color: var(--text-2); border-radius: 20px; padding: 4px 12px; font: inherit; font-size: 13px; cursor: pointer; }
.foto { margin-top: 4px; font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.punto { width: 7px; height: 7px; border-radius: 50%; background: var(--good); flex: none; }
.punto.viejo { background: #d9a400; }
.punto.sin-red { background: var(--bad); }
.aviso-pend { margin-top: 8px; background: var(--warn-bg); color: var(--warn-text); border-radius: 8px; padding: 6px 10px; font-size: 13px; cursor: pointer; }
main { flex: 1; overflow-y: auto; padding: 14px 14px calc(90px + env(safe-area-inset-bottom)); }
nav.tabs { position: absolute; bottom: 0; left: 0; right: 0; display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--surface); border-top: 1px solid var(--border); padding: 6px 4px calc(10px + env(safe-area-inset-bottom)); }
nav.tabs[hidden] { display: none; }
nav.tabs button { background: none; border: 0; color: var(--muted); font: inherit; font-size: 11px; display: flex; flex-direction: column;
  align-items: center; gap: 2px; cursor: pointer; padding: 4px 0; position: relative; }
nav.tabs button .ic { font-size: 20px; line-height: 1; }
nav.tabs button.activo { color: var(--accent); font-weight: 600; }
.badge { position: absolute; top: 0; right: 22%; background: var(--bad); color: #fff; border-radius: 9px; font-size: 10px; padding: 0 5px; min-width: 16px; }
h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 18px 4px 8px; font-weight: 600; }
h2:first-child { margin-top: 0; }
.tarjeta { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; }
.tarjeta + .tarjeta { margin-top: 10px; }
.grande { font-size: 30px; font-weight: 650; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.sub { color: var(--text-2); font-size: 13px; }
.centro { text-align: center; }
.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.kpis .tarjeta + .tarjeta { margin-top: 0; }
.kpi .v { font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
.kpi .e { font-size: 12.5px; color: var(--muted); }
.lista { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.it { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-top: 1px solid var(--border); }
.it:first-child { border-top: 0; }
.it .izq { flex: 1; min-width: 0; }
.it .n { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.it .d { font-size: 12.5px; color: var(--muted); }
.it .imp { font-variant-numeric: tabular-nums; font-weight: 550; white-space: nowrap; }
.it.pulsable { cursor: pointer; }
.cab-grupo { display: flex; justify-content: space-between; padding: 8px 14px; background: var(--surface-2); font-size: 12.5px; color: var(--text-2); font-weight: 600; }
.neg { color: var(--bad); } .pos { color: var(--good); }
.chip { display: inline-block; font-size: 11.5px; padding: 1px 8px; border-radius: 10px; background: var(--surface-2); color: var(--text-2); }
.chip.pend { background: var(--warn-bg); color: var(--warn-text); }
.selmes { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; gap: 8px; }
.btn2 { background: var(--surface); border: 1px solid var(--border); color: var(--text); border-radius: 8px; padding: 7px 12px; font: inherit; cursor: pointer; }
.btn2:disabled { opacity: .4; }
.buscar { width: 100%; margin-bottom: 8px; }
.filtros { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 8px; }
.filtros button { flex: none; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); border-radius: 16px; padding: 4px 12px; font: inherit; font-size: 13px; cursor: pointer; }
.filtros button.activo { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
.segm { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--surface-2); border-radius: 10px; padding: 3px; margin-bottom: 12px; }
.segm button { border: 0; background: none; padding: 7px 4px; border-radius: 8px; font: inherit; font-size: 13.5px; color: var(--text-2); cursor: pointer; }
.segm button.activo { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: var(--shadow); }
label { display: block; font-size: 13px; color: var(--text-2); margin: 10px 0 4px; }
input, select { width: 100%; padding: 11px 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-size: 16px; }
input[type=checkbox] { width: auto; }
.check { display: flex; gap: 8px; align-items: center; margin-top: 10px; font-size: 13.5px; color: var(--text-2); }
.btn { width: 100%; margin-top: 16px; padding: 13px; border: 0; border-radius: 12px; background: var(--accent); color: #fff; font: inherit; font-weight: 600; font-size: 16px; cursor: pointer; }
.btn:disabled { opacity: .5; }
.btn.sec { background: var(--surface-2); color: var(--text); }
.nota { font-size: 12.5px; color: var(--muted); margin-top: 8px; }
.rev { padding: 14px; border-top: 1px solid var(--border); }
.rev:first-child { border-top: 0; }
.rev .cab { display: flex; justify-content: space-between; gap: 10px; }
.rev .acc { display: flex; gap: 8px; margin-top: 10px; }
.rev .acc .btn2 { flex: 1; font-size: 13.5px; }
.rev .acc .ok { background: var(--accent); color: #fff; border-color: var(--accent); }
.subir { border: 2px dashed var(--border); border-radius: var(--radius); padding: 24px 16px; text-align: center; color: var(--text-2); cursor: pointer; display: block; margin: 0; }
.subir input { display: none; }
.anular { background: none; border: 1px solid var(--border); color: var(--bad); border-radius: 8px; padding: 4px 10px; font: inherit; font-size: 12.5px; cursor: pointer; }
.mini-ojo { background: none; border: 0; padding: 2px 4px; font-size: 15px; cursor: pointer; opacity: .6; }
.toast { position: absolute; left: 16px; right: 16px; bottom: calc(84px + env(safe-area-inset-bottom)); background: #222; color: #fff; border-radius: 10px;
  padding: 10px 14px; font-size: 14px; opacity: 0; transition: opacity .2s; pointer-events: none; z-index: 5; }
.toast.ver { opacity: .95; }
.oculto .cifra, .cifra.tapada { filter: blur(7px); }
.horas { width: 100%; border-collapse: collapse; font-size: 14px; }
.horas td { padding: 5px 3px; }
.horas input { padding: 8px; font-size: 15px; }
.barra { height: 6px; border-radius: 3px; background: var(--surface-2); margin-top: 6px; overflow: hidden; }
.barra > span { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.login { margin-top: 18vh; text-align: center; }
.login img { width: 84px; height: 84px; border-radius: 20px; }
.login h1 { font-size: 22px; margin: 14px 0 6px; }
.error { background: var(--warn-bg); color: var(--warn-text); border-radius: 10px; padding: 10px 12px; font-size: 13.5px; margin-bottom: 10px; }
.tabla { width: 100%; border-collapse: collapse; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.tabla th, .tabla td { padding: 7px 6px; border-top: 1px solid var(--border); text-align: right; }
.tabla th:first-child, .tabla td:first-child { text-align: left; }
.tabla th { color: var(--muted); font-weight: 600; font-size: 12px; border-top: 0; }
/* Bloqueo con huella: pantalla encima de todo; «velado» tapa los datos mientras la app está en segundo plano */
.bloqueo { position: fixed; inset: 0; z-index: 50; background: var(--bg); display: flex; flex-direction: column; align-items: center;
  justify-content: center; padding: 24px; text-align: center; }
.bloqueo[hidden] { display: none; }
.bloqueo img { width: 84px; height: 84px; border-radius: 20px; }
.bloqueo h1 { font-size: 22px; margin: 14px 0 6px; }
.bloqueo .btn { max-width: 320px; }
.bloqueo .enlace { background: none; border: 0; color: var(--accent); font: inherit; font-size: 14px; margin-top: 14px; cursor: pointer; }
.velado main, .velado nav, .velado #infoFoto, .velado #avisoPend { visibility: hidden; }
