/* ============================================================
   BASE.CSS — design system de la nueva estética
   Única fuente de tokens y componentes compartidos.
   Las clases "legacy" (.hub, .searcher, .formulary, table,
   .paginacion) están cubiertas acá para que las vistas aún no
   migradas se vean bien; ver TAREAS_ESTETICA.md.
   ============================================================ */

:root {
	/* Marca: el teal pasa de fondo a acento */
	--brand-900: #033f3f;
	--brand-700: #046868;
	--brand-600: #068181;
	--brand-500: #119292;
	--brand-100: #d9efef;
	--brand-50:  #ecf6f6;
	--accent:    #20e3b2;
	--accent-50: #e3f8f1;

	/* Neutros */
	--bg:          #f2f6f6;
	--surface:     #ffffff;
	--text:        #16302f;
	--text-muted:  #5d7575;
	--border:      #dde8e8;

	/* Semánticos */
	--danger:      #c0392b;
	--danger-bg:   #fdeeec;
	--success:     #1e8e5a;
	--success-bg:  #e8f7ef;

	/* Elevación y forma */
	--shadow-sm: 0 1px 3px rgba(8, 60, 60, .07);
	--shadow-md: 0 2px 10px rgba(8, 60, 60, .09);
	--radius:    12px;
	--radius-sm: 8px;

	--fuente: 'Inter', system-ui, sans-serif;

	/* Alias para CSS legacy aún cargado (assignStyle, galeryStyle) */
	--paneles:    var(--surface);
	--font:       var(--text);
	--hover:      var(--accent);
	--nav:        var(--surface);
	--formulario: var(--surface);
	--Bordes:     var(--border);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
	font-family: var(--fuente);
	background: linear-gradient(160deg, var(--brand-100) 0%, var(--bg) 45%, var(--accent-50) 100%);
	min-height: 100vh;
	color: var(--text);
	font-size: 16px;
	line-height: 1.5;
}

a { text-decoration: none; color: inherit; }

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible {
	outline: 2px solid var(--brand-500);
	outline-offset: 2px;
}

/* ============================================================
   HEADER COMPACTO (sticky, fuera de .contenedor)
   ============================================================ */
.header {
	position: sticky;
	top: 0;
	z-index: 10;
	background: var(--surface);
	border-bottom: 1px solid var(--border);
	box-shadow: var(--shadow-sm);
}

.header-inner {
	max-width: 1280px;
	margin: 0 auto;
	padding: 0 24px;
	height: 76px;
	display: flex;
	align-items: center;
	gap: 16px;
}

.header .logo {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-right: 16px;
}

.header .logo img { height: 48px; width: auto; }

.header .logo span {
	font-weight: 700;
	font-size: 19px;
	letter-spacing: .02em;
	color: var(--brand-700);
	white-space: nowrap;
}

.menu {
	display: flex;
	align-items: center;
	gap: 4px;
	flex: 1;
}

.menu a {
	padding: 10px 16px;
	border-radius: var(--radius-sm);
	font-size: 16px;
	font-weight: 500;
	color: var(--text-muted);
	transition: background .15s ease, color .15s ease;
}

.menu a:hover { background: var(--brand-50); color: var(--brand-700); }

.menu a.activo { background: var(--brand-100); color: var(--brand-900); font-weight: 600; }

.menu .salir { margin-left: auto; color: var(--danger); }
.menu .salir:hover { background: var(--danger-bg); color: var(--danger); }

/* Submenú del header (dropdown nativo con <details>/<summary>) */
.submenu { position: relative; }

.submenu > summary {
	list-style: none;
	display: flex;
	align-items: center;
	gap: 6px;
	padding: 10px 16px;
	border-radius: var(--radius-sm);
	font-size: 16px;
	font-weight: 500;
	color: var(--text-muted);
	white-space: nowrap;
	cursor: pointer;
	transition: background .15s ease, color .15s ease;
}

.submenu > summary::-webkit-details-marker { display: none; }

.submenu > summary i { font-size: 11px; transition: transform .15s ease; }

.submenu > summary:hover { background: var(--brand-50); color: var(--brand-700); }

.submenu[open] > summary { background: var(--brand-100); color: var(--brand-900); }
.submenu[open] > summary i { transform: rotate(180deg); }

.submenu-panel {
	position: absolute;
	top: calc(100% + 6px);
	left: 0;
	z-index: 20;
	min-width: 180px;
	padding: 6px;
	display: flex;
	flex-direction: column;
	gap: 2px;
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
	box-shadow: var(--shadow-md);
}

.submenu-panel a {
	display: block;
	padding: 8px 12px;
	border-radius: var(--radius-sm);
	font-size: 15px;
	font-weight: 500;
	color: var(--text-muted);
}

.submenu-panel a:hover { background: var(--brand-50); color: var(--brand-700); }

/* Switch de vista Admin/Profesor (solo para roles con ambos modos) */
.switch-vista {
	display: inline-flex;
	align-items: center;
	gap: 2px;
	padding: 3px;
	border: 1px solid var(--border);
	border-radius: 999px;
	background: var(--bg);
}

.menu .switch-vista a,
.switch-vista span {
	padding: 6px 14px;
	border-radius: 999px;
	font-size: 14px;
	font-weight: 600;
	color: var(--text-muted);
	white-space: nowrap;
}

.menu .switch-vista a:hover { background: var(--brand-100); color: var(--brand-900); }

.switch-vista .activo {
	background: var(--brand-600);
	color: #fff;
	cursor: default;
}

/* Toggle del menú (hamburguesa, visible solo en mobile) */
.nav-toggle {
	position: absolute;
	opacity: 0;
	pointer-events: none;
}

.nav-toggle-btn {
	display: none;
	margin-left: auto;
	width: 44px;
	height: 44px;
	align-items: center;
	justify-content: center;
	border-radius: var(--radius-sm);
	color: var(--brand-700);
	font-size: 20px;
	cursor: pointer;
	transition: background .15s ease;
}

.nav-toggle-btn:hover { background: var(--brand-50); }

.nav-toggle:focus-visible ~ .nav-toggle-btn {
	outline: 2px solid var(--brand-500);
	outline-offset: 2px;
}

/* ============================================================
   CONTENEDOR DE PÁGINA
   (reemplaza al grid con áreas: ahora todo apila vertical)
   ============================================================ */
.contenedor {
	max-width: 1280px;
	margin: 0 auto;
	padding: 28px 24px 48px;
	display: flex;
	flex-direction: column;
	gap: 20px;
}

/* ============================================================
   TÍTULO DE PÁGINA + ACCIONES
   ============================================================ */
.titulo-pagina {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	flex-wrap: wrap;
}

.titulo-pagina h1 { font-size: 30px; font-weight: 700; letter-spacing: -.01em; }

.titulo-pagina .acciones { display: flex; gap: 8px; flex-wrap: wrap; }

/* Botón "volver" a la izquierda del título (páginas internas de un curso) */
.titulo-volver { display: flex; align-items: center; gap: 12px; }

.btn-volver {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	flex-shrink: 0;
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
	background: var(--surface);
	color: var(--brand-700);
	font-size: 16px;
	transition: background .15s ease, border-color .15s ease;
}

.btn-volver:hover { border-color: var(--brand-500); background: var(--brand-50); }

/* ============================================================
   BOTONES
   ============================================================ */
.btn {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 10px 18px;
	border-radius: var(--radius-sm);
	border: 1px solid transparent;
	font-family: var(--fuente);
	font-size: 15px;
	font-weight: 600;
	cursor: pointer;
	transition: background .15s ease, border-color .15s ease;
}

.btn-primario { background: var(--brand-600); color: #fff; }
.btn-primario:hover { background: var(--brand-700); color: #fff; }

.btn-secundario { background: var(--surface); color: var(--brand-700); border-color: var(--border); }
.btn-secundario:hover { border-color: var(--brand-500); background: var(--brand-50); }

.btn-peligro { background: var(--surface); color: var(--danger); border-color: var(--border); }
.btn-peligro:hover { background: var(--danger-bg); border-color: var(--danger); }

.btn-icono {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 38px;
	height: 38px;
	border: none;
	border-radius: var(--radius-sm);
	background: transparent;
	color: var(--text-muted);
	font-size: 16px;
	cursor: pointer;
	transition: background .15s ease, color .15s ease;
}

.btn-icono:hover { background: var(--brand-100); color: var(--brand-900); }
.btn-icono.peligro:hover { background: var(--danger-bg); color: var(--danger); }

/* ============================================================
   CARDS
   ============================================================ */
.card {
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	box-shadow: var(--shadow-sm);
}

/* ============================================================
   BUSCADOR (nuevo) + HUB/SEARCHER (legacy)
   ============================================================ */
.buscador {
	padding: 14px 16px;
	display: flex;
	gap: 10px;
	align-items: center;
	flex-wrap: wrap;
}

.campo {
	flex: 1;
	min-width: 220px;
	position: relative;
}

.campo i {
	position: absolute;
	left: 12px;
	top: 50%;
	transform: translateY(-50%);
	color: var(--text-muted);
	font-size: 13px;
}

.campo input {
	width: 100%;
	padding: 10px 12px 10px 36px;
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
	font-family: var(--fuente);
	font-size: 15px;
	color: var(--text);
	background: var(--surface);
	transition: border-color .15s ease, box-shadow .15s ease;
}

.campo input:focus {
	outline: none;
	border-color: var(--brand-500);
	box-shadow: 0 0 0 3px var(--brand-100);
}

select.filtro {
	padding: 10px 12px;
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
	font-family: var(--fuente);
	font-size: 15px;
	color: var(--text);
	background: var(--surface);
	cursor: pointer;
}

select.filtro:focus {
	outline: none;
	border-color: var(--brand-500);
	box-shadow: 0 0 0 3px var(--brand-100);
}

/* Legacy: .hub y .searcher se ven como card hasta que se migren */
.hub {
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	box-shadow: var(--shadow-sm);
	padding: 18px;
	width: 100%;
	font-family: var(--fuente);
	color: var(--text);
	text-align: left;
}

.hub h1 { font-size: 24px; font-weight: 700; margin: 0 0 12px; }

.searcher {
	display: flex;
	gap: 10px;
	align-items: center;
	flex-wrap: wrap;
	padding: 0;
	font-family: var(--fuente);
}

.searcher form { display: flex; gap: 10px; align-items: center; flex: 1; min-width: 220px; }

.searcher input {
	flex: 1;
	padding: 9px 12px;
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
	background: var(--surface);
	font-family: var(--fuente);
	font-size: 14px;
	color: var(--text);
}

.searcher input:focus {
	outline: none;
	border-color: var(--brand-500);
	box-shadow: 0 0 0 3px var(--brand-100);
}

.hub button,
.searcher button {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 9px 16px;
	min-width: 0;
	width: auto;
	margin: 0;
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
	background: var(--surface);
	color: var(--brand-700);
	font-family: var(--fuente);
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
	transition: background .15s ease, border-color .15s ease;
}

.hub button:hover,
.searcher button:hover { border-color: var(--brand-500); background: var(--brand-50); }

.searcher select {
	padding: 9px 12px;
	min-width: 0;
	width: auto;
	margin: 0;
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
	background: var(--surface);
	font-family: var(--fuente);
	font-size: 14px;
	color: var(--text);
	cursor: pointer;
}

/* ============================================================
   FORMULARIOS (.formulary y sus alias numerados legacy)
   ============================================================ */
.formulary,
.formulary2,
.formulary3,
.formulary4,
.formulary5,
.formulary6 {
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	box-shadow: var(--shadow-sm);
	padding: 32px;
	width: 100%;
	max-width: 860px;
	margin: 0 auto;
	font-family: var(--fuente);
	font-size: 16px;
	color: var(--text);
	text-align: left;
}

.formulary h1, .formulary2 h1, .formulary3 h1,
.formulary4 h1, .formulary5 h1, .formulary6 h1 {
	font-size: 24px;
	font-weight: 700;
	margin-bottom: 16px;
}

.formulary h2, .formulary2 h2, .formulary3 h2,
.formulary4 h2, .formulary5 h2, .formulary6 h2 {
	font-size: 18px;
	font-weight: 600;
	margin-bottom: 12px;
}

.formulary strong, .formulary label,
.formulary2 strong, .formulary2 label,
.formulary3 strong, .formulary3 label,
.formulary4 strong, .formulary4 label,
.formulary5 strong, .formulary5 label,
.formulary6 strong, .formulary6 label {
	display: block;
	font-weight: 600;
	font-size: 15px;
	margin: 14px 0 6px;
}

.formulary input:not([type="submit"]):not([type="checkbox"]):not([type="radio"]),
.formulary select,
.formulary textarea,
.formulary2 input:not([type="submit"]):not([type="checkbox"]):not([type="radio"]),
.formulary2 select, .formulary2 textarea,
.formulary3 input:not([type="submit"]):not([type="checkbox"]):not([type="radio"]),
.formulary3 select, .formulary3 textarea,
.formulary4 input:not([type="submit"]):not([type="checkbox"]):not([type="radio"]),
.formulary4 select, .formulary4 textarea,
.formulary5 input:not([type="submit"]):not([type="checkbox"]):not([type="radio"]),
.formulary5 select, .formulary5 textarea,
.formulary6 input:not([type="submit"]):not([type="checkbox"]):not([type="radio"]),
.formulary6 select, .formulary6 textarea {
	width: 100%;
	padding: 10px 12px;
	margin-bottom: 10px;
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
	background: var(--surface);
	font-family: var(--fuente);
	font-size: 15px;
	color: var(--text);
	transition: border-color .15s ease, box-shadow .15s ease;
}

.formulary input:focus, .formulary select:focus, .formulary textarea:focus,
.formulary2 input:focus, .formulary2 select:focus, .formulary2 textarea:focus,
.formulary3 input:focus, .formulary3 select:focus, .formulary3 textarea:focus,
.formulary4 input:focus, .formulary4 select:focus, .formulary4 textarea:focus,
.formulary5 input:focus, .formulary5 select:focus, .formulary5 textarea:focus,
.formulary6 input:focus, .formulary6 select:focus, .formulary6 textarea:focus {
	outline: none;
	border-color: var(--brand-500);
	box-shadow: 0 0 0 3px var(--brand-100);
}

.formulary textarea { height: 120px; resize: vertical; }

.formulary input[type="submit"],
.formulary2 input[type="submit"],
.formulary3 input[type="submit"],
.formulary4 input[type="submit"],
.formulary5 input[type="submit"],
.formulary6 input[type="submit"] {
	display: inline-flex;
	padding: 10px 22px;
	margin-top: 16px;
	border: none;
	border-radius: var(--radius-sm);
	background: var(--brand-600);
	color: #fff;
	font-family: var(--fuente);
	font-size: 15px;
	font-weight: 600;
	cursor: pointer;
	transition: background .15s ease;
}

.formulary input[type="submit"]:hover,
.formulary2 input[type="submit"]:hover,
.formulary3 input[type="submit"]:hover,
.formulary4 input[type="submit"]:hover,
.formulary5 input[type="submit"]:hover,
.formulary6 input[type="submit"]:hover { background: var(--brand-700); }

.fechaYhora { display: flex; gap: 10px; }
.fechaYhora select, .fechaYhora input { width: auto; min-width: 110px; }

/* Botón "Volver" legacy dentro de formularios */
.formulary .botones, .formulary2 .botones, .formulary3 .botones,
.formulary4 .botones, .formulary5 .botones, .formulary6 .botones {
	display: inline-flex;
	width: auto;
	padding: 9px 16px;
	margin-top: 12px;
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
	background: var(--surface);
	color: var(--brand-700);
	font-family: var(--fuente);
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
}

.formulary .botones:hover { border-color: var(--brand-500); background: var(--brand-50); }

.formulary a { color: var(--brand-700); font-weight: 600; }

.formulary .options {
	width: auto;
	padding: 9px 12px;
	font-size: 14px;
}

.formulary iframe, .formulary .embed-img { width: 100%; height: 100%; }
.formulary .embed-pdf { width: 100%; height: 600px; border: 1px solid var(--border); border-radius: var(--radius-sm); }

/* ============================================================
   CAMPOS DE FORMULARIO — grilla de 2 columnas, secciones y selects
   ============================================================ */
.form-grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 14px 16px;
	margin-top: 4px;
}

.form-grid .span-2 { grid-column: 1 / -1; }

.campo-form {
	display: flex;
	flex-direction: column;
}

.formulary .campo-form label,
.formulary .campo-form strong {
	margin: 0 0 6px;
}

.form-grid input:not([type="submit"]):not([type="checkbox"]):not([type="radio"]),
.form-grid select,
.form-grid textarea {
	margin-bottom: 0;
}

.formulary .form-seccion {
	grid-column: 1 / -1;
	margin: 8px 0 0;
	padding-top: 16px;
	border-top: 1px solid var(--border);
	font-size: 12px;
	font-weight: 600;
	letter-spacing: .07em;
	text-transform: uppercase;
	color: var(--text-muted);
}

.fila-doble {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 10px;
}

/* Selects al estilo de los inputs, con chevron propio (fill = --text-muted) */
.formulary select {
	appearance: none;
	-webkit-appearance: none;
	background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%235d7575'%3E%3Cpath d='M4.22 6.22a.75.75 0 0 1 1.06 0L8 8.94l2.72-2.72a.75.75 0 1 1 1.06 1.06l-3.25 3.25a.75.75 0 0 1-1.06 0L4.22 7.28a.75.75 0 0 1 0-1.06z'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 12px center;
	background-size: 14px;
	padding-right: 36px;
	cursor: pointer;
}

.formulary input:not([type="submit"]):not([type="checkbox"]):not([type="radio"]):hover,
.formulary select:hover,
.formulary textarea:hover {
	border-color: var(--brand-500);
}

@media (max-width: 640px) {
	.form-grid { grid-template-columns: 1fr; }
}

.container-iframe {
	position: relative;
	width: 100%;
	overflow: hidden;
	padding-top: 56.25%; /* 16:9 */
}

.divisor {
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	box-shadow: var(--shadow-sm);
	padding: 20px;
	margin-bottom: 16px;
}

/* Errores de validación de WTForms */
.errors-container {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 12px 16px;
	margin-bottom: 10px;
	border: 1px solid #f3cdc8;
	border-radius: var(--radius-sm);
	background: var(--danger-bg);
	color: var(--danger);
	font-size: 15px;
	font-weight: 500;
}

/* ============================================================
   TABLAS
   ============================================================ */
/* overflow-x: la tabla scrollea dentro de la card en pantallas angostas
   en vez de desbordar la página */
.tabla-card { overflow-x: auto; overflow-y: hidden; padding: 0; }

table {
	width: 100%;
	border-collapse: separate;
	border-spacing: 0;
	font-size: 15px;
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	box-shadow: var(--shadow-sm);
	overflow: hidden;
}

.tabla-card table { border: none; border-radius: 0; box-shadow: none; }

thead th {
	text-align: left;
	padding: 14px 18px;
	font-size: 13px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: .06em;
	color: var(--text-muted);
	background: var(--brand-50);
	border-bottom: 1px solid var(--border);
	white-space: nowrap;
}

tbody td {
	padding: 14px 18px;
	border-bottom: 1px solid var(--border);
	vertical-align: middle;
}

tbody tr:last-child td { border-bottom: none; }

tbody tr:nth-child(even) td { background: #fafcfc; }

tbody tr:hover td { background: var(--brand-50); }

td.celda-nombre { font-weight: 600; }
td.celda-muted { color: var(--text-muted); }

td.estado-vacio {
	text-align: center;
	padding: 48px 16px;
	color: var(--text-muted);
	font-size: 16px;
}

/* Botones de acción legacy dentro de tablas (ícono pelado) */
table button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 38px;
	height: 38px;
	border: none;
	border-radius: var(--radius-sm);
	background: transparent;
	color: var(--text-muted);
	font-size: 16px;
	cursor: pointer;
	transition: background .15s ease, color .15s ease;
}

table button:hover { background: var(--brand-100); color: var(--brand-900); }

.acciones-fila { display: flex; gap: 2px; }

.badge {
	display: inline-block;
	padding: 3px 10px;
	border-radius: 999px;
	font-size: 13px;
	font-weight: 600;
	background: var(--brand-100);
	color: var(--brand-900);
	white-space: nowrap;
}

/* Estado inactivo/archivado */
.badge.archivado { background: var(--border); color: var(--text-muted); }

/* Encabezado de columna ordenable (macro th_orden de layout/macros.html) */
.th-orden {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	color: inherit;
}

.th-orden:hover { color: var(--brand-700); }

.th-orden .fa-sort { opacity: .4; font-size: 11px; }

/* Switch (link toggle), ej. "Solo actuales" junto a "Agregar curso" en cursos.
   Es un <a> con .activo cuando está prendido; navega alternando el filtro. */
.switch {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	cursor: pointer;
	font-size: 15px;
	font-weight: 500;
	color: var(--text);
	white-space: nowrap;
	user-select: none;
}

.switch .switch-pista {
	width: 38px;
	height: 22px;
	border-radius: 999px;
	background: var(--border);
	position: relative;
	transition: background .15s ease;
	flex-shrink: 0;
}

.switch .switch-pista::after {
	content: '';
	position: absolute;
	top: 3px;
	left: 3px;
	width: 16px;
	height: 16px;
	border-radius: 50%;
	background: var(--surface);
	box-shadow: var(--shadow-sm);
	transition: left .15s ease;
}

.switch.activo .switch-pista { background: var(--brand-600); }

.switch.activo .switch-pista::after { left: 19px; }

/* Ícono tachado: fa-slash superpuesto al glifo (ej. desarchivar = archivar
   tachado). El text-shadow hace de halo y separa la barra del ícono de abajo,
   como en los íconos *-slash propios de Font Awesome. */
.icono-tachado {
	position: relative;
	display: inline-flex;
}

.icono-tachado .fa-slash {
	position: absolute;
	left: 50%;
	top: 50%;
	transform: translate(-50%, -50%);
	font-size: 1.15em;
	text-shadow: 1.5px -1.5px 0 var(--surface), 3px -3px 0 var(--surface);
}

/* Tooltip instantáneo para botones de acción ([data-tooltip] + aria-label) */
[data-tooltip] { position: relative; }

[data-tooltip]:hover::after {
	content: attr(data-tooltip);
	position: absolute;
	bottom: calc(100% + 7px);
	left: 50%;
	transform: translateX(-50%);
	background: var(--brand-900);
	color: #fff;
	font-size: 12px;
	font-weight: 500;
	line-height: 1;
	padding: 6px 9px;
	border-radius: var(--radius-sm);
	white-space: nowrap;
	pointer-events: none;
	z-index: 30;
}

[data-tooltip]:hover::before {
	content: '';
	position: absolute;
	bottom: calc(100% + 2px);
	left: 50%;
	transform: translateX(-50%);
	border: 5px solid transparent;
	border-top-color: var(--brand-900);
	pointer-events: none;
	z-index: 30;
}

/* ============================================================
   PAGINACIÓN
   ============================================================ */
.paginacion {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	text-align: center;
	margin-top: 14px;
}

/* Input al que se expande el ".." de la paginación (js/tabla.js) */
.paginacion .selector-pagina {
	width: 58px;
	height: 34px;
	padding: 0 6px;
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
	background: var(--surface);
	color: var(--text);
	font: inherit;
	font-size: 14px;
	text-align: center;
}

.paginacion button,
.paginacion .btn-pagina {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 40px;
	height: 40px;
	width: auto;
	padding: 0 12px;
	margin: 0;
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
	background: var(--surface);
	color: var(--text);
	font-family: var(--fuente);
	font-size: 15px;
	font-weight: 500;
	cursor: pointer;
	transition: background .15s ease, border-color .15s ease;
}

.paginacion button:hover,
.paginacion a.btn-pagina:hover { border-color: var(--brand-500); background: var(--brand-50); color: var(--text); }

.paginacion .deshabilitado { opacity: .4; cursor: default; }
.paginacion .deshabilitado:hover { border-color: var(--border); background: var(--surface); }

.paginacion .actual {
	background: var(--brand-600);
	border-color: var(--brand-600);
	color: #fff;
	font-weight: 600;
	cursor: default;
}

.paginacion .actual:hover { background: var(--brand-600); border-color: var(--brand-600); color: #fff; }

/* Número de página legacy (<a> suelto) */
.paginacion > a {
	color: var(--text);
	font-family: var(--fuente);
	font-size: 14px;
	font-weight: 600;
	padding: 0 8px;
}

/* ============================================================
   MENSAJES
   ============================================================ */
.alerta {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 12px 16px;
	border-radius: var(--radius-sm);
	font-size: 15px;
	font-weight: 500;
}

/* Botón de acción que necesita ser POST (form inline dentro de .acciones-fila) */
.accion-inline { display: inline-flex; }

/* ============================================================
   ESTADOS DE CARGA (js/carga.js y js/dialogo-form.js)
   ============================================================ */
@keyframes shimmer {
	from { background-position: 200% 0; }
	to   { background-position: -200% 0; }
}

@keyframes girar {
	to { transform: rotate(360deg); }
}

/* Barra de progreso al navegar a otra página */
.barra-carga {
	position: fixed;
	top: 0;
	left: 0;
	height: 3px;
	width: 0;
	background: linear-gradient(90deg, var(--brand-600), var(--accent));
	z-index: 100;
	opacity: 0;
	pointer-events: none;
}

.barra-carga.activa {
	opacity: 1;
	width: 85%;
	/* se frena cerca del final, como si esperara a la página nueva */
	transition: width 5s cubic-bezier(.08, .75, .15, 1), opacity .1s ease;
}

/* Botón en estado "enviando" (submit de un dialog en curso) */
.btn.enviando { pointer-events: none; opacity: .75; }

.btn.enviando::after {
	content: '';
	width: 13px;
	height: 13px;
	border: 2px solid currentColor;
	border-top-color: transparent;
	border-radius: 50%;
	display: inline-block;
	margin-left: 8px;
	vertical-align: -2px;
	animation: girar .7s linear infinite;
}

/* Shimmer del marco de la galería mientras carga su foto */
.imagen.cargando {
	background: linear-gradient(90deg, var(--border) 25%, var(--brand-50) 50%, var(--border) 75%);
	background-size: 200% 100%;
	animation: shimmer 1.1s linear infinite;
}

.imagen img { transition: opacity .25s ease; }

.imagen.cargando img { opacity: 0; }

/* ============================================================
   TOASTS (mensajes flash, auto-descartables — js/toast.js)
   ============================================================ */
.toasts {
	position: fixed;
	bottom: 20px;
	right: 20px;
	z-index: 40;
	display: flex;
	flex-direction: column;
	gap: 10px;
	max-width: min(420px, calc(100vw - 40px));
}

.toast {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 13px 16px;
	border-radius: var(--radius-sm);
	background: var(--surface);
	border: 1px solid var(--border);
	border-left: 4px solid var(--brand-600);
	box-shadow: var(--shadow-md);
	font-size: 15px;
	font-weight: 500;
	color: var(--text);
	animation: toast-entra .2s ease-out;
}

.toast.ok    { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.saliendo { animation: toast-sale .25s ease-in forwards; }

.toast .cerrar {
	margin-left: auto;
	border: none;
	background: none;
	color: var(--text-muted);
	cursor: pointer;
	font-size: 15px;
	line-height: 1;
	padding: 2px 4px;
}

.toast .cerrar:hover { color: var(--text); }

@keyframes toast-entra {
	from { opacity: 0; transform: translateY(12px); }
	to   { opacity: 1; transform: none; }
}

@keyframes toast-sale {
	from { opacity: 1; transform: none; }
	to   { opacity: 0; transform: translateY(8px); }
}

.alerta.ok { background: var(--success-bg); color: var(--success); border: 1px solid #bfe8d2; }
.alerta.error { background: var(--danger-bg); color: var(--danger); border: 1px solid #f3cdc8; }
/* Variante neutra para confirmaciones no destructivas (ej. archivar un curso) */
.alerta.aviso { background: var(--brand-50); color: var(--brand-900); border: 1px solid var(--border); }

/* ============================================================
   CONFIRMACIÓN DESTRUCTIVA
   Patrón único: <div class="card confirmacion"> con h1, .alerta y
   .confirmacion-acciones (confirmar en .btn-peligro + cancelar en .btn-secundario).
   ============================================================ */
.confirmacion {
	max-width: 520px;
	margin: 24px auto 0;
	padding: 28px;
	display: flex;
	flex-direction: column;
	gap: 16px;
}

.confirmacion h1 { font-size: 22px; font-weight: 700; }

.confirmacion-acciones { display: flex; gap: 8px; flex-wrap: wrap; }

/* Fila de botones al pie de una vista de detalle */
.acciones-detalle {
	display: flex;
	gap: 8px;
	flex-wrap: wrap;
	margin-top: 20px;
}

/* ============================================================
   SIDEBAR / IMAGEN DE HOME (legacy)
   ============================================================ */
.sidebar {
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	box-shadow: var(--shadow-sm);
	padding: 32px 24px;
	text-align: center;
	color: var(--text);
}

.sidebar .acerca-de img {
	border-radius: 100%;
	height: 10em;
	width: 10em;
	object-fit: cover;
	margin-bottom: 20px;
}

.sidebar .bio { font-size: 15px; line-height: 1.6; }

.Home-image {
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	box-shadow: var(--shadow-sm);
	padding: 16px;
	width: 100%;
	max-width: 640px;
	margin: 0 auto;
}

.Home-image img {
	width: 100%;
	height: auto;
	border-radius: var(--radius-sm);
}

/* ============================================================
   FOOTER
   ============================================================ */
.footer {
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	box-shadow: var(--shadow-sm);
	padding: 20px;
	text-align: center;
	font-size: 15px;
	font-weight: 600;
	color: var(--text);
}

.footer i { padding: 0 12px; color: var(--brand-600); transition: color .15s ease; }
.footer a:hover i { color: var(--brand-900); }

/* ============================================================
   AUTOFILL
   ============================================================ */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
select:-webkit-autofill,
select:-webkit-autofill:hover,
select:-webkit-autofill:focus {
	-webkit-text-fill-color: var(--text);
	-webkit-box-shadow: 0 0 0px 1000px var(--surface) inset;
	transition: background-color 5000s ease-in-out 0s;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
/* Navbar: colapsa a hamburguesa cuando los links ya no entran en fila */
@media (max-width: 1200px) {
	.header-inner { flex-wrap: wrap; height: auto; min-height: 64px; padding: 8px 16px; }

	.nav-toggle-btn { display: flex; }
	.nav-toggle:checked ~ .nav-toggle-btn i::before { content: "\f00d"; }

	.menu {
		display: none;
		width: 100%;
		flex-direction: column;
		align-items: stretch;
		gap: 2px;
		padding: 8px 0 12px;
	}

	.nav-toggle:checked ~ .menu { display: flex; }

	.menu a { padding: 12px 16px; }
	.header .menu .salir, .header .menu .ingresar { margin-left: 0; }
	.menu .switch-vista { align-self: flex-start; margin: 6px 16px; }
	.menu .switch-vista a { padding: 6px 14px; }

	.submenu > summary { padding: 12px 16px; }

	.submenu-panel {
		position: static;
		min-width: 0;
		margin: 2px 0 4px 16px;
		border: none;
		border-left: 2px solid var(--brand-100);
		border-radius: 0;
		box-shadow: none;
	}
}

@media (max-width: 900px) {
	.contenedor { padding: 20px 16px 40px; }

	.titulo-pagina { flex-direction: column; align-items: flex-start; }

	table { display: block; overflow-x: auto; }
	.tabla-card { overflow-x: auto; }

	.buscador .campo, .searcher form { min-width: 100%; }
	.fechaYhora { flex-wrap: wrap; }
}
