/*
 * Shell del diseño único (DANTE-56, etapa D; antes solo sistema_new): barra lateral, barra superior, estados de
 * carga y contenedor. La geometría de la barra (expandida, riel, drawer, menú flotante) está en shell-lateral.css.
 * login.php y cuenta_usuario.php (body.shell-auth, DANTE-58) la cargan por los tokens y los avisos de SweetAlert2:
 * el resto de las reglas no les llega (van por .shell-*, #sidebar, #main o body.shell-ui).
 * Solo variables del tema --bs-* (claro y oscuro salen de data-bs-theme); nunca bg-light,
 * bg-white ni text-dark. Mobile-first: lo de escritorio entra con min-width.
 *
 * Orden de carga (index.php): app.css, app-dark.css, iconly.css, common/css/dark-fixes.css,
 * common/css/dante-ui.css (sistema visual común de los paneles: tokens, contraste AA, foco, objetivos
 * táctiles) y al final esta hoja. A igual especificidad gana el shell; las colisiones con dante-ui.css
 * (burger-btn, `#main > footer`) se resuelven acá con un selector más específico (DANTE-56, etapa C1).
 *
 * Especificidad: app-dark.css (Mazer) repite reglas como `html[data-bs-theme="dark"] #main
 * #main-content {padding:2rem}`. Lo que el shell necesita que gane en los dos temas se escribe con
 * `html[data-bs-theme] ...` (suma una clase de atributo y vence a la regla de Mazer).
 *
 * Convención de títulos (para los módulos): la barra superior ya muestra el nombre del módulo, así
 * que el título de la pantalla no debería repetirse en la primera pantalla del celular. El módulo
 * pone su título como siempre (Mazer: <div class="page-heading"><h3>Alumnos</h3><p>subtítulo</p>
 * </div>, o la clase .page-heading-title en cualquier h1-h6). js/shell.js toma el primer título del
 * módulo y, si coincide con el de la barra, le agrega .shell-title-dup: en móvil (< 768 px) se
 * oculta visualmente (sigue disponible para lectores de pantalla) y queda el subtítulo; en
 * escritorio se ve igual. Un módulo que necesite un título distinto del de la barra simplemente
 * lo escribe distinto.
 */

:root {
	--shell-topbar-h: 3.75rem;
	--shell-gutter: 1rem;
	--shell-hit: 2.75rem; /* mínimo táctil: 44 px */
}

@media (min-width: 768px) {
	:root { --shell-gutter: 1.5rem; }
}

@media (min-width: 1200px) {
	:root { --shell-gutter: 2rem; }
}

/*
 * Texto atenuado con contraste AA (>= 4,5:1) en claro y oscuro. --bs-secondary-color da ~3:1 en
 * el tema claro: subtítulos, etiquetas y conteos del shell usan este derivado del texto principal.
 * Claro: el texto del cuerpo ya es medio, se oscurece un poco hacia el énfasis (~6:1). Oscuro: se
 * acerca al fondo para quedar tenue pero legible (~6:1).
 */
html,
html[data-bs-theme] {
	--shell-muted: color-mix(in srgb, var(--bs-body-color) 80%, var(--bs-emphasis-color));
}

html[data-bs-theme="dark"] {
	--shell-muted: color-mix(in srgb, var(--bs-body-color) 74%, var(--bs-body-bg));
}

/* Los saltos a un ancla o a un foco no quedan detrás de la barra superior fija (solo donde hay barra) */
html:has(body.shell-ui) {
	scroll-padding-top: calc(var(--shell-topbar-h) + .5rem);
}

/* ---- Accesibilidad -------------------------------------------------------- */
.shell-skip-link {
	position: fixed;
	top: .5rem;
	left: .5rem;
	z-index: 2000;
	padding: .5rem 1rem;
	border-radius: .5rem;
	background: var(--bs-primary);
	color: #fff;
	transform: translateY(-200%);
}

.shell-skip-link:focus {
	transform: none;
	color: #fff;
}

#main-content.shell-content {
	scroll-margin-top: var(--shell-topbar-h);
}

#main-content.shell-content:focus {
	outline: none;
}

/* ---- Barra lateral ---------------------------------------------------------- */
html[data-bs-theme] #sidebar .sidebar-wrapper {
	/* La lista puede ser larga: scroll nativo (en este perfil js/lateral.js no crea PerfectScrollbar) */
	overflow-y: auto !important;
	overscroll-behavior: contain;
	border-right: 1px solid var(--bs-border-color);
}

/* Anchos, estados (expandida, riel, drawer) y columna del menú: shell-lateral.css (DANTE-56, etapa D) */

#sidebar .sidebar-wrapper .sidebar-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: .5rem;
	padding: 1.25rem 1.5rem .5rem 2rem;
	min-height: var(--shell-topbar-h);
}

#sidebar .shell-logo {
	display: block;
	min-width: 0;
}

#sidebar .shell-logo-img {
	display: block;
	object-fit: contain;
	width: auto;
	height: 2.75rem;
	max-width: 100%;
}

/*
 * Logo del tema oscuro: app-dark.css apunta a /logo-dark.png (raíz del dominio) y acá no existe.
 * La hoja se sirve en <panel>/common/shell/css/ (vínculo common/ del panel): tres niveles arriba
 * está la carpeta del panel, con su propio logo-dark.png.
 */
html[data-bs-theme="dark"] .shell-logo .shell-logo-img {
	content: url("../../../logo-dark.png");
}

/* Filtro del menú (aparece cuando hay muchos módulos) */
.shell-menu-filter {
	position: relative;
	margin: .5rem 1rem 0;
}

.shell-menu-filter > i {
	position: absolute;
	top: 50%;
	left: .85rem;
	transform: translateY(-50%);
	color: var(--shell-muted);
	pointer-events: none;
}

html[data-bs-theme] .shell-menu-filter .shell-menu-filter-input {
	display: block;
	width: 100%;
	height: var(--shell-hit);
	padding: 0 .85rem 0 2.5rem;
	border: 1px solid var(--bs-border-color);
	border-radius: .6rem;
	background: var(--bs-body-bg);
	color: var(--bs-body-color);
	font-size: 1rem; /* 16 px: evita el zoom de iOS al enfocar */
}

.shell-menu-filter-input::placeholder {
	color: var(--shell-muted);
	opacity: 1;
}

.shell-menu-filter-input:focus-visible {
	outline: 3px solid var(--dante-focus, var(--bs-primary));
	outline-offset: 1px;
}

.shell-menu-empty {
	display: block;
	padding: .75rem 1rem;
	color: var(--shell-muted);
	font-size: .9rem;
	font-weight: 400;
}

/* Lista del menú */
html[data-bs-theme] #sidebar .sidebar-wrapper .menu {
	margin-top: .5rem;
	padding: 0 1rem 6rem;
}

html[data-bs-theme] #sidebar .menu .sidebar-title {
	margin: 1.25rem 0 .25rem;
	padding: 0 .85rem;
	color: var(--shell-muted);
	font-size: .8rem;
	font-weight: 600;
}

html[data-bs-theme] #sidebar .menu .sidebar-item {
	margin-top: .15rem;
}

html[data-bs-theme] #sidebar .menu .sidebar-link,
html[data-bs-theme] #sidebar .menu .submenu-link {
	display: flex;
	align-items: center;
	min-height: var(--shell-hit);
	padding: .55rem .85rem;
	border-radius: .6rem;
	color: var(--bs-body-color);
	font-size: 1rem;
	font-weight: 600;
	line-height: 1.25;
	transition: background-color .15s ease, color .15s ease;
}

html[data-bs-theme] #sidebar .menu .sidebar-link:hover,
html[data-bs-theme] #sidebar .menu .submenu-link:hover {
	background: var(--bs-tertiary-bg);
	color: var(--bs-emphasis-color);
	margin-left: 0;
}

html[data-bs-theme] #sidebar .menu .sidebar-link:focus-visible,
html[data-bs-theme] #sidebar .menu .submenu-link:focus-visible {
	outline: 3px solid var(--dante-focus, var(--bs-primary));
	outline-offset: -2px;
}

/* Sobre la hoja activa (fondo primario) el anillo por dentro no llega a 3:1: va por fuera, sobre el fondo del menú */
html[data-bs-theme] #sidebar .menu .sidebar-item.active:not(.shell-group) > .sidebar-link:focus-visible,
html[data-bs-theme] #sidebar .menu .submenu-item.active:not(.shell-group) > .submenu-link:focus-visible {
	outline-offset: 2px;
	box-shadow: 0 0 0 2px var(--bs-body-bg);
}

html[data-bs-theme] #sidebar .menu .sidebar-link > i:not(.shell-group-caret) {
	flex: 0 0 auto;
	width: 1.5rem;
	color: var(--shell-muted);
	font-size: 1.15rem;
	text-align: center;
}

html[data-bs-theme] #sidebar .menu .sidebar-link .shell-menu-text {
	margin-left: .85rem;
}

html[data-bs-theme] #sidebar .menu .submenu-link .shell-menu-text {
	margin-left: 0;
}

/* Hoja activa: fondo del color primario y texto blanco (contraste fijo en los dos temas) */
html[data-bs-theme] #sidebar .menu .sidebar-item.active:not(.shell-group) > .sidebar-link {
	background: var(--bs-primary);
	color: #fff;
}

html[data-bs-theme] #sidebar .menu .sidebar-item.active:not(.shell-group) > .sidebar-link > i,
html[data-bs-theme] #sidebar .menu .sidebar-item.active:not(.shell-group) > .sidebar-link .shell-menu-text {
	color: #fff;
}

/* Grupos plegables (padre_id de menu_sistema_new) */
html[data-bs-theme] #sidebar .menu .sidebar-item.has-sub {
	overflow: visible;
}

html[data-bs-theme] #sidebar .menu .shell-group > .sidebar-link::after,
html[data-bs-theme] #sidebar .menu .shell-group > .submenu-link::after {
	content: none;
	display: none;
}

html[data-bs-theme] #sidebar .menu .shell-group.active > .shell-group-toggle {
	background: transparent;
	color: var(--bs-emphasis-color);
}

html[data-bs-theme] #sidebar .menu .shell-group.active > .shell-group-toggle:hover {
	background: var(--bs-tertiary-bg);
}

html[data-bs-theme] #sidebar .menu .shell-group.active > .shell-group-toggle .shell-menu-text,
html[data-bs-theme] #sidebar .menu .shell-group.active > .shell-group-toggle > i:not(.shell-group-caret) {
	color: var(--bs-emphasis-color);
}

.shell-group-caret {
	flex: 0 0 auto;
	margin-left: auto;
	padding-left: .5rem;
	color: var(--shell-muted);
	font-size: .9rem;
	transition: transform .2s ease;
}

.shell-group.is-open > .shell-group-toggle .shell-group-caret {
	transform: rotate(180deg);
}

.shell-submenu {
	display: none;
	margin: .1rem 0 .35rem 1.5rem;
	padding: 0 0 0 .5rem;
	list-style: none;
	border-left: 1px solid var(--bs-border-color);
}

.shell-group.is-open > .shell-submenu {
	display: block;
}

/* Con el filtro activo se ven todas las coincidencias, estén los grupos abiertos o no */
#sidebar.is-filtering .shell-submenu {
	display: block;
}

html[data-bs-theme] #sidebar .menu .submenu-item {
	margin-top: .1rem;
	list-style: none;
}

html[data-bs-theme] #sidebar .menu .submenu-item .submenu-link {
	padding: .5rem .75rem;
	font-size: .95rem;
	font-weight: 500;
	letter-spacing: 0;
}

html[data-bs-theme] #sidebar .menu .submenu-item.active:not(.shell-group) > .submenu-link {
	background: var(--bs-primary);
	color: #fff;
	font-weight: 600;
}

#sidebar .menu [hidden] {
	display: none !important;
}

.shell-menu-nomatch {
	list-style: none;
}

/* ---- Barra superior --------------------------------------------------------- */
#main > .shell-header {
	display: block;
	position: sticky;
	top: 0;
	z-index: 9;
	height: auto;
	/* PWA instalada con viewport-fit=cover: la barra no queda debajo del notch */
	padding-top: env(safe-area-inset-top, 0px);
	background-color: var(--bs-body-bg);
	border-bottom: 1px solid var(--bs-border-color);
}

.shell-topbar {
	display: flex;
	align-items: center;
	gap: .25rem;
	height: var(--shell-topbar-h);
	padding: 0 max(.5rem, env(safe-area-inset-right, 0px)) 0 max(.25rem, env(safe-area-inset-left, 0px));
	min-width: 0;
}

@media (min-width: 768px) {
	.shell-topbar {
		gap: .5rem;
		padding: 0 max(var(--shell-gutter), env(safe-area-inset-right, 0px))
			0 max(var(--shell-gutter), env(safe-area-inset-left, 0px));
	}
}

.shell-icon-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 auto;
	width: var(--shell-hit);
	height: var(--shell-hit);
	padding: 0;
	border: 0;
	border-radius: .6rem;
	background: transparent;
	color: var(--bs-emphasis-color);
	font-size: 1.5rem;
	line-height: 1;
}

/* app-dark.css oculta .burger-btn en el tema oscuro; en celular tiene que verse.
   dante-ui.css pone `button.burger-btn {color: inherit}`: se repite el color del botón con más especificidad */
.shell-topbar button.burger-btn.shell-icon-btn {
	display: inline-flex;
	color: var(--bs-emphasis-color);
	font-size: 1.75rem;
}

/* Mazer fija `i {width:16px}` y `.bi {width:1rem;height:1rem}` (en oscuro con más especificidad: la hamburguesa
   y la campana quedaban corridas hacia abajo): el glifo se mide por su fuente en los dos temas */
html[data-bs-theme] .shell-icon-btn i,
html[data-bs-theme] .shell-state-icon i {
	display: block;
	width: 1em;
	height: 1em;
	line-height: 1;
}

.shell-icon-btn i::before {
	display: block;
	vertical-align: 0;
}

/* Trazo más grueso: la hamburguesa de Bootstrap Icons es fina y en oscuro se lee como rayitas */
.shell-topbar .burger-btn i {
	-webkit-text-stroke: .35px currentColor;
}

.shell-icon-btn:hover,
.shell-icon-btn:focus-visible {
	background: var(--bs-tertiary-bg);
	color: var(--bs-emphasis-color);
}

.shell-icon-btn:focus-visible,
.shell-account-btn:focus-visible {
	outline: 3px solid var(--dante-focus, var(--bs-primary));
	outline-offset: 2px;
}

/* app-dark.css fuerza `button {border-radius: 0}` en el tema oscuro: se restituyen los radios */
html[data-bs-theme] .shell-icon-btn { border-radius: .6rem; }
html[data-bs-theme] .shell-account-btn { border-radius: 999px; }

/* Dónde estoy: grupo del menú (arriba, chico) y nombre del módulo */
.shell-where {
	display: flex;
	flex-direction: column;
	justify-content: center;
	flex: 0 1 auto;
	min-width: 0;
	line-height: 1.2;
}

.shell-where-group {
	display: none;
	color: var(--shell-muted);
	font-size: .75rem;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.shell-where-name {
	color: var(--bs-emphasis-color);
	font-size: 1.05rem;
	font-weight: 700;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

@media (min-width: 768px) {
	.shell-where-group:not(:empty) { display: block; }
	.shell-where-name { font-size: 1.15rem; }
}

.shell-spacer {
	flex: 1 1 0;
	min-width: 0;
}

/*
 * Entorno (sandbox/producción). Móvil: solo un punto de color (el texto queda para lectores de
 * pantalla y el tooltip); en producción no se muestra. Escritorio: la pastilla con el dominio.
 */
.shell-env {
	display: none;
	flex-direction: column;
	align-items: flex-end;
	flex: 0 0 auto;
	margin-right: .25rem;
	line-height: 1.2;
}

.shell-env:not(.shell-env-prod) {
	display: flex;
}

.shell-env-pill {
	display: inline-flex;
	align-items: center;
	gap: .4rem;
	padding: .15rem .6rem;
	border: 1px solid var(--bs-warning-border-subtle);
	border-radius: 999px;
	background: var(--bs-warning-bg-subtle);
	color: var(--bs-warning-text-emphasis);
	font-size: .75rem;
	font-weight: 700;
	white-space: nowrap;
}

.shell-env-dot {
	display: block;
	flex: 0 0 auto;
	width: .5rem;
	height: .5rem;
	border-radius: 50%;
	background: var(--bs-warning);
}

.shell-env-prod .shell-env-pill {
	border-color: var(--bs-success-border-subtle);
	background: var(--bs-success-bg-subtle);
	color: var(--bs-success-text-emphasis);
}

.shell-env-prod .shell-env-dot {
	background: var(--bs-success);
}

.shell-env-domain {
	display: none;
	margin-top: .1rem;
	color: var(--shell-muted);
	font-size: .75rem;
}

@media (max-width: 767.98px) {
	.shell-env-pill {
		padding: 0;
		border: 0;
		background: transparent;
	}

	.shell-env-dot {
		width: .65rem;
		height: .65rem;
		box-shadow: 0 0 0 3px var(--bs-warning-bg-subtle);
	}

	.shell-env-label {
		position: absolute;
		width: 1px;
		height: 1px;
		margin: -1px;
		overflow: hidden;
		clip: rect(0 0 0 0);
		white-space: nowrap;
	}
}

@media (min-width: 768px) {
	.shell-env { display: flex; margin-right: .75rem; }
	.shell-env-domain { display: block; }
}

/* Slots de cabecera: buscador, campanita y cuenta (los llenan otros módulos) */
.shell-slot {
	display: flex;
	align-items: center;
	flex: 0 0 auto;
	gap: .25rem;
}

.shell-slot:empty {
	display: none;
}

/* Cuenta: en móvil solo el avatar (44x44); desde 576 px también el nombre y el perfil */
.shell-account-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: .75rem;
	min-width: var(--shell-hit);
	min-height: var(--shell-hit);
	padding: 0;
	border: 0;
	border-radius: 999px;
	background: transparent;
	color: var(--bs-body-color);
	text-align: right;
}

.shell-account-btn:hover,
.shell-account-btn.show {
	background: var(--bs-tertiary-bg);
}

.shell-account-name {
	display: none;
	flex-direction: column;
	max-width: 14rem;
	line-height: 1.2;
}

.shell-account-name strong,
.shell-account-name small {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.shell-account-name small {
	color: var(--shell-muted);
	font-size: .75rem;
}

@media (min-width: 576px) {
	.shell-account-btn { padding: 0 .25rem 0 .75rem; }
	.shell-account-name { display: flex; }
}

.shell-avatar {
	flex: 0 0 auto;
}

.shell-account-btn .shell-avatar {
	width: 2.25rem;
	height: 2.25rem;
}

.shell-avatar img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	border-radius: 50%;
}

.shell-account-menu {
	min-width: 16rem;
	max-width: calc(100vw - 1rem);
	margin-top: .35rem !important;
	padding: .5rem 0;
	border: 1px solid var(--bs-border-color);
	border-radius: .75rem;
	box-shadow: 0 .75rem 2rem rgba(0, 0, 0, .18);
}

/* app-dark.css apaga el color de los .dropdown-item: se refuerza con más especificidad */
html[data-bs-theme] .shell-account-menu .dropdown-item {
	color: var(--bs-body-color);
}

html[data-bs-theme] .shell-account-menu .dropdown-item:hover,
html[data-bs-theme] .shell-account-menu .dropdown-item:focus {
	background: var(--bs-tertiary-bg);
	color: var(--bs-emphasis-color);
}

html[data-bs-theme] .shell-account-menu .dropdown-item.shell-logout,
html[data-bs-theme] .shell-account-menu .dropdown-item.shell-logout i {
	color: var(--bs-danger-text-emphasis);
}

.shell-account-menu .dropdown-item i {
	display: inline-flex;
	justify-content: center;
	line-height: 1;
	flex: 0 0 auto;
	width: 1.25rem;
	text-align: center;
}

.shell-account-head strong {
	color: var(--bs-emphasis-color);
}

.shell-account-menu .dropdown-item {
	display: flex;
	align-items: center;
	min-height: var(--shell-hit);
}

.shell-account-head {
	display: flex;
	flex-direction: column;
	padding: .25rem 1rem .5rem;
	line-height: 1.3;
}

.shell-account-head small {
	color: var(--shell-muted);
}

/* Tema y menú lateral del menú de la cuenta: radios nativos (.shell-pref, shell-lateral.css) */

/* ---- Progreso de carga de módulo --------------------------------------------- */
.shell-progress {
	position: absolute;
	left: 0;
	right: 0;
	bottom: -1px;
	height: 3px;
	overflow: hidden;
	opacity: 0;
	transition: opacity .2s ease;
	pointer-events: none;
}

.shell-progress::before {
	content: "";
	position: absolute;
	inset: 0 auto 0 0;
	width: 40%;
	background: var(--bs-primary);
	border-radius: 3px;
}

.shell-progress.is-active {
	opacity: 1;
}

.shell-progress.is-active::before {
	animation: shell-progress 1.1s ease-in-out infinite;
}

@keyframes shell-progress {
	from { transform: translateX(-100%); }
	to { transform: translateX(250%); }
}

@media (prefers-reduced-motion: reduce) {
	.shell-progress.is-active::before { animation: none; width: 100%; opacity: .5; }
	.shell-group-caret { transition: none; }
}

/* ---- Contenido ------------------------------------------------------------------ */
/* Mismo margen lateral en claro y oscuro: vence a `#main #main-content {padding:2rem}` de app-dark.css */
html[data-bs-theme] #main #main-content.shell-content {
	min-width: 0;
	padding: var(--shell-gutter);
	/* Márgenes seguros del notch con el celular apaisado (viewport-fit=cover); sin notch env() vale 0 */
	padding-right: max(var(--shell-gutter), env(safe-area-inset-right, 0px));
	padding-left: max(var(--shell-gutter), env(safe-area-inset-left, 0px));
	transition: opacity .15s ease;
}

html[data-bs-theme] #main #main-content.shell-content.is-loading {
	opacity: .55;
	pointer-events: none;
}

/* Título repetido: en móvil se oculta (queda para lectores de pantalla) si coincide con la barra */
@media (max-width: 767.98px) {
	.shell-content .shell-title-dup {
		position: absolute !important;
		width: 1px;
		height: 1px;
		margin: -1px !important;
		padding: 0 !important;
		overflow: hidden;
		clip: rect(0 0 0 0);
		white-space: nowrap;
	}
}

.shell-loading {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: .75rem;
	min-height: 40vh;
	color: var(--shell-muted);
}

/* `#main > footer` de dante-ui.css (márgenes seguros) pisaba el padding: misma regla con los dos */
#main > footer.shell-footer {
	padding: .75rem max(var(--shell-gutter), env(safe-area-inset-right, 0px))
		max(1rem, env(safe-area-inset-bottom, 0px)) max(var(--shell-gutter), env(safe-area-inset-left, 0px));
	color: var(--shell-muted);
	font-size: .85rem;
}

.shell-footer p {
	margin: 0;
}

/* ---- Estados: sin acceso, no encontrado, error, sin conexión ---------------------- */
.shell-state {
	max-width: 32rem;
	margin: 3rem auto;
	padding: 0 .5rem;
	text-align: center;
}

.shell-state-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 4.5rem;
	height: 4.5rem;
	margin-bottom: 1.25rem;
	border-radius: 50%;
	background: var(--bs-secondary-bg);
	color: var(--bs-emphasis-color);
	font-size: 2rem;
}

.shell-state-icon i::before {
	vertical-align: 0;
}

.shell-state-title {
	margin: 0 0 .5rem;
	font-size: 1.35rem;
	font-weight: 700;
	color: var(--bs-emphasis-color);
}

.shell-state-text {
	margin: 0 auto 1.5rem;
	color: var(--shell-muted);
	line-height: 1.5;
}

.shell-state-actions {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: .5rem;
}

.shell-state-actions .btn {
	min-height: var(--shell-hit);
}

/* ---- Selector segmentado (tema y menú lateral) ---------------------------------------------
   Radios nativos (flechas y Tab como cualquier grupo de radios). Lo usan el menú de la cuenta de los paneles y
   login y cuenta_usuario (body.shell-auth, DANTE-58). */
:is(body.shell-ui, body.shell-auth) .shell-seg {
	display: grid;
	grid-auto-columns: 1fr;
	grid-auto-flow: column;
	gap: .25rem;
	padding: .2rem;
	border: 1px solid var(--bs-border-color);
	border-radius: .6rem;
	background: var(--bs-tertiary-bg);
}

:is(body.shell-ui, body.shell-auth) .shell-seg-opt {
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: .1rem;
	min-height: var(--shell-hit);
	margin: 0;
	padding: .25rem;
	border-radius: .45rem;
	color: var(--bs-body-color);
	font-size: .8125rem;
	font-weight: 600;
	line-height: 1.1;
	text-align: center;
	cursor: pointer;
}

:is(body.shell-ui, body.shell-auth) .shell-seg-opt i { font-size: 1.1rem; }

:is(body.shell-ui, body.shell-auth) .shell-seg-opt input {
	position: absolute;
	inset: 0;
	margin: 0;
	opacity: 0;
	cursor: pointer;
}

:is(body.shell-ui, body.shell-auth) .shell-seg-opt:hover { color: var(--bs-emphasis-color); }

:is(body.shell-ui, body.shell-auth) .shell-seg-opt:has(input:checked) {
	background: var(--bs-primary);
	color: #fff;
}

:is(body.shell-ui, body.shell-auth) .shell-seg-opt:has(input:focus-visible) {
	outline: 3px solid var(--dante-focus, var(--bs-primary));
	outline-offset: 2px;
}

/* Colores forzados (alto contraste de Windows): el activo se marca con borde, no solo con relleno */
@media (forced-colors: active) {
	:is(body.shell-ui, body.shell-auth) .shell-seg-opt:has(input:checked) { border: 2px solid Highlight; }
}

/* ---- Avisos de SweetAlert2 con los colores del tema ----------------------------------- */
/* app-dark.css fija estos colores con !important: acá se vencen con !important y más especificidad.
   Valen en los paneles (body.shell-ui) y en login y cuenta_usuario (body.shell-auth, DANTE-58); :where() no suma
   especificidad. */
html[data-bs-theme] :where(body.shell-ui, body.shell-auth) .swal2-popup {
	border: 1px solid var(--bs-border-color);
	border-radius: .9rem;
	background-color: var(--bs-body-bg) !important;
	color: var(--bs-body-color) !important;
	font-family: inherit;
}

html[data-bs-theme] :where(body.shell-ui, body.shell-auth) .swal2-popup .swal2-title {
	color: var(--bs-emphasis-color) !important;
	font-size: 1.35rem;
	font-weight: 700;
}

html[data-bs-theme] :where(body.shell-ui, body.shell-auth) .swal2-popup .swal2-html-container {
	color: var(--bs-body-color);
	line-height: 1.5;
}

html[data-bs-theme] :where(body.shell-ui, body.shell-auth) .swal2-popup .swal2-actions {
	gap: .5rem;
}

html[data-bs-theme] :where(body.shell-ui, body.shell-auth) .swal2-popup .swal2-styled {
	min-height: var(--shell-hit);
	margin: 0;
	padding: .55rem 1.1rem;
	border-radius: .6rem;
	box-shadow: none;
	font-weight: 600;
}

html[data-bs-theme] :where(body.shell-ui, body.shell-auth) .swal2-popup .swal2-styled:focus-visible {
	outline: 3px solid var(--dante-focus, var(--bs-primary));
	outline-offset: 2px;
	box-shadow: none;
}

html[data-bs-theme] :where(body.shell-ui, body.shell-auth) .swal2-popup .swal2-styled.swal2-confirm {
	border: 1px solid var(--bs-primary);
	background-color: var(--bs-primary) !important;
	color: #fff;
}

html[data-bs-theme] :where(body.shell-ui, body.shell-auth) .swal2-popup .swal2-styled.swal2-confirm:hover {
	background-color: color-mix(in srgb, var(--bs-primary) 85%, #000) !important;
}

html[data-bs-theme] :where(body.shell-ui, body.shell-auth) .swal2-popup .swal2-styled.swal2-deny {
	border: 1px solid var(--bs-danger);
	background: var(--bs-danger);
	color: #fff;
}

html[data-bs-theme] :where(body.shell-ui, body.shell-auth) .swal2-popup .swal2-styled.swal2-cancel {
	border: 1px solid var(--bs-border-color);
	background: transparent;
	color: var(--bs-body-color);
}

html[data-bs-theme] :where(body.shell-ui, body.shell-auth) .swal2-popup .swal2-styled.swal2-cancel:hover {
	background: var(--bs-tertiary-bg);
	color: var(--bs-emphasis-color);
}

html[data-bs-theme] :where(body.shell-ui, body.shell-auth) .swal2-popup .swal2-icon.swal2-warning {
	border-color: var(--bs-warning);
	color: var(--bs-warning-text-emphasis);
}

html[data-bs-theme] :where(body.shell-ui, body.shell-auth) .swal2-popup .swal2-icon.swal2-info {
	border-color: var(--bs-info);
	color: var(--bs-info-text-emphasis);
}

html[data-bs-theme] :where(body.shell-ui, body.shell-auth) .swal2-popup .swal2-icon.swal2-question {
	border-color: var(--bs-primary-border-subtle);
	color: var(--bs-primary-text-emphasis);
}

html[data-bs-theme] :where(body.shell-ui, body.shell-auth) .swal2-popup .swal2-icon.swal2-error {
	border-color: var(--bs-danger);
	color: var(--bs-danger);
}

html[data-bs-theme] :where(body.shell-ui, body.shell-auth) .swal2-popup .swal2-icon.swal2-error [class^="swal2-x-mark-line"] {
	background-color: var(--bs-danger);
}

html[data-bs-theme] :where(body.shell-ui, body.shell-auth) .swal2-popup .swal2-icon.swal2-success {
	border-color: var(--bs-success);
	color: var(--bs-success);
}

html[data-bs-theme] :where(body.shell-ui, body.shell-auth) .swal2-popup .swal2-icon.swal2-success [class^="swal2-success-line"] {
	background-color: var(--bs-success);
}

html[data-bs-theme] :where(body.shell-ui, body.shell-auth) .swal2-popup .swal2-icon.swal2-success .swal2-success-ring {
	border-color: color-mix(in srgb, var(--bs-success) 30%, transparent);
}

html[data-bs-theme] :where(body.shell-ui, body.shell-auth) .swal2-popup .swal2-icon.swal2-success [class^="swal2-success-circular-line"],
html[data-bs-theme] :where(body.shell-ui, body.shell-auth) .swal2-popup .swal2-icon.swal2-success .swal2-success-fix {
	background-color: var(--bs-body-bg);
}

html[data-bs-theme] :where(body.shell-ui, body.shell-auth) .swal2-popup .swal2-timer-progress-bar {
	background: var(--bs-primary);
}

html[data-bs-theme] :where(body.shell-ui, body.shell-auth) .swal2-popup .swal2-input,
html[data-bs-theme] :where(body.shell-ui, body.shell-auth) .swal2-popup .swal2-textarea,
html[data-bs-theme] :where(body.shell-ui, body.shell-auth) .swal2-popup .swal2-select {
	border-color: var(--bs-border-color);
	background: var(--bs-body-bg);
	color: var(--bs-body-color);
}

.shell-session-count {
	font-variant-numeric: tabular-nums;
}

/* ---- Avisos de los módulos con los tokens del tema --------------------------------------
   app.css/app-dark.css (Mazer) pintan .alert-* y .alert-light-* con fondo y color fijos (en oscuro,
   bloques pastel; .alert-info, celeste con texto blanco a ~2:1). En el contenido del shell se usan los
   *-bg-subtle / *-text-emphasis de Bootstrap 5.3, que siguen al tema. */
html[data-bs-theme] #main-content .alert-primary,
html[data-bs-theme] #main-content .alert-light-primary {
	background: var(--bs-primary-bg-subtle);
	color: var(--bs-primary-text-emphasis);
	border-color: var(--bs-primary-border-subtle);
}

html[data-bs-theme] #main-content .alert-info,
html[data-bs-theme] #main-content .alert-light-info {
	background: var(--bs-info-bg-subtle);
	color: var(--bs-info-text-emphasis);
	border-color: var(--bs-info-border-subtle);
}

html[data-bs-theme] #main-content .alert-success,
html[data-bs-theme] #main-content .alert-light-success {
	background: var(--bs-success-bg-subtle);
	color: var(--bs-success-text-emphasis);
	border-color: var(--bs-success-border-subtle);
}

html[data-bs-theme] #main-content .alert-warning,
html[data-bs-theme] #main-content .alert-light-warning {
	background: var(--bs-warning-bg-subtle);
	color: var(--bs-warning-text-emphasis);
	border-color: var(--bs-warning-border-subtle);
}

html[data-bs-theme] #main-content .alert-danger,
html[data-bs-theme] #main-content .alert-light-danger {
	background: var(--bs-danger-bg-subtle);
	color: var(--bs-danger-text-emphasis);
	border-color: var(--bs-danger-border-subtle);
}

/* ---- Impresión: el contenido ocupa todo el ancho ------------------------------------- */
@media print {
	#sidebar ~ #main { margin-left: 0 !important; }
	html[data-bs-theme] #main #main-content.shell-content { padding: 0; }
}
