/* Vengala Catálogo — app de edición de productos */

:root {
	--accent: #241a2e;
	--on-accent: #fff;
	--accent-soft: color-mix(in srgb, var(--accent) 9%, #fff);
	--accent-line: color-mix(in srgb, var(--accent) 28%, #fff);
	--bg: #f7f4ef;
	--surface: #fff;
	--ink: #1d1a20;
	--muted: #6f6874;
	--faint: #a29ba6;
	--line: #e8e2da;
	--line-strong: #d6cec4;
	--danger: #b42318;
	--danger-soft: #fdecea;
	--ok: #1f7a4d;
	--ok-soft: #e7f4ec;
	--warn: #9a5b0b;
	--warn-soft: #fbf1e1;
	--sans: "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
	--serif: "Instrument Serif", Georgia, serif;
	--r-sm: 8px;
	--r: 12px;
	--r-lg: 18px;
	--shadow: 0 1px 2px rgba(29, 26, 32, .06), 0 8px 24px -12px rgba(29, 26, 32, .18);
	--safe-b: env(safe-area-inset-bottom, 0px);
	--safe-t: env(safe-area-inset-top, 0px);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
	margin: 0;
	background: var(--bg);
	color: var(--ink);
	font: 400 15px/1.45 var(--sans);
	-webkit-font-smoothing: antialiased;
	-webkit-tap-highlight-color: transparent;
	overscroll-behavior-y: none;
}
body.locked { overflow: hidden; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
img { display: block; max-width: 100%; }
a { color: inherit; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
svg.i { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.boot { min-height: 100vh; display: grid; place-items: center; }
.spinner {
	width: 22px; height: 22px; border-radius: 50%;
	border: 2px solid var(--line-strong); border-top-color: var(--accent);
	animation: spin .7s linear infinite; display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------ Estructura: barra lateral + contenido */

.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px; }
.icon-btn {
	width: 40px; height: 40px; border-radius: 50%;
	display: inline-grid; place-items: center; color: inherit;
	transition: background .15s;
}
.icon-btn:hover { background: rgba(29, 26, 32, .06); }

.side {
	background: var(--accent); color: var(--on-accent);
	position: relative;
}
.brand { display: flex; align-items: center; gap: 12px; min-height: 44px; }
.brand-name { font: 400 28px/1 var(--serif); letter-spacing: -.01em; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-logo { height: 22px; width: auto; max-width: min(180px, 60vw); min-width: 0; object-fit: contain; object-position: left center; }
.brand-spacer { flex: 1; }
.avatar {
	width: 36px; height: 36px; border-radius: 50%; flex: none;
	background: color-mix(in srgb, var(--on-accent) 14%, transparent); color: var(--on-accent);
	border: 1px solid color-mix(in srgb, var(--on-accent) 22%, transparent);
	display: grid; place-items: center; font-weight: 600; font-size: 12.5px; letter-spacing: .03em;
}

/* Secciones: Joyas / Descuentos / Pagos */
.sec {
	display: flex; align-items: center; gap: 10px; width: 100%;
	color: color-mix(in srgb, var(--on-accent) 78%, transparent); font-weight: 600; font-size: 15px;
	border-radius: 10px; transition: background .15s, color .15s; text-align: left;
}
.sec svg { width: 19px; height: 19px; flex: none; }
.sec-l { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sec-s { display: none; }
.sec-badge {
	font-size: 11px; font-weight: 700; letter-spacing: .03em; padding: 3px 7px; border-radius: 999px;
	background: color-mix(in srgb, var(--on-accent) 16%, transparent); color: var(--on-accent);
}
.sec-badge.on { background: #3fb27f; color: #fff; }

/* Lista de filtros: nombre a la izquierda, número a la derecha (misma letra que los productos). */
.nav {
	display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%;
	padding: 8px 10px; border-radius: 9px; font-size: 14.5px; font-weight: 500; text-align: left;
	transition: background .15s, color .15s;
}
.nav-l { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-n { font-weight: 600; font-size: 13.5px; font-variant-numeric: tabular-nums; opacity: .7; }
.nav[aria-pressed="true"] { font-weight: 600; }
.nav[aria-pressed="true"] .nav-n { opacity: 1; }
.side-h { margin: 22px 10px 6px; font-size: 11px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; opacity: .55; }
.navs { display: flex; flex-direction: column; gap: 1px; }

.range { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 0 2px; }
.range label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 600; opacity: .9; }
.range input {
	width: 100%; height: 38px; border-radius: 9px; padding: 0 10px; font-size: 15px; font-weight: 600;
	border: 1px solid var(--line); background: var(--surface); color: var(--ink);
}
.range input:focus { outline: none; border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-soft); }
.clear-all {
	display: inline-flex; align-items: center; gap: 6px; margin: 16px 10px 0; font-size: 13.5px; font-weight: 600;
	text-decoration: underline; text-underline-offset: 3px;
}
.clear-all svg { width: 15px; height: 15px; }

.tools { display: grid; grid-template-columns: 1fr 280px; gap: 10px; }
.search { position: relative; display: flex; align-items: center; }
.search svg { position: absolute; left: 14px; color: var(--muted); pointer-events: none; }
.search input {
	width: 100%; height: 46px; border-radius: var(--r);
	border: 1px solid var(--line); background: var(--surface);
	padding: 0 44px; font-size: 16px; /* 16px evita el zoom en iPhone */
	transition: border-color .15s, box-shadow .15s;
}
.search input::placeholder { color: var(--faint); }
.search input:focus { outline: none; border-color: var(--accent-line); box-shadow: 0 0 0 4px var(--accent-soft); }
.search .clear { position: absolute; right: 4px; color: var(--muted); }
.search .clear svg { position: static; }
.search input::-webkit-search-cancel-button { display: none; }

.select { position: relative; display: flex; align-items: center; }
.select select {
	appearance: none; -webkit-appearance: none; width: 100%; height: 46px;
	border: 1px solid var(--line); border-radius: var(--r); background: var(--surface);
	padding: 0 40px 0 86px; font-size: 15px; font-weight: 600; cursor: pointer; color: var(--ink);
	transition: border-color .15s, box-shadow .15s;
}
.select-l { position: absolute; left: 14px; font-size: 13px; color: var(--muted); pointer-events: none; }
.select select:focus { outline: none; border-color: var(--accent-line); box-shadow: 0 0 0 4px var(--accent-soft); }
.select svg { position: absolute; right: 14px; width: 18px; height: 18px; color: var(--muted); pointer-events: none; }

.filters-mob { display: none; }

.bar { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 14px; padding: 18px 0 14px; color: var(--muted); font-size: 14px; }
.bar-t { margin: 0; font-size: 20px; font-weight: 600; color: var(--ink); letter-spacing: -.01em; }
.bar-t strong { font-weight: 700; font-variant-numeric: tabular-nums; }
.bar-f { font-size: 14px; color: var(--muted); }
.progress { display: inline-flex; align-items: center; gap: 8px; }
.progress .spinner { width: 14px; height: 14px; border-width: 1.5px; }

.banner, .tip {
	display: flex; align-items: center; gap: 12px; margin: 0 0 14px;
	background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--accent);
	border-radius: var(--r); padding: 10px 8px 10px 14px; font-size: 14px; color: var(--muted);
}
.banner { border-left-color: #2e9e6b; background: #f1faf5; }
.banner > svg { color: #2e9e6b; flex: none; }
.tip > svg { color: var(--accent); flex: none; }
.banner p, .tip p { margin: 0; flex: 1; }
.banner strong, .tip strong { color: var(--ink); }
.tip .icon-btn { color: var(--muted); flex: none; }
.link { font-weight: 600; color: var(--accent); text-decoration: underline; text-underline-offset: 3px; padding: 6px 8px; display: inline-flex; align-items: center; gap: 4px; }
.link.danger { color: var(--danger); text-decoration: none; }
.link svg { width: 15px; height: 15px; }

/* ---- Computadora: panel con barra lateral fija ---- */
@media (min-width: 960px) {
	.layout { display: grid; grid-template-columns: 268px minmax(0, 1fr); min-height: 100vh; }
	.side {
		position: sticky; top: 0; height: 100vh; overflow-y: auto; overscroll-behavior: contain;
		padding: 24px 14px 20px; display: flex; flex-direction: column;
		scrollbar-width: thin; scrollbar-color: color-mix(in srgb, var(--on-accent) 25%, transparent) transparent;
	}
	.brand { padding: 0 8px 18px; margin-bottom: 14px; border-bottom: 1px solid color-mix(in srgb, var(--on-accent) 14%, transparent); }
	.sections { display: flex; flex-direction: column; gap: 2px; }
	.sec { padding: 10px 12px; }
	.sec:hover { background: color-mix(in srgb, var(--on-accent) 8%, transparent); color: var(--on-accent); }
	.sec[aria-current="page"] { background: color-mix(in srgb, var(--on-accent) 15%, transparent); color: var(--on-accent); }
	.side-cat { margin-top: 6px; }
	body:not([data-section="catalog"]) .side-cat { display: none; }
	.side .tabs { display: flex; flex-direction: column; gap: 1px; }
	.side .nav { color: color-mix(in srgb, var(--on-accent) 80%, transparent); }
	.side .nav:hover { background: color-mix(in srgb, var(--on-accent) 8%, transparent); color: var(--on-accent); }
	.side .nav[aria-pressed="true"] { background: var(--on-accent); color: var(--accent); }
	.side .range input { background: color-mix(in srgb, var(--on-accent) 8%, transparent); border-color: color-mix(in srgb, var(--on-accent) 20%, transparent); color: var(--on-accent); }
	.side .range input::placeholder { color: color-mix(in srgb, var(--on-accent) 45%, transparent); }
	.side .range input:focus { border-color: color-mix(in srgb, var(--on-accent) 50%, transparent); box-shadow: none; }
	.side-foot { margin: auto 10px 0; padding-top: 24px; font-size: 12px; opacity: .5; }
	.side-foot a { color: inherit; }
	.side-desk { display: block; }

	.main { padding: 22px 32px 0; min-width: 0; }
	.tools { position: sticky; top: 0; z-index: 20; background: var(--bg); padding: 12px 0; margin-top: -12px; }
	.menu { top: auto; bottom: 70px; left: 20px; right: auto; }
	.fab { right: 32px; }
}

/* ---- Celular y tablet: franja arriba, secciones abajo ---- */
@media (max-width: 959px) {
	body { padding-bottom: calc(var(--safe-b) + 66px); }
	.side { padding: calc(var(--safe-t) + 12px) 16px 0; overflow: hidden; }
	.side-desk { display: none !important; }
	body:not([data-section="catalog"]) .side-cat { display: none; }
	body:not([data-section="catalog"]) .side { padding-bottom: 14px; }

	.sections {
		position: fixed; z-index: 25; left: 0; right: 0; bottom: 0;
		display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
		background: var(--surface); border-top: 1px solid var(--line);
		padding: 6px 8px calc(var(--safe-b) + 6px);
		box-shadow: 0 -8px 24px -18px rgba(29, 26, 32, .4);
	}
	.sec {
		flex-direction: column; gap: 3px; padding: 6px 4px; color: var(--faint);
		font-size: 11.5px; justify-content: center; text-align: center; position: relative;
	}
	.sec svg { width: 22px; height: 22px; }
	.sec-l { flex: none; }
	.sec:has(.sec-s) .sec-l { display: none; }
	.sec-s { display: block; }
	.sec[aria-current="page"] { color: var(--accent); }
	.sec-badge { position: absolute; top: 0; left: calc(50% + 6px); font-size: 9.5px; padding: 2px 5px; }
	.sec-badge:not(.on) { display: none; }

	.side .tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 2px; margin: 16px -8px 0; }
	.side .tabs .nav {
		flex-direction: column; align-items: flex-start; gap: 1px; padding: 9px 8px 11px;
		border-radius: 12px 12px 0 0; color: color-mix(in srgb, var(--on-accent) 72%, transparent); font-size: 12.5px;
	}
	.side .tabs .nav-n { font-size: 20px; font-weight: 700; opacity: 1; color: var(--on-accent); }
	.side .tabs .nav[aria-pressed="true"] { background: var(--bg); color: var(--ink); }
	.side .tabs .nav[aria-pressed="true"] .nav-n { color: var(--ink); }

	.main { padding: 14px 16px 0; }
	.tools { grid-template-columns: 1fr; gap: 8px; }

	.filters-mob {
		display: block; margin-top: 8px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface);
	}
	.filters-mob summary {
		list-style: none; display: flex; align-items: center; gap: 10px; height: 46px; padding: 0 14px;
		font-weight: 600; font-size: 15px; cursor: pointer;
	}
	.filters-mob summary::-webkit-details-marker { display: none; }
	.filters-mob summary span { flex: 1; }
	.filters-mob summary svg:last-child { color: var(--muted); transition: transform .2s; }
	.filters-mob[open] summary svg:last-child { transform: rotate(180deg); }
	.filters-mob #filters { padding: 0 6px 14px; border-top: 1px solid var(--line); }
	.filters-mob .nav[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }
	.filters-mob .side-h { color: var(--muted); opacity: 1; margin-top: 16px; }

	.fab { bottom: calc(var(--safe-b) + 80px); }
	.menu { top: calc(var(--safe-t) + 60px); right: 12px; }
	.toast { bottom: calc(var(--safe-b) + 150px); }
}

/* ------------------------------------------------------------ Páginas: Descuentos y Pagos */

.page { max-width: 760px; padding-bottom: 60px; }
.page-h { padding: 8px 0 18px; }
.page-h h2 { margin: 0 0 6px; font: 400 42px/1.05 var(--serif); letter-spacing: -.015em; }
.page-h p { margin: 0; color: var(--muted); max-width: 60ch; }
.page-h strong { color: var(--ink); }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 20px; margin-bottom: 16px; }
.panel hr { border: 0; border-top: 1px solid var(--line); margin: 18px -20px; }
.panel > .t, .switch-row .t { font-weight: 600; font-size: 16px; }
.panel .hint { font-size: 13px; color: var(--muted); margin: 8px 0 0; font-weight: 400; }
.btn.wide { width: 100%; }
.btn-ghost svg { width: 18px; height: 18px; }

.status-card {
	display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px; margin-bottom: 16px;
	border-radius: var(--r-lg); border: 1px solid var(--line); background: var(--surface);
}
.status-card p { margin: 2px 0 0; color: var(--muted); font-size: 14px; }
.st-dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 6px; flex: none; background: var(--line-strong); }
.st-on { background: #f1faf5; border-color: #bfe6d1; }
.st-on .st-dot { background: #2e9e6b; box-shadow: 0 0 0 4px #d5f0e2; }
.st-soon { background: var(--warn-soft); border-color: #f0dcb8; }
.st-soon .st-dot { background: var(--warn); }

.pct { position: relative; max-width: 200px; }
.pct .input { font-size: 30px; font-weight: 700; height: 64px; padding-right: 44px; font-variant-numeric: tabular-nums; }
.pct span { position: absolute; right: 16px; top: 50%; transform: translateY(-50%); font-size: 22px; font-weight: 600; color: var(--muted); }
.quick-pcts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.date { display: flex; flex-direction: column; gap: 5px; font-size: 13px; font-weight: 600; color: var(--muted); }
.date .input { font-weight: 500; color: var(--ink); }
.example {
	display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin: 4px 0 18px;
	padding: 12px 14px; border-radius: var(--r); background: var(--bg); font-size: 14px;
}
.example > span:first-child { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.ex-p { margin-left: auto; font-variant-numeric: tabular-nums; }
.ex-p s { color: var(--faint); }
.ex-p b { color: #2e9e6b; font-size: 16px; }
.audit { margin: 12px 0 0; font-size: 12.5px; color: var(--faint); text-align: center; }
.audit strong { color: var(--muted); font-weight: 600; }

.acct { border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px 14px; margin-bottom: 10px; background: #fcfbf9; }
.acct-h { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.acct .grid2 { gap: 10px; }
@media (max-width: 520px) { .acct .grid2 { grid-template-columns: 1fr; } }
.preview { border: 1px dashed var(--line-strong); border-radius: var(--r); padding: 14px 16px; margin: 4px 0 18px; font-size: 14px; }
.pv-l { display: block; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); margin-bottom: 6px; }
.pv-t { display: block; font-size: 16px; }
.pv-i { margin: 4px 0 0; color: var(--muted); }
.pv-acct { display: flex; flex-direction: column; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.others { list-style: none; margin: 10px 0 0; padding: 0; }
.others li { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; border-top: 1px solid var(--line); }
.pill { font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: var(--bg); color: var(--muted); }
.pill.on { background: var(--ok-soft); color: var(--ok); }

.chip {
	flex: none; height: 34px; padding: 0 13px; border-radius: 999px;
	border: 1px solid var(--line-strong); background: var(--surface);
	font-size: 14px; font-weight: 500; white-space: nowrap;
	display: inline-flex; align-items: center; gap: 6px;
	transition: background .15s, border-color .15s, color .15s;
}
.chip .n { color: var(--faint); font-variant-numeric: tabular-nums; }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.chip[aria-pressed="true"] .n { color: color-mix(in srgb, var(--on-accent) 65%, transparent); }

/* ------------------------------------------------------------ Tarjetas */

.grid {
	list-style: none; margin: 0; padding: 0 0 calc(var(--safe-b) + 110px);
	display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 12px;
}
@media (min-width: 900px) { .grid { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 16px; } }

.item {
	display: flex; flex-direction: column; min-width: 0;
	background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
	overflow: hidden; transition: border-color .2s, box-shadow .2s, transform .2s;
}
.item:hover { box-shadow: 0 10px 30px -18px rgba(29, 26, 32, .35); }
.item.flash { border-color: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }

.item-ph {
	position: relative; display: block; width: 100%; aspect-ratio: 1; background: #fff;
	border-bottom: 1px solid var(--line); overflow: hidden;
}
.item-ph img { width: 100%; height: 100%; object-fit: contain; padding: 6%; transition: transform .35s ease; }
.item:hover .item-ph img { transform: scale(1.04); }
.item.is-draft .item-ph img, .item.is-draft .item-body { opacity: .55; }
.item.is-out .item-ph img { filter: grayscale(.6); opacity: .75; }
.no-ph {
	position: absolute; inset: 10px; border: 1.5px dashed var(--line-strong); border-radius: var(--r);
	display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
	color: var(--faint); font-size: 13px; font-weight: 500; background: #faf8f5;
}
.no-ph svg { width: 26px; height: 26px; }
.badges { position: absolute; left: 8px; top: 8px; right: 8px; display: flex; flex-wrap: wrap; gap: 4px; pointer-events: none; }
.badge {
	font-size: 10.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
	padding: 4px 7px; border-radius: 6px; line-height: 1;
}
.b-draft { background: var(--ink); color: #fff; }
.b-out { background: var(--danger); color: #fff; }
.b-sale { background: var(--ok); color: #fff; }

.item-body { padding: 12px 12px 4px; cursor: pointer; min-width: 0; }
.name {
	margin: 0; font-size: 15px; font-weight: 600; line-height: 1.25;
	display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
	min-height: 2.5em;
}
.meta { margin-top: 4px; font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meta .sku { font-variant-numeric: tabular-nums; letter-spacing: .02em; }

.quick { padding: 8px 12px 12px; display: flex; flex-direction: column; gap: 6px; margin-top: auto; }
.ctl { display: flex; align-items: center; gap: 8px; }
.ctl-l { width: 44px; flex: none; font-size: 11.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--faint); }
.ctl > :last-child { flex: 1; min-width: 0; }

.price-in {
	display: flex; align-items: center; height: 38px;
	border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface);
	padding: 0 10px; gap: 2px; transition: border-color .15s, box-shadow .15s, background .3s;
}
.price-in span { color: var(--muted); font-size: 14px; }
.price-in input {
	border: 0; outline: 0; width: 100%; min-width: 0; background: transparent;
	font-size: 16px; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums;
}
.price-in:focus-within { border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-soft); }
.price-in.saving { background: #faf8f5; }
.price-in.saved { border-color: var(--ok); }
.price-in.error { border-color: var(--danger); }
.price-var { font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }

.stepper {
	display: inline-flex; align-items: center; height: 38px;
	border: 1px solid var(--line); border-radius: var(--r-sm); overflow: hidden; background: var(--surface);
}
.stepper button {
	width: 36px; height: 100%; flex: none; display: grid; place-items: center; color: var(--ink);
	transition: background .12s;
}
.stepper button:active { background: var(--accent-soft); }
.stepper button:disabled { color: var(--line-strong); cursor: default; }
.stepper button svg { width: 16px; height: 16px; stroke-width: 2.2; }
.stepper output, .stepper input {
	flex: 1; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; font-size: 15px;
	border: 0; outline: 0; background: transparent; width: 100%; min-width: 0; padding: 0;
}
.stepper.zero { border-color: color-mix(in srgb, var(--danger) 35%, #fff); background: var(--danger-soft); }
.stepper.zero output, .stepper.zero input { color: var(--danger); }
.avail {
	height: 38px; border-radius: var(--r-sm); font-size: 13px; font-weight: 600;
	border: 1px solid var(--line); display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.avail .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); }
.avail.out { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 30%, #fff); }
.avail.out .dot { background: var(--danger); }
.go {
	height: 38px; border-radius: var(--r-sm); border: 1px solid var(--line);
	font-size: 13px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 2px;
}
.go svg { width: 16px; height: 16px; }

/* Celular: dos columnas de ~165px. */
@media (max-width: 520px) {
	.grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
	.item-body { padding: 10px 10px 2px; }
	.name { font-size: 14px; }
	.quick { padding: 6px 10px 10px; gap: 5px; }
	.ctl { gap: 4px; }
	.ctl-l { width: 38px; font-size: 9.5px; letter-spacing: .02em; }
	.price-in { padding: 0 8px; height: 36px; }
	.price-in input { font-size: 15px; }
	.stepper { height: 36px; }
	.stepper button { width: 30px; }
}

.empty { grid-column: 1 / -1; text-align: center; padding: 64px 24px; color: var(--muted); list-style: none; }
.empty h2 { font: 400 30px/1.1 var(--serif); color: var(--ink); margin: 0 0 6px; }
.more { height: 1px; }

.fab {
	position: fixed; z-index: 15; right: 16px; bottom: calc(var(--safe-b) + 18px);
	height: 54px; padding: 0 22px 0 18px; border-radius: 16px;
	background: var(--accent); color: var(--on-accent);
	display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: 15px;
	box-shadow: 0 10px 28px -8px color-mix(in srgb, var(--accent) 70%, transparent);
	transition: transform .15s;
}
.fab:active { transform: scale(.97); }

/* ------------------------------------------------------------ Menú */

.menu {
	position: fixed; z-index: 40;
	min-width: 220px; background: var(--surface); border-radius: var(--r);
	box-shadow: var(--shadow), 0 0 0 1px var(--line); padding: 6px; display: none;
}
.menu.open { display: block; animation: pop .14s ease-out; }
.menu .who { padding: 10px 12px 8px; font-size: 13px; color: var(--muted); border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.menu .who strong { display: block; color: var(--ink); font-size: 14px; }
.menu a, .menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border-radius: var(--r-sm); text-decoration: none; font-size: 14px; }
.menu a:hover, .menu button:hover { background: var(--bg); }
.menu svg { width: 18px; height: 18px; color: var(--muted); }
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } }

/* ------------------------------------------------------------ Ficha */

.sheet {
	position: fixed; inset: 0; z-index: 30; display: flex; justify-content: center;
	pointer-events: none;
}
.sheet-scrim { position: absolute; inset: 0; background: rgba(20, 16, 24, .38); opacity: 0; transition: opacity .25s; }
.sheet-panel {
	position: relative; width: 100%; max-width: 640px; height: 100%;
	background: var(--bg); display: flex; flex-direction: column;
	transform: translateY(100%); transition: transform .32s cubic-bezier(.2, .8, .2, 1);
}
.sheet.open { pointer-events: auto; }
.sheet.open .sheet-scrim { opacity: 1; }
.sheet.open .sheet-panel { transform: none; }
@media (min-width: 700px) {
	.sheet { align-items: center; padding: 24px; }
	.sheet-panel { height: auto; max-height: calc(100vh - 48px); border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow); transform: translateY(24px); opacity: 0; transition: transform .25s, opacity .2s; }
	.sheet.open .sheet-panel { opacity: 1; }
}

.sheet-head {
	display: flex; align-items: center; gap: 8px;
	padding: calc(var(--safe-t) + 8px) 8px 8px; border-bottom: 1px solid var(--line); background: var(--bg);
}
.sheet-head h2 { flex: 1; min-width: 0; margin: 0; font-size: 15px; font-weight: 600; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sheet-head .icon-btn { flex: none; }
.sheet-body { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 16px 16px 24px; overscroll-behavior: contain; }
.sheet-foot {
	padding: 12px 16px calc(var(--safe-b) + 12px); border-top: 1px solid var(--line); background: var(--bg);
	display: flex; gap: 10px;
}

.btn {
	height: 50px; border-radius: var(--r); padding: 0 20px; font-weight: 600; font-size: 16px;
	display: inline-flex; align-items: center; justify-content: center; gap: 8px;
	transition: opacity .15s, transform .1s, background .15s;
}
.btn:active:not(:disabled) { transform: scale(.985); }
.btn-primary { background: var(--accent); color: var(--on-accent); flex: 1; }
.btn-primary:disabled { opacity: .35; cursor: default; }
.btn-ghost { border: 1px solid var(--line-strong); background: var(--surface); }
.btn .spinner { width: 18px; height: 18px; border-color: color-mix(in srgb, var(--on-accent) 35%, transparent); border-top-color: var(--on-accent); }

.field { margin-bottom: 20px; }
.field > label, .field > .label {
	display: flex; align-items: baseline; justify-content: space-between; gap: 8px;
	font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 7px; letter-spacing: .01em;
}
.field .hint { font-weight: 400; color: var(--faint); font-size: 12.5px; }
.input, .textarea {
	width: 100%; border: 1px solid var(--line); background: var(--surface); border-radius: var(--r);
	padding: 12px 14px; font-size: 16px; transition: border-color .15s, box-shadow .15s;
}
.input:focus, .textarea:focus { outline: none; border-color: var(--accent-line); box-shadow: 0 0 0 4px var(--accent-soft); }
.input.title { font: 400 26px/1.15 var(--serif); padding: 10px 14px; }
.textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
.money { position: relative; }
.money span { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.money .input { padding-left: 30px; font-weight: 600; font-variant-numeric: tabular-nums; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid2 .field { margin-bottom: 0; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; }
.section { margin-bottom: 20px; }
.err-msg { color: var(--danger); font-size: 13px; margin-top: 6px; }

.stock-big { display: flex; align-items: center; gap: 12px; }
.stock-big .stepper { height: 50px; width: 168px; border-radius: var(--r); }
.stock-big .stepper button { width: 50px; }
.stock-big .stepper input { font-size: 20px; }
.stock-big .note { font-size: 13px; color: var(--muted); }

.seg { display: inline-flex; background: #efeae3; border-radius: var(--r); padding: 3px; gap: 3px; }
.seg button { height: 40px; padding: 0 16px; border-radius: 9px; font-weight: 600; font-size: 14px; color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .08); }

.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.switch-row .t { font-weight: 600; }
.switch-row .d { font-size: 13px; color: var(--muted); }
.switch { position: relative; width: 50px; height: 30px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--line-strong); transition: background .2s; }
.switch span::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, .2); transition: transform .2s; }
.switch input:checked + span { background: var(--ok); }
.switch input:checked + span::after { transform: translateX(20px); }
.switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

.cat-pick { display: flex; flex-wrap: wrap; gap: 8px; }
.cat-pick .chip { height: 38px; font-size: 14px; }
.cat-pick .chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.cat-pick .chip.add { border-style: dashed; color: var(--muted); background: transparent; }
.cat-new { display: flex; gap: 8px; margin-top: 10px; }
.cat-new .input { height: 42px; padding: 0 12px; }
.cat-new .btn { height: 42px; font-size: 14px; padding: 0 14px; }

/* Fotos */
.photos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.photo {
	position: relative; aspect-ratio: 1; border-radius: var(--r); overflow: hidden;
	background: #efeae3; border: 1px solid var(--line);
}
.photo:first-child { grid-column: span 2; grid-row: span 2; }
.photo img { width: 100%; height: 100%; object-fit: cover; }
.photo .badge {
	position: absolute; left: 8px; top: 8px; font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
	background: rgba(255, 255, 255, .92); color: var(--ink); padding: 4px 8px; border-radius: 6px;
}
.photo .actions { position: absolute; right: 6px; top: 6px; display: flex; gap: 6px; }
.photo .actions button {
	width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center;
	background: rgba(255, 255, 255, .94); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .15);
}
.photo .actions button svg { width: 16px; height: 16px; }
.photo.loading::after { content: ""; position: absolute; inset: 0; background: rgba(255, 255, 255, .55); }
.photo .up { position: absolute; inset: 0; display: grid; place-items: center; z-index: 1; }
.photo-add {
	aspect-ratio: 1; border-radius: var(--r); border: 1.5px dashed var(--line-strong); background: transparent;
	display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
	color: var(--muted); font-size: 13px; font-weight: 500; position: relative;
}
.photos.none .photo-add { grid-column: 1 / -1; aspect-ratio: auto; height: 180px; font-size: 15px; }
.photos.none .photo-add svg { width: 28px; height: 28px; }
.photo-add input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

.vars { display: flex; flex-direction: column; gap: 8px; }
.var { display: grid; grid-template-columns: 1fr 104px 104px; gap: 8px; align-items: center; }
.var .lbl { font-weight: 600; font-size: 14px; min-width: 0; }
.var .lbl small { display: block; font-weight: 400; color: var(--muted); font-size: 12px; }

.links { display: flex; flex-wrap: wrap; gap: 8px 16px; font-size: 14px; }
.links a { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); text-decoration: none; }
.links a:hover { color: var(--ink); }
.links svg { width: 16px; height: 16px; }

.sheet-loading { display: grid; place-items: center; padding: 80px 0; }

/* ------------------------------------------------------------ Toast y diálogo */

.toast {
	position: fixed; z-index: 60; left: 50%; bottom: calc(var(--safe-b) + 88px);
	transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
	background: var(--ink); color: #fff; padding: 12px 16px; border-radius: var(--r);
	font-size: 14px; font-weight: 500; width: max-content; max-width: calc(100vw - 32px);
	display: flex; align-items: center; gap: 10px; box-shadow: var(--shadow);
	transition: transform .22s, opacity .22s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.bad { background: var(--danger); }
.toast svg { width: 18px; height: 18px; }
.sheet.open ~ .toast { bottom: calc(var(--safe-b) + 90px); }

.dialog-wrap { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: 24px; background: rgba(20, 16, 24, .45); }
.dialog { background: var(--surface); border-radius: var(--r-lg); padding: 22px; max-width: 360px; width: 100%; box-shadow: var(--shadow); animation: pop .16s ease-out; }
.dialog h3 { margin: 0 0 6px; font: 400 24px/1.15 var(--serif); }
.dialog p { margin: 0 0 18px; color: var(--muted); }
.dialog .row-btns { display: flex; gap: 8px; }
.dialog .row-btns .btn { flex: 1; height: 46px; font-size: 15px; }
.btn-danger { background: var(--danger); color: #fff; }


@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

/* ------------------------------------------------------------ Login */

body.login-page { background: var(--accent); }
.login {
	min-height: 100vh; min-height: 100svh;
	display: flex; flex-direction: column; align-items: center; justify-content: center;
	padding: calc(var(--safe-t) + 24px) 16px calc(var(--safe-b) + 24px);
	background: radial-gradient(90% 60% at 80% 0%, color-mix(in srgb, var(--on-accent) 10%, transparent), transparent);
}
.login-logo { height: 30px; width: auto; max-width: min(320px, 80vw); object-fit: contain; margin-bottom: 28px; }
.login-brand { margin: 0 0 28px; font: 400 32px/1 var(--serif); color: var(--on-accent); letter-spacing: -.01em; }
.login-card {
	width: 100%; max-width: 400px; background: var(--surface);
	border-radius: var(--r-lg); padding: 30px 24px 24px;
	box-shadow: 0 30px 60px -30px rgba(0, 0, 0, .45);
}
.login h1 { margin: 0 0 6px; font: 400 40px/1.02 var(--serif); letter-spacing: -.015em; }
.login-lead { margin: 0 0 24px; color: var(--muted); }
.login-err {
	margin: 0 0 18px; padding: 11px 14px; border-radius: var(--r);
	background: var(--danger-soft); color: var(--danger); font-weight: 500; font-size: 14px;
}
.login .field { margin-bottom: 16px; }
.login .input { height: 50px; }
.pass { position: relative; }
.pass .input { padding-right: 76px; }
.pass-toggle {
	position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
	height: 38px; padding: 0 12px; border-radius: 9px; font-size: 13px; font-weight: 600; color: var(--muted);
}
.pass-toggle:hover { background: var(--bg); color: var(--ink); }
.login-btn { width: 100%; margin-top: 8px; text-decoration: none; }
.login-forgot { display: block; text-align: center; margin-top: 18px; font-size: 14px; color: var(--muted); }
.login-foot { margin: 24px 0 0; font-size: 12px; color: color-mix(in srgb, var(--on-accent) 55%, transparent); }
.login-foot a { color: inherit; }

body:not([data-section="catalog"]) .fab { display: none; }

/* Posición final del botón "Nuevo" y avisos según el diseño (van al final para ganar). */
@media (min-width: 960px) { .fab { right: 32px; bottom: 24px; } }
@media (max-width: 959px) {
	.fab { bottom: calc(var(--safe-b) + 80px); }
	.toast, .sheet.open ~ .toast { bottom: calc(var(--safe-b) + 146px); }
}
.page .grid2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.date .input { width: 100%; min-width: 0; }
.main, .view { min-width: 0; }
.date { min-width: 0; }
@media (max-width: 380px) { .page .grid2 { grid-template-columns: 1fr; } }

/* ------------------------------------------------------------ Pedidos */

.side-orders { display: none; }
body[data-section="orders"] .side-orders { display: block; }
.tools.tools-1 { grid-template-columns: 1fr; }

.st {
	display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
	font-size: 12px; font-weight: 700; padding: 4px 9px; border-radius: 999px; line-height: 1.2;
}
.st::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.st-amber { background: #fdf1dc; color: #9a5b0b; }
.st-blue { background: #e6effc; color: #1f55a6; }
.st-green { background: var(--ok-soft); color: var(--ok); }
.st-red { background: var(--danger-soft); color: var(--danger); }
.st-gray { background: #eeebe6; color: var(--muted); }

.orders { list-style: none; margin: 0 0 16px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.order {
	display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 14px; align-items: center;
	background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 12px 14px;
	cursor: pointer; transition: box-shadow .2s, border-color .2s;
}
.order:hover, .order:focus-visible { box-shadow: 0 10px 30px -18px rgba(29, 26, 32, .35); border-color: var(--line-strong); outline: none; }
.o-thumbs { display: flex; }
.o-thumbs img, .o-thumbs .o-noimg {
	width: 46px; height: 46px; border-radius: 10px; object-fit: contain; background: #fff;
	border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--line); margin-left: -14px;
}
.o-thumbs > :first-child { margin-left: 0; }
.o-noimg { display: grid; place-items: center; color: var(--faint); background: #f4f1ec !important; }
.o-noimg svg { width: 18px; height: 18px; }
.o-top { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.o-top strong { font-size: 15px; font-variant-numeric: tabular-nums; }
.o-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.o-sub, .o-date { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.o-date { color: var(--faint); font-size: 12.5px; }
.o-right { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.o-total { font-size: 16px; font-variant-numeric: tabular-nums; }
@media (max-width: 600px) {
	.order { grid-template-columns: minmax(0, 1fr) auto; gap: 10px; padding: 12px; }
	.o-thumbs { display: none; }
	.o-top { flex-direction: column; gap: 0; }
}

/* Detalle del pedido */
.o-hero { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-bottom: 16px; }
.o-when { font-size: 13px; color: var(--muted); }
.o-sum { flex-basis: 100%; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 14px 16px; }
.o-sum span { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); }
.o-sum strong { font-size: 28px; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.o-sum small { margin-left: auto; color: var(--muted); font-size: 13.5px; }
.banner.warn { border-left-color: #c98a1d; background: #fdf6e8; }
.banner.warn > svg { color: #c98a1d; }
.banner.muted { border-left-color: var(--line-strong); background: var(--surface); }
.banner.muted > svg { color: var(--faint); }

.o-sec { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 14px 16px; margin-bottom: 12px; }
.o-sec h3 { margin: 0 0 8px; font-size: 11.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); }
.o-big { margin: 0 0 4px; font-weight: 600; font-size: 16px; }
.o-addr { margin: 4px 0 0; color: var(--muted); line-height: 1.5; }
.o-note { margin: 12px 0 0; padding: 10px 12px; border-radius: var(--r); background: var(--bg); font-style: italic; }
.o-note span { display: block; font-style: normal; font-size: 11.5px; font-weight: 700; color: var(--faint); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 2px; }
.o-contact { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.o-contact .btn { height: 42px; font-size: 14px; padding: 0 14px; text-decoration: none; }
.o-contact .btn svg { width: 17px; height: 17px; }
.btn-wa { background: #1fa855; color: #fff; }

.o-items { list-style: none; margin: 0; padding: 0; }
.o-items li { display: grid; grid-template-columns: 48px minmax(0, 1fr) auto auto; gap: 10px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); }
.o-items li:first-child { border-top: 0; padding-top: 0; }
.o-items img, .o-items .o-noimg { width: 48px; height: 48px; border-radius: 10px; object-fit: contain; background: #fff; border: 1px solid var(--line); }
.o-items strong { display: block; font-size: 14px; line-height: 1.3; }
.o-items span { font-size: 12.5px; color: var(--muted); }
.o-qty { color: var(--muted); font-variant-numeric: tabular-nums; }
.o-items .o-lt { font-weight: 600; font-variant-numeric: tabular-nums; color: var(--ink); font-size: 14px; }
.o-totals { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; margin: 12px 0 0; padding-top: 12px; border-top: 1px solid var(--line); font-size: 14px; }
.o-totals dt { color: var(--muted); }
.o-totals dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.o-totals dt:last-of-type, .o-totals dd:last-of-type { font-weight: 700; color: var(--ink); font-size: 15px; }

.o-addnote { display: flex; flex-direction: column; gap: 8px; }
.o-addnote .textarea { min-height: 64px; }
.o-addnote-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.o-addnote-row .btn { height: 40px; font-size: 14px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--muted); cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.o-notes { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.o-notes li { padding: 10px 12px; border-radius: var(--r); background: var(--bg); }
.o-notes li.to-cust { background: #e6effc; }
.o-notes p { margin: 0 0 4px; font-size: 14px; white-space: pre-line; }
.o-notes span { font-size: 12px; color: var(--muted); }

.order-acts { display: flex; gap: 10px; width: 100%; }
.order-acts[hidden] { display: none; }
.order-acts .btn { flex: 1; }
.order-acts .btn-ghost { flex: 0 0 auto; }
.order-acts .btn svg { width: 19px; height: 19px; }
.st-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.st-opt { display: flex; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r); text-align: left; }
.st-opt:hover { border-color: var(--line-strong); background: var(--bg); }
.st-opt .st { font-size: 13.5px; }

@media (max-width: 959px) {
	body[data-section="orders"] .side { padding-bottom: 0; }
	.otabs {
		display: flex; flex-direction: row; gap: 2px; overflow-x: auto; scrollbar-width: none;
		margin: 14px -16px 0; padding: 0 8px;
	}
	.otabs::-webkit-scrollbar { display: none; }
	.otabs .nav {
		flex: none; width: auto; flex-direction: column; align-items: flex-start; gap: 1px;
		padding: 9px 12px 11px; border-radius: 12px 12px 0 0; font-size: 12.5px;
		color: color-mix(in srgb, var(--on-accent) 72%, transparent);
	}
	.otabs .nav-n { font-size: 20px; font-weight: 700; opacity: 1; color: var(--on-accent); }
	.otabs .nav[aria-pressed="true"] { background: var(--bg); color: var(--ink); }
	.otabs .nav[aria-pressed="true"] .nav-n { color: var(--ink); }
}
@media (min-width: 960px) {
	.side .otabs .nav { color: color-mix(in srgb, var(--on-accent) 80%, transparent); }
	.side .otabs .nav:hover { background: color-mix(in srgb, var(--on-accent) 8%, transparent); color: var(--on-accent); }
	.side .otabs .nav[aria-pressed="true"] { background: var(--on-accent); color: var(--accent); }
	.side-orders { margin-top: 6px; }
}

/* ------------------------------------------------------------ Historial de pedidos */

.nav-n:empty { display: none; }
.nav-sep { display: block; height: 1px; margin: 8px 10px; background: color-mix(in srgb, var(--on-accent) 14%, transparent); }
.ohist { margin-bottom: 4px; }
.periods { display: flex; flex-wrap: wrap; gap: 6px; }
.range-dates { margin-top: 10px; max-width: 420px; }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-top: 14px; }
.kpi {
	display: flex; flex-direction: column; gap: 2px; min-width: 0;
	background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 14px 16px;
}
.kpi:first-child { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.kpi-l { font-size: 11.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; opacity: .65; }
.kpi-v { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-s { font-size: 12.5px; opacity: .65; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 760px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } .kpi-v { font-size: 20px; } }

.o-month {
	display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap;
	padding: 14px 4px 4px; list-style: none;
}
.o-month strong { font-size: 16px; }
.o-month span { font-size: 13px; color: var(--muted); }
.o-month b { color: var(--ink); font-variant-numeric: tabular-nums; }

.o-hist { list-style: none; margin: 0; padding: 0; }
.o-hist li {
	display: grid; grid-template-columns: auto 1fr auto auto; gap: 10px; align-items: center;
	padding: 9px 4px; border-top: 1px solid var(--line); cursor: pointer; font-size: 14px;
}
.o-hist li:first-child { border-top: 0; }
.o-hist li:hover { background: var(--bg); }
.o-hist span { color: var(--muted); font-size: 13px; }
.o-hist b { font-variant-numeric: tabular-nums; }

@media (max-width: 959px) {
	.otabs .nav-sep { width: 1px; height: auto; margin: 10px 4px; flex: none; }
}
