/* =========================================================
   RAELab · Sistema de diseño (estilo app)
   Una sola estructura en todas las pantallas:
   - Móvil: barra inferior de pestañas, título grande, hojas inferiores
   - Escritorio: la barra de pestañas pasa a riel lateral de íconos
   ========================================================= */

:root {
  --bg: #f2f2f5;
  --surface: #ffffff;
  --surface-2: #f7f7f9;
  --surface-3: #ebebef;
  --text: #15171a;
  --muted: #6c7078;
  --line: #e2e3e7;
  --primary: #0a66d8;
  --primary-hover: #0857bb;
  --primary-soft: #e6effb;
  --primary-ink: #0a4fa8;
  --on-primary: #ffffff;
  --cyan: #0891b2;
  --success: #1a8a47;
  --success-soft: #e5f4ea;
  --warning: #b86e00;
  --warning-soft: #fdf1dc;
  --danger: #d1302a;
  --danger-soft: #fce9e8;
  --modelo: #0a66d8;
  --modelo-soft: #e6effb;
  --video: #d4520f;
  --video-soft: #fcebe1;
  --marcador: #13865f;
  --marcador-soft: #e2f3ec;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .04);
  --shadow: 0 6px 20px rgba(0, 0, 0, .08);
  --shadow-lg: 0 18px 48px rgba(0, 0, 0, .18);
  --radius: 16px;
  --radius-sm: 12px;
  --hero-grad: linear-gradient(var(--primary), var(--primary));
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI Variable Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --rail-w: 84px;
  --tabbar-h: 60px;
  --topbar-h: 54px;
  --sheet-ease: cubic-bezier(.2, .8, .2, 1);
}

[data-bs-theme="dark"] {
  --bg: #0c0c0e;
  --surface: #1b1b1e;
  --surface-2: #222226;
  --surface-3: #2c2c31;
  --text: #f2f2f4;
  --muted: #9a9ba3;
  --line: #303035;
  --primary: #4b9bff;
  --primary-hover: #74b2ff;
  --primary-soft: rgba(75, 155, 255, .16);
  --primary-ink: #a4cbff;
  --on-primary: #06172e;
  --success: #3ccf7b;
  --success-soft: rgba(60, 207, 123, .14);
  --warning: #f2b23e;
  --warning-soft: rgba(242, 178, 62, .14);
  --danger: #ff6b63;
  --danger-soft: rgba(255, 107, 99, .14);
  --modelo: #4b9bff;
  --modelo-soft: rgba(75, 155, 255, .16);
  --video: #ff9a5c;
  --video-soft: rgba(255, 154, 92, .15);
  --marcador: #45d6a0;
  --marcador-soft: rgba(69, 214, 160, .14);
  --shadow-sm: none;
  --shadow: 0 8px 24px rgba(0, 0, 0, .5);
  --shadow-lg: 0 20px 50px rgba(0, 0, 0, .65);
  --bs-body-bg: var(--bg);
  --bs-body-color: var(--text);
}

* { box-sizing: border-box; }

html { scroll-padding-top: calc(var(--topbar-h) + 16px); }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: .9375rem;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

h1, h2, h3, h4, h5 { font-weight: 700; letter-spacing: -.015em; color: var(--text); }
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); }
::selection { background: var(--primary); color: var(--on-primary); }

.skip-link {
  position: absolute; left: 12px; top: -48px; z-index: 2000;
  padding: 8px 14px; border-radius: 10px; background: var(--primary); color: var(--on-primary);
}
.skip-link:focus { top: 12px; color: var(--on-primary); }

:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* ---------- Botones y formularios ---------- */
.btn {
  --bs-btn-font-weight: 600; --bs-btn-padding-x: 1rem; --bs-btn-padding-y: .55rem; --bs-btn-font-size: .9375rem;
  border-radius: var(--radius-sm); display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  min-height: 42px; transition: background .15s, color .15s, transform .1s;
}
.btn:active { transform: scale(.97); }
.btn-sm { --bs-btn-padding-x: .75rem; --bs-btn-padding-y: .35rem; --bs-btn-font-size: .85rem; min-height: 34px; border-radius: 10px; }
.btn-lg { --bs-btn-padding-y: .7rem; --bs-btn-font-size: 1rem; min-height: 50px; border-radius: 14px; }
.btn-primary {
  --bs-btn-bg: var(--primary); --bs-btn-border-color: var(--primary); --bs-btn-color: var(--on-primary);
  --bs-btn-hover-bg: var(--primary-hover); --bs-btn-hover-border-color: var(--primary-hover); --bs-btn-hover-color: var(--on-primary);
  --bs-btn-active-bg: var(--primary-hover); --bs-btn-active-border-color: var(--primary-hover); --bs-btn-active-color: var(--on-primary);
  --bs-btn-disabled-bg: var(--primary); --bs-btn-disabled-border-color: var(--primary); --bs-btn-disabled-color: var(--on-primary);
}
.btn-soft { background: var(--primary-soft); color: var(--primary-ink); border: 0; }
.btn-soft:hover, .btn-soft:focus { background: color-mix(in srgb, var(--primary) 22%, var(--surface)); color: var(--primary-ink); }
.btn-ghost { background: var(--surface-3); color: var(--text); border: 0; }
.btn-ghost:hover, .btn-ghost:focus { background: color-mix(in srgb, var(--text) 12%, var(--surface)); color: var(--text); }
.btn-danger-soft { background: var(--danger-soft); color: var(--danger); border: 0; }
.btn-danger-soft:hover { background: var(--danger); color: #fff; }
.btn-light { --bs-btn-bg: #fff; --bs-btn-border-color: #fff; --bs-btn-color: #111; --bs-btn-hover-bg: #f0f0f0; --bs-btn-hover-border-color: #f0f0f0; }
.btn-outline-light { --bs-btn-color: #fff; --bs-btn-border-color: rgba(255,255,255,.5); --bs-btn-hover-bg: rgba(255,255,255,.16); --bs-btn-hover-color: #fff; --bs-btn-hover-border-color: rgba(255,255,255,.7); }

.form-control, .form-select {
  min-height: 46px; border-radius: var(--radius-sm); border: 1px solid var(--line);
  background-color: var(--surface-2); color: var(--text); font-size: .9375rem;
}
.form-control::placeholder { color: color-mix(in srgb, var(--muted) 80%, transparent); }
.form-control:focus, .form-select:focus {
  background-color: var(--surface); border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent);
}
textarea.form-control { min-height: 96px; }
.form-label { font-weight: 600; font-size: .85rem; color: var(--muted); margin-bottom: .35rem; }
.form-text { color: var(--muted); font-size: .8rem; }
.form-check-input:checked { background-color: var(--primary); border-color: var(--primary); }
.form-switch .form-check-input { width: 2.6em; height: 1.5em; margin-top: 0; }
.input-icon { position: relative; }
.input-icon > i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.input-icon > .form-control { padding-left: 42px; }

.modal-content { border: 0; border-radius: 20px; background: var(--surface); box-shadow: var(--shadow-lg); }
.modal-header, .modal-footer { border: 0; }
.modal-header { padding: 18px 20px 6px; }
.modal-header .modal-title { font-size: 1.1rem; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.modal-header .modal-title i { display: none; }
.modal-body { padding: 12px 20px; }
.modal-footer { padding: 8px 20px 18px; gap: 8px; }
.modal-footer > * { margin: 0; }
.dropdown-menu { border: 0; border-radius: 14px; padding: 6px; background: var(--surface); box-shadow: var(--shadow-lg); }
.dropdown-item { border-radius: 10px; padding: 9px 12px; font-weight: 500; }

/* ---------- Estructura de la app ---------- */
.app { min-height: 100vh; }
.app-main { min-width: 0; display: flex; flex-direction: column; min-height: 100vh; }

/* Barra de pestañas (inferior en móvil, riel lateral en escritorio) */
.tabbar {
  position: fixed; z-index: 1030; display: flex; user-select: none;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(180%) blur(18px); -webkit-backdrop-filter: saturate(180%) blur(18px);
}
.tab {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-width: 0;
  padding: 0; border: 0; background: none; color: var(--muted); font-size: .68rem; font-weight: 600; cursor: pointer;
}
.tab:hover { color: var(--text); }
.tab-icon {
  position: relative; display: grid; place-items: center; width: 48px; height: 30px;
  border-radius: 999px; font-size: 1.25rem; transition: background .2s, transform .12s;
}
.tab-text { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tab.active { color: var(--primary); }
.tab.active .tab-icon { background: var(--primary-soft); }
.tab:active .tab-icon { transform: scale(.88); }
.tab .dot-badge { top: -4px; right: 4px; border-color: var(--surface); }
.sidebar-open .tab[data-sidebar-toggle] { color: var(--primary); }
.rail-brand, .rail-user { display: none; }

/* Barra superior */
.topbar {
  position: sticky; top: 0; z-index: 1020;
  display: flex; align-items: center; gap: 8px;
  min-height: calc(var(--topbar-h) + env(safe-area-inset-top)); padding: env(safe-area-inset-top) 12px 0;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: saturate(180%) blur(18px); -webkit-backdrop-filter: saturate(180%) blur(18px);
  border-bottom: 1px solid transparent; transition: border-color .2s;
}
.is-scrolled .topbar { border-bottom-color: var(--line); }
.topbar-side { flex: 1 1 0; display: flex; align-items: center; gap: 6px; min-width: 0; }
.topbar-side:last-child { justify-content: flex-end; }
.topbar-title { flex: 0 1 auto; min-width: 0; text-align: center; font-size: 1rem; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: opacity .2s; }
.has-large-title:not(.is-scrolled) .topbar-title { opacity: 0; }
.topbar-back {
  display: inline-flex; align-items: center; gap: 2px; height: 40px; padding: 0 8px 0 2px; border-radius: 10px;
  color: var(--primary); font-weight: 500; white-space: nowrap; overflow: hidden; max-width: 100%;
}
.topbar-back i { font-size: 1.35rem; }
.topbar-back span { overflow: hidden; text-overflow: ellipsis; }
.topbar-back:hover { background: var(--surface-3); }

.icon-btn {
  position: relative; width: 40px; height: 40px; flex: 0 0 auto; display: inline-grid; place-items: center;
  border-radius: 12px; border: 0; background: var(--surface-3); color: var(--text);
  font-size: 1.1rem; cursor: pointer; transition: background .15s, transform .1s;
}
.icon-btn:hover { background: color-mix(in srgb, var(--text) 12%, var(--surface)); color: var(--text); }
.icon-btn:active { transform: scale(.94); }
.dot-badge {
  position: absolute; top: -5px; right: -5px; min-width: 18px; height: 18px; padding: 0 5px;
  display: grid; place-items: center; border-radius: 999px; border: 2px solid var(--bg);
  background: var(--danger); color: #fff; font-size: .62rem; font-weight: 700; line-height: 1;
}
.side-badge[hidden], .dot-badge[hidden] { display: none; }
.dot-badge.bump, .side-badge.bump { animation: bump .5s ease; }

/* Menú "Más": hoja con accesos en cuadrícula */
.sidebar {
  position: fixed; z-index: 1050; display: flex; flex-direction: column; gap: 4px;
  background: var(--surface); box-shadow: var(--shadow-lg); overflow-y: auto; overscroll-behavior: contain;
  visibility: hidden; transition: transform .3s var(--sheet-ease), visibility 0s linear .3s;
}
.sidebar-open .sidebar { visibility: visible; transform: none; transition: transform .3s var(--sheet-ease), visibility 0s; }
.sidebar-backdrop {
  position: fixed; inset: 0; z-index: 1040; background: rgba(0, 0, 0, .38);
  opacity: 0; pointer-events: none; transition: opacity .25s;
}
.sidebar-open .sidebar-backdrop { opacity: 1; pointer-events: auto; }
.sheet-grip { flex: 0 0 auto; width: 38px; height: 5px; margin: 0 auto 6px; border-radius: 999px; background: var(--line); }

.menu-user { display: flex; align-items: center; gap: 12px; padding: 4px 4px 12px; }
.menu-user .li-main { flex: 1; min-width: 0; }
.menu-user strong { display: block; font-size: 1.02rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.menu-user small { color: var(--muted); }

.side-nav { display: flex; flex-direction: column; }
.side-label { margin: 12px 4px 6px; color: var(--muted); font-size: .78rem; font-weight: 600; }
.menu-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; }
.side-link {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 8px 2px; border-radius: 14px; color: var(--text); text-align: center;
  font-size: .72rem; font-weight: 500; line-height: 1.2;
}
.side-link:hover { background: var(--surface-2); color: var(--text); }
.side-link i {
  width: 50px; height: 50px; display: grid; place-items: center; border-radius: 15px;
  background: var(--surface-3); font-size: 1.3rem; color: var(--text);
}
.side-link.active i { background: var(--primary); color: var(--on-primary); }
.side-link span:not(.side-badge) { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.side-badge {
  position: absolute; top: 4px; right: calc(50% - 32px); min-width: 20px; height: 20px; padding: 0 6px;
  display: inline-grid; place-items: center; border-radius: 999px; border: 2px solid var(--surface);
  background: var(--danger); color: #fff; font-size: .64rem; font-weight: 700;
}

.menu-rows { margin-top: 14px; border-radius: 14px; background: var(--surface-2); overflow: hidden; }
.menu-row {
  width: 100%; display: flex; align-items: center; gap: 12px; min-height: 50px; padding: 0 14px;
  border: 0; background: none; color: var(--text); font-weight: 500; text-align: left;
}
.menu-row + .menu-row { border-top: 1px solid var(--line); }
.menu-row > i:first-child { width: 22px; text-align: center; font-size: 1.1rem; color: var(--muted); }
.menu-row .menu-state { margin-left: auto; color: var(--muted); font-size: .86rem; }
.menu-row:hover { background: var(--surface-3); color: var(--text); }
.menu-row.danger, .menu-row.danger > i:first-child { color: var(--danger); }

/* Contenido */
.page { flex: 1; width: 100%; max-width: 1120px; margin: 0 auto; padding: 8px 32px 56px; outline: none; animation: pageIn .2s ease; }
.app-footer { display: none; }

/* ---------- Encabezados ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 4px 0 20px; }
.page-head h1 { margin: 0; font-size: 2rem; font-weight: 750; letter-spacing: -.025em; line-height: 1.1; }
.page-head p { margin: 4px 0 0; color: var(--muted); font-size: .9rem; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 28px 0 12px; }
.section-head h2 { margin: 0; font-size: 1.25rem; display: flex; align-items: center; gap: 8px; }
.section-head h2 i, .cat-head h2 i { display: none; }
.section-head p { margin: 2px 0 0; color: var(--muted); font-size: .85rem; }
.section-head .btn-ghost.btn-sm { background: none; color: var(--primary); padding-inline: 4px; }
.section-head .btn-ghost.btn-sm:hover { text-decoration: underline; }

/* ---------- Avatares ---------- */
.avatar {
  width: 42px; height: 42px; flex: 0 0 auto; display: inline-grid; place-items: center;
  border-radius: 50%; font-weight: 700; font-size: .88rem; color: #fff; background: #5b6472;
}
.avatar-sm { width: 34px; height: 34px; font-size: .74rem; }
.avatar-lg { width: 52px; height: 52px; font-size: 1.1rem; }
.avatar[data-role="docente"] { background: #0f7f8f; }
.avatar[data-role="estudiante"] { background: #c25e12; }
.avatar[data-role="administrador"] { background: #3d4a5c; }

/* ---------- Tarjetas ---------- */
.card-x { background: var(--surface); border-radius: var(--radius); overflow: hidden; }
.card-x-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px 4px; }
.card-x-head h2, .card-x-head h3 { margin: 0; font-size: 1.05rem; display: flex; align-items: center; gap: 8px; }
.card-x-head p { margin: 2px 0 0; color: var(--muted); font-size: .82rem; }
.card-x-head .head-icon { display: none; }
.card-x-body { padding: 14px 18px 18px; }
.head-icon {
  width: 34px; height: 34px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 10px;
  background: var(--primary-soft); color: var(--primary); font-size: 1rem;
}
.head-icon.success { background: var(--success-soft); color: var(--success); }
.head-icon.warning { background: var(--warning-soft); color: var(--warning); }
.head-icon.danger { background: var(--danger-soft); color: var(--danger); }

/* ---------- Cabecera destacada (aulas, resumen) ---------- */
.hero {
  position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 20px;
  padding: 22px; border-radius: 20px; background: var(--primary); color: #fff;
}
.hero h1, .hero h2 { color: #fff; margin: 0; font-size: 1.6rem; letter-spacing: -.02em; }
.hero p { margin: 6px 0 0; color: rgba(255,255,255,.85); font-size: .92rem; }
.hero-kicker { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 6px; font-size: .82rem; font-weight: 600; opacity: .85; }
.hero-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.hero .btn-light { color: #111; }
.aula-hero { background: var(--aula); }

/* Anillo de progreso */
.ring { position: relative; width: 96px; height: 96px; flex: 0 0 auto; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 10; }
.ring .ring-track { stroke: var(--surface-3); }
.ring .ring-value { stroke: var(--primary); stroke-linecap: round; transition: stroke-dashoffset .9s var(--sheet-ease); }
.hero .ring .ring-track { stroke: rgba(255,255,255,.22); }
.hero .ring .ring-value { stroke: #fff; }
.ring-label { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.ring-label strong { font-size: 1.25rem; line-height: 1; }
.ring-label small { font-size: .68rem; color: var(--muted); font-weight: 600; }
.hero .ring-label small { color: rgba(255,255,255,.8); }

/* Tarjeta de progreso y fila de acceso */
.progress-card, .list-card {
  display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: var(--radius);
  background: var(--surface); color: var(--text);
}
.progress-card .ring { width: 64px; height: 64px; }
.progress-card .ring circle { stroke-width: 12; }
.progress-card .ring-label strong { font-size: .9rem; }
.progress-card .li-main strong, .list-card .li-main strong { display: block; font-weight: 600; }
.progress-card .li-main small { color: var(--muted); font-size: .82rem; }
a.list-card:hover { color: var(--text); background: var(--surface-2); }

/* ---------- Resumen numérico ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-top: 12px; }
.stat {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px;
  background: var(--surface); border-radius: var(--radius); color: inherit;
}
a.stat { transition: background .15s, transform .1s; }
a.stat:hover { background: var(--surface-2); color: inherit; }
a.stat:active { transform: scale(.98); }
.stat-icon {
  width: 34px; height: 34px; flex: 0 0 auto; display: grid; place-items: center;
  border-radius: 10px; font-size: 1.02rem;
}
.stat-value { margin: 0; font-size: 1.6rem; font-weight: 700; line-height: 1; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat-label { margin: 4px 0 0; color: var(--muted); font-size: .8rem; font-weight: 500; }
.tone-primary { background: var(--primary-soft); color: var(--primary); }
.tone-modelo { background: var(--modelo-soft); color: var(--modelo); }
.tone-video { background: var(--video-soft); color: var(--video); }
.tone-marcador { background: var(--marcador-soft); color: var(--marcador); }
.tone-success { background: var(--success-soft); color: var(--success); }
.tone-warning { background: var(--warning-soft); color: var(--warning); }
.tone-danger { background: var(--danger-soft); color: var(--danger); }

/* ---------- Etiquetas ---------- */
.tag {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px;
  font-size: .72rem; font-weight: 600; white-space: nowrap; background: var(--surface-3); color: var(--muted);
}
.tag-modelo { background: var(--modelo-soft); color: var(--modelo); }
.tag-video { background: var(--video-soft); color: var(--video); }
.tag-marcador { background: var(--marcador-soft); color: var(--marcador); }
.tag-success { background: var(--success-soft); color: var(--success); }
.tag-danger { background: var(--danger-soft); color: var(--danger); }
.tag-warning { background: var(--warning-soft); color: var(--warning); }
.tag-primary { background: var(--primary-soft); color: var(--primary-ink); }
.tag-cat { background: color-mix(in srgb, var(--cat) 13%, transparent); color: color-mix(in srgb, var(--cat) 85%, var(--text)); }
[data-bs-theme="dark"] .tag-cat { background: color-mix(in srgb, var(--cat) 22%, transparent); color: color-mix(in srgb, var(--cat) 55%, white); }

/* Miniaturas */
.thumb-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; padding: 12px; }
.thumb-fallback { position: absolute; inset: 0; display: grid; place-items: center; font-size: 2.6rem; color: var(--cat, var(--primary)); opacity: .5; }

/* Secciones por categoría */
.cat-head { display: flex; align-items: center; gap: 10px; margin: 28px 0 12px; }
.cat-head .stat-icon { width: 32px; height: 32px; font-size: 1rem; border-radius: 10px;
  background: color-mix(in srgb, var(--cat) 14%, transparent); color: var(--cat); }
.cat-head h2 { margin: 0; font-size: 1.2rem; }
.cat-head p { display: none; }
.cat-head .count { margin-left: auto; }

/* Grupos plegables por categoría */
.cat-groups { display: flex; flex-direction: column; border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.cat-group { background: var(--surface); }
.cat-group + .cat-group { border-top: 1px solid var(--line); }
.cat-group[hidden] { display: none; }
.cat-group > summary {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px; cursor: pointer; list-style: none; transition: background .15s;
}
.cat-group > summary::-webkit-details-marker { display: none; }
.cat-group > summary:hover { background: var(--surface-2); }
.cat-group > summary .stat-icon { width: 36px; height: 36px; font-size: 1.05rem; border-radius: 10px;
  background: color-mix(in srgb, var(--cat) 14%, transparent); color: var(--cat); }
.cat-group-title { flex: 1; min-width: 0; }
.cat-group-title strong { display: block; font-size: .98rem; font-weight: 600; }
.cat-group-title small { display: none; }
.cat-group-types { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.cat-group-count { min-width: 30px; height: 26px; padding: 0 9px; display: grid; place-items: center; border-radius: 999px;
  background: var(--surface-3); font-weight: 600; font-size: .8rem; color: var(--muted); }
.cat-group-chevron { color: var(--muted); transition: transform .2s; }
.cat-group[open] .cat-group-chevron { transform: rotate(180deg); }

.res-mini-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 8px; padding: 4px 12px 14px; }
.res-mini {
  display: flex; align-items: center; gap: 12px; padding: 8px; min-width: 0;
  background: var(--surface-2); border-radius: 14px; color: var(--text); transition: background .15s;
}
.res-mini:hover { color: var(--text); background: var(--surface-3); }
.res-mini.is-hidden { display: none; }
.res-mini-thumb {
  position: relative; width: 56px; height: 56px; flex: 0 0 auto; display: grid; place-items: center; overflow: hidden;
  border-radius: 12px; background: var(--surface); color: var(--cat, var(--primary)); font-size: 1.4rem;
}
.res-mini-thumb img { width: 100%; height: 100%; object-fit: contain; padding: 4px; }
.res-mini-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.res-mini-body strong { font-size: .9rem; font-weight: 600; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.res-mini-meta { display: flex; gap: 6px; flex-wrap: wrap; }
.res-mini-meta .tag { padding: 2px 7px; font-size: .68rem; }
.res-mini-body small { color: var(--muted); font-size: .75rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.res-mini-go { color: var(--muted); font-size: 1rem; }
.res-mini-link { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; color: inherit; }
.res-mini-link:hover { color: inherit; }
.res-mini-actions { display: flex; flex-direction: column; gap: 4px; }
.res-mini-actions .icon-btn { width: 32px; height: 32px; border-radius: 10px; font-size: .85rem; background: var(--surface); }
.res-mini-actions .icon-btn.danger:hover { background: var(--danger-soft); color: var(--danger); }
.chip:disabled { opacity: .4; cursor: not-allowed; }

/* ---------- Aulas ---------- */
.aula-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.aula-card {
  position: relative; display: flex; flex-direction: column; overflow: hidden; color: var(--text);
  background: var(--surface); border-radius: 18px; transition: transform .1s;
}
.aula-card:hover { color: var(--text); }
.aula-card:active { transform: scale(.98); }
.aula-banner { position: relative; min-height: 84px; padding: 16px; color: #fff; background: var(--aula); }
.aula-banner h3 { margin: 0; color: #fff; font-size: 1.08rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.aula-banner small { opacity: .85; font-weight: 500; }
.aula-banner .bi-easel2 { display: none; }
.aula-body { padding: 12px 16px 14px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.aula-body p { display: none; }
.aula-stats { display: flex; gap: 14px; color: var(--muted); font-size: .8rem; font-weight: 500; margin-top: auto; }
.codigo-aula {
  display: inline-flex; align-items: center; gap: 8px; padding: 5px 10px; border-radius: 10px;
  background: var(--surface-3); font-family: ui-monospace, "SF Mono", Consolas, monospace;
  font-size: 1rem; font-weight: 700; letter-spacing: .14em;
}
.hero .codigo-aula { background: rgba(255,255,255,.18); color: #fff; }
.segmented { display: flex; gap: 2px; padding: 3px; border-radius: 12px; background: var(--surface-3); max-width: 420px; }
.segmented button, .segmented .seg-link {
  flex: 1 1 0; min-height: 34px; border: 0; border-radius: 9px; background: none; color: var(--muted);
  font-weight: 600; font-size: .86rem; transition: background .15s, color .15s;
}
.segmented button span, .seg-link span { font-weight: 500; opacity: .7; }
.seg-link { display: flex; align-items: center; justify-content: center; gap: 6px; }
.seg-link:hover { color: var(--text); }
.segmented [aria-selected="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.join-card { display: flex; gap: 8px; padding: 8px; border-radius: var(--radius); background: var(--surface); }
.join-card .form-control { border: 0; background: var(--surface-3); font-family: ui-monospace, "SF Mono", Consolas, monospace; font-weight: 700; letter-spacing: .14em; }
.join-card .form-control::placeholder { font-family: var(--font); letter-spacing: 0; font-weight: 400; }
.join-card .btn { flex: 0 0 auto; }
.instrucciones { padding: 10px 12px; margin-bottom: 12px; border-radius: 12px; font-size: .85rem; line-height: 1.45; background: var(--warning-soft); }
.instrucciones strong { display: block; font-size: .74rem; font-weight: 600; color: var(--warning); }
.color-pick { display: flex; gap: 10px; flex-wrap: wrap; }
.color-pick input { position: absolute; opacity: 0; pointer-events: none; }
.color-pick label { width: 34px; height: 34px; border-radius: 50%; background: var(--c); cursor: pointer; border: 3px solid var(--surface); box-shadow: 0 0 0 1px var(--line); }
.color-pick input:checked + label { box-shadow: 0 0 0 2px var(--c); }
.color-pick input:focus-visible + label { outline: 2px solid var(--primary); }

/* ---------- Filtros y búsqueda ---------- */
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.chips { display: flex; gap: 6px; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; min-width: 0; max-width: 100%; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 0 14px; white-space: nowrap;
  border-radius: 999px; border: 0; background: var(--surface); color: var(--text);
  font-weight: 500; font-size: .84rem; cursor: pointer; transition: background .15s, color .15s;
}
.chip:hover { background: var(--surface-3); }
.card-x .chip:not([aria-pressed="true"]):not(.active), .modal .chip:not([aria-pressed="true"]):not(.active) { background: var(--surface-3); }
.chip.active, .chip[aria-pressed="true"] { background: var(--text); color: var(--bg); }
.chip.active i, .chip[aria-pressed="true"] i { color: inherit !important; }
.chip .chip-count { color: var(--muted); font-size: .76rem; }
.chip[aria-pressed="true"] .chip-count { color: inherit; opacity: .65; }
.search { position: relative; min-width: min(260px, 100%); margin: 0; }
.search i { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search input { padding-left: 38px; border-radius: 12px; min-height: 40px; border: 0; background: var(--surface-3); }
.search input:focus { background: var(--surface); }

/* ---------- Recursos ---------- */
.res-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.res-card {
  position: relative; display: flex; flex-direction: column; min-width: 0;
  background: var(--surface); border-radius: 18px; overflow: hidden;
}
.res-thumb { position: relative; aspect-ratio: 4 / 3; background: var(--surface-2); }
.res-thumb model-viewer, .res-thumb img, .res-thumb video { width: 100%; height: 100%; display: block; object-fit: cover; background: transparent; }
.res-thumb model-viewer { --poster-color: transparent; }
.res-thumb > .tag { position: absolute; top: 10px; left: 10px; z-index: 2; }
.res-thumb > .tag-modelo { display: none; }
.res-flags { position: absolute; top: 10px; right: 10px; z-index: 2; display: flex; gap: 6px; }
.flag-new { background: var(--danger); color: #fff; }
.flag-seen { background: var(--success); color: #fff; }
[data-bs-theme="dark"] .flag-seen { color: #04220f; }
.res-hint { display: none; }
.res-body { display: flex; flex-direction: column; flex: 1; gap: 6px; padding: 12px 14px 14px; }
.res-body > .mb-2 { margin: 0 !important; }
.res-body h3 { margin: 0; font-size: .98rem; font-weight: 650; line-height: 1.3; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.res-body > p { display: none; }
.cat-section .res-body > .mb-2 { display: none; }
.res-meta { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: .76rem; flex-wrap: wrap; }
.res-actions { margin-top: auto; padding-top: 6px; display: flex; gap: 6px; }
.res-actions .btn { flex: 0 0 auto; min-height: 38px; }
.res-actions .btn:first-child { flex: 1 1 auto; }
.res-card.is-hidden { display: none; }
.model-placeholder { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; gap: 6px; color: var(--muted); font-size: .8rem; }
.model-placeholder i { font-size: 2.2rem; color: var(--modelo); }

/* ---------- Estado vacío ---------- */
.empty { display: grid; place-items: center; text-align: center; padding: 40px 20px; border-radius: 18px; background: var(--surface); }
.empty-icon {
  width: 64px; height: 64px; display: grid; place-items: center; margin: 0 auto 12px;
  border-radius: 20px; background: var(--surface-3); color: var(--muted); font-size: 1.7rem;
}
.empty h3 { margin: 0 0 4px; font-size: 1.05rem; }
.empty p { margin: 0 auto; max-width: 380px; color: var(--muted); font-size: .88rem; }

/* ---------- Pasos (se conservan por compatibilidad) ---------- */
.steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; counter-reset: paso; }
.step { position: relative; padding: 16px; border-radius: var(--radius); background: var(--surface); }
.step-num { width: 28px; height: 28px; display: grid; place-items: center; margin-bottom: 10px; border-radius: 50%; background: var(--surface-3); font-weight: 700; font-size: .85rem; }
.step h3 { margin: 0 0 4px; font-size: .98rem; }
.step p { margin: 0; color: var(--muted); font-size: .85rem; }
.step-icon { display: none; }

.tip { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 14px; background: var(--surface); }
.tip > i { font-size: 1.15rem; color: var(--warning); }
.tip strong { display: block; font-size: .9rem; }
.tip p { margin: 0; color: var(--muted); font-size: .86rem; }

/* Destacado */
.feature { display: grid; grid-template-columns: 200px minmax(0, 1fr); overflow: hidden; border-radius: 18px; background: var(--surface); }
.feature-media { position: relative; min-height: 170px; background: var(--surface-2); }
.feature-media model-viewer, .feature-media img, .feature-media video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.feature-body { padding: 18px; display: flex; flex-direction: column; justify-content: center; }
.feature-body h3 { margin: 4px 0; font-size: 1.1rem; }
.feature-body p { margin: 0 0 12px; color: var(--muted); }

/* ---------- Listas agrupadas ---------- */
.list-x { display: flex; flex-direction: column; }
.list-item {
  position: relative; display: flex; align-items: center; gap: 12px; padding: 12px 16px;
  color: var(--text); transition: background .15s;
}
.list-item + .list-item::before { content: ""; position: absolute; top: 0; left: 62px; right: 0; height: 1px; background: var(--line); }
a.list-item:hover { background: var(--surface-2); color: var(--text); }
a.list-item:active { background: var(--surface-3); }
.list-item.unread .li-title { font-weight: 700; }
.li-main { min-width: 0; flex: 1; }
.li-title { display: flex; align-items: center; gap: 8px; font-weight: 550; }
.li-title span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.li-sub { color: var(--muted); font-size: .84rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.li-side { color: var(--muted); font-size: .76rem; white-space: nowrap; text-align: right; }
.unread-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--primary); flex: 0 0 auto; }

/* En línea */
.online-list { display: flex; flex-direction: column; }
.online-item { display: flex; align-items: center; gap: 12px; padding: 8px 0; }
.online-item + .online-item { border-top: 1px solid var(--line); }
.online-item .avatar { position: relative; }
.online-item .avatar::after {
  content: ""; position: absolute; right: -1px; bottom: -1px; width: 11px; height: 11px;
  border-radius: 50%; background: #22c55e; border: 2px solid var(--surface);
}
.online-item .li-main strong { display: block; font-size: .9rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.online-item .li-main small { color: var(--muted); text-transform: capitalize; }
.live-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #22c55e; }

/* ---------- Tablas ---------- */
.table-x { width: 100%; margin: 0; border-collapse: separate; border-spacing: 0; }
.table-x th {
  padding: 10px 16px; color: var(--muted); font-size: .76rem; font-weight: 600;
  border-bottom: 1px solid var(--line); white-space: nowrap; text-align: left;
}
.table-x td { padding: 10px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table-x tr:last-child td { border-bottom: 0; }
.table-x tbody tr:hover { background: var(--surface-2); }
.table-x tr.is-hidden { display: none; }
.cell-user { display: flex; align-items: center; gap: 12px; min-width: 200px; }
.cell-user strong { display: block; font-weight: 600; }
.cell-user small { color: var(--muted); }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }
.row-actions .icon-btn { width: 34px; height: 34px; border-radius: 10px; font-size: .92rem; background: transparent; }
.row-actions .icon-btn:hover { background: var(--surface-3); }
.row-actions .icon-btn.danger:hover { background: var(--danger-soft); color: var(--danger); }

/* ---------- Carga de archivos ---------- */
.dropzone {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  min-height: 140px; padding: 20px; text-align: center; cursor: pointer;
  border: 1.5px dashed var(--line); border-radius: 16px; background: var(--surface-2); transition: border-color .2s, background .2s;
}
.dropzone:hover, .dropzone.is-over { border-color: var(--primary); background: var(--primary-soft); }
.dropzone input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dz-empty { display: flex; flex-direction: column; align-items: center; gap: 4px; pointer-events: none; }
.dz-empty > i, .dropzone > i { font-size: 1.8rem; color: var(--primary); }
.dropzone strong { font-size: .92rem; font-weight: 600; }
.dropzone small { color: var(--muted); }
.dz-file {
  display: none; align-items: center; gap: 12px; width: 100%; padding: 10px; margin-top: 4px;
  border-radius: 12px; background: var(--surface); text-align: left;
}
.dropzone.has-file .dz-file { display: flex; }
.dropzone.has-file .dz-empty { display: none; }
.dz-file .stat-icon { width: 40px; height: 40px; font-size: 1.1rem; border-radius: 10px; }
.dz-file-name { font-weight: 600; overflow-wrap: anywhere; }
.dz-preview { width: 50px; height: 50px; object-fit: cover; border-radius: 10px; }

/* Selector segmentado (tarjetas radio) */
.type-picker { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; padding: 4px; border-radius: 14px; background: var(--surface-3); }
.type-option { position: relative; }
.type-option input { position: absolute; opacity: 0; pointer-events: none; }
.type-option label {
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 6px; height: 100%;
  border-radius: 11px; cursor: pointer; text-align: center; font-weight: 600; font-size: .84rem; color: var(--muted); transition: background .15s, color .15s;
}
.type-option label i { font-size: 1.25rem; }
.type-option label small { color: var(--muted); font-weight: 500; font-size: .7rem; }
.type-option input:checked + label { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.type-option input:focus-visible + label { outline: 2px solid var(--primary); }

/* Barra de progreso */
.progress-x { height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.progress-x > span { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--primary); transition: width .25s; }

/* Selección múltiple */
.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.pick { position: relative; }
.pick input { position: absolute; opacity: 0; pointer-events: none; }
.pick label {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; height: 100%;
  border-radius: 14px; background: var(--surface-2); cursor: pointer; transition: background .15s, box-shadow .15s;
}
.pick label:hover { background: var(--surface-3); }
.pick input:checked + label { background: var(--primary-soft); box-shadow: inset 0 0 0 1.5px var(--primary); }
.pick input:focus-visible + label { outline: 2px solid var(--primary); }
.pick input:disabled + label { opacity: .55; cursor: not-allowed; }
.pick .check {
  margin-left: auto; width: 22px; height: 22px; flex: 0 0 auto; display: grid; place-items: center;
  border-radius: 50%; border: 2px solid var(--line); color: transparent; font-size: .78rem; transition: all .15s;
}
.pick input:checked + label .check { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.pick .li-main strong { display: block; font-size: .9rem; font-weight: 600; overflow-wrap: anywhere; }
.pick .li-main small { color: var(--muted); font-size: .76rem; }
.pick.is-hidden { display: none; }

/* Pasos numerados de formulario */
.form-step { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; font-size: .95rem; font-weight: 600; }
.form-step span {
  width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%;
  background: var(--surface-3); color: var(--muted); font-size: .74rem; font-weight: 700;
}

/* Barra fija de acción */
.sticky-action {
  position: sticky; bottom: 16px; z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  margin-top: 16px; padding: 10px 10px 10px 16px; border-radius: 18px; background: var(--surface); box-shadow: var(--shadow-lg);
}

/* ---------- Avisos ---------- */
.toast-stack {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 2100;
  display: flex; flex-direction: column; align-items: center; gap: 8px; width: min(420px, calc(100vw - 24px)); pointer-events: none;
}
.toast-x {
  pointer-events: auto; display: flex; align-items: center; gap: 10px; width: 100%; padding: 12px 14px; border-radius: 14px;
  background: #1f2023; color: #f4f4f5; box-shadow: var(--shadow-lg); animation: toastIn .3s var(--sheet-ease) both;
}
[data-bs-theme="dark"] .toast-x { background: #3a3a40; }
.toast-x.out { animation: toastOut .25s ease forwards; }
.toast-x > i { font-size: 1.1rem; }
.toast-x.success > i { color: #4ade80; }
.toast-x.danger > i { color: #ff7b72; }
.toast-x.warning > i { color: #fbbf24; }
.toast-x.info > i { color: #7cb6ff; }
.toast-x p { margin: 0; font-weight: 500; font-size: .88rem; line-height: 1.35; flex: 1; }
.toast-x button { border: 0; background: none; color: rgba(255,255,255,.6); padding: 0 2px; font-size: 1.15rem; line-height: 1; }

.alert-x { display: flex; gap: 10px; align-items: center; padding: 12px 14px; border-radius: 12px; font-weight: 500; font-size: .9rem; margin-bottom: 14px; }
.alert-x.success { background: var(--success-soft); color: var(--success); }
.alert-x.danger { background: var(--danger-soft); color: var(--danger); }
.alert-x.warning { background: var(--warning-soft); color: var(--warning); }
.alert-x.info { background: var(--primary-soft); color: var(--primary-ink); }

/* ---------- Movimiento ---------- */
.reveal { opacity: 1; }
/* Solo opacidad y sin "fill": al terminar no deja contexto de apilamiento en .page (los modales quedarían atrapados) */
@keyframes pageIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(8px); } }
@keyframes bump { 0%,100% { transform: scale(1); } 40% { transform: scale(1.3); } }
@keyframes shimmer { to { background-position: -200% 0; } }
.skeleton { border-radius: 10px; background: linear-gradient(90deg, var(--surface-3) 25%, var(--surface-2) 50%, var(--surface-3) 75%); background-size: 200% 100%; animation: shimmer 1.4s infinite linear; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* ---------- Chat ---------- */
.chat-app {
  display: grid; grid-template-columns: 330px minmax(0, 1fr);
  height: calc(100dvh - var(--topbar-h) - 40px); min-height: 480px;
  background: var(--surface); border-radius: var(--radius); overflow: hidden;
}
.chat-side { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--line); background: var(--surface); }
.chat-side-head { padding: 12px; display: grid; gap: 10px; }
.chat-side-head .search { width: 100%; }
.chat-side-head .chip { background: var(--surface-3); padding-block: 4px; font-size: .8rem; }
.chat-side-head .chip[aria-pressed="true"] { background: var(--text); }
.chat-list { flex: 1; overflow-y: auto; padding: 0 6px 6px; }
.chat-contact {
  width: 100%; display: flex; align-items: center; gap: 11px; padding: 10px; border: 0; border-radius: 12px;
  background: transparent; color: inherit; text-align: left; cursor: pointer; transition: background .15s;
}
.chat-contact:hover { background: var(--surface-2); }
.chat-contact.active { background: var(--primary-soft); }
.chat-contact .avatar { position: relative; flex: 0 0 auto; }
.chat-contact .avatar.is-online::after, .chat-pane-head .avatar.is-online::after {
  content: ""; position: absolute; right: -1px; bottom: -1px; width: 12px; height: 12px; border-radius: 50%;
  background: #22c55e; border: 2px solid var(--surface);
}
.chat-contact .cc-main { flex: 1; min-width: 0; }
.chat-contact .cc-top { display: flex; align-items: baseline; gap: 6px; }
.chat-contact .cc-top strong { flex: 1; min-width: 0; font-size: .92rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-contact .cc-top time { color: var(--muted); font-size: .72rem; flex: 0 0 auto; }
.chat-contact .cc-bottom { display: flex; align-items: center; gap: 6px; margin-top: 2px; }
.chat-contact .cc-bottom small { flex: 1; min-width: 0; color: var(--muted); font-size: .8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-contact.has-unread .cc-bottom small { color: var(--text); font-weight: 600; }
.cc-unread { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--primary); color: var(--on-primary); font-size: .7rem; font-weight: 700; display: grid; place-items: center; }
.chat-group-label { margin: 12px 10px 4px; color: var(--muted); font-size: .76rem; font-weight: 600; }

.chat-pane { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.chat-conv { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.chat-conv[hidden], .chat-form[hidden] { display: none; }
.chat-pane-head { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.chat-pane-head .li-main { min-width: 0; }
.chat-pane-head .li-main strong { display: block; font-weight: 600; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-pane-head .li-main small { color: var(--muted); font-size: .78rem; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-back { display: none; }
.chat-msgs { flex: 1; overflow-y: auto; padding: 16px 14px; display: flex; flex-direction: column; gap: 3px; background: var(--bg); }
.chat-day { align-self: center; margin: 10px 0 6px; padding: 2px 10px; border-radius: 999px; background: var(--surface-3); color: var(--muted); font-size: .72rem; font-weight: 600; }
.bubble {
  max-width: min(76%, 600px); padding: 7px 12px 5px; border-radius: 18px; line-height: 1.4; font-size: .93rem;
  overflow-wrap: anywhere; white-space: pre-wrap; animation: fadeUp .2s ease both;
}
.bubble time { display: flex; justify-content: flex-end; align-items: center; gap: 4px; margin-top: 1px; font-size: .66rem; opacity: .7; }
.bubble.me { align-self: flex-end; background: var(--primary); color: var(--on-primary); border-bottom-right-radius: 6px; }
.bubble.them { align-self: flex-start; background: var(--surface); border-bottom-left-radius: 6px; }
.bubble .tick { font-size: .9rem; line-height: 1; }
.bubble.seen .tick { color: #bfe3ff; }
[data-bs-theme="dark"] .bubble.seen .tick { color: #0a3d7a; }
.bubble.pending { opacity: .6; }
.chat-empty { margin: auto; text-align: center; color: var(--muted); padding: 24px; }
.chat-empty .empty-icon { margin-inline: auto; }
.chat-form { display: flex; gap: 8px; align-items: flex-end; padding: 10px; border-top: 1px solid var(--line); background: var(--surface); }
.chat-form textarea { resize: none; max-height: 140px; border-radius: 22px; padding: 10px 16px; min-height: 42px; }
.chat-form .send-btn { width: 42px; height: 42px; min-height: 0; border-radius: 50%; padding: 0; flex: 0 0 auto; }
.chat-notice { padding: 12px 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: .86rem; text-align: center; background: var(--surface-2); }

/* =========================================================
   Escritorio y tableta horizontal (≥ 992px): riel lateral
   ========================================================= */
@media (min-width: 992px) {
  .app { padding-left: var(--rail-w); }
  .tabbar {
    left: 0; top: 0; bottom: 0; width: var(--rail-w); flex-direction: column; align-items: center; gap: 4px;
    padding: 14px 0 16px; border-right: 1px solid var(--line); background: var(--surface);
  }
  .rail-brand { display: grid; place-items: center; margin-bottom: 14px; }
  .rail-user { display: flex; margin-top: auto; }
  .tab { width: 72px; padding: 6px 0; border-radius: 14px; }
  .tab-icon { width: 52px; height: 32px; }
  .tabbar .tab[data-sidebar-toggle]:not(.rail-user) { display: none; }
  .rail-user .tab-icon { width: auto; height: auto; background: none !important; }

  .topbar { padding-inline: 32px; }
  .topbar-title { text-align: left; }
  .topbar-side:first-child:empty { display: none; }

  /* Menú como panel junto al riel */
  .sidebar {
    left: calc(var(--rail-w) + 10px); bottom: 10px; width: 380px; max-height: calc(100vh - 20px);
    padding: 16px; border-radius: 22px; transform: translateX(-16px) scale(.98); opacity: 0;
    transition: transform .25s var(--sheet-ease), opacity .2s, visibility 0s linear .25s;
  }
  .sidebar-open .sidebar { opacity: 1; transition: transform .25s var(--sheet-ease), opacity .2s, visibility 0s; }
  .sheet-grip { display: none; }
  .sidebar-backdrop { background: rgba(0, 0, 0, .12); }
}

@media (min-width: 1400px) {
  .page { max-width: 1240px; }
}

/* =========================================================
   Móvil y tableta vertical (< 992px)
   ========================================================= */
@media (max-width: 991.98px) {
  body { overscroll-behavior-y: none; }

  .tabbar {
    left: 0; right: 0; bottom: 0; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr);
    height: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding: 0 4px env(safe-area-inset-bottom);
    border-top: 1px solid var(--line);
  }
  .tabbar .rail-user, .tabbar .tab-escritorio { display: none; }

  .sidebar {
    left: 0; right: 0; bottom: 0; max-height: 88dvh; padding: 10px 16px calc(16px + env(safe-area-inset-bottom));
    border-radius: 24px 24px 0 0; transform: translateY(100%);
  }

  .page { padding: 4px 16px calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 24px); }
  .page-head h1 { font-size: 1.85rem; }
  .page-head { margin-bottom: 16px; }
  .section-head { margin: 24px 0 10px; }
  .section-head h2 { font-size: 1.15rem; }
  .hero { grid-template-columns: 1fr; padding: 18px; }
  .hero:has(.ring) h1, .hero:has(.ring) > div > p { padding-right: 76px; }
  .hero .ring { position: absolute; top: 16px; right: 16px; width: 64px; height: 64px; }
  .hero .ring circle { stroke-width: 12; }
  .hero .ring-label strong { font-size: .9rem; }
  .hero h1, .hero h2 { font-size: 1.35rem; }
  .hero-actions .btn { flex: 1 1 auto; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .steps { grid-template-columns: 1fr; }

  /* Filtros de borde a borde */
  .toolbar { flex-direction: column; flex-wrap: nowrap; align-items: stretch; }
  .chips { margin-inline: -16px; padding: 0 16px; scroll-padding-inline: 16px; max-width: none; }
  .search { width: 100%; min-width: 0; }

  .cat-group > summary { padding: 12px 14px; gap: 10px; }
  .cat-group-types { display: none; }
  .res-mini-grid { grid-template-columns: 1fr; padding: 4px 10px 12px; }

  /* iOS no hace zoom en campos de 16px */
  .form-control, .form-select, textarea { font-size: 16px; }

  .toast-stack { bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 12px); }
  .sticky-action { bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 10px); }

  /* Chat a pantalla completa */
  .page:has(.chat-app) { padding: 0; max-width: none; }
  .chat-app {
    grid-template-columns: 1fr; border-radius: 0;
    height: calc(100dvh - var(--topbar-h) - env(safe-area-inset-top) - var(--tabbar-h) - env(safe-area-inset-bottom)); min-height: 0;
  }
  .chat-app .chat-pane { display: none; }
  .chat-app.has-con .chat-side { display: none; }
  .chat-app.has-con .chat-pane { display: flex; }
  .chat-back { display: inline-grid; }
  body:has(.chat-app.has-con) .tabbar, body:has(.chat-app.has-con) .topbar { display: none; }
  .chat-app.has-con { height: 100dvh; padding-top: env(safe-area-inset-top); }
  .chat-form { padding-bottom: calc(10px + env(safe-area-inset-bottom)); }
  .bubble { max-width: 84%; }
}

/* Teléfono */
@media (max-width: 640px) {
  .res-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .res-body { padding: 10px 12px 12px; }
  .res-body h3 { font-size: .9rem; }
  .res-meta { display: none; }
  .res-actions .btn { min-height: 36px; --bs-btn-padding-x: .6rem; --bs-btn-font-size: .82rem; }
  .res-actions .btn:not(:first-child) { width: 36px; padding: 0; }
  .res-actions .btn:not(:first-child) span { display: none; }
  .res-thumb > .tag { display: none; }
  .aula-grid { grid-template-columns: 1fr; }
  .feature { grid-template-columns: 1fr; }
  .list-item { padding: 12px 14px; }
  .li-side { font-size: .72rem; }
  .page-actions .btn { flex: 1 1 auto; }
  .stat { padding: 12px 14px; }
  .stat-value { font-size: 1.4rem; }
}

/* Móvil: tablas como filas de lista */
@media (max-width: 767.98px) {
  .table-responsive:has(> .table-x) { overflow: visible; }
  .table-x thead { display: none; }
  .table-x, .table-x tbody { display: block; width: 100%; }
  .table-x tbody tr:not(.is-hidden) { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
  .table-x tbody tr:last-child { border-bottom: 0; }
  .table-x td { display: flex; align-items: center; gap: 8px; min-width: 0; padding: 0; border: 0; font-size: .8rem; }
  .table-x td::before { content: none; }
  .table-x td:first-child { flex-basis: 100%; font-size: inherit; }
  .table-x td:first-child .cell-user { gap: 10px; }
  .table-x td:has(.row-actions) { margin-left: auto; }
  .table-x td .tag:has(i) { padding: 3px 8px; }
  .cell-user { min-width: 0 !important; }
  .cell-user > div { min-width: 0; }
  .cell-user small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .row-actions { gap: 2px; }
  .row-actions .icon-btn { width: 36px; height: 36px; }
}

/* Teléfono: modales como hojas inferiores */
@media (max-width: 575.98px) {
  .modal-dialog, .modal-dialog-centered { margin: 0; max-width: none; min-height: 100%; display: flex; align-items: flex-end; }
  .modal-content { border-radius: 24px 24px 0 0; max-height: 94dvh; overflow-y: auto; padding-bottom: env(safe-area-inset-bottom); }
  .modal-content::before { content: ""; flex: 0 0 auto; display: block; width: 38px; height: 5px; margin: 8px auto 0; border-radius: 999px; background: var(--line); }
  .modal.fade .modal-dialog { transform: translateY(100%); transition: transform .32s var(--sheet-ease); }
  .modal.show .modal-dialog { transform: none; }
  .modal-footer { position: sticky; bottom: 0; z-index: 1; background: var(--surface); }
  .modal-footer > .btn { flex: 1 1 0; }
  .section-head .search, .section-head > .btn:not(.btn-sm) { width: 100%; }
}

/* Pantallas táctiles: sin efectos de puntero */
@media (hover: none) {
  .chip:hover { background: var(--surface); }
  .chip[aria-pressed="true"]:hover { background: var(--text); }
  .side-link:hover, a.list-item:hover { background: transparent; }
  .res-mini:hover { background: var(--surface-2); }
  a.stat:hover { background: var(--surface); }
}

/* ---------- Cascada Laboratorios › Biblioteca › Recursos ---------- */
.migas { margin: 2px 0 6px; font-size: .85rem; }
.migas ol { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; margin: 0; padding: 0; list-style: none; }
.migas li { display: inline-flex; align-items: center; min-width: 0; }
.migas li + li::before { content: "\F285"; font-family: "bootstrap-icons"; font-size: .7rem; color: var(--muted); margin: 0 6px; }
.migas a { color: var(--primary); font-weight: 600; text-decoration: none; }
.migas a:hover { text-decoration: underline; }
.migas span { color: var(--muted); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: 10px; }
.cat-tile {
  position: relative; display: flex; align-items: center; gap: 14px; padding: 14px 14px 14px 16px; border-radius: var(--radius);
  background: var(--surface); color: var(--text); text-decoration: none; box-shadow: var(--shadow-sm); overflow: hidden;
  transition: transform .15s var(--sheet-ease), box-shadow .2s;
}
.cat-tile::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--cat); }
.cat-tile:hover { color: var(--text); box-shadow: var(--shadow); transform: translateY(-1px); }
.cat-tile:active { transform: scale(.985); }
.cat-tile-icon {
  flex: none; display: grid; place-items: center; width: 48px; height: 48px; border-radius: 14px; font-size: 1.35rem;
  background: color-mix(in srgb, var(--cat) 14%, transparent); color: var(--cat);
}
.cat-tile .li-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.cat-tile strong { font-size: 1rem; }
.cat-tile small { color: var(--muted); font-size: .8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-tile-tipos { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.cat-tile-tipos .tag { font-size: .7rem; padding: 2px 7px; }
.cat-tile-count { flex: none; min-width: 32px; padding: 3px 9px; border-radius: 999px; background: var(--surface-3); font-size: .8rem; font-weight: 700; text-align: center; }
.cat-tile-go { flex: none; color: var(--muted); }

.cat-hero { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.cat-hero .cat-tile-icon { width: 56px; height: 56px; font-size: 1.6rem; border-radius: 16px; }
.cat-hero h1 { margin: 0; }
.cat-hero p { margin: 2px 0 0; color: var(--muted); }

.lib-entry {
  display: flex; align-items: center; gap: 16px; padding: 18px; border-radius: 22px; background: var(--surface);
  color: var(--text); text-decoration: none; box-shadow: var(--shadow-sm); transition: box-shadow .2s, transform .15s var(--sheet-ease);
}
.lib-entry:hover { color: var(--text); box-shadow: var(--shadow); transform: translateY(-1px); }
.lib-entry:active { transform: scale(.99); }
.lib-entry .lib-icon { flex: none; display: grid; place-items: center; width: 56px; height: 56px; border-radius: 16px; font-size: 1.6rem; background: var(--primary-soft); color: var(--primary); }
.lib-entry .li-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.lib-entry strong { font-size: 1.15rem; }
.lib-entry small { color: var(--muted); }
.lib-cats { display: flex; margin-top: 8px; }
.lib-cats span { display: grid; place-items: center; width: 28px; height: 28px; margin-right: -6px; border-radius: 50%; border: 2px solid var(--surface);
  background: color-mix(in srgb, var(--cat) 18%, var(--surface)); color: var(--cat); font-size: .8rem; }
.lib-cats span.mas { background: var(--surface-3); color: var(--muted); font-weight: 700; font-size: .68rem; }

/* =========================================================
   Transiciones entre pantallas (estilo app nativa)
   - Avanzar: la pantalla nueva entra desde la derecha y la anterior se desplaza un poco detrás
   - Volver: la pantalla actual sale hacia la derecha y deja ver la anterior
   - Cambio de pestaña / envío de formulario: fundido suave con un leve ascenso
   La barra de pestañas y la barra superior quedan fijas mientras cambia el contenido.
   Tipo de navegación: clase nav-adelante | nav-atras | nav-fundido en <html> (ver ui_head).
   ========================================================= */
@view-transition { navigation: auto; }

.tabbar { view-transition-name: tabbar; }
.topbar { view-transition-name: topbar; }

::view-transition-group(root) { animation-duration: .38s; animation-timing-function: var(--sheet-ease); }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .38s; animation-timing-function: cubic-bezier(.2, .8, .2, 1); }
::view-transition-group(tabbar) { z-index: 3; animation-duration: .25s; }
::view-transition-group(topbar) { z-index: 2; animation-duration: .3s; }

html.nav-adelante::view-transition-old(root) { animation-name: vtAtrasPoco; }
html.nav-adelante::view-transition-new(root) { animation-name: vtDesdeDerecha; box-shadow: -12px 0 32px rgba(0, 0, 0, .14); }
html.nav-atras::view-transition-old(root) { z-index: 1; animation-name: vtHaciaDerecha; box-shadow: -12px 0 32px rgba(0, 0, 0, .14); }
html.nav-atras::view-transition-new(root) { animation-name: vtDesdeAtras; }
html.nav-fundido::view-transition-old(root) { animation: vtSalir .18s ease both; }
html.nav-fundido::view-transition-new(root) { animation: vtEntrar .3s .06s cubic-bezier(.2, .8, .2, 1) both; }

@keyframes vtDesdeDerecha { from { transform: translateX(100%); } }
@keyframes vtAtrasPoco { to { transform: translateX(-28%); filter: brightness(.82); } }
@keyframes vtHaciaDerecha { to { transform: translateX(100%); } }
@keyframes vtDesdeAtras { from { transform: translateX(-28%); filter: brightness(.82); } }
@keyframes vtSalir { to { opacity: 0; } }
@keyframes vtEntrar { from { opacity: 0; transform: translateY(14px) scale(.985); } }

/* Con View Transitions, el contenido ya entra animado: se quita el fundido propio de .page */
html.vt .page { animation: none; }

/* Respaldo sin View Transitions: solo animación de entrada del contenido */
html.no-vt.nav-adelante :is(.page, .splash, .auth, main) { animation: vtDesdeDerechaSuave .34s cubic-bezier(.2, .8, .2, 1); }
html.no-vt.nav-atras :is(.page, .splash, .auth, main) { animation: vtDesdeIzquierdaSuave .34s cubic-bezier(.2, .8, .2, 1); }
html.no-vt.nav-fundido :is(.page, .splash, .auth, main) { animation: vtEntrarSuave .3s cubic-bezier(.2, .8, .2, 1); }
@keyframes vtDesdeDerechaSuave { from { opacity: 0; transform: translateX(40px); } }
@keyframes vtDesdeIzquierdaSuave { from { opacity: 0; transform: translateX(-40px); } }
@keyframes vtEntrarSuave { from { opacity: 0; transform: translateY(10px); } }

@media (prefers-reduced-motion: reduce) {
  @view-transition { navigation: none; }
}

/* =========================================================
   Paneles por perfil: aprender (estudiante), enseñar y acompañar (docente), gobernar la plataforma (administrador)
   ========================================================= */
.purpose { display: flex; align-items: center; gap: 8px; margin: -12px 0 18px; color: var(--muted); font-size: .9rem; }
.purpose i { color: var(--primary); }

.hero-estudiante { background: linear-gradient(135deg, #0a66d8, #0f7f8f); }
.hero-docente { background: linear-gradient(135deg, #0f6b78, #1a7a43); }
.hero-admin { background: linear-gradient(135deg, #2c3a4f, #0a4fa8); }
.hero-stats { display: flex; gap: 22px; flex-wrap: wrap; margin-top: 14px; }
.hero-stats div { min-width: 0; }
.hero-stats strong { display: block; font-size: 1.35rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
.hero-stats small { color: rgba(255,255,255,.85); font-size: .78rem; font-weight: 500; }

/* Dos columnas en escritorio, una en móvil */
.dash-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.dash-grid > * { min-width: 0; }
.dash-col { display: flex; flex-direction: column; gap: 14px; min-width: 0; }

/* Medidor de avance (barra + número siempre visible; el tono acompaña, no reemplaza al texto) */
.meter { display: inline-flex; align-items: center; gap: 8px; min-width: 110px; width: 100%; }
.meter-track { flex: 1; height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.meter-track > span { display: block; height: 100%; border-radius: 999px; background: var(--primary); transition: width .6s var(--sheet-ease); }
.meter.is-good .meter-track > span { background: var(--success); }
.meter.is-low .meter-track > span { background: var(--warning); }
.meter b { min-width: 38px; text-align: right; font-size: .8rem; font-weight: 650; font-variant-numeric: tabular-nums; color: var(--text); }

/* Siguiente paso del estudiante */
.next-card { display: grid; grid-template-columns: 160px minmax(0, 1fr); overflow: hidden; border-radius: var(--radius); background: var(--surface); }
.next-media { position: relative; background: var(--surface-2); min-height: 160px; }
.next-media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; padding: 10px; }
.next-body { padding: 16px 18px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.next-body h3 { margin: 0; font-size: 1.1rem; }
.next-body .kicker { font-size: .74rem; font-weight: 700; color: var(--primary); text-transform: uppercase; letter-spacing: .05em; }
.next-body .instrucciones { margin: 0; }
.next-body .res-meta { margin: 0; }
.next-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: auto; padding-top: 4px; }

/* Lista de filas (aulas, estudiantes, recursos) */
.rows { display: flex; flex-direction: column; }
.row-item { display: flex; align-items: center; gap: 12px; padding: 11px 18px; color: var(--text); min-width: 0; }
.row-item + .row-item { border-top: 1px solid var(--line); }
a.row-item:hover { background: var(--surface-2); color: var(--text); }
.row-item .li-main { flex: 1; min-width: 0; }
.row-item .li-main strong { display: block; font-size: .92rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-item .li-main small { display: block; color: var(--muted); font-size: .78rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-item .meter { width: 150px; flex: 0 0 auto; }
.row-item .row-end { flex: 0 0 auto; display: flex; align-items: center; gap: 6px; }
.row-dot { width: 34px; height: 34px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 10px; color: #fff; background: var(--c, var(--primary)); }
.row-thumb { width: 40px; height: 40px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 10px; background: var(--surface-2); color: var(--cat, var(--muted)); overflow: hidden; }
.row-thumb img { width: 100%; height: 100%; object-fit: contain; padding: 3px; }
.row-item.is-hidden { display: none; }
.toolbar-end { display: flex; gap: 8px; flex-wrap: wrap; }
@media (min-width: 768px) { .toolbar-end { flex-shrink: 0; flex-wrap: nowrap; } .toolbar-end .search { min-width: 0; width: 220px; } }
.table-x .meter { min-width: 90px; }
.table-x.compact th, .table-x.compact td { padding-inline: 10px; }
.table-x.compact .cell-user { min-width: 170px; gap: 10px; }
.row-empty { padding: 22px 18px; text-align: center; color: var(--muted); font-size: .88rem; }

/* Actividad reciente */
.feed { list-style: none; margin: 0; padding: 4px 18px 14px; }
.feed li { display: flex; gap: 12px; padding: 9px 0; font-size: .88rem; }
.feed li + li { border-top: 1px dashed var(--line); }
.feed .feed-icon { width: 30px; height: 30px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 50%; font-size: .9rem; }
.feed .li-main { min-width: 0; flex: 1; }
.feed .li-main span { display: block; line-height: 1.35; overflow-wrap: anywhere; }
.feed .li-main small { color: var(--muted); font-size: .76rem; }

/* Alertas accionables (estado con ícono + texto, nunca solo color) */
.alerts { display: flex; flex-direction: column; }
.alert-row { display: flex; align-items: center; gap: 12px; padding: 12px 18px; color: var(--text); }
.alert-row + .alert-row { border-top: 1px solid var(--line); }
a.alert-row:hover { background: var(--surface-2); color: var(--text); }
.alert-row .li-main { flex: 1; min-width: 0; }
.alert-row .li-main strong { display: block; font-size: .9rem; font-weight: 600; }
.alert-row .li-main small { color: var(--muted); font-size: .8rem; }
.alert-ok { display: flex; align-items: center; gap: 10px; padding: 16px 18px; color: var(--success); font-weight: 600; font-size: .9rem; }

/* Gráfico de columnas por día (una sola serie: el título la nombra, sin leyenda) */
.chart-total { display: flex; align-items: baseline; gap: 8px; padding: 0 18px; }
.chart-total strong { font-size: 1.6rem; font-variant-numeric: tabular-nums; }
.chart-total small { color: var(--muted); font-size: .82rem; }
.chart-cols { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 2px; align-items: end; height: 150px; padding: 26px 18px 0; }
.chart-col { position: relative; display: flex; flex-direction: column; justify-content: flex-end; height: 100%; outline-offset: -2px; }
.chart-col > span { display: block; min-height: 2px; margin: 0 2px; border-radius: 4px 4px 0 0; background: var(--primary); transition: opacity .15s; }
.chart-col.is-zero > span { background: var(--surface-3); }
.chart-col:hover > span, .chart-col:focus-visible > span { opacity: .72; }
.chart-tip { position: absolute; bottom: calc(100% + 4px); left: 50%; transform: translateX(-50%); z-index: 3; padding: 5px 8px; border-radius: 8px;
  background: var(--text); color: var(--bg); font-size: .74rem; font-weight: 600; white-space: nowrap; pointer-events: none; opacity: 0; transition: opacity .12s; }
.chart-col:first-child .chart-tip { left: 0; transform: none; }
.chart-col:last-child .chart-tip { left: auto; right: 0; transform: none; }
.chart-col:hover .chart-tip, .chart-col:focus-visible .chart-tip { opacity: 1; }
.chart-axis { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 2px; padding: 6px 18px 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: .68rem; text-align: center; }
.chart-axis span { overflow: hidden; white-space: nowrap; }

/* Barras horizontales (uso por categoría) */
.hbars { display: flex; flex-direction: column; gap: 10px; padding: 8px 18px 18px; }
.hbar { display: grid; grid-template-columns: minmax(0, 150px) minmax(0, 1fr) 42px; align-items: center; gap: 10px; font-size: .85rem; }
.hbar-label { display: flex; align-items: center; gap: 6px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.hbar-label i { color: var(--cat, var(--muted)); }
.hbar-track { height: 10px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.hbar-track > span { display: block; height: 100%; border-radius: 0 4px 4px 0; background: var(--primary); }
.hbar b { text-align: right; font-variant-numeric: tabular-nums; font-weight: 650; }

/* Accesos a los laboratorios */
.lab-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; }
.lab-tile { display: flex; align-items: center; gap: 14px; padding: 16px; border-radius: var(--radius); background: var(--surface); color: var(--text); }
a.lab-tile:hover { color: var(--text); background: var(--surface-2); }
.lab-tile .lab-icon { width: 48px; height: 48px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 14px; font-size: 1.4rem; color: #fff; background: var(--c); }
.lab-tile .li-main { flex: 1; min-width: 0; }
.lab-tile .li-main strong { display: block; font-weight: 650; }
.lab-tile .li-main small { display: block; color: var(--muted); font-size: .8rem; }

/* Accesos rápidos */
.quick-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; }
.quick { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 14px; border: 0; border-radius: var(--radius); background: var(--surface); color: var(--text); text-align: left; font-weight: 600; font-size: .9rem; }
.quick:hover { background: var(--surface-2); color: var(--text); }
.quick small { color: var(--muted); font-weight: 500; font-size: .76rem; }

.badge-score { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font-size: .72rem; font-weight: 650; background: var(--surface-3); color: var(--text); white-space: nowrap; }
.badge-score i { color: var(--warning); }

@media (max-width: 991.98px) {
  .dash-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .next-card { grid-template-columns: minmax(0, 1fr); }
  .next-media { min-height: 130px; }
  .quick-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .row-item { padding: 11px 14px; }
  .row-item .meter { width: 96px; min-width: 96px; }
  .hbar { grid-template-columns: minmax(0, 104px) minmax(0, 1fr) 36px; }
  .hero-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; }
  .chart-cols, .chart-axis { padding-inline: 12px; }
}

/* Panel del administrador: indicadores con tendencia y cifras compactas */
.kpi-grid .stat { align-items: flex-start; }
.kpi-grid .stat-label { line-height: 1.35; }
.trend { display: inline-flex; align-items: center; gap: 3px; margin-top: 2px; font-size: .74rem; font-weight: 600; color: var(--muted); }
.trend.up { color: var(--success); }
.trend.down { color: var(--danger); }
.mini-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; padding: 8px 18px 14px; }
.mini-stats div { min-width: 0; padding: 10px; border-radius: 12px; background: var(--surface-2); }
.mini-stats strong { display: block; font-size: 1.15rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
.mini-stats small { display: block; color: var(--muted); font-size: .72rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
a.hbar:hover .hbar-label { text-decoration: underline; }
@media (max-width: 575.98px) { .mini-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 575.98px) { .row-item .meter { width: 92px; min-width: 0; } }

/* Importación masiva de usuarios */
.imp-pasos { display: flex; gap: 6px; list-style: none; padding: 0; margin: 0 0 16px; counter-reset: paso; }
.imp-pasos li { flex: 1; display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 10px; background: var(--surface-2); color: var(--muted); font-size: .82rem; font-weight: 600; counter-increment: paso; }
.imp-pasos li::before { content: counter(paso); width: 22px; height: 22px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 50%; background: var(--surface-3); font-size: .75rem; }
.imp-pasos li.actual { background: var(--primary-soft); color: var(--primary); }
.imp-pasos li.actual::before { background: var(--primary); color: #fff; }
.imp-pasos li.hecho::before { content: "✓"; background: var(--success); color: #fff; }
.imp-zona { display: flex; align-items: center; gap: 14px; padding: 22px; border: 2px dashed var(--line); border-radius: var(--radius); cursor: pointer; transition: border-color .15s, background .15s; }
.imp-zona > i { font-size: 2rem; color: var(--primary); }
.imp-zona strong { display: block; }
.imp-zona small { color: var(--muted); }
.imp-zona:hover, .imp-zona.arrastrando { border-color: var(--primary); background: var(--primary-soft); }
.imp-zona.con-archivo { border-style: solid; border-color: var(--success); }
.imp-tabla { max-height: 340px; overflow: auto; border: 1px solid var(--line); border-radius: 12px; }
.imp-tabla thead th { position: sticky; top: 0; background: var(--surface); z-index: 1; }
.imp-tabla tr.imp-error td { background: var(--danger-soft); }

/* Vista previa del correo institucional al registrar un usuario */
.correo-preview { display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; border-radius: 12px; background: var(--primary-soft); }
.correo-preview > i { font-size: 1.2rem; color: var(--primary); margin-top: 2px; }
.correo-preview div { min-width: 0; }
.correo-preview small { display: block; color: var(--muted); font-size: .76rem; line-height: 1.35; }
.correo-preview strong { display: block; margin: 2px 0 4px; font-size: 1.05rem; color: var(--primary); overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }

/* Opciones de una sola elección con aspecto de chip (sexo al registrar un usuario) */
.chip-radio { background: var(--surface-2); }
/* Más específica que «.modal .chip:not([aria-pressed])», que pinta de gris los chips dentro de los modales */
.chip.chip-radio:has(input:checked), .modal .chip.chip-radio:has(input:checked) { background: var(--text); color: var(--bg); }
.chip-radio:has(input:focus-visible) { outline: 2px solid var(--primary); outline-offset: 2px; }

/* Laboratorios del aula (docente): qué ven los estudiantes y cuánto lo usan */
.lab-aviso { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; margin-bottom: 14px; border-radius: var(--radius); background: var(--primary-soft); }
.lab-aviso > i { font-size: 1.25rem; color: var(--primary); }
.lab-aviso strong { display: block; }
.lab-aviso small { display: block; color: var(--muted); margin-top: 2px; }
.lab-aviso.vacio { background: var(--warning-soft); }
.lab-aviso.vacio > i { color: var(--warning); }
.lab-card-aula { margin-bottom: 14px; border-top: 4px solid var(--cat); }
.lab-card-aula h2 i { color: var(--cat); }
.lab-grupo { border: 1px solid var(--line); border-radius: 14px; margin-top: 8px; }
.lab-grupo > summary { display: flex; align-items: center; gap: 10px; padding: 10px 12px; cursor: pointer; list-style: none; }
.lab-grupo > summary::-webkit-details-marker { display: none; }
.lab-grupo > summary .stat-icon { background: color-mix(in srgb, var(--cat) 14%, transparent); color: var(--cat); }
.lab-grupo > summary .li-main strong { display: block; font-size: .92rem; }
.lab-grupo > summary .li-main small { color: var(--muted); font-size: .78rem; }
.lab-grupo > summary::after { content: "\F282"; font-family: "bootstrap-icons"; margin-left: auto; color: var(--muted); transition: transform .2s; }
.lab-grupo[open] > summary::after { transform: rotate(180deg); }
.lab-grupo .lab-items { padding: 0 12px 10px; }
.lab-items { display: flex; flex-direction: column; }
.lab-item { display: flex; align-items: center; gap: 10px; padding: 8px 4px; border-top: 1px dashed var(--line); cursor: pointer; font-size: .9rem; }
.lab-items > .lab-item:first-child { border-top: 0; }
.lab-item input { width: 18px; height: 18px; flex: 0 0 auto; accent-color: var(--primary); }
.lab-item .li-main { flex: 1; min-width: 0; }
.lab-item:has(input:disabled) { opacity: .5; cursor: not-allowed; }
.lab-todo { font-weight: 600; color: var(--primary); }
.lab-guardar { position: sticky; bottom: 12px; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 12px 16px; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-lg); }
@media (max-width: 991.98px) { .lab-guardar { bottom: calc(76px + env(safe-area-inset-bottom)); } }

/* Revisión de recursos de docentes */
.flujo-recurso { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; list-style: none; padding: 0; margin: 0 0 18px; }
.flujo-recurso li { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border-radius: var(--radius); background: var(--surface); }
.flujo-recurso strong { display: block; font-size: .9rem; }
.flujo-recurso small { display: block; color: var(--muted); font-size: .78rem; line-height: 1.35; }
.revision-nota { display: flex; gap: 8px; align-items: flex-start; margin: 6px 0 8px; padding: 8px 10px; border-radius: 10px; background: var(--danger-soft); font-size: .8rem; line-height: 1.4; }
.revision-nota > i { color: var(--danger); margin-top: 2px; }
.revision-nota small { color: var(--muted); }
.revision-nota.pendiente { background: var(--warning-soft); }
.revision-nota.pendiente > i { color: var(--warning); }
.decision { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 12px; cursor: pointer; }
.decision input { margin-top: 4px; accent-color: var(--primary); }
.decision strong { display: block; font-size: .9rem; }
.decision small { display: block; color: var(--muted); font-size: .78rem; line-height: 1.35; }
.decision:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }

/* Avance por aula (docente): lo más explorado de cada aula */
.row-aula .li-main small { white-space: normal; }
.row-aula .aula-top { margin-top: 2px; color: var(--primary); }

/* Inicio del estudiante: secciones numeradas en el orden de trabajo y laboratorios aún sin contenido */
.paso-num { display: inline-grid; place-items: center; width: 26px; height: 26px; margin-right: 6px; border-radius: 50%; background: var(--primary); color: #fff; font-size: .8rem; font-weight: 700; vertical-align: 2px; }
.lab-tile-off { opacity: .6; }
.lab-tile-off .lab-icon { filter: grayscale(.7); }

/* Aula del estudiante: un bloque por laboratorio con vista previa de lo habilitado */
.lab-bloque { margin-bottom: 18px; padding: 14px; border-radius: var(--radius); background: color-mix(in srgb, var(--cat) 6%, var(--surface)); border-top: 4px solid var(--cat); }
.lab-bloque-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.lab-bloque-head .lab-icon { width: 44px; height: 44px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 12px; font-size: 1.3rem; color: #fff; background: var(--c); }
.lab-bloque-head .li-main { flex: 1; min-width: 160px; }
.lab-bloque-head h3 { margin: 0; font-size: 1.05rem; }
.lab-bloque-head small { color: var(--muted); }
.lab-preview { position: absolute; inset: 0; display: grid; place-items: center; font-size: 3.4rem; color: var(--cat);
  background: radial-gradient(circle at 50% 45%, color-mix(in srgb, var(--cat) 20%, transparent), color-mix(in srgb, var(--cat) 6%, transparent) 70%); }
.lab-preview.formula { font-size: 2.6rem; font-weight: 750; letter-spacing: .02em; font-variant-numeric: normal; }
.lab-card .lab-card-tag { background: var(--surface); color: var(--cat); }
.lab-card .res-body h3 { margin-bottom: 4px; }
/* En las tarjetas de laboratorio la descripción sí se muestra (dos líneas) */
.lab-card .res-body > p { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin: 0; color: var(--muted); font-size: .8rem; line-height: 1.35; }
.lab-card .lab-card-tema { color: var(--cat); font-size: .74rem; font-weight: 650; text-transform: uppercase; letter-spacing: .03em; }
.lab-card .lab-card-tag { max-width: calc(100% - 110px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lab-preview img { width: 100%; height: 100%; object-fit: contain; padding: 38px 14px 10px; }
/* Las miniaturas de los modelos son cuadradas: se muestran completas, por debajo de las etiquetas de la tarjeta */
.res-thumb img.thumb-img { object-fit: contain; padding: 38px 14px 10px; }
@media (max-width: 640px) {
  .res-thumb img.thumb-img, .lab-preview img { padding: 26px 8px 6px; }
}
.lab-reto { display: flex; align-items: flex-start; gap: 6px; font-size: .78rem; font-weight: 650; line-height: 1.3; color: var(--cat); }
/* Aula del estudiante: lo explorado y los retos de cada laboratorio, por separado */
.lab-indicadores { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 8px; margin: 0 0 12px; }
.lab-indic { display: flex; flex-direction: column; gap: 4px; padding: 10px 12px; border-radius: 12px; background: var(--surface); }
.lab-indic > span { color: var(--muted); font-size: .76rem; font-weight: 650; }
.lab-indic > span i { color: var(--cat); }
.lab-indic > strong { font-size: .92rem; }
.flag-pend { background: var(--surface); color: var(--muted); }
.lab-reto.ok { color: var(--success); }

/* ---------- Ranking del aula (estudiante/ranking.php) ---------- */
.rank-controles { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin: 16px 0; }
.rank-controles .segmented { flex: 0 1 320px; }
.podio { --oro: #d4a017; --plata: #98a3b3; --bronce: #b87333;
  display: flex; align-items: flex-end; justify-content: center; gap: 10px; margin: 8px 0 18px; padding: 40px 12px 0;
  border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.podio-col { --m: var(--bronce); position: relative; flex: 0 1 180px; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; }
.podio-oro { --m: var(--oro); }
.podio-plata { --m: var(--plata); }
.podio-avatar { box-shadow: 0 0 0 4px var(--surface), 0 0 0 7px var(--m); background: var(--m) !important; }
.podio-oro .podio-avatar { width: 64px; height: 64px; font-size: 1.3rem; }
.podio-corona { position: absolute; top: -32px; color: var(--oro); font-size: 1.25rem; }
.podio-nombre { max-width: 100%; margin-top: 6px; font-size: .92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.podio-puntos { color: var(--muted); font-size: .8rem; font-weight: 650; font-variant-numeric: tabular-nums; }
.podio-base { width: 100%; margin-top: 6px; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; padding-top: 10px;
  border-radius: 12px 12px 0 0; color: #fff; background: linear-gradient(180deg, var(--m), color-mix(in srgb, var(--m) 70%, #000)); }
.podio-oro .podio-base { height: 120px; }
.podio-plata .podio-base { height: 88px; }
.podio-bronce .podio-base { height: 64px; }
.podio-num { font-size: 1.9rem; font-weight: 800; line-height: 1; }
.podio-base small { font-size: .72rem; opacity: .9; }
.podio-col.es-yo .podio-nombre { color: var(--primary); }
.rank-list { list-style: none; margin: 8px 0 0; padding: 0 0 8px; }
.rank-row { display: flex; align-items: center; gap: 12px; padding: 10px 18px; min-width: 0; }
.rank-row + .rank-row { border-top: 1px solid var(--line); }
.rank-row.es-yo { background: var(--primary-soft); }
.rank-row .li-main { flex: 1; min-width: 0; }
.rank-row .li-main strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-row .li-main small { display: flex; flex-wrap: wrap; gap: 4px 10px; color: var(--muted); font-size: .76rem; }
.rank-pos { width: 30px; flex: 0 0 auto; display: grid; place-items: center; height: 30px; border-radius: 50%; font-weight: 750; font-variant-numeric: tabular-nums; color: var(--muted); }
.rank-pos.top-1 { background: #d4a017; color: #fff; }
.rank-pos.top-2 { background: #98a3b3; color: #fff; }
.rank-pos.top-3 { background: #b87333; color: #fff; }
.rank-tu { margin-left: 4px; padding: 1px 7px; font-size: .68rem; background: var(--primary); color: #fff; vertical-align: middle; }
.rank-insignia { color: var(--warning); }
.rank-puntos { flex: 0 0 auto; font-size: 1.05rem; font-weight: 750; font-variant-numeric: tabular-nums; text-align: right; }
.rank-puntos small { margin-left: 3px; color: var(--muted); font-size: .72rem; font-weight: 600; }
.rank-valor { flex: 0 0 auto; font-weight: 750; color: var(--success); font-variant-numeric: tabular-nums; }
.rank-insignia-dot { background: var(--warning) !important; }
.rank-grid .row-item small { white-space: normal; overflow: visible; }
.rank-bloqueada { opacity: .55; }
.rank-bloqueada .rank-insignia-dot { background: var(--surface-3) !important; color: var(--muted); }
@media (max-width: 900px) { .rank-grid { grid-template-columns: 1fr; } }
@media (max-width: 640px) {
  .rank-controles .segmented { flex: 1 1 100%; max-width: none; }
  .podio { gap: 6px; padding-inline: 8px; }
  .podio-avatar { width: 44px; height: 44px; font-size: .9rem; }
  .podio-oro .podio-avatar { width: 54px; height: 54px; font-size: 1.1rem; }
  .podio-nombre { font-size: .8rem; }
  .rank-row { padding: 10px 14px; gap: 10px; }
}
/* Interruptor del ranking en el aula del docente */
.rank-docente-head { display: flex; align-items: center; gap: 12px; padding: 14px 18px; }
.rank-docente-head .li-main { flex: 1; min-width: 0; }
.rank-docente-head .form-switch .form-check-input { width: 2.6em; height: 1.4em; cursor: pointer; }
.rank-docente-podio { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 0 18px 14px; }
.rank-docente-podio .tag { gap: 6px; }
.rank-docente-podio .rank-pos { width: 20px; height: 20px; font-size: .7rem; }
/* Tarjeta de aula del docente: avance real de la clase */
.aula-stats { flex-wrap: wrap; gap: 4px 14px; }
.aula-avance { display: flex; flex-direction: column; gap: 3px; margin-top: 4px; }
.aula-avance small { color: var(--muted); font-size: .74rem; font-weight: 600; }
.aula-avance .aula-activos { margin-top: 3px; font-weight: 500; }
/* Rankings de las aulas (administrador) */
.rank-aulas { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.rank-aula { display: flex; flex-direction: column; color: var(--text); border-top: 4px solid var(--aula); transition: transform .1s; }
.rank-aula:hover { color: var(--text); }
.rank-aula:active { transform: scale(.99); }
.rank-aula.is-hidden { display: none; }
.rank-aula-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px 10px; }
.rank-aula-head .li-main { flex: 1; min-width: 0; }
.rank-aula-head .li-main strong, .rank-aula-head .li-main small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-aula-head small { color: var(--muted); font-size: .78rem; }
.rank-mini { list-style: none; margin: 0; padding: 0 16px 14px; display: flex; flex-direction: column; gap: 6px; }
.rank-mini li { display: flex; align-items: center; gap: 8px; font-size: .86rem; min-width: 0; }
.rank-mini .rank-pos { width: 24px; height: 24px; font-size: .74rem; }
.rank-mini .li-main { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-mini b { font-variant-numeric: tabular-nums; }
/* Seguimiento que hace el docente (administrador/docente.php) */
.gestion-indice { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.gestion-indice strong { font-size: 1.5rem; font-variant-numeric: tabular-nums; }
.gestion-extra { display: flex; flex-wrap: wrap; gap: 6px; padding: 4px 18px 16px; }
.tag-link { color: var(--primary); background: var(--primary-soft); }
.tag-link:hover { color: var(--primary); text-decoration: underline; }
.gestion-card .row-item small { white-space: normal; overflow: visible; }
@media (max-width: 640px) { .gestion-card .card-x-head { flex-wrap: wrap; } }

/* ---------- Instalar la app (PWA) ---------- */
[data-install-app][hidden] { display: none !important; }
.install-sheet {
  position: fixed; inset: 0; z-index: 2000; display: flex; align-items: flex-end; justify-content: center;
  padding: 16px; padding-bottom: max(16px, env(safe-area-inset-bottom));
  background: rgba(0, 0, 0, 0); transition: background .25s ease;
}
.install-sheet.open { background: rgba(0, 0, 0, .45); }
.install-card {
  width: 100%; max-width: 420px; background: var(--surface); color: var(--text); border-radius: 24px;
  padding: 28px 22px 22px; text-align: center; box-shadow: var(--shadow-lg);
  transform: translateY(24px); opacity: 0; transition: transform .25s var(--sheet-ease), opacity .25s ease;
}
.install-sheet.open .install-card { transform: none; opacity: 1; }
.install-card img { border-radius: 16px; }
.install-card h2 { font-size: 1.2rem; font-weight: 700; margin: 14px 0 16px; }
.install-card ol { list-style: none; padding: 0; margin: 0 0 18px; text-align: left; display: grid; gap: 10px; }
.install-card li { display: flex; align-items: center; gap: 12px; background: var(--surface-2); border-radius: var(--radius-sm); padding: 12px 14px; font-size: .9375rem; line-height: 1.4; }
.install-card li i { font-size: 1.25rem; color: var(--primary); flex: none; }
.install-note { font-size: .85rem; color: var(--muted); margin: -6px 0 16px; }
@media (min-width: 768px) { .install-sheet { align-items: center; } }
@media (prefers-reduced-motion: reduce) { .install-sheet, .install-card { transition: none; } }
