/* ==========================================================================
   Registro de Asistencia QR — estilos
   Para cambiar los colores del colegio: edita las variables --brand y --brand-2
   ========================================================================== */
:root {
  --brand: #1d4ed8;
  --brand-2: #06b6d4;
  --brand-soft: #eff6ff;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e5e9f2;
  --bg: #f4f6fb;
  --surface: #ffffff;
  --ok: #15803d;
  --ok-bg: #dcfce7;
  --warn: #b45309;
  --warn-bg: #fef3c7;
  --bad: #b91c1c;
  --bad-bg: #fee2e2;
  --navy: #0a1530;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.05), 0 10px 30px rgba(15, 23, 42, 0.06);
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  --display: 'Outfit', 'Inter', system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
body[data-view='home'], body[data-view='login'], body[data-view='scan'] { background: #06101f; color: #e8ecff; }
img { max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
h1, h2, h3, h4 { font-family: var(--display); margin: 0; letter-spacing: -0.01em; line-height: 1.15; }
p { margin: 0; }
.ic { width: 20px; height: 20px; flex: none; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.strong { font-weight: 600; }
.center { text-align: center; }
.pad { padding: 28px 16px; }
.grow { flex: 1; min-width: 0; }
.mono { font-variant-numeric: tabular-nums; font-feature-settings: 'tnum'; }
[hidden] { display: none !important; }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px; border-radius: 12px; border: 1px solid transparent;
  font-weight: 600; font-size: 14px; line-height: 1.2; white-space: nowrap;
  transition: transform .12s, box-shadow .2s, background .2s, border-color .2s, opacity .2s;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary { color: #fff; background: linear-gradient(135deg, var(--brand), #2563eb 55%, var(--brand-2)); box-shadow: 0 6px 18px rgba(29, 78, 216, 0.32); }
.btn-primary:hover:not(:disabled) { box-shadow: 0 8px 24px rgba(29, 78, 216, 0.42); filter: brightness(1.05); }
.btn-ghost { color: var(--ink); background: var(--surface); border-color: var(--line); }
.btn-ghost:hover:not(:disabled) { border-color: #c7d0e4; background: #f8faff; }
.btn-danger { color: #fff; background: #dc2626; }
.btn-danger-ghost { color: var(--bad); background: transparent; border-color: #fecaca; }
.btn-danger-ghost:hover { background: var(--bad-bg); }
.btn-glass { color: #e8ecff; background: rgba(255, 255, 255, 0.08); border-color: rgba(255, 255, 255, 0.16); backdrop-filter: blur(8px); }
.btn-glass:hover { background: rgba(255, 255, 255, 0.14); }
.btn-lg { padding: 14px 24px; font-size: 15px; border-radius: 14px; }
.btn-sm { padding: 7px 12px; font-size: 13px; border-radius: 10px; }
.btn.block { width: 100%; }
.btn.loading { position: relative; color: transparent !important; pointer-events: none; }
.btn.loading::after {
  content: ''; position: absolute; width: 18px; height: 18px; border-radius: 50%;
  border: 2.5px solid rgba(255, 255, 255, 0.5); border-top-color: #fff; animation: spin .7s linear infinite;
}
.btn-ghost.loading::after { border-color: rgba(15, 23, 42, 0.2); border-top-color: var(--brand); }
.icon-btn {
  display: inline-grid; place-items: center; width: 42px; height: 42px; border-radius: 12px;
  color: #e8ecff; background: rgba(255, 255, 255, 0.08); border: 1px solid rgba(255, 255, 255, 0.14);
}
.icon-btn.dark { color: var(--ink); background: var(--surface); border-color: var(--line); }
.icon-btn svg { width: 22px; height: 22px; }
.spinner { width: 20px; height: 20px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--brand); animation: spin .7s linear infinite; display: inline-block; }
.loading-box { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 48px; color: var(--muted); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Formularios ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field label { font-size: 13px; font-weight: 600; color: #334155; display: flex; align-items: center; gap: 8px; }
input, select, textarea {
  font: inherit; color: var(--ink); background: #fff; border: 1px solid #d5dcec; border-radius: 12px;
  padding: 11px 14px; width: 100%; transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; line-height: 1.55; min-height: 140px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px rgba(29, 78, 216, 0.14); }
.hint { font-size: 12.5px; color: var(--muted); }
.field.inline { margin: 0; flex-direction: column; min-width: 170px; }
.count {
  display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 999px;
  font-size: 12px; font-weight: 700; background: var(--brand-soft); color: var(--brand);
}
.code, .code-pill { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.form-error { color: #fca5a5; font-size: 13.5px; min-height: 20px; margin: -4px 0 8px; }

/* ---------- Chips ---------- */
.chip { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.chip-ok { color: var(--ok); background: var(--ok-bg); }
.chip-warn { color: var(--warn); background: var(--warn-bg); }
.chip-off { color: #475569; background: #eef1f6; }
.pill { display: inline-flex; align-items: center; gap: 7px; padding: 7px 14px; border-radius: 999px; font-size: 13px; font-weight: 600; background: #fff; border: 1px solid var(--line); color: #334155; }
.pill .ic { width: 16px; height: 16px; }
.pill-ok { color: var(--ok); background: var(--ok-bg); border-color: transparent; }
.pill-warn { color: var(--warn); background: var(--warn-bg); border-color: transparent; }
.pill-bad { color: var(--bad); background: var(--bad-bg); border-color: transparent; }
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--brand); margin-bottom: 6px; }
.eyebrow.light { color: #7dd3fc; }

/* ---------- Avisos y modales ---------- */
#toasts { position: fixed; z-index: 900; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 10px; max-width: min(92vw, 380px); }
.toast { padding: 12px 16px; border-radius: 12px; color: #fff; background: #1e293b; font-size: 14px; font-weight: 500; box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25); animation: toastIn .3s ease both; }
.toast.out { opacity: 0; transform: translateY(8px); transition: .3s; }
.toast-success { background: #15803d; }
.toast-error { background: #b91c1c; }
.toast-warn { background: #b45309; }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px) scale(.96); } }
.modal-backdrop { position: fixed; inset: 0; z-index: 800; background: rgba(8, 12, 28, 0.55); backdrop-filter: blur(4px); display: grid; place-items: center; padding: 16px; animation: fade .2s ease; }
.modal { background: #fff; color: var(--ink); border-radius: 20px; padding: 26px; width: min(100%, 440px); max-height: 92vh; overflow: auto; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.35); animation: pop .25s cubic-bezier(.2, 1.2, .3, 1); }
.modal h3 { font-size: 20px; margin-bottom: 8px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; flex-wrap: wrap; }
.qr-modal { text-align: center; }
.qr-big { width: min(100%, 300px); border-radius: 14px; border: 1px solid var(--line); margin-bottom: 14px; image-rendering: pixelated; }
.code-pill { display: inline-block; margin-top: 10px; padding: 5px 12px; border-radius: 8px; background: #f1f5f9; font-size: 13px; letter-spacing: .04em; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: scale(.92) translateY(10px); } }

/* ==========================================================================
   APERTURA
   ========================================================================== */
.intro { position: fixed; inset: 0; z-index: 1000; background: #040b1a; color: #fff; display: grid; place-items: center; overflow: hidden; transition: opacity .8s ease, transform .8s ease; }
.intro--out { opacity: 0; transform: scale(1.05); pointer-events: none; }
#intro-canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.intro-aurora {
  position: absolute; inset: -25%; filter: blur(34px); opacity: .65; animation: drift 14s ease-in-out infinite alternate;
  background:
    radial-gradient(40% 40% at 25% 30%, rgba(37, 99, 235, .55), transparent 70%),
    radial-gradient(35% 35% at 75% 65%, rgba(6, 182, 212, .45), transparent 70%),
    radial-gradient(30% 30% at 62% 14%, rgba(236, 72, 153, .25), transparent 70%);
}
@keyframes drift { to { transform: translate(4%, -3%) scale(1.12) rotate(6deg); } }
.intro-center { position: relative; display: flex; flex-direction: column; align-items: center; text-align: center; padding: 24px; }
.intro-logo-wrap { position: relative; width: min(38vw, 180px); aspect-ratio: 1; display: grid; place-items: center; margin-bottom: 30px; }
.intro-logo { position: relative; width: 100%; height: 100%; object-fit: contain; opacity: .4; transform: scale(.92); background: #fff; border-radius: 50%; padding: 9%; box-shadow: 0 10px 50px rgba(37, 99, 235, .6); animation: float 3.2s ease-in-out infinite alternate; }
@keyframes float { to { transform: scale(.98) translateY(-6px); } }
.ring { position: absolute; inset: 0; border-radius: 50%; border: 2px solid rgba(125, 211, 252, .6); opacity: 0; }
.intro--play .intro-logo { animation: logoPop 1.2s .3s cubic-bezier(.2, 1.5, .3, 1) both; }
.intro--play .ring { animation: ring 2.6s ease-out infinite; }
.intro--play .r1 { animation-delay: .7s; }
.intro--play .r2 { animation-delay: 1.5s; }
.intro--play .r3 { animation-delay: 2.3s; }
@keyframes logoPop { from { opacity: 0; transform: scale(.2) rotate(-14deg); filter: blur(12px); } to { opacity: 1; transform: scale(1); box-shadow: 0 10px 70px rgba(37, 99, 235, .85); } }
@keyframes ring { from { transform: scale(.8); opacity: .75; } to { transform: scale(2.3); opacity: 0; } }
.intro-school { font-family: var(--display); font-size: clamp(22px, 4.6vw, 42px); font-weight: 700; opacity: 0; margin-bottom: 10px; text-wrap: balance; }
.intro--play .intro-school { animation: fadeUp .9s 1.4s cubic-bezier(.2, .8, .2, 1) both; background: linear-gradient(90deg, #fff, #bae6fd 60%, #bfdbfe); -webkit-background-clip: text; background-clip: text; color: transparent; }
.intro-title { font-size: clamp(15px, 2.6vw, 21px); font-weight: 500; letter-spacing: .04em; color: #c7d9ff; min-height: 1.5em; }
.intro-title .ch { display: inline-block; opacity: 0; transform: translateY(14px); }
.intro--play .intro-title .ch { animation: chIn .6s calc(2.1s + var(--i) * .045s) cubic-bezier(.2, .8, .2, 1) both; }
.intro-sub { margin-top: 8px; font-size: 13px; letter-spacing: .16em; text-transform: uppercase; color: #7dd3fc; opacity: 0; }
.intro--play .intro-sub { animation: fadeUp .8s 3.6s both; }
.intro-bar { width: min(260px, 60vw); height: 3px; background: rgba(255, 255, 255, .12); border-radius: 3px; margin-top: 30px; overflow: hidden; opacity: 0; }
.intro-bar span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #2563eb, #22d3ee); border-radius: 3px; }
.intro--play .intro-bar { opacity: 1; transition: opacity .4s .3s; }
.intro--play .intro-bar span { animation: fill 6.2s .3s linear forwards; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
@keyframes chIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes fill { to { width: 100%; } }
.intro-start {
  position: absolute; bottom: max(12vh, 70px); left: 50%; transform: translateX(-50%); display: inline-flex; align-items: center; gap: 12px;
  padding: 15px 30px; border-radius: 999px; font-size: 16px; font-weight: 600; color: #fff;
  background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .28); backdrop-filter: blur(10px); animation: breathe 2.4s ease-in-out infinite;
}
.intro-start .pulse { width: 10px; height: 10px; border-radius: 50%; background: #22d3ee; box-shadow: 0 0 0 0 rgba(34, 211, 238, .7); animation: ping 1.6s infinite; }
@keyframes breathe { 50% { transform: translateX(-50%) scale(1.05); background: rgba(255, 255, 255, .16); } }
@keyframes ping { to { box-shadow: 0 0 0 14px rgba(34, 211, 238, 0); } }
.intro-skip { position: absolute; top: max(18px, env(safe-area-inset-top)); right: 18px; padding: 8px 16px; border-radius: 999px; font-size: 13px; color: #c7d9ff; background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .18); }

/* ==========================================================================
   INICIO / LOGIN
   ========================================================================== */
.home { position: relative; min-height: 100dvh; overflow: hidden; display: flex; flex-direction: column; padding: max(22px, env(safe-area-inset-top)) 22px 22px; }
.aurora { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.aurora i { position: absolute; border-radius: 50%; filter: blur(90px); opacity: .5; animation: blob 16s ease-in-out infinite alternate; }
.aurora i:nth-child(1) { width: 46vmax; height: 46vmax; left: -12vmax; top: -14vmax; background: #1d4ed8; }
.aurora i:nth-child(2) { width: 38vmax; height: 38vmax; right: -10vmax; top: 20vh; background: #0891b2; animation-delay: -5s; }
.aurora i:nth-child(3) { width: 30vmax; height: 30vmax; left: 25vw; bottom: -16vmax; background: #d97706; opacity: .32; animation-delay: -9s; }
@keyframes blob { to { transform: translate(6vmax, -4vmax) scale(1.15); } }
.home-head { position: relative; display: flex; align-items: center; gap: 14px; max-width: 1000px; width: 100%; margin: 0 auto; }
.brand-logo { width: 58px; height: 58px; object-fit: contain; background: #fff; border-radius: 16px; padding: 4px; box-shadow: 0 6px 18px rgba(37, 99, 235, .45); }
.home-head strong { display: block; font-family: var(--display); font-size: 18px; color: #fff; }
.home-head span { font-size: 13px; color: #9fb0e6; }
.home-main { position: relative; flex: 1; display: flex; flex-direction: column; justify-content: center; max-width: 1000px; width: 100%; margin: 0 auto; padding: 28px 0; }
.home-main h1 { font-size: clamp(38px, 8vw, 76px); font-weight: 800; color: #fff; line-height: 1.02; margin-bottom: 14px; }
.home-main h1 em { font-style: normal; background: linear-gradient(90deg, #60a5fa, #22d3ee); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lead { font-size: clamp(16px, 2.4vw, 20px); color: #aab8ea; margin-bottom: 34px; }
.home-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.home-card {
  display: flex; align-items: center; gap: 18px; padding: 24px; border-radius: 24px; color: #fff;
  background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .13); backdrop-filter: blur(16px);
  transition: transform .2s, background .2s, border-color .2s, box-shadow .2s;
}
.home-card:hover { transform: translateY(-4px); background: rgba(255, 255, 255, .1); border-color: rgba(255, 255, 255, .28); }
.home-card.primary { background: linear-gradient(135deg, rgba(37, 99, 235, .75), rgba(6, 182, 212, .55)); border-color: rgba(255, 255, 255, .3); box-shadow: 0 20px 50px rgba(29, 78, 216, .35); }
.hc-ic { display: grid; place-items: center; width: 62px; height: 62px; border-radius: 18px; background: rgba(255, 255, 255, .14); flex: none; }
.hc-ic .ic { width: 30px; height: 30px; }
.hc-txt h2 { font-size: 22px; margin-bottom: 4px; }
.hc-txt p { font-size: 14px; color: rgba(255, 255, 255, .78); }
.hc-txt { flex: 1; }
.hc-go { opacity: .7; transition: transform .2s; }
.home-card:hover .hc-go { transform: translateX(5px); opacity: 1; }
.home-foot { position: relative; max-width: 1000px; width: 100%; margin: 0 auto; display: flex; gap: 10px; color: #8294d6; font-size: 14px; font-variant-numeric: tabular-nums; flex-wrap: wrap; }
.home-foot #home-clock { color: #fff; font-weight: 600; }
.login-page { align-items: center; justify-content: center; }
.login-back { position: absolute; top: max(18px, env(safe-area-inset-top)); left: 18px; display: inline-flex; align-items: center; gap: 6px; color: #aab8ea; font-size: 14px; z-index: 2; }
.login-back .ic { transform: rotate(180deg); width: 18px; }
.login-card { position: relative; width: min(100%, 410px); padding: 34px 30px; border-radius: 26px; background: rgba(255, 255, 255, .07); border: 1px solid rgba(255, 255, 255, .15); backdrop-filter: blur(22px); box-shadow: 0 30px 80px rgba(0, 0, 0, .4); }
.login-logo { display: block; width: 92px; height: 92px; object-fit: contain; margin: 0 auto 14px; background: #fff; border-radius: 22px; padding: 6px; box-shadow: 0 8px 28px rgba(37, 99, 235, .5); }
.login-card h1 { font-size: 26px; text-align: center; color: #fff; }
.login-card > .muted { text-align: center; margin: 6px 0 24px; color: #9fb0e6; font-size: 14px; }
.login-card .field label { color: #c4d0ff; }
.login-card input { background: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .18); color: #fff; }
.login-card input:focus { border-color: #60a5fa; box-shadow: 0 0 0 4px rgba(129, 140, 248, .25); }
.pass-wrap { position: relative; }
.pass-wrap input { padding-right: 48px; }
.pass-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 38px; height: 38px; border: 0; background: transparent; color: #aab8ea; border-radius: 10px; display: grid; place-items: center; }
.shake { animation: shake .4s; }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
.setup-card { position: relative; margin: auto; width: min(100%, 560px); padding: 34px; border-radius: 24px; background: rgba(255, 255, 255, .07); border: 1px solid rgba(255, 255, 255, .15); backdrop-filter: blur(20px); color: #e8ecff; }
.setup-card h1 { font-size: 28px; margin-bottom: 12px; color: #fff; }
.setup-card ol { padding-left: 20px; line-height: 1.7; margin: 16px 0; }
.setup-card code { background: rgba(255, 255, 255, .12); padding: 2px 8px; border-radius: 6px; }
.setup-card .btn { margin-top: 10px; }

/* ==========================================================================
   ESCÁNER
   ========================================================================== */
.scan { min-height: 100dvh; display: flex; flex-direction: column; color: #e8ecff; background: radial-gradient(70% 50% at 50% -10%, rgba(29, 78, 216, .35), transparent), #06101f; }
.scan-top { display: flex; align-items: center; gap: 14px; padding: max(14px, env(safe-area-inset-top)) 16px 10px; max-width: 1180px; width: 100%; margin: 0 auto; }
.scan-title { flex: 1; min-width: 0; }
.scan-title strong { display: block; font-family: var(--display); font-size: 19px; color: #fff; }
.scan-title span { font-size: 13px; color: #9fb0e6; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.scan-clock { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 20px; color: #fff; padding: 8px 14px; border-radius: 12px; background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .12); }
.scan-grid { display: grid; grid-template-columns: minmax(300px, 520px) 1fr; gap: 20px; padding: 10px 16px 28px; max-width: 1180px; width: 100%; margin: 0 auto; align-items: start; }
.viewfinder { position: relative; aspect-ratio: 1; width: 100%; border-radius: 28px; overflow: hidden; background: #000; border: 1px solid rgba(255, 255, 255, .15); box-shadow: 0 24px 60px rgba(0, 0, 0, .5); }
.viewfinder video { width: 100%; height: 100%; object-fit: cover; display: block; }
.vf-frame { position: absolute; inset: 14%; pointer-events: none; }
.vf-frame i { position: absolute; width: 38px; height: 38px; border: 4px solid #22d3ee; filter: drop-shadow(0 0 8px rgba(34, 211, 238, .8)); }
.vf-frame i:nth-child(1) { top: 0; left: 0; border-right: 0; border-bottom: 0; border-top-left-radius: 14px; }
.vf-frame i:nth-child(2) { top: 0; right: 0; border-left: 0; border-bottom: 0; border-top-right-radius: 14px; }
.vf-frame i:nth-child(3) { bottom: 0; left: 0; border-right: 0; border-top: 0; border-bottom-left-radius: 14px; }
.vf-frame i:nth-child(4) { bottom: 0; right: 0; border-left: 0; border-top: 0; border-bottom-right-radius: 14px; }
.vf-line { position: absolute; left: 6%; right: 6%; height: 3px; border-radius: 3px; background: linear-gradient(90deg, transparent, #22d3ee, transparent); box-shadow: 0 0 18px #22d3ee; animation: sweep 2.4s ease-in-out infinite alternate; }
@keyframes sweep { from { top: 4%; } to { top: 94%; } }
.vf-msg { position: absolute; inset: 0; display: none; place-items: center; text-align: center; padding: 28px; background: rgba(5, 8, 22, .88); color: #c7d9ff; font-size: 15px; line-height: 1.5; }
.vf-msg.show { display: grid; }
.scan-tools { display: flex; gap: 10px; margin: 14px 0; flex-wrap: wrap; }
.scan-manual { display: flex; gap: 10px; }
.scan-manual input { background: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .16); color: #fff; font-family: ui-monospace, Menlo, monospace; text-transform: uppercase; letter-spacing: .04em; }
.scan-manual input::placeholder { text-transform: none; letter-spacing: 0; font-family: var(--font); color: #8294d6; }
.scan-result { position: relative; text-align: center; padding: 30px 22px; border-radius: 28px; min-height: 320px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; border: 1px solid rgba(255, 255, 255, .14); transition: background .3s; animation: resultIn .35s cubic-bezier(.2, 1.2, .3, 1); }
@keyframes resultIn { from { transform: scale(.96); opacity: .4; } }
.scan-result.idle { background: rgba(255, 255, 255, .05); }
.scan-result.ok { background: linear-gradient(145deg, #15803d, #16a34a 60%, #0d9488); box-shadow: 0 20px 60px rgba(22, 163, 74, .4); border-color: transparent; }
.scan-result.late { background: linear-gradient(145deg, #b45309, #d97706 60%, #ea580c); box-shadow: 0 20px 60px rgba(217, 119, 6, .4); border-color: transparent; }
.scan-result.dup { background: linear-gradient(145deg, #1d4ed8, #1d4ed8); box-shadow: 0 20px 60px rgba(29, 78, 216, .4); border-color: transparent; }
.scan-result.exit { background: linear-gradient(145deg, #0f766e, #0891b2 60%, #1d4ed8); box-shadow: 0 20px 60px rgba(8, 145, 178, .4); border-color: transparent; }
.scan-result.err { background: linear-gradient(145deg, #991b1b, #dc2626); box-shadow: 0 20px 60px rgba(220, 38, 38, .4); border-color: transparent; }
.scan-result h2 { font-size: clamp(24px, 4.6vw, 36px); color: #fff; text-wrap: balance; }
.res-icon { width: 76px; height: 76px; border-radius: 50%; display: grid; place-items: center; background: rgba(255, 255, 255, .2); margin-bottom: 10px; animation: iconPop .5s cubic-bezier(.2, 1.6, .3, 1); }
.res-icon svg { width: 42px; height: 42px; }
.res-icon.pulse { background: rgba(125, 211, 252, .12); color: #7dd3fc; animation: breatheIc 2.2s ease-in-out infinite; }
@keyframes iconPop { from { transform: scale(.2); } }
@keyframes breatheIc { 50% { transform: scale(1.1); box-shadow: 0 0 0 16px rgba(125, 211, 252, 0); } }
.res-course { font-size: 17px; font-weight: 600; color: rgba(255, 255, 255, .92); }
.res-msg { color: rgba(255, 255, 255, .82); margin-top: 8px; font-size: 15px; }
.res-time { font-family: var(--display); font-size: clamp(44px, 9vw, 68px); font-weight: 700; line-height: 1; color: #fff; font-variant-numeric: tabular-nums; }
.res-date { color: rgba(255, 255, 255, .85); font-size: 15px; margin-bottom: 8px; }
.scan-result .chip { font-size: 14px; padding: 5px 16px; }
.scan-result.idle p { color: #9fb0e6; }
.scan-result.idle h2 { color: #e8ecff; }
.scan-log { margin-top: 16px; padding: 18px; border-radius: 22px; background: rgba(255, 255, 255, .05); border: 1px solid rgba(255, 255, 255, .1); }
.scan-log h3 { font-size: 16px; color: #fff; display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.scan-log .count { background: rgba(255, 255, 255, .14); color: #fff; }
.scan-log ul { list-style: none; margin: 0; padding: 0; max-height: 300px; overflow: auto; }
.scan-log li { display: flex; align-items: center; gap: 12px; padding: 10px 4px; border-top: 1px solid rgba(255, 255, 255, .08); }
.scan-log li.empty { color: #8294d6; justify-content: center; border: 0; }
.scan-log li div { flex: 1; min-width: 0; }
.scan-log li strong { display: block; font-size: 14.5px; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.scan-log li small { color: #8fa0dc; font-size: 12.5px; }
.scan-log li time { font-size: 13px; color: #c7d9ff; font-variant-numeric: tabular-nums; }
.scan-log .dot { width: 10px; height: 10px; border-radius: 50%; background: #22c55e; flex: none; }
.scan-log li.late .dot { background: #f59e0b; }
.scan-log li.dup .dot { background: #60a5fa; }

/* ==========================================================================
   PANEL DE ADMINISTRACIÓN
   ========================================================================== */
.admin { min-height: 100dvh; }
.sidebar { position: fixed; z-index: 60; inset: 0 auto 0 0; width: 280px; display: flex; flex-direction: column; background: var(--navy); color: #cbd5f5; border-right: 1px solid rgba(255, 255, 255, .06); transition: transform .28s cubic-bezier(.2, .8, .2, 1); }
.side-brand { display: flex; align-items: center; gap: 12px; padding: 20px 18px 16px; }
.side-brand img { width: 48px; height: 48px; object-fit: contain; flex: none; background: #fff; border-radius: 13px; padding: 3px; }
.side-brand strong { display: block; color: #fff; font-family: var(--display); font-size: 16px; line-height: 1.2; }
.side-brand span { font-size: 12px; color: #7f8fc2; }
.side-nav { flex: 1; overflow-y: auto; padding: 6px 12px 12px; display: flex; flex-direction: column; gap: 2px; scrollbar-width: thin; scrollbar-color: #25304f transparent; }
.nav-item, .side-link { display: flex; align-items: center; gap: 12px; width: 100%; padding: 11px 12px; border-radius: 12px; border: 0; background: transparent; color: #aebbe6; font-size: 14.5px; font-weight: 500; text-align: left; transition: background .15s, color .15s; }
.nav-item:hover, .side-link:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav-item.active { background: linear-gradient(135deg, rgba(37, 99, 235, .38), rgba(6, 182, 212, .2)); color: #fff; box-shadow: inset 0 0 0 1px rgba(129, 140, 248, .35); }
.nav-item .chev { margin-left: auto; transition: transform .2s; display: grid; }
.nav-item .chev .ic { width: 16px; height: 16px; }
.nav-item .chev.open { transform: rotate(90deg); }
.nav-sub { display: none; margin: 2px 0 6px 18px; padding-left: 12px; border-left: 1px solid rgba(255, 255, 255, .09); }
.nav-sub.open { display: block; animation: fade .2s; }
.nav-group { margin: 10px 0 4px 8px; font-size: 10.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: #5f6f9f; }
.nav-course { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; border-radius: 10px; font-size: 14px; color: #a2b0de; }
.nav-course:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav-course.active { background: rgba(37, 99, 235, .28); color: #fff; font-weight: 600; }
.nav-course em { font-style: normal; font-size: 11.5px; font-weight: 700; padding: 1px 8px; border-radius: 999px; background: rgba(255, 255, 255, .1); color: #dbe4ff; }
.side-foot { padding: 12px; border-top: 1px solid rgba(255, 255, 255, .07); display: flex; flex-direction: column; gap: 2px; }
.scrim { display: none; }
.admin-main { margin-left: 280px; min-height: 100dvh; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: 14px; padding: 14px 28px; background: rgba(244, 246, 251, .85); backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); }
.topbar h2 { font-size: 20px; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#menu-btn { display: none; }
.top-meta { display: flex; align-items: center; gap: 10px; font-size: 13.5px; color: var(--muted); }
.top-meta b { color: var(--ink); font-variant-numeric: tabular-nums; font-size: 15px; }
.banner { display: flex; align-items: center; gap: 12px; margin: 16px 28px 0; padding: 12px 16px; border-radius: 14px; font-size: 14px; }
.banner.warn { background: var(--warn-bg); color: #78350f; border: 1px solid #fde68a; }
.banner a { text-decoration: underline; font-weight: 600; }
.content { padding: 26px 28px 60px; }
.page { max-width: 1180px; margin: 0 auto; }
.page.narrow { max-width: 820px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1, .hero h1 { font-size: clamp(26px, 3.4vw, 34px); }
.page-head p { margin-top: 6px; max-width: 640px; }
.head-actions, .hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); margin-bottom: 18px; }
.card.flush { padding: 0; overflow: hidden; }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.card-head h3 { font-size: 18px; }
.actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; align-items: center; }
.actions.between { justify-content: space-between; }
.actions.start { justify-content: flex-start; margin-top: 10px; }
.empty-state { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; padding: 36px 16px; color: var(--muted); }
.empty-state > .ic { width: 42px; height: 42px; color: #93c5fd; }
.empty-state h4 { font-size: 18px; color: var(--ink); }
.empty-state .btn { margin-top: 10px; }

/* Resumen */
.hero { display: flex; justify-content: space-between; align-items: flex-end; gap: 18px; flex-wrap: wrap; margin-bottom: 22px; }
.hero .muted { margin-top: 6px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat { position: relative; display: flex; align-items: center; gap: 14px; padding: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.stat b { display: block; font-family: var(--display); font-size: 32px; line-height: 1; }
.stat small { color: var(--muted); font-size: 13px; }
.stat-ic { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 14px; }
.c-ok { color: var(--ok); background: var(--ok-bg); }
.c-warn { color: var(--warn); background: var(--warn-bg); }
.c-bad { color: var(--bad); background: var(--bad-bg); }
.c-brand { color: var(--brand); background: var(--brand-soft); }
.stat .pct { position: absolute; top: 14px; right: 16px; font-style: normal; font-weight: 700; font-size: 13px; color: var(--ok); }
.cols { display: grid; grid-template-columns: 1.15fr 1fr; gap: 18px; align-items: start; }
.bars { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.bars a { display: block; }
.bars a:hover .bar-top span { color: var(--brand); }
.bar-top { display: flex; justify-content: space-between; font-size: 14px; margin-bottom: 6px; font-weight: 500; }
.bar-top em { font-style: normal; color: var(--muted); font-variant-numeric: tabular-nums; }
.bar { height: 9px; border-radius: 9px; background: #eef1f8; overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 9px; background: linear-gradient(90deg, var(--brand), var(--brand-2)); transition: width .6s cubic-bezier(.2, .8, .2, 1); }
.live { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 600; color: var(--ok); }
.live i { width: 8px; height: 8px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 0 rgba(34, 197, 94, .6); animation: ping2 1.8s infinite; }
@keyframes ping2 { to { box-shadow: 0 0 0 9px rgba(34, 197, 94, 0); } }
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-top: 1px solid var(--line); }
.feed li:first-child { border-top: 0; }
.avatar { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; font-weight: 700; color: var(--brand); background: var(--brand-soft); flex: none; }
.feed strong { display: block; font-size: 14.5px; }
.feed small { color: var(--muted); font-size: 12.5px; }
.feed-r { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.feed-r time { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* Curso / tablas */
.chips-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.toolbar { display: flex; gap: 12px; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.toolbar.wrap { flex-wrap: wrap; align-items: flex-end; }
.search { position: relative; flex: 1; min-width: 200px; }
.search .ic { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); width: 18px; color: var(--muted); }
.search input { padding-left: 40px; }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; padding: 11px 16px; font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); background: #f8f9fd; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 10px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:hover { background: #fafbff; }
.table .num { width: 48px; color: var(--muted); font-variant-numeric: tabular-nums; }
.table .r { text-align: right; }
.table .nm strong { display: block; font-weight: 600; }
.table .nm small { font-size: 12px; color: var(--muted); }
.table .strong { font-weight: 700; }
.acts { text-align: right; white-space: nowrap; }
.qr-thumb { width: 52px; height: 52px; padding: 3px; background: #fff; border: 1px solid var(--line); border-radius: 10px; transition: transform .15s, box-shadow .15s; }
.qr-thumb:hover { transform: scale(1.12); box-shadow: var(--shadow); }
.qr-thumb img { width: 100%; height: 100%; display: block; image-rendering: pixelated; }
.icon-act { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; border: 0; background: transparent; color: #64748b; transition: background .15s, color .15s; }
.icon-act:hover { background: #eff6ff; color: var(--brand); }
.icon-act.ok:hover { background: var(--ok-bg); color: var(--ok); }
.icon-act.bad:hover { background: var(--bad-bg); color: var(--bad); }
.icon-act .ic { width: 18px; height: 18px; }
.tabs { display: flex; gap: 4px; padding: 0 12px; border-bottom: 1px solid var(--line); }
.tab { display: inline-flex; align-items: center; gap: 8px; padding: 13px 14px; border: 0; background: transparent; font-weight: 600; font-size: 14px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab small { font-weight: 500; color: var(--warn); }
.tab.active { color: var(--brand); border-bottom-color: var(--brand); }

/* Subir lista */
.upload-row { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; align-items: stretch; margin-bottom: 18px; }
.dropzone { display: flex; align-items: center; gap: 16px; padding: 18px 20px; border: 2px dashed #b9c4e6; border-radius: 16px; background: #f8f9ff; cursor: pointer; transition: border-color .2s, background .2s, transform .15s; min-height: 92px; }
.dropzone:hover, .dropzone.drag { border-color: var(--brand); background: var(--brand-soft); }
.dropzone.drag { transform: scale(1.01); }
.dropzone.busy { opacity: .7; pointer-events: none; }
.dz-icon { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 14px; background: #fff; color: var(--brand); box-shadow: var(--shadow); flex: none; }
.dz-text strong { display: block; font-size: 15px; word-break: break-word; }
.dz-text small { color: var(--muted); font-size: 12.5px; }
.course-field { margin: 0; justify-content: center; }
.success-card { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; border-color: #86efac; background: linear-gradient(135deg, #f0fdf4, #fff); animation: pop .35s; }
.success-ic { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; background: var(--ok-bg); color: var(--ok); flex: none; }
.success-card h3 { font-size: 18px; }

/* Reportes / ajustes */
.month-list { display: flex; flex-direction: column; gap: 12px; }
.month-card { display: flex; align-items: center; gap: 16px; padding: 16px 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); flex-wrap: wrap; }
.month-ic { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 14px; background: var(--ok-bg); color: var(--ok); flex: none; }
.month-card h3 { font-size: 18px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.logo-row { display: flex; gap: 18px; align-items: center; margin-bottom: 18px; flex-wrap: wrap; }
.logo-prev { width: 96px; height: 96px; display: grid; place-items: center; border-radius: 18px; background: repeating-conic-gradient(#f1f4fa 0 25%, #fff 0 50%) 0 0 / 16px 16px; border: 1px solid var(--line); flex: none; }
.logo-prev img { max-width: 80%; max-height: 80%; object-fit: contain; }

/* ==========================================================================
   Carnets (solo impresión)
   ========================================================================== */
#print-root { display: none; }
.carnet { width: 90mm; height: 56mm; border: 0.3mm solid #cbd5e1; border-radius: 4mm; overflow: hidden; display: flex; flex-direction: column; break-inside: avoid; page-break-inside: avoid; background: #fff; color: #0f172a; font-family: var(--font); }
.carnet-head { display: flex; align-items: center; gap: 3mm; padding: 2.4mm 4mm; background: linear-gradient(90deg, #0f2a6b, #1d4ed8); color: #fff; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.carnet-head img { width: 9mm; height: 9mm; object-fit: contain; background: rgba(255, 255, 255, .95); border-radius: 2mm; padding: .6mm; }
.carnet-head b { display: block; font-size: 8.5pt; line-height: 1.1; }
.carnet-head span { font-size: 6.5pt; opacity: .85; }
.carnet-body { flex: 1; display: flex; align-items: center; justify-content: space-between; gap: 3mm; padding: 2mm 4mm 3mm; }
.carnet-info { flex: 1; min-width: 0; }
.carnet-info h4 { font-size: 10.5pt; line-height: 1.15; margin-bottom: 1.5mm; word-break: break-word; }
.carnet-info p { font-size: 8pt; color: #475569; }
.carnet-info small { display: block; margin-top: 2mm; font: 6.5pt ui-monospace, Menlo, monospace; color: #64748b; }
.carnet-qr { width: 33mm; height: 33mm; image-rendering: pixelated; }
@media print {
  @page { size: A4; margin: 10mm; }
  body > *:not(#print-root) { display: none !important; }
  html, body { background: #fff !important; }
  #print-root { display: grid !important; grid-template-columns: repeat(2, 90mm); gap: 5mm 6mm; justify-content: center; }
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1000px) {
  .cols { grid-template-columns: 1fr; }
  .scan-grid { grid-template-columns: 1fr; }
  .viewfinder { max-width: 460px; margin: 0 auto; }
}
@media (max-width: 900px) {
  .sidebar { transform: translateX(-102%); width: min(300px, 86vw); box-shadow: 0 0 60px rgba(0, 0, 0, .5); }
  .admin.menu-open .sidebar { transform: none; }
  .admin.menu-open .scrim { display: block; position: fixed; inset: 0; z-index: 55; background: rgba(5, 8, 22, .55); backdrop-filter: blur(3px); animation: fade .2s; }
  .admin-main { margin-left: 0; }
  #menu-btn { display: inline-grid; }
  .topbar { padding: 12px 16px; }
  .top-meta span { display: none; }
  .content { padding: 18px 16px 50px; }
  .banner { margin: 12px 16px 0; }
  .upload-row { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .home-card { padding: 18px; }
  .hc-ic { width: 52px; height: 52px; }
  .card { padding: 16px; }
  .actions.between { flex-direction: column-reverse; align-items: stretch; }
  .actions.between .btn { width: 100%; }
  .scan-manual { flex-direction: column; }
  .table th, .table td { padding: 9px 10px; }
  .modal { padding: 20px; }
  #toasts { left: 12px; right: 12px; bottom: 12px; max-width: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ==========================================================================
   Dashboard, selector de curso, interruptores, WhatsApp, docentes
   ========================================================================== */
.modal.modal-wide { width: min(100%, 640px); }
.block { display: block; }
code { font-family: ui-monospace, Menlo, monospace; font-size: .86em; background: #eef2f8; padding: 1px 6px; border-radius: 6px; }
.top-meta .who { color: var(--ink); font-weight: 600; padding-right: 10px; border-right: 1px solid var(--line); }

.dash-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.dash-head h1 { font-size: clamp(26px, 3.4vw, 34px); }
.dash-controls { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.month-sel { width: auto; min-width: 170px; font-weight: 600; background: var(--surface); }
.cpick { position: relative; }
.cpick-btn { display: inline-flex; align-items: center; gap: 10px; padding: 10px 14px 10px 16px; min-width: 240px; border-radius: 12px; background: var(--surface); border: 1px solid #cdd6ea; font-weight: 600; font-size: 14px; color: var(--ink); box-shadow: var(--shadow); transition: border-color .15s, box-shadow .15s; }
.cpick-btn:hover, .cpick-btn.open { border-color: var(--brand); box-shadow: 0 0 0 4px rgba(37, 99, 235, .12); }
.cpick-btn > span:nth-child(2) { flex: 1; text-align: left; }
.cpick-btn .chev { display: grid; transition: transform .2s; }
.cpick-btn.open .chev { transform: rotate(90deg); }
.cpick-btn .ic { width: 18px; height: 18px; }
.cpick-pop { position: absolute; z-index: 70; top: calc(100% + 8px); left: 0; width: min(340px, 92vw); max-height: min(70vh, 520px); overflow-y: auto; padding: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 24px 60px rgba(15, 23, 42, .22); animation: pop .18s ease; }
.cp-all, .cp-group, .cp-course { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border: 0; background: transparent; border-radius: 10px; font-size: 14px; color: var(--ink); text-align: left; }
.cp-all { font-weight: 700; }
.cp-group { font-weight: 600; color: #334155; }
.cp-course { padding-left: 38px; color: #475569; }
.cp-all:hover, .cp-group:hover, .cp-course:hover { background: #f1f5fb; }
.cp-all.active, .cp-course.active { background: var(--brand-soft); color: var(--brand); font-weight: 700; }
.cp-all span:not(.ic), .cp-group span:not(.chev), .cp-course span { flex: 1; }
.cp-all em, .cp-group em, .cp-course em { font-style: normal; font-size: 12px; font-weight: 700; padding: 1px 8px; border-radius: 999px; background: #eef2f8; color: #475569; }
.cp-group .chev { display: grid; transition: transform .2s; }
.cp-group .chev.open { transform: rotate(90deg); }
.cp-group .ic { width: 16px; height: 16px; }
.cp-items { display: none; }
.cp-items.open { display: block; }

.sched { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 20px; }
.sched-chip { display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px; border-radius: 999px; background: var(--ok-bg); color: var(--ok); font-size: 13px; }
.sched-chip small { font-weight: 500; opacity: .85; }
.sched-chip b { font-variant-numeric: tabular-nums; }
.sched-chip .ic { width: 15px; height: 15px; }
.sched-chip.off { background: #eef1f6; color: #64748b; }
.sec-title { font-size: 15px; letter-spacing: .02em; color: #475569; margin: 6px 0 12px; font-family: var(--font); font-weight: 700; text-transform: uppercase; font-size: 12px; letter-spacing: .1em; }
.stat .pct.warn { color: var(--warn); }
.cols.even { grid-template-columns: 1fr 1fr; }
.monthend { display: flex; align-items: center; gap: 14px; padding: 14px 18px; margin-bottom: 18px; border-radius: 16px; background: linear-gradient(135deg, #eff6ff, #fff7ed); border: 1px solid #bfdbfe; flex-wrap: wrap; }
.me-ic { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; background: #fff; color: var(--brand); box-shadow: var(--shadow); flex: none; }
.monthend .icon-act svg { transform: rotate(45deg); }

.dchart-wrap { overflow-x: auto; padding-bottom: 4px; }
.dchart { display: flex; align-items: flex-end; gap: 4px; height: 210px; min-width: 100%; padding-top: 8px; }
.dcol { flex: 1 0 22px; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 3px; }
.dbar { width: 100%; max-width: 30px; flex: 1; display: flex; flex-direction: column; justify-content: flex-end; border-radius: 7px 7px 3px 3px; background: #eef1f8; overflow: hidden; min-height: 4px; }
.dcol:hover .dbar { box-shadow: 0 0 0 2px rgba(37, 99, 235, .35); }
.seg-ok { display: block; width: 100%; background: linear-gradient(180deg, #22c55e, #16a34a); }
.seg-late { display: block; width: 100%; background: linear-gradient(180deg, #fbbf24, #f59e0b); }
.dlab { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.dval { font-size: 10.5px; font-weight: 700; color: #334155; font-variant-numeric: tabular-nums; margin-top: -2px; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; align-items: center; font-size: 12.5px; margin-top: 12px; color: #475569; }
.legend .lg { display: inline-block; width: 11px; height: 11px; border-radius: 4px; margin-right: 6px; vertical-align: -1px; }
.lg.ok { background: #22c55e; }
.lg.late { background: #f59e0b; }
.rank { list-style: none; margin: 0; padding: 0; }
.rank li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.rank li:first-child { border-top: 0; }
.rk-n { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; font-size: 12.5px; font-weight: 700; background: #eef2f8; color: #475569; flex: none; }
.rank li:nth-child(-n+3) .rk-n { background: #fee2e2; color: #b91c1c; }
.rank strong { display: block; font-size: 14px; }
.rank small { color: var(--muted); font-size: 12px; display: block; }
.rk-bar { height: 6px; border-radius: 6px; background: #eef1f8; margin-top: 6px; overflow: hidden; }
.rk-bar i { display: block; height: 100%; border-radius: 6px; }
.rk-bar i.late { background: #f59e0b; }
.rk-bar i.bad { background: #ef4444; }
.rk-v { font-family: var(--display); font-size: 22px; min-width: 64px; text-align: right; }
.rk-v small { font-family: var(--font); font-size: 11px; font-weight: 500; color: var(--muted); margin-left: 3px; }
.rk-v.late { color: var(--warn); }
.rk-v.bad { color: var(--bad); }

.switch-row { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; background: #f8f9fd; cursor: pointer; }
.switch-row small { display: block; color: var(--muted); font-size: 12.5px; }
.switch { position: relative; width: 48px; height: 28px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 2; }
.switch i { position: absolute; inset: 0; border-radius: 28px; background: #cbd5e1; transition: background .2s; }
.switch i::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .25); transition: transform .2s; }
.switch input:checked + i { background: #16a34a; }
.switch input:checked + i::after { transform: translateX(20px); }
.switch input:focus-visible + i { box-shadow: 0 0 0 4px rgba(37, 99, 235, .25); }

.btn-wa { color: #fff; background: #16a34a; box-shadow: 0 6px 16px rgba(22, 163, 74, .3); }
.btn-wa:hover { background: #15803d; }
.btn .ic[fill] { width: 17px; height: 17px; }
.icon-act.wa { color: #16a34a; }
.icon-act.wa:hover { background: var(--ok-bg); color: #15803d; }
.waq { list-style: none; margin: 14px 0 0; padding: 0; max-height: 52vh; overflow-y: auto; border: 1px solid var(--line); border-radius: 14px; }
.waq li { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-top: 1px solid var(--line); }
.waq li:first-child { border-top: 0; }
.waq li.done { background: #f0fdf4; }
.waq li.empty { justify-content: center; padding: 22px; }
.waq strong { display: block; font-size: 14px; }
.waq small { color: var(--muted); font-size: 12.5px; }

.avatar.big { width: 48px; height: 48px; font-size: 18px; border-radius: 14px; }
.month-card.inactive { opacity: .6; }
.tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.tag { padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--brand-soft); color: var(--brand); }
.cpicker { max-height: 280px; overflow-y: auto; padding: 4px 2px; }
.cg { border: 1px solid var(--line); border-radius: 12px; margin: 0 0 10px; padding: 8px 12px 10px; }
.cg legend { font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); padding: 0 6px; }
.cb { display: flex; align-items: center; gap: 10px; padding: 5px 2px; font-size: 14px; cursor: pointer; }
.cb input { width: 18px; height: 18px; margin: 0; accent-color: var(--brand); }

@media (max-width: 1000px) { .cols.even { grid-template-columns: 1fr; } }
@media (max-width: 560px) {
  .cpick, .cpick-btn { width: 100%; }
  .dash-controls { width: 100%; }
  .dash-controls .btn, .month-sel { flex: 1; }
  .top-meta .who { display: none; }
  .rk-v { min-width: 52px; font-size: 19px; }
}

/* Ajustes móvil */
.monthend .grow { flex: 1 1 220px; }
@media (max-width: 560px) {
  .stats { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat { padding: 14px 12px; gap: 10px; }
  .stat b { font-size: 24px; }
  .stat-ic { width: 38px; height: 38px; border-radius: 11px; }
  .stat .pct { top: 8px; right: 10px; font-size: 11.5px; }
  .monthend { padding: 12px 14px; }
}
