/* Calasanz · Licencias VET4YE — estilos del panel.
   Colores y letra de calasanz.eus: morado #302e60, blanco, grises claros y texto #333.
   Esquinas rectas (sin border-radius). Espacios de la escala 4 · 8 · 12 · 16 · 24 · 32 px.
   Iconos: Font Awesome Free (fontawesome/). Sin estilos dentro de las páginas (CSP). */

@font-face { font-family: "DM Sans"; font-style: normal; font-weight: 400; font-display: swap;
  src: url(fonts/dm-sans-400.woff2) format("woff2"); }
@font-face { font-family: "DM Sans"; font-style: normal; font-weight: 500; font-display: swap;
  src: url(fonts/dm-sans-500.woff2) format("woff2"); }
@font-face { font-family: "DM Sans"; font-style: normal; font-weight: 700; font-display: swap;
  src: url(fonts/dm-sans-700.woff2) format("woff2"); }

:root {
  /* Calasanz */
  --brand: #302e60;
  --brand-hover: #24224a;
  --brand-light: #45428a;
  --brand-soft: #edecf4;
  --brand-tint: #f7f7fb;
  --accent: #076cb4;

  /* Superficies y texto */
  --bg: #f4f4f4;
  --surface: #ffffff;
  --surface-2: #f6f6f6;
  --border: #e2e2e8;
  --border-strong: #c9c9d3;
  --title: #302e60;
  --text: #333333;
  --text-2: #4d4d57;
  --text-3: #6b6b76;

  /* Estados */
  --ok: #17714a;   --ok-soft: #eaf6ef;   --ok-line: #b5dcc6;
  --bad: #b3261e;  --bad-soft: #fcefee;  --bad-line: #efc2bf;
  --warn: #9a5b00; --warn-soft: #fff6e5; --warn-line: #f1d4a0;
  --info: #076cb4; --info-soft: #eaf3fa; --info-line: #b8d6ec;

  --control: 40px;
  --pad-x: 24px;
  --gap: 24px;
  --sidebar-width: 256px;
  --shadow: 0 1px 2px rgba(48, 46, 96, 0.06);
  --font: "DM Sans", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  --mono: Consolas, "SFMono-Regular", Menlo, "Courier New", monospace;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; border-radius: 0; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 14px; line-height: 1.5; color: var(--text);
  background: var(--bg); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { margin: 0; color: var(--title); line-height: 1.25; font-weight: 700; }
h1 { font-size: 24px; letter-spacing: -0.01em; }
h2 { font-size: 16px; }
p { margin: 0; }
a { color: var(--accent); }
strong { font-weight: 700; }
img { display: block; max-width: 100%; height: auto; }
.muted { color: var(--text-3); }
.small { font-size: 12px; }
.mono { font-family: var(--mono); font-size: 13px; letter-spacing: 0.02em; }
.break { word-break: break-all; }
.copy-helper { position: fixed; left: -9999px; top: 0; opacity: 0; }

/* Iconos: ancho fijo, así quedan alineados en columna. */
.icon { display: inline-block; width: 1.25em; text-align: center; flex: none; line-height: 1; }
.i12 { font-size: 12px; } .i14 { font-size: 14px; } .i16 { font-size: 16px; } .i18 { font-size: 18px; }
.i20 { font-size: 20px; } .i24 { font-size: 24px; } .i32 { font-size: 32px; } .i40 { font-size: 40px; }

/* ---------- Estructura: barra lateral morada + página ---------- */
body.app { display: grid; grid-template-columns: var(--sidebar-width) minmax(0, 1fr); min-height: 100vh; }

.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
  padding: 24px 16px; background: var(--brand); color: #fff; }
.brand { display: flex; align-items: center; gap: 12px; padding: 0 12px 24px; margin-bottom: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14); color: #fff; text-decoration: none; }
.brand-logo { display: grid; place-items: center; width: 44px; height: 44px; padding: 4px; flex: none;
  background: #fff; }
.brand-logo .logo { width: auto; height: 36px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-text strong { font-size: 16px; letter-spacing: 0.02em; }
.brand-text small { font-size: 12px; color: rgba(255, 255, 255, 0.72); }

.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item { display: flex; align-items: center; justify-content: flex-start; gap: 12px; width: 100%; height: 40px; padding: 0 12px;
  border: 0; font: inherit; font-weight: 500; text-align: left; text-decoration: none; cursor: pointer;
  color: rgba(255, 255, 255, 0.86); background: transparent; transition: background-color 0.15s, color 0.15s; }
.nav-item:hover { color: #fff; background: rgba(255, 255, 255, 0.10); }
.nav-item.active, .nav-item.active:hover { color: var(--brand); background: #fff; font-weight: 700; }

.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.14); }
.user { display: flex; align-items: center; gap: 12px; padding: 4px 12px; }
.avatar { display: grid; place-items: center; width: 32px; height: 32px; flex: none;
  background: #fff; color: var(--brand); font-weight: 700; }
.user-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.user-text strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-text small { color: rgba(255, 255, 255, 0.72); font-size: 12px; }

.main { min-width: 0; width: 100%; max-width: 1320px; margin: 0 auto; padding: 32px; }
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 16px; margin-bottom: var(--gap); }
.page-title { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.page-title p { color: var(--text-3); }
.page-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- Tarjetas ---------- */
.card { background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow);
  margin-bottom: var(--gap); }
.card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 64px; padding: 12px var(--pad-x); border-bottom: 1px solid var(--border); }
.card-head h2 { display: flex; align-items: center; gap: 8px; }
.card-head h2 .icon { color: var(--brand-light); }
.card-head p { color: var(--text-3); margin-top: 2px; }
.card-body { padding: var(--pad-x); }
.card-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px var(--pad-x); border-top: 1px solid var(--border); background: var(--surface-2); }
.card-narrow { max-width: 680px; }
.card-danger { border-color: var(--bad-line); }
.card-danger .card-head { background: var(--bad-soft); border-bottom-color: var(--bad-line); }
.card-danger .card-head h2, .card-danger .card-head h2 .icon { color: var(--bad); }

.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: var(--gap); align-items: start; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

/* ---------- Indicadores: las 4 tarjetas iguales y del mismo color ---------- */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--gap); margin-bottom: var(--gap); }
.stat { display: flex; align-items: center; gap: 16px; padding: var(--pad-x); background: var(--surface);
  border: 1px solid var(--border); box-shadow: var(--shadow); }
.stat-icon { display: grid; place-items: center; width: 48px; height: 48px; flex: none;
  background: var(--brand-soft); color: var(--brand); }
.stat-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.stat-label { color: var(--text-3); font-weight: 500; }
.stat-value { color: var(--title); font-size: 28px; font-weight: 700; line-height: 1.1; }
.stat-foot { color: var(--text-3); font-size: 12px; }
.stat-revoked .stat-value { color: var(--bad); }

.usage { display: flex; flex-direction: column; gap: 12px; padding: 20px var(--pad-x); margin-bottom: var(--gap);
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); }
.usage-labels { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; }
.usage-labels span { color: var(--text-3); }
.usage-labels strong { color: var(--title); }
progress.usage-bar { -webkit-appearance: none; appearance: none; display: block; width: 100%; height: 8px;
  border: 0; background: var(--brand-soft); }
progress.usage-bar::-webkit-progress-bar { background: var(--brand-soft); }
progress.usage-bar::-webkit-progress-value { background: var(--brand); }
progress.usage-bar::-moz-progress-bar { background: var(--brand); }

/* ---------- Botones ---------- */
button, .button { display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: var(--control); padding: 0 16px; border: 1px solid var(--brand);
  font: inherit; font-weight: 700; line-height: 1; white-space: nowrap; cursor: pointer; text-decoration: none;
  color: #fff; background: var(--brand); transition: background-color 0.15s, border-color 0.15s, color 0.15s; }
button:hover, .button:hover { background: var(--brand-hover); border-color: var(--brand-hover); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button:disabled { opacity: 0.55; cursor: not-allowed; }

.secondary { color: var(--brand); background: var(--surface); border-color: var(--border-strong); }
.secondary:hover { color: var(--brand); background: var(--brand-tint); border-color: var(--brand); }
.danger { color: #fff; background: var(--bad); border-color: var(--bad); }
.danger:hover { background: #8f1d17; border-color: #8f1d17; }
.danger-outline { color: var(--bad); background: var(--surface); border-color: var(--bad-line); }
.danger-outline:hover { color: var(--bad); background: var(--bad-soft); border-color: var(--bad); }
.ghost { color: var(--text-2); background: transparent; border-color: transparent; }
.ghost:hover { color: var(--brand); background: var(--brand-soft); border-color: transparent; }
.sm { height: 32px; padding: 0 12px; font-size: 13px; gap: 6px; }
.block { width: 100%; }
.icon-only { width: 32px; height: 32px; padding: 0; }
.copied, .copied:hover { color: var(--ok); background: var(--ok-soft); border-color: var(--ok-line); }

/* ---------- Formularios ---------- */
form { margin: 0; }
.field { display: flex; flex-direction: column; gap: 8px; margin-bottom: var(--gap); }
.field:last-child { margin-bottom: 0; }
.field-label { font-weight: 700; color: var(--text); }
.field-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 32px; }
.field-hint { font-size: 12px; color: var(--text-3); }

input:not([type]), input[type="text"], input[type="password"], input[type="number"], input[type="search"],
select, textarea {
  display: block; width: 100%; height: var(--control); padding: 0 12px; margin: 0;
  font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--border-strong); transition: border-color 0.15s, box-shadow 0.15s; }
textarea { height: auto; padding: 12px; resize: vertical; line-height: 1.6; }
input::placeholder, textarea::placeholder { color: #9a9aa5; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(48, 46, 96, 0.18); }
input[readonly], textarea[readonly] { background: var(--surface-2); color: var(--text-2); }
select { -webkit-appearance: none; appearance: none; padding-right: 40px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23302e60' stroke-width='3' stroke-linecap='square'%3E%3Cpath d='M5 9l7 7 7-7'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; }
textarea.code, input.mono { font-family: var(--mono); font-size: 13px; letter-spacing: 0.02em; }

.input-wrap { position: relative; display: block; }
.input-wrap > .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--text-3); pointer-events: none; }
.input-wrap > input { padding-left: 40px; }
.input-wrap > .toggle { position: absolute; right: 4px; top: 4px; }
.input-wrap.has-toggle > input { padding-right: 44px; }

/* Casillas cuadradas: 18 px, morado al marcar, foco visible. */
input[type="checkbox"] { -webkit-appearance: none; appearance: none; flex: none; display: inline-block;
  width: 18px; height: 18px; margin: 0; vertical-align: middle; cursor: pointer;
  background: var(--surface) no-repeat center / 12px; border: 1.5px solid var(--border-strong);
  transition: background-color 0.15s, border-color 0.15s; }
input[type="checkbox"]:hover { border-color: var(--brand); }
input[type="checkbox"]:checked { background-color: var(--brand); border-color: var(--brand);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='4' stroke-linecap='square'%3E%3Cpath d='M4 12.5l5 5L20 6.5'/%3E%3C/svg%3E"); }
.check { display: inline-flex; align-items: center; gap: 12px; min-height: var(--control);
  color: var(--text); cursor: pointer; user-select: none; }

/* ---------- Avisos ---------- */
.alert { display: flex; align-items: flex-start; gap: 12px; padding: 12px 16px; margin-bottom: var(--gap);
  border: 1px solid; border-left-width: 4px; background: var(--surface); }
.alert .icon { margin-top: 2px; }
.alert div { color: var(--text); }
.alert-success { color: var(--ok); background: var(--ok-soft); border-color: var(--ok-line); border-left-color: var(--ok); }
.alert-error { color: var(--bad); background: var(--bad-soft); border-color: var(--bad-line); border-left-color: var(--bad); }
.alert-warning { color: var(--warn); background: var(--warn-soft); border-color: var(--warn-line); border-left-color: var(--warn); }
.alert-info { color: var(--info); background: var(--info-soft); border-color: var(--info-line); border-left-color: var(--info); }

/* ---------- Estados: icono + texto, no solo color ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px;
  font-size: 12px; font-weight: 700; white-space: nowrap; border: 1px solid; }
.badge .icon { width: auto; }
.badge-unused { color: var(--text-2); background: var(--surface-2); border-color: var(--border-strong); }
.badge-activated { color: var(--ok); background: var(--ok-soft); border-color: var(--ok-line); }
.badge-revoked { color: var(--bad); background: var(--bad-soft); border-color: var(--bad-line); }
.tag { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 8px; font-size: 12px;
  font-weight: 500; color: var(--text-2); background: var(--surface-2); border: 1px solid var(--border);
  white-space: nowrap; }
.tag .icon { width: auto; color: var(--brand-light); }

/* ---------- Búsqueda y acciones en lote ---------- */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 16px var(--pad-x);
  border-bottom: 1px solid var(--border); }
.toolbar .search { flex: 1 1 280px; }
.toolbar select { flex: 0 0 220px; width: 220px; }
.bulkbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 12px var(--pad-x);
  background: var(--brand-tint); border-bottom: 1px solid var(--border); }
.bulkbar select { flex: 0 0 280px; width: 280px; }
.bulkbar .check { margin-right: auto; }

/* ---------- Tablas ---------- */
.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { height: 56px; padding: 8px 12px; text-align: left; vertical-align: middle; white-space: nowrap;
  border-bottom: 1px solid var(--border); }
th:first-child, td:first-child { padding-left: var(--pad-x); }
th:last-child, td:last-child { padding-right: var(--pad-x); }
th { height: 44px; font-size: 12px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--text-3); background: var(--surface-2); }
tbody tr { transition: background-color 0.1s; }
tbody tr:hover td { background: var(--brand-tint); }
tbody tr:last-child td { border-bottom: 0; }
tbody tr.selected-row td { background: var(--brand-soft); }
th.col-check, td.col-check { width: 64px; padding-right: 0; }
td.wrap { white-space: normal; min-width: 240px; }
.serial-cell { display: flex; align-items: center; gap: 8px; }
.serial-link { font-family: var(--mono); font-size: 13px; font-weight: 700; letter-spacing: 0.03em;
  color: var(--brand); text-decoration: none; }
.serial-link:hover { color: var(--accent); text-decoration: underline; }

.empty { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 48px 24px;
  text-align: center; white-space: normal; }
.empty > .icon { width: auto; color: var(--border-strong); margin-bottom: 8px; }
.empty .button { margin-top: 8px; }
.pager-links { display: flex; gap: 8px; }

/* ---------- Detalle de una licencia ---------- */
.serial-title { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.serial-big { font-family: var(--mono); font-size: 20px; font-weight: 700; letter-spacing: 0.04em; color: var(--brand); }
.details { display: grid; grid-template-columns: 200px minmax(0, 1fr); margin: 0; }
.details dt, .details dd { display: flex; align-items: center; min-height: 52px; margin: 0;
  padding: 8px var(--pad-x); border-bottom: 1px solid var(--border); }
.details dt { color: var(--text-3); background: var(--surface-2); padding-right: 16px; }
.details dd { flex-wrap: wrap; gap: 4px 6px; min-width: 0; }
.details dt:last-of-type, .details dd:last-of-type { border-bottom: 0; }
.action-list { display: flex; flex-direction: column; gap: 12px; }
.action-list form, .action-list button { width: 100%; }
.action-list button { justify-content: flex-start; }

/* Campo con botón pegado (número de serie + Copiar). */
.input-group { display: flex; align-items: stretch; min-width: 0; }
.input-group > input { flex: 1 1 auto; min-width: 0; }
.input-group > button { flex: none; margin-left: -1px; }
.serial-field { flex: 0 1 420px; }
.input-group > input.serial-input, .input-group > input.serial-input[readonly] { font-family: var(--mono);
  font-size: 16px; font-weight: 700; letter-spacing: 0.06em; color: var(--brand); background: var(--brand-tint); }

/* Datos en dos columnas (etiqueta | valor | etiqueta | valor). */
.details-2 { grid-template-columns: 180px minmax(0, 1fr) 180px minmax(0, 1fr); }
.details-2 dt:nth-last-of-type(-n+2), .details-2 dd:nth-last-of-type(-n+2) { border-bottom: 0; }

/* Todas las acciones en una línea: las normales a la izquierda y eliminar a la derecha. */
.actions-bar { gap: 16px; }
.actions-bar form { margin: 0; }

/* ---------- Generar ---------- */
.quick { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.serial-list { font-family: var(--mono); font-size: 14px; letter-spacing: 0.06em; }

/* ---------- Acceso (login e instalación) ---------- */
body.auth { min-height: 100vh; display: grid; place-items: center; padding: 32px 16px; background: var(--brand); }
.auth-main { width: 100%; max-width: 440px; display: flex; flex-direction: column; gap: 16px; }
.auth-main > .alert { margin: 0; }
.auth-card { padding: 32px; background: var(--surface); border-top: 4px solid var(--accent); }
.auth-brand { display: flex; flex-direction: column; align-items: center; gap: 16px; margin-bottom: 32px;
  text-align: center; }
.auth-brand .logo { width: auto; height: 88px; }
.auth-brand h1 { font-size: 22px; }
.auth-brand p { color: var(--text-3); margin-top: 4px; }
.auth-card .alert { margin-bottom: var(--gap); }
.auth-card .field { margin-bottom: 16px; }
.auth-card button[type="submit"], .auth-card .button.block { margin-top: 8px; }
.auth-foot { display: flex; align-items: center; justify-content: center; gap: 8px;
  color: rgba(255, 255, 255, 0.78); font-size: 12px; }

/* ---------- Pantallas medianas y móviles ---------- */
@media (max-width: 1200px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .details-2 { grid-template-columns: 180px minmax(0, 1fr); }
  .details-2 dt:nth-last-of-type(2), .details-2 dd:nth-last-of-type(2) { border-bottom: 1px solid var(--border); }
}

@media (max-width: 860px) {
  body.app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: sticky; top: 0; z-index: 10; height: auto; flex-direction: row; align-items: center;
    gap: 8px; padding: 8px 16px; overflow-x: auto; }
  .brand { padding: 0; margin: 0 8px 0 0; border: 0; }
  .brand-text, .user, .nav-item span { display: none; }
  .nav { flex-direction: row; gap: 4px; }
  .nav-item { width: 40px; padding: 0; justify-content: center; }
  .sidebar-foot { margin: 0 0 0 auto; padding: 0; border: 0; }
  .main { padding: 24px 16px; }
  :root { --pad-x: 16px; --gap: 16px; }
  .details, .details-2 { grid-template-columns: minmax(0, 1fr); }
  .serial-field { flex: 1 1 100%; }
  .details dt { min-height: 0; padding-top: 12px; padding-bottom: 4px; border-bottom: 0; background: none; }
  .details dd { min-height: 0; padding-top: 0; padding-bottom: 12px; }
  .toolbar select, .bulkbar select { flex: 1 1 100%; width: 100%; }
  .toolbar > button, .bulkbar > button { flex: 1 1 100%; }
}

@media (max-width: 560px) {
  .stats { grid-template-columns: minmax(0, 1fr); }
  .page-actions, .page-actions .button, .page-actions button { width: 100%; }
  .auth-card { padding: 24px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* ================= Plataforma: centros, profesorado, grupos, alumnado y sesiones ================= */

/* Insignias por tono (estado de cuentas, grupos, PIN y sesiones). */
.badge-ok { color: var(--ok); background: var(--ok-soft); border-color: var(--ok-line); }
.badge-bad { color: var(--bad); background: var(--bad-soft); border-color: var(--bad-line); }
.badge-warn { color: var(--warn); background: var(--warn-soft); border-color: var(--warn-line); }
.badge-info { color: var(--info); background: var(--info-soft); border-color: var(--info-line); }
.badge-neutral { color: var(--text-2); background: var(--surface-2); border-color: var(--border-strong); }

/* Mensajes arriba (después de guardar). La contraseña temporal o el PIN se quedan hasta cerrarlos. */
.notice-area:empty { display: none; }
.notice-area .alert { margin-bottom: var(--gap); align-items: flex-start; }
.notice-area .alert > div { flex: 1 1 auto; }
.notice-close { margin-left: auto; color: inherit; }
.secret-label { display: block; margin-top: 8px; font-weight: 700; }
.secret-field { max-width: 420px; margin-top: 8px; }
.secret-field input { font-size: 16px; font-weight: 700; color: var(--brand); background: var(--surface); }

/* Ventanas (dialog) para crear y editar. */
.dialog { width: min(640px, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 0; color: var(--text);
  background: var(--surface); border: 1px solid var(--border-strong); box-shadow: 0 16px 48px rgba(48, 46, 96, 0.25); }
.dialog::backdrop { background: rgba(36, 34, 74, 0.55); }
.dialog form { display: flex; flex-direction: column; max-height: calc(100vh - 48px); margin: 0; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 64px;
  padding: 12px var(--pad-x); border-bottom: 1px solid var(--border); border-top: 4px solid var(--brand); }
.dialog-head h2 { margin: 0; font-size: 18px; color: var(--title); }
.dialog-body { padding: var(--pad-x); overflow-y: auto; }
.dialog-body .alert { margin-bottom: var(--gap); }
.dialog-foot { display: flex; justify-content: flex-end; gap: 12px; padding: 16px var(--pad-x);
  border-top: 1px solid var(--border); background: var(--surface-2); }
[hidden] { display: none !important; }

/* Formularios en dos columnas y grupos de campos. */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.fieldset { margin: 0 0 var(--gap); padding: 16px; border: 1px solid var(--border); background: var(--brand-tint); }
.fieldset legend { padding: 0 8px; font-weight: 700; color: var(--brand); }
.fieldset .field:last-of-type { margin-bottom: 12px; }
.fieldset .field-hint { margin: 0; }
.check-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 16px; }
.check-list .check { min-height: 36px; }
form.inline { display: inline-flex; margin: 0; }
.inline-form { margin: 0; }
.inline-form select { width: auto; min-width: 220px; }

/* Celdas de acciones de las tablas: botones en una línea, a la derecha. */
td.cell-actions { white-space: nowrap; text-align: right; }
td.cell-actions > * { vertical-align: middle; }
td.cell-actions > * + * { margin-left: 6px; }
.strong-link { font-weight: 700; color: var(--brand); text-decoration: none; }
.strong-link:hover { text-decoration: underline; }
.tag-list { display: flex; flex-wrap: wrap; gap: 6px; }
a.tag { text-decoration: none; }
a.tag:hover { color: var(--brand); border-color: var(--brand); }
.tag-muted { opacity: 0.6; }

/* PIN del alumno: oculto hasta pulsar «Ver». */
.pin-cell { display: flex; align-items: center; gap: 8px; }
.pin-value { min-width: 72px; font-size: 15px; letter-spacing: 0.12em; color: var(--text-3); }
.pin-value.pin-shown { font-weight: 700; color: var(--brand); }

/* Lista de enlaces (grupos en el inicio, profesores con acceso). */
.link-list { margin: 0; padding: 0; list-style: none; }
.link-list li + li { border-top: 1px solid var(--border); }
.link-list a, .link-list-row { display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 56px; padding: 8px var(--pad-x); color: var(--text); text-decoration: none; }
.link-list a:hover { background: var(--brand-tint); }
.link-list a small { display: block; color: var(--text-3); font-size: 12px; }
.link-list-empty { padding: 16px var(--pad-x); }

/* Filtro de fechas de las sesiones. */
.date-field { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; color: var(--text-2); }
.date-field input { width: 160px; }
.loading { opacity: 0.5; transition: opacity 0.15s; }

@media (max-width: 860px) {
  .form-grid, .check-list { grid-template-columns: minmax(0, 1fr); }
  td.cell-actions { white-space: normal; }
  .date-field { flex: 1 1 140px; }
  .date-field input { width: 100%; }
}
.row.nowrap { flex-wrap: nowrap; }
.card-head .row select { width: 300px; }
@media (max-width: 860px) { .row.nowrap { flex-wrap: wrap; } .card-head .row select { width: 100%; } }
.cell-sub { display: block; margin-top: 2px; font-size: 12px; color: var(--text-3); }
