/* =========================================================================
   Asistencia C2N · Sistema de diseño
   Tema oscuro por defecto, tema claro con [data-theme="light"].
   ========================================================================= */

:root {
  --bg: #0b1120;
  --surface: #111a2e;
  --surface-2: #16213a;
  --surface-3: #1c2945;
  --border: #22304d;
  --border-strong: #31426a;
  --text: #e8edf7;
  --muted: #94a3c0;
  --faint: #64748f;

  --brand: #fbc11a;
  --brand-hover: #ffd047;
  --brand-ink: #1b1403;
  --brand-text: #fbc11a;
  --brand-soft: rgba(251, 193, 26, .12);

  --info: #60a5fa;
  --info-soft: rgba(96, 165, 250, .14);
  --success: #34d399;
  --success-soft: rgba(52, 211, 153, .14);
  --danger: #f87171;
  --danger-soft: rgba(248, 113, 113, .14);
  --warning: #fbbf24;
  --warning-soft: rgba(251, 191, 36, .14);

  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
  --shadow-lg: 0 20px 50px rgba(0, 0, 0, .5);
  --sidebar-w: 256px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  color-scheme: dark;
}

[data-theme="light"] {
  --bg: #f3f5f9;
  --surface: #ffffff;
  --surface-2: #f7f9fc;
  --surface-3: #eef2f8;
  --border: #e2e8f1;
  --border-strong: #cdd6e4;
  --text: #0f1a2e;
  --muted: #56647d;
  --faint: #8a97ad;

  --brand: #f5b400;
  --brand-hover: #e0a500;
  --brand-ink: #1b1403;
  --brand-text: #976a00;
  --brand-soft: rgba(245, 180, 0, .14);

  --info: #2563eb;
  --info-soft: rgba(37, 99, 235, .1);
  --success: #059669;
  --success-soft: rgba(5, 150, 105, .1);
  --danger: #dc2626;
  --danger-soft: rgba(220, 38, 38, .08);
  --warning: #b45309;
  --warning-soft: rgba(245, 158, 11, .12);

  --shadow: 0 1px 2px rgba(15, 26, 46, .06), 0 6px 20px rgba(15, 26, 46, .06);
  --shadow-lg: 0 24px 60px rgba(15, 26, 46, .18);
  color-scheme: light;
}

/* ---------- Base ---------- */
*, *::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;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--info); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; font-weight: 700; letter-spacing: -.01em; }
p { margin: 0; }
img { max-width: 100%; }
code, .mono { font-family: var(--mono); font-size: .9em; }
hr { border: 0; border-top: 1px solid var(--border); margin: 1.5rem 0; }
.ph { line-height: 1; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }

/* ---------- Layout de la app ---------- */
.app { display: flex; min-height: 100vh; }

.sidebar {
  position: fixed; inset: 0 auto 0 0;
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  z-index: 50;
  transition: transform .25s ease;
}
.sidebar-brand { padding: 1.25rem 1.25rem 1rem; display: flex; align-items: center; justify-content: space-between; }
.sidebar-brand img { height: 42px; width: auto; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: .5rem .75rem; display: flex; flex-direction: column; gap: 2px; }
.nav-label { font-size: .7rem; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--faint); padding: 1rem .75rem .4rem; }
.nav-link {
  display: flex; align-items: center; gap: .75rem;
  padding: .6rem .75rem; border-radius: var(--radius-sm);
  color: var(--muted); font-weight: 500;
  transition: background .15s, color .15s;
}
.nav-link .ph { font-size: 1.25rem; }
.nav-link:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav-link.active { background: var(--brand-soft); color: var(--brand-text); }
.sidebar-footer { border-top: 1px solid var(--border); padding: .75rem; }
.user-chip { display: flex; align-items: center; gap: .65rem; padding: .5rem; border-radius: var(--radius-sm); color: var(--text); }
.user-chip:hover { background: var(--surface-2); text-decoration: none; }
.user-chip-text { min-width: 0; flex: 1; }
.user-chip-name { font-weight: 600; font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-chip-role { font-size: .75rem; color: var(--muted); }
.sidebar-actions { display: flex; gap: .4rem; margin-top: .5rem; }
.sidebar-actions > * { flex: 1; }

.avatar {
  width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center; flex-shrink: 0;
  background: var(--brand); color: var(--brand-ink);
  font-weight: 700; font-size: .85rem;
}
.avatar.lg { width: 56px; height: 56px; font-size: 1.2rem; }

.topbar { display: none; }
.main { flex: 1; margin-left: var(--sidebar-w); min-width: 0; }
.container { max-width: 1240px; margin: 0 auto; padding: 2rem 2rem 4rem; }

.backdrop { display: none; }

@media (max-width: 960px) {
  .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .backdrop { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 40; }
  .main { margin-left: 0; }
  .topbar {
    display: flex; align-items: center; justify-content: space-between; gap: .75rem;
    position: sticky; top: 0; z-index: 30;
    height: 60px; padding: 0 1rem;
    background: var(--surface); border-bottom: 1px solid var(--border);
  }
  .topbar img { height: 34px; }
  .container { padding: 1.25rem 1rem 4rem; }
}

/* ---------- Encabezado de página ---------- */
.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.page-title { font-size: 1.6rem; }
.page-subtitle { color: var(--muted); margin-top: .25rem; }
.page-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.breadcrumb { display: flex; align-items: center; gap: .35rem; font-size: .85rem; color: var(--muted); margin-bottom: .5rem; flex-wrap: wrap; }
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--text); }
.breadcrumb .ph { font-size: .8rem; }

@media (max-width: 640px) {
  .page-title { font-size: 1.35rem; }
  .page-actions { width: 100%; }
  .page-actions > .btn, .page-actions > form, .page-actions > .dropdown { flex: 1 1 auto; }
  .page-actions > form .btn, .page-actions > .dropdown > .btn { width: 100%; }
}

/* ---------- Botones ---------- */
.btn {
  --btn-bg: var(--surface-2); --btn-fg: var(--text); --btn-bd: var(--border);
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  height: 40px; padding: 0 1rem;
  border-radius: var(--radius-sm); border: 1px solid var(--btn-bd);
  background: var(--btn-bg); color: var(--btn-fg);
  font: inherit; font-weight: 600; font-size: .9rem; white-space: nowrap;
  cursor: pointer; text-decoration: none !important;
  transition: background .15s, border-color .15s, color .15s, transform .05s, opacity .15s;
}
.btn .ph { font-size: 1.1rem; }
.btn:hover { background: var(--surface-3); border-color: var(--border-strong); }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn.is-loading { opacity: .6; cursor: not-allowed; }
.btn-primary { --btn-bg: var(--brand); --btn-fg: var(--brand-ink); --btn-bd: var(--brand); }
.btn-primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); }
.btn-success { --btn-bg: var(--success-soft); --btn-fg: var(--success); --btn-bd: transparent; }
.btn-success:hover { background: var(--success); color: #fff; border-color: var(--success); }
.btn-danger { --btn-bg: var(--danger-soft); --btn-fg: var(--danger); --btn-bd: transparent; }
.btn-danger:hover { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-ghost { --btn-bg: transparent; --btn-bd: transparent; --btn-fg: var(--muted); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); border-color: transparent; }
.btn-sm { height: 32px; padding: 0 .7rem; font-size: .82rem; }
.btn-lg { height: 48px; padding: 0 1.4rem; font-size: 1rem; }
.btn-block { width: 100%; }
.btn-icon { width: 40px; padding: 0; }
.btn-icon.btn-sm { width: 32px; }

/* ---------- Tarjetas ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-body { padding: 1.25rem; }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 1.25rem; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.card-title { font-size: 1rem; display: flex; align-items: center; gap: .5rem; }
.card-title .ph { color: var(--brand-text); font-size: 1.2rem; }
.card + .card, .card + .grid, .grid + .card, .grid + .grid { margin-top: 1.25rem; }
.grid > .card { margin-top: 0; }

.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1024px) { .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 760px) { .grid-2 { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 480px) { .grid-4 { grid-template-columns: 1fr 1fr; gap: .75rem; } }

/* ---------- Estadísticas ---------- */
.stat { padding: 1.1rem 1.25rem; display: flex; gap: 1rem; align-items: flex-start; justify-content: space-between; }
.stat-label { color: var(--muted); font-size: .82rem; font-weight: 500; }
.stat-value { font-size: 1.8rem; font-weight: 700; letter-spacing: -.02em; margin-top: .15rem; }
.stat-hint { font-size: .78rem; color: var(--faint); margin-top: .2rem; }
.stat-icon { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; font-size: 1.3rem; flex-shrink: 0; }
.tone-brand { background: var(--brand-soft); color: var(--brand-text); }
.tone-info { background: var(--info-soft); color: var(--info); }
.tone-success { background: var(--success-soft); color: var(--success); }
.tone-danger { background: var(--danger-soft); color: var(--danger); }
.tone-warning { background: var(--warning-soft); color: var(--warning); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-muted { color: var(--muted); }
.text-faint { color: var(--faint); }
.text-brand { color: var(--brand-text); }
@media (max-width: 480px) {
  .stat { padding: .9rem; }
  .stat-value { font-size: 1.45rem; }
  .stat-icon { display: none; }
}

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .2rem .6rem; border-radius: 999px;
  font-size: .75rem; font-weight: 600; white-space: nowrap;
  background: var(--surface-3); color: var(--muted);
}
.badge-dot::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-brand { background: var(--brand-soft); color: var(--brand-text); }
.badge-open::before { animation: pulse 1.6s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }

/* ---------- Tablas ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th {
  text-align: left; font-weight: 600; font-size: .75rem; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); padding: .75rem 1.25rem; border-bottom: 1px solid var(--border); background: var(--surface-2);
  white-space: nowrap;
}
.table td { padding: .8rem 1.25rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .1s; }
.table tbody tr:hover { background: var(--surface-2); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .actions { text-align: right; white-space: nowrap; }
.table .actions > * + * { margin-left: .35rem; }
.row-muted { opacity: .55; }
.row-highlight { background: var(--brand-soft) !important; }
.cell-title { font-weight: 600; color: var(--text); }
.cell-sub { font-size: .8rem; color: var(--muted); }
a.cell-title:hover { color: var(--brand-text); text-decoration: none; }

/* Tablas como tarjetas en móvil */
@media (max-width: 720px) {
  .table-stack thead { display: none; }
  .table-stack, .table-stack tbody, .table-stack tr, .table-stack td { display: block; width: 100%; }
  .table-stack tr { padding: .85rem 1rem; border-bottom: 1px solid var(--border); }
  .table-stack tr:last-child { border-bottom: 0; }
  .table-stack td { border: 0; padding: .2rem 0; display: flex; justify-content: space-between; align-items: center; gap: 1rem; text-align: right; }
  .table-stack td[data-label]::before { content: attr(data-label); color: var(--muted); font-size: .78rem; font-weight: 500; text-align: left; }
  .table-stack td.cell-main { display: block; text-align: left; padding-bottom: .35rem; }
  .table-stack td.cell-main::before { display: none; }
  .table-stack td.actions { justify-content: flex-end; padding-top: .5rem; }
  .table-stack td.actions::before { display: none; }
}

/* ---------- Formularios ---------- */
.form-grid { display: grid; gap: 1rem; grid-template-columns: minmax(0, 1fr); }
.form-row { display: grid; gap: 1rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 640px) { .form-row { grid-template-columns: 1fr; } }
.field { display: flex; flex-direction: column; gap: .4rem; }
.label { font-size: .85rem; font-weight: 600; color: var(--text); }
.label .req { color: var(--danger); }
.hint { font-size: .78rem; color: var(--muted); }
.input, .select, .textarea {
  width: 100%; height: 42px; padding: 0 .85rem;
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  font: inherit; font-size: .95rem;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.textarea { height: auto; min-height: 90px; padding: .7rem .85rem; resize: vertical; }
.select { appearance: none; padding-right: 2.2rem; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 256 256' fill='%2394a3c0'%3E%3Cpath d='M213.66 101.66l-80 80a8 8 0 01-11.32 0l-80-80a8 8 0 0111.32-11.32L128 164.69l74.34-74.35a8 8 0 0111.32 11.32z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right .8rem center; }
.input::placeholder { color: var(--faint); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); background: var(--surface); }
.input-group { position: relative; display: flex; align-items: center; }
.input-group .input { padding-left: 2.5rem; }
.input-group > .ph { position: absolute; left: .85rem; color: var(--faint); font-size: 1.1rem; pointer-events: none; }
.input-group .input-action { position: absolute; right: .35rem; height: 32px; width: 32px; border: 0; background: transparent; color: var(--muted); border-radius: 6px; cursor: pointer; display: grid; place-items: center; font-size: 1.1rem; }
.input-group .input-action:hover { color: var(--text); background: var(--surface-3); }
.input-group:has(.input-action) .input { padding-right: 2.75rem; }
.form-actions { display: flex; justify-content: flex-end; gap: .5rem; flex-wrap: wrap; padding-top: .5rem; }
@media (max-width: 640px) { .form-actions > * { flex: 1; } }

/* Selector de días (chips) */
.chips { display: flex; flex-wrap: wrap; gap: .5rem; }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.chip span {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 56px; height: 38px; padding: 0 .85rem;
  border: 1px solid var(--border); border-radius: 999px;
  background: var(--surface-2); color: var(--muted); font-weight: 600; font-size: .85rem;
  transition: all .15s; user-select: none;
}
.chip input:checked + span { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.chip input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 2px; }

/* Zona de carga de archivos */
.dropzone {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .4rem;
  padding: 1.75rem 1rem; text-align: center;
  border: 2px dashed var(--border-strong); border-radius: var(--radius);
  background: var(--surface-2); cursor: pointer; transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone.is-dragover { border-color: var(--brand); background: var(--brand-soft); }
.dropzone input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dropzone .ph { font-size: 2.2rem; color: var(--success); }
.dropzone-title { font-weight: 600; }
.dropzone-file { font-size: .85rem; color: var(--brand-text); font-weight: 600; }
.dropzone.has-file { border-style: solid; border-color: var(--success); }

/* ---------- Alertas y avisos ---------- */
.alert { display: flex; gap: .75rem; align-items: flex-start; padding: .85rem 1rem; border-radius: var(--radius-sm); font-size: .9rem; border: 1px solid transparent; }
.alert > .ph { font-size: 1.25rem; flex-shrink: 0; margin-top: 1px; }
.alert a { color: inherit; font-weight: 600; text-decoration: underline; }
.alert-success { background: var(--success-soft); color: var(--success); border-color: color-mix(in srgb, var(--success) 30%, transparent); }
.alert-error { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 30%, transparent); }
.alert-warning { background: var(--warning-soft); color: var(--warning); border-color: color-mix(in srgb, var(--warning) 30%, transparent); }
.alert-info { background: var(--info-soft); color: var(--info); border-color: color-mix(in srgb, var(--info) 30%, transparent); }
.alert-body { color: var(--text); }
.alert-body strong { color: inherit; }

.toasts { position: fixed; top: 1rem; right: 1rem; z-index: 200; display: flex; flex-direction: column; gap: .5rem; width: min(420px, calc(100vw - 2rem)); }
.toast {
  display: flex; gap: .75rem; align-items: flex-start;
  padding: .9rem 1rem; border-radius: var(--radius-sm);
  background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--info);
  box-shadow: var(--shadow-lg); font-size: .9rem;
  animation: toast-in .25s ease;
}
.toast > .ph { font-size: 1.25rem; flex-shrink: 0; }
.toast-text { flex: 1; }
.toast-close { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 0; font-size: 1rem; }
.toast-success { border-left-color: var(--success); } .toast-success > .ph { color: var(--success); }
.toast-error { border-left-color: var(--danger); } .toast-error > .ph { color: var(--danger); }
.toast-warning { border-left-color: var(--warning); } .toast-warning > .ph { color: var(--warning); }
.toast-info > .ph { color: var(--info); }
.toast.is-leaving { opacity: 0; transform: translateX(20px); transition: all .25s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } }

/* ---------- Estados vacíos ---------- */
.empty { text-align: center; padding: 3rem 1.5rem; color: var(--muted); }
.empty .ph { font-size: 2.75rem; color: var(--faint); margin-bottom: .75rem; }
.empty-title { color: var(--text); font-weight: 600; font-size: 1rem; margin-bottom: .25rem; }
.empty .btn { margin-top: 1rem; }

/* ---------- Pestañas ---------- */
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--border); margin-bottom: 1.25rem; overflow-x: auto; }
.tab {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .7rem 1rem; color: var(--muted); font-weight: 600; font-size: .9rem; white-space: nowrap;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab:hover { color: var(--text); text-decoration: none; }
.tab.active { color: var(--brand-text); border-bottom-color: var(--brand); }
.tab .count { background: var(--surface-3); color: var(--muted); border-radius: 999px; padding: 0 .5rem; font-size: .75rem; }

/* ---------- Diálogos ---------- */
dialog.modal {
  width: min(560px, calc(100vw - 2rem)); max-height: calc(100vh - 2rem);
  padding: 0; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg);
}
dialog.modal::backdrop { background: rgba(5, 10, 20, .6); backdrop-filter: blur(2px); }
dialog.modal[open] { animation: modal-in .2s ease; }
@keyframes modal-in { from { opacity: 0; transform: translateY(10px) scale(.98); } }
.modal-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 1.25rem; border-bottom: 1px solid var(--border); }
.modal-title { font-size: 1.05rem; }
.modal-body { padding: 1.25rem; }
.modal-footer { display: flex; justify-content: flex-end; gap: .5rem; padding: 1rem 1.25rem; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }

/* Modo proyección (QR a pantalla completa) */
dialog.projector { width: 100vw; height: 100vh; max-width: none; max-height: none; margin: 0; border: 0; border-radius: 0; padding: 0; background: var(--bg); color: var(--text); }
dialog.projector::backdrop { background: var(--bg); }
.projector-inner { min-height: 100%; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4rem; align-items: center; padding: 3rem 5vw; }
.projector-qr { background: #fff; padding: 1.25rem; border-radius: 20px; box-shadow: var(--shadow-lg); }
.projector-qr canvas, .projector-qr img { display: block; width: min(60vh, 42vw) !important; height: auto !important; }
.projector-course { color: var(--brand-text); font-weight: 700; font-size: clamp(1rem, 2vw, 1.4rem); }
.projector-title { font-size: clamp(2rem, 5vw, 3.75rem); margin: .5rem 0 1rem; }
.projector-url { font-family: var(--mono); font-size: clamp(.9rem, 1.6vw, 1.25rem); background: var(--surface); border: 1px solid var(--border); padding: .75rem 1rem; border-radius: var(--radius-sm); word-break: break-all; }
.projector-count { display: flex; align-items: baseline; gap: .75rem; margin-top: 2rem; }
.projector-count strong { font-size: clamp(3rem, 8vw, 6rem); line-height: 1; color: var(--success); font-variant-numeric: tabular-nums; }
.projector-close { position: fixed; top: 1rem; right: 1rem; }
@media (max-width: 860px) {
  .projector-inner { grid-template-columns: 1fr; gap: 2rem; justify-items: center; text-align: center; padding: 4rem 1.25rem 2rem; }
  .projector-qr canvas, .projector-qr img { width: min(80vw, 50vh) !important; }
  .projector-count { justify-content: center; }
}

/* ---------- Componentes varios ---------- */
.progress { height: 8px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--success); border-radius: inherit; transition: width .3s; }
.progress.sm { height: 6px; }
.progress-inline { display: flex; align-items: center; gap: .6rem; min-width: 120px; }
.progress-inline .progress { flex: 1; }
.progress-inline small { color: var(--muted); font-variant-numeric: tabular-nums; min-width: 2.5rem; text-align: right; }

.list { list-style: none; margin: 0; padding: 0; }
.list-item { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .85rem 1.25rem; border-bottom: 1px solid var(--border); }
.list-item:last-child { border-bottom: 0; }
.list-item-main { min-width: 0; }

.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 1rem 1.5rem; }
.kv dt { font-size: .78rem; color: var(--muted); font-weight: 500; }
.kv dd { margin: .15rem 0 0; font-weight: 600; }

.link-box {
  display: flex; align-items: center; gap: .5rem;
  padding: .35rem .35rem .35rem .9rem; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2);
}
.link-box code { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }

.share-panel { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 1.5rem; align-items: center; }
.qr-mini { background: #fff; padding: .6rem; border-radius: 10px; line-height: 0; }
.qr-mini canvas, .qr-mini img { width: 132px !important; height: 132px !important; }
@media (max-width: 640px) { .share-panel { grid-template-columns: minmax(0, 1fr); text-align: center; } .share-panel .qr-mini { justify-self: center; } .share-panel .flex { justify-content: center; } }

.toolbar { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }
.toolbar .input-group { flex: 1; min-width: 220px; }

.pagination { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .85rem 1.25rem; border-top: 1px solid var(--border); font-size: .85rem; color: var(--muted); flex-wrap: wrap; }
.pagination-links { display: flex; gap: .35rem; }

.autocomplete { position: relative; }
.autocomplete-list {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 20;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg);
  max-height: 280px; overflow-y: auto; list-style: none; margin: 0; padding: .25rem;
}
.autocomplete-list li { padding: .55rem .75rem; border-radius: 6px; cursor: pointer; display: flex; justify-content: space-between; gap: 1rem; }
.autocomplete-list li small { color: var(--muted); font-family: var(--mono); }
.autocomplete-list li:hover, .autocomplete-list li.active { background: var(--brand-soft); }
.autocomplete-list .empty-option { color: var(--muted); cursor: default; }
.autocomplete-list .empty-option:hover { background: none; }

.toggle-present {
  display: inline-flex; align-items: center; gap: .4rem; height: 32px; padding: 0 .75rem;
  border-radius: 999px; border: 1px solid var(--border); background: var(--surface-2);
  font: inherit; font-size: .8rem; font-weight: 600; color: var(--muted); cursor: pointer; transition: all .15s;
}
.toggle-present:hover { border-color: var(--success); color: var(--success); }
.toggle-present.is-present { background: var(--success-soft); color: var(--success); border-color: transparent; }
@media (hover: hover) { .toggle-present.is-present:hover { background: var(--danger-soft); color: var(--danger); } }
.toggle-present .when-hover, .toggle-present .lbl-on { display: none; }
.toggle-present.is-present .lbl-on { display: inline; }
.toggle-present.is-present .lbl-off { display: none; }
.toggle-present:not(.is-present) .when-idle .ph { opacity: .4; }
@media (hover: hover) {
  .toggle-present.is-present:hover .when-idle { display: none; }
  .toggle-present.is-present:hover .when-hover { display: inline; }
}

.dropdown { position: relative; display: inline-block; }
.dropdown-menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 25; min-width: 220px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg);
  padding: .3rem; display: none;
}
.dropdown.open .dropdown-menu { display: block; }
.dropdown-item { display: flex; align-items: center; gap: .6rem; width: 100%; padding: .55rem .7rem; border: 0; background: none; border-radius: 6px; color: var(--text); font: inherit; font-size: .88rem; text-align: left; cursor: pointer; }
.dropdown-item:hover { background: var(--surface-2); text-decoration: none; }
.dropdown-item .ph { font-size: 1.1rem; color: var(--muted); }
.dropdown-item.danger, .dropdown-item.danger .ph { color: var(--danger); }
.dropdown-divider { border-top: 1px solid var(--border); margin: .3rem 0; }

.steps { display: flex; gap: .5rem; align-items: center; font-size: .82rem; color: var(--muted); margin-bottom: 1rem; flex-wrap: wrap; }
.step { display: inline-flex; align-items: center; gap: .4rem; }
.step-num { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-3); font-weight: 700; font-size: .75rem; }
.step.active { color: var(--text); font-weight: 600; }
.step.active .step-num { background: var(--brand); color: var(--brand-ink); }
.step.done .step-num { background: var(--success); color: #fff; }
.step-sep { width: 24px; height: 1px; background: var(--border-strong); }

.help-fab {
  position: fixed; right: 1.25rem; bottom: 1.25rem; z-index: 35;
  display: inline-flex; align-items: center; gap: .5rem; height: 44px; padding: 0 1rem;
  border-radius: 999px; background: var(--surface); border: 1px solid var(--border); color: var(--text);
  box-shadow: var(--shadow-lg); font-weight: 600; font-size: .88rem;
}
.help-fab .ph { color: var(--brand-text); font-size: 1.2rem; }
.help-fab:hover { border-color: var(--brand); text-decoration: none; }
@media (max-width: 640px) { .help-fab span { display: none; } .help-fab { width: 44px; padding: 0; justify-content: center; } }

.mt-0 { margin-top: 0 !important; } .mt-1 { margin-top: .5rem; } .mt-2 { margin-top: 1rem; } .mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: .5rem; } .mb-2 { margin-bottom: 1rem; } .mb-3 { margin-bottom: 1.5rem; }
.flex { display: flex; } .items-center { align-items: center; } .justify-between { justify-content: space-between; }
.gap-1 { gap: .5rem; } .gap-2 { gap: 1rem; } .wrap { flex-wrap: wrap; } .grow { flex: 1; min-width: 0; }
.nowrap { white-space: nowrap; } .small { font-size: .85rem; } .xsmall { font-size: .78rem; } .bold { font-weight: 600; }
.text-right { text-align: right; }
@media (max-width: 640px) { .hide-sm { display: none !important; } .list-item { flex-wrap: wrap; } }
.show-sm { display: none; }
@media (max-width: 720px) {
  .show-sm { display: block; }
  .table-stack td.hide-sm-cell { display: none; }
  .table-stack tr.row-compact { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
  .table-stack tr.row-compact td.cell-main { padding-bottom: 0; flex: 1; min-width: 0; }
  .table-stack tr.row-compact td.actions { width: auto; padding-top: 0; }
} .text-center { text-align: center; }
.inline { display: inline; }

/* ---------- Pantallas de acceso (login, recuperación, asistencia) ---------- */
.guest {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1.5rem 1rem;
  background:
    radial-gradient(1000px 500px at 85% -10%, var(--brand-soft), transparent 60%),
    radial-gradient(800px 400px at -10% 110%, var(--info-soft), transparent 60%),
    var(--bg);
}
.guest-card { width: 100%; max-width: 420px; }
.guest-card .card-body { padding: 2rem; }
.guest-logo { display: block; height: 64px; margin: 0 auto 1.5rem; }
.guest-title { font-size: 1.4rem; text-align: center; }
.guest-subtitle { text-align: center; color: var(--muted); margin: .35rem 0 1.5rem; font-size: .92rem; }
.guest-footer { text-align: center; margin-top: 1.25rem; font-size: .85rem; color: var(--muted); }
.guest-links { display: flex; justify-content: space-between; align-items: center; gap: 1rem; font-size: .85rem; }
.guest-theme { position: fixed; top: 1rem; right: 1rem; }
@media (max-width: 480px) { .guest-card .card-body { padding: 1.5rem 1.25rem; } }

.big-icon { width: 72px; height: 72px; border-radius: 50%; display: grid; place-items: center; margin: 0 auto 1rem; font-size: 2.4rem; }

.id-input { text-align: center; font-size: 1.3rem; font-weight: 700; letter-spacing: .12em; height: 56px; text-transform: uppercase; font-family: var(--mono); }

/* ---------- Impresión ---------- */
@media print {
  .sidebar, .topbar, .page-actions, .help-fab, .toasts, .btn, .tabs { display: none !important; }
  .main { margin: 0; }
  body { background: #fff; color: #000; }
  .card { box-shadow: none; border-color: #ccc; }
}
