/*
 * Portal Clientes (/web/) — estilo del sitio comercial citofoniainalambrica.cl.
 *
 * La paleta, las tipografías y los componentes (topbar, header con menú,
 * botones, tarjetas, campos y pie) salen del HTML del sitio público. No depende
 * de Metronic ni de Bootstrap. Sysview (/sysview/) también la usa como base y
 * suma sus componentes propios en sysview/css/sysview.css.
 */

:root {
	--red: #e01b22;
	--red-bright: #ff2e36;
	--red-dark: #a80f14;
	--red-deep: #6e0a0e;
	--red-soft: #fdecec;
	--ink: #1c1114;
	--ink-2: #3a2b2f;
	--gray: #6f6468;
	--line: #eadfe1;
	--bg: #ffffff;
	--bg-soft: #faf6f7;
	--bg-dark: #190c0e;
	--radius: 18px;
	--shadow: 0 18px 50px -18px rgba(110, 10, 14, .22);
	--shadow-soft: 0 10px 30px -20px rgba(110, 10, 14, .25);
	--font: 'Outfit', system-ui, -apple-system, 'Segoe UI', sans-serif;
	--mono: 'JetBrains Mono', ui-monospace, Consolas, monospace;

	--ok-bg: #eefaf0;
	--ok-line: #bfe8c8;
	--ok-ink: #1c7a34;
	--warn-bg: #fff7e8;
	--warn-line: #f5dca8;
	--warn-ink: #8a5800;
	--danger-bg: #fdecec;
	--danger-line: #f4c7c9;
	--danger-ink: #a3121a;
	--info-bg: #eef3fb;
	--info-line: #cddcf1;
	--info-ink: #24589b;
}

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

html {
	-webkit-text-size-adjust: 100%
}

body {
	font-family: var(--font);
	color: var(--ink);
	background: var(--bg-soft);
	line-height: 1.6;
	overflow-x: hidden;
	min-height: 100vh;
	display: flex;
	flex-direction: column
}

img,
svg {
	max-width: 100%;
	display: block
}

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

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible {
	outline: 3px solid rgba(224, 27, 34, .45);
	outline-offset: 2px
}

ul {
	list-style: none
}

[hidden] {
	display: none !important
}

.container {
	width: min(1180px, 92%);
	margin-inline: auto
}

.skip-link {
	position: absolute;
	left: 1rem;
	top: -3rem;
	z-index: 200;
	background: var(--ink);
	color: #fff;
	padding: .5rem 1rem;
	border-radius: 10px;
	font-weight: 600
}

.skip-link:focus {
	top: 1rem
}

.sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap
}

/* ---------- Topbar ---------- */
.topbar {
	background: var(--ink);
	color: #fff;
	font-size: .83rem
}

.topbar .container {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	padding: .45rem 0
}

.topbar .left {
	display: flex;
	gap: 1.4rem;
	flex-wrap: wrap
}

.topbar a {
	display: flex;
	align-items: center;
	gap: .4rem;
	color: #f2e9ea;
	transition: color .2s
}

.topbar a:hover {
	color: var(--red-bright)
}

.topbar .tag {
	color: #c9b8bb;
	display: flex;
	align-items: center;
	gap: .4rem;
	min-width: 0
}

.topbar .tag span {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap
}

.topbar svg {
	width: 14px;
	height: 14px;
	flex: none
}

@media(max-width:640px) {
	.topbar .tag,
	.topbar .hide-sm {
		display: none
	}
}

/* ---------- Header ---------- */
.site-header {
	position: sticky;
	top: 0;
	z-index: 100;
	border-bottom: 1px solid transparent;
	transition: box-shadow .3s, border-color .3s
}

/* El fondo translúcido va en un pseudo-elemento: un backdrop-filter en el
   propio header haría que el menú móvil (position: fixed) quedara contenido
   en el header en vez de en la ventana. */
.site-header::before {
	content: "";
	position: absolute;
	inset: 0;
	z-index: -1;
	background: rgba(255, 255, 255, .92);
	backdrop-filter: blur(12px);
	-webkit-backdrop-filter: blur(12px)
}

.site-header.scrolled {
	box-shadow: 0 8px 30px -12px rgba(28, 17, 20, .18);
	border-color: var(--line)
}

.nav {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1.5rem;
	padding: .7rem 0
}

.brand {
	display: flex;
	align-items: center;
	gap: .9rem;
	flex: none
}

.brand svg {
	height: 44px;
	width: auto
}

.brand-tag {
	font-family: var(--mono);
	font-size: .68rem;
	font-weight: 600;
	letter-spacing: .14em;
	text-transform: uppercase;
	color: var(--red);
	border-left: 1.5px solid var(--line);
	padding-left: .9rem;
	line-height: 1.3
}

nav.menu {
	display: flex;
	align-items: center;
	gap: 1.6rem;
	font-weight: 500;
	font-size: .98rem;
	margin-left: auto
}

nav.menu > a {
	position: relative;
	display: flex;
	align-items: center;
	gap: .5rem;
	padding: .35rem 0;
	color: var(--ink-2);
	transition: color .2s;
	white-space: nowrap
}

nav.menu > a::after {
	content: "";
	position: absolute;
	left: 0;
	bottom: 0;
	width: 0;
	height: 2.5px;
	border-radius: 2px;
	background: var(--red);
	transition: width .25s
}

nav.menu > a:hover,
nav.menu > a.active {
	color: var(--red)
}

nav.menu > a:hover::after,
nav.menu > a.active::after {
	width: 100%
}

nav.menu > a svg {
	width: 18px;
	height: 18px;
	display: none
}

.menu-account {
	display: none
}

/* ---- grupos del menú (Historial, Administrar) ---- */
.menu-group {
	position: relative
}

.menu-toggle {
	position: relative;
	display: flex;
	align-items: center;
	gap: .5rem;
	padding: .35rem 0;
	background: none;
	border: 0;
	font: inherit;
	color: var(--ink-2);
	cursor: pointer;
	white-space: nowrap;
	transition: color .2s
}

.menu-toggle > svg {
	width: 18px;
	height: 18px;
	display: none
}

.menu-toggle .chev svg {
	display: block;
	width: 14px;
	height: 14px;
	transition: transform .2s
}

.menu-toggle::after {
	content: "";
	position: absolute;
	left: 0;
	bottom: 0;
	width: 0;
	height: 2.5px;
	border-radius: 2px;
	background: var(--red);
	transition: width .25s
}

.menu-toggle:hover,
.menu-group.active .menu-toggle,
.menu-group.open .menu-toggle {
	color: var(--red)
}

.menu-group.active .menu-toggle::after {
	width: 100%
}

.menu-group.open .menu-toggle .chev svg {
	transform: rotate(180deg)
}

.submenu {
	display: none;
	position: absolute;
	left: -1rem;
	top: calc(100% + .9rem);
	min-width: 310px;
	background: #fff;
	border: 1px solid var(--line);
	border-radius: 16px;
	box-shadow: var(--shadow);
	padding: .5rem;
	z-index: 110
}

/* Puente invisible para que el hover no se corte entre el botón y el panel. */
.submenu::before {
	content: "";
	position: absolute;
	left: 0;
	right: 0;
	top: -1rem;
	height: 1rem
}

.submenu-right {
	left: auto;
	right: -1rem
}

.menu-group.open .submenu {
	display: block
}

@media (hover: hover) and (min-width: 1101px) {
	.menu-group:hover .submenu {
		display: block
	}
}

.submenu a {
	display: flex;
	align-items: flex-start;
	gap: .8rem;
	padding: .7rem .8rem;
	border-radius: 12px;
	color: var(--ink-2)
}

.submenu a > svg {
	width: 20px;
	height: 20px;
	flex: none;
	margin-top: .1rem;
	color: var(--red)
}

.submenu a b {
	display: block;
	font-weight: 600;
	color: var(--ink)
}

.submenu a small {
	display: block;
	font-size: .8rem;
	color: var(--gray);
	font-weight: 400;
	line-height: 1.35
}

.submenu a:hover,
.submenu a.active {
	background: var(--red-soft)
}

@media(max-width:1100px) {
	.menu-group {
		width: 100%;
		border-bottom: 1px solid var(--line)
	}

	.menu-toggle {
		width: 100%;
		font-size: 1.1rem;
		padding: .8rem .2rem
	}

	.menu-toggle::after {
		display: none
	}

	.menu-toggle > svg {
		display: block;
		color: var(--red)
	}

	.menu-toggle .chev {
		margin-left: auto
	}

	.menu-group.active .menu-toggle {
		font-weight: 600
	}

	.submenu,
	.submenu-right {
		position: static;
		min-width: 0;
		border: 0;
		box-shadow: none;
		padding: 0 0 .6rem 1.4rem
	}

	.submenu::before {
		display: none
	}

	.submenu a {
		padding: .55rem .6rem
	}

	.submenu a small {
		display: none
	}
}

.nav-actions {
	display: flex;
	align-items: center;
	gap: .6rem;
	flex: none
}

/* Menú de usuario */
.user-menu {
	position: relative
}

.user-chip {
	display: flex;
	align-items: center;
	gap: .6rem;
	background: none;
	border: 1.5px solid var(--line);
	border-radius: 999px;
	padding: .3rem .8rem .3rem .3rem;
	font-family: var(--font);
	font-size: .92rem;
	color: var(--ink-2);
	cursor: pointer;
	transition: border-color .2s, box-shadow .2s
}

.user-chip:hover,
.user-chip[aria-expanded="true"] {
	border-color: #f4c7c9;
	box-shadow: 0 6px 18px -10px rgba(224, 27, 34, .45)
}

.user-chip b {
	color: var(--ink);
	font-weight: 600
}

.user-chip .chev {
	width: 14px;
	height: 14px;
	color: var(--gray);
	transition: transform .2s
}

.user-chip[aria-expanded="true"] .chev {
	transform: rotate(180deg)
}

.avatar {
	width: 34px;
	height: 34px;
	flex: none;
	border-radius: 50%;
	background: linear-gradient(135deg, var(--red-bright), var(--red-dark));
	color: #fff;
	display: grid;
	place-items: center;
	font-weight: 700;
	font-size: .95rem;
	text-transform: uppercase
}

.avatar.lg {
	width: 46px;
	height: 46px;
	font-size: 1.2rem
}

.dropdown {
	position: absolute;
	right: 0;
	top: calc(100% + .6rem);
	width: 290px;
	background: #fff;
	border: 1px solid var(--line);
	border-radius: 16px;
	box-shadow: var(--shadow);
	padding: 1.1rem;
	z-index: 110
}

.dropdown-head {
	display: flex;
	align-items: center;
	gap: .8rem;
	padding-bottom: 1rem;
	border-bottom: 1px solid var(--line)
}

.dropdown-head b {
	display: block;
	line-height: 1.3
}

.dropdown-head > div {
	min-width: 0
}

.dropdown-head > div > span {
	display: block;
	font-size: .85rem;
	color: var(--gray);
	word-break: break-all
}

.dropdown-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	padding: .9rem 0;
	font-size: .9rem;
	color: var(--ink-2)
}

/* Hamburguesa */
.hamburger {
	display: none;
	flex-direction: column;
	gap: 5px;
	background: none;
	border: 0;
	cursor: pointer;
	padding: .4rem
}

.hamburger span {
	width: 26px;
	height: 3px;
	border-radius: 3px;
	background: var(--red);
	transition: transform .3s, opacity .3s
}

.menu-backdrop {
	position: fixed;
	inset: 0;
	background: rgba(28, 17, 20, .35);
	z-index: 98;
	opacity: 0;
	pointer-events: none;
	transition: opacity .3s
}

.menu-backdrop.open {
	opacity: 1;
	pointer-events: auto
}

@media(max-width:1260px) {
	nav.menu {
		gap: 1.3rem
	}

	.user-chip .hello {
		display: none
	}

	.user-chip {
		padding-right: .6rem
	}
}

@media(max-width:1100px) {
	nav.menu {
		position: fixed;
		inset: 0 0 0 auto;
		width: min(320px, 84vw);
		background: #fff;
		flex-direction: column;
		align-items: stretch;
		justify-content: flex-start;
		gap: .2rem;
		padding: 5.5rem 1.6rem 2rem;
		box-shadow: -20px 0 60px rgba(28, 17, 20, .18);
		transform: translateX(110%);
		transition: transform .35s;
		z-index: 99;
		overflow-y: auto;
		visibility: hidden
	}

	nav.menu.open {
		transform: none;
		visibility: visible
	}

	nav.menu > a {
		font-size: 1.1rem;
		padding: .8rem .2rem;
		width: 100%;
		border-bottom: 1px solid var(--line)
	}

	nav.menu > a::after {
		display: none
	}

	nav.menu > a svg {
		display: block;
		color: var(--red)
	}

	nav.menu > a.active {
		font-weight: 600
	}

	.menu-account {
		display: block;
		margin-top: 1.6rem;
		padding: 1.1rem;
		border-radius: 14px;
		background: var(--bg-soft);
		border: 1px solid var(--line)
	}

	.menu-account .dropdown-head {
		border-bottom: 0;
		padding-bottom: .8rem
	}

	.menu-account .btn {
		margin-top: .4rem
	}

	.user-menu {
		display: none
	}

	.hamburger {
		display: flex;
		z-index: 100
	}

	.hamburger.open span:nth-child(1) {
		transform: translateY(8px) rotate(45deg)
	}

	.hamburger.open span:nth-child(2) {
		opacity: 0
	}

	.hamburger.open span:nth-child(3) {
		transform: translateY(-8px) rotate(-45deg)
	}
}

@media(max-width:480px) {
	.brand svg {
		height: 38px
	}

	.brand-tag {
		display: none
	}
}

/* ---------- Botones ---------- */
.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: .55rem;
	padding: .78rem 1.6rem;
	border-radius: 999px;
	font-weight: 600;
	font-size: .95rem;
	line-height: 1.3;
	border: 2px solid transparent;
	cursor: pointer;
	transition: transform .2s, box-shadow .2s, background .2s, color .2s, border-color .2s;
	font-family: var(--font);
	text-align: center;
	white-space: nowrap
}

.btn svg {
	width: 16px;
	height: 16px;
	flex: none
}

.btn-red {
	background: linear-gradient(135deg, var(--red-bright), var(--red-dark));
	color: #fff;
	box-shadow: 0 10px 24px -8px rgba(224, 27, 34, .55)
}

.btn-red:hover {
	transform: translateY(-2px);
	box-shadow: 0 16px 30px -8px rgba(224, 27, 34, .6)
}

.btn-outline {
	border-color: var(--red);
	color: var(--red);
	background: #fff
}

.btn-outline:hover {
	background: var(--red);
	color: #fff
}

.btn-light {
	background: #fff;
	border-color: var(--line);
	color: var(--ink-2)
}

.btn-light:hover {
	border-color: #f4c7c9;
	color: var(--red)
}

.btn-ghost {
	background: transparent;
	border-color: rgba(255, 255, 255, .55);
	color: #fff
}

.btn-ghost:hover {
	background: rgba(255, 255, 255, .12)
}

.btn-sm {
	padding: .5rem 1.1rem;
	font-size: .88rem
}

.btn-lg {
	padding: .95rem 1.9rem;
	font-size: 1rem
}

.btn-block {
	display: flex;
	width: 100%
}

.btn-icon {
	width: 38px;
	height: 38px;
	padding: 0;
	border-radius: 12px
}

.btn-icon svg {
	width: 18px;
	height: 18px
}

.btn[disabled] {
	opacity: .55;
	pointer-events: none
}

/* ---------- Banda de título (hero compacto) ---------- */
.page-hero {
	position: relative;
	background: radial-gradient(900px 420px at 85% -20%, #8c1016 0%, transparent 60%), linear-gradient(150deg, #2a0c0f 0%, #4d0b10 45%, #8c1016 80%, #b3131a 100%);
	color: #fff;
	overflow: hidden
}

.page-hero::before,
.page-hero::after {
	content: "";
	position: absolute;
	border-radius: 50%;
	border: 1.5px solid rgba(255, 255, 255, .12);
	pointer-events: none
}

.page-hero::before {
	width: 340px;
	height: 340px;
	right: -90px;
	top: -170px
}

.page-hero::after {
	width: 220px;
	height: 220px;
	right: 120px;
	top: 40px
}

.page-hero .container {
	position: relative;
	z-index: 1;
	display: flex;
	align-items: flex-end;
	justify-content: space-between;
	gap: 1.5rem;
	flex-wrap: wrap;
	padding: 2.6rem 0 5.6rem
}

.page-hero .container > div:first-child {
	min-width: 0;
	max-width: 100%
}

.eyebrow {
	display: inline-flex;
	align-items: center;
	gap: .6rem;
	font-family: var(--mono);
	font-size: .74rem;
	letter-spacing: .18em;
	text-transform: uppercase;
	color: #ffb9bc;
	margin-bottom: .8rem;
	max-width: 100%
}

.eyebrow::before {
	content: "";
	width: 34px;
	height: 2px;
	flex: none;
	background: var(--red-bright)
}

.eyebrow span {
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap
}

.page-hero h1 {
	font-size: clamp(1.8rem, 3.6vw, 2.6rem);
	font-weight: 800;
	line-height: 1.12;
	letter-spacing: -.02em
}

.crumbs {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: .45rem;
	margin-top: .7rem;
	font-size: .9rem;
	color: #f4dfe0;
	font-weight: 300
}

.crumbs a {
	color: #fff;
	font-weight: 500;
	border-bottom: 1px solid rgba(255, 255, 255, .35);
	transition: border-color .2s
}

.crumbs a:hover {
	border-color: #fff
}

.crumbs .sep {
	color: #ff8f94
}

.page-hero .actions {
	display: flex;
	gap: .7rem;
	flex-wrap: wrap
}

.wave {
	position: absolute;
	bottom: -1px;
	left: 0;
	width: 100%;
	line-height: 0;
	pointer-events: none;
	color: var(--bg-soft)
}

.wave svg {
	width: 100%;
	height: 70px
}

/* ---------- Contenido ---------- */
.page-body {
	position: relative;
	z-index: 5;
	margin-top: -3.4rem;
	padding-bottom: 4.5rem;
	flex: 1
}

.stack-gap > * + * {
	margin-top: 1.6rem
}

.kicker {
	display: inline-flex;
	align-items: center;
	gap: .55rem;
	color: var(--red);
	font-family: var(--mono);
	font-size: .72rem;
	font-weight: 600;
	letter-spacing: .16em;
	text-transform: uppercase;
	margin-bottom: .35rem
}

.kicker::before {
	content: "//"
}

/* Tarjeta */
.panel {
	background: #fff;
	border: 1px solid var(--line);
	border-radius: var(--radius);
	box-shadow: var(--shadow-soft);
	position: relative;
	/* Que el header fijo no tape la tarjeta al llegar por un ancla (#configuracion). */
	scroll-margin-top: 6.5rem
}

.panel-head {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 1rem;
	flex-wrap: wrap;
	padding: 1.7rem 1.9rem 0
}

.panel-head h2 {
	font-size: clamp(1.2rem, 2vw, 1.4rem);
	font-weight: 800;
	letter-spacing: -.01em;
	line-height: 1.25
}

.panel-head p {
	color: var(--gray);
	font-size: .93rem;
	margin-top: .3rem;
	max-width: 46rem
}

.panel-body {
	padding: 1.5rem 1.9rem 1.9rem
}

.panel-foot {
	display: flex;
	align-items: center;
	justify-content: flex-end;
	gap: 1rem;
	flex-wrap: wrap;
	padding: 1.2rem 1.9rem;
	border-top: 1px solid var(--line);
	background: var(--bg-soft);
	border-radius: 0 0 var(--radius) var(--radius)
}

.panel-foot .note {
	margin-right: auto;
	color: var(--gray);
	font-size: .88rem
}

.panel-narrow {
	max-width: 640px;
	margin-inline: auto
}

h3.sub-title {
	display: flex;
	align-items: center;
	gap: .6rem;
	font-size: 1.02rem;
	font-weight: 700;
	margin-bottom: 1rem
}

h3.sub-title .ico {
	width: 34px;
	height: 34px;
	border-radius: 10px;
	background: linear-gradient(135deg, #fdecec, #fbd9da);
	color: var(--red);
	display: grid;
	place-items: center;
	flex: none
}

h3.sub-title .ico svg {
	width: 18px;
	height: 18px
}

.grid-2 {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 2rem 2.6rem
}

.grid-2 .full {
	grid-column: 1/-1
}

@media(max-width:860px) {
	.grid-2 {
		grid-template-columns: 1fr
	}

	.panel-head {
		padding: 1.4rem 1.3rem 0
	}

	.panel-body {
		padding: 1.3rem 1.3rem 1.5rem
	}

	.panel-foot {
		padding: 1rem 1.3rem
	}
}

.divider {
	height: 1px;
	background: var(--line);
	border: 0
}

/* Lista de datos (dt/dd) */
.facts {
	display: grid;
	grid-template-columns: minmax(110px, 40%) 1fr;
	border-top: 1px solid var(--line)
}

.facts dt,
.facts dd {
	padding: .75rem 0;
	border-bottom: 1px solid var(--line);
	font-size: .95rem
}

.facts dt {
	color: var(--gray);
	font-weight: 500;
	padding-right: 1rem
}

.facts dd {
	color: var(--ink);
	font-weight: 500;
	min-width: 0;
	overflow-wrap: anywhere
}

/* ---------- Estadísticas ---------- */
.stats-grid {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	background: #fff;
	border-radius: var(--radius);
	box-shadow: var(--shadow);
	overflow: hidden;
	border: 1px solid var(--line)
}

.stat {
	padding: 1.7rem 1.4rem;
	text-align: center;
	border-left: 1px solid var(--line)
}

.stat:first-child {
	border-left: 0
}

.stat b {
	display: block;
	font-size: 2.2rem;
	font-weight: 800;
	color: var(--red);
	letter-spacing: -.02em;
	line-height: 1.2
}

.stat span {
	display: block;
	font-size: .9rem;
	line-height: 1.4;
	color: var(--gray)
}

.stat .dot {
	display: inline-block;
	width: 8px;
	height: 8px;
	border-radius: 50%;
	margin-right: .45rem;
	vertical-align: .08em
}

.dot-ok {
	background: #2fb556
}

.dot-warn {
	background: #e5a118
}

@media(max-width:760px) {
	.stats-grid {
		grid-template-columns: repeat(2, 1fr)
	}

	.stat:nth-child(3) {
		border-left: 0
	}

	.stat:nth-child(n+3) {
		border-top: 1px solid var(--line)
	}

	.stat {
		padding: 1.3rem 1rem
	}

	.stat b {
		font-size: 1.8rem
	}
}

/* ---------- Tablas ---------- */
.table-wrap {
	overflow-x: auto;
	-webkit-overflow-scrolling: touch
}

table.data {
	width: 100%;
	border-collapse: collapse;
	font-size: .95rem
}

table.data th {
	font-family: var(--mono);
	font-size: .7rem;
	font-weight: 600;
	letter-spacing: .12em;
	text-transform: uppercase;
	color: var(--gray);
	text-align: left;
	padding: .75rem 1rem;
	border-bottom: 1.5px solid var(--line);
	white-space: nowrap
}

table.data td {
	padding: .95rem 1rem;
	border-bottom: 1px dashed var(--line);
	vertical-align: middle;
	color: var(--ink-2)
}

table.data th:first-child,
table.data td:first-child {
	padding-left: .2rem
}

table.data th:last-child,
table.data td:last-child {
	padding-right: .2rem
}

table.data tbody tr:last-child td {
	border-bottom: 0
}

table.data tbody tr:not(.empty):hover td {
	background: var(--bg-soft)
}

table.data .t-end {
	text-align: right
}

.t-strong {
	font-weight: 600;
	color: var(--ink)
}

.t-muted {
	color: var(--gray)
}

.t-mono {
	font-family: var(--mono);
	font-size: .85rem;
	letter-spacing: .02em
}

table.data tr.empty td {
	text-align: center;
	color: var(--gray);
	padding: 2.6rem 1rem
}

.empty-state {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: .7rem
}

.empty-state svg {
	width: 40px;
	height: 40px;
	color: #f0c7c9
}

/* En el teléfono cada fila pasa a ser una tarjeta con su etiqueta. */
@media(max-width:720px) {
	table.data.stack thead {
		display: none
	}

	table.data.stack,
	table.data.stack tbody,
	table.data.stack tr,
	table.data.stack td {
		display: block;
		width: 100%
	}

	table.data.stack tr {
		border: 1px solid var(--line);
		border-radius: 14px;
		padding: .3rem 1rem;
		margin-bottom: .8rem;
		background: #fff
	}

	table.data.stack tr:last-child {
		margin-bottom: 0
	}

	/* La etiqueta va a la izquierda en posición absoluta: el contenido de la
	   celda sigue fluyendo en línea (texto + badges) alineado a la derecha. */
	table.data.stack td,
	table.data.stack td:first-child,
	table.data.stack td:last-child {
		position: relative;
		min-height: 2.9rem;
		padding: .65rem 0 .65rem 38%;
		text-align: right;
		border-bottom: 1px dashed var(--line);
		overflow-wrap: anywhere
	}

	table.data.stack td:last-child {
		border-bottom: 0
	}

	table.data.stack td::before {
		content: attr(data-label);
		position: absolute;
		left: 0;
		top: 50%;
		transform: translateY(-50%);
		max-width: 36%;
		font-family: var(--mono);
		font-size: .68rem;
		font-weight: 600;
		letter-spacing: .1em;
		text-transform: uppercase;
		color: var(--gray);
		text-align: left
	}

	table.data.stack tbody tr:not(.empty):hover td {
		background: none
	}

	table.data.stack tr.empty {
		border-style: dashed
	}

	table.data.stack tr.empty td {
		text-align: center;
		padding: 1.6rem 0
	}

	table.data.stack tr.empty td::before {
		content: none
	}
}

/* ---------- Badges ---------- */
.badge {
	display: inline-flex;
	align-items: center;
	gap: .4rem;
	padding: .25rem .75rem;
	border-radius: 999px;
	font-size: .78rem;
	font-weight: 600;
	line-height: 1.35;
	border: 1px solid var(--line);
	background: var(--bg-soft);
	color: var(--gray);
	white-space: nowrap
}

.badge::before {
	content: "";
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: currentColor;
	flex: none
}

.badge-plain::before {
	content: none
}

/* En la cabecera de una tarjeta el badge puede traer textos largos (estado de sincronización). */
.panel-head .badge {
	white-space: normal;
	max-width: 100%
}

.badge-ok {
	background: var(--ok-bg);
	border-color: var(--ok-line);
	color: var(--ok-ink)
}

.badge-warn {
	background: var(--warn-bg);
	border-color: var(--warn-line);
	color: var(--warn-ink)
}

.badge-danger {
	background: var(--danger-bg);
	border-color: var(--danger-line);
	color: var(--danger-ink)
}

.badge-info {
	background: var(--info-bg);
	border-color: var(--info-line);
	color: var(--info-ink)
}

.badge-red {
	background: var(--red-soft);
	border-color: #f4c7c9;
	color: var(--red-dark)
}

.count {
	display: inline-grid;
	place-items: center;
	min-width: 2rem;
	height: 2rem;
	padding: 0 .5rem;
	border-radius: 10px;
	background: linear-gradient(135deg, #fdecec, #fbd9da);
	color: var(--red-dark);
	font-weight: 700;
	font-size: .9rem
}

/* ---------- Avisos (mensajes de Django) ---------- */
.alerts {
	display: grid;
	gap: .8rem;
	margin-bottom: 1.6rem
}

.alert {
	display: flex;
	align-items: flex-start;
	gap: .8rem;
	padding: .95rem 1.1rem;
	border-radius: 14px;
	border: 1px solid var(--line);
	background: #fff;
	color: var(--ink-2);
	font-size: .94rem;
	font-weight: 500;
	box-shadow: var(--shadow-soft)
}

.alert > svg {
	width: 20px;
	height: 20px;
	flex: none;
	margin-top: .1rem
}

.alert .alert-text {
	flex: 1;
	min-width: 0
}

.alert .alert-text b {
	display: block
}

.alert-success {
	background: var(--ok-bg);
	border-color: var(--ok-line);
	color: var(--ok-ink)
}

.alert-danger,
.alert-error {
	background: var(--danger-bg);
	border-color: var(--danger-line);
	color: var(--danger-ink)
}

.alert-warning {
	background: var(--warn-bg);
	border-color: var(--warn-line);
	color: var(--warn-ink)
}

.alert-info,
.alert-debug {
	background: var(--info-bg);
	border-color: var(--info-line);
	color: var(--info-ink)
}

.alert-close {
	flex: none;
	width: 28px;
	height: 28px;
	margin: -.2rem -.3rem -.2rem 0;
	display: grid;
	place-items: center;
	border: 0;
	border-radius: 8px;
	background: transparent;
	color: inherit;
	cursor: pointer;
	opacity: .7;
	transition: opacity .2s, background .2s
}

.alert-close:hover {
	opacity: 1;
	background: rgba(0, 0, 0, .06)
}

.alert-close svg {
	width: 16px;
	height: 16px
}

/* ---------- Formularios ---------- */
.field + .field {
	margin-top: 1.2rem
}

.field label,
.field .label {
	display: block;
	font-size: .85rem;
	font-weight: 600;
	margin-bottom: .35rem;
	color: var(--ink-2)
}

.field .req {
	color: var(--red)
}

.field input:not([type=checkbox]):not([type=radio]),
.field textarea,
.field select {
	width: 100%;
	padding: .85rem 1rem;
	border: 1.5px solid var(--line);
	border-radius: 12px;
	font-family: var(--font);
	font-size: .95rem;
	color: var(--ink);
	background: var(--bg-soft);
	transition: border-color .2s, box-shadow .2s, background .2s;
	outline: none;
	appearance: none;
	-webkit-appearance: none
}

.field select {
	padding-right: 2.6rem;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23e01b22' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 1rem center;
	background-size: 16px
}

.field input:not([type=checkbox]):not([type=radio]):focus,
.field textarea:focus,
.field select:focus {
	border-color: var(--red);
	box-shadow: 0 0 0 4px rgba(224, 27, 34, .12);
	background-color: #fff
}

.field input::placeholder {
	color: #a8999d
}

.field input:disabled,
.field select:disabled {
	opacity: .65;
	cursor: not-allowed
}

.field.has-error input:not([type=checkbox]),
.field.has-error select {
	border-color: #e88b8f;
	background-color: #fff
}

.field-error {
	margin-top: .4rem;
	color: var(--danger-ink);
	font-size: .85rem;
	font-weight: 500
}

.field-help {
	margin-top: .4rem;
	color: var(--gray);
	font-size: .82rem
}

.form-note {
	font-size: .85rem;
	color: var(--gray)
}

.input-lg {
	font-size: 1.05rem !important;
	padding: 1rem 1.1rem !important
}

.code-input {
	font-family: var(--mono) !important;
	font-size: clamp(1.4rem, 6vw, 2rem) !important;
	font-weight: 600;
	letter-spacing: .22em;
	text-align: center;
	text-transform: uppercase
}

/* Contraseña con botón para mostrarla */
.password-field {
	position: relative
}

.password-field input {
	padding-right: 3.4rem !important
}

.password-field [data-password-toggle] {
	position: absolute;
	top: 50%;
	right: .5rem;
	transform: translateY(-50%);
	width: 38px;
	height: 38px;
	border: 0;
	border-radius: 10px;
	background: transparent;
	color: var(--gray);
	display: grid;
	place-items: center;
	cursor: pointer;
	transition: color .2s, background .2s
}

.password-field [data-password-toggle]:hover {
	color: var(--red);
	background: var(--red-soft)
}

.password-field [data-password-toggle] svg {
	width: 20px;
	height: 20px
}

.password-field [data-password-toggle] .eye-off,
.password-field [data-password-toggle][aria-pressed="true"] .eye {
	display: none
}

.password-field [data-password-toggle][aria-pressed="true"] .eye-off {
	display: block
}

/* Interruptores (checkbox role=switch) */
.switch-list {
	display: grid;
	gap: .7rem
}

.switch-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	padding: .85rem 1rem;
	border: 1px solid var(--line);
	border-radius: 14px;
	background: var(--bg-soft);
	cursor: pointer;
	transition: border-color .2s, background .2s
}

.switch-row:hover {
	border-color: #f4c7c9;
	background: #fff
}

.switch-row .switch-text {
	min-width: 0
}

.switch-row .switch-text b {
	display: block;
	font-size: .94rem;
	font-weight: 600;
	color: var(--ink)
}

.switch-row .switch-text small {
	display: block;
	font-size: .82rem;
	color: var(--gray);
	line-height: 1.45;
	margin-top: .15rem
}

.switch-row input[type=checkbox] {
	appearance: none;
	-webkit-appearance: none;
	flex: none;
	width: 48px;
	height: 28px;
	border-radius: 999px;
	border: 0;
	background-color: #dccfd2;
	background-image: radial-gradient(circle, #fff 0, #fff 10px, transparent 11px);
	background-size: 28px 28px;
	background-repeat: no-repeat;
	background-position: left center;
	cursor: pointer;
	transition: background-color .2s, background-position .2s, box-shadow .2s
}

.switch-row input[type=checkbox]:checked {
	background-color: var(--red);
	background-position: right center
}

.switch-row input[type=checkbox]:focus-visible {
	box-shadow: 0 0 0 4px rgba(224, 27, 34, .2);
	outline: none
}

.switch-row.is-disabled {
	cursor: not-allowed;
	opacity: .7
}

.switch-row.is-disabled:hover {
	border-color: var(--line);
	background: var(--bg-soft)
}

.switch-row input[type=checkbox]:disabled {
	cursor: not-allowed
}

.form-row {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 1rem
}

.form-row .field + .field {
	margin-top: 0
}

/* Etiquetas de distinto largo: los campos quedan alineados abajo. */
.form-row .field {
	display: flex;
	flex-direction: column
}

.form-row .field > label {
	flex: 1 0 auto
}

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

/* ---------- Pie ---------- */
.site-footer {
	background: var(--bg-dark);
	color: #cbbdbf
}

.foot-grid {
	display: grid;
	grid-template-columns: 1.5fr 1fr 1.2fr;
	gap: 2.5rem;
	padding: 3.4rem 0 2.6rem
}

.foot-grid h4 {
	color: #fff;
	font-size: 1rem;
	font-weight: 700;
	margin-bottom: 1.1rem
}

.foot-grid p {
	font-size: .92rem;
	font-weight: 300;
	max-width: 24rem
}

.foot-grid ul {
	display: grid;
	gap: .55rem;
	font-size: .93rem
}

.foot-grid ul a {
	transition: color .2s
}

.foot-grid ul a:hover {
	color: var(--red-bright)
}

.foot-brand svg {
	height: 46px;
	width: auto;
	margin-bottom: 1rem
}

.foot-contact {
	gap: .8rem !important
}

.foot-contact li,
.foot-contact a {
	display: flex;
	gap: .7rem;
	align-items: flex-start;
	font-size: .92rem
}

.foot-contact svg {
	width: 16px;
	height: 16px;
	flex: none;
	margin-top: .25rem;
	color: var(--red-bright)
}

.copyright {
	border-top: 1px solid rgba(255, 255, 255, .1);
	padding: 1.3rem 0;
	font-size: .83rem;
	display: flex;
	justify-content: space-between;
	gap: 1rem;
	flex-wrap: wrap;
	color: #9d8d90
}

.copyright b {
	color: #fff;
	font-weight: 600
}

@media(max-width:860px) {
	.foot-grid {
		grid-template-columns: 1fr 1fr
	}

	.foot-brand {
		grid-column: 1/-1
	}
}

@media(max-width:560px) {
	.foot-grid {
		grid-template-columns: 1fr;
		gap: 2rem;
		padding: 2.6rem 0 2rem
	}
}

/* ---------- Acceso (login y recuperación) ---------- */
.auth {
	flex: 1;
	display: grid;
	grid-template-columns: 1.05fr .95fr;
	min-height: 100vh
}

.auth-side {
	position: relative;
	overflow: hidden;
	color: #fff;
	background: radial-gradient(900px 600px at 90% -10%, #8c1016 0%, transparent 60%), linear-gradient(150deg, #2a0c0f 0%, #4d0b10 45%, #8c1016 80%, #b3131a 100%);
	display: flex;
	flex-direction: column;
	justify-content: space-between;
	gap: 2.5rem;
	padding: 3rem clamp(2rem, 5vw, 4.5rem)
}

.auth-side::before,
.auth-side::after {
	content: "";
	position: absolute;
	border-radius: 50%;
	border: 1.5px solid rgba(255, 255, 255, .12);
	pointer-events: none
}

.auth-side::before {
	width: 460px;
	height: 460px;
	right: -160px;
	bottom: -140px
}

.auth-side::after {
	width: 280px;
	height: 280px;
	right: -40px;
	bottom: -30px
}

.auth-side > * {
	position: relative;
	z-index: 1
}

.auth-side .brand svg {
	height: 52px
}

.auth-side h1 {
	font-size: clamp(2rem, 3.6vw, 3rem);
	font-weight: 800;
	line-height: 1.08;
	letter-spacing: -.02em;
	max-width: 30rem
}

.auth-side h1 .hl {
	background: linear-gradient(120deg, #ffd6d8, #ff8f94);
	-webkit-background-clip: text;
	background-clip: text;
	color: transparent
}

.auth-side .lead {
	margin-top: 1.2rem;
	font-size: 1.08rem;
	color: #f4dfe0;
	max-width: 30rem;
	font-weight: 300
}

.chips {
	display: flex;
	gap: .6rem;
	flex-wrap: wrap;
	margin-top: 2rem
}

.chip {
	display: inline-flex;
	align-items: center;
	gap: .45rem;
	font-size: .83rem;
	font-weight: 500;
	padding: .42rem .95rem;
	border-radius: 999px;
	background: rgba(255, 255, 255, .1);
	border: 1px solid rgba(255, 255, 255, .22)
}

.chip svg {
	width: 14px;
	height: 14px
}

.auth-side .back-site {
	display: inline-flex;
	align-items: center;
	gap: .5rem;
	font-size: .9rem;
	color: #f4dfe0;
	transition: color .2s
}

.auth-side .back-site:hover {
	color: #fff
}

.auth-side .back-site svg {
	width: 16px;
	height: 16px
}

.auth-main {
	display: flex;
	flex-direction: column;
	justify-content: center;
	align-items: center;
	padding: 3rem 1.5rem;
	background: var(--bg-soft)
}

.auth-card {
	width: min(460px, 100%);
	background: #fff;
	border: 1px solid var(--line);
	border-radius: var(--radius);
	box-shadow: var(--shadow);
	padding: clamp(1.6rem, 4vw, 2.6rem)
}

.auth-card .auth-head {
	margin-bottom: 1.6rem
}

.auth-card h2 {
	font-size: clamp(1.5rem, 3vw, 1.85rem);
	font-weight: 800;
	letter-spacing: -.02em;
	line-height: 1.15
}

.auth-card .auth-head p {
	color: var(--gray);
	margin-top: .5rem;
	font-size: .95rem
}

.auth-card .alerts {
	margin-bottom: 1.3rem
}

.auth-card .alert {
	box-shadow: none
}

.auth-links {
	display: flex;
	justify-content: flex-end;
	margin: .7rem 0 1.5rem
}

.link {
	color: var(--red);
	font-weight: 600;
	font-size: .9rem;
	border-bottom: 1px solid transparent;
	transition: border-color .2s
}

.link:hover {
	border-color: currentColor
}

.field + .btn-block {
	margin-top: 1.6rem
}

.auth-actions {
	display: grid;
	gap: .7rem;
	margin-top: 1.6rem
}

.auth-foot {
	margin-top: 1.6rem;
	font-size: .82rem;
	color: var(--gray);
	text-align: center
}

.auth-foot a {
	color: var(--ink-2);
	font-weight: 500
}

.auth-foot a:hover {
	color: var(--red)
}

.result-icon {
	width: 64px;
	height: 64px;
	border-radius: 18px;
	display: grid;
	place-items: center;
	margin-bottom: 1.2rem;
	background: linear-gradient(135deg, var(--red-bright), var(--red-dark));
	color: #fff;
	box-shadow: 0 12px 24px -8px rgba(224, 27, 34, .5)
}

.result-icon svg {
	width: 30px;
	height: 30px
}

.result-icon.muted {
	background: linear-gradient(135deg, #fdecec, #fbd9da);
	color: var(--red);
	box-shadow: none
}

@media(max-width:920px) {
	.auth {
		grid-template-columns: 1fr;
		min-height: 0
	}

	.auth-side {
		padding: 1.6rem 6% 4.2rem;
		gap: 1.4rem
	}

	.auth-side .brand svg {
		height: 42px
	}

	.auth-side h1 {
		font-size: clamp(1.6rem, 6.5vw, 2.2rem)
	}

	.auth-side .lead {
		font-size: .98rem;
		margin-top: .8rem
	}

	.auth-side .chips,
	.auth-side .back-site {
		display: none
	}

	.auth-main {
		justify-content: flex-start;
		padding: 0 4% 3rem;
		margin-top: -2.6rem;
		background: transparent;
		position: relative;
		z-index: 2
	}

	body.auth-body {
		background: var(--bg-soft)
	}
}

/* ---------- Utilidades ---------- */
.mt-0 {
	margin-top: 0 !important
}

.mt-1 {
	margin-top: .5rem
}

.mt-2 {
	margin-top: 1rem
}

.mt-3 {
	margin-top: 1.6rem
}

.mb-2 {
	margin-bottom: 1rem
}

.text-center {
	text-align: center
}

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