/* ═══════════════════════════════════════════════════════════════════
   SHELL — sidebar, content frame, mobile navigation, global loader
   ═══════════════════════════════════════════════════════════════════ */

/* ── Sidebar ────────────────────────────────────────────────────────── */

.header-principal {
	width: var(--nav-w);
	min-width: var(--nav-w);
	padding: 14px 0 26px;
	background: linear-gradient(180deg, var(--nav-900) 0%, var(--nav-800) 100%);
	border-right: 1px solid var(--nav-line);
	color: var(--nav-ink);
	z-index: 100;
}

.header-principal::-webkit-scrollbar { width: 6px; }
.header-principal::-webkit-scrollbar-track { background: transparent; }
.header-principal::-webkit-scrollbar-thumb {
	background: rgba(255,255,255,.14);
	border-radius: var(--r-pill);
}
.header-principal::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.26); }

.header-principal figure.logo {
	margin: 10px 0 18px;
	padding: 0 18px 18px;
	text-align: center;
	border-bottom: 1px solid var(--nav-line);
}

.header-principal figure.logo img {
	max-width: 100%;
	height: auto;
	transition: opacity var(--dur-2) var(--ease-out);
}

.header-principal figure.logo a:hover img { opacity: .82; }


/* ── Sidebar navigation ─────────────────────────────────────────────── */

.nav-principal ul {
	font-size: var(--fs-md);
	margin: 6px 0;
	font-weight: 500;
}

/* Pill-shaped rows, inset from the panel edge. The 8px inset is what
   turns the old full-bleed bars into discrete items. */
.nav-principal ul li a {
	display: flex;
	align-items: center;
	gap: 10px;
	margin: 1px 8px;
	padding: 9px 12px;
	border-radius: var(--r-md);
	color: var(--nav-ink-soft);
	line-height: 1.35;
	position: relative;
	transition: background-color var(--dur-1) var(--ease-out),
	            color var(--dur-1) var(--ease-out);
}

.nav-principal ul li i {
	margin-right: 0;
	width: calc(var(--icon-md) + 4px);   /* tracks the icon size, incl. "Texto grande" */
	flex-shrink: 0;
	font-size: var(--icon-md);
	text-align: center;
	opacity: .85;
	transition: transform var(--dur-1) var(--ease-out), opacity var(--dur-1) var(--ease-out);
}

.nav-principal ul li a:hover {
	background: var(--nav-hover);
	color: var(--nav-ink);
}

.nav-principal ul li a:hover i {
	transform: translateX(2px);
	opacity: 1;
}

/* Active item: solid brand pill + a left indicator bar.
   Replaces the CSS triangle that used to poke out of the right edge. */
.nav-principal ul li.active a,
.nav-principal ul li a.active:hover {
	background-image: var(--brand-fill);
	color: #fff;
	font-weight: 600;
	text-shadow: none;
	box-shadow: var(--brand-glow);
}

.nav-principal ul li.active a i { opacity: 1; }

/* Neutralise the old right-pointing triangle everywhere it used to land.
   The legacy selector matched every `a` under an active li, including the
   links nested in `.sub_ul`. */
.nav-principal ul li.active a:after {
	content: none;
}

/* Indicator bar, top-level items only. `.con-subnivel` is excluded because
   its `a::after` is the accordion chevron; overriding it would erase the
   chevron whenever the parent itself is the active page (e.g. Turnos). */
.nav-principal > ul > li.active:not(.con-subnivel) > a::after {
	content: '';
	position: absolute;
	left: -8px;
	top: 50%;
	transform: translateY(-50%);
	width: 3px;
	height: 18px;
	border: 0;
	border-radius: 0 var(--r-pill) var(--r-pill) 0;
	background: var(--accent-mint);
}

/* Section labels */
.navigation-li {
	margin: 20px 0 6px;
	padding: 0 20px;
	font-size: var(--fs-xs);
	font-weight: 700;
	letter-spacing: .08em;
	text-transform: uppercase;
	color: var(--nav-ink-mute);
}

.navigation-li:empty { margin: 14px 0 0; }


/* ── "Texto grande" switch (sidebar + mobile panel) ─────────────────── */
/* A <button>, not a link, so it can carry aria-pressed. Styled to sit in
   the menu like any other item, with a small switch at the end. The icon
   picks up `.nav-principal ul li i` sizing in the sidebar. */

.text-size-toggle {
	display: flex;
	align-items: center;
	gap: 10px;
	width: calc(100% - 16px);
	margin: 1px 8px;
	padding: 9px 12px;
	border: 0;
	border-radius: var(--r-md);
	background: transparent;
	color: var(--nav-ink-soft);
	font-family: var(--font-sans);
	font-size: inherit;
	font-weight: 500;
	line-height: 1.35;
	text-align: left;
	cursor: pointer;
	transition: background-color var(--dur-1) var(--ease-out),
	            color var(--dur-1) var(--ease-out);
}

.text-size-toggle:hover { background: var(--nav-hover); color: var(--nav-ink); }

.text-size-toggle:focus-visible { outline: 2px solid var(--accent-mint); outline-offset: 2px; }

.ts-switch {
	position: relative;
	flex-shrink: 0;
	width: 30px;
	height: 18px;
	margin-left: auto;
	border-radius: var(--r-pill);
	background: rgba(255,255,255,.18);
	transition: background-color var(--dur-2) var(--ease-out);
}

.ts-switch::after {
	content: '';
	position: absolute;
	top: 2px;
	left: 2px;
	width: 14px;
	height: 14px;
	border-radius: 50%;
	background: #fff;
	box-shadow: 0 1px 2px rgba(0,0,0,.3);
	transition: transform var(--dur-2) var(--ease-spring);
}

.text-size-toggle[aria-pressed="true"] { color: var(--nav-ink); }
.text-size-toggle[aria-pressed="true"] .ts-switch { background: var(--brand-solid); }
.text-size-toggle[aria-pressed="true"] .ts-switch::after { transform: translateX(12px); }

/* Mobile panel variant inherits .offcanvas-item's look */
.offcanvas-item.text-size-toggle { width: calc(100% - 16px); }


/* ── Sidebar accordion (Reportes, Turnos) ───────────────────────────── */

.con-subnivel > a::after {
	right: 16px;
	opacity: .55;
	transition: transform var(--dur-2) var(--ease-spring), opacity var(--dur-1) var(--ease-out);
}

.con-subnivel:hover > a::after { opacity: .9; }

.sub_ul {
	max-height: 0;
	overflow: hidden;
	opacity: 0;
	background: rgba(0,0,0,.22);
	border-left: 2px solid var(--brand-500);
	border-radius: 0 var(--r-sm) var(--r-sm) 0;
	margin: 2px 8px 4px 22px;
	transition: max-height var(--dur-3) var(--ease-out),
	            opacity var(--dur-2) var(--ease-out);
}

.con-subnivel.open > .sub_ul {
	max-height: 520px;
	opacity: 1;
}

/* Children fade in one after another once the panel is open */
.con-subnivel.open > .sub_ul > li {
	animation: ui-enter-sm var(--dur-2) var(--ease-out) backwards;
}
.con-subnivel.open > .sub_ul > li:nth-child(1) { animation-delay: 40ms; }
.con-subnivel.open > .sub_ul > li:nth-child(2) { animation-delay: 70ms; }
.con-subnivel.open > .sub_ul > li:nth-child(3) { animation-delay: 100ms; }
.con-subnivel.open > .sub_ul > li:nth-child(4) { animation-delay: 130ms; }
.con-subnivel.open > .sub_ul > li:nth-child(5) { animation-delay: 160ms; }
.con-subnivel.open > .sub_ul > li:nth-child(n+6) { animation-delay: 190ms; }

.sub_ul li a {
	padding: 7px 12px 7px 14px !important;   /* beats the legacy !important */
	font-size: var(--fs-sm) !important;
	margin: 1px 6px;
	opacity: 1;
	color: var(--nav-ink-soft);
}

.sub_ul li a:hover {
	background: var(--nav-hover) !important;
	color: var(--nav-ink);
}

.sub_ul li.active a {
	background-image: var(--brand-fill) !important;
	color: #fff;
}


/* ── Notification badge ─────────────────────────────────────────────── */

#notif-badge-nav,
.notif-badge-num {
	background: var(--danger);
	box-shadow: 0 0 0 2px var(--nav-900);
}

/* JS toggles .is-bumped when the count changes */
#notif-badge-nav.is-bumped,
#notif-badge-offcanvas.is-bumped {
	animation: ui-badge-pop var(--dur-3) var(--ease-spring);
}


/* ── Caja live widget (was inline in both layouts) ──────────────────── */

/* The widget's li also carries `.navigation-li` (a section label), so it
   inherits uppercase, tracking and muted colour. Reset them here so the
   deposit names read as names; the header row sets its own caps. */
.caja-widget {
	display: flex;
	flex-direction: column;
	margin: 0 8px 8px;
	padding: 0;
	text-transform: none;
	letter-spacing: normal;
	font-size: var(--fs-sm);
	font-weight: 500;
	color: var(--nav-ink);
	background: rgba(255,255,255,.04);
	border: 1px solid var(--nav-line);
	border-radius: var(--r-md);
	overflow: hidden;
}

.caja-widget__user {
	display: flex;
	align-items: center;
	gap: 7px;
	padding: 9px 12px;
	font-size: var(--fs-xs);
	font-weight: 700;
	letter-spacing: .04em;
	color: var(--nav-ink);
	text-transform: uppercase;
	cursor: pointer;
	user-select: none;
	white-space: nowrap;
	transition: background-color var(--dur-1) var(--ease-out);
}

.caja-widget__user:hover { background: rgba(255,255,255,.05); }

.caja-widget__user div.cw-dot {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: var(--accent-mint);
	box-shadow: 0 0 0 0 rgba(126,232,162,.6);
	animation: ui-pulse-ring 2s infinite;
	flex-shrink: 0;
}

.caja-widget__user .cw-chevron { display: none; }

.caja-widget__panel {
	display: none;
	background: rgba(0,0,0,.2);
	border-top: 1px solid var(--nav-line);
	padding: 4px 0;
}

.caja-widget__panel.open { display: block; }
.caja-widget__user.open .cw-chevron { transform: rotate(180deg); }

.cw-row {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 10px;
	padding: 6px 12px;
	font-size: var(--fs-xs);
	color: var(--nav-ink-soft);
	border-bottom: 1px solid rgba(255,255,255,.05);
}

.cw-row:last-child { border-bottom: none; }
.cw-row__info { display: flex; flex-direction: column; gap: 1px; }
.cw-row__deposito { font-weight: 600; font-size: var(--fs-xs); color: #fff; }
.cw-row__user     { font-size: var(--fs-xs); color: var(--nav-ink-mute); }
.cw-row__total    { font-weight: 700; font-size: var(--fs-sm); color: var(--accent-mint); white-space: nowrap; }

/* "Ver más (N)": link to the Caja section when the day has more cajas than the menu shows */
.cw-more {
	display: block;
	padding: 6px 12px;
	font-size: var(--fs-xs);
	font-weight: 600;
	color: var(--accent-mint);
	text-decoration: none;
	border-top: 1px solid rgba(255,255,255,.05);
}

.cw-more:hover,
.cw-more:focus-visible { color: #fff; text-decoration: underline; }

.offcanvas-caja-widget .cw-more { padding: 3px 0; border-top: none; }

.cw-footer {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 7px 12px;
	font-size: var(--fs-xs);
	font-weight: 700;
	color: #fff;
	border-top: 1px solid rgba(255,255,255,.12);
	background: rgba(0,0,0,.18);
}

.cw-footer__label {
	text-transform: uppercase;
	letter-spacing: .06em;
	font-size: var(--fs-xs);
	color: var(--nav-ink-mute);
}

.cw-footer__total { color: var(--accent-mint); font-size: var(--fs-md); }

.cw-empty {
	padding: 8px 12px;
	font-size: var(--fs-xs);
	color: var(--nav-ink-mute);
	font-style: italic;
}

/* Off-canvas variant */
.offcanvas-caja-widget .caja-widget__panel {
	display: block;
	width: 100%;
	padding: 4px 0;
	background: transparent;
	border: none;
}

.offcanvas-caja-widget .cw-mobile-item {
	display: block;
	font-size: var(--fs-sm);
	color: var(--nav-ink-soft);
	padding: 3px 0;
}

.offcanvas-caja-widget .cw-empty { padding: 4px 0; }


/* ── Content frame ──────────────────────────────────────────────────── */
/* The old shell stacked a 151px `.top-bar` in normal flow and then
   yanked the content back up with `top: -135px`. That made every
   vertical offset on the page a guess. The band is now a zero-height
   decorative backdrop, so the content box starts where it says it does. */

.top-bar {
	height: 0;
	opacity: 1;
	background: none;
	overflow: visible;
	position: relative;
	z-index: 0;
}

.top-bar::after {
	content: '';
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	height: 210px;
	background: var(--brand-fill-soft);
	-webkit-mask-image: linear-gradient(to bottom, rgba(0,0,0,.85), transparent);
	mask-image: linear-gradient(to bottom, rgba(0,0,0,.85), transparent);
	pointer-events: none;
	z-index: 0;
}

/* No z-index here on purpose. A z-index would make this a stacking
   context and trap every overlay rendered inside the content area (the
   WooCommerce modals at z 1000, the doc-modal and vuelto badge at z 9999)
   underneath the sidebar at z 100. Tree order already paints the content
   above the decorative band. */
.contenedor-principal {
	top: 0;
	padding: 30px 32px 90px calc(var(--nav-w) + 32px);
}

/* Page entrance.
   Headings slide up. Cards only fade: `.box` holds `.form-submit-cont`,
   which is position:fixed, and a transform on any ancestor turns that
   ancestor into the containing block for fixed children. The save and
   add buttons would render relative to the card and then jump to the
   viewport corner when the animation ended. Opacity has no such effect.
   `.menu-home` and `.home-widgets-row` are left out: ui-motion.js already
   reveals their children, and animating both levels doubles the motion. */
.contenedor-principal > h2,
.contenedor-principal > h3 {
	animation: ui-enter var(--dur-3) var(--ease-out) backwards;
}

.contenedor-principal > .box {
	animation: ui-fade var(--dur-3) var(--ease-out) backwards;
}

.contenedor-principal > *:nth-child(1) { animation-delay: 0ms; }
.contenedor-principal > *:nth-child(2) { animation-delay: 45ms; }
.contenedor-principal > *:nth-child(3) { animation-delay: 90ms; }
.contenedor-principal > *:nth-child(4) { animation-delay: 135ms; }


/* ── Inicio: banner fijo con el contenido deslizándose encima ───────── */
/* home.php shows `.header-home`, a fixed 200px brand banner at z 1, and
   tags the frame `.contenedor-principal-home` (z 2), so the cards scroll
   over the banner. Two things depend on that and must hold:

   1. The content has to start below the banner. It used to, by accident
      of the removed layout hack (151px `.top-bar` minus `top:-17px`, plus
      35px padding ≈ 169px). With the hack gone the cards opened at 30px
      and covered the banner and its logo animation from the first frame,
      so the offset is now explicit.
   2. Everything that scrolls across the banner must be opaque, or the
      teal banner shows through it. See `.fichas-bar` below. */

.header-home {
	/* Was `left: 85px; width: 100%`: it overflowed the viewport by 85px
	   and centred the logo off the content area's axis. */
	left: var(--nav-w);
	right: 0;
	width: auto;
	height: 200px;
	background-image: var(--brand-fill);
	z-index: 1;
}

@media (min-width: 769px) {
	.contenedor-principal.contenedor-principal-home {
		padding-top: 168px;
		z-index: 2;   /* keeps the cards above the fixed banner (estilos.css sets it too) */
	}
}

/* Open-records notice. Its 8%-alpha teal wash turned into teal-on-teal
   as it scrolled over the banner and the text vanished into the header.
   An opaque tint keeps the same "notice" read without any see-through. */
.fichas-bar {
	margin: 16px 0;
	padding: 13px 16px;
	background: var(--brand-50);
	border: 1px solid var(--brand-200);
	border-left: 3px solid var(--brand-500);
	border-radius: var(--r-md);
	box-shadow: var(--sh-1);
	color: var(--ink);
}

.fichas-bar strong {
	color: var(--brand-700);
	font-weight: 600;
}

.fichas-bar strong .fa { color: var(--brand-500); margin-right: 4px; }

.fichas-list { margin-top: 10px; gap: 8px; }

.ficha-pill {
	gap: 8px;
	padding: 6px 8px 6px 11px;
	background: var(--surface);
	border: 1px solid var(--line-strong);
	border-radius: var(--r-pill);
	font-size: var(--fs-md);
	box-shadow: var(--sh-1);
	animation: ui-pop var(--dur-2) var(--ease-spring) backwards;
}

.ficha-pill .fa-file-text-o { color: var(--brand-500); }

.ficha-pill-link,
.ficha-pill-liberar {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	margin-left: 0;
	padding: 3px 8px;
	border-radius: var(--r-pill);
	font-size: var(--fs-sm);
	font-weight: 600;
	text-decoration: none;
	transition: background-color var(--dur-1) var(--ease-out),
	            color var(--dur-1) var(--ease-out);
}

.ficha-pill-link { color: var(--brand-600); }
.ficha-pill-link:hover { background: var(--brand-50); }

.ficha-pill-liberar { color: var(--danger); }
.ficha-pill-liberar:hover { background: var(--danger-soft); }


/* ── Inicio: tarjetas de secciones (.menu-home) ─────────────────────── */
/* The lift lives on the li (which clips with overflow:hidden and owns
   the shadow); the border and colour live on the inner link. The entrance
   is ui-motion.js's reveal, an animation, so these transitions stay the
   card's own and aren't delayed by the cascade. */

.menu-home ul { gap: 14px; }

.menu-home li {
	border-radius: var(--r-lg);
	box-shadow: var(--sh-1);
	transition: transform var(--dur-2) var(--ease-out),
	            box-shadow var(--dur-2) var(--ease-out);
}

.menu-home li:hover {
	transform: translateY(-3px);
	box-shadow: var(--sh-3);
}

.menu-home li:active { transform: translateY(-1px); }

.menu-home li a {
	min-height: 164px;
	padding: 24px 14px 18px;
	background: var(--surface);
	border: 1px solid var(--line);
	border-radius: var(--r-lg);
	box-shadow: none;
	color: var(--ink);
	transition: color var(--dur-1) var(--ease-out),
	            border-color var(--dur-1) var(--ease-out),
	            background-color var(--dur-1) var(--ease-out);
}

.menu-home li:hover a {
	color: var(--brand-600);
	border-color: var(--brand-200);
	box-shadow: none;
}

.menu-home li:active a { background: var(--brand-50); }

/* The markup still asks for `fa-5x`; the icon becomes a 56px tile
   instead of a 52px glyph floating over the title. */
.menu-home li a i.fa {
	display: grid;
	place-items: center;
	width: 56px;
	height: 56px;
	margin: 0 0 14px;
	border-radius: 16px;
	background: var(--brand-50);
	color: var(--brand-600);
	font-size: 24px;
	transition: transform var(--dur-2) var(--ease-spring),
	            background-color var(--dur-2) var(--ease-out),
	            color var(--dur-2) var(--ease-out),
	            box-shadow var(--dur-2) var(--ease-out);
}

.menu-home li:hover a i.fa {
	background-color: var(--brand-500);
	background-image: var(--brand-fill);
	color: #fff;
	transform: translateY(-2px) scale(1.04);
	box-shadow: var(--brand-glow);
}

.menu-home h6 {
	font-size: var(--fs-base);
	font-weight: 600;
	text-transform: none;
	letter-spacing: -.005em;
	line-height: 1.3;
}

.menu-home li p { color: var(--ink-mute); line-height: 1.4; }


/* ── Inicio: widgets (ventas, top productos, ARCA) ──────────────────── */

.home-widgets-row { gap: 16px; }

.ventas-chart-header,
.ventas-chart-body,
.top-productos-header,
.top-productos-body,
.arca-section {
	background: var(--surface);
	border: 1px solid var(--line);
	border-radius: var(--r-lg);
	box-shadow: var(--sh-1);
}

.ventas-chart-header,
.top-productos-header { padding: 10px 14px; }

.ventas-chart-header h3,
.top-productos-header h3 {
	margin: 0;
	font-size: var(--fs-base);
	font-weight: 600;
	letter-spacing: -.005em;
	color: var(--ink);
}

/* Month switcher as a segmented control */
.ventas-chart-btns {
	gap: 2px;
	padding: 3px;
	background: var(--bg-sunken);
	border-radius: var(--r-pill);
}

.btn-mes-chart {
	padding: 5px 12px;
	border: 0;
	border-radius: var(--r-pill);
	background: transparent;
	color: var(--ink-soft);
	font-family: var(--font-sans);
	font-size: var(--fs-sm);
	font-weight: 600;
	transition: background-color var(--dur-2) var(--ease-out),
	            color var(--dur-1) var(--ease-out),
	            box-shadow var(--dur-2) var(--ease-out);
}

.btn-mes-chart:hover { color: var(--brand-600); }

.btn-mes-chart.active-mes {
	background: var(--surface);
	background-image: none;
	color: var(--brand-700);
	box-shadow: var(--sh-1);
}

.ventas-chart-titulo { font-size: var(--fs-sm); color: var(--ink-mute); }

.ventas-chart-username {
	background-image: var(--brand-fill);
	border-radius: var(--r-pill);
}

.ventas-chart-user-select {
	border: 1px solid var(--line-strong);
	border-radius: var(--r-pill);
	color: var(--ink-soft);
	font-family: var(--font-sans);
	transition: border-color var(--dur-1) var(--ease-out),
	            box-shadow var(--dur-1) var(--ease-out);
}

.ventas-chart-user-select:hover { border-color: var(--brand-300); }

.ventas-chart-user-select:focus {
	border-color: var(--brand-500);
	box-shadow: var(--focus-ring);
}

/* As the system's select (multipleSelect, home.php): the plugin copies the
   select's class onto its .ms-parent wrapper, so drop the native pill there —
   the field is .ms-choice, styled like every other (components.css). Only the
   height is trimmed to sit in the chart header. */
.ms-parent.ventas-chart-user-select {
	padding: 0;
	border: 0;
	border-radius: 0;
	background: none;
	box-shadow: none;
	font-weight: inherit;
	max-width: 100%;
}

.ms-parent.ventas-chart-user-select > .ms-choice { height: 34px !important; }
.ms-parent.ventas-chart-user-select > .ms-choice > span {
	line-height: 32px;
	font-size: var(--fs-sm);
}

.ventas-chart-body { padding: 14px 14px 10px; }

/* KPI strip above the chart. The figures count up (ui-motion.js). */
.ventas-chart-summary {
	gap: 18px;
	margin-bottom: 12px;
	padding: 10px 14px;
	background: var(--surface-alt);
	border: 1px solid var(--line);
	border-radius: var(--r-md);
}

.vcs-label {
	font-size: var(--fs-xs);
	font-weight: 700;
	letter-spacing: .06em;
	color: var(--ink-mute);
}

.vcs-value {
	font-size: var(--fs-xl);
	font-weight: 700;
	letter-spacing: -.01em;
	color: var(--ink);
	font-variant-numeric: tabular-nums;
}

.vcs-value-descuento { color: var(--warn); }

.vcs-sep { color: var(--line-strong); }

/* Loaders: the fa-spinner icons give way to theme placeholders */
.ventas-chart-loader {
	background: rgba(255,255,255,.72);
	backdrop-filter: blur(2px);
	-webkit-backdrop-filter: blur(2px);
	border-radius: var(--r-lg);
}

.ventas-chart-loader i.fa-spinner,
.top-productos-loader i.fa-spinner { display: none; }

.ventas-chart-loader::after {
	content: '';
	width: 30px;
	height: 30px;
	border: 3px solid var(--brand-100);
	border-top-color: var(--brand-500);
	border-radius: 50%;
	animation: ui-spin .7s linear infinite;
}

/* Top-products skeleton: one shimmer band, cut into rows by a mask */
.top-productos-loader { padding: 6px 2px; }

.top-productos-loader::before {
	content: '';
	display: block;
	height: 150px;
	border-radius: var(--r-sm);
	background-image: linear-gradient(90deg, var(--bg-sunken) 0%, #f7f9fb 50%, var(--bg-sunken) 100%);
	background-size: 200% 100%;
	animation: ui-shimmer 1.4s linear infinite;
	-webkit-mask-image: repeating-linear-gradient(to bottom, #000 0 18px, transparent 18px 30px);
	mask-image: repeating-linear-gradient(to bottom, #000 0 18px, transparent 18px 30px);
}

/* Ranking rows cascade in each time the list is rebuilt */
.tp-item {
	border-radius: var(--r-sm);
	animation: ui-enter-sm var(--dur-2) var(--ease-out) backwards;
}

.tp-item:nth-child(2)  { animation-delay: 30ms; }
.tp-item:nth-child(3)  { animation-delay: 60ms; }
.tp-item:nth-child(4)  { animation-delay: 90ms; }
.tp-item:nth-child(5)  { animation-delay: 120ms; }
.tp-item:nth-child(6)  { animation-delay: 150ms; }
.tp-item:nth-child(7)  { animation-delay: 180ms; }
.tp-item:nth-child(8)  { animation-delay: 210ms; }
.tp-item:nth-child(n+9) { animation-delay: 240ms; }

.tp-item:hover { background: var(--brand-50); }

.tp-rank {
	background: var(--brand-50);
	color: var(--brand-600);
	font-weight: 700;
	font-variant-numeric: tabular-nums;
}

.tp-rank-top {
	background-image: var(--brand-fill);
	color: #fff;
	box-shadow: var(--brand-glow);
}

.tp-title { color: var(--ink); }

.tp-qty-badge {
	background: var(--bg-sunken);
	color: var(--ink-soft);
	border-radius: var(--r-pill);
	font-weight: 700;
	font-variant-numeric: tabular-nums;
}

.tp-edit-btn {
	width: var(--hit);
	height: var(--hit);
	color: var(--ink-mute);
	border-radius: 50%;
}

.tp-edit-btn:hover {
	color: #fff;
	background: var(--brand-500);
}

.top-productos-ver-mas {
	color: var(--brand-600);
	font-weight: 600;
	border-radius: var(--r-sm);
	transition: background-color var(--dur-1) var(--ease-out);
}

.top-productos-ver-mas:hover { background: var(--brand-50); }


/* ── Global loading modal ───────────────────────────────────────────── */

/* mostrar_cargando() flips this from display:none with .show(), which
   restarts the animation, so the backdrop fades in on every open. */
#modal_cargando {
	background: rgba(11,27,43,.7);
	backdrop-filter: blur(6px);
	-webkit-backdrop-filter: blur(6px);
	z-index: 99999;
	animation: ui-fade var(--dur-2) var(--ease-out);
}

.modal_cargando_cont {
	background: var(--surface);
	border: 1px solid var(--line);
	border-radius: var(--r-lg);
	box-shadow: var(--sh-4);
	padding: 30px 38px;
	min-width: 230px;
	/* estilos.css centres this card with translate(-50%,-50%). A plain
	   scale keyframe would replace that transform for the whole animation
	   and the card would open off-centre, then snap. The keyframe below
	   carries the translate along. */
	animation: ui-pop-centered var(--dur-2) var(--ease-spring);
}

@keyframes ui-pop-centered {
	from { opacity: 0; transform: translate(-50%, -50%) scale(.96); }
	to   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

/* The hourglass is replaced by a brand ring spinner. The markup keeps
   its element names so nothing in the JS has to change. */
.hourglass-icon {
	display: inline-block;
	width: 46px;
	height: 46px;
	position: relative;
	border-radius: 50%;
	border: 3px solid var(--brand-100);
	border-top-color: var(--brand-500);
	animation: ui-spin .75s linear infinite;
	background: none;
}

.hourglass-icon:before,
.hourglass-icon:after,
.hourglass-icon .middle,
.hourglass-icon .sand {
	display: none;
}

.modal_cargando_text {
	display: block;
	margin-top: 16px;
	font-size: var(--fs-md);
	font-weight: 600;
	letter-spacing: .02em;
	color: var(--ink-soft);
	text-transform: none;
}


/* ── Sub-ABM modal ──────────────────────────────────────────────────── */

/* The legacy rule dims the page with a huge spread shadow (the modal has
   no separate backdrop element). The second shadow here keeps that veil;
   `100vmax` covers the viewport from any position. */
.sub_abm_modal {
	border-radius: var(--r-lg);
	box-shadow: var(--sh-4), 0 0 0 100vmax rgba(11,27,43,.5);
}

.sub_abm_modal_cont { border-radius: var(--r-lg); }

/* Phones: a bottom sheet instead of a centred box. Centred with
   translate(-50%,-50%) and no height limit, a long form ran off both
   edges of the screen with no way to scroll to its buttons. z-index goes
   above the bottom nav (200) so the sheet is not covered by it. */
@media (max-width: 768px) {
	.sub_abm_modal {
		top: auto;
		bottom: 0;
		left: 0;
		right: 0;
		transform: none;
		width: auto;
		max-height: calc(100vh - 24px);
		max-height: calc(100dvh - 24px);
		overflow-y: auto;
		overscroll-behavior: contain;
		z-index: 300;
		padding: 16px 16px calc(16px + env(safe-area-inset-bottom, 0px));
		border-radius: var(--r-lg) var(--r-lg) 0 0;
		animation: ui-slide-up var(--dur-3) var(--ease-out);
	}

	.sub_abm_modal_cont { border-radius: 0; }
}


/* ── Mobile top bar (kept hidden — see note) ────────────────────────── */
/* `#menu-mobile` sits inside `.top-bar`, which the 768px query hides, so
   this bar does not render today. Styles stay tokenized so that if it is
   ever brought back it matches the rest of the shell. Reviving it needs
   content padding-top and a z-index check against `code_reader`'s
   `.cr-pwa-bar`, so it is deliberately left alone here. */

.mobile-topbar-nav {
	background: rgba(11,27,43,.9);
	backdrop-filter: blur(12px);
	-webkit-backdrop-filter: blur(12px);
	border-bottom: 1px solid var(--nav-line);
	height: 60px;
	padding: 0 16px;
}

.mobile-topbar-brand a {
	color: var(--nav-ink);
	font-size: var(--fs-lg);
	font-weight: 600;
	letter-spacing: 0;
}


/* ── Bottom navigation (mobile) ─────────────────────────────────────── */

#bottom-nav {
	height: calc(var(--bnav-h) + env(safe-area-inset-bottom, 0px));
	padding-bottom: env(safe-area-inset-bottom, 0px);
	background: rgba(11,27,43,.94);
	backdrop-filter: blur(14px);
	-webkit-backdrop-filter: blur(14px);
	border-top: 1px solid var(--nav-line);
	box-shadow: 0 -2px 16px rgba(0,0,0,.28);
}

.bnav-tab {
	color: var(--nav-ink-mute);
	gap: 4px;
	transition: color var(--dur-1) var(--ease-out);
}

.bnav-tab i.fa {
	font-size: var(--icon-lg);
	transition: transform var(--dur-2) var(--ease-spring), color var(--dur-1) var(--ease-out);
}

.bnav-tab span {
	font-size: var(--fs-xs);
	font-weight: 600;
	letter-spacing: .01em;
}

.bnav-tab:active i.fa { transform: scale(.92); }

.bnav-tab.active { color: var(--accent-mint); }
.bnav-tab.active i.fa { transform: translateY(-1px); }

/* Pill indicator instead of the old 2px top tick. Centred with auto
   margins rather than translateX(-50%): the pop animation animates
   `transform`, and would otherwise drop the centring mid-animation. */
.bnav-tab.active::before {
	content: '';
	position: absolute;
	top: 6px;
	left: 0;
	right: 0;
	margin: 0 auto;
	transform: none;
	width: 34px;
	height: 30px;
	border-radius: var(--r-pill);
	background: rgba(126,232,162,.13);
	z-index: -1;
	animation: ui-pop var(--dur-2) var(--ease-spring);
}


/* ── Off-canvas panel ───────────────────────────────────────────────── */

#offcanvas-panel {
	background: linear-gradient(180deg, var(--nav-900) 0%, var(--nav-800) 100%);
	box-shadow: var(--sh-4);
}

#offcanvas-overlay {
	backdrop-filter: blur(3px);
	-webkit-backdrop-filter: blur(3px);
	background: rgba(11,27,43,.55);
}

.offcanvas-header { border-bottom: 1px solid var(--nav-line); }

.offcanvas-item {
	display: flex;
	align-items: center;
	gap: 11px;
	margin: 1px 8px;
	padding: 11px 12px;
	border-radius: var(--r-md);
	color: var(--nav-ink-soft);
	transition: background-color var(--dur-1) var(--ease-out),
	            color var(--dur-1) var(--ease-out);
}

.offcanvas-item i { width: 18px; text-align: center; flex-shrink: 0; opacity: .85; }

.offcanvas-item:active { background: var(--nav-hover); }

.offcanvas-item.active {
	background-image: var(--brand-fill);
	color: #fff;
	font-weight: 600;
}

.offcanvas-item--sub {
	margin-left: 26px;
	font-size: var(--fs-sm);
}

.offcanvas-item--logout { color: #f2a9a4; }

.offcanvas-section-title {
	padding: 16px 20px 6px;
	font-size: var(--fs-xs);
	font-weight: 700;
	letter-spacing: .08em;
	text-transform: uppercase;
	color: var(--nav-ink-mute);
}

.offcanvas-divider {
	height: 1px;
	margin: 10px 14px;
	background: var(--nav-line);
}

.offcanvas-accordion__arrow {
	margin-left: auto;
	transition: transform var(--dur-2) var(--ease-spring);
}

.offcanvas-accordion.open .offcanvas-accordion__arrow { transform: rotate(180deg); }

/* Items reveal in sequence once the panel is open */
#offcanvas-panel.open .offcanvas-body > * {
	animation: ui-enter-sm var(--dur-2) var(--ease-out) backwards;
}
#offcanvas-panel.open .offcanvas-body > *:nth-child(1) { animation-delay: 30ms; }
#offcanvas-panel.open .offcanvas-body > *:nth-child(2) { animation-delay: 50ms; }
#offcanvas-panel.open .offcanvas-body > *:nth-child(3) { animation-delay: 70ms; }
#offcanvas-panel.open .offcanvas-body > *:nth-child(4) { animation-delay: 90ms; }
#offcanvas-panel.open .offcanvas-body > *:nth-child(5) { animation-delay: 110ms; }
#offcanvas-panel.open .offcanvas-body > *:nth-child(n+6) { animation-delay: 130ms; }


/* ── PWA install banner ─────────────────────────────────────────────── */
/* Moved here from the inline <style> blocks in both layout shells. Those
   lived in <body>, i.e. after the theme <link>, so they used to win the
   cascade over anything written here. Full rules now, not just overrides. */

#pwa-install-banner {
	display: none;
	position: fixed;
	bottom: 0;
	left: 0;
	right: 0;
	z-index: 9998;
	padding: 12px 20px;
	gap: 12px;
	align-items: center;
	justify-content: space-between;
	color: #fff;
	background-image: var(--brand-fill);
	box-shadow: var(--sh-4);
	animation: ui-slide-up var(--dur-3) var(--ease-out);
}

#pwa-install-banner.visible { display: flex; }

.pwa-banner__left {
	display: flex;
	align-items: center;
	gap: 12px;
	flex: 1;
	min-width: 0;
}

.pwa-banner__icon {
	width: 40px;
	height: 40px;
	border-radius: var(--r-md);
	flex-shrink: 0;
}

.pwa-banner__text strong {
	display: block;
	font-size: var(--fs-base);
	font-weight: 700;
}

.pwa-banner__text span {
	font-size: var(--fs-sm);
	opacity: .85;
}

.pwa-banner__actions {
	display: flex;
	align-items: center;
	gap: 8px;
	flex-shrink: 0;
}

.pwa-banner__btn-install {
	background: #fff;
	color: var(--brand-600);
	border: none;
	border-radius: var(--r-pill);
	padding: 8px 18px;
	font-family: var(--font-sans);
	font-size: var(--fs-md);
	font-weight: 700;
	cursor: pointer;
	white-space: nowrap;
	transition: transform var(--dur-1) var(--ease-out),
	            box-shadow var(--dur-1) var(--ease-out);
}

.pwa-banner__btn-install:hover {
	transform: translateY(-1px);
	box-shadow: var(--sh-2);
}

.pwa-banner__btn-snooze,
.pwa-banner__btn-never {
	background: transparent;
	border: 1px solid rgba(255,255,255,.45);
	color: rgba(255,255,255,.9);
	border-radius: var(--r-pill);
	padding: 7px 14px;
	font-family: var(--font-sans);
	font-size: var(--fs-sm);
	cursor: pointer;
	white-space: nowrap;
	transition: background-color var(--dur-1) var(--ease-out),
	            border-color var(--dur-1) var(--ease-out);
}

.pwa-banner__btn-snooze:hover,
.pwa-banner__btn-never:hover {
	background: rgba(255,255,255,.15);
	border-color: rgba(255,255,255,.75);
}

@media (max-width: 600px) {
	#pwa-install-banner {
		flex-direction: column;
		align-items: flex-start;
		padding: 14px 16px 10px;
	}
	.pwa-banner__actions { flex-wrap: wrap; }
}


/* ── Notifications: toasts, dropdown, widget and page live in
   theme/notificaciones.css (panel/js/notificaciones.js). ─────────────── */


/* ── Mobile overrides ───────────────────────────────────────────────── */

@media (max-width: 768px) {

	/* The legacy rule pins this at `top: -14px !important`, a leftover of
	   the removed negative-offset hack. !important is required to undo it. */
	/* Bottom padding = bottom nav + 32px of air, so the last card can be
	   scrolled clear of the nav. */
	.contenedor-principal {
		top: 0 !important;
		padding: 18px 16px calc(var(--bnav-h) + 32px + env(safe-area-inset-bottom, 0px));
	}

	.contenedor-principal > h2 { font-size: var(--fs-xl); }

	/* Full-screen tools (the WhatsApp inbox) size themselves to the space
	   above the bottom nav, so the page padding would only add a scroll. */
	body:has(.wa-root) .contenedor-principal { padding: 0; }
}
