/* ═══════════════════════════════════════════════════════════════════
   COMPONENTS — feedback layers, listings, forms, vendor widgets
   Everything here is a restyle of markup the engine or a vendor
   already emits. No selector renames.
   ═══════════════════════════════════════════════════════════════════ */

/* ── SweetAlert2 ────────────────────────────────────────────────────── */
/* Previously an inline <style> block in both layout shells. The
   `:where()` wrappers keep Swal's own specificity low, so plain class
   selectors here are enough — except the confirm background, which Swal
   sets as an inline style from `confirmButtonColor` and can only be
   beaten with !important. */

div:where(.swal2-container) div:where(.swal2-popup) {
	border-radius: var(--r-lg);
	box-shadow: var(--sh-4);
	font-family: var(--font-sans);
	padding: 24px 24px 20px;
	border: 1px solid var(--line);
}

div:where(.swal2-container) h2:where(.swal2-title) {
	font-size: var(--fs-xl);
	font-weight: 700;
	letter-spacing: -.01em;
	color: var(--ink);
	text-transform: none;
}

div:where(.swal2-container) div:where(.swal2-html-container) {
	font-size: var(--fs-base);
	line-height: 1.55;
	color: var(--ink-soft);
}

div:where(.swal2-container) button:where(.swal2-styled) {
	border-radius: var(--r-sm);
	font-family: var(--font-sans);
	font-size: var(--fs-md);
	font-weight: 600;
	padding: 10px 20px;
	box-shadow: var(--sh-1);
	transition: transform var(--dur-1) var(--ease-out),
	            box-shadow var(--dur-1) var(--ease-out),
	            filter var(--dur-1) var(--ease-out);
}

div:where(.swal2-container) button:where(.swal2-styled):hover {
	transform: translateY(-1px);
	box-shadow: var(--sh-2);
}

div:where(.swal2-container) button:where(.swal2-styled):active {
	transform: translateY(0) scale(.98);
}

div:where(.swal2-container) button:where(.swal2-styled):focus-visible {
	box-shadow: var(--sh-1), var(--focus-ring);
}

/* Confirm button colour: the solid brand fill, whatever `confirmButtonColor`
   the caller passed. That is how it has always rendered — the old inline
   block forced the brand colour on every confirm — and the palette callers
   pass is not curated: violet #6f42c1 (Abrir Caja and 13 more), assorted
   teals. Honouring those surfaced colours nobody had seen before.
   !important because Swal's own stylesheet declares these with it. */
div:where(.swal2-container) button:where(.swal2-styled):where(.swal2-confirm) {
	background-image: var(--brand-fill) !important;
	background-color: var(--brand-500) !important;
	border: none;
}

div:where(.swal2-container) button:where(.swal2-styled):where(.swal2-confirm):hover {
	background-image: var(--brand-fill-hover) !important;
}

/* One deliberate exception: destructive actions. Swal writes the caller's
   colour as an inline custom property on the button
   (`style="--swal2-confirm-button-background-color: #e74c3c"`), and the
   four reds used for delete/cancel confirmations become one danger colour
   instead of turning teal. Declared after the hover rule above, at equal
   specificity, so the brand fill does not come back on hover. */
div:where(.swal2-container) button:where(.swal2-confirm)[style*="#e74c3c" i],
div:where(.swal2-container) button:where(.swal2-confirm)[style*="#b91c1c" i],
div:where(.swal2-container) button:where(.swal2-confirm)[style*="#c0392b" i],
div:where(.swal2-container) button:where(.swal2-confirm)[style*="#dc3545" i],
div:where(.swal2-container) button:where(.swal2-confirm)[style*="#d33" i] {
	background-image: none !important;
	background-color: var(--danger) !important;
}

div:where(.swal2-container) button:where(.swal2-confirm)[style*="#e74c3c" i]:hover,
div:where(.swal2-container) button:where(.swal2-confirm)[style*="#b91c1c" i]:hover,
div:where(.swal2-container) button:where(.swal2-confirm)[style*="#c0392b" i]:hover,
div:where(.swal2-container) button:where(.swal2-confirm)[style*="#dc3545" i]:hover,
div:where(.swal2-container) button:where(.swal2-confirm)[style*="#d33" i]:hover {
	filter: brightness(.92);
}

/* Escape hatch — `customClass: { confirmButton: 'swal-confirm-plain' }`
   lets a destructive dialog keep its own confirmButtonColor. */
div:where(.swal2-container) button:where(.swal2-styled).swal-confirm-plain {
	background-image: none !important;
}

div:where(.swal2-container) button:where(.swal2-styled):where(.swal2-cancel) {
	background-color: transparent !important;
	border: 1px solid var(--line-strong);
	color: var(--ink-soft);
	box-shadow: none;
}

div:where(.swal2-container) button:where(.swal2-styled):where(.swal2-cancel):hover {
	background-color: var(--bg-sunken) !important;
	border-color: var(--line-strong);
}

/* "Deny" is an outline button. Swal's default deny is red and callers use
   it for destructive answers (calendario: "Eliminar"), so by default it is a
   danger outline. A caller that passes the neutral grey (#6c757d: "No" in
   tabla_results, "Volver al precio de lista" in sell_abm) gets the same
   quiet outline as Cancelar. Swal writes the colour as an inline custom
   property, hence the attribute selector (same trick as the confirm). */
div:where(.swal2-container) button:where(.swal2-styled):where(.swal2-deny) {
	background-color: transparent !important;
	background-image: none !important;
	border: 1px solid var(--danger-border);
	color: var(--danger);
	box-shadow: none;
}

div:where(.swal2-container) button:where(.swal2-styled):where(.swal2-deny):hover {
	background-color: var(--danger-soft) !important;
}

div:where(.swal2-container) button:where(.swal2-deny)[style*="#6c757d" i] {
	border-color: var(--line-strong);
	color: var(--ink-soft);
}

div:where(.swal2-container) button:where(.swal2-deny)[style*="#6c757d" i]:hover {
	background-color: var(--bg-sunken) !important;
}

div:where(.swal2-container) input:where(.swal2-input),
div:where(.swal2-container) textarea:where(.swal2-textarea),
div:where(.swal2-container) select:where(.swal2-select) {
	border-radius: var(--r-sm);
	border: 1px solid var(--field-border);
	background: var(--field-bg);
	font-family: var(--font-sans);
	font-size: var(--fs-base);
	box-shadow: none;
	transition: border-color var(--dur-1) var(--ease-out),
	            box-shadow var(--dur-1) var(--ease-out),
	            background-color var(--dur-1) var(--ease-out);
}

div:where(.swal2-container) input:where(.swal2-input):focus,
div:where(.swal2-container) textarea:where(.swal2-textarea):focus {
	background: var(--surface);
	border-color: var(--brand-500);
	box-shadow: var(--focus-ring);
}

/* Softer open/close than Swal's default bounce */
div:where(.swal2-container) div:where(.swal2-popup).swal2-show {
	animation: ui-pop var(--dur-2) var(--ease-spring);
}

div:where(.swal2-container) div:where(.swal2-popup).swal2-hide {
	animation: ui-pop-out var(--dur-1) var(--ease-out);
}

/* Phones: less frame, and the actions as full-width stacked buttons, easy
   to hit with the thumb. Swal renders confirm first in the DOM, so it stays
   on top. Fields at 16px so iOS does not zoom when one gets focus. */
@media (max-width: 480px) {
	div:where(.swal2-container) div:where(.swal2-popup) { padding: 18px 16px 16px; }

	div:where(.swal2-container) div:where(.swal2-actions) {
		flex-direction: column;
		align-items: stretch;
		width: 100%;
		gap: 8px;
		padding: 0 4px;
		box-sizing: border-box;
	}

	div:where(.swal2-container) div:where(.swal2-actions) button:where(.swal2-styled) {
		width: 100%;
		margin: 0;
		min-height: 44px;
	}

	div:where(.swal2-container) input:where(.swal2-input),
	div:where(.swal2-container) textarea:where(.swal2-textarea),
	div:where(.swal2-container) select:where(.swal2-select) {
		font-size: max(16px, var(--fs-base));
	}
}

div:where(.swal2-container).swal2-backdrop-show {
	background: rgba(11,27,43,.45);
	backdrop-filter: blur(3px);
	-webkit-backdrop-filter: blur(3px);
}


/* ── Toasts (Noty) ──────────────────────────────────────────────────── */
/* panel/js/noty/themes/relax.js now only adds a layout class; the look is
   here. Two callers in panel/index.js:
     message_success() → type success, layout bottomRight, 5s timeout
     message_error()   → type error,   layout center, modal
   Two Noty behaviours constrain the CSS:
   · On open it pins `height` inline to the bar's innerHeight. A real
     border would then shave 2px off the content, so borders and the
     status accent are drawn with box-shadow instead.
   · Removal waits for `animationend`. The bar must always animate;
     reduced motion shortens it (motion.css) but never sets it to none. */

/* !important on the properties Noty paints inline. Two sources write
   inline styles here: the Noty core itself, and any cached copy of the
   previous relax.js (which set padding, colours, borders and a 2px radius
   on every bar). The script is now versioned so browsers refetch it, but
   until they do, a stale copy put a 10px inline padding under the icon
   gutter and the icon landed on top of the text. These rules render the
   toast the same whichever theme version the browser is running. */
.noty_bar {
	position: relative;
	margin: 6px 0 !important;
	border: 0 !important;
	border-radius: var(--r-md) !important;
	background: var(--surface) !important;
	color: var(--ink) !important;
	font-family: var(--font-sans);
	--toast-accent: var(--brand-500);
	box-shadow: inset 3px 0 0 var(--toast-accent), 0 0 0 1px var(--line), var(--sh-3) !important;
	overflow: hidden !important;
	cursor: pointer;
}

.noty_bar .noty_message {
	position: relative !important;
	width: auto !important;
	padding: 12px 14px 12px 42px !important;
	font-size: var(--fs-md) !important;
	line-height: 1.45 !important;
	text-align: left !important;
	font-weight: 500 !important;
}

/* Status glyph, positioned in the left gutter the padding leaves free */
.noty_bar .noty_message::before {
	position: absolute;
	left: 14px;
	top: 12px;
	font-family: FontAwesome;
	font-size: var(--icon-md);
	line-height: 1.1;
	color: var(--toast-accent);
	content: '\f05a';            /* fa-info-circle */
}

.noty_bar.noty_type_success     { --toast-accent: var(--ok); }
.noty_bar.noty_type_error       { --toast-accent: var(--danger); }
.noty_bar.noty_type_warning     { --toast-accent: var(--warn); }
.noty_bar.noty_type_information { --toast-accent: var(--info); }

.noty_bar.noty_type_success .noty_message::before { content: '\f058'; }  /* fa-check-circle */
.noty_bar.noty_type_error   .noty_message::before { content: '\f06a'; }  /* fa-exclamation-circle */
.noty_bar.noty_type_warning .noty_message::before { content: '\f071'; }  /* fa-exclamation-triangle */
.noty_bar.noty_type_alert   .noty_message::before,
.noty_bar.noty_type_notification .noty_message::before { content: '\f0f3'; } /* fa-bell */

/* Timeout bar on the corner toast. 5s mirrors `timeout: 5000` in
   message_success(); change both together. */
.noty_bar.noty_layout_bottomRight.noty_type_success::after {
	content: '';
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	height: 2px;
	background: var(--toast-accent);
	opacity: .35;
	transform-origin: left;
	animation: ui-toast-timer 5s linear forwards;
}

@keyframes ui-toast-timer {
	from { transform: scaleX(1); }
	to   { transform: scaleX(0); }
}

/* The centred error is a blocking message, so it gets more room and
   weight than the corner toast. */
.noty_bar.noty_layout_center {
	border-radius: var(--r-lg) !important;
	box-shadow: inset 0 3px 0 var(--toast-accent), 0 0 0 1px var(--line), var(--sh-4) !important;
}

.noty_bar.noty_layout_center .noty_message {
	padding: 22px 20px 18px !important;
	text-align: center !important;
	font-size: var(--fs-base) !important;
}

.noty_bar.noty_layout_center .noty_message::before {
	position: static;
	display: block;
	margin: 0 auto 10px;
	font-size: 30px;
}

.noty_bar .noty_buttons {
	padding: 8px 12px;
	text-align: right;
	border-top: 1px solid var(--line);
	background: var(--surface-alt);
}

.noty_bar .noty_close {
	position: absolute;
	top: 8px;
	right: 8px;
	width: 18px;
	height: 18px;
	background: none;
	cursor: pointer;
}

.noty_bar .noty_close::before {
	content: '\f00d';            /* fa-times */
	font-family: FontAwesome;
	font-size: var(--fs-xs);
	color: var(--ink-mute);
}

.noty_modal {
	background: rgba(11,27,43,.45);
	backdrop-filter: blur(3px);
	-webkit-backdrop-filter: blur(3px);
}

/* Entrance/exit. index.js asks for animate.css's `animated fadeInUp` /
   `fadeOutDown`, which run 1s with a stock curve. Same class hooks, the
   theme's timing and keyframes. The close class is added on top of the
   open one, so the close rule must come second to win. */
.noty_bar.animated {
	animation-duration: var(--dur-3);
	animation-timing-function: var(--ease-out);
	animation-fill-mode: both;
}

.noty_bar.fadeInUp    { animation-name: ui-toast-in; }
.noty_bar.fadeOutDown { animation-name: ui-toast-out; animation-duration: var(--dur-2); }

/* Same specificity pair for the centred layout. The close rule has to
   match the open rule's weight, or the open name would stick when both
   classes are present, no new animation would start, `animationend` would
   never fire, and Noty would leave the modal on screen for good. */
.noty_bar.noty_layout_center.fadeInUp    { animation-name: ui-pop; }
.noty_bar.noty_layout_center.fadeOutDown { animation-name: ui-toast-out; }

@keyframes ui-toast-in {
	from { opacity: 0; transform: translateY(12px) scale(.98); }
	to   { opacity: 1; transform: none; }
}

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


/* ═══════════════════════════════════════════════════════════════════
   LISTADOS Y FORMULARIOS
   ═══════════════════════════════════════════════════════════════════ */

/* ── Tablas de datos ────────────────────────────────────────────────── */
/* Two scopes, one look:
     .general_result_rows #table  the main listing. It is injected into a
                                  container that sits OUTSIDE .box-body, so
                                  a .box-body-only scope (as in the first
                                  pass) never reached it — it kept the navy,
                                  centred, zebra look of estilos.css.
     .box-body table              tables inside forms and cards (sub-ABM,
                                  users, stock records, reports).
   The bare `table` selector in estilos.css also reaches the factura and
   etiqueta print templates; those don't load the theme and are untouched.
   The listing ID selector outweighs every legacy table rule, so nothing in
   estilos.css has to change. */

.general_result_rows #table,
.box-body table {
	background: var(--surface);
	border: 0;
	border-radius: 0;
	box-shadow: none;
	margin: 4px 0 10px;
	font-size: var(--fs-md);
	font-weight: 500;
	line-height: 1.45;
	color: var(--ink);
	text-align: var(--table-align);
}

.box-body table { border-collapse: collapse; }

/* Header: light surface with a strong baseline instead of a navy slab */
.general_result_rows #table > thead,
.box-body thead {
	background: transparent;
	border: 0;
	border-radius: 0;
	color: var(--ink-soft);
	font-size: var(--fs-xs);
	font-weight: 700;
}

.general_result_rows #table > thead > tr > th,
.box-body thead th {
	padding: 11px 14px;
	border: 0;
	border-bottom: 2px solid var(--line-strong);
	background: var(--surface-alt);
	font-size: var(--fs-xs);
	font-weight: 700;
	line-height: 1.3;
	letter-spacing: .06em;
	text-transform: uppercase;
	text-align: var(--table-align);
	color: var(--ink-soft);
	vertical-align: middle;
}

.box-body thead th { white-space: nowrap; }

/* The legacy per-corner radii belonged to the dark slab */
.box-body thead tr th:nth-child(1),
.box-body thead tr th:nth-last-child(-n + 1) {
	border-radius: 0;
}

.general_result_rows #table > tbody > tr > td,
.box-body tbody td {
	padding: 11px 14px;
	border: 0;
	border-bottom: 1px solid var(--line);
	box-shadow: none;              /* estilos.css paints inset lines on first/last cells */
	vertical-align: middle;
	transition: background-color var(--dur-1) var(--ease-out);
}

/* Zebra off, hover on — the row under the cursor is the useful signal */
.general_result_rows #table > tbody > tr:nth-child(odd) > td,
.box-body tbody tr:nth-child(odd) td { background-color: transparent; }

.general_result_rows #table > tbody > tr:hover > td,
.box-body tbody tr:hover td { background-color: var(--brand-50); }

.box-body tbody tr:last-child td { border-bottom: 0; }

.box-body .subabm-zaphify-table td:last-child {
	border-right: 0;
	box-shadow: none;
	min-width: 110px;
}

/* Sub-ABM tables (the products of a sale, etc.): the same continuity cues
   as the main listing. Light on light read as washed out next to the add
   panel, and these rows are what the operator checks before saving. A
   framed card, navy header, a zebra visible enough to follow a row across,
   and column lines. Desktop only: from 768px down the rows are cards. */
@media (min-width: 769px) {
	.box-body .subabm-zaphify-table table {
		border-collapse: separate;
		border-spacing: 0;
		border: 1px solid var(--line-strong);
		border-radius: var(--r-md);
		overflow: hidden;
		box-shadow: var(--sh-1);
	}

	.box-body .subabm-zaphify-table thead th,
	.box-body .subabm-zaphify-table thead .sortable-header.sort-asc,
	.box-body .subabm-zaphify-table thead .sortable-header.sort-desc {
		background: var(--nav-900);
		color: #fff;
		border-bottom: 0;
		font-size: var(--fs-sm);
		font-weight: 600;
		letter-spacing: 0;
		text-transform: none;
	}

	.box-body .subabm-zaphify-table thead th + th { border-left: 1px solid rgba(255,255,255,.08); }
	.box-body .subabm-zaphify-table thead .sortable-header:hover { background: var(--nav-800); color: #fff; }

	.box-body .subabm-zaphify-table tbody td { font-weight: 600; }
	.box-body .subabm-zaphify-table tbody td + td { border-left: 1px solid var(--line); }
	.box-body .subabm-zaphify-table tbody tr:nth-child(even) td { background-color: var(--row-alt); }
	.box-body .subabm-zaphify-table tbody tr:hover td { background-color: var(--brand-50); }
}


/* ── Listado principal: tarjeta, encabezado fijo, tipos de columna ──── */

/* A card. Separate borders (spacing 0) instead of collapse: collapsed
   borders belong to the table grid and scroll away from a sticky header,
   and a collapsed table ignores cell border-radius. No overflow:hidden
   either — it would stop the header from sticking — so the corners are
   rounded on the corner cells themselves. */
.general_result_rows #table {
	border-collapse: separate;
	border-spacing: 0;
	border: 1px solid var(--line);
	border-radius: var(--r-lg);
	box-shadow: var(--sh-1);
	margin: 10px 0 14px;
}

.general_result_rows #table > thead > tr > th {
	position: sticky;
	top: var(--table-sticky-top, 0px);
	z-index: 3;                    /* over row content, under the action bar (50) */
}

/* Once the action bar turns sticky it covers the top 64px of the page, so
   the header parks right below it. Read from the page with :has(); no JS. */
body:has(.form-submit-cont.sticky) { --table-sticky-top: 64px; }

.general_result_rows #table > thead > tr:first-child > th:first-child { border-top-left-radius: calc(var(--r-lg) - 1px); }
.general_result_rows #table > thead > tr:first-child > th:last-child  { border-top-right-radius: calc(var(--r-lg) - 1px); }
.general_result_rows #table > tbody > tr:last-child > td { border-bottom: 0; }
.general_result_rows #table > tbody > tr:last-child > td:first-child { border-bottom-left-radius: calc(var(--r-lg) - 1px); }
.general_result_rows #table > tbody > tr:last-child > td:last-child  { border-bottom-right-radius: calc(var(--r-lg) - 1px); }

/* Rows that hold widgets (products, history, stock pills) are tall; top
   alignment keeps the short values of those rows on one reading line. */
.general_result_rows #table > tbody > tr > td { vertical-align: top; }

/* Continuity with the previous look. A fully light listing was too big a
   jump for people who use it all day: the navy header was the anchor of
   the screen, and rows ran together without zebra or column lines. The
   listing keeps those cues — refined — while tables inside forms stay
   light. */
.general_result_rows #table > thead > tr > th {
	background: var(--nav-900);
	color: #fff;
	border-bottom: 0;
	font-size: var(--fs-md);
	font-weight: 600;
	letter-spacing: 0;
	text-transform: none;
}

.general_result_rows #table > thead > tr > th + th { border-left: 1px solid rgba(255,255,255,.08); }

.general_result_rows #table > thead > tr > .sortable-header:hover { background: var(--nav-800); color: #fff; }

.general_result_rows #table > thead > tr > .sortable-header.sort-asc,
.general_result_rows #table > thead > tr > .sortable-header.sort-desc {
	background: var(--nav-700);
	color: #fff;
}

.general_result_rows #table > thead > tr > th .sort-icon { color: rgba(255,255,255,.35); }

.general_result_rows #table > thead > tr > .sortable-header.sort-asc  .sort-icon.sort-asc,
.general_result_rows #table > thead > tr > .sortable-header.sort-desc .sort-icon.sort-desc { color: var(--accent-mint); }

.general_result_rows #table > thead > tr > .sortable-header.sort-asc  .sort-icon.sort-desc,
.general_result_rows #table > thead > tr > .sortable-header.sort-desc .sort-icon.sort-asc { color: rgba(255,255,255,.2); }

.general_result_rows #table > tbody > tr > td { font-weight: 600; }
.general_result_rows #table > tbody > tr > td + td { border-left: 1px solid var(--line); }
.general_result_rows #table > thead > tr > th.md + th,
.general_result_rows #table > tbody > tr > td.md + td { border-left: 0; }
.general_result_rows #table > tbody > tr:nth-child(even) > td { background-color: var(--surface-alt); }
.general_result_rows #table > tbody > tr:hover > td { background-color: var(--brand-50); }

.general_result_rows #table > thead > tr > .col-id,
.general_result_rows #table > tbody > tr > .col-id { color: var(--ink); font-weight: 700; }

/* Column types — classes set per column by tabla_results.php */
.general_result_rows #table > thead > tr > .col-id,
.general_result_rows #table > tbody > tr > .col-id {
	width: 1%;
	white-space: nowrap;
	font-weight: 600;
	color: var(--ink-soft);
	font-variant-numeric: tabular-nums;
}

.general_result_rows #table > thead > tr > .col-num,
.general_result_rows #table > tbody > tr > .col-num {
	text-align: var(--table-align);
	white-space: nowrap;
	font-variant-numeric: tabular-nums;
}

.general_result_rows #table > thead > tr > .col-date,
.general_result_rows #table > tbody > tr > .col-date {
	white-space: nowrap;
	font-variant-numeric: tabular-nums;
}

.general_result_rows #table > tbody > tr > td.col-rich { padding-top: 8px; padding-bottom: 8px; }

/* Long free text (observation timelines, td.col-text) reads better from
   the left. Widgets inside cells (codigo chip, stock pills…) follow the
   table alignment: text-align moves inline ones, flex rows need justify. */
.general_result_rows #table > tbody > tr > td.col-text { text-align: left; }
.general_result_rows #table > tbody > tr > td:not(.col-text) .sd-list { justify-content: var(--table-align); }

/* Actions: pinned to the right edge of the table, never wrapping */
.general_result_rows #table > thead > tr > th.xg,
.general_result_rows #table > tbody > tr > td.xg {
	width: 1%;
	white-space: nowrap;
	text-align: var(--table-align);
}

/* Small inline markers the view now uses */
.ui-muted { color: var(--ink-mute); font-style: italic; font-weight: 400; }

.ui-chip {
	display: inline-flex;
	align-items: center;
	padding: 2px 9px;
	border: 1px solid var(--line);
	border-radius: var(--r-pill);
	background: var(--bg-sunken);
	color: var(--ink-soft);
	font-size: var(--fs-xs);
	font-weight: 700;
	letter-spacing: .04em;
	line-height: 1.5;
	white-space: nowrap;
}

.ui-chip--ok { background: var(--ok-soft); border-color: var(--ok-border); color: var(--ok); }


/* ── Cabeceras ordenables (venían inline en tabla_results.php) ──────── */

.sortable-header {
	cursor: pointer;
	position: relative;
	user-select: none;
	padding-right: 26px !important;
	transition: color var(--dur-1) var(--ease-out),
	            background-color var(--dur-1) var(--ease-out);
}

.box-body thead .sortable-header:hover {
	background: var(--brand-50);
	color: var(--brand-600);
}

.sort-icons {
	position: absolute;
	right: 8px;
	top: 50%;
	transform: translateY(-50%);
	display: flex;
	flex-direction: column;
	line-height: 1;
}

.sort-icon {
	font-size: 10px;
	color: var(--ink-faint);
	margin: 1px 0;
	transition: color var(--dur-1) var(--ease-out),
	            transform var(--dur-2) var(--ease-spring);
}

.sortable-header.sort-asc  .sort-icon.sort-asc,
.sortable-header.sort-desc .sort-icon.sort-desc {
	color: var(--brand-500);
	font-weight: 700;
	transform: scale(1.35);
}

.sortable-header.sort-asc  .sort-icon.sort-desc,
.sortable-header.sort-desc .sort-icon.sort-asc {
	color: var(--line-strong);
}

/* The sorted column reads as active even away from the arrows */
/* (The main listing has its own navy variant, above.) */
.box-body thead .sortable-header.sort-asc,
.box-body thead .sortable-header.sort-desc {
	color: var(--brand-600);
	background: var(--brand-50);
}


/* ── Acciones por fila ──────────────────────────────────────────────── */

.btn-editar,
.btn-eliminar,
.btn-cancelar-factura,
.btn-cancelar-ticket,
.btn-devolver-factura {
	font-size: var(--icon-md);
	margin: 0 3px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: var(--hit);
	height: var(--hit);
	border-radius: 50%;
	border: 1px solid transparent;
	text-decoration: none;
	transition: color var(--dur-1) var(--ease-out),
	            background-color var(--dur-1) var(--ease-out),
	            border-color var(--dur-1) var(--ease-out),
	            transform var(--dur-1) var(--ease-out);
}

.btn-editar,
.btn-devolver-factura { color: var(--brand-500); }

.btn-editar:hover,
.btn-devolver-factura:hover {
	color: #fff;
	background: var(--brand-500);
	border-color: var(--brand-500);
	transform: translateY(-1px);
}

.btn-eliminar,
.btn-cancelar-factura,
.btn-cancelar-ticket { color: var(--danger); }

.btn-eliminar:hover,
.btn-cancelar-factura:hover,
.btn-cancelar-ticket:hover {
	color: #fff;
	background: var(--danger);
	border-color: var(--danger);
	transform: translateY(-1px);
}

.btn-editar:focus-visible,
.btn-eliminar:focus-visible,
.btn-cancelar-factura:focus-visible,
.btn-devolver-factura:focus-visible {
	outline: none;
	box-shadow: var(--focus-ring);
}

.btn-icon-disabled {
	opacity: .35;
	cursor: not-allowed;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: var(--hit);
	height: var(--hit);
}

.btn-icon-disabled .fa-ban,
.btn-icon-disabled .fa-exchange { color: var(--ink-mute); font-size: var(--icon-md); }

/* Devolución (php84dev): its icon follows the button colour instead of the
   fixed teal and 17px estilos.css gives it. */
.btn-devolver-factura .fa-exchange,
.btn-devolver-factura:hover .fa-exchange { color: inherit; font-size: inherit; }

/* "Devuelta" / "Devol. parcial" next to the sale's estado in the listing */
.badge-devolucion {
	display: inline-flex;
	align-items: center;
	margin: 3px 0 0 6px;
	padding: 1px 9px;
	border: 1px solid var(--brand-200);
	border-radius: var(--r-pill);
	background: var(--brand-50);
	color: var(--brand-700);
	font-size: var(--fs-xs);
	font-weight: 700;
	line-height: 1.5;
	white-space: nowrap;
}

.badge-devolucion--total {
	border-color: var(--brand-600);
	background: var(--brand-600);
	color: #fff;
}


/* ── Paginación ─────────────────────────────────────────────────────── */
/* Replaces a pile of vendor-prefixed gradients and an IE filter. */

.paginate { text-align: center; margin: 14px 0 4px; }

.paginate a {
	border-radius: var(--r-sm);
	box-shadow: none;
	border: 1px solid var(--line);
	border-top: 1px solid var(--line);
	margin: 2px 3px;
	padding: 7px 12px;
	min-width: 36px;
	display: inline-block;
	text-decoration: none;
	color: var(--ink-soft);
	font-family: var(--font-sans);
	font-size: var(--fs-md);
	font-weight: 600;
	text-shadow: none;
	background-color: var(--surface);
	background-image: none;
	filter: none;
	transition: background-color var(--dur-1) var(--ease-out),
	            border-color var(--dur-1) var(--ease-out),
	            color var(--dur-1) var(--ease-out),
	            transform var(--dur-1) var(--ease-out);
}

.paginate a:hover,
.paginate a:focus {
	border-color: var(--brand-300);
	background-color: var(--brand-50);
	background-image: none;
	color: var(--brand-600);
	transform: translateY(-1px);
	filter: none;
}

.paginate a.active {
	border-color: transparent;
	background-color: var(--brand-500);
	background-image: var(--brand-fill);
	color: #fff;
	text-shadow: none;
	box-shadow: var(--brand-glow);
	filter: none;
}

.paginate a.active:hover { transform: none; }

.paginate a.more {
	border: 0;
	background: transparent;
	box-shadow: none;
	color: var(--ink-mute);
}


/* ── Caja de filtros ────────────────────────────────────────────────── */

.buscador { position: relative; }

.buscador form {
	display: flex;
	flex-wrap: wrap;
	gap: 0 12px;
	align-items: flex-start;
}

.buscador .control-group {
	border-bottom: 0;
	padding-bottom: 10px;
}

/* The search submit is a <button class="buton action blue">, which has no
   .btn class, so it needs its own rule to match the button system. */
.buscador .buton.action,
.buton.action.blue {
	padding: 9px 18px;
	border: 1px solid transparent;
	border-radius: var(--r-sm);
	background-image: var(--brand-fill);
	background-color: var(--brand-500);
	color: #fff;
	font-family: var(--font-sans);
	font-size: var(--fs-md);
	font-weight: 600;
	text-shadow: none;
	cursor: pointer;
	box-shadow: var(--sh-1);
	transition: transform var(--dur-1) var(--ease-out),
	            box-shadow var(--dur-1) var(--ease-out),
	            filter var(--dur-1) var(--ease-out);
}

.buscador .buton.action:hover,
.buton.action.blue:hover {
	transform: translateY(-1px);
	box-shadow: var(--sh-2);
	filter: brightness(1.04);
}

.buscador .buton.action:active,
.buton.action.blue:active { transform: translateY(0) scale(.98); }

/* Alignment in the filter row. The form is a flex row with items at the
   top, and each filter is label + input, so the button — which has no
   label — sat level with the labels instead of the inputs. It now sits at
   the bottom of the row, lifted by the space under each input (the
   group's 5px margin + 10px padding + the input's 4px margin), so its
   baseline meets the fields'. Same 40px height as the inputs. */
.buscador form > .buton.action {
	align-self: flex-end;
	display: inline-flex;
	align-items: center;
	gap: 7px;
	height: 40px;
	margin: 5px 5px 19px;
	padding: 0 18px;
}

/* estilos.css pads the inner label 12px on each side for the old look */
.buscador .buton.action .label { padding: 0; }

.buscador .buton.action::before {
	content: '\f002';            /* fa-search */
	font-family: FontAwesome;
	font-size: var(--icon-sm);
	font-weight: 400;
}

/* A stray <br> before the button becomes an empty flex item */
.buscador form > br { display: none; }

@media (max-width: 768px) {
	.buscador form > .buton.action {
		width: 100%;
		justify-content: center;
		margin: 4px 0 6px;
	}
}

/* Filter card header gets an icon so it reads as a control panel, not as
   another data card. `:has()` finds it without touching the view markup. */
.box:has(.buscador) > .box-head::before {
	content: '\f1de';            /* fa-sliders */
	font-family: FontAwesome;
	font-weight: 400;
	margin-right: 8px;
	color: var(--brand-500);
}

/* Collapsible filter card on mobile — the chevron gets a real transition.
   The legacy rule spreads the header with space-between; with the icon
   added that would push the title into the middle, so the chevron takes
   the free space instead. */
.box.buscador-collapsible .box-head { justify-content: flex-start; }

.box.buscador-collapsible .box-head::after {
	margin-left: auto;
	transition: transform var(--dur-2) var(--ease-spring);
	color: var(--ink-mute);
	opacity: 1;
}


/* ── Código con acciones (includes/codigo_options.php) ─────────────── */
/* Code chip plus two icon buttons. Replaces a bold span and two buttons
   with inline colours outside the palette (#7c3aed violet, #3b82f6 blue).
   `user-select: all` lets one click select the whole code for a manual
   copy. After a copy the button turns into a green check for ~1.4s. */

.codigo-opts {
	display: inline-flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 6px;
	max-width: 100%;
}

.codigo-opts__code {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 3px 8px;
	background: var(--surface-alt);
	border: 1px solid var(--line);
	border-radius: var(--r-sm);
	color: var(--ink);
	font-weight: 600;
	letter-spacing: .02em;
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
	user-select: all;
}

.codigo-opts__code .fa { color: var(--ink-mute); font-size: var(--icon-sm); }

.codigo-opts__actions { display: inline-flex; gap: 2px; }

.codigo-opts__btn {
	display: inline-grid;
	place-items: center;
	width: var(--hit);
	height: var(--hit);
	padding: 0;
	margin: 0;
	border: 1px solid transparent;
	border-radius: var(--r-sm);
	background: transparent;
	color: var(--ink-mute);
	font-size: var(--icon-sm);
	cursor: pointer;
	transition: background-color var(--dur-1) var(--ease-out),
	            color var(--dur-1) var(--ease-out),
	            border-color var(--dur-1) var(--ease-out),
	            transform var(--dur-1) var(--ease-out);
}

.codigo-opts__btn:hover {
	background: var(--brand-50);
	border-color: var(--brand-100);
	color: var(--brand-600);
}

.codigo-opts__btn:active { transform: scale(.92); }

.codigo-opts__btn:focus-visible {
	outline: none;
	box-shadow: var(--focus-ring);
}

.codigo-opts__btn.is-done {
	background: var(--ok-soft);
	border-color: var(--ok-border);
	color: var(--ok);
}

.codigo-opts__btn.is-done .fa { animation: ui-pop var(--dur-2) var(--ease-spring); }


/* ── Barra de acciones fija ─────────────────────────────────────────── */
/* Was copy-pasted into tabla_listar_nuevo.php, tabla_agregar.php and
   tabla_editar.php. One definition now; the JS that toggles .sticky /
   .unsticky is untouched. */

.form-submit-cont {
	transition: background-color var(--dur-3) var(--ease-in-out),
	            box-shadow var(--dur-3) var(--ease-in-out);
}

.form-submit-cont.sticky {
	position: fixed !important;
	top: 0 !important;
	right: 0 !important;
	left: 0 !important;
	width: 100% !important;
	/* Fixed 64px: the listing's sticky header parks right below it
	   (--table-sticky-top). Solid white now that the page is grey — the
	   translucent bar used to melt into the white page. */
	height: 64px;
	padding: 0 31px;
	z-index: 50;
	background: var(--surface);
	border-bottom: 1px solid var(--line);
	box-shadow: var(--sh-2);
	animation: ui-enter-down var(--dur-3) var(--ease-out);
	transform: translateY(0);
}

.form-submit-cont.unsticky {
	animation: ui-exit-up var(--dur-2) var(--ease-in-out);
}

@keyframes ui-enter-down {
	from { transform: translateY(-100%); opacity: 0; }
	to   { transform: translateY(0);     opacity: 1; }
}

@keyframes ui-exit-up {
	from { transform: translateY(0);     opacity: 1; }
	to   { transform: translateY(-20px); opacity: 0; }
}

/* The inline copies used to scale every button 5% on hover while sticky.
   Those rules are gone with the inline blocks, and the buttons' own hover
   and press states apply the same whether the bar is sticky or not. */

.form-submit-cont.disabled-menu { opacity: .8; pointer-events: none; cursor: progress; }


/* ── Botones principales del formulario ─────────────────────────────── */
/* `.save-button` (Guardar) and `.button-add-new` (+) sit in the fixed bar
   on every add/edit page. The hierarchy was inverted: "add another" was
   the solid navy block and "save" the thin outline. Save is the primary
   action on an edit form, so it now carries the brand fill.
   componentes/impacto_stock.php hides both with display:none !important
   when the record is locked; nothing below uses !important, so that
   still wins. */

/* "Pegar" next to barcode inputs (ui-motion.js initPasteButtons, any
   input marked data-paste). The input keeps its own look; the button is a
   square the height of a field. */
.ui-paste {
	display: flex;
	align-items: center;
	gap: 6px;
	width: 100%;
	margin-bottom: 4px;
}

.ui-paste > input { flex: 1 1 auto; min-width: 0; margin-bottom: 0; }

.ui-paste__btn {
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: var(--hit);
	height: var(--hit);
	margin: 0;
	padding: 0;
	border: 1px solid var(--line-strong);
	border-radius: var(--r-sm);
	background: var(--surface);
	color: var(--brand-600);
	font-size: var(--icon-sm);
	cursor: pointer;
	transition: background-color var(--dur-1) var(--ease-out), border-color var(--dur-1) var(--ease-out);
}

.ui-paste__btn:hover { background: var(--brand-50); border-color: var(--brand-300); }
.ui-paste__btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }

/* The toolbar is shared: besides Guardar and +, components write into it.
   code_reader and its variants, manual_ticket and
   select_product_by_categoria_obs prepend `.invoice-btn` buttons (white
   print/copy/ray icons on `.blue` or `.dark-action`), manual_invoice
   replaces the contents, impacto_stock empties it. Those buttons came with
   the legacy sizes (58x46, 5px margins, a teal `.action` border forced
   with !important), so the bar looked like three different kits. Every
   direct child now shares one box: 42px high, same radius, 8px apart.
   Names for the icon-only buttons come from ui-motion.js (initActionLabels),
   by `data-destino`, so a component that injects a button needs no change. */
.right-block-menu { gap: 8px; align-items: center; }

.right-block-menu > button,
.right-block-menu > .save-button-container { margin: 0; }

.right-block-menu .invoice-btn {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: auto;
	min-width: 46px;
	height: 42px;
	padding: 0 12px;
	border: 1px solid transparent !important;   /* beats legacy button.action */
	border-radius: var(--r-md);
	background-image: none;
	color: #fff;
	box-shadow: var(--sh-1);
	cursor: pointer;
	transition: transform var(--dur-1) var(--ease-out),
	            box-shadow var(--dur-1) var(--ease-out),
	            background-color var(--dur-1) var(--ease-out);
}

/* The injected icons are white (print.svg, copy.svg, ray.png 32px) */
.right-block-menu .invoice-btn img {
	display: block;
	width: 20px;
	height: 20px;
	object-fit: contain;
}

/* "Facturar"/"Ticket"/"Orden": a document goes out, the brand colour.
   Copies and quick sale: navy, the secondary tone of the shell. */
.right-block-menu .invoice-btn.blue        { background-color: var(--brand-solid); }
.right-block-menu .invoice-btn.dark-action { background-color: var(--nav-800); }

.right-block-menu .invoice-btn.blue:hover        { background-color: var(--brand-hover); }
.right-block-menu .invoice-btn.dark-action:hover { background-color: var(--nav-700); }

.right-block-menu .invoice-btn:hover {
	background-image: none;
	box-shadow: var(--sh-2);
	transform: translateY(-1px);
}

.right-block-menu .invoice-btn:active { transform: scale(.97); }

.right-block-menu .invoice-btn:focus-visible,
.right-block-menu .button-add-new:focus-visible {
	outline: none;
	box-shadow: var(--sh-1), var(--focus-ring);
}

/* Name of each icon on hover or keyboard focus, below the button (the bar
   sits at the top of the screen). Guardar is left out: hovering it already
   opens its menu of save options. Pointer devices only; on touch a tap
   would leave the label stuck. */
@media (hover: hover) {
	.right-block-menu [data-ui-tip] { position: relative; }

	.right-block-menu [data-ui-tip]::after {
		content: attr(data-ui-tip);
		position: absolute;
		top: calc(100% + 8px);
		right: 0;
		z-index: 60;
		padding: 5px 9px;
		border-radius: var(--r-sm);
		background: var(--nav-900);
		color: #fff;
		font-family: var(--font-sans);
		font-size: var(--fs-xs);
		font-weight: 600;
		line-height: 1.3;
		white-space: nowrap;
		box-shadow: var(--sh-2);
		pointer-events: none;
		opacity: 0;
		transform: translateY(-3px);
		transition: opacity var(--dur-1) var(--ease-out),
		            transform var(--dur-1) var(--ease-out);
	}

	.right-block-menu [data-ui-tip]:hover::after,
	.right-block-menu [data-ui-tip]:focus-visible::after {
		opacity: 1;
		transform: translateY(0);
		transition-delay: .25s;
	}
}

.save-button,
.button-add-new {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: auto;
	min-width: 46px;
	height: 42px;
	padding: 0 14px;
	border-radius: var(--r-md);
	cursor: pointer;
	transition: transform var(--dur-1) var(--ease-out),
	            box-shadow var(--dur-1) var(--ease-out),
	            background-color var(--dur-1) var(--ease-out),
	            border-color var(--dur-1) var(--ease-out);
}

.save-button {
	position: relative;
	border: 1px solid transparent;
	background-color: var(--brand-500);
	background-image: var(--brand-fill);
	box-shadow: var(--sh-2);
}

/* save.svg is a single #081623 path; this turns it white on the brand fill */
.save-button img {
	display: block;
	width: 20px;
	height: 20px;
	filter: brightness(0) invert(1);
	transition: opacity var(--dur-1) var(--ease-out);
}

.save-button:hover {
	background-image: var(--brand-fill-hover);
	box-shadow: var(--sh-3);
	transform: translateY(-1px);
}

.save-button:active { transform: scale(.97); }

.save-button:focus-visible {
	outline: none;
	box-shadow: var(--sh-2), var(--focus-ring);
}

.button-add-new {
	background: var(--surface);
	border: 1px solid var(--line-strong);
	color: var(--brand-600);
	font-size: var(--icon-lg);
	box-shadow: var(--sh-1);
}

.button-add-new:hover {
	background: var(--brand-50);
	border-color: var(--brand-300);
	transform: translateY(-1px);
}

.button-add-new:active { transform: scale(.97); }

/* While bloquearSubmit() holds the form, the save icon becomes a spinner.
   Driven by the `.disabled-menu` class the function already adds. */
.form-submit-cont.disabled-menu .save-button img { opacity: 0; }

/* Read-only ficha (tabla_editar.php fichaSoloLectura()): nothing is saving, so
   no spinner; the buttons are disabled instead. */
body.ficha-solo-lectura .form-submit-cont.disabled-menu .save-button img { opacity: 1; }
body.ficha-solo-lectura .form-submit-cont.disabled-menu .save-button::after { content: none; }
body.ficha-solo-lectura .load { display: none; }
body.ficha-solo-lectura .form-agregar :disabled { cursor: not-allowed; }
/* Sub-ABM row actions and jQuery UI selectmenus are links, which :disabled
   doesn't reach; CSS also covers rows the sub-ABM loads later */
body.ficha-solo-lectura .form-agregar .btn-options-sug { display: none; }
body.ficha-solo-lectura .form-agregar .ui-selectmenu { pointer-events: none; opacity: .6; }

.form-submit-cont.disabled-menu .save-button::after {
	content: '';
	position: absolute;
	top: 50%;
	left: 50%;
	width: 16px;
	height: 16px;
	margin: -8px 0 0 -8px;
	border: 2px solid rgba(255,255,255,.35);
	border-top-color: #fff;
	border-radius: 50%;
	animation: ui-spin .7s linear infinite;
}

@media (max-width: 768px) {
	/* styles_1.min.css la deja transparente en el celular: sin la línea de abajo, que quedaba suelta */
	.form-submit-cont.sticky { padding: 0 16px; border-bottom: 0; }
}


/* ── Dropdown de guardar ────────────────────────────────────────────── */
/* Also lifted out of tabla_agregar.php and tabla_editar.php. */

.save-button-container {
	position: relative;
	display: inline-block;
}

.save-dropdown {
	position: absolute;
	top: calc(100% + 6px);
	right: 0;
	min-width: 190px;
	padding: 5px;
	background: var(--surface);
	border: 1px solid var(--line);
	border-radius: var(--r-md);
	box-shadow: var(--sh-3);
	opacity: 0;
	visibility: hidden;
	transform: translateY(-6px) scale(.97);
	transform-origin: top right;
	transition: opacity var(--dur-2) var(--ease-out),
	            transform var(--dur-2) var(--ease-spring),
	            visibility var(--dur-2);
	z-index: 1000;
	white-space: nowrap;
}

.save-button-container:hover .save-dropdown,
.save-button-container:focus-within .save-dropdown {
	opacity: 1;
	visibility: visible;
	transform: translateY(0) scale(1);
}

.save-option {
	width: 100%;
	padding: 9px 12px;
	border: none;
	border-radius: var(--r-sm);
	background: transparent;
	text-align: left;
	cursor: pointer;
	display: flex;
	align-items: center;
	gap: 9px;
	font-family: var(--font-sans);
	font-size: var(--fs-md);
	font-weight: 500;
	color: var(--ink);
	white-space: nowrap;
	transition: background-color var(--dur-1) var(--ease-out),
	            color var(--dur-1) var(--ease-out);
}

.save-option:hover {
	background-color: var(--brand-50);
	color: var(--brand-600);
}

.save-option i {
	margin-right: 0;
	font-size: var(--fs-xs);
	width: 15px;
	text-align: center;
	color: var(--ink-mute);
}

.save-option:hover i { color: var(--brand-500); }

/* The old dark dropdown drew its arrow with two stacked triangles; those
   are gone. `::before` is reused as an invisible bridge over the 6px gap
   between the button and the menu. Without it the pointer leaves
   `.save-button-container` while crossing the gap, `:hover` drops, and the
   menu closes before it can be reached. */
.save-dropdown::after { content: none; }

.save-dropdown::before {
	content: '';
	position: absolute;
	left: 0;
	right: 0;
	top: -8px;
	height: 8px;
	width: auto;
	border: 0;
}

@media (max-width: 768px) {
	.save-dropdown { min-width: 170px; right: -8px; }
	.save-option   { padding: 11px 12px; font-size: var(--fs-base); }
}


/* ── Banner de error de guardado ────────────────────────────────────── */
/* Moved out of tabla_editar.php. Reads as a toast now. */

.message-error-busy {
	position: fixed;
	left: calc(var(--nav-w) + 16px);
	top: 16px;
	z-index: 150;
	max-width: 460px;
	display: none;
	align-items: flex-start;
	gap: 10px;
	padding: 12px 16px;
	background: var(--surface);
	border: 1px solid var(--danger-border);
	border-left: 3px solid var(--danger);
	border-radius: var(--r-md);
	box-shadow: var(--sh-3);
	color: var(--danger);
	font-family: var(--font-sans);
	font-size: var(--fs-md);
	font-weight: 500;
	line-height: 1.5;
	animation: ui-slide-in-left var(--dur-3) var(--ease-out);
}

/* The JS reveals it with .show(), which writes display:block inline.
   The flex layout is opted into only once it is actually visible. */
.message-error-busy[style*="block"] { display: flex !important; }

/* Cancelled sale (tabla_editar): solid danger with white text. It used to
   get a red gradient inline, which left the theme's red text on red. */
.message-error-busy.is-cancelada {
	background: var(--danger);
	border-color: var(--danger);
	color: #fff;
}

/* Logged-in user without a group (includes/aviso_sin_grupo.php, both layouts) */
.aviso-sin-grupo {
	display: flex;
	align-items: flex-start;
	gap: 12px;
	margin: 16px;
	padding: 14px 16px;
	border: 1px solid var(--warn-border);
	border-radius: var(--r-md);
	background: var(--warn-soft);
	color: var(--warn);
	font-size: 14px;
	line-height: 1.5;
}
.aviso-sin-grupo > .fa { font-size: 18px; line-height: 1.3; flex: 0 0 auto; }
.aviso-sin-grupo strong { display: block; font-weight: 700; }

/* Online store not updated after a cancel / return (tabla_results:
   avisoWooSync): warning note in the Swal footer, with the button to the
   WooCommerce tool when the user can open it. */
.swal2-footer:has(.woo-sync-aviso) { border-top: 0; padding-top: 0; }
.woo-sync-aviso {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 10px;
	width: 100%;
	padding: 12px 14px;
	border: 1px solid var(--warn-border);
	border-radius: var(--r-md);
	background: var(--warn-soft);
	color: var(--warn);
	font-size: 13px;
	line-height: 1.45;
	text-align: center;
}
.woo-sync-aviso__btn {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 7px 14px;
	border-radius: var(--r-sm);
	background: var(--brand-fill);
	color: #fff !important;
	font-weight: 600;
	text-decoration: none !important;
}
.woo-sync-aviso__btn:hover { background: var(--brand-fill-hover); }

.message-error-busy::before {
	content: '\f06a';            /* fa-exclamation-circle */
	font-family: FontAwesome;
	font-size: var(--icon-md);
	line-height: 1.4;
	margin-right: 0;
	flex: 0 0 auto;
}

@keyframes ui-slide-in-left {
	from { transform: translateX(-24px); opacity: 0; }
	to   { transform: translateX(0);     opacity: 1; }
}

@media (max-width: 768px) {
	.message-error-busy {
		top: calc(env(safe-area-inset-top, 0px) + 10px);
		left: 10px;
		right: 10px;
		max-width: none;
		font-size: var(--fs-sm);
		padding: 10px 14px;
	}
}


/* ── Grupos del formulario ──────────────────────────────────────────── */
/* `.new-title` is a collapsible section header. The chevron was a PNG
   background image; it is a FontAwesome glyph now, so it can rotate. */

.new-title {
	position: relative;
	display: flex;
	align-items: center;
	gap: 9px;
	padding: 13px 44px 13px 16px;
	margin: 18px 0 10px;
	background: var(--surface);
	background-image: none;
	border: 1px solid var(--line);
	border-left: 3px solid var(--brand-500);
	border-radius: var(--r-md);
	color: var(--ink);
	font-size: var(--fs-base);
	font-weight: 600;
	letter-spacing: .01em;
	cursor: pointer;
	user-select: none;
	transition: background-color var(--dur-1) var(--ease-out),
	            border-color var(--dur-1) var(--ease-out),
	            box-shadow var(--dur-1) var(--ease-out);
}

.new-title:hover {
	background: var(--brand-50);
	border-color: var(--brand-200);
	border-left-color: var(--brand-500);
	box-shadow: var(--sh-1);
}

.new-title::after {
	content: '\f107';            /* fa-angle-down */
	font-family: FontAwesome;
	position: absolute;
	right: 16px;
	top: 50%;
	font-size: var(--icon-md);
	font-weight: 400;
	color: var(--ink-mute);
	transform: translateY(-50%) rotate(-90deg);
	transition: transform var(--dur-2) var(--ease-spring),
	            color var(--dur-1) var(--ease-out);
}

.new-title:hover::after { color: var(--brand-500); }

/* The engine toggles `.show-it` on the fields (`.grupoN`), never on the
   title (`.gtitleN`), and CSS cannot express that pairing: a sibling
   selector would rotate every chevron above any open group. So
   `.is-open` is toggled on the title by ui-motion.js, on the same click
   the view's own handler already listens for. */
.new-title.is-open::after {
	transform: translateY(-50%) rotate(0deg);
}

/* Fields revealed by the group toggle animate in instead of snapping */
div.show-it {
	display: inline-block !important;
	animation: ui-enter-sm var(--dur-2) var(--ease-out);
}

.content-subamb-zaphify.show-it {
	display: flex !important;
	animation: ui-enter-sm var(--dur-2) var(--ease-out);
}


/* ── Indicador .load ───────────────────────────────────────────────── */
/* 22 views render `<div class="load"><img src=".../load.gif"></div>`.
   Rather than edit each one, the gif is hidden and a token-based ring
   spinner is drawn in its place, so the markup and the JS that toggles
   `.none` keep working untouched. */

.load { text-align: center; margin: 10px 0; }

.load img { display: none; }

.load:not(.none)::after {
	content: '';
	display: inline-block;
	width: 26px;
	height: 26px;
	border: 3px solid var(--brand-100);
	border-top-color: var(--brand-500);
	border-radius: 50%;
	animation: ui-spin .7s linear infinite;
}

/* Backdrop the submit blocker drops over the form while a save is in
   flight — was a flat 50% white wash. Kept scoped exactly like the
   original rule: a bare `.block` also matches divs outside the bar that
   have no positioning and would show as a stray tinted rectangle. */
.form-submit-cont .block:not(.none) {
	background: rgba(244,246,248,.6);
	backdrop-filter: blur(1px);
	-webkit-backdrop-filter: blur(1px);
}


/* ── Skeleton de la tabla ───────────────────────────────────────────── */
/* Same markup `showTableSkeleton()` already builds; the placeholder bars
   now match the real header and rows so the swap is not a jump. */

.table-skeleton { border-radius: var(--r-md); }

.table-skeleton-header {
	background: var(--surface-alt);
	border-radius: var(--r-md) var(--r-md) 0 0;
	border-bottom: 2px solid var(--line-strong);
	padding: 11px 14px;
}

.table-skeleton-header .sk-cell {
	height: 11px;
	border-radius: var(--r-pill);
	background-image: linear-gradient(90deg,
		var(--brand-100) 0%,
		var(--brand-200) 50%,
		var(--brand-100) 100%);
	background-size: 200% 100%;
	animation: ui-shimmer 1.4s linear infinite;
}

.table-skeleton-row {
	padding: 11px 14px;
	border-bottom: 1px solid var(--line);
}

.table-skeleton-row:nth-child(even) { background: transparent; }

.table-skeleton-row .sk-cell {
	height: 11px;
	border-radius: var(--r-pill);
	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;
}


/* ── Estado vacío ───────────────────────────────────────────────────── */

.ui-empty {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 10px;
	padding: 46px 20px;
	text-align: center;
	color: var(--ink-mute);
}

.ui-empty__icon {
	display: grid;
	place-items: center;
	width: 62px;
	height: 62px;
	border-radius: 50%;
	background: var(--brand-fill-soft);
	color: var(--brand-600);
	font-size: 25px;
}

.ui-empty__title {
	font-size: var(--fs-lg);
	font-weight: 600;
	color: var(--ink);
}

.ui-empty__hint { font-size: var(--fs-md); max-width: 340px; line-height: 1.5; }

/* The empty state is one full-width cell: it must not pick up row hover,
   cell borders, or the mobile card treatment. */
.general_result_rows #table > tbody > tr.ui-empty-row > td,
.general_result_rows #table > tbody > tr.ui-empty-row:hover > td,
.box-body tbody tr.ui-empty-row td,
.box-body tbody tr.ui-empty-row:hover td {
	background: transparent;
	border: 0;
	padding: 0;
}


/* ── Tarjetas de fila en mobile ─────────────────────────────────────── */

@media (max-width: 768px) {

	/* Rows become cards (estilos.css), so the desktop table frame and the
	   desktop column sizing step aside. The header is hidden here, so its
	   sticky rule is moot. */
	.general_result_rows #table {
		border: 0;
		border-radius: 0;
		box-shadow: none;
		background: transparent;
		margin-top: 6px;
	}

	.general_result_rows #table > tbody > tr > td.col-id,
	.general_result_rows #table > tbody > tr > td.xg { width: 100%; }

	.general_result_rows #table > thead > tr > .col-num,
	.general_result_rows #table > tbody > tr > .col-num { text-align: left; }

	.general_result_rows #table > tbody > tr > td { vertical-align: initial; }

	/* Column dividers and zebra are desktop reading aids; each card is its
	   own block here. */
	.general_result_rows #table > tbody > tr > td + td { border-left: 0; }
	.general_result_rows #table > tbody > tr:nth-child(even) > td { background-color: transparent; }

	/* The desktop rule drops the bottom border of the last table row; in
	   card mode every card needs its own separators back. */
	.general_result_rows #table > tbody > tr:last-child > td:not(.md):not(.xg) {
		border-bottom: 1px solid var(--line);
		border-radius: 0;
	}

	.general_result_rows #table > tbody > tr:last-child > td:not(.md):not(.xg):last-of-type { border-bottom: 0; }

	.general_result_rows #table > tbody > tr {
		background: var(--surface);
		border: 1px solid var(--line);
		border-radius: var(--r-md);
		margin-bottom: 12px;
		box-shadow: var(--sh-1);
		overflow: hidden;
	}

	.general_result_rows #table > tbody > tr:hover > td { background-color: transparent; }

	.general_result_rows #table > tbody > tr > td:not(.md):not(.xg) {
		border-bottom: 1px solid var(--line);
		padding: 9px 13px;
	}

	.general_result_rows #table > tbody > tr > td:not(.md):not(.xg)::before {
		color: var(--ink-mute);
		font-size: var(--fs-xs);
		font-weight: 700;
		letter-spacing: .06em;
	}

	.general_result_rows #table > tbody > tr > td.xg {
		background: var(--surface-alt);
		border-top: 1px solid var(--line);
		padding: 9px 13px;
	}

	/* The 768px rules turn every `tr` into a card and every `td` into a
	   label/value row. The empty state is neither, so it opts out. */
	.general_result_rows #table > tbody > tr.ui-empty-row {
		background: transparent;
		border: 0;
		box-shadow: none;
		margin: 0;
	}

	.general_result_rows #table > tbody > tr.ui-empty-row > td {
		display: block !important;
		border: 0;
		padding: 0;
	}

	.general_result_rows #table > tbody > tr.ui-empty-row > td::before {
		content: none;
	}

	.ui-empty { padding: 34px 16px; }

	/* A table inside a listing cell (an include such as the cuenta corriente
	   statement) stays a table. estilos.css turns `#table td` into labelled
	   flex cards and hides `#table thead` with descendant selectors and
	   !important, which also reached these nested tables. The prefix
	   td:not(.md):not(.xg) matches those legacy rules' weight so these win. */
	.general_result_rows #table td table { display: table; width: 100%; }
	.general_result_rows #table td table thead { display: table-header-group !important; }
	.general_result_rows #table td table tbody { display: table-row-group; }

	.general_result_rows #table td table tr {
		display: table-row;
		width: auto;
		margin: 0;
		border: 0;
		border-radius: 0;
		box-shadow: none;
		background: transparent;
	}

	.general_result_rows #table td:not(.md):not(.xg) table td:not(.md):not(.xg),
	.general_result_rows #table td:not(.md):not(.xg) table th {
		display: table-cell !important;
		width: auto;
		min-height: 0;
		gap: 0;
		padding: 5px 7px;
		border-right: 0;
		border-bottom: 1px solid var(--line);
	}

	.general_result_rows #table td:not(.md):not(.xg) table td:not(.md):not(.xg)::before {
		content: none;
		display: none;
	}
}


/* ═══════════════════════════════════════════════════════════════════
   WIDGETS DE TERCEROS
   Each vendor ships its own look (sprites, blue/orange accents, 2px
   corners). These bring them onto the same tokens as native inputs, so a
   form reads as one system regardless of which plugin drew each field.
   Where a vendor uses !important, the override has to as well, at the
   same or higher specificity; each such spot says why.
   ═══════════════════════════════════════════════════════════════════ */

/* ── Selects: jQuery UI selectmenu 1.5.0pre (Filament Group) ─────────── */
/* Not the official 1.11 widget: this is the older plugin with the
   `selectmenu("value")` API used across componentes/. Button is an
   `a.ui-selectmenu`; the menu is a `div.ui-selectmenu-menu > ul` appended
   to <body> and placed with left/top by jQuery UI position (no transform),
   so the list can be animated freely. */

/* estilos.css sets `.ui-state-default { background: #ddd !important }` for
   every jQuery UI widget; !important is the only way past it. */
a.ui-selectmenu.ui-state-default {
	background: var(--field-bg) !important;
}

a.ui-selectmenu.ui-widget {
	display: inline-flex;
	align-items: center;
	height: 40px;
	max-width: 100%;
	border: 1px solid var(--field-border);
	border-radius: var(--r-sm);
	color: var(--ink);
	font-family: var(--font-sans);
	font-size: var(--fs-base);
	font-weight: 400;
	text-decoration: none;
	cursor: pointer;
	transition: border-color var(--dur-1) var(--ease-out),
	            box-shadow var(--dur-1) var(--ease-out);
}

/* The plugin swaps ui-corner-all for ui-corner-top while open, to fuse
   the button with an attached list. The list floats detached now. */
a.ui-selectmenu.ui-corner-all,
a.ui-selectmenu.ui-corner-top { border-radius: var(--r-sm); }

a.ui-selectmenu.ui-state-hover { border-color: var(--brand-300); color: var(--ink); }

a.ui-selectmenu.ui-state-focus,
a.ui-selectmenu.ui-state-active {
	background: var(--surface) !important;   /* white while focused / open */
	border-color: var(--brand-500);
	box-shadow: var(--focus-ring);
	color: var(--ink);
}

a.ui-selectmenu .ui-selectmenu-status {
	flex: 1;
	min-width: 0;
	padding: 0 34px 0 11px;
	line-height: 38px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	color: var(--ink);
}

/* Sprite triangle -> FontAwesome chevron that flips while open.
   `.ui-icon` hides its text with a huge negative indent; reset it so the
   glyph can render. */
a.ui-selectmenu .ui-selectmenu-icon.ui-icon {
	right: 10px;
	width: 16px;
	height: 16px;
	margin-top: -8px;
	background-image: none;
	text-indent: 0;
	overflow: visible;
	line-height: 16px;
	text-align: center;
	color: var(--ink-mute);
	transition: transform var(--dur-2) var(--ease-spring),
	            color var(--dur-1) var(--ease-out);
}

a.ui-selectmenu .ui-selectmenu-icon.ui-icon::before {
	content: '\f107';            /* fa-angle-down */
	font-family: FontAwesome;
	font-size: var(--icon-md);
}

a.ui-selectmenu.ui-state-active .ui-selectmenu-icon.ui-icon {
	transform: rotate(180deg);
	color: var(--brand-500);
}

a.ui-selectmenu.ui-state-disabled {
	background: var(--bg-sunken) !important;
	color: var(--ink-mute);
	cursor: not-allowed;
	opacity: 1;
}

/* Gap between button and list. On the wrapper — the element jQuery UI
   positions — not on the list: with collision:'flip' the wrapper can be
   placed above the button, and a margin on the list would then push it
   down over the button. Padding on the wrapper gives 4px of air when the
   list opens below and sits flush when it flips above. */
.ui-selectmenu-menu { padding-top: 4px; }

.ui-selectmenu-menu > ul.ui-widget-content {
	padding: 4px;
	background: var(--surface);
	border: 1px solid var(--line);
	border-radius: var(--r-md);
	box-shadow: var(--sh-3);
	color: var(--ink);
	font-family: var(--font-sans);
	font-size: var(--fs-base);
}

.ui-selectmenu-menu.ui-selectmenu-open > ul {
	animation: ui-dropdown-in var(--dur-2) var(--ease-out);
	transform-origin: top center;
}

.ui-selectmenu-menu li {
	margin: 1px 0;
	border: 0 !important;        /* plugin draws dotted transparent borders with !important widths */
	border-radius: var(--r-sm);
}

.ui-selectmenu-menu li a {
	padding: 8px 30px 8px 10px;
	border-radius: var(--r-sm);
	color: var(--ink);
	line-height: 1.35;
}

.ui-selectmenu-menu li.ui-state-hover {
	background: var(--brand-50);
	border-color: transparent;
}

.ui-selectmenu-menu li.ui-state-hover a { color: var(--brand-700); }

.ui-selectmenu-menu li.ui-selectmenu-item-selected,
.ui-selectmenu-menu li.ui-state-active {
	position: relative;
	background: transparent;
	border-color: transparent;
}

.ui-selectmenu-menu li.ui-selectmenu-item-selected a {
	color: var(--brand-600);
	font-weight: 600;
}

.ui-selectmenu-menu li.ui-selectmenu-item-selected::after {
	content: '\f00c';            /* fa-check */
	font-family: FontAwesome;
	position: absolute;
	right: 10px;
	top: 50%;
	margin-top: -8px;
	line-height: 16px;
	font-size: var(--fs-xs);
	color: var(--brand-500);
	pointer-events: none;
}

.ui-selectmenu-menu li.ui-selectmenu-item-selected.ui-state-hover { background: var(--brand-50); }

.ui-selectmenu-menu .ui-selectmenu-group .ui-selectmenu-group-label {
	padding: 8px 10px 4px;
	font-size: var(--fs-xs);
	font-weight: 700;
	letter-spacing: .06em;
	text-transform: uppercase;
	color: var(--ink-mute);
}


/* ── Selector con búsqueda en el servidor (componentes/single_select_ajax) ── */
/* Se ve como el multiple select de abajo: mismo alto, borde y panel. */

.ssa { position: relative; }

.ssa > .ssa-input {
	width: 100%;
	height: 40px;
	padding: 0 34px 0 11px;
	border: 1px solid var(--field-border);
	border-radius: var(--r-sm);
	background: var(--field-bg);
	color: var(--ink);
	font-size: var(--fs-base);
	transition: border-color var(--dur-1) var(--ease-out),
	            box-shadow var(--dur-1) var(--ease-out),
	            background-color var(--dur-1) var(--ease-out);
}

.ssa > .ssa-input:hover { border-color: var(--brand-300); }

.ssa > .ssa-input:focus {
	background: var(--surface);
	border-color: var(--brand-500);
	box-shadow: var(--focus-ring);
	outline: none;
}

.ssa > .ssa-input::placeholder { color: var(--ink-mute); }

.ssa > .ssa-limpiar {
	position: absolute;
	top: 0;
	right: 4px;
	width: 30px;
	height: 40px;
	border: 0;
	background: none;
	color: var(--ink-mute);
	cursor: pointer;
}

.ssa > .ssa-limpiar:hover { color: var(--ink); }

.ssa > .ssa-opciones {
	position: absolute;
	z-index: 50;
	left: 0;
	right: 0;
	margin: 4px 0 0;
	padding: 4px;
	max-height: 280px;
	overflow-y: auto;
	list-style: none;
	background: var(--surface);
	border: 1px solid var(--line);
	border-radius: var(--r-md);
	box-shadow: var(--sh-3);
	color: var(--ink);
	animation: ui-dropdown-in var(--dur-2) var(--ease-out);
}

.ssa-opciones > li {
	padding: 8px 10px;
	border-radius: var(--r-xs);
	font-size: var(--fs-base);
}

.ssa-opciones > .ssa-opcion { cursor: pointer; }

.ssa-opciones > .ssa-opcion:hover,
.ssa-opciones > .ssa-opcion.activa { background: var(--brand-fill-soft); }

.ssa-opciones > .ssa-aviso { color: var(--ink-mute); }


/* ── Multiple select 1.1.0 (wenzhixin) ──────────────────────────────── */
/* The drop panel is shown/hidden with display, so the CSS entrance below
   replays on every open without touching the plugin. */

/* Vendor pins height with !important. */
.ms-parent > .ms-choice {
	height: 40px !important;
	border: 1px solid var(--field-border);
	border-radius: var(--r-sm);
	background: var(--field-bg);
	color: var(--ink);
	transition: border-color var(--dur-1) var(--ease-out),
	            box-shadow var(--dur-1) var(--ease-out),
	            background-color var(--dur-1) var(--ease-out);
}

.ms-parent > .ms-choice:hover { border-color: var(--brand-300); }

/* Open state, read from the panel the plugin shows with inline display */
.ms-parent:has(> .ms-drop[style*="block"]) > .ms-choice,
.ms-parent > .ms-choice:focus {
	background: var(--surface);
	border-color: var(--brand-500);
	box-shadow: var(--focus-ring);
	outline: none;
}

.ms-parent > .ms-choice > span {
	padding-left: 11px;
	line-height: 38px;
	font-size: var(--fs-base);
	color: var(--ink);
}

.ms-parent > .ms-choice > span.placeholder { color: var(--ink-mute); }

/* Sprite arrow -> chevron */
.ms-parent > .ms-choice > div,
.ms-parent > .ms-choice > div.open {
	top: 0;
	right: 10px;
	width: 16px;
	height: 100%;
	background: none;
	display: flex;
	align-items: center;
	justify-content: center;
	color: var(--ink-mute);
	transition: transform var(--dur-2) var(--ease-spring);
}

.ms-parent > .ms-choice > div::before {
	content: '\f107';
	font-family: FontAwesome;
	font-size: var(--icon-md);
}

.ms-parent > .ms-choice > div.open {
	transform: rotate(180deg);
	color: var(--brand-500);
}

.ms-parent > .ms-drop {
	padding: 4px;
	background: var(--surface);
	border: 1px solid var(--line);
	border-radius: var(--r-md);
	box-shadow: var(--sh-3);
	color: var(--ink);
	animation: ui-dropdown-in var(--dur-2) var(--ease-out);
}

.ms-parent > .ms-drop.bottom { margin-top: 4px; }

/* La lista se recorre con el dedo (iPhone): scroll táctil propio que no arrastra la página.
   Al abrir en un táctil, el plugin la sube para que quede arriba de la barra de abajo. */
.ms-drop ul {
	-webkit-overflow-scrolling: touch;
	overscroll-behavior: contain;
	touch-action: pan-y;
}

.ms-parent > .ms-drop.top    { margin-top: 0; margin-bottom: 4px; }

.ms-drop ul > li label {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 7px 8px;
	border-radius: var(--r-sm);
	font-size: var(--fs-base);
	color: var(--ink);
	cursor: pointer;
	transition: background-color var(--dur-1) var(--ease-out);
}

.ms-drop ul > li label:hover { background: var(--brand-50); }

.ms-drop ul > li label.optgroup {
	font-size: var(--fs-xs);
	font-weight: 700;
	letter-spacing: .06em;
	text-transform: uppercase;
	color: var(--ink-mute);
}

.ms-drop input[type="checkbox"],
.ms-drop input[type="radio"] { accent-color: var(--brand-500); }   /* radio: single selects */

.ms-drop .ms-no-results { padding: 10px; color: var(--ink-mute); font-size: var(--fs-md); }

/* Search box. The base input rule in base.css uses the `background`
   shorthand, which also wiped this plugin's magnifier sprite; the icon is
   redrawn with FontAwesome on the wrapper. */
.ms-drop .ms-search { position: relative; padding: 4px 4px 6px; }

.ms-drop .ms-search::before {
	content: '\f002';            /* fa-search */
	font-family: FontAwesome;
	position: absolute;
	left: 15px;
	top: 50%;
	margin-top: -9px;
	font-size: var(--icon-sm);
	line-height: 16px;
	color: var(--ink-faint);
	pointer-events: none;
}

.ms-drop .ms-search input {
	padding: 8px 10px 8px 32px;
	border: 1px solid var(--field-border);
	border-radius: var(--r-sm);
	background: var(--field-bg);
	font-family: var(--font-sans);
	font-size: var(--fs-md);
}


/* ── Date/time picker (xdsoft) ──────────────────────────────────────── */
/* Paddings are left alone on purpose: the date and time panes are floats
   with fixed widths, and changing the container padding wraps the time
   column under the calendar. */

.xdsoft_datetimepicker {
	border: 1px solid var(--line);
	border-radius: var(--r-lg);
	background: var(--surface);
	box-shadow: var(--sh-4);
	color: var(--ink);
	font-family: var(--font-sans);
	animation: ui-dropdown-in var(--dur-2) var(--ease-out);
}

.xdsoft_datetimepicker.xdsoft_inline {
	box-shadow: var(--sh-1);
	animation: none;
}

.xdsoft_datetimepicker .xdsoft_label {
	font-weight: 600;
	color: var(--ink);
	background: transparent;
}

.xdsoft_datetimepicker .xdsoft_label:hover {
	text-decoration: none;
	color: var(--brand-600);
}

.xdsoft_datetimepicker .xdsoft_prev,
.xdsoft_datetimepicker .xdsoft_next,
.xdsoft_datetimepicker .xdsoft_today_button {
	border-radius: var(--r-sm);
	transition: opacity var(--dur-1) var(--ease-out),
	            background-color var(--dur-1) var(--ease-out);
}

.xdsoft_datetimepicker .xdsoft_prev:hover,
.xdsoft_datetimepicker .xdsoft_next:hover,
.xdsoft_datetimepicker .xdsoft_today_button:hover { background-color: var(--brand-50); }

.xdsoft_datetimepicker .xdsoft_label > .xdsoft_select {
	border: 1px solid var(--line);
	border-radius: var(--r-md);
	box-shadow: var(--sh-3);
	background: var(--surface);
}

.xdsoft_datetimepicker .xdsoft_label > .xdsoft_select > div > .xdsoft_option {
	padding: 3px 12px 3px 8px;
	font-weight: 500;
}

.xdsoft_datetimepicker .xdsoft_label > .xdsoft_select > div > .xdsoft_option:hover {
	color: var(--brand-700);
	background: var(--brand-50);
}

.xdsoft_datetimepicker .xdsoft_label > .xdsoft_select > div > .xdsoft_option.xdsoft_current {
	background: var(--brand-500);
	box-shadow: none;
	color: #fff;
}

/* Calendar grid: borderless cells, weekday header in small caps.
   The vendor collapses the table borders, and a collapsed table ignores
   border-radius on its cells; separate borders with a 2px gutter let the
   selected day render as a rounded chip. */
.xdsoft_datetimepicker .xdsoft_calendar table {
	border-collapse: separate;
	border-spacing: 2px;
}

.xdsoft_datetimepicker .xdsoft_calendar td,
.xdsoft_datetimepicker .xdsoft_calendar th {
	background: var(--surface);
	border: 0;
	border-radius: var(--r-sm);
	color: var(--ink);
	font-size: var(--fs-sm);
	text-align: center;
	transition: background-color var(--dur-1) var(--ease-out),
	            color var(--dur-1) var(--ease-out);
}

.xdsoft_datetimepicker .xdsoft_calendar td > div { padding-right: 0; }

/* estilos.css paints every bare `thead` navy (#081623) for the old listing
   header. The weekday cells below are transparent, so that slab showed
   through the calendar's day names. Only this header needs clearing: every
   other table in the theme paints its own th. */
.xdsoft_datetimepicker .xdsoft_calendar thead {
	background: transparent;
	color: inherit;
	font-size: inherit;
	font-weight: inherit;
}

.xdsoft_datetimepicker .xdsoft_calendar th {
	background: transparent;
	color: var(--ink-mute);
	font-size: var(--fs-xs);
	font-weight: 700;
	letter-spacing: .06em;
	text-transform: uppercase;
}

.xdsoft_datetimepicker .xdsoft_calendar td.xdsoft_today {
	color: var(--brand-600);
	font-weight: 700;
	box-shadow: inset 0 0 0 1px var(--brand-200);
}

.xdsoft_datetimepicker .xdsoft_calendar td.xdsoft_default,
.xdsoft_datetimepicker .xdsoft_calendar td.xdsoft_current,
.xdsoft_datetimepicker .xdsoft_timepicker .xdsoft_time_box > div > div.xdsoft_current {
	background: var(--brand-500);
	background-image: var(--brand-fill);
	box-shadow: none;
	color: #fff;
	font-weight: 700;
}

/* The vendor hover is orange and !important, so this has to be too.
   The selected day keeps its fill under the cursor. */
.xdsoft_datetimepicker .xdsoft_calendar td:hover,
.xdsoft_datetimepicker .xdsoft_timepicker .xdsoft_time_box > div > div:hover {
	color: var(--brand-700) !important;
	background: var(--brand-50) !important;
	box-shadow: none !important;
}

.xdsoft_datetimepicker .xdsoft_calendar td.xdsoft_current:hover,
.xdsoft_datetimepicker .xdsoft_timepicker .xdsoft_time_box > div > div.xdsoft_current:hover {
	color: #fff !important;
	background: var(--brand-600) !important;
}

.xdsoft_datetimepicker .xdsoft_timepicker .xdsoft_time_box {
	border: 1px solid var(--line);
	border-radius: var(--r-sm);
}

.xdsoft_datetimepicker .xdsoft_timepicker .xdsoft_time_box > div > div {
	border-color: var(--line);
	color: var(--ink);
	font-size: var(--fs-sm);
}

.xdsoft_datetimepicker .xdsoft_scrollbar > .xdsoft_scroller {
	background: var(--line-strong) !important;
	border-radius: var(--r-pill);
}


/* ── Date field (componentes/date.php) ──────────────────────────────── */
/* Moved out of the component, which printed this same <style> block once
   per date field on the form. */

.date-component__field {
	position: relative;
	display: flex;
	align-items: center;
}

.date-component__icon {
	position: absolute;
	left: 12px;
	color: var(--brand-500);
	font-size: var(--icon-md);
	pointer-events: none;
	opacity: .85;
}

.date-component__input.input_text {
	width: 100%;
	height: 40px;
	padding-left: 36px;
	padding-right: 34px;
	border: 1px solid var(--field-border);
	border-radius: var(--r-sm);
	background: var(--field-bg);
	cursor: pointer;
}

.date-component__input.input_text:focus {
	background: var(--surface);
	border-color: var(--brand-500);
	box-shadow: var(--focus-ring);
	outline: none;
}

.date-component__clear {
	position: absolute;
	right: 8px;
	display: none;
	align-items: center;
	justify-content: center;
	width: 22px;
	height: 22px;
	padding: 0;
	border: none;
	border-radius: 50%;
	background: var(--bg-sunken);
	color: var(--ink-soft);
	font-size: var(--icon-md);
	line-height: 1;
	cursor: pointer;
	transition: background-color var(--dur-1) var(--ease-out),
	            color var(--dur-1) var(--ease-out);
}

.date-component__clear:hover {
	background: var(--danger-soft);
	color: var(--danger);
}

.date-component__field.has-value .date-component__clear {
	display: inline-flex;
	animation: ui-pop var(--dur-2) var(--ease-spring);
}


/* ── Uploads (Plupload jQuery UI widget) ────────────────────────────── */

.plupload_wrapper .plupload_container {
	border: 1px solid var(--line);
	border-radius: var(--r-lg);
	background: var(--surface);
}

/* Drop zone. Plupload only marks drag-and-drop *support*
   (`.plupload_dropbox`), not an active drag; ui-motion.js adds
   `.is-dragover` on dragenter/dragleave so the zone can react. */
.plupload_dropbox .plupload_droptext {
	margin: 10px;
	border: 2px dashed var(--line-strong);
	border-radius: var(--r-md);
	background: var(--surface-alt);
	color: var(--ink-mute);
	font-family: var(--font-sans);
	font-size: var(--fs-lg);
	font-weight: 500;
	letter-spacing: 0;
	transition: border-color var(--dur-2) var(--ease-out),
	            background-color var(--dur-2) var(--ease-out),
	            color var(--dur-2) var(--ease-out);
}

.plupload_dropbox.is-dragover .plupload_droptext,
.is-dragover .plupload_dropbox .plupload_droptext {
	border-color: var(--brand-500);
	background: var(--brand-50);
	color: var(--brand-600);
	animation: ui-dash-pulse 1.2s var(--ease-in-out) infinite;
}

@keyframes ui-dash-pulse {
	0%, 100% { box-shadow: 0 0 0 0 rgba(64,136,146,.0); }
	50%      { box-shadow: 0 0 0 6px rgba(64,136,146,.12); }
}

/* File rows are `li.plupload_file.ui-state-default`, so they too sit
   under the global `#ddd !important` and need !important to change. */
.plupload_file.ui-state-default {
	background: var(--surface) !important;
	border-color: var(--line);
	transition: background-color var(--dur-1) var(--ease-out);
	animation: ui-enter-sm var(--dur-2) var(--ease-out);
}

.plupload_file.ui-state-default:hover { background: var(--surface-alt) !important; }

.plupload_file .plupload_file_progress.ui-widget-header {
	border: 0;
	background: var(--brand-fill-soft);
}

.plupload_filelist_footer {
	background: var(--surface-alt);
	border-top: 1px solid var(--line);
	border-radius: 0 0 var(--r-lg) var(--r-lg);
}

/* Progress: jQuery UI progressbar inside the widget */
.plupload_wrapper .ui-progressbar {
	height: 6px;
	border: 0;
	border-radius: var(--r-pill);
	background: var(--bg-sunken);
	overflow: hidden;
}

.plupload_wrapper .ui-progressbar-value {
	margin: 0;
	border: 0;
	border-radius: var(--r-pill);
	background: var(--brand-fill);
	transition: width var(--dur-3) var(--ease-out);
}

/* Its "Add files" buttons are jQuery UI buttons, i.e. `.ui-state-default`
   and therefore under the global `background: #ddd !important`. */
.plupload_wrapper .plupload_button.ui-state-default {
	background: var(--surface) !important;
	border: 1px solid var(--line-strong);
	border-radius: var(--r-sm);
	color: var(--brand-600);
	font-weight: 600;
	transition: border-color var(--dur-1) var(--ease-out),
	            background-color var(--dur-1) var(--ease-out);
}

.plupload_wrapper .plupload_button.ui-state-hover {
	background: var(--brand-50) !important;
	border-color: var(--brand-300);
}


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

/* Add/filter panels beside a nested table */
.section-agregar,
.section-filtrar {
	background: var(--surface);
	border: 1px solid var(--line);
	border-radius: var(--r-md);
	box-shadow: var(--sh-1);
	padding: 14px;
}

/* Inside a sub-ABM the panel sits next to a navy-headed table, and grey
   wells on a white card with a faint border all but disappeared there.
   Here the panel gets a firm edge and the fields go back to white boxes
   with a visible border, closer to the look operators were used to.
   Done by redefining the field tokens for this subtree only, so every
   field widget (inputs, selectmenu, date) follows without new selectors. */
.subabm-zaphify {
	--field-bg: var(--surface);
	--field-border: #c5cfdb;
}

.subabm-zaphify .section-agregar:not(.section-popup),
.subabm-zaphify .section-filtrar {
	border-color: var(--line-strong);
}

.subabm-zaphify .section-agregar:not(.section-popup) > label:first-child,
.subabm-zaphify .section-filtrar > label:first-child {
	display: block;
	margin: -2px 0 10px;
	padding-bottom: 8px;
	border-bottom: 1px solid var(--line);
	color: var(--ink);
	font-size: var(--fs-md);
	font-weight: 700;
}

/* Collapse toggle (was inline in componentes/sub_abm4.php, navy gradient) */
.btn-toggle-fields {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	margin: 0 auto 10px;
	padding: 7px 14px;
	font-size: var(--fs-md);
	cursor: pointer;
}

.btn-toggle-fields .toggle-icon {
	display: inline-block;
	margin-left: 0;
	transition: transform var(--dur-2) var(--ease-spring);
}

.btn-toggle-fields[data-expanded="true"] .toggle-icon { transform: rotate(180deg); }

/* Popup header. The panel itself is centred with translate(-50%,-50%)
   and animated by estilos.css keyframes that carry that translate, so
   only the header is restyled here — the container's transform and
   animation are left exactly as they are. */
.section-agregar.section-popup {
	border: 1px solid var(--line);
	border-radius: var(--r-lg);
	box-shadow: var(--sh-4);
}

.section-agregar.section-popup > label:first-child {
	background: var(--surface);
	color: var(--ink);
	border-bottom: 1px solid var(--line);
	border-radius: var(--r-lg) var(--r-lg) 0 0;
	padding: 16px 20px;
	font-size: var(--fs-lg);
	font-weight: 600;
}

/* ── Listing view selector (admin/vistas_listado/_selector.php) ─────── */
/* Each option is a full rectangle covering its whole part of the
   control, edges included, so every pixel of the visible pill is
   clickable. The rounded "pill" of the active / hovered option is drawn
   inside it by ::before (a border-radius on the link itself would also
   clip its clickable corners). Raised above the content's layers so
   nothing can sit over it. */
.vl-selector {
	position: relative;
	z-index: 60;
	display: inline-flex;
	align-items: stretch;
	margin: 0 0 12px;
	padding: 0;
	border: 1px solid var(--line-strong);
	border-radius: var(--r-md);
	background: var(--surface);
	box-shadow: var(--sh-1);
	overflow: hidden;
}
.vl-selector__op {
	position: relative;
	z-index: 0;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	min-height: 42px;
	margin: 0;
	padding: 0 18px;
	color: var(--ink-soft);
	font-size: var(--fs-sm);
	font-weight: 700;
	text-decoration: none;
	cursor: pointer;
	transition: color var(--dur-1) var(--ease-out);
}
.vl-selector__op::before {
	content: '';
	position: absolute;
	inset: 4px 2px;
	z-index: -1;
	border-radius: var(--r-sm);
	background: transparent;
	transition: background-color var(--dur-1) var(--ease-out);
}
.vl-selector__op:first-child::before { left: 4px; }
.vl-selector__op:last-child::before  { right: 4px; }
.vl-selector__op:hover { color: var(--brand-700); text-decoration: none; }
.vl-selector__op:hover::before { background: var(--brand-50); }
.vl-selector__op.is-active,
.vl-selector__op.is-active:hover { color: #fff; }
.vl-selector__op.is-active::before { background: var(--brand-solid); }
.vl-selector__op:focus-visible { outline: none; }
.vl-selector__op:focus-visible::before { box-shadow: var(--focus-ring); }


/* ── Filtros activos (panel/js/filtros-activos.js) ───────────────────── */
/* Chips under a listing's #searchForm: the filters the results were
   searched with; × clears one, "Limpiar filtros" clears them all. */

.fa-bar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px 10px;
	margin: 14px 0 0;
	padding: 10px 12px;
	border: 1px solid var(--brand-100);
	border-radius: var(--r-md);
	background: var(--brand-50);
}
.fa-bar[hidden] { display: none; }

.fa-bar__titulo {
	font-size: var(--fs-sm);
	font-weight: 700;
	color: var(--brand-700);
	white-space: nowrap;
}
.fa-bar__chips { display: flex; flex-wrap: wrap; gap: 6px; flex: 1 1 auto; min-width: 0; }

.fa-chip {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	max-width: 100%;
	min-height: 32px;
	margin: 0;
	padding: 4px 8px 4px 12px;
	border: 1px solid var(--brand-200);
	border-radius: var(--r-pill);
	background: var(--surface);
	color: var(--ink);
	font-family: inherit;
	font-size: var(--fs-sm);
	line-height: 1.2;
	cursor: pointer;
	transition: border-color var(--dur-1) var(--ease-out), background-color var(--dur-1) var(--ease-out);
}
.fa-chip__campo { color: var(--ink-mute); font-weight: 500; white-space: nowrap; }
.fa-chip__valor {
	font-weight: 700;
	color: var(--brand-700);
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	max-width: 240px;
}
.fa-chip__x {
	display: inline-grid;
	place-items: center;
	width: 20px;
	height: 20px;
	margin-left: 2px;
	border-radius: 50%;
	color: var(--ink-mute);
	font-size: 12px;
}
.fa-chip:hover { border-color: var(--danger); background: var(--danger-soft); }
.fa-chip:hover .fa-chip__x { color: var(--danger); }
.fa-chip:focus-visible { outline: none; box-shadow: var(--focus-ring); }

.fa-bar__limpiar {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	min-height: 32px;
	margin: 0 0 0 auto;
	padding: 0 12px;
	border: 0;
	border-radius: var(--r-sm);
	background: transparent;
	color: var(--brand-600);
	font-family: inherit;
	font-size: var(--fs-sm);
	font-weight: 700;
	cursor: pointer;
	white-space: nowrap;
}
.fa-bar__limpiar:hover { background: var(--brand-100); color: var(--brand-700); }
.fa-bar__limpiar:focus-visible { outline: none; box-shadow: var(--focus-ring); }

@media (max-width: 768px) {
	.fa-bar__titulo { flex: 1 1 auto; }
	.fa-bar__chips { order: 3; flex-basis: 100%; }
	.fa-chip__valor { max-width: 160px; }
	.fa-chip, .fa-bar__limpiar { min-height: var(--hit); }
}
