/* =========================================================
   Checador Dulces Gómez · Tema corporativo
   Azul oscuro / azul tecnológico / blanco · verde éxito · rojo alerta
   ========================================================= */
:root {
  --c-navy: #0b2545;
  --c-navy-2: #13315c;
  --c-blue: #1d6fe8;
  --c-blue-soft: #e8f1fe;
  --c-green: #16a34a;
  --c-red: #dc2626;
  --c-amber: #d97706;
  --c-bg: #f4f7fb;
  --c-border: #e3e9f2;
  --c-text: #1e293b;
  --c-muted: #64748b;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 4px 16px rgba(15, 23, 42, .06);
  --bs-primary: #1d6fe8;
  --bs-primary-rgb: 29, 111, 232;
  --bs-body-font-family: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --bs-body-color: #1e293b;
}
body { background: var(--c-bg); color: var(--c-text); -webkit-font-smoothing: antialiased; }
.btn-primary { --bs-btn-bg: var(--c-blue); --bs-btn-border-color: var(--c-blue); --bs-btn-hover-bg: #165ac0; --bs-btn-hover-border-color: #165ac0; --bs-btn-active-bg: #124ca3; }
.btn { border-radius: 10px; }
.form-control, .form-select { border-radius: 10px; border-color: var(--c-border); }
.form-control:focus, .form-select:focus { border-color: var(--c-blue); box-shadow: 0 0 0 .2rem rgba(29, 111, 232, .15); }
.card { border: 1px solid var(--c-border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-header { background: #fff; border-bottom: 1px solid var(--c-border); font-weight: 600; border-radius: var(--radius) var(--radius) 0 0 !important; }
.table { --bs-table-bg: transparent; vertical-align: middle; }
.table thead th { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--c-muted); font-weight: 600; border-bottom-width: 1px; white-space: nowrap; }
.fade-in { animation: fadeIn .35s ease both; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- Login / páginas simples ---------- */
.auth-body { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1.25rem;
  background: radial-gradient(1200px 600px at 10% -10%, #1d6fe8 0%, transparent 60%), linear-gradient(160deg, #0b2545 0%, #13315c 55%, #0b2545 100%); }
.auth-card { width: 100%; max-width: 420px; background: #fff; border-radius: 20px; padding: 2rem 1.75rem; box-shadow: 0 20px 60px rgba(0, 0, 0, .25); }
.auth-logo { width: 64px; height: 64px; }
.auth-clock { font-variant-numeric: tabular-nums; font-size: 2rem; font-weight: 700; color: var(--c-navy); letter-spacing: .02em; }
.btn-reveal { position: absolute; right: .5rem; top: 50%; transform: translateY(-50%); color: var(--c-muted); z-index: 5; }
.privacy-text p, .privacy-text li { font-size: .95rem; line-height: 1.6; }

/* ---------- Panel administrativo ---------- */
.admin-wrap { display: flex; min-height: 100vh; }
.sidebar { width: 264px; flex-shrink: 0; background: linear-gradient(180deg, var(--c-navy) 0%, #0e2d55 100%); color: #cbd5e1; position: sticky; top: 0; height: 100vh; overflow-y: auto; z-index: 1040; transition: transform .25s ease; }
.sidebar-brand { display: flex; gap: .75rem; align-items: center; padding: 1.25rem 1.25rem 1rem; border-bottom: 1px solid rgba(255, 255, 255, .08); }
.brand-logo { width: 40px; height: 40px; }
.brand-title { color: #fff; font-weight: 700; font-size: .95rem; line-height: 1.1; }
.brand-sub { font-size: .75rem; color: #93c5fd; }
.sidebar-nav { padding: .75rem .6rem 2rem; display: flex; flex-direction: column; gap: 2px; }
.sidebar-nav .nav-link { display: flex; align-items: center; gap: .7rem; color: #cbd5e1; padding: .6rem .8rem; border-radius: 10px; font-size: .9rem; transition: background .15s, color .15s; }
.sidebar-nav .nav-link i { font-size: 1.05rem; width: 1.2rem; text-align: center; }
.sidebar-nav .nav-link:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.sidebar-nav .nav-link.active { background: var(--c-blue); color: #fff; box-shadow: 0 4px 14px rgba(29, 111, 232, .35); }
.sidebar-sep { height: 1px; background: rgba(255, 255, 255, .08); margin: .75rem .5rem; }
.admin-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 1020; display: flex; align-items: center; gap: .5rem; padding: .85rem 1.5rem; background: rgba(255, 255, 255, .92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--c-border); }
.topbar-title { font-size: 1.15rem; font-weight: 700; margin: 0; color: var(--c-navy); }
.admin-content { padding: 1.5rem; flex: 1; }
.admin-footer { padding: 1rem 1.5rem; font-size: .75rem; color: var(--c-muted); }
.sidebar-backdrop { display: none; }
@media (max-width: 991.98px) {
  .sidebar { position: fixed; left: 0; top: 0; transform: translateX(-100%); }
  .sidebar.show { transform: none; }
  .sidebar-backdrop.show { display: block; position: fixed; inset: 0; background: rgba(15, 23, 42, .45); z-index: 1030; }
  .admin-content { padding: 1rem; }
  .topbar { padding: .75rem 1rem; }
}

/* KPIs */
.kpi { display: flex; flex-direction: row; align-items: center; gap: 1rem; padding: 1.1rem 1.2rem; }
.kpi-icon { width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center; font-size: 1.35rem; flex-shrink: 0; }
.kpi-value { font-size: 1.6rem; font-weight: 800; line-height: 1; color: var(--c-navy); font-variant-numeric: tabular-nums; }
.kpi-label { font-size: .8rem; color: var(--c-muted); margin-top: .25rem; }
.kpi-blue .kpi-icon { background: var(--c-blue-soft); color: var(--c-blue); }
.kpi-green .kpi-icon { background: #dcfce7; color: var(--c-green); }
.kpi-red .kpi-icon { background: #fee2e2; color: var(--c-red); }
.kpi-amber .kpi-icon { background: #fef3c7; color: var(--c-amber); }
.kpi-navy .kpi-icon { background: #e2e8f0; color: var(--c-navy); }
.kpi-cyan .kpi-icon { background: #cffafe; color: #0e7490; }

.avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; background: #e2e8f0; flex-shrink: 0; }
.avatar-lg { width: 96px; height: 96px; }
.avatar-placeholder { display: inline-grid; place-items: center; font-weight: 700; color: var(--c-blue); background: var(--c-blue-soft); }
.thumb { width: 52px; height: 52px; object-fit: cover; border-radius: 10px; cursor: zoom-in; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, .15); }
.filters-card .form-label { font-size: .75rem; color: var(--c-muted); margin-bottom: .2rem; font-weight: 600; }
.map-box { height: 320px; border-radius: 12px; overflow: hidden; border: 1px solid var(--c-border); }
.map-sm { height: 220px; }
.status-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.status-online { background: var(--c-green); box-shadow: 0 0 0 4px #dcfce7; }
.status-offline, .status-error, .status-auth_error { background: var(--c-red); box-shadow: 0 0 0 4px #fee2e2; }
.status-unknown { background: #94a3b8; box-shadow: 0 0 0 4px #e2e8f0; }
.code-box { background: #0f172a; color: #e2e8f0; border-radius: 10px; padding: .9rem 1rem; font-family: ui-monospace, Consolas, monospace; font-size: .8rem; word-break: break-all; }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { display: flex; gap: .75rem; padding: .55rem 0; border-bottom: 1px dashed var(--c-border); }
.timeline li:last-child { border-bottom: 0; }

/* ---------- App del empleado ---------- */
.emp-body { background: var(--c-bg); padding-bottom: calc(72px + env(safe-area-inset-bottom)); }
.emp-topbar { position: sticky; top: 0; z-index: 1020; display: flex; align-items: center; gap: .6rem; padding: .7rem 1rem; padding-top: calc(.7rem + env(safe-area-inset-top)); background: var(--c-navy); color: #fff; }
.brand-logo-sm { width: 30px; height: 30px; }
.emp-topbar-title { font-weight: 600; font-size: .95rem; }
.emp-main { max-width: 560px; margin: 0 auto; padding: 1rem; }
.emp-bottomnav { position: fixed; bottom: 0; left: 0; right: 0; z-index: 1020; display: flex; background: #fff; border-top: 1px solid var(--c-border); padding-bottom: env(safe-area-inset-bottom); box-shadow: 0 -4px 16px rgba(15, 23, 42, .06); }
.emp-bottomnav a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: .55rem 0 .5rem; color: var(--c-muted); text-decoration: none; font-size: .72rem; font-weight: 600; }
.emp-bottomnav a i { font-size: 1.35rem; }
.emp-bottomnav a.active { color: var(--c-blue); }

/* Reloj checador */
.clock-card { background: linear-gradient(160deg, var(--c-navy) 0%, var(--c-navy-2) 100%); color: #fff; border-radius: 22px; padding: 1.5rem 1.25rem 1.75rem; text-align: center; box-shadow: 0 14px 40px rgba(11, 37, 69, .35); position: relative; overflow: hidden; }
.clock-card::after { content: ""; position: absolute; right: -60px; top: -60px; width: 200px; height: 200px; border-radius: 50%; background: radial-gradient(circle, rgba(29, 111, 232, .45), transparent 70%); }
.clock-label { font-size: .72rem; letter-spacing: .2em; text-transform: uppercase; color: #93c5fd; font-weight: 700; }
.clock-time { font-size: 3rem; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.1; margin: .35rem 0 .1rem; letter-spacing: .02em; }
.clock-date { color: #cbd5e1; font-size: .95rem; }
.emp-photo { width: 104px; height: 104px; border-radius: 50%; object-fit: cover; border: 4px solid rgba(255, 255, 255, .85); margin: 1.25rem auto .75rem; display: block; background: #1e3a64; position: relative; z-index: 1; }
.emp-photo.placeholder { display: grid; place-items: center; font-size: 2.2rem; font-weight: 800; color: #93c5fd; }
.emp-name { font-size: 1.35rem; font-weight: 800; text-transform: uppercase; letter-spacing: .02em; position: relative; z-index: 1; }
.emp-no { color: #93c5fd; font-weight: 600; font-size: .9rem; position: relative; z-index: 1; }
.emp-meta { color: #cbd5e1; font-size: .8rem; position: relative; z-index: 1; }
.state-pill { display: inline-flex; align-items: center; gap: .45rem; margin-top: 1rem; padding: .45rem .95rem; border-radius: 999px; font-weight: 700; font-size: .8rem; letter-spacing: .04em; background: rgba(255, 255, 255, .12); position: relative; z-index: 1; }
.state-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: #94a3b8; }
.state-working .dot, .state-working_after_lunch .dot { background: #22c55e; box-shadow: 0 0 0 4px rgba(34, 197, 94, .25); animation: pulse 1.8s infinite; }
.state-lunch .dot { background: #f59e0b; }
.state-finished .dot { background: #60a5fa; }
@keyframes pulse { 50% { box-shadow: 0 0 0 7px rgba(34, 197, 94, 0); } }
.btn-punch { display: block; width: 100%; padding: 1.15rem 1rem; font-size: 1.15rem; font-weight: 800; letter-spacing: .03em; border-radius: 16px; border: 0; color: #fff; margin-top: 1.1rem;
  background: linear-gradient(135deg, #22c55e, #15803d); box-shadow: 0 10px 24px rgba(22, 163, 74, .35); transition: transform .1s ease, box-shadow .2s; }
.btn-punch:active { transform: scale(.98); }
.btn-punch.mv-LUNCH_OUT { background: linear-gradient(135deg, #f59e0b, #d97706); box-shadow: 0 10px 24px rgba(217, 119, 6, .35); }
.btn-punch.mv-LUNCH_IN { background: linear-gradient(135deg, #3b82f6, #1d4ed8); box-shadow: 0 10px 24px rgba(29, 78, 216, .35); }
.btn-punch.mv-OUT { background: linear-gradient(135deg, #ef4444, #b91c1c); box-shadow: 0 10px 24px rgba(185, 28, 28, .35); }
.btn-punch:disabled { opacity: .65; }
.btn-punch-secondary { width: 100%; margin-top: .6rem; border-radius: 14px; padding: .8rem; font-weight: 700; }
.day-summary .item { text-align: center; padding: .65rem .25rem; }
.day-summary .item .v { font-weight: 800; color: var(--c-navy); font-variant-numeric: tabular-nums; }
.day-summary .item .l { font-size: .7rem; color: var(--c-muted); text-transform: uppercase; letter-spacing: .05em; }

/* Cámara a pantalla completa */
.camera-overlay { position: fixed; inset: 0; z-index: 2000; background: #000; display: none; flex-direction: column; }
.camera-overlay.show { display: flex; }
.camera-head { color: #fff; padding: 1rem; padding-top: calc(1rem + env(safe-area-inset-top)); display: flex; align-items: center; gap: .75rem; }
.camera-stage { flex: 1; position: relative; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.camera-stage video, .camera-stage img { max-width: 100%; max-height: 100%; object-fit: contain; }
.camera-stage video.mirror { transform: scaleX(-1); }
.face-guide { position: absolute; width: min(62vw, 300px); aspect-ratio: 3/4; border: 3px dashed rgba(255, 255, 255, .7); border-radius: 50%; pointer-events: none; }
.camera-foot { padding: 1rem 1.25rem calc(1.25rem + env(safe-area-inset-bottom)); display: flex; gap: .75rem; justify-content: center; align-items: center; background: rgba(0, 0, 0, .6); }
.shutter { width: 76px; height: 76px; border-radius: 50%; border: 5px solid #fff; background: #fff; box-shadow: inset 0 0 0 4px #000; }
.shutter:active { transform: scale(.94); }
.camera-msg { color: #fff; text-align: center; padding: 1rem; }
.gps-chip { font-size: .78rem; padding: .3rem .65rem; border-radius: 999px; background: rgba(255, 255, 255, .12); color: #fff; }

/* Confirmación */
.success-screen { position: fixed; inset: 0; z-index: 2100; background: linear-gradient(160deg, #052e16, #14532d 60%, #166534); color: #fff; display: none; flex-direction: column; align-items: center; justify-content: center; padding: 1.5rem; text-align: center; overflow-y: auto; }
.success-screen.show { display: flex; animation: fadeIn .3s ease both; }
.check-anim { width: 92px; height: 92px; border-radius: 50%; background: #22c55e; display: grid; place-items: center; box-shadow: 0 0 0 0 rgba(34, 197, 94, .6); animation: ring 1.4s ease-out 1; }
.check-anim svg { width: 52px; height: 52px; }
.check-anim path { stroke-dasharray: 60; stroke-dashoffset: 60; animation: draw .6s .2s ease forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes ring { 0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, .7); } 100% { box-shadow: 0 0 0 40px rgba(34, 197, 94, 0); } }
.success-photo { width: 160px; height: 200px; object-fit: cover; border-radius: 16px; border: 4px solid rgba(255, 255, 255, .9); margin: 1.25rem 0 1rem; }
.success-mov { font-size: 1.4rem; font-weight: 800; text-transform: uppercase; }
.success-time { font-size: 2.6rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.error-screen { background: linear-gradient(160deg, #450a0a, #7f1d1d); }
