:root {
  --paper: #f6f3ee; --card: #fffdf9; --ink: #1a1817; --ink-2: #5d5853; --ink-3: #8f8982;
  --line: #e4ded5; --accent: #b8321c; --accent-soft: #f6e3de;
  --ok: #2f6b45; --ok-soft: #e1eee5; --warn: #9a6a12; --warn-soft: #f6ecd6; --info: #2f5574; --info-soft: #e0e9f1;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --r: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--paper); color: var(--ink); font: 15px/1.45 var(--sans); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; letter-spacing: -.01em; margin: 0; }
.muted { color: var(--ink-2); } .small { font-size: 13px; } .tiny { font-size: 12px; color: var(--ink-3); }
.hidden { display: none !important; }

/* ---------- botones ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--ink); background: var(--ink); color: #fff;
  border-radius: 12px; padding: 13px 18px; font-weight: 600; cursor: pointer; text-decoration: none; transition: transform .05s, opacity .2s; }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .45; cursor: default; }
.btn.secondary { background: transparent; color: var(--ink); }
.btn.accent { background: var(--accent); border-color: var(--accent); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-2); padding: 8px 10px; }
.btn.sm { padding: 7px 12px; font-size: 13px; border-radius: 9px; }
.btn.block { width: 100%; }
.btn.big { padding: 18px; font-size: 17px; border-radius: 16px; }

/* ---------- formularios ---------- */
label { display: block; font-size: 13px; color: var(--ink-2); margin: 12px 0 5px; }
input, select, textarea { width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--ink); outline-offset: -1px; }
.row { display: flex; gap: 10px; } .row > * { flex: 1; }

/* ---------- tarjetas y etiquetas ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 99px; font-size: 12px; font-weight: 600; background: var(--line); color: var(--ink-2); white-space: nowrap; }
.chip.ok { background: var(--ok-soft); color: var(--ok); } .chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.info { background: var(--info-soft); color: var(--info); } .chip.accent { background: var(--accent-soft); color: var(--accent); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; display: inline-block; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 12px 18px;
  border-radius: 12px; z-index: 99; max-width: 90vw; box-shadow: 0 8px 30px rgba(0,0,0,.2); font-size: 14px; }
.toast.error { background: var(--accent); }

/* ---------- app del empleado (móvil) ---------- */
.app { max-width: 480px; margin: 0 auto; min-height: 100vh; padding: 0 16px 96px; }
.top { display: flex; align-items: center; justify-content: space-between; padding: 18px 2px 8px; }
.brand { font-family: var(--serif); font-size: 20px; font-weight: 600; letter-spacing: .02em; }
.brand small { display: block; font-family: var(--sans); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); font-weight: 500; }
.clock { font-variant-numeric: tabular-nums; text-align: right; }
.clock b { font-size: 20px; display: block; }

.status { margin-top: 10px; padding: 22px 20px; border-radius: 20px; background: var(--ink); color: #fff; position: relative; overflow: hidden; }
.status.fuera { background: #ece7df; color: var(--ink); }
.status.en_pausa { background: var(--warn); }
.status .label { font-size: 12px; letter-spacing: .14em; text-transform: uppercase; opacity: .75; }
.status h2 { font-size: 30px; margin: 4px 0 2px; }
.status .counter { font: 600 44px/1 var(--sans); font-variant-numeric: tabular-nums; margin-top: 14px; letter-spacing: -.02em; }
.status .counter small { font-size: 14px; font-weight: 500; opacity: .7; margin-left: 6px; letter-spacing: 0; }
.status .bar { height: 5px; background: rgba(255,255,255,.18); border-radius: 9px; margin-top: 14px; overflow: hidden; }
.status.fuera .bar { background: rgba(0,0,0,.08); }
.status .bar i { display: block; height: 100%; background: currentColor; border-radius: 9px; opacity: .85; }

.actions { display: grid; gap: 10px; margin-top: 14px; }
.actions.two { grid-template-columns: 1fr 1fr; }

.proposal { margin-top: 14px; border: 1px solid #c9d6e2; background: var(--info-soft); border-radius: var(--r); padding: 14px 16px; }
.proposal b { color: var(--info); }
.proposal .row { margin-top: 10px; }

.section-title { display: flex; align-items: baseline; justify-content: space-between; margin: 26px 2px 10px; }
.section-title h3 { font-size: 18px; }

.tramo { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.tramo:last-child { border-bottom: 0; }
.tramo .t { font-variant-numeric: tabular-nums; font-weight: 600; min-width: 108px; }
.tramo .h { margin-left: auto; font-variant-numeric: tabular-nums; color: var(--ink-2); }

.day { padding: 14px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.day:last-child { border-bottom: 0; }
.day .line1 { display: flex; align-items: center; gap: 10px; }
.day .date { font-weight: 600; min-width: 92px; text-transform: capitalize; }
.day .hours { margin-left: auto; font-variant-numeric: tabular-nums; font-weight: 600; }
.day .detail { margin-top: 8px; padding-left: 2px; }
.ev { display: flex; gap: 10px; align-items: center; padding: 5px 0; font-size: 14px; }
.ev .tm { font-variant-numeric: tabular-nums; width: 44px; font-weight: 600; }
.ev.anulado { text-decoration: line-through; color: var(--ink-3); }

.tabbar { position: fixed; bottom: 0; left: 0; right: 0; background: rgba(255,253,249,.96); backdrop-filter: blur(10px); border-top: 1px solid var(--line);
  display: flex; justify-content: center; padding: 6px 0 calc(6px + env(safe-area-inset-bottom)); z-index: 10; }
.tabbar .inner { display: flex; width: 100%; max-width: 480px; }
.tabbar button { flex: 1; border: 0; background: none; padding: 6px 0; font-size: 11px; color: var(--ink-3); display: flex; flex-direction: column; align-items: center; gap: 3px; cursor: pointer; }
.tabbar button svg { width: 22px; height: 22px; }
.tabbar button.on { color: var(--ink); font-weight: 600; }

.sheet-bg { position: fixed; inset: 0; background: rgba(26,24,23,.45); z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: var(--card); width: 100%; max-width: 480px; border-radius: 22px 22px 0 0; padding: 22px 20px calc(22px + env(safe-area-inset-bottom)); max-height: 92vh; overflow: auto; }
.sheet h3 { font-size: 22px; margin-bottom: 4px; }

.result { text-align: center; padding: 28px 10px 10px; }
.result .icon { width: 74px; height: 74px; border-radius: 50%; display: grid; place-items: center; margin: 0 auto 14px; background: var(--ok-soft); color: var(--ok); }
.result .icon.out { background: #ece7df; color: var(--ink); }
.result h2 { font-size: 28px; } .result .time { font: 600 40px var(--sans); font-variant-numeric: tabular-nums; margin: 6px 0; }

.scanner { position: relative; border-radius: 16px; overflow: hidden; background: #000; aspect-ratio: 1; margin: 14px 0; }
.scanner video { width: 100%; height: 100%; object-fit: cover; }
.scanner .frame { position: absolute; inset: 18%; border: 3px solid #fff; border-radius: 18px; box-shadow: 0 0 0 999px rgba(0,0,0,.35); }

.login { max-width: 380px; margin: 0 auto; padding: 12vh 22px 40px; }
.login .brand { font-size: 34px; margin-bottom: 4px; }
.pin { letter-spacing: .5em; text-align: center; font-size: 22px; }

/* ---------- administración (escritorio) ---------- */
.admin { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.side { background: var(--ink); color: #eae6e0; padding: 22px 14px; position: sticky; top: 0; height: 100vh; }
.side .brand { color: #fff; padding: 0 10px 22px; }
.side .brand small { color: #9b958e; }
.side button { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; border: 0; background: none; color: #cfc9c1; padding: 10px 12px; border-radius: 9px; cursor: pointer; font-size: 14px; }
.side button:hover { background: rgba(255,255,255,.06); }
.side button.on { background: rgba(255,255,255,.12); color: #fff; font-weight: 600; }
.side .badge { margin-left: auto; background: var(--accent); color: #fff; border-radius: 99px; font-size: 11px; padding: 1px 7px; }
.side .foot { position: absolute; bottom: 18px; left: 14px; right: 14px; font-size: 12px; color: #9b958e; padding: 0 12px; }
.main { padding: 28px 34px 60px; max-width: 1240px; }
.main header { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 22px; flex-wrap: wrap; }
.main header h1 { font-size: 30px; }
.toolbar { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.toolbar label { margin-top: 0; }
.toolbar input, .toolbar select { width: auto; }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 22px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; }
.kpi .v { font: 600 30px var(--sans); font-variant-numeric: tabular-nums; margin-top: 4px; }
.kpi .k { font-size: 12px; color: var(--ink-2); text-transform: uppercase; letter-spacing: .08em; }
table { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-2); font-weight: 600; background: #f9f6f1; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.click { cursor: pointer; } tr.click:hover td { background: #faf7f2; }
tr.sub td { background: #fbf9f5; font-size: 13px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.qrbox { background: #fff; padding: 16px; border-radius: 12px; border: 1px solid var(--line); text-align: center; }
.qrbox svg { width: 220px; height: 220px; }
.ok-text { color: var(--ok); } .bad-text { color: var(--accent); }

@media (max-width: 900px) {
  .admin { grid-template-columns: 1fr; } .side { position: static; height: auto; display: flex; overflow-x: auto; gap: 4px; padding: 10px; }
  .side .brand, .side .foot { display: none; } .side button { white-space: nowrap; width: auto; }
  .main { padding: 18px; } .kpis { grid-template-columns: 1fr 1fr; } .grid2 { grid-template-columns: 1fr; }
}

/* ---------- impresión ---------- */
@media print {
  body { background: #fff; } .noprint { display: none !important; }
  table { border: 1px solid #999; } th, td { padding: 5px 8px; font-size: 11px; }
}
