/* =========================================================================
   VentaSync POS — Sistema de diseño "Liquid Glass" (aprobado en Figma)
   - Vidrio solo en controles (barras, botones, hojas); el contenido va en tarjetas sólidas.
   - Íconos siempre con texto en la navegación; colores con significado:
     verde = dinero recibido · azul = transferencia · ámbar = por verificar · rojo = problema.
   - Mobile-first (una mano), claro/oscuro, contraste AA, objetivos táctiles ≥ 44 px,
     respeta "reducir movimiento" y "reducir transparencia".
   ========================================================================= */

/* ---------- 1. Tokens ---------- */
:root {
	--font: "Inter", ui-sans-serif, system-ui, -apple-system, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	--mono: ui-monospace, "SF Mono", "Cascadia Code", Consolas, monospace;

	--r-sm: 12px;
	--r: 18px;
	--r-lg: 24px;
	--r-xl: 32px;
	--r-pill: 999px;
	--tap: 44px;
	--ease: cubic-bezier(0.2, 0.8, 0.2, 1);
	--spring: cubic-bezier(0.34, 1.4, 0.64, 1);
	--safe-b: env(safe-area-inset-bottom, 0px);
	--safe-t: env(safe-area-inset-top, 0px);

	color-scheme: light;
	--bg: #eef1f6;
	--blob-a: #ffd45c;
	--blob-b: #ff9ec4;
	--blob-c: #8dbbff;
	--surface: #ffffff;
	--surface-2: #f3f5f9;
	--text: #0f1218;
	--text-2: #454d5c;
	--muted: #646c7b;
	--border: #e1e5ec;
	--glass: rgba(255, 255, 255, 0.42);
	--glass-strong: rgba(255, 255, 255, 0.66);
	--glass-stroke: rgba(255, 255, 255, 0.85);
	--glass-shadow: 0 10px 30px rgba(15, 20, 38, 0.14), 0 1px 0 rgba(255, 255, 255, 0.6) inset;
	--card-shadow: 0 1px 3px rgba(15, 20, 38, 0.08), 0 6px 16px rgba(15, 20, 38, 0.06);
	--overlay: rgba(5, 7, 11, 0.38);

	--cash: #047857;
	--cash-text: #047857;
	--cash-soft: rgba(5, 150, 105, 0.13);
	--transfer: #1d4ed8;
	--transfer-text: #1d4ed8;
	--transfer-soft: rgba(37, 99, 235, 0.12);
	--pending: #b45309;
	--pending-text: #9a4a00;
	--pending-soft: rgba(245, 158, 11, 0.16);
	--danger: #c81e1e;
	--danger-text: #b91c1c;
	--danger-soft: rgba(220, 38, 38, 0.11);
	--on-solid: #ffffff;

	--accent: #f5b400;
	--accent-ink: #1b1400;
	--accent-text: #8a5d00;
	--accent-soft: rgba(245, 180, 0, 0.18);
}

:root[data-theme="dark"] {
	color-scheme: dark;
	--bg: #0b0d12;
	--blob-a: #7a5200;
	--blob-b: #5b1e3e;
	--blob-c: #17346b;
	--surface: #171a21;
	--surface-2: #20242d;
	--text: #f3f5f8;
	--text-2: #bac2cf;
	--muted: #939cac;
	--border: #2b303b;
	--glass: rgba(30, 34, 44, 0.42);
	--glass-strong: rgba(24, 27, 35, 0.72);
	--glass-stroke: rgba(255, 255, 255, 0.14);
	--glass-shadow: 0 10px 30px rgba(0, 0, 0, 0.45), 0 1px 0 rgba(255, 255, 255, 0.08) inset;
	--card-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
	--overlay: rgba(0, 0, 0, 0.55);
	--cash: #059669;
	--cash-text: #34d399;
	--cash-soft: rgba(16, 185, 129, 0.16);
	--transfer: #2563eb;
	--transfer-text: #7aa7ff;
	--transfer-soft: rgba(59, 130, 246, 0.18);
	--pending: #d97706;
	--pending-text: #fbbf24;
	--pending-soft: rgba(245, 158, 11, 0.16);
	--danger: #dc2626;
	--danger-text: #fca5a5;
	--danger-soft: rgba(239, 68, 68, 0.16);
	--accent: #ffc93d;
	--accent-text: #ffd670;
	--accent-soft: rgba(255, 201, 61, 0.16);
}

/* Acento por tipo de negocio */
[data-business="antojitos"] { --accent: #f59e0b; --accent-ink: #1c1000; --accent-text: #9a5a00; --accent-soft: rgba(245, 158, 11, 0.17); --blob-a: #ffcf70; }
[data-business="dulceria"] { --accent: #db2777; --accent-ink: #ffffff; --accent-text: #be185d; --accent-soft: rgba(219, 39, 119, 0.14); --blob-a: #ffb3d1; }
[data-business="cafeteria"] { --accent: #b45309; --accent-ink: #ffffff; --accent-text: #92400e; --accent-soft: rgba(180, 83, 9, 0.15); --blob-a: #f5c58a; }
[data-business="papeleria"] { --accent: #2563eb; --accent-ink: #ffffff; --accent-text: #1d4ed8; --accent-soft: rgba(37, 99, 235, 0.14); --blob-a: #a8c8ff; }
[data-business="comida"] { --accent: #dc2626; --accent-ink: #ffffff; --accent-text: #b91c1c; --accent-soft: rgba(220, 38, 38, 0.13); --blob-a: #ffb0a0; }
[data-business="ropa"] { --accent: #7c3aed; --accent-ink: #ffffff; --accent-text: #6d28d9; --accent-soft: rgba(124, 58, 237, 0.14); --blob-a: #c9b0ff; }
:root[data-theme="dark"][data-business="antojitos"] { --accent-text: #fbbf24; --blob-a: #6b4300; }
:root[data-theme="dark"][data-business="dulceria"] { --accent-text: #f472b6; --blob-a: #5b1e3e; }
:root[data-theme="dark"][data-business="cafeteria"] { --accent: #d97706; --accent-text: #fbbf24; --blob-a: #5c3200; }
:root[data-theme="dark"][data-business="papeleria"] { --accent: #3b82f6; --accent-text: #93b8ff; --blob-a: #17346b; }
:root[data-theme="dark"][data-business="comida"] { --accent: #ef4444; --accent-text: #f87171; --blob-a: #5c1414; }
:root[data-theme="dark"][data-business="ropa"] { --accent: #8b5cf6; --accent-text: #a78bfa; --blob-a: #34186b; }

/* ---------- 2. Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
	font-family: var(--font);
	font-size: 16px;
	line-height: 1.45;
	color: var(--text);
	background: var(--bg);
	min-height: 100dvh;
	-webkit-font-smoothing: antialiased;
	-webkit-tap-highlight-color: transparent;
	overflow-x: hidden;
}
/* Manchas de color de fondo: le dan al vidrio algo que "refractar" */
body::before {
	content: "";
	position: fixed;
	inset: -20vmax;
	z-index: -1;
	pointer-events: none;
	background:
		radial-gradient(38vmax 38vmax at 12% 8%, color-mix(in srgb, var(--blob-a) 85%, transparent), transparent 70%),
		radial-gradient(34vmax 34vmax at 92% 38%, color-mix(in srgb, var(--blob-b) 75%, transparent), transparent 70%),
		radial-gradient(36vmax 36vmax at 18% 78%, color-mix(in srgb, var(--blob-c) 75%, transparent), transparent 70%),
		radial-gradient(26vmax 26vmax at 88% 96%, color-mix(in srgb, var(--blob-a) 70%, transparent), transparent 70%);
	filter: blur(30px);
}
body.modal-open { overflow: hidden; }
img, svg { display: block; }
.ic { flex-shrink: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
button:disabled { cursor: not-allowed; }
a { color: var(--accent-text); text-underline-offset: 3px; }
h1 { font-size: 1.6rem; line-height: 1.2; letter-spacing: -0.02em; }
h2 { font-size: 1.25rem; line-height: 1.25; letter-spacing: -0.01em; }
h3 { font-size: 1.05rem; margin: 1.2rem 0 0.5rem; }
code { font-family: var(--mono); font-size: 0.92em; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 10px; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: 12px; top: -60px; z-index: 100; background: var(--surface); padding: 10px 14px; border-radius: 12px; }
.skip-link:focus { top: 12px; }
.muted { color: var(--muted); }
.fine { font-size: 0.8rem; color: var(--muted); display: flex; gap: 6px; align-items: center; justify-content: center; flex-wrap: wrap; }
.grow { flex: 1; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.inline-row { display: flex; gap: 8px; align-items: center; }
.inline-row.wrap { flex-wrap: wrap; }
.amount { font-variant-numeric: tabular-nums; font-weight: 700; }
.amount.big { font-size: 1.5rem; font-weight: 800; letter-spacing: -0.02em; }
.pos-text, .ok-text { color: var(--cash-text); }
.neg-text { color: var(--danger-text); }
.warn-text { color: var(--pending-text); }
.info-text { color: var(--transfer-text); }

/* ---------- 3. Material de vidrio ---------- */
.glass,
.appbar,
.tabbar,
.cartbar,
.modal-box,
.icon-btn,
.chip,
.btn-outline,
.auth-card,
.perk,
.status-card {
	background: var(--glass);
	-webkit-backdrop-filter: blur(var(--glass-blur, 22px)) saturate(180%);
	backdrop-filter: blur(var(--glass-blur, 22px)) saturate(180%);
	border: 1px solid var(--glass-stroke);
	box-shadow: var(--glass-shadow);
}
.glass-strong, .auth-card, .modal-box, .cartbar, .status-card { background: var(--glass-strong); }
/* Brillo especular (luz desde arriba a la izquierda) */
.appbar, .tabbar, .cartbar, .auth-card, .modal-box { position: relative; isolation: isolate; }
.appbar::before, .tabbar::before, .cartbar::before, .auth-card::before, .modal-box::before {
	content: "";
	position: absolute;
	inset: 0;
	border-radius: inherit;
	pointer-events: none;
	z-index: -1;
	background: linear-gradient(135deg, rgba(255, 255, 255, 0.45), rgba(255, 255, 255, 0) 42%, rgba(255, 255, 255, 0) 70%, rgba(255, 255, 255, 0.18));
	mix-blend-mode: soft-light;
}
@media (prefers-reduced-transparency: reduce) {
	.glass, .appbar, .tabbar, .cartbar, .modal-box, .icon-btn, .chip, .btn-outline, .auth-card, .perk, .status-card {
		-webkit-backdrop-filter: none;
		backdrop-filter: none;
		background: var(--surface);
	}
}

/* ---------- 4. Botones ---------- */
.btn, .btn-primary, .btn-success, .btn-transfer, .btn-danger, .btn-outline, .btn-ghost, .btn-dark, .btn-pending {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	min-height: var(--tap);
	padding: 10px 18px;
	border-radius: var(--r);
	font-weight: 700;
	font-size: 0.98rem;
	text-decoration: none;
	transition: transform 0.15s var(--ease), filter 0.15s, background 0.2s;
	white-space: nowrap;
}
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-success { background: var(--cash); color: var(--on-solid); }
.btn-transfer { background: var(--transfer); color: var(--on-solid); }
.btn-pending { background: var(--pending); color: var(--on-solid); }
.btn-danger { background: var(--danger-soft); color: var(--danger-text); }
.btn-danger.solid { background: var(--danger); color: var(--on-solid); }
.btn-dark { background: var(--text); color: var(--bg); }
.btn-outline { color: var(--text); }
.btn-ghost { color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); }
:is(.btn-primary, .btn-success, .btn-transfer, .btn-danger, .btn-outline, .btn-dark, .btn-pending):not(:disabled):active { transform: scale(0.97); }
:is(.btn-primary, .btn-success, .btn-transfer, .btn-dark, .btn-pending):not(:disabled):hover { filter: brightness(1.05); }
button:disabled:not([data-busy]) { opacity: 0.45; }
button[data-busy] { opacity: 0.75; }
button[data-busy]::after { content: ""; width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin 0.7s linear infinite; }
.btn-block { width: 100%; }
.btn-lg { min-height: 58px; font-size: 1.08rem; border-radius: 20px; }
.btn-sm { min-height: 38px; padding: 6px 12px; font-size: 0.88rem; border-radius: 12px; }
.icon-btn {
	width: 48px; height: 48px; border-radius: 50%;
	display: inline-flex; align-items: center; justify-content: center;
	color: var(--text); flex-shrink: 0;
	transition: transform 0.15s var(--ease);
}
.icon-btn:active { transform: scale(0.94); }
.icon-btn.sm { width: 44px; height: 44px; }

/* ---------- 5. Formularios ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
label, legend { font-weight: 600; font-size: 0.92rem; color: var(--text); }
fieldset { border: 0; padding: 0; margin: 0 0 14px; }
legend { margin-bottom: 8px; }
input:not([type="checkbox"]):not([type="radio"]):not([type="color"]), select, textarea {
	width: 100%;
	min-height: 52px;
	padding: 12px 16px;
	border-radius: 16px;
	border: 1px solid var(--border);
	background: var(--surface);
	color: var(--text);
	font-size: 16px;
	transition: border-color 0.15s, box-shadow 0.15s;
}
input::placeholder, textarea::placeholder { color: var(--muted); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
input[type="color"] { width: 100%; height: 52px; padding: 4px; border-radius: 16px; border: 1px solid var(--border); background: var(--surface); }
.input-affix { position: relative; display: flex; align-items: center; }
.input-affix input { padding-right: 56px !important; }
.input-affix.lead > .ic:first-child { position: absolute; left: 14px; color: var(--muted); pointer-events: none; z-index: 1; }
.input-affix.lead input { padding-left: 46px !important; }
.affix-btn { position: absolute; right: 4px; width: var(--tap); height: var(--tap); display: inline-flex; align-items: center; justify-content: center; border-radius: 12px; color: var(--text-2); }
.money-input { font-size: 1.6rem !important; font-weight: 800; font-variant-numeric: tabular-nums; min-height: 64px !important; }
.form-grid { display: grid; grid-template-columns: 1fr; gap: 0 14px; }
@media (min-width: 640px) { .form-grid { grid-template-columns: 1fr 1fr; } .span-2 { grid-column: 1 / -1; } }
.hint { font-size: 0.82rem; color: var(--muted); font-weight: 500; }
.switch { display: flex; align-items: center; gap: 12px; min-height: var(--tap); cursor: pointer; font-weight: 500; margin-bottom: 6px; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .track { width: 50px; height: 30px; border-radius: 99px; background: var(--border); position: relative; flex-shrink: 0; transition: background 0.2s; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3); transition: transform 0.25s var(--spring); }
.switch input:checked + .track { background: var(--cash); }
.switch input:checked + .track::after { transform: translateX(20px); }
.switch input:focus-visible + .track { outline: 3px solid var(--accent); outline-offset: 2px; }
.check-row { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; font-weight: 500; line-height: 1.4; }
.check-row input { width: 24px; height: 24px; margin-top: 1px; accent-color: var(--cash); flex-shrink: 0; }

/* ---------- 6. Avisos, chips y badges ---------- */
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 16px; font-size: 0.92rem; font-weight: 500; margin: 0 0 14px; }
.alert-error { background: var(--danger-soft); color: var(--danger-text); }
.alert-warn { background: var(--pending-soft); color: var(--pending-text); }
.alert-info { background: var(--transfer-soft); color: var(--transfer-text); }
.alert-success { background: var(--cash-soft); color: var(--cash-text); }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 99px; font-size: 0.75rem; font-weight: 700; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.badge.ok { background: var(--cash-soft); color: var(--cash-text); }
.badge.warn { background: var(--pending-soft); color: var(--pending-text); }
.badge.err { background: var(--danger-soft); color: var(--danger-text); }
.badge.info { background: var(--transfer-soft); color: var(--transfer-text); }
.badge.accent { background: var(--accent-soft); color: var(--accent-text); }
.count-pill { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; background: var(--pending); color: #fff; font-size: 0.72rem; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; }
.status-chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 99px; font-size: 0.78rem; font-weight: 700; background: var(--cash-soft); color: var(--cash-text); white-space: nowrap; }
.status-chip.off { background: var(--pending-soft); color: var(--pending-text); }
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 2px 2px 4px; margin: 0 -2px; }
.chips::-webkit-scrollbar { display: none; }
.chip { min-height: 40px; padding: 0 16px; border-radius: 99px; font-weight: 600; font-size: 0.92rem; color: var(--text-2); white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.chip[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: transparent; box-shadow: none; }
.segmented { display: inline-flex; padding: 4px; border-radius: 16px; background: var(--surface-2); gap: 4px; flex-wrap: wrap; }
.segmented button { min-height: 38px; padding: 0 14px; border-radius: 12px; font-weight: 600; font-size: 0.9rem; color: var(--text-2); }
.segmented button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--card-shadow); }

/* ---------- 7. Vistas y barras flotantes ---------- */
.view { min-height: 100dvh; }
.appbar {
	position: sticky;
	top: calc(8px + var(--safe-t));
	z-index: 20;
	margin: calc(8px + var(--safe-t)) 12px 0;
	min-height: 64px;
	padding: 8px 8px 8px 10px;
	border-radius: 32px;
	display: flex;
	align-items: center;
	gap: 10px;
}
.appbar-brand { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.brand-mark { width: 44px; height: 44px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.brand-mark.lg { width: 76px; height: 76px; border-radius: 24px; box-shadow: var(--glass-shadow); }
.appbar-title { display: flex; flex-direction: column; min-width: 0; }
.appbar-title strong { font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appbar-title .sub { font-size: 0.75rem; color: var(--muted); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appbar-actions { display: flex; align-items: center; gap: 8px; }

.page { width: 100%; max-width: 1180px; margin: 0 auto; padding: 14px 16px calc(190px + var(--safe-b)); }
.page.admin { padding-bottom: calc(120px + var(--safe-b)); }

.tabbar {
	position: fixed;
	left: 50%;
	transform: translateX(-50%);
	bottom: calc(10px + var(--safe-b));
	z-index: 30;
	width: min(calc(100% - 24px), 520px);
	height: 76px;
	padding: 0 8px;
	border-radius: 38px;
	display: flex;
	align-items: center;
	justify-content: space-between;
}
.tab {
	position: relative;
	flex: 1;
	max-width: 84px;
	height: 60px;
	border-radius: 26px;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 3px;
	color: var(--text-2);
	font-size: 0.7rem;
	font-weight: 600;
	transition: background 0.25s var(--ease), color 0.2s;
}
.tab span:not(.count-pill), .tab-main > span:last-child { white-space: nowrap; letter-spacing: -0.01em; }
.tab[aria-current="page"], .tab.active { background: var(--accent-soft); color: var(--accent-text); font-weight: 800; }
.tab .count-pill { position: absolute; top: 4px; right: 12px; }
.tab-main { flex: 1; max-width: 84px; display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 0.7rem; font-weight: 600; color: var(--text-2); }
.tab-main .circle { width: 50px; height: 50px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: inline-flex; align-items: center; justify-content: center; box-shadow: 0 6px 16px color-mix(in srgb, var(--accent) 45%, transparent); transition: transform 0.2s var(--spring); }
.tab-main:active .circle { transform: scale(0.92); }

.cartbar {
	position: fixed;
	left: 50%;
	transform: translateX(-50%);
	bottom: calc(96px + var(--safe-b));
	z-index: 29;
	width: min(calc(100% - 24px), 520px);
	min-height: 68px;
	padding: 8px 8px 8px 18px;
	border-radius: 34px;
	display: flex;
	align-items: center;
	gap: 12px;
	text-align: left;
	animation: rise 0.35s var(--spring);
}
.cartbar .info { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.cartbar .info small { font-size: 0.78rem; color: var(--muted); font-weight: 600; }
.cartbar .info strong { font-size: 1.4rem; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; line-height: 1.15; }
.cartbar .btn-primary { min-height: 52px; border-radius: 26px; padding: 0 16px 0 22px; font-size: 1.05rem; }

/* ---------- 8. Punto de venta ---------- */
.search-bar { position: relative; display: flex; align-items: center; margin-bottom: 12px; }
.search-bar > .ic { position: absolute; left: 16px; color: var(--muted); pointer-events: none; }
.search-bar input { padding-left: 46px !important; border-radius: 18px !important; }
.shift-banner { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 20px; margin-bottom: 12px; background: var(--cash-soft); color: var(--cash-text); font-weight: 600; font-size: 0.9rem; }
.shift-banner.closed { background: var(--pending-soft); color: var(--pending-text); }
.shift-banner .txt { flex: 1; display: flex; flex-direction: column; }
.shift-banner .txt small { color: var(--text-2); font-weight: 500; font-size: 0.78rem; }
.offline-banner { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 18px; margin-bottom: 12px; background: var(--pending-soft); color: var(--pending-text); font-weight: 600; font-size: 0.88rem; }
.offline-banner span { flex: 1; }
.products-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-top: 6px; }
@media (min-width: 600px) { .products-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 900px) { .products-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (min-width: 1180px) { .products-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.product-card {
	position: relative;
	display: flex;
	flex-direction: column;
	gap: 8px;
	padding: 12px 12px 14px;
	border-radius: 22px;
	background: var(--surface);
	border: 1px solid var(--border);
	box-shadow: var(--card-shadow);
	text-align: left;
	transition: transform 0.15s var(--ease), border-color 0.2s, box-shadow 0.2s;
	min-height: 168px;
}
.product-card:not(:disabled):active { transform: scale(0.97); }
.product-card .swatch {
	height: 72px;
	border-radius: 16px;
	display: flex;
	align-items: center;
	justify-content: center;
	background: color-mix(in srgb, var(--pc) 16%, transparent);
	color: color-mix(in srgb, var(--pc) 78%, var(--text));
	font-size: 1.9rem;
	font-weight: 800;
}
:root[data-theme="dark"] .product-card .swatch { color: color-mix(in srgb, var(--pc) 70%, #fff); }
.product-card .name { font-weight: 600; font-size: 0.95rem; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.product-card .bottom { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-top: auto; flex-wrap: wrap; }
.product-card .price { font-size: 1.1rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.product-card .stock { font-size: 0.7rem; font-weight: 700; padding: 3px 8px; border-radius: 99px; background: var(--surface-2); color: var(--muted); }
.product-card .stock.low { background: var(--pending-soft); color: var(--pending-text); }
.product-card .stock.out { background: var(--danger-soft); color: var(--danger-text); }
.product-card.in-cart { border: 2px solid var(--accent); padding: 11px 11px 13px; }
.product-card:disabled { opacity: 0.55; }
.qty-badge { position: absolute; top: 8px; right: 8px; min-width: 30px; height: 30px; padding: 0 8px; border-radius: 99px; background: var(--accent); color: var(--accent-ink); font-weight: 800; display: inline-flex; align-items: center; justify-content: center; animation: pop 0.3s var(--spring); }
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 36px 16px; color: var(--muted); }
.empty .ic { color: var(--muted); opacity: 0.8; }

/* Hojas inferiores / diálogos */
.modal-overlay { position: fixed; inset: 0; z-index: 50; background: var(--overlay); display: flex; align-items: flex-end; justify-content: center; animation: fade 0.2s; }
.modal-box {
	width: 100%;
	max-width: 560px;
	max-height: min(92dvh, 900px);
	overflow-y: auto;
	overscroll-behavior: contain;
	border-radius: 36px 36px 0 0;
	padding: 10px 20px calc(24px + var(--safe-b));
	animation: sheet 0.35s var(--spring);
}
.modal-box::after { content: ""; position: sticky; display: block; }
.sheet-grabber { width: 40px; height: 5px; border-radius: 3px; background: var(--muted); opacity: 0.5; margin: 0 auto 12px; }
@media (min-width: 720px) {
	.modal-overlay { align-items: center; }
	.modal-box { border-radius: 32px; padding: 24px 28px 28px; }
	.sheet-grabber { display: none; }
}
.sheet-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.sheet-head h2 { flex: 1; font-size: 1.35rem; }
.row-actions { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.row-actions > * { flex: 1 1 140px; }
.total-box { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-radius: 20px; background: var(--surface); border: 1px solid var(--border); margin: 12px 0; }
.total-box strong { font-size: 1.9rem; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.highlight-box { padding: 14px 16px; border-radius: 20px; background: var(--surface); border: 1px solid var(--border); margin: 10px 0 14px; }
.pay-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 8px; }
.pay-option { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 16px; border-radius: 24px; color: var(--on-solid); text-align: left; min-height: 116px; transition: transform 0.15s var(--ease); }
.pay-option:active:not(:disabled) { transform: scale(0.97); }
.pay-option .ic { margin-bottom: 8px; }
.pay-option strong { font-size: 1.12rem; }
.pay-option small { font-size: 0.82rem; opacity: 0.92; font-weight: 500; }
.pay-option.cash { background: var(--cash); }
.pay-option.transfer { background: var(--transfer); }
.bill-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 10px 0 12px; }
.bill-grid button { min-height: 50px; border-radius: 16px; background: var(--surface); border: 1px solid var(--border); font-weight: 800; font-size: 1rem; }
.bill-grid button[aria-pressed="true"] { background: var(--cash); color: var(--on-solid); border-color: transparent; }
.change-box { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; border-radius: 22px; background: var(--cash-soft); color: var(--cash-text); font-weight: 600; margin: 12px 0; }
.change-box strong { font-size: 1.9rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.change-box.insufficient { background: var(--danger-soft); color: var(--danger-text); }
.qr-wrap { display: flex; justify-content: center; padding: 12px; background: #fff; border-radius: 20px; margin: 10px auto; width: fit-content; }
.qr-wrap img { width: 220px; height: 220px; image-rendering: pixelated; }
.dl { display: grid; grid-template-columns: auto 1fr; gap: 8px 12px; font-size: 0.95rem; }
.dl dt { color: var(--muted); font-weight: 500; }
.dl dd { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; word-break: break-word; }
.dl .sep { grid-column: 1 / -1; height: 1px; background: var(--border); margin: 2px 0; }
.dl .total dt, .dl .total dd { font-weight: 800; color: var(--text); font-size: 1.05rem; }
.folio-big { font-family: var(--mono); font-size: 1.4rem; font-weight: 800; letter-spacing: 0.04em; }
.cart-lines { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.cart-line { display: flex; align-items: center; gap: 12px; padding: 10px 8px 10px 12px; border-radius: 20px; background: var(--surface); border: 1px solid var(--border); }
.cart-line .sw { width: 40px; height: 40px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-weight: 800; background: color-mix(in srgb, var(--pc) 16%, transparent); color: color-mix(in srgb, var(--pc) 78%, var(--text)); flex-shrink: 0; }
.cart-line .info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.cart-line .info strong { font-size: 0.95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cart-line .info span { font-size: 0.8rem; color: var(--muted); }
.stepper { display: flex; align-items: center; background: var(--surface-2); border-radius: 14px; }
.stepper button { width: var(--tap); height: var(--tap); display: inline-flex; align-items: center; justify-content: center; border-radius: 12px; }
.stepper output { min-width: 26px; text-align: center; font-weight: 800; font-size: 1.05rem; }
.menu-list { display: flex; flex-direction: column; gap: 6px; }
.menu-item { display: flex; align-items: center; gap: 14px; min-height: 54px; padding: 0 14px; border-radius: 16px; font-weight: 600; text-align: left; width: 100%; color: var(--text); text-decoration: none; }
.menu-item:hover { background: var(--surface-2); }
.menu-item .ic-box { width: 36px; height: 36px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; background: var(--surface-2); color: var(--text-2); }
.menu-item.danger { color: var(--danger-text); }
.menu-item.danger .ic-box { background: var(--danger-soft); color: var(--danger-text); }
.menu-item .chev { margin-left: auto; color: var(--muted); }
.menu-sep { height: 1px; background: var(--border); margin: 6px 4px; }

/* ---------- 9. Panel ---------- */
.page-head { margin: 6px 0 16px; }
.page-head h1 { margin-bottom: 4px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 16px; box-shadow: var(--card-shadow); margin-bottom: 14px; }
.card.glass-card { background: var(--glass-strong); -webkit-backdrop-filter: blur(var(--glass-blur, 22px)) saturate(180%); backdrop-filter: blur(var(--glass-blur, 22px)) saturate(180%); border-color: var(--glass-stroke); box-shadow: var(--glass-shadow); }
.card-title { font-size: 1.05rem; margin-bottom: 12px; }
.section-title { font-size: 1.05rem; margin: 22px 0 10px; }
.hero { padding: 20px; border-radius: 28px; margin-bottom: 14px; }
.hero small { color: var(--text-2); font-weight: 600; font-size: 0.9rem; }
.hero strong { display: block; font-size: 2.3rem; font-weight: 800; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; line-height: 1.15; margin: 2px 0 4px; }
.hero .sub { color: var(--muted); font-size: 0.85rem; }
.kpi-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.kpi-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.kpi-grid.three .kpi { padding: 12px 10px; }
.kpi-grid.three .kpi strong { font-size: 1.05rem; }
@media (min-width: 720px) { .kpi-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } .kpi-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: 14px; box-shadow: var(--card-shadow); display: flex; flex-direction: column; gap: 6px; text-align: left; min-width: 0; }
.kpi .kpi-ic { width: 36px; height: 36px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; background: var(--surface-2); color: var(--text-2); }
.kpi span { font-size: 0.78rem; color: var(--muted); font-weight: 600; line-height: 1.25; }
.kpi strong { font-size: 1.2rem; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; overflow-wrap: anywhere; }
.kpi.cash .kpi-ic { background: var(--cash-soft); color: var(--cash-text); }
.kpi.transfer .kpi-ic { background: var(--transfer-soft); color: var(--transfer-text); }
.kpi.pending .kpi-ic { background: var(--pending-soft); color: var(--pending-text); }
.kpi.danger .kpi-ic { background: var(--danger-soft); color: var(--danger-text); }
.kpi.accent .kpi-ic { background: var(--accent-soft); color: var(--accent-text); }
.two-col { display: grid; gap: 14px; }
@media (min-width: 900px) { .two-col { grid-template-columns: 1fr 1fr; } }
.list { display: flex; flex-direction: column; gap: 10px; }
.item-card { display: flex; gap: 12px; align-items: flex-start; flex-wrap: wrap; padding: 14px 16px; border-radius: 22px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--card-shadow); }
.item-main { flex: 1 1 240px; min-width: 0; }
.item-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-weight: 700; }
.item-meta { font-size: 0.85rem; color: var(--muted); margin-top: 3px; overflow-wrap: anywhere; }
.item-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.swatch-dot { width: 14px; height: 14px; border-radius: 5px; flex-shrink: 0; }
.verify-row { display: flex; gap: 10px; width: 100%; flex-wrap: wrap; }
.verify-row input { flex: 1 1 100%; }
.verify-row button { flex: 1 1 140px; min-height: 50px; }
.rank-row { display: flex; align-items: center; gap: 12px; padding: 8px 0; }
.rank-row .n { width: 28px; height: 28px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; background: var(--accent-soft); color: var(--accent-text); font-weight: 800; font-size: 0.85rem; flex-shrink: 0; }
.bar { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; margin-top: 6px; }
.bar > i { display: block; height: 100%; border-radius: 99px; background: var(--accent); }
.bar.cash > i { background: var(--cash); }
.bar.danger > i { background: var(--danger); }
.alert-row { display: flex; align-items: center; gap: 12px; padding: 12px 12px 12px 14px; border-radius: 20px; background: var(--pending-soft); color: var(--pending-text); margin-bottom: 14px; }
.alert-row .txt { flex: 1; display: flex; flex-direction: column; font-weight: 700; }
.alert-row .txt small { color: var(--text-2); font-weight: 500; }
.type-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.type-option { position: relative; display: flex; flex-direction: column; gap: 6px; padding: 14px; border-radius: 20px; background: var(--surface); border: 2px solid var(--border); cursor: pointer; font-weight: 700; text-align: left; font-size: 0.92rem; }
.type-option input { position: absolute; opacity: 0; }
.type-option .tile { width: 48px; height: 48px; border-radius: 16px; display: inline-flex; align-items: center; justify-content: center; background: color-mix(in srgb, var(--sw) 16%, transparent); color: var(--sw); }
.type-option small { font-weight: 500; color: var(--muted); font-size: 0.78rem; }
.type-option:has(input:checked), .type-option[aria-current="true"] { border-color: var(--sw); box-shadow: 0 0 0 4px color-mix(in srgb, var(--sw) 18%, transparent); }
.metadata { display: block; margin-top: 6px; padding: 8px 10px; border-radius: 12px; background: var(--surface-2); font-size: 0.78rem; white-space: pre-wrap; color: var(--text-2); }
.margin-preview { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; border-radius: 16px; background: var(--cash-soft); color: var(--cash-text); font-weight: 700; margin-bottom: 14px; }
.margin-preview.neg { background: var(--danger-soft); color: var(--danger-text); }
.margin-preview.none { background: var(--surface-2); color: var(--muted); }
.count-table { display: flex; flex-direction: column; gap: 8px; max-height: 46dvh; overflow-y: auto; padding-right: 2px; margin-bottom: 12px; }
.count-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 16px; background: var(--surface); border: 1px solid var(--border); }
.count-row .nm { flex: 1; min-width: 0; font-weight: 600; font-size: 0.92rem; }
.count-row .nm small { display: block; color: var(--muted); font-weight: 500; }
.count-row input { width: 96px !important; min-height: 44px !important; text-align: center; font-weight: 800; }

/* Panel en escritorio: barra lateral */
.admin-layout { display: block; }
.admin-nav { display: none; }
@media (min-width: 1024px) {
	.admin-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 20px; max-width: 1280px; margin: 0 auto; padding: 0 16px; }
	.admin-nav { display: flex; flex-direction: column; gap: 4px; position: sticky; top: 92px; align-self: start; margin-top: 14px; padding: 10px; border-radius: 28px; }
	.admin-nav .nav-item { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 0 14px; border-radius: 16px; font-weight: 600; color: var(--text-2); text-align: left; }
	.admin-nav .nav-item[aria-current="page"] { background: var(--accent-soft); color: var(--accent-text); font-weight: 800; }
	.admin-nav .nav-item .count-pill { margin-left: auto; }
	.page.admin { padding-left: 0; padding-right: 0; }
	#view-admin .tabbar { display: none; }
	#view-admin .page.admin { padding-bottom: 40px; }
}

/* ---------- 10. Inicio de sesión / legal ---------- */
.view-auth { display: flex; align-items: center; justify-content: center; padding: calc(24px + var(--safe-t)) 18px calc(24px + var(--safe-b)); }
.auth-shell { width: 100%; max-width: 420px; display: flex; flex-direction: column; align-items: center; gap: 18px; }
.auth-shell.wide { max-width: 560px; }
.auth-title { text-align: center; display: flex; flex-direction: column; gap: 6px; align-items: center; }
.auth-title h1 { font-size: 2rem; font-weight: 800; }
.auth-title p { color: var(--text-2); font-weight: 500; }
.auth-card { width: 100%; padding: 24px 22px; border-radius: 32px; }
.auth-card h2 { font-size: 1.4rem; margin-bottom: 4px; }
.auth-card > .muted { margin-bottom: 18px; font-size: 0.92rem; }
.perks { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.perk { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px 7px 10px; border-radius: 99px; font-size: 0.78rem; font-weight: 600; color: var(--text-2); }
.floating-tl { position: fixed; top: calc(14px + var(--safe-t)); right: 14px; z-index: 5; }
.legal-summary { font-size: 0.92rem; color: var(--text-2); display: flex; flex-direction: column; gap: 8px; margin: 12px 0 16px; padding-left: 18px; }
.legal-links { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }

.legal-doc { max-width: 820px; margin: 0 auto; padding: 32px 20px 80px; }
.legal-doc article { background: var(--surface); border: 1px solid var(--border); border-radius: 28px; padding: 28px 24px; box-shadow: var(--card-shadow); }
.legal-doc h1 { font-size: 1.8rem; margin-bottom: 6px; }
.legal-doc h2 { font-size: 1.15rem; margin: 26px 0 8px; }
.legal-doc h3 { margin: 16px 0 6px; }
.legal-doc p, .legal-doc li { color: var(--text-2); margin-bottom: 8px; line-height: 1.6; }
.legal-doc ul, .legal-doc ol { padding-left: 22px; margin-bottom: 10px; }
.legal-doc .meta { color: var(--muted); font-size: 0.9rem; margin-bottom: 18px; }
.legal-doc .todo { background: var(--pending-soft); color: var(--pending-text); padding: 1px 6px; border-radius: 6px; font-weight: 700; }
.legal-doc nav { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; font-weight: 600; }
.legal-doc table { width: 100%; border-collapse: collapse; margin: 10px 0 16px; font-size: 0.92rem; }
.legal-doc th, .legal-doc td { text-align: left; padding: 8px; border-bottom: 1px solid var(--border); vertical-align: top; color: var(--text-2); }

/* Página de estado (negocio inexistente / suspendido) */
.status-page { display: flex; align-items: center; justify-content: center; min-height: 100dvh; padding: 20px; }
.status-card { max-width: 440px; padding: 32px 26px; border-radius: 32px; text-align: center; display: flex; flex-direction: column; gap: 12px; align-items: center; }
.status-card p { color: var(--text-2); }

/* Página pública */
.landing { max-width: 1040px; margin: 0 auto; padding: 24px 18px 60px; }
.landing-hero { text-align: center; padding: 48px 8px 24px; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.landing-hero h1 { font-size: clamp(2rem, 6vw, 3.2rem); font-weight: 800; letter-spacing: -0.03em; max-width: 760px; }
.landing-hero p { font-size: 1.1rem; color: var(--text-2); max-width: 620px; }
.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; margin: 28px 0; }
.feature { padding: 20px; border-radius: 24px; display: flex; flex-direction: column; gap: 8px; }
.feature .tile { width: 48px; height: 48px; border-radius: 16px; display: inline-flex; align-items: center; justify-content: center; background: var(--accent-soft); color: var(--accent-text); }
.feature p { color: var(--text-2); font-size: 0.95rem; }

/* ---------- 11. Avisos emergentes ---------- */
.toast-container { position: fixed; left: 50%; transform: translateX(-50%); top: calc(12px + var(--safe-t)); z-index: 80; display: flex; flex-direction: column; gap: 8px; width: min(calc(100% - 24px), 460px); pointer-events: none; }
.toast { padding: 12px 16px; border-radius: 18px; font-weight: 600; font-size: 0.92rem; background: var(--text); color: var(--bg); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25); animation: drop 0.3s var(--spring); pointer-events: auto; }
.toast-success { background: var(--cash); color: #fff; }
.toast-error { background: var(--danger); color: #fff; }
.toast-warn { background: var(--pending); color: #fff; }
.toast-hide { opacity: 0; transform: translateY(-8px); transition: 0.3s; }

/* ---------- 12. Movimiento ---------- */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fade { from { opacity: 0; } }
@keyframes sheet { from { transform: translateY(40px); opacity: 0.4; } }
@keyframes rise { from { transform: translate(-50%, 24px); opacity: 0; } }
@keyframes drop { from { transform: translateY(-12px); opacity: 0; } }
@keyframes pop { from { transform: scale(0.4); } }
@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}

/* Escáner de cámara */
.scanner-frame { position: relative; border-radius: 22px; overflow: hidden; background: #000; margin-bottom: 10px; }
.scanner-frame video { width: 100%; display: block; aspect-ratio: 3 / 4; object-fit: cover; max-height: 56dvh; }
.scanner-reticle { position: absolute; inset: 18%; border: 3px solid var(--accent); border-radius: 18px; box-shadow: 0 0 0 999px rgba(0, 0, 0, 0.28); pointer-events: none; }
.center { text-align: center; }

@media print {
	body::before, .appbar, .tabbar, .cartbar { display: none; }
}

/* =========================================================================
   12. Movimiento Liquid Glass (v3.1)
   La opción activa se marca con una píldora que se desliza y se estira como gota.
   ========================================================================= */
.segmented.has-liquid, .chips.has-liquid { position: relative; }
.has-liquid > :not(.liquid-pill) { position: relative; z-index: 1; }
.has-liquid > :is([aria-pressed="true"], [aria-current="page"]) { background: transparent !important; box-shadow: none !important; border-color: transparent !important; }
.liquid-pill {
	position: absolute;
	top: 0;
	left: 0;
	z-index: 0;
	pointer-events: none;
	opacity: 0;
	border-radius: 12px;
	transition: transform 0.5s var(--spring), width 0.5s var(--spring), height 0.4s var(--ease), opacity 0.2s, background 0.3s;
	will-change: transform, width;
}
.liquid-pill.no-anim { transition: none !important; }
.liquid-pill.moving-x { animation: goo-x 0.55s var(--ease); }
.liquid-pill.moving-y { animation: goo-y 0.55s var(--ease); }
@keyframes goo-x { 0% { scale: 1 1; } 30% { scale: 1.14 0.84; } 62% { scale: 0.96 1.05; } 100% { scale: 1 1; } }
@keyframes goo-y { 0% { scale: 1 1; } 30% { scale: 0.9 1.12; } 62% { scale: 1.04 0.97; } 100% { scale: 1 1; } }
.segmented > .liquid-pill { background: var(--surface); box-shadow: var(--card-shadow); border-radius: 12px; }
.tabbar > .liquid-pill { background: var(--accent-soft); border-radius: 26px; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35); }
.admin-nav > .liquid-pill { background: var(--accent-soft); border-radius: 16px; }
.chips > .liquid-pill { background: var(--accent); border-radius: 99px; box-shadow: 0 6px 16px color-mix(in srgb, var(--accent) 35%, transparent); }
.chips.has-liquid > .chip[aria-pressed="true"] { color: var(--accent-ink); }
.tab, .chip, .segmented button, .admin-nav .nav-item { transition: color 0.25s var(--ease), transform 0.2s var(--spring), background 0.25s var(--ease); }
.tab:active, .chip:active, .segmented button:active, .admin-nav .nav-item:active { transform: scale(0.94); }
.tab[aria-current="page"] .ic { animation: tab-bounce 0.5s var(--spring); }
@keyframes tab-bounce { 0% { transform: translateY(0) scale(1); } 40% { transform: translateY(-3px) scale(1.12); } 100% { transform: none; } }

/* Entrada de vistas y pestañas: desliz en la dirección del cambio + desenfoque que se aclara */
.enter-r { animation: in-r 0.42s var(--ease) both; }
.enter-l { animation: in-l 0.42s var(--ease) both; }
.enter-up { animation: in-up 0.42s var(--ease) both; }
@keyframes in-r { from { opacity: 0; transform: translateX(26px); filter: blur(4px); } }
@keyframes in-l { from { opacity: 0; transform: translateX(-26px); filter: blur(4px); } }
@keyframes in-up { from { opacity: 0; transform: translateY(14px) scale(0.99); filter: blur(4px); } }
/* (nunca se anima un contenedor de barras fijas: un transform las movería de lugar) */
.enter-r > :not(.tabbar, .cartbar, .appbar), .enter-l > :not(.tabbar, .cartbar, .appbar), .enter-up > :not(.tabbar, .cartbar, .appbar) { animation: stagger 0.5s var(--ease) both; }
.enter-r > :nth-child(2), .enter-l > :nth-child(2), .enter-up > :nth-child(2) { animation-delay: 40ms; }
.enter-r > :nth-child(3), .enter-l > :nth-child(3), .enter-up > :nth-child(3) { animation-delay: 80ms; }
.enter-r > :nth-child(n + 4), .enter-l > :nth-child(n + 4), .enter-up > :nth-child(n + 4) { animation-delay: 120ms; }
@keyframes stagger { from { opacity: 0; transform: translateY(8px); } }

/* Hojas: también se animan al cerrar (copia fantasma que se desvanece) */
.modal-leaving { pointer-events: none; animation: fade-out 0.24s var(--ease) forwards; z-index: 49; }
.modal-leaving .modal-box { animation: sheet-out 0.26s var(--ease) forwards; }
@keyframes fade-out { to { opacity: 0; } }
@keyframes sheet-out { to { transform: translateY(60px); opacity: 0; } }
@media (min-width: 720px) {
	.modal-box { animation-name: pop-in; }
	@keyframes pop-in { from { transform: scale(0.94) translateY(10px); opacity: 0; } }
	@keyframes sheet-out { to { transform: scale(0.95); opacity: 0; } }
}
.card, .item-card, .kpi, .product-card { transition: transform 0.2s var(--ease), box-shadow 0.25s var(--ease), border-color 0.2s; }
@media (hover: hover) {
	.item-card:hover, .kpi:hover { transform: translateY(-2px); box-shadow: 0 2px 6px rgba(15, 20, 38, 0.08), 0 12px 28px rgba(15, 20, 38, 0.1); }
}

/* Parámetros que elige el super-admin (data-motion / data-radius en <html> o en la vista previa) */
[data-motion="calm"] { --spring: cubic-bezier(0.2, 0.8, 0.2, 1); }
[data-motion="calm"] .liquid-pill.moving-x, [data-motion="calm"] .liquid-pill.moving-y { animation: none; }
[data-motion="none"] *, [data-motion="none"] *::before, [data-motion="none"] *::after { animation: none !important; transition: none !important; }
[data-radius="compact"] { --r-sm: 8px; --r: 12px; --r-lg: 16px; --r-xl: 22px; }
[data-radius="compact"] :is(.item-card, .product-card, .kpi, .card, .hero, .alert-row) { border-radius: 14px; }
[data-radius="compact"] :is(.appbar, .tabbar, .cartbar, .auth-card) { border-radius: 20px; }
[data-radius="compact"] .product-card .swatch { border-radius: 10px; }
[data-radius="round"] { --r-sm: 16px; --r: 24px; --r-lg: 30px; --r-xl: 40px; }
[data-radius="round"] :is(.item-card, .product-card, .kpi, .card, .alert-row) { border-radius: 30px; }
[data-radius="round"] .hero { border-radius: 36px; }
[data-radius="round"] .product-card .swatch { border-radius: 22px; }

/* =========================================================================
   13. WhatsApp
   ========================================================================= */
.btn-whatsapp { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: var(--tap); padding: 10px 18px; border-radius: var(--r); font-weight: 700; background: #1fa855; color: #fff; transition: transform 0.15s var(--ease), filter 0.15s; text-decoration: none; }
.btn-whatsapp:hover { filter: brightness(1.05); }
.btn-whatsapp:active { transform: scale(0.97); }
.btn-whatsapp.btn-sm { min-height: 38px; padding: 6px 12px; font-size: 0.88rem; border-radius: 14px; }
.wa-preview { white-space: pre-wrap; font: 500 0.88rem/1.5 var(--font); background: #e7f8ee; color: #10291b; border-radius: 18px 18px 18px 6px; padding: 12px 14px; margin: 6px 0 4px; max-height: 300px; overflow: auto; box-shadow: var(--card-shadow); }
:root[data-theme="dark"] .wa-preview { background: #0f3b26; color: #e6f7ee; }
.hero-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }

/* =========================================================================
   14. Editor de apariencia (super-panel) y vista previa en vivo
   ========================================================================= */
.modal-box.modal-wide { max-width: 1180px; }
.ae { display: grid; gap: 18px; }
@media (min-width: 900px) { .ae { grid-template-columns: minmax(0, 1fr) 360px; align-items: start; } }
.ae-controls { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.ae-sec { background: var(--surface); border: 1px solid var(--border); border-radius: 22px; padding: 14px; }
.ae-sec h3 { margin: 0 0 10px; font-size: 1rem; }
.ae-sec h4 { margin: 12px 0 6px; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.ae-presets { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; }
.ae-preset { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; padding: 10px; border-radius: 16px; border: 2px solid var(--border); background: var(--surface-2); font-weight: 700; font-size: 0.85rem; text-align: left; transition: transform 0.2s var(--spring), border-color 0.2s; }
.ae-preset:hover { transform: translateY(-2px); }
.ae-preset[aria-pressed="true"] { border-color: var(--accent); }
.ae-preset .dots { display: flex; }
.ae-preset .dots i { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--surface); margin-right: -6px; }
.ae-colors { display: grid; gap: 6px; }
.ae-colors { grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); }
.ae-color { display: flex; align-items: center; gap: 10px; padding: 6px 6px 6px 8px; border-radius: 14px; background: var(--surface-2); min-width: 0; }
.ae-color label { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; margin: 0; cursor: pointer; }
.ae-color input[type="color"] { width: 40px; height: 40px; min-height: 0; padding: 0; border: 2px solid var(--border); border-radius: 12px; background: none; cursor: pointer; flex-shrink: 0; }
.ae-color input[type="color"]::-webkit-color-swatch-wrapper { padding: 2px; }
.ae-color input[type="color"]::-webkit-color-swatch { border: 0; border-radius: 8px; }
.ae-color .t { display: flex; flex-direction: column; min-width: 0; font-weight: 600; font-size: 0.88rem; line-height: 1.2; }
.ae-color .t small { color: var(--muted); font-weight: 500; font-size: 0.74rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ae-color .t code { font-size: 0.72rem; color: var(--text-2); }
.ae-color .t code.custom { color: var(--accent-text); font-weight: 800; }
.ae .ae-color input.ae-hex.ae-hex { width: 88px; flex: 0 0 88px; min-height: 36px; padding: 4px 8px; border-radius: 10px; font-size: 0.8rem; font: 600 0.8rem var(--mono); text-transform: lowercase; }
.ae-color button { width: 34px; height: 34px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; color: var(--muted); flex-shrink: 0; }
.ae-color button:hover { background: var(--surface); color: var(--text); }
.ae-color button:disabled { opacity: 0.3; }
.ae-params { display: grid; gap: 12px; }
@media (min-width: 600px) { .ae-params { grid-template-columns: 1fr 1fr; } }
.ae-param > span { display: block; font-weight: 700; font-size: 0.85rem; margin-bottom: 6px; }
.ae-param .segmented { display: flex; width: 100%; flex-wrap: nowrap; }
.ae-param .segmented button { flex: 1; padding: 0 6px; font-size: 0.8rem; min-height: 36px; }
.ae-warn { margin-top: 10px; }
.ae-preview { position: sticky; top: 0; display: flex; flex-direction: column; gap: 10px; align-items: center; }
@media (max-width: 899px) { .ae-preview { position: static; order: -1; } }
.ae-preview .segmented { align-self: stretch; display: flex; }
.ae-preview .segmented button { flex: 1; }
.ae-actions { position: sticky; bottom: -28px; margin: 16px -28px -28px; padding: 14px 28px calc(14px + var(--safe-b)); background: var(--glass-strong); -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px); border-top: 1px solid var(--border); align-items: center; z-index: 3; }
@media (max-width: 719px) { .ae-actions { margin: 16px -20px calc(-24px - var(--safe-b)); padding-left: 20px; padding-right: 20px; bottom: calc(-24px - var(--safe-b)); } }

.pv-phone { width: 100%; max-width: 340px; padding: 10px; border-radius: 46px; background: #0c0e13; box-shadow: 0 30px 60px rgba(15, 20, 38, 0.28), 0 0 0 1px rgba(255, 255, 255, 0.06) inset; }
.pv-stage { position: relative; height: 620px; overflow: hidden; border-radius: 36px; background: var(--bg); color: var(--text); font-size: 14px; isolation: isolate; text-align: left; transition: background 0.4s var(--ease); }
@media (max-width: 899px) { .pv-stage { height: 520px; } }
.pv-stage::before { content: ""; position: absolute; inset: -30%; z-index: -1; pointer-events: none; filter: blur(26px);
	background: radial-gradient(48% 34% at 12% 10%, color-mix(in srgb, var(--blob-a) 85%, transparent), transparent 70%),
		radial-gradient(44% 32% at 92% 40%, color-mix(in srgb, var(--blob-b) 75%, transparent), transparent 70%),
		radial-gradient(46% 34% at 16% 80%, color-mix(in srgb, var(--blob-c) 75%, transparent), transparent 70%); }
.pv-stage .pv-scroll { position: absolute; inset: 0; overflow: hidden auto; padding-bottom: 120px; scrollbar-width: none; }
.pv-stage .pv-scroll::-webkit-scrollbar { display: none; }
.pv-stage .pv-status { display: flex; justify-content: space-between; padding: 12px 24px 0; font-weight: 700; font-size: 0.78rem; }
.pv-stage .appbar { position: sticky; top: 6px; margin: 6px 10px 0; min-height: 54px; }
.pv-stage .brand-mark { width: 38px; height: 38px; }
.pv-stage .page { padding: 10px 12px 20px; }
.pv-stage .tabbar { position: absolute; bottom: 10px; height: 64px; border-radius: 32px; width: calc(100% - 20px); }
.pv-stage .tab { height: 52px; font-size: 0.62rem; max-width: 70px; border-radius: 22px; }
.pv-stage .tabbar > .liquid-pill { border-radius: 22px; }
.pv-stage .tab-main .circle { width: 42px; height: 42px; }
.pv-stage .tab-main { font-size: 0.62rem; }
.pv-stage .cartbar { position: absolute; bottom: 84px; min-height: 56px; width: calc(100% - 20px); border-radius: 28px; animation: none; }
.pv-stage .cartbar .info strong { font-size: 1.1rem; }
.pv-stage .cartbar .btn-primary { min-height: 42px; font-size: 0.9rem; }
.pv-stage .products-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
.pv-stage .product-card { min-height: 140px; padding: 10px; }
.pv-stage .product-card .swatch { height: 56px; font-size: 1.4rem; }
.pv-stage .hero strong { font-size: 1.8rem; }
.pv-stage .kpi { padding: 10px; }
.pv-stage .kpi strong { font-size: 0.98rem; }
.pv-stage .auth-shell { padding: 34px 18px 20px; gap: 14px; }
.pv-stage .auth-title h1 { font-size: 1.55rem; }
.pv-stage .auth-card { padding: 18px 16px; border-radius: 26px; }
.pv-stage .field { margin-bottom: 10px; }
.pv-stage input { pointer-events: none; }
.pv-stage[data-pv-mode="dark"] .product-card .swatch { color: color-mix(in srgb, var(--pc) 70%, #fff); }
