/* FIT&+ · Control de acceso. Marca: negro, blanco y rojo #E10600 (#FF2A1F sobre oscuro); títulos en Barlow Condensed
   cursiva, texto en Inter. Tema claro/oscuro: automático según Windows (prefers-color-scheme) o el elegido en Ajustes. */

@font-face { font-family: 'Barlow Condensed'; src: url('fonts/BarlowCondensed-BoldItalic.ttf') format('truetype'); font-weight: 700; font-style: italic; font-display: swap; }
@font-face { font-family: 'Barlow Condensed'; src: url('fonts/BarlowCondensed-ExtraBoldItalic.ttf') format('truetype'); font-weight: 800; font-style: italic; font-display: swap; }
@font-face { font-family: 'Barlow Condensed'; src: url('fonts/BarlowCondensed-SemiBoldItalic.ttf') format('truetype'); font-weight: 600; font-style: italic; font-display: swap; }
@font-face { font-family: 'Inter'; src: url('fonts/Inter-Regular.ttf') format('truetype'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Inter'; src: url('fonts/Inter-Medium.ttf') format('truetype'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Inter'; src: url('fonts/Inter-SemiBold.ttf') format('truetype'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Inter'; src: url('fonts/Inter-Bold.ttf') format('truetype'); font-weight: 700; font-display: swap; }

:root {
  --bg: #F4F4F2;
  --bg-2: #ECECE9;
  --surface: #FFFFFF;
  --surface-2: #F7F7F5;
  --border: #E2E2DE;
  --text: #121212;
  --text-2: #5C5C58;
  --text-3: #8A8A85;
  --brand: #E10600;
  --brand-text: #C40500;
  --on-brand: #FFFFFF;
  --green: #12A150;
  --green-bg: #E6F6EC;
  --green-strong: #0B8A42;
  --red: #D92D20;
  --red-bg: #FDECEA;
  --amber: #D98A00;
  --amber-bg: #FFF4DB;
  --info: #2563EB;
  --info-bg: #E8EFFE;
  --cc-booked-bg: rgba(22, 101, 52, .10); --cc-booked-fg: #166534;
  --cc-wait-bg: rgba(29, 78, 216, .10); --cc-wait-fg: #1D4ED8;
  --cc-few-bg: rgba(138, 79, 0, .10); --cc-few-fg: #8A4F00;
  --shadow: 0 1px 2px rgba(0, 0, 0, .06), 0 8px 28px rgba(0, 0, 0, .07);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, .16);
  --radius: 18px;
  --radius-sm: 12px;
  --topbar: 76px;
  --font-title: 'Barlow Condensed', 'Arial Narrow', sans-serif;
  --font-body: 'Inter', 'Segoe UI', system-ui, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #0B0B0C; --bg-2: #121214; --surface: #17171A; --surface-2: #1E1E22; --border: #2A2A2F;
    --text: #F5F5F4; --text-2: #B4B4B0; --text-3: #85857F; --brand: #E10600; --brand-text: #FF2A1F;
    --green: #22C55E; --green-bg: rgba(34, 197, 94, .14); --green-strong: #16A34A;
    --red: #F04438; --red-bg: rgba(240, 68, 56, .15); --amber: #FDB022; --amber-bg: rgba(253, 176, 34, .14);
    --info: #60A5FA; --info-bg: rgba(96, 165, 250, .14); --cc-booked-bg: rgba(52, 209, 112, .14); --cc-booked-fg: #34D170; --cc-wait-bg: rgba(85, 174, 255, .14); --cc-wait-fg: #55AEFF; --cc-few-bg: rgba(255, 178, 36, .14); --cc-few-fg: #FFB224;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 10px 30px rgba(0, 0, 0, .35); --shadow-lg: 0 24px 70px rgba(0, 0, 0, .6);
    color-scheme: dark;
  }
}
:root[data-theme='dark'] {
  --bg: #0B0B0C; --bg-2: #121214; --surface: #17171A; --surface-2: #1E1E22; --border: #2A2A2F;
  --text: #F5F5F4; --text-2: #B4B4B0; --text-3: #85857F; --brand: #E10600; --brand-text: #FF2A1F;
  --green: #22C55E; --green-bg: rgba(34, 197, 94, .14); --green-strong: #16A34A;
  --red: #F04438; --red-bg: rgba(240, 68, 56, .15); --amber: #FDB022; --amber-bg: rgba(253, 176, 34, .14);
  --info: #60A5FA; --info-bg: rgba(96, 165, 250, .14); --cc-booked-bg: rgba(52, 209, 112, .14); --cc-booked-fg: #34D170; --cc-wait-bg: rgba(85, 174, 255, .14); --cc-wait-fg: #55AEFF; --cc-few-bg: rgba(255, 178, 36, .14); --cc-few-fg: #FFB224;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 10px 30px rgba(0, 0, 0, .35); --shadow-lg: 0 24px 70px rgba(0, 0, 0, .6);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 400 15px/1.45 var(--font-body);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  user-select: none;
}
input, select, button { font: inherit; color: inherit; }
button { cursor: pointer; }
.display { font-family: var(--font-title); font-style: italic; font-weight: 800; letter-spacing: .01em; text-transform: uppercase; line-height: 1; margin: 0; }
.muted { color: var(--text-2); }
.small { font-size: 12.5px; }
.mono { font-family: Consolas, 'Cascadia Mono', monospace; }
.ok { color: var(--green); font-weight: 600; }
.ic { width: 20px; height: 20px; flex: none; }
.ic-lg { width: 30px; height: 30px; }
.ic-xl { width: 46px; height: 46px; }
.ic-xxl { width: 72px; height: 72px; }

/* ── Botones y campos ─────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px;
  border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2); font-weight: 600;
  transition: transform .08s ease, background .15s ease, border-color .15s ease;
}
.btn:hover { border-color: var(--text-3); }
.btn:active { transform: scale(.98); }
.btn:focus-visible, .icon-btn:focus-visible, .chip:focus-visible, .nav-item:focus-visible, .pin-key:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }
.btn[disabled] { opacity: .6; cursor: default; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.btn-primary:hover { background: #C40500; border-color: #C40500; }
.btn-outline { background: transparent; border-color: currentColor; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { color: var(--text); background: var(--surface-2); }
.btn-danger { background: var(--red-bg); color: var(--red); border-color: transparent; }
.btn-sm { min-height: 34px; padding: 0 12px; font-size: 13px; }
.btn-lg { min-height: 52px; font-size: 16px; }
.link { background: none; border: 0; color: var(--brand-text); font-weight: 600; padding: 4px; }
.icon-btn {
  width: 44px; height: 44px; display: grid; place-items: center; border-radius: 12px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text);
}
.icon-btn:hover { border-color: var(--text-3); }
.icon-btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.input {
  width: 100%; min-height: 46px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--surface); outline: none; user-select: text;
}
.input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 22%, transparent); }
select.input { padding-right: 8px; }
.field { display: grid; gap: 6px; margin: 12px 0; }
.field > span { font-size: 13px; font-weight: 600; color: var(--text-2); }

/* ── Pantallas centradas (PIN y entrada) ─────────────────────────────────────── */
.center-screen {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(1200px 600px at 50% -10%, color-mix(in srgb, var(--brand) 12%, transparent), transparent 60%), var(--bg);
}
.logo-mark { width: 92px; height: 92px; border-radius: 22px; box-shadow: var(--shadow); }
.pin-card, .login-card {
  width: min(420px, 100%); display: grid; justify-items: center; gap: 10px; text-align: center; padding: 34px 30px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 26px; box-shadow: var(--shadow-lg);
}
.login-card { justify-items: stretch; text-align: left; }
.login-card .logo-mark { justify-self: center; }
.login-card h1 { text-align: center; font-size: 38px; margin-top: 6px; }
.login-card p { margin: 0 0 6px; }
.pin-card h1 { font-size: 36px; margin-top: 6px; }
.pin-card p { margin: 0; max-width: 320px; }
.pin-boxes { display: flex; gap: 12px; margin: 16px 0 4px; }
.pin-box {
  width: 58px; height: 68px; border-radius: 16px; border: 2px solid var(--border); background: var(--surface-2);
  display: grid; place-items: center; font-size: 22px; color: var(--text); transition: border-color .12s ease, transform .12s ease;
}
.pin-box.filled { border-color: var(--text-3); }
.pin-box.current { border-color: var(--brand); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 18%, transparent); }
.pin-dots { display: flex; gap: 12px; margin: 14px 0 4px; min-height: 18px; }
.pin-dots span { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--text-3); transition: all .12s ease; }
.pin-dots span.on { background: var(--brand); border-color: var(--brand); transform: scale(1.1); }
.pin-error { min-height: 20px; margin: 0; color: var(--red); font-weight: 600; font-size: 14px; }
.pin-pad { display: grid; grid-template-columns: repeat(3, 76px); gap: 12px; margin: 4px 0 8px; }
.pin-key {
  height: 64px; border-radius: 18px; border: 1px solid var(--border); background: var(--surface-2);
  font: 600 24px var(--font-body); display: grid; place-items: center;
}
.pin-key:hover { border-color: var(--text-3); }
.pin-key:active { transform: scale(.96); }
.pin-ok { background: var(--brand); border-color: var(--brand); color: #fff; }
.shake { animation: shake .35s ease; }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }

/* ── Estructura ──────────────────────────────────────────────────────────────── */
.shell { height: 100vh; display: grid; grid-template-rows: var(--topbar) auto 1fr; }
.topbar {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px; padding: 0 22px;
  background: var(--surface); border-bottom: 1px solid var(--border); app-region: drag;
}
.topbar button, .topbar .pill { app-region: no-drag; }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; background: none; border: 0; padding: 0; color: inherit; text-align: left; justify-self: start; }
.brand-logo { width: 46px; height: 46px; border-radius: 12px; }
.brand-title { font: italic 800 24px/1 var(--font-title); text-transform: uppercase; }
.brand-text { display: grid; gap: 3px; min-width: 0; }
.brand-sub { color: var(--text-2); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.clock { text-align: center; }
.clock-time { font: italic 800 34px/1 var(--font-title); letter-spacing: .02em; }
.clock-date { color: var(--text-2); font-size: 12.5px; }
.top-actions { display: flex; justify-content: flex-end; align-items: center; gap: 10px; }
.pill {
  display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 14px; border-radius: 999px;
  font-weight: 600; font-size: 13px; white-space: nowrap;
}
.pill .ic { width: 17px; height: 17px; }
.pill-ok { background: var(--green-bg); color: var(--green-strong); }
.pill-warn { background: var(--amber-bg); color: var(--amber); }
.pill-sub { font-weight: 500; opacity: .8; }
.pill-count { background: var(--amber); color: #111; border-radius: 999px; padding: 1px 8px; font-size: 12px; }
#banner { min-height: 0; }
.banner { display: flex; align-items: center; gap: 10px; padding: 10px 22px; font-weight: 500; }
.banner-info { background: var(--info-bg); color: var(--info); }
.banner-error { background: var(--red-bg); color: var(--red); }
.banner-warn { background: var(--amber-bg); color: var(--amber); }
.banner .btn { margin-left: auto; }
.main { min-height: 0; display: grid; grid-template-columns: 1fr minmax(300px, 380px); gap: 22px; padding: 22px; }
.main[data-view]:not([data-view='door']) { grid-template-columns: 1fr; }

/* ── Puerta ──────────────────────────────────────────────────────────────────── */
.stage { min-height: 0; display: grid; }
.idle {
  display: grid; place-content: center; justify-items: center; text-align: center; gap: 14px; padding: 30px;
  border-radius: 28px; border: 2px dashed var(--border); background: var(--surface);
}
.idle-rings { position: relative; width: clamp(190px, 24vw, 300px); aspect-ratio: 1; display: grid; place-items: center; margin-bottom: 10px; }
.ring { position: absolute; inset: 0; border-radius: 50%; border: 2px solid color-mix(in srgb, var(--brand) 55%, transparent); animation: ring 2.6s ease-out infinite; }
.ring.r2 { animation-delay: 1.3s; }
@keyframes ring { from { transform: scale(.55); opacity: 1; } to { transform: scale(1.05); opacity: 0; } }
/* QR y llave en rojo, sin fondo (18/10/2026, petición del usuario: el círculo rojo llamaba mucho), los dos a la misma altura. */
.idle-icons { display: flex; align-items: center; justify-content: center; gap: 8%; width: 70%; color: var(--brand-text); }
.idle-icons .ic { width: auto; height: clamp(64px, 8vw, 104px); stroke-width: 1.8; }
.idle-title { font-size: clamp(40px, 5vw, 76px); }
.idle-sub { color: var(--text-2); font-size: clamp(15px, 1.4vw, 19px); margin: 0; }
.idle-stats { display: flex; gap: 22px; color: var(--text-2); margin-top: 10px; }
.idle-stats strong { color: var(--text); font-size: 20px; }
.idle-cam { margin-top: 20px; }
@media (prefers-reduced-motion: reduce) { .ring { animation: none; opacity: .4; } }

.result {
  --tone: var(--green); --tone-bg: var(--green-bg);
  position: relative; display: grid; grid-template-rows: auto 1fr; overflow: hidden;
  border-radius: 28px; background: var(--surface); border: 3px solid var(--tone); box-shadow: var(--shadow-lg);
  animation: pop .22s ease-out;
}
.result-rojo { --tone: var(--red); --tone-bg: var(--red-bg); }
.result-ambar { --tone: var(--amber); --tone-bg: var(--amber-bg); }
@keyframes pop { from { transform: scale(.97); opacity: .4; } to { transform: none; opacity: 1; } }
.result-band {
  display: flex; align-items: center; justify-content: center; gap: 14px; padding: clamp(14px, 2vh, 22px);
  background: var(--tone); color: #fff; font: italic 800 clamp(34px, 4.4vw, 68px)/1 var(--font-title); letter-spacing: .03em;
}
.result-ambar .result-band { color: #1B1300; }
.result-body { display: grid; grid-template-columns: auto 1fr; gap: clamp(20px, 3vw, 44px); align-items: center; padding: clamp(20px, 3.4vw, 48px); min-height: 0; }
.result-info { display: grid; gap: 14px; align-content: center; min-width: 0; }
.result-name { font-size: clamp(42px, 5.4vw, 92px); overflow-wrap: anywhere; }
.result-summary { margin: 0; color: var(--text-2); font-size: clamp(15px, 1.4vw, 20px); font-weight: 500; }
.reasons { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.reasons li {
  display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 14px;
  background: var(--tone-bg, var(--red-bg)); color: var(--tone, var(--red)); font-weight: 700; font-size: clamp(16px, 1.5vw, 22px);
}
.class-box { padding: 16px 18px; border-radius: 16px; background: var(--surface-2); border: 1px solid var(--border); display: grid; gap: 4px; }
.class-box-soft { opacity: .9; }
.class-label { font-size: 12.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); }
.class-name { font: italic 800 clamp(26px, 2.6vw, 40px)/1.05 var(--font-title); text-transform: uppercase; }
.checkin { display: flex; align-items: center; gap: 8px; font-weight: 600; margin-top: 4px; }
.checkin-ok { color: var(--green); }
.checkin-wait { color: var(--text-2); }
.checkin-none { color: var(--text-3); }
.result-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.result-timer { position: absolute; left: 0; bottom: 0; height: 5px; width: 100%; background: var(--tone); transform-origin: left; animation: timer linear forwards; opacity: .55; }
@keyframes timer { from { transform: scaleX(1); } to { transform: scaleX(0); } }

.avatar { position: relative; display: grid; place-items: center; overflow: hidden; border-radius: 50%; background: var(--surface-2); color: var(--text-2); flex: none; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-initials { font: italic 800 1em/1 var(--font-title); }
.avatar-hero { width: clamp(180px, 22vw, 340px); aspect-ratio: 1; border-radius: 28px; border: 5px solid var(--tone, var(--border)); font-size: clamp(64px, 8vw, 120px); box-shadow: var(--shadow); }
.avatar-xl { width: 150px; height: 150px; border-radius: 24px; font-size: 56px; }
.avatar-lg { width: 96px; height: 96px; border-radius: 20px; font-size: 36px; }
.avatar-lg .ic { width: 40px; height: 40px; }
.avatar-md { width: 56px; height: 56px; font-size: 22px; }
.avatar-sm { width: 40px; height: 40px; font-size: 16px; }

.recent { min-height: 0; display: grid; grid-template-rows: auto 1fr; background: var(--surface); border: 1px solid var(--border); border-radius: 22px; overflow: hidden; }
.recent-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px 8px; }
.recent-head h2 { margin: 0; font: italic 800 22px/1 var(--font-title); text-transform: uppercase; }
.recent-list { list-style: none; margin: 0; padding: 4px 10px 14px; overflow: auto; display: grid; gap: 4px; align-content: start; }
.recent-item { display: flex; align-items: center; gap: 12px; padding: 8px; border-radius: 12px; }
.recent-item:hover { background: var(--surface-2); }
.recent-text { min-width: 0; flex: 1; }
.recent-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.recent-sub { color: var(--text-3); font-size: 12.5px; }
.recent-empty { padding: 0 18px; }
.dot { width: 12px; height: 12px; border-radius: 50%; flex: none; background: var(--amber); }
.res-verde .dot { background: var(--green); }
.res-rojo .dot { background: var(--red); }

/* ── Panel lateral ───────────────────────────────────────────────────────────── */
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(380px, 92vw); z-index: 40; display: grid; grid-template-rows: auto 1fr auto;
  background: var(--surface); border-left: 1px solid var(--border); box-shadow: var(--shadow-lg);
  transform: translateX(105%); transition: transform .22s ease;
}
.drawer.open { transform: none; }
.drawer-backdrop { position: fixed; inset: 0; z-index: 30; background: rgba(0, 0, 0, .45); opacity: 0; pointer-events: none; transition: opacity .2s ease; }
.drawer-backdrop.open { opacity: 1; pointer-events: auto; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 20px 10px; }
.drawer-head h2 { font-size: 30px; }
.nav { display: grid; gap: 6px; padding: 8px 14px; align-content: start; }
.nav-item { display: flex; align-items: center; gap: 14px; text-align: left; padding: 14px; border-radius: 14px; border: 1px solid transparent; background: none; }
.nav-item:hover { background: var(--surface-2); }
.nav-item.active { background: color-mix(in srgb, var(--brand) 10%, transparent); border-color: color-mix(in srgb, var(--brand) 35%, transparent); }
.nav-item.active .ic { color: var(--brand-text); }
.nav-label { font-weight: 700; }
.nav-sub { color: var(--text-3); font-size: 12.5px; }
.drawer-foot { display: flex; align-items: center; justify-content: space-between; padding: 14px 20px; border-top: 1px solid var(--border); }

/* ── Páginas ─────────────────────────────────────────────────────────────────── */
.page { min-height: 0; overflow: auto; display: grid; align-content: start; gap: 12px; }
.page-body { display: grid; gap: 16px; align-content: start; }
.page-title { font-size: clamp(34px, 3.6vw, 52px); }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; justify-content: space-between; }
.toolbar .search { max-width: 360px; }
/* Al hacer scroll en Personas y Hoy, el título y la frase se van y los chips, el buscador y las vistas quedan fijos arriba
   (18/10/2026, petición del usuario). El contenido deja hueco a la barra de scroll. */
.page { padding-right: 14px; scrollbar-gutter: stable; }
.page .toolbar { position: sticky; top: 0; z-index: 5; margin: 0 -2px; padding: 10px 2px; background: var(--bg); box-shadow: 0 8px 12px -12px rgba(0, 0, 0, .35); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { height: 38px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); font-weight: 600; font-size: 13.5px; }
.chip-on { background: var(--text); color: var(--bg); border-color: var(--text); }
.chip { display: inline-flex; align-items: center; gap: 8px; }
.chip-count { min-width: 22px; height: 22px; padding: 0 7px; border-radius: 999px; background: var(--surface-2, var(--border)); color: var(--text-2); font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; font-variant-numeric: tabular-nums; }
.hero-photo { position: relative; flex: none; }
.hero-camera { position: absolute; right: -4px; bottom: -4px; width: 44px; height: 44px; border-radius: 999px; display: grid; place-items: center; background: var(--text); color: var(--bg); border: 3px solid var(--surface); box-shadow: var(--shadow-lg); }
.hero-camera:hover { background: var(--brand); color: #fff; }
.hero-camera:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }
.cam-video { width: 100%; height: 100%; object-fit: cover; display: block; background: #000; }
.cam-video.mirror { transform: scaleX(-1); }
.cam-dock { position: fixed; left: 20px; bottom: 20px; z-index: 30; width: 220px; aspect-ratio: 4 / 3; border-radius: 18px; overflow: hidden; border: 3px solid var(--border); background: #000; box-shadow: var(--shadow-lg); }
.cam-dock-label { position: absolute; left: 8px; bottom: 8px; display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; background: rgba(0, 0, 0, .6); color: #fff; font-size: 12px; font-weight: 700; }
.cam-dock-label .ic { width: 14px; height: 14px; }
.cam-dock-stop { position: absolute; top: 8px; right: 8px; width: 36px; height: 36px; display: grid; place-items: center; border: 0; border-radius: 999px; background: rgba(0, 0, 0, .6); color: #fff; cursor: pointer; }
.cam-dock-stop:hover, .cam-dock-stop:focus-visible { background: var(--brand); }
.cam-dock-stop .ic { width: 18px; height: 18px; }
@media (max-width: 820px) { .cam-dock { width: 140px; left: 12px; bottom: 12px; } }
.modal-wide { width: min(640px, 100%); }
.photo-stage { position: relative; width: min(420px, 100%); aspect-ratio: 1; border-radius: 22px; overflow: hidden; background: var(--surface-2); display: grid; place-items: center; }
.photo-stage .cam-video { position: absolute; inset: 0; }
.photo-guide { position: absolute; inset: 12%; border-radius: 50%; border: 3px dashed rgba(255, 255, 255, .8); pointer-events: none; }
.photo-shot { width: 100%; height: 100%; object-fit: cover; }
.photo-actions { justify-content: center; flex-wrap: wrap; }
.nm-form { text-align: left; justify-items: stretch; }
.nm-form h2, .nm-form > p { text-align: center; }
.nm-top { display: flex; align-items: center; justify-content: center; gap: 16px; }
.nm-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.nm-grid .field { margin: 6px 0; }
@media (max-width: 560px) { .nm-grid { grid-template-columns: 1fr; } }
.nm-form .row-actions { justify-content: flex-end; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.phone { display: flex; align-items: stretch; }
.phone-prefix { display: grid; place-items: center; padding: 0 12px; border: 1px solid var(--border); border-right: 0; border-radius: 12px 0 0 12px; background: var(--surface-2); color: var(--text-2); font-weight: 700; }
.phone .phone-input { border-radius: 0 12px 12px 0; min-width: 0; flex: 1; }
.danger-zone { display: flex; justify-content: flex-end; padding-top: 8px; }
.btn-danger-ghost { background: transparent; color: var(--red); border: 1px solid var(--red); }
.btn-danger-ghost:hover { background: var(--red-bg); }
.btn-danger { background: var(--red); color: #fff; border-color: var(--red); }
.btn-danger:disabled { opacity: .45; cursor: not-allowed; }
.chip-on .chip-count { background: var(--bg); color: var(--text); }
.chip-info { display: inline-flex; align-items: center; height: 30px; width: fit-content; background: var(--info-bg); color: var(--info); border: 0; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.stat { padding: 18px; border-radius: 18px; background: var(--surface); border: 1px solid var(--border); }
.stat-value { font: italic 800 44px/1 var(--font-title); }
.stat-label { color: var(--text-2); font-weight: 600; }
.stat-verde .stat-value { color: var(--green); }
.stat-rojo .stat-value { color: var(--red); }
.stat-ambar .stat-value { color: var(--amber); }
.stat-info .stat-value { color: var(--info); }
.table { display: grid; gap: 6px; }
.row {
  display: grid; grid-template-columns: 64px 40px minmax(160px, 1.4fr) 90px minmax(120px, 1fr) 120px 28px; align-items: center; gap: 12px;
  padding: 10px 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); text-align: left; border-left: 5px solid var(--amber);
}
.row.res-verde { border-left-color: var(--green); }
.row.res-rojo { border-left-color: var(--red); }
.row:hover { border-color: var(--text-3); }
.row-time { font-weight: 700; font-variant-numeric: tabular-nums; }
.row-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-method, .row-class { color: var(--text-2); font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-sync { color: var(--text-3); }
.badge { display: inline-flex; align-items: center; justify-content: center; height: 28px; padding: 0 12px; border-radius: 999px; font-weight: 700; font-size: 12.5px; width: fit-content; }
.badge-verde { background: var(--green-bg); color: var(--green-strong); }
.badge-rojo { background: var(--red-bg); color: var(--red); }
.badge-ambar { background: var(--amber-bg); color: var(--amber); }
.empty { padding: 20px 4px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.member-card {
  position: relative; display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 16px; text-align: left;
  background: var(--surface); border: 1px solid var(--border);
}
.member-card:hover { border-color: var(--text-3); box-shadow: var(--shadow); }
.toolbar-right { display: flex; align-items: center; gap: 10px; flex: 1; justify-content: flex-end; min-width: 260px; }
.view-switch { display: flex; gap: 4px; padding: 4px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface); }
.view-btn { width: 38px; height: 38px; border: 0; background: transparent; color: var(--text-3); }
.view-btn.on { background: var(--text); color: var(--bg); }
.members-body { display: grid; gap: 22px; }
.members-section { display: grid; gap: 10px; }
.members-title { margin: 0; display: flex; align-items: center; gap: 10px; font: italic 800 22px/1 var(--font-title); text-transform: uppercase; }
.members-count { font: 600 12.5px var(--font-body); font-style: normal; padding: 3px 9px; border-radius: 999px; background: var(--surface-2); color: var(--text-2); }
/* Solo caras: fotos grandes con el nombre debajo; el semáforo en el borde de la foto. */
.faces { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 16px; }
.face-card { display: grid; gap: 8px; justify-items: center; text-align: center; padding: 10px; border-radius: 18px; border: 1px solid transparent; background: none; }
.face-card:hover { background: var(--surface); border-color: var(--border); }
.face-photo { position: relative; width: 100%; }
.avatar-face { width: 100%; aspect-ratio: 1; height: auto; border-radius: 20px; font-size: 44px; border: 4px solid var(--amber); }
.face-card.res-verde .avatar-face { border-color: var(--green); }
.face-card.res-rojo .avatar-face { border-color: var(--red); }
.face-photo .dot { position: absolute; right: 8px; bottom: 8px; width: 16px; height: 16px; border: 3px solid var(--surface); }
.face-key { position: absolute; left: 8px; bottom: 8px; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); color: var(--text-2); }
.face-key .ic { width: 15px; height: 15px; }
.face-name { font-weight: 700; font-size: 14px; line-height: 1.25; overflow-wrap: anywhere; }
.member-text { min-width: 0; flex: 1; }
.member-name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.member-sub { color: var(--text-3); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.member-key { position: absolute; top: 8px; right: 30px; color: var(--text-3); }
.member-key .ic { width: 15px; height: 15px; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 14px; align-items: start; }
.card { padding: 20px; border-radius: 20px; background: var(--surface); border: 1px solid var(--border); display: grid; gap: 10px; }
.card h2 { margin: 0 0 4px; font: italic 800 24px/1 var(--font-title); text-transform: uppercase; display: flex; align-items: center; gap: 8px; }
.card p { margin: 0; }
.kv { display: grid; grid-template-columns: 170px 1fr; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.kv:last-of-type { border-bottom: 0; }
.kv-label { color: var(--text-3); font-weight: 600; font-size: 13.5px; }
.kv-value { font-weight: 500; overflow-wrap: anywhere; user-select: text; }
.plain { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.cred { display: flex; align-items: center; gap: 10px; }
.cred span { flex: 1; font-family: Consolas, monospace; }
.person-hero { display: flex; gap: 24px; align-items: center; padding: 20px; border-radius: 24px; background: var(--surface); border: 1px solid var(--border); --tone: var(--amber); --tone-bg: var(--amber-bg); }
.person-hero.res-verde { --tone: var(--green); --tone-bg: var(--green-bg); }
.person-hero.res-rojo { --tone: var(--red); --tone-bg: var(--red-bg); }
.person-hero .avatar-xl { border: 4px solid var(--tone); }
.person-hero > div { display: grid; gap: 10px; }
.person-hero-info { min-width: 0; }
.person-hero { position: relative; padding-left: 64px; }
.hero-back {
  position: absolute; top: 14px; left: 14px; width: 38px; height: 38px; display: grid; place-items: center;
  border-radius: 50%; border: 1px solid var(--border); background: var(--surface-2); color: var(--text-2);
}
.hero-back:hover { color: var(--text); border-color: var(--text-3); }
.hero-back:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }
@media (max-width: 820px) { .person-hero { padding-left: 20px; padding-top: 60px; } }
.reasons-sm li { font-size: 15px; padding: 8px 12px; }
.person-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.person-col { display: grid; gap: 14px; min-width: 0; }
.fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px 20px; }
.fld { min-width: 0; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.fld-wide { grid-column: 1 / -1; }
.fld-label { font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); margin-bottom: 4px; }
.fld-value { font-size: 16px; font-weight: 500; overflow-wrap: anywhere; user-select: text; }
.hist { display: flex; align-items: center; gap: 8px; }
.card-sub { margin: 10px 0 0; font-size: 14px; font-weight: 700; }
.steps { margin: 0; padding-left: 20px; display: grid; gap: 6px; color: var(--text-2); font-size: 13.5px; }
/* Tarjetas de clase con los colores de la app (verde reservada, azul en espera, ámbar plaza ofrecida) y el color del tipo. */
.class-list { display: grid; gap: 8px; }
.class-card {
  --cc-bg: var(--cc-booked-bg); --cc-fg: var(--cc-booked-fg);
  display: grid; grid-template-columns: 96px 1fr auto; align-items: center; gap: 14px; padding: 12px 14px 12px 16px;
  border-radius: 14px; background: var(--cc-bg); border-left: 6px solid var(--type, var(--cc-fg));
}
.cc-espera { --cc-bg: var(--cc-wait-bg); --cc-fg: var(--cc-wait-fg); }
.cc-ofrecida { --cc-bg: var(--cc-few-bg); --cc-fg: var(--cc-few-fg); }
.cc-hour { font: italic 800 26px/1 var(--font-title); }
.cc-day { font-size: 12.5px; color: var(--text-2); margin-top: 2px; }
.cc-name { font: italic 800 22px/1.05 var(--font-title); text-transform: uppercase; overflow-wrap: anywhere; }
.cc-state { display: flex; align-items: center; gap: 6px; font-weight: 700; color: var(--cc-fg); font-size: 13.5px; white-space: nowrap; }
.cc-state .ic { width: 17px; height: 17px; }
.btn-door { min-height: 40px; }
@media (max-width: 1100px) {
  .person-grid { grid-template-columns: 1fr; }
  .btn-door span { display: none; }
}

.row-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.toggle { display: flex; align-items: center; gap: 12px; cursor: pointer; font-weight: 500; padding: 4px 0; }
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.toggle-track { width: 46px; height: 28px; border-radius: 999px; background: var(--border); position: relative; transition: background .15s ease; flex: none; }
.toggle-thumb { position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); transition: transform .15s ease; }
.toggle input:checked + .toggle-track { background: var(--green); }
.toggle input:checked + .toggle-track .toggle-thumb { transform: translateX(18px); }
.toggle input:focus-visible + .toggle-track { outline: 3px solid var(--brand); outline-offset: 2px; }

/* ── Ventanas ────────────────────────────────────────────────────────────────── */
.modal-backdrop { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 20px; background: rgba(0, 0, 0, .55); backdrop-filter: blur(4px); }
.modal { width: min(440px, 100%); display: grid; justify-items: center; gap: 12px; text-align: center; padding: 30px; border-radius: 26px; background: var(--surface); box-shadow: var(--shadow-lg); }
.modal-wide { width: min(620px, 100%); justify-items: stretch; text-align: left; max-height: 86vh; grid-template-rows: auto auto 1fr auto; }
.modal h2 { font-size: 32px; }
.pin-overlay-card { box-shadow: var(--shadow-lg); }
.pulse-ring { width: 110px; height: 110px; border-radius: 50%; display: grid; place-items: center; background: var(--brand); color: #fff; animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 18px color-mix(in srgb, var(--brand) 18%, transparent); } }
.pick-list { overflow: auto; display: grid; gap: 4px; min-height: 120px; }
.pick-item { display: flex; align-items: center; gap: 12px; padding: 8px; border-radius: 12px; border: 0; background: none; text-align: left; font-weight: 600; }
.pick-item:hover { background: var(--surface-2); }

#toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 80; display: grid; gap: 8px; justify-items: center; pointer-events: none; }
.toast { padding: 12px 18px; border-radius: 14px; background: var(--text); color: var(--bg); font-weight: 600; box-shadow: var(--shadow-lg); animation: pop .2s ease-out; transition: opacity .4s ease; max-width: min(560px, 90vw); }
.toast-ok { background: var(--green-strong); color: #fff; }
.toast-error { background: var(--red); color: #fff; }
.toast.out { opacity: 0; }

/* ── Tamaños de ventana ──────────────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .main { grid-template-columns: 1fr; grid-template-rows: 1fr auto; }
  .recent { max-height: 220px; }
}
@media (max-width: 820px) {
  :root { --topbar: 64px; }
  .topbar { grid-template-columns: 1fr auto; padding: 0 14px; }
  .clock { display: none; }
  .pill-sub { display: none; }
  .brand-title { font-size: 20px; }
  .main { padding: 14px; gap: 14px; }
  .result-body { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .result-actions { justify-content: center; }
  .reasons li { justify-content: center; }
  .row { grid-template-columns: 52px 40px 1fr 90px 24px; }
  .row-method, .row-class { display: none; }
  .kv { grid-template-columns: 1fr; gap: 2px; }
  .person-hero { flex-direction: column; text-align: center; }
}
@media (max-height: 640px) {
  .result-band { padding: 10px; }
  .avatar-hero { width: clamp(140px, 18vw, 220px); }
}
