/* Registro horario — estilos comunes */
:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #eef0f3;
  --text: #16191d;
  --muted: #5c6670;
  --line: #dde1e6;
  --brand: #1f6f5c;
  --brand-ink: #ffffff;
  --brand-soft: #e3f1ed;
  --ok: #1d7a46;
  --ok-soft: #e2f4e9;
  --warn: #9a5b00;
  --warn-soft: #fdf1dc;
  --bad: #b3261e;
  --bad-soft: #fbe5e3;
  --pause: #6b4fbb;
  --pause-soft: #eeeafb;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 32, .06), 0 4px 16px rgba(16, 24, 32, .05);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111416; --surface: #1a1e21; --surface-2: #23282c; --text: #eef1f3; --muted: #9aa5ae; --line: #2f363b;
    --brand: #4fb89c; --brand-ink: #07211a; --brand-soft: #173a31;
    --ok: #5cc98a; --ok-soft: #173826; --warn: #f0b04d; --warn-soft: #3a2c12; --bad: #f2867e; --bad-soft: #3d1c19;
    --pause: #b3a1f0; --pause-soft: #2c2547;
    --shadow: none;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5rem; }
h1 { font-size: 1.5rem; } h2 { font-size: 1.2rem; } h3 { font-size: 1rem; }
p { margin: 0 0 .75rem; }
small, .muted { color: var(--muted); }
.wrap { max-width: 1080px; margin: 0 auto; padding: 16px; }
.narrow { max-width: 460px; margin: 0 auto; padding: 16px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); margin-bottom: 14px; }
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grow { flex: 1 1 auto; min-width: 0; }
.stack > * + * { margin-top: 10px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.hidden { display: none !important; }
.center { text-align: center; }

/* Botones */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 16px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
}
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.primary:hover { filter: brightness(1.05); }
.btn.danger { color: var(--bad); }
.btn.small { min-height: 34px; padding: 6px 12px; font-size: .9rem; border-radius: 10px; }
.btn.block { width: 100%; }
.btn.huge { min-height: 76px; font-size: 1.25rem; border-radius: 18px; width: 100%; }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.pause { background: var(--pause-soft); border-color: transparent; color: var(--pause); }
.btn.link { border: 0; background: none; color: var(--brand); padding: 4px; min-height: 0; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 55%, transparent); outline-offset: 2px; }

/* Formularios */
label { display: block; font-weight: 600; font-size: .92rem; margin-bottom: 4px; }
.field { margin-bottom: 12px; }
.hint { font-weight: 400; color: var(--muted); font-size: .85rem; }
input, select, textarea {
  width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface); color: var(--text); font: inherit;
}
textarea { min-height: 80px; resize: vertical; }
input[type=checkbox] { width: 22px; min-height: 22px; height: 22px; accent-color: var(--brand); }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; }
.check input { flex: none; margin-top: 1px; }

/* Etiquetas de estado */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: .82rem; font-weight: 600; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.pill.working { background: var(--ok-soft); color: var(--ok); }
.pill.paused { background: var(--pause-soft); color: var(--pause); }
.pill.off { background: var(--surface-2); color: var(--muted); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.tag { display: inline-block; padding: 1px 8px; border-radius: 6px; font-size: .78rem; background: var(--warn-soft); color: var(--warn); margin: 2px 4px 2px 0; }
.tag.info { background: var(--brand-soft); color: var(--brand); }

/* Tablas */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: .93rem; }
th, td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 600; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tr.weekend td { color: var(--muted); }
tr.incomplete td { background: var(--warn-soft); }
.list { list-style: none; margin: 0; padding: 0; }
.list > li { padding: 12px 0; border-bottom: 1px solid var(--line); }
.list > li:last-child { border-bottom: 0; }

/* Cifras */
.stat { font-size: 1.9rem; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.1; }
.stat-label { color: var(--muted); font-size: .85rem; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(92px, 1fr)); gap: 12px; }
.stats > div { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }

/* Avisos y mensajes */
.notice { padding: 12px 14px; border-radius: 12px; background: var(--brand-soft); color: var(--text); margin-bottom: 12px; font-size: .95rem; }
.notice.warn { background: var(--warn-soft); }
.notice.bad { background: var(--bad-soft); }
.toast {
  position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(20px);
  background: #16191d; color: #fff; padding: 12px 18px; border-radius: 12px; max-width: calc(100vw - 32px);
  opacity: 0; transition: .2s; z-index: 100; pointer-events: none; font-weight: 500; box-shadow: 0 8px 24px rgba(0,0,0,.2);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.bad { background: var(--bad); }

/* Cabecera */
.topbar { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.topbar .wrap { display: flex; align-items: center; gap: 12px; padding-top: 10px; padding-bottom: 10px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--text); text-decoration: none; }
.brand img { width: 28px; height: 28px; }
.tabs { display: flex; gap: 4px; overflow-x: auto; }
.tabs a { padding: 8px 12px; border-radius: 10px; color: var(--muted); text-decoration: none; font-weight: 600; white-space: nowrap; position: relative; }
.tabs a.active { background: var(--brand-soft); color: var(--brand); }
.badge { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 10px; background: var(--bad); color: #fff; font-size: .75rem; line-height: 20px; text-align: center; margin-left: 4px; }

/* Navegación inferior en móvil */
@media (max-width: 760px) {
  .topbar .tabs { display: none; }
  .bottomnav { position: fixed; bottom: 0; left: 0; right: 0; background: var(--surface); border-top: 1px solid var(--line); display: flex; z-index: 20; padding-bottom: env(safe-area-inset-bottom); }
  .bottomnav a { flex: 1; text-align: center; padding: 8px 2px 9px; font-size: .72rem; color: var(--muted); text-decoration: none; font-weight: 600; }
  .bottomnav a .ico { display: block; font-size: 1.2rem; line-height: 1.4; }
  .bottomnav a.active { color: var(--brand); }
  body.has-bottomnav { padding-bottom: 76px; }
}
@media (min-width: 761px) { .bottomnav { display: none; } }

/* Diálogos */
dialog { border: 0; border-radius: 18px; padding: 0; width: min(520px, calc(100vw - 24px)); background: var(--surface); color: var(--text); box-shadow: 0 20px 60px rgba(0,0,0,.3); }
dialog::backdrop { background: rgba(10, 14, 18, .45); }
dialog .dlg { padding: 20px; max-height: calc(100dvh - 40px); overflow-y: auto; }
dialog .actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; flex-wrap: wrap; }

/* App del empleado */
.state-card { text-align: center; padding: 26px 16px; border-radius: 22px; margin-bottom: 14px; border: 1px solid var(--line); background: var(--surface); }
.state-card .big { font-size: 2.6rem; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.state-card.working { background: var(--ok-soft); border-color: transparent; }
.state-card.paused { background: var(--pause-soft); border-color: transparent; }
.result { min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 24px; gap: 8px; }
.result .icon { width: 96px; height: 96px; border-radius: 50%; display: grid; place-items: center; font-size: 3rem; font-weight: 800; margin-bottom: 8px; }
.result.ok { background: var(--ok-soft); } .result.ok .icon { background: var(--ok); color: #fff; }
.result.warn { background: var(--warn-soft); } .result.warn .icon { background: var(--warn); color: #fff; }
.result.bad { background: var(--bad-soft); } .result.bad .icon { background: var(--bad); color: #fff; }
.result .when { font-size: 3.2rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.scanner { position: relative; border-radius: 18px; overflow: hidden; background: #000; aspect-ratio: 1; }
.scanner video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scanner .frame { position: absolute; inset: 18%; border: 3px solid rgba(255,255,255,.9); border-radius: 16px; box-shadow: 0 0 0 999px rgba(0,0,0,.35); }

/* Tablet */
.kiosk { min-height: 100dvh; display: grid; place-items: center; padding: 20px; }
.kiosk .panel { width: min(420px, 100%); text-align: center; }
.clock { font-size: 3.4rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.pin-dots { display: flex; justify-content: center; gap: 14px; margin: 18px 0; }
.pin-dots span { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--muted); }
.pin-dots span.on { background: var(--text); border-color: var(--text); }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.keypad button { min-height: 72px; font-size: 1.6rem; font-weight: 700; border-radius: 18px; border: 1px solid var(--line); background: var(--surface); color: var(--text); cursor: pointer; }
.keypad button:active { background: var(--surface-2); }

/* Impresión */
@media print {
  .topbar, .bottomnav, .no-print { display: none !important; }
  body { background: #fff; }
  .card { box-shadow: none; border: 0; }
}
