:root{
  --bg:#F5F7FB;
  --card:#FFFFFF;
  --text:#0F172A;
  --muted:#64748B;
  --border:rgba(15,23,42,.10);
  --primary:#2563EB;
  --primary-2:#1D4ED8;
  --success:#16A34A;
  --danger:#DC2626;
  --warning:#F59E0B;
  --shadow:0 10px 30px rgba(15,23,42,.08);
  --shadow-sm:0 6px 16px rgba(15,23,42,.08);
  --radius:16px;
  --pad:16px;
  --pad-lg:20px;
  --max:980px;
  --max-narrow:560px;
  --font:ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family:var(--font);
  background:linear-gradient(180deg, #F7F9FF 0%, var(--bg) 40%, var(--bg) 100%);
  color:var(--text);
}
a{color:inherit;text-decoration:none}
button,input,select{font:inherit}
img{max-width:100%;display:block}

.container{
  width:min(100% - 24px, var(--max));
  margin:0 auto;
  padding:18px 0 34px;
}
.container.narrow{width:min(100% - 24px, var(--max-narrow))}

.topbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:8px 0 14px;
}
.brand{
  display:flex;align-items:center;gap:10px;
  font-weight:800;
  letter-spacing:.2px;
}
.brand small{
  display:block;
  font-weight:600;
  color:var(--muted);
  letter-spacing:0;
}
.brand .logo{
  width:34px;height:34px;border-radius:10px;
  background:rgba(37,99,235,.10);
  display:grid;place-items:center;
  border:1px solid rgba(37,99,235,.18);
}
.brand .logo svg{width:22px;height:22px}
.actions{display:flex;align-items:center;gap:10px}

.btn{
  border:1px solid var(--border);
  background:var(--card);
  color:var(--text);
  padding:10px 12px;
  border-radius:12px;
  display:inline-flex;align-items:center;gap:10px;
  box-shadow:0 1px 0 rgba(15,23,42,.02);
  cursor:pointer;
}
.btn:hover{box-shadow:var(--shadow-sm)}
.btn.primary{
  background:linear-gradient(180deg, var(--primary) 0%, var(--primary-2) 100%);
  border-color:rgba(37,99,235,.45);
  color:white;
}
.btn.primary:hover{filter:brightness(1.02)}
.btn.full{width:100%;justify-content:center;padding:14px 14px;border-radius:14px}
.btn.small{padding:8px 10px;border-radius:10px}
.btn:disabled{opacity:.6;cursor:not-allowed;box-shadow:none}
.btn .spinner{
  width:16px;height:16px;border-radius:999px;
  border:2px solid rgba(255,255,255,.45);
  border-top-color:white;
  display:none;
  animation:spin .9s linear infinite;
}
.btn.loading .spinner{display:inline-block}
.btn.loading .label{opacity:.9}
@keyframes spin{to{transform:rotate(360deg)}}

.card{
  background:var(--card);
  border:1px solid var(--border);
  border-radius:var(--radius);
  box-shadow:var(--shadow);
}
.card.pad{padding:var(--pad-lg)}
.card.pad-sm{padding:var(--pad)}
.stack{display:flex;flex-direction:column;gap:12px}
.grid{display:grid;gap:12px}

.grid.kpis{grid-template-columns:repeat(3, 1fr)}
@media (max-width:860px){ .grid.kpis{grid-template-columns:repeat(2, 1fr)} }
@media (max-width:520px){ .grid.kpis{grid-template-columns:1fr} }

.kpi{
  display:flex;align-items:center;gap:12px;
  padding:14px 14px;
  border-radius:14px;
  border:1px solid var(--border);
  background:linear-gradient(180deg, rgba(15,23,42,.02) 0%, rgba(15,23,42,0) 100%);
}
.kpi .dot{
  width:36px;height:36px;border-radius:12px;
  display:grid;place-items:center;
  border:1px solid rgba(15,23,42,.10);
  background:rgba(37,99,235,.10);
}
.kpi .dot.green{background:rgba(22,163,74,.12)}
.kpi .dot.amber{background:rgba(245,158,11,.14)}
.kpi .dot.red{background:rgba(220,38,38,.12)}
.kpi .value{font-size:22px;font-weight:800;line-height:1}
.kpi .label{color:var(--muted);font-weight:650;font-size:13px;margin-top:4px}

.tabs{
  display:flex;
  align-items:center;
  background:rgba(15,23,42,.04);
  border:1px solid rgba(15,23,42,.08);
  border-radius:14px;
  padding:4px;
  width:max-content;
  gap:4px;
}
.tab{
  padding:10px 14px;
  border-radius:12px;
  cursor:pointer;
  border:0;
  background:transparent;
  color:var(--muted);
  font-weight:750;
}
.tab.active{
  background:var(--card);
  color:var(--text);
  box-shadow:0 10px 30px rgba(15,23,42,.06);
  border:1px solid rgba(15,23,42,.10);
}

.field{display:flex;flex-direction:column;gap:8px}
.field label{font-weight:750;color:var(--muted);font-size:13px}
.input, select.input{
  height:46px;
  border-radius:14px;
  border:1px solid rgba(15,23,42,.14);
  padding:0 14px;
  background:white;
  outline:none;
}
.input:focus, select.input:focus{
  border-color:rgba(37,99,235,.55);
  box-shadow:0 0 0 4px rgba(37,99,235,.14);
}
.help{color:var(--muted);font-size:13px;line-height:1.35}
.error{color:var(--danger);font-size:13px;font-weight:650}
.hr{height:1px;background:rgba(15,23,42,.08);margin:14px 0}

.badge{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding:8px 12px;
  border-radius:999px;
  font-weight:800;
  font-size:12px;
  border:1px solid rgba(15,23,42,.10);
  background:rgba(15,23,42,.03);
  color:var(--text);
}
.badge.green{background:rgba(22,163,74,.10);border-color:rgba(22,163,74,.25);color:#14532D}
.badge.red{background:rgba(220,38,38,.10);border-color:rgba(220,38,38,.25);color:#7F1D1D}
.badge.amber{background:rgba(245,158,11,.14);border-color:rgba(245,158,11,.25);color:#78350F}

.row{display:flex;align-items:center;justify-content:space-between;gap:12px}

.employee-card{
  padding:16px;
  border-radius:var(--radius);
  border:1px solid var(--border);
  background:linear-gradient(180deg, rgba(15,23,42,.02) 0%, rgba(15,23,42,0) 100%);
}
.employee-head{display:flex;align-items:flex-start;justify-content:space-between;gap:12px}
.employee-name{font-size:20px;font-weight:900;letter-spacing:.1px}
.employee-total{font-size:20px;font-weight:900}
.employee-body{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-top:10px}
.turns{display:flex;flex-direction:column;gap:8px;color:var(--text);font-weight:750}
.turns span{color:var(--muted);font-weight:700}
.thumbs{display:flex;gap:8px;flex-wrap:wrap}
.thumb{
  width:44px;height:44px;border-radius:14px;
  border:1px solid rgba(15,23,42,.12);
  overflow:hidden;background:rgba(15,23,42,.04);
}
.thumb img{width:100%;height:100%;object-fit:cover}

.filters{display:flex;flex-wrap:wrap;gap:10px;align-items:center}
.filters .grow{flex:1}

.toggle{
  display:flex;align-items:center;gap:10px;
  padding:10px 12px;border-radius:14px;
  background:var(--card);
  border:1px solid rgba(15,23,42,.10);
}
.switch{
  width:44px;height:26px;border-radius:999px;
  background:rgba(15,23,42,.15);
  position:relative;
}
.switch::after{
  content:"";
  width:20px;height:20px;border-radius:999px;
  background:white;position:absolute;top:3px;left:3px;
  transition:all .18s ease;
  box-shadow:0 8px 18px rgba(15,23,42,.18);
}
.toggle input{display:none}
.toggle input:checked + .switch{background:rgba(22,163,74,.35)}
.toggle input:checked + .switch::after{left:21px}

.camera{
  border-radius:18px;
  border:1px solid rgba(15,23,42,.10);
  overflow:hidden;
  background:rgba(15,23,42,.04);
  aspect-ratio:16/10;
  display:grid;place-items:center;
}
.camera video, .camera img{width:100%;height:100%;object-fit:cover}
.camera .placeholder{
  color:var(--muted);
  font-weight:750;
  text-align:center;
  padding:18px;
}

.toast-area{
  position:fixed;
  left:0;right:0;bottom:18px;
  display:flex;justify-content:center;
  z-index:9999;
  pointer-events:none;
}
.toast{
  pointer-events:auto;
  width:min(520px, calc(100% - 24px));
  background:rgba(15,23,42,.92);
  color:white;
  border-radius:16px;
  padding:14px 14px;
  display:flex;align-items:center;gap:10px;
  box-shadow:0 18px 40px rgba(15,23,42,.35);
  border:1px solid rgba(255,255,255,.12);
}
.toast .icon{
  width:34px;height:34px;border-radius:14px;
  display:grid;place-items:center;
  background:rgba(255,255,255,.12);
}
.toast.success .icon{background:rgba(22,163,74,.20)}
.toast.error .icon{background:rgba(220,38,38,.20)}
.toast .text{font-weight:750}
.toast .sub{font-size:12px;color:rgba(255,255,255,.75);margin-top:2px;font-weight:650}

.modal-backdrop{
  position:fixed;inset:0;
  background:rgba(2,6,23,.55);
  display:none;
  align-items:center;
  justify-content:center;
  padding:18px;
  z-index:9998;
}
.modal-backdrop.show{display:flex}
.modal{
  width:min(720px, 100%);
  background:var(--card);
  border-radius:18px;
  border:1px solid rgba(15,23,42,.10);
  box-shadow:0 30px 70px rgba(2,6,23,.45);
  overflow:hidden;
}
.modal header{
  padding:14px 16px;
  display:flex;align-items:center;justify-content:space-between;gap:10px;
  border-bottom:1px solid rgba(15,23,42,.08);
}
.modal header h3{margin:0;font-size:16px;font-weight:900}
.modal .content{padding:16px}
.modal .content img{border-radius:14px;border:1px solid rgba(15,23,42,.10)}

/* Tabla (modo rango) */
.table{
  width:100%;
  border-collapse:separate;
  border-spacing:0;
}
.table thead th{
  text-align:left;
  padding:12px 14px;
  font-size:13px;
  color:var(--muted);
  background:rgba(148,163,184,.08);
  border-bottom:1px solid var(--border);
}
.table tbody td{
  padding:12px 14px;
  border-bottom:1px solid var(--border);
  font-weight:800;
}
.table tbody tr:last-child td{
  border-bottom:none;
}
.table .num{
  text-align:right;
  font-variant-numeric: tabular-nums;
}


/* Admin sections */
.section{margin-top:14px}
.section-tabs{
  display:flex;
  align-items:center;
  background:rgba(15,23,42,.04);
  border:1px solid rgba(15,23,42,.08);
  border-radius:14px;
  padding:4px;
  gap:4px;
  margin-top:14px;
  overflow:auto;
}
.section-tabs .tab{
  flex:1;
  min-width:130px;
  text-align:center;
  white-space:nowrap;
}
