:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --text: #17202b;
  --muted: #5f6b7a;
  --border: #dde1e7;
  --brand: #1f2a37;
  --accent: #e67700;
  --accent-ink: #ffffff;
  --ok: #2b8a3e;
  --ok-bg: #e6f4ea;
  --warn: #b35c00;
  --warn-bg: #fff1dc;
  --danger: #c92a2a;
  --danger-bg: #fdecec;
  --info: #1864ab;
  --info-bg: #e7f0fb;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f141a;
    --surface: #18202a;
    --surface-2: #212b37;
    --text: #e8edf3;
    --muted: #9aa7b6;
    --border: #2c3846;
    --brand: #0b1016;
    --accent: #f59f00;
    --accent-ink: #1a1200;
    --ok: #69db7c;
    --ok-bg: #16301e;
    --warn: #ffc078;
    --warn-bg: #3a2810;
    --danger: #ff8787;
    --danger-bg: #3b1717;
    --info: #74c0fc;
    --info-bg: #132a40;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
/* Sin zoom al tocar dos veces (los mapas mantienen su propio zoom con dos dedos) */
html { touch-action: manipulation; -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
  min-height: 100dvh;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--info); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5rem; }
h1 { font-size: 1.35rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.center { display: grid; place-items: center; min-height: 60vh; text-align: center; padding: 16px; }
.row { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }
.grow { flex: 1; }
.stack > * + * { margin-top: .75rem; }
.hidden { display: none !important; }
.num { font-variant-numeric: tabular-nums; }

/* Top bar */
.topbar {
  background: var(--brand); color: #fff;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  display: flex; align-items: center; gap: 12px;
  position: sticky; top: 0; z-index: 10;
}
.topbar .title { font-weight: 700; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .brand { display: inline-flex; align-items: center; gap: 6px; letter-spacing: -.01em; }
.topbar .brand-mark { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; background: #f59f00; color: #1f2a37; font-size: .85rem; font-weight: 900; }
.topbar .brand-co { font-weight: 500; opacity: .85; margin-left: 6px; }
.topbar .title small { display: block; font-weight: 400; opacity: .75; font-size: .8rem; }
.topbar button { background: rgba(255,255,255,.12); color: #fff; border: 0; border-radius: 10px; padding: 8px 12px; cursor: pointer; }
.topbar button:hover { background: rgba(255,255,255,.2); }

main { max-width: 1100px; margin: 0 auto; padding: 16px; padding-bottom: calc(32px + env(safe-area-inset-bottom)); }
main.narrow { max-width: 560px; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.card + .card, .card + .section, .section + .card { margin-top: 16px; }
.section { margin-top: 20px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  border-radius: 10px; padding: 9px 14px; cursor: pointer; font-weight: 600; text-decoration: none;
  min-height: 42px; transition: transform .08s ease, background .15s ease;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.05); }
.btn.danger { color: var(--danger); }
.btn.solid-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.sm { min-height: 34px; padding: 5px 10px; font-size: .875rem; }
.btn.block { width: 100%; }
.btn.big { min-height: 64px; font-size: 1.1rem; border-radius: 14px; }
.btn.big small { display: block; font-weight: 400; font-size: .82rem; opacity: .85; }
.btn.big { flex-direction: column; gap: 0; }

/* Forms */
label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 4px; }
.field { margin-bottom: 12px; }
.field .hint { font-weight: 400; color: var(--muted); font-size: .82rem; margin-top: 3px; }
input[type=text], input[type=number], input[type=password], input[type=date], input[type=datetime-local], input[type=tel], select, textarea {
  width: 100%; border: 1px solid var(--border); background: var(--surface); border-radius: 10px;
  padding: 10px 12px; min-height: 44px; font-size: 16px;
}
textarea { min-height: 80px; resize: vertical; }
input:focus, select:focus, textarea:focus, .btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; padding: 8px 0; cursor: pointer; }
.check input { width: 20px; height: 20px; margin-top: 1px; flex: none; accent-color: var(--accent); }
.check b { display: block; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (max-width: 640px) { .grid2, .grid3 { grid-template-columns: 1fr; } }

/* Badges */
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: .75rem; font-weight: 700; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.danger { background: var(--danger-bg); color: var(--danger); }
.badge.info { background: var(--info-bg); color: var(--info); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--muted); margin-right: 6px; vertical-align: middle; }
.dot.working { background: var(--ok); }
.dot.travel { background: var(--info); }
.dot.break { background: var(--warn); }

/* Menú de empresas */
.co-list { display: grid; gap: 10px; }
.co-card {
  display: flex; align-items: center; gap: 14px; width: 100%; text-align: left; cursor: pointer;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px;
  box-shadow: var(--shadow); color: var(--text); font: inherit; transition: transform .08s ease, border-color .15s ease;
}
.co-card:hover { border-color: var(--accent); }
.co-card:active { transform: scale(.99); }
.co-name { flex: 1; font-weight: 700; font-size: 1.1rem; }
.co-go { color: var(--muted); font-size: 1.6rem; }
.co-logo { border-radius: 14px; object-fit: contain; background: #fff; flex: none; }
.co-initial { display: inline-grid; place-items: center; background: var(--brand); color: #f59f00; font-weight: 900; }
.co-head { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
.co-head h1 { margin: 0; }
.top-logo { width: 34px; height: 34px; border-radius: 8px; object-fit: contain; background: #fff; flex: none; }

/* Bienvenida */
.welcome { min-height: 100dvh; display: grid; place-items: center; }
.welcome-card { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 6px; width: 100%; }
.welcome-card h1 { font-size: 1.8rem; margin: 14px 0 0; }
.welcome-msg { font-size: 1.2rem; font-weight: 600; margin: 4px 0 10px; }
.welcome-card .co-logo { animation: pop .4s cubic-bezier(.2, .8, .2, 1); }
@keyframes pop { from { transform: scale(.85); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .welcome-card .co-logo { animation: none; } }
.code-big { font-size: 2.6rem; font-weight: 900; letter-spacing: .2em; text-align: center; padding: 14px; border: 2px dashed var(--accent); border-radius: 14px; }

/* Login */
.login-names { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.login-names .btn { min-height: 56px; }
.pin-display { font-size: 2rem; letter-spacing: .5em; text-align: center; min-height: 3rem; font-variant-numeric: tabular-nums; }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; max-width: 320px; margin: 0 auto; }
.keypad .btn { min-height: 64px; font-size: 1.4rem; }

/* Employee status */
.status-card { text-align: center; padding: 22px 16px; border-width: 2px; }
.status-card.working { border-color: var(--ok); }
.status-card.travel { border-color: var(--info); }
.status-card.break { border-color: var(--warn); }
.status-label { font-size: .85rem; text-transform: uppercase; letter-spacing: .06em; font-weight: 700; color: var(--muted); }
.status-main { font-size: 1.45rem; font-weight: 800; margin: 4px 0; }
.status-sub { color: var(--muted); }
.clock { font-size: 2.6rem; font-weight: 800; font-variant-numeric: tabular-nums; margin-top: 10px; }
.actions { display: grid; gap: 10px; margin-top: 16px; }
.actions-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* Cuenta atrás */
.countdown { text-align: center; }
.cd-label { color: var(--muted); font-size: .92rem; }
.cd-label b { color: var(--text); }
.cd-big { font-size: 2.1rem; font-weight: 800; margin: 2px 0; font-variant-numeric: tabular-nums; }
.cd-mid { font-size: 1.25rem; font-weight: 700; margin-top: 2px; }
.cd-over { color: var(--warn); }
.cd-entry { color: var(--info); font-size: 1.6rem; }
.cd-bar { margin-top: 10px; height: 10px; }

.cal-link { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--text); }
.cal-link:hover { background: var(--surface-2); }
.cal-link-icon { font-size: 1.6rem; }

/* Calendario */
.cal-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.cal-head h2 { margin: 0; flex: 1; min-width: 140px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal-dow { text-align: center; font-size: .72rem; font-weight: 700; color: var(--muted); text-transform: uppercase; padding: 4px 0; }
.cal-day {
  min-height: 74px; border: 1px solid var(--border); border-radius: 8px; padding: 4px; background: var(--surface);
  display: flex; flex-direction: column; gap: 2px; font-size: .72rem; line-height: 1.2; overflow: hidden; text-align: left;
}
button.cal-day { cursor: pointer; font: inherit; font-size: .72rem; color: inherit; }
button.cal-day:hover { border-color: var(--accent); }
.cal-day.blank { border: 0; background: transparent; }
.cal-day.today { border: 2px solid var(--accent); }
.cal-day.off { background: var(--surface-2); color: var(--muted); }
.cal-num { font-weight: 800; font-size: .85rem; }
.cal-tag { border-radius: 4px; padding: 1px 4px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 720px) { .cal-day { min-height: 60px; } .cal-tag .full { display: none; } .cal-tag { padding: 1px 2px; text-align: center; } }
@media (min-width: 721px) { .cal-tag .short { display: none; } }

.sched-row { flex-wrap: nowrap; margin-bottom: 4px; }
.sched-row input[type=time] { min-height: 38px; padding: 6px 8px; }

/* Colores por tipo (iguales en el calendario individual y en el de equipo) */
.t-worked { background: var(--ok-bg); color: var(--ok); }
.t-absent { background: var(--danger-bg); color: var(--danger); }
.t-scheduled { background: transparent; color: var(--muted); font-weight: 600; }
.t-vacaciones { background: #e3f2fd; color: #1565c0; }
.t-descanso { background: #ede7f6; color: #5e35b1; }
.t-festivo { background: #fce4ec; color: #ad1457; }
.t-permiso { background: #e0f2f1; color: #00796b; }
.t-baja { background: #fff3e0; color: #c25e00; }
.t-ausencia_just { background: #fff8e1; color: #8d6e00; }
.t-ausencia_injust { background: var(--danger-bg); color: var(--danger); }
@media (prefers-color-scheme: dark) {
  .t-vacaciones { background: #10304d; color: #90caf9; }
  .t-descanso { background: #2a2140; color: #b39ddb; }
  .t-festivo { background: #3d1828; color: #f48fb1; }
  .t-permiso { background: #0f302c; color: #80cbc4; }
  .t-baja { background: #3a2610; color: #ffb74d; }
  .t-ausencia_just { background: #36300f; color: #ffe082; }
}
.cal-legend { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 0; font-size: .78rem; }
.cal-legend .cal-tag { padding: 2px 8px; }

/* Calendario de equipo: empleados en filas, días en columnas */
.team-cal { border-collapse: separate; border-spacing: 0; font-size: .75rem; }
.team-cal th, .team-cal td { padding: 0; text-align: center; border-bottom: 1px solid var(--border); }
.team-cal th { padding: 6px 2px; min-width: 30px; }
.team-cal th.we { color: var(--danger); }
.team-cal .name { position: sticky; left: 0; z-index: 1; background: var(--surface); text-align: left; padding: 6px 10px; white-space: nowrap; min-width: 130px; border-right: 1px solid var(--border); }
.team-cal td.cell { height: 34px; }
.team-cal td.cell button { width: 100%; height: 34px; border: 0; background: transparent; font: inherit; font-weight: 800; cursor: pointer; color: inherit; }
.team-cal td.cell button:hover { outline: 2px solid var(--accent); outline-offset: -2px; }
.team-cal td.today { box-shadow: inset 0 0 0 2px var(--accent); }
.team-cal td.off { background: var(--surface-2); }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); align-items: flex-start; }
.timeline li:last-child { border-bottom: 0; }
.timeline .t { font-weight: 700; font-variant-numeric: tabular-nums; min-width: 3.2rem; }

/* Location picker */
.loc-list { display: grid; gap: 8px; }
.loc-item {
  display: flex; gap: 10px; align-items: center; text-align: left; width: 100%;
  border: 1px solid var(--border); background: var(--surface); border-radius: 12px; padding: 12px; cursor: pointer;
}
.loc-item:hover { background: var(--surface-2); }
.loc-item.selected { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent) inset; }
.loc-item .name { font-weight: 700; }
.loc-item .addr { font-size: .85rem; color: var(--muted); }
.loc-group { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; margin: 14px 0 6px; }

/* Tabs */
.tabs { display: flex; gap: 6px; overflow-x: auto; padding: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; margin-bottom: 16px; scrollbar-width: none; }
.tabs a { padding: 8px 12px; border-radius: 9px; text-decoration: none; color: var(--muted); font-weight: 600; white-space: nowrap; }
.tabs a.active { background: var(--brand); color: #fff; }
@media (prefers-color-scheme: dark) { .tabs a.active { background: var(--accent); color: var(--accent-ink); } }

/* Tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { padding: 9px 10px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
th { background: var(--surface-2); font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td.r, th.r { text-align: right; }
.empty { padding: 24px; text-align: center; color: var(--muted); }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; }
.stat .v { font-size: 1.5rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.stat .k { color: var(--muted); font-size: .85rem; }

.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; align-items: end; margin-bottom: 14px; }
.filters .field { margin: 0; }

.bar { height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; min-width: 80px; }
.bar > span { display: block; height: 100%; background: var(--accent); }

.alert { padding: 12px 14px; border-radius: 12px; margin-bottom: 14px; }
.alert.warn { background: var(--warn-bg); color: var(--warn); }
.alert.info { background: var(--info-bg); color: var(--info); }
.alert.danger { background: var(--danger-bg); color: var(--danger); }

/* Modal */
.modal-backdrop { position: fixed; inset: 0; background: rgba(10, 14, 20, .55); display: flex; align-items: flex-end; justify-content: center; z-index: 50; animation: fade .15s ease; }
.modal {
  background: var(--surface); width: 100%; max-width: 560px; max-height: 92dvh; overflow: auto;
  border-radius: 18px 18px 0 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
  animation: up .2s cubic-bezier(.2, .8, .2, 1);
}
@media (min-width: 700px) { .modal-backdrop { align-items: center; } .modal { border-radius: 18px; } }
.modal-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.modal-head h2 { flex: 1; margin: 0; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; flex-wrap: wrap; }
.modal-foot .btn { flex: 1; }
@media (min-width: 700px) { .modal-foot .btn { flex: 0 0 auto; } }
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(24px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .modal-backdrop, .modal { animation: none; } }

#toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 60; pointer-events: none; }
#toast .t { background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-weight: 600; box-shadow: 0 6px 20px rgba(0,0,0,.25); max-width: 90vw; }
#toast .t.error { background: var(--danger); color: #fff; }

/* Mapa */
.map { height: 380px; width: 100%; background: var(--surface-2); }
@media (max-width: 640px) { .map { height: 300px; } }
.map-pin {
  display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; transform: translate(-10px, -50%);
  background: #fff; color: #17202b; border: 2px solid #2b8a3e; border-radius: 999px; padding: 2px 9px 2px 4px;
  font: 700 12px/1.3 system-ui, sans-serif; box-shadow: 0 2px 6px rgba(0,0,0,.3);
}
.map-pin span { width: 10px; height: 10px; border-radius: 50%; background: #2b8a3e; }
.map-pin.travel { border-color: #1864ab; } .map-pin.travel span { background: #1864ab; }
.map-pin.break { border-color: #e67700; } .map-pin.break span { background: #e67700; }
.map-pin.off { border-color: #868e96; } .map-pin.off span { background: #868e96; }
.map-pin.stale { opacity: .6; border-style: dashed; }

.spinner { width: 28px; height: 28px; border: 3px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; margin: 10px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

/* =====================================================================
   Tema con color: degradados por estado (trabajando, de camino, comida,
   fuera), botones de acción con su color, anillo de cuenta atrás.
   ===================================================================== */
:root {
  --g-brand: linear-gradient(135deg, #1e3a8a 0%, #4338ca 55%, #7c3aed 100%);
  --g-work: linear-gradient(135deg, #047857 0%, #10b981 60%, #34d399 100%);
  --g-travel: linear-gradient(135deg, #1d4ed8 0%, #3b82f6 60%, #38bdf8 100%);
  --g-break: linear-gradient(135deg, #c2410c 0%, #f97316 55%, #fbbf24 100%);
  --g-off: linear-gradient(135deg, #312e81 0%, #4f46e5 60%, #6366f1 100%);
  --g-stop: linear-gradient(135deg, #b91c1c 0%, #ef4444 100%);
  --g-go: linear-gradient(135deg, #059669 0%, #22c55e 100%);
  --g-accent: linear-gradient(135deg, #f59e0b 0%, #f97316 100%);
  --g-violet: linear-gradient(135deg, #7c3aed 0%, #c026d3 100%);
  --radius: 18px;
  --shadow: 0 1px 2px rgba(30, 41, 99, .06), 0 6px 18px rgba(30, 41, 99, .08);
  --bg: #f3f4fb;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0b1020; --surface: #141b2e; --surface-2: #1d2640; --border: #263152; --shadow: 0 6px 20px rgba(0, 0, 0, .35); }
}
body {
  background:
    radial-gradient(1200px 500px at 110% -10%, rgba(124, 58, 237, .10), transparent 60%),
    radial-gradient(900px 400px at -10% 10%, rgba(16, 185, 129, .08), transparent 60%),
    var(--bg);
  background-attachment: fixed;
}

/* Cabecera */
.topbar { background: var(--g-brand); box-shadow: 0 4px 18px rgba(67, 56, 202, .35); }
.topbar .brand-mark { background: var(--g-accent); color: #1f2a37; }

/* Tarjetas */
.card { border: 1px solid var(--border); box-shadow: var(--shadow); }

/* Tarjeta de estado con el color de lo que está haciendo */
.status-card { border: 0; color: #fff; position: relative; overflow: hidden; box-shadow: 0 10px 30px rgba(30, 41, 99, .25); }
.status-card.off { background: var(--g-off); }
.status-card.working { background: var(--g-work); }
.status-card.travel { background: var(--g-travel); }
.status-card.break { background: var(--g-break); }
.status-card::after {
  content: ""; position: absolute; width: 260px; height: 260px; right: -90px; top: -110px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, .22), transparent 70%); pointer-events: none;
}
.status-card .status-label, .status-card .status-sub, .status-card .muted { color: rgba(255, 255, 255, .85); }
.status-card .status-label .dot { background: #fff; box-shadow: 0 0 0 4px rgba(255, 255, 255, .25); }
.status-card .status-main { font-size: 1.6rem; }
.status-card .clock { color: #fff; text-shadow: 0 2px 12px rgba(0, 0, 0, .18); font-size: 3rem; }
.status-card .alert { background: rgba(255, 255, 255, .16); color: #fff; }
.status-card .alert a { color: #fff; }
.status-card .actions { position: relative; z-index: 1; }

/* Botones de acción con su color */
.btn-go, .btn-travel, .btn-food, .btn-stop, .btn-horario, .btn.primary {
  border: 0; color: #fff; text-shadow: 0 1px 2px rgba(0, 0, 0, .18);
  box-shadow: 0 6px 16px rgba(0, 0, 0, .18), inset 0 0 0 1px rgba(255, 255, 255, .25);
}
.btn-go { background: var(--g-go); }
.btn-travel { background: var(--g-travel); }
.btn-food { background: var(--g-break); }
.btn-stop, .btn.solid-danger { background: var(--g-stop); border: 0; color: #fff; }
.btn-horario { background: var(--g-violet); }
.btn.primary { background: var(--g-accent); color: #fff; }
.btn-go:hover, .btn-travel:hover, .btn-food:hover, .btn-stop:hover, .btn-horario:hover, .btn.primary:hover { filter: brightness(1.07); }
.btn-ghost { background: rgba(255, 255, 255, .14); color: #fff; border: 1px solid rgba(255, 255, 255, .35); }
.btn-ghost:hover { background: rgba(255, 255, 255, .24); }
.status-card .btn-go { box-shadow: 0 6px 16px rgba(0, 0, 0, .22), inset 0 0 0 2px rgba(255, 255, 255, .45); }

/* Cuenta atrás con anillo */
.countdown { text-align: left; }
.cd-wrap { display: flex; align-items: center; gap: 18px; }
.cd-ring {
  --p: 0; flex: none; width: 140px; height: 140px; border-radius: 50%; display: grid; place-items: center;
  background: conic-gradient(#10b981 0%, #3b82f6 calc(var(--p) * 1%), var(--surface-2) 0);
}
.cd-ring.over { background: conic-gradient(#f97316 0%, #ef4444 100%); }
.cd-inner { width: 112px; height: 112px; border-radius: 50%; background: var(--surface); display: grid; place-content: center; text-align: center; }
.cd-ring .cd-big { font-size: 1.35rem; margin: 0; }
.cd-ring.over .cd-big { color: var(--warn); }
.cd-small { font-size: .78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 700; }
.cd-side { min-width: 0; }
.cd-side .cd-label { font-size: 1rem; color: var(--text); }
.cd-end { display: block; font-size: 2rem; line-height: 1.1; color: #4338ca; }
@media (prefers-color-scheme: dark) { .cd-end { color: #a5b4fc; } }
@media (max-width: 380px) { .cd-ring { width: 118px; height: 118px; } .cd-inner { width: 94px; height: 94px; } .cd-ring .cd-big { font-size: 1.1rem; } }
.pill { display: inline-block; border-radius: 999px; padding: 3px 12px; font-weight: 700; font-size: .8rem; margin-bottom: 10px; }
.pill-horario { background: var(--g-violet); color: #fff; }

/* Horario especial en el calendario */
.t-horario { background: #f3e8ff; color: #7e22ce; }
@media (prefers-color-scheme: dark) { .t-horario { background: #3b1d5a; color: #e9d5ff; } }

/* Pestañas y estadísticas */
.tabs a.active { background: var(--g-brand); color: #fff; box-shadow: 0 4px 12px rgba(67, 56, 202, .35); }
@media (prefers-color-scheme: dark) { .tabs a.active { background: var(--g-brand); color: #fff; } }
.stat { border: 1px solid var(--border); box-shadow: var(--shadow); }
/* Cada cifra con su color (verde, azul, naranja, violeta, rojo) */
.stat .v { color: #059669; }
.stat:nth-child(5n+2) .v { color: #2563eb; }
.stat:nth-child(5n+3) .v { color: #ea580c; }
.stat:nth-child(5n+4) .v { color: #7c3aed; }
.stat:nth-child(5n+5) .v { color: #dc2626; }
@media (prefers-color-scheme: dark) {
  .stat .v { color: #34d399; }
  .stat:nth-child(5n+2) .v { color: #60a5fa; }
  .stat:nth-child(5n+3) .v { color: #fb923c; }
  .stat:nth-child(5n+4) .v { color: #c4b5fd; }
  .stat:nth-child(5n+5) .v { color: #f87171; }
}
.bar > span { background: linear-gradient(90deg, #10b981, #3b82f6); }

/* Inicio: empresas */
.co-initial { background: var(--g-brand); color: #fff; }
.co-go { color: #6366f1; }

/* Teclado del código */
.pin-display {
  display: block; width: 100%; text-align: center; border: 0; border-radius: 14px; padding: 10px; min-height: 64px;
  background: var(--surface-2); color: var(--text); letter-spacing: .5em; font-size: 2rem; caret-color: transparent;
}
.pin-display::placeholder { color: var(--border); }
.keypad { margin-top: 14px; }
.keypad .btn { border-radius: 16px; font-weight: 800; background: var(--surface); box-shadow: 0 2px 0 var(--border); }
.keypad .btn:active { transform: translateY(2px); box-shadow: none; }
.keypad .btn.primary { background: var(--g-accent); box-shadow: 0 6px 16px rgba(249, 115, 22, .35); }

/* Bienvenida a pantalla completa con degradado */
.welcome { max-width: none; margin: 0; padding: 24px 16px; background: var(--g-brand); color: #fff; }
.welcome-card { max-width: 440px; margin: 0 auto; }
.welcome .muted { color: rgba(255, 255, 255, .82); }
.welcome .co-logo { box-shadow: 0 10px 30px rgba(0, 0, 0, .3); }
.welcome .co-initial { background: rgba(255, 255, 255, .18); }
.welcome-msg { color: #fff; }
.welcome #w-go { background: #fff; color: #4338ca; text-shadow: none; }

/* Enlace al calendario */
.cal-link { background: linear-gradient(135deg, rgba(124, 58, 237, .10), rgba(59, 130, 246, .08)), var(--surface); }
.cal-link-icon { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 14px; background: var(--g-violet); font-size: 1.4rem; }

/* =====================================================================
   Modo sencillo (trabajadores): letra grande, más contraste,
   botones enormes uno debajo de otro.
   ===================================================================== */
.simple { font-size: 1.12rem; }
.simple .status-card { padding: 26px 18px; }
.simple .status-label { font-size: 1rem; }
.simple .status-main { font-size: 2rem; }
.simple .status-sub { font-size: 1.2rem; color: #fff; }
.simple .status-card .muted { color: rgba(255, 255, 255, .95); font-size: 1rem; }
.simple .clock { font-size: 3.4rem; }
.simple .btn.big { min-height: 86px; font-size: 1.45rem; border-radius: 20px; }
.simple .btn.big small { font-size: 1rem; opacity: .95; }
.simple .actions-2 { grid-template-columns: 1fr; }
.simple .alert { font-size: 1rem; }
.simple .cd-label, .simple .cd-side .cd-label { font-size: 1.2rem; }
.simple .cd-side .muted { font-size: 1rem; color: var(--text); }
.simple .cd-end { font-size: 2.6rem; }
.simple .muted { color: var(--text); opacity: .85; }
.simple .small { font-size: 1rem; }

/* "Ver más" */
.more { margin-top: 16px; }
.more > summary {
  list-style: none; cursor: pointer; text-align: center; font-weight: 700; font-size: 1.1rem;
  padding: 16px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow);
}
.more > summary::-webkit-details-marker { display: none; }
.more > summary::after { content: "  ▾"; }
.more[open] > summary::after { content: "  ▴"; }

/* Botón "Me he equivocado" */
.undo-btn { width: 100%; margin-top: 12px; min-height: 52px; font-size: 1.05rem; background: rgba(255, 255, 255, .95); color: #1f2a37; border: 0; }
.undo-btn:hover { background: #fff; }

/* Confirmación a pantalla completa tras fichar */
.punch-ok {
  position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 24px; color: #fff; text-align: center;
  animation: fade .18s ease;
}
.punch-go { background: var(--g-work); }
.punch-travel { background: var(--g-travel); }
.punch-food { background: var(--g-break); }
.punch-stop { background: var(--g-off); }
.punch-ok-in { width: 100%; max-width: 420px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.punch-ok-icon {
  width: 120px; height: 120px; border-radius: 50%; display: grid; place-items: center; font-size: 3.6rem; font-weight: 900;
  background: rgba(255, 255, 255, .22); box-shadow: 0 0 0 10px rgba(255, 255, 255, .12); animation: pop .35s cubic-bezier(.2, .8, .2, 1);
}
.punch-ok-title { font-size: 1.9rem; font-weight: 800; margin-top: 14px; line-height: 1.2; }
.punch-ok-time { font-size: 3.6rem; font-weight: 900; line-height: 1; text-shadow: 0 2px 14px rgba(0, 0, 0, .2); }
.punch-ok-sub { font-size: 1.2rem; opacity: .95; }
.punch-ok-btn { width: 100%; margin-top: 18px; background: #fff; color: #1f2a37; border: 0; font-size: 1.35rem; min-height: 72px; }
.punch-ok-undo { width: 100%; background: transparent; color: #fff; border: 2px solid rgba(255, 255, 255, .6); min-height: 54px; font-size: 1.05rem; }
.punch-ok-undo:hover { background: rgba(255, 255, 255, .12); }
@media (prefers-reduced-motion: reduce) { .punch-ok, .punch-ok-icon { animation: none; } }
