/**
 * Pedidos Manager — estilos globales.
 * Paleta oficial del sitio: NO usar colores fuera de estas variables.
 */

:root {
	--primary: hsl(95, 78%, 18%);
	--primary-l-1: hsl(95, 50%, 25%);  --primary-l-2: hsl(95, 35%, 33%);
	--primary-l-3: hsl(95, 25%, 40%);  --primary-l-4: hsl(95, 19%, 48%);
	--primary-l-5: hsl(95, 17%, 55%);  --primary-l-6: hsl(95, 17%, 63%);
	--primary-l-7: hsl(95, 17%, 70%);  --primary-l-8: hsl(95, 17%, 78%);
	--primary-l-9: hsl(95, 17%, 85%);  --primary-l-10: hsl(95, 17%, 93%);
	--primary-d-1: hsl(95, 78%, 16%);  --primary-d-2: hsl(95, 78%, 15%);
	--primary-d-3: hsl(95, 78%, 13%);  --primary-d-4: hsl(95, 78%, 11%);
	--primary-d-5: hsl(95, 78%, 10%);  --primary-d-6: hsl(95, 78%, 8%);
	--primary-d-7: hsl(95, 78%, 7%);   --primary-d-8: hsl(95, 78%, 5%);
	--primary-d-9: hsl(95, 78%, 3%);   --primary-d-10: hsl(95, 76%, 2%);
	--primary-t-1: hsla(95, 78%, 18%, .09);  --primary-t-2: hsla(95, 78%, 18%, .18);
	--primary-t-3: hsla(95, 78%, 18%, .27);  --primary-t-4: hsla(95, 78%, 18%, .36);
	--primary-t-5: hsla(95, 78%, 18%, .45);  --primary-t-6: hsla(95, 78%, 18%, .55);
	--primary-t-7: hsla(95, 78%, 18%, .64);  --primary-t-8: hsla(95, 78%, 18%, .73);
	--primary-t-9: hsla(95, 78%, 18%, .82);  --primary-t-10: hsla(95, 78%, 18%, .91);

	--secondary: hsl(86, 47%, 91%);
	--secondary-l-1: hsl(87, 48%, 92%);  --secondary-l-2: hsl(87, 48%, 93%);
	--secondary-l-3: hsl(87, 48%, 93%);  --secondary-l-4: hsl(87, 48%, 94%);
	--secondary-l-5: hsl(87, 48%, 95%);  --secondary-l-6: hsl(87, 48%, 96%);
	--secondary-l-7: hsl(87, 48%, 97%);  --secondary-l-8: hsl(87, 48%, 98%);
	--secondary-l-9: hsl(87, 48%, 98%);  --secondary-l-10: hsl(87, 48%, 99%);
	--secondary-d-1: hsl(87, 23%, 83%);  --secondary-d-2: hsl(87, 14%, 74%);
	--secondary-d-3: hsl(87, 9%, 66%);   --secondary-d-4: hsl(87, 7%, 58%);
	--secondary-d-5: hsl(87, 5%, 50%);   --secondary-d-6: hsl(87, 5%, 41%);
	--secondary-d-7: hsl(87, 5%, 33%);   --secondary-d-8: hsl(87, 5%, 25%);
	--secondary-d-9: hsl(87, 5%, 17%);   --secondary-d-10: hsl(87, 5%, 8%);

	/* Rojo: alertas / descuentos / eliminar */
	--tertiary: hsl(0, 72%, 59%);
	--tertiary-l-1: hsl(0, 72%, 63%);  --tertiary-l-2: hsl(0, 72%, 67%);
	--tertiary-l-3: hsl(0, 72%, 70%);  --tertiary-l-4: hsl(0, 72%, 74%);
	--tertiary-l-5: hsl(0, 72%, 78%);  --tertiary-l-6: hsl(0, 72%, 81%);
	--tertiary-l-7: hsl(0, 72%, 85%);  --tertiary-l-8: hsl(0, 72%, 89%);
	--tertiary-l-9: hsl(0, 72%, 93%);  --tertiary-l-10: hsl(0, 72%, 97%);
	--tertiary-d-1: hsl(0, 61%, 53%);  --tertiary-d-2: hsl(0, 50%, 48%);
	--tertiary-d-3: hsl(0, 50%, 42%);  --tertiary-d-4: hsl(0, 50%, 36%);
	--tertiary-d-5: hsl(0, 50%, 30%);  --tertiary-d-6: hsl(0, 50%, 24%);
	--tertiary-d-7: hsl(0, 50%, 19%);  --tertiary-d-8: hsl(0, 50%, 14%);
	--tertiary-d-9: hsl(0, 50%, 9%);   --tertiary-d-10: hsl(0, 50%, 5%);
	--tertiary-t-1: hsla(0, 72%, 59%, .09);  --tertiary-t-2: hsla(0, 72%, 59%, .18);
	--tertiary-t-3: hsla(0, 72%, 59%, .27);  --tertiary-t-4: hsla(0, 72%, 59%, .36);
	--tertiary-t-5: hsla(0, 72%, 59%, .45);  --tertiary-t-6: hsla(0, 72%, 59%, .55);
	--tertiary-t-7: hsla(0, 72%, 59%, .64);  --tertiary-t-8: hsla(0, 72%, 59%, .73);
	--tertiary-t-9: hsla(0, 72%, 59%, .82);  --tertiary-t-10: hsla(0, 72%, 59%, .91);

	--white: hsl(0, 0%, 100%);
	--black: hsl(0, 0%, 0%);

	/* Tokens de diseño del plugin */
	--pm-radius: 14px;
	--pm-radius-sm: 9px;
	--pm-shadow: 0 4px 18px var(--primary-t-1);
	--pm-shadow-lg: 0 12px 40px var(--primary-t-3);
	--pm-transition: .18s ease;
}

/* ------------------------------------------------------------------ */
/* Base                                                                */
/* ------------------------------------------------------------------ */

.pm,
.pm * {
	box-sizing: border-box;
}

/* El atributo hidden SIEMPRE gana, incluso sobre los display: block que
   usa el layout de tarjetas móviles (filtros de clientes/inventario). */
.pm [hidden] {
	display: none !important;
}

.pm {
	color: var(--primary-d-4);
	font-size: 1.8rem;
	line-height: 1.5;
}

.pm-notice {
	background: var(--secondary-l-5);
	border-radius: var(--pm-radius);
	padding: 14px 18px;
}

.pm-notice--error {
	background: var(--tertiary-l-9);
	color: var(--tertiary-d-4);
}

/* Botones */
.pm-btn {
	appearance: none;
	border: 0;
	border-radius: 999px;
	cursor: pointer;
	font: inherit;
	font-weight: 600;
	padding: 10px 20px;
	transition: background var(--pm-transition), color var(--pm-transition), transform var(--pm-transition), opacity var(--pm-transition);
}

.pm-btn:active { transform: scale(.97); }
.pm-btn:disabled { cursor: not-allowed; opacity: .45; }

.pm-btn--primary { background: var(--primary); color: var(--white); }
.pm-btn--primary:hover:not(:disabled) { background: var(--primary-l-1); }

.pm-btn--ghost {
	background: var(--primary-t-1);
	color: var(--primary);
}
.pm-btn--ghost:hover:not(:disabled) { background: var(--primary-t-2); }

.pm-btn--danger-ghost {
	background: var(--tertiary-t-1);
	color: var(--tertiary-d-2);
}
.pm-btn--danger-ghost:hover:not(:disabled) { background: var(--tertiary-t-2); }

.pm-btn--block { display: block; width: 100%; }
.pm-btn--lg { font-size: 1.05em; padding: 14px 24px; }
.pm-btn--sm { font-size: .85em; padding: 8px 16px; }

/* Tabla de clientes */
.pm-clientes .pm-btn--sm { display: inline-block; text-decoration: none; white-space: nowrap; }
.pm-no-url { color: var(--secondary-d-4); font-size: .85em; font-style: italic; }
.pm-tel { color: var(--primary); font-weight: 600; text-decoration: none; }
.pm-tel:hover { text-decoration: underline; }

.pm-filters--clientes { align-items: center; grid-template-columns: 1fr auto; }
.pm-clientes__count { color: var(--secondary-d-6); font-size: .85em; font-weight: 700; white-space: nowrap; }

/* Conteo de pedidos por cliente (abre el historial) */
.pm-count-btn {
	align-items: center;
	background: var(--primary-t-1);
	border: 0;
	border-radius: 999px;
	color: var(--primary);
	cursor: pointer;
	display: inline-flex;
	font: inherit;
	font-weight: 800;
	height: 40px;
	justify-content: center;
	min-width: 48px;
	padding: 0 14px;
	transition: background var(--pm-transition), transform var(--pm-transition);
}

.pm-count-btn:hover { background: var(--primary-t-2); transform: scale(1.05); }

/* Popup de historial de pedidos del cliente */
.pm-co-client { color: var(--secondary-d-6); font-weight: 700; margin: 0 0 14px; }

.pm-co-summary {
	display: grid;
	gap: 8px;
	grid-template-columns: 1fr 1fr;
	margin-bottom: 16px;
}

.pm-co-stat {
	background: var(--secondary-l-6);
	border-radius: var(--pm-radius-sm);
	display: flex;
	flex-direction: column;
	gap: 2px;
	padding: 10px 14px;
}

.pm-co-stat span { color: var(--secondary-d-6); font-size: .75em; font-weight: 700; text-transform: uppercase; }
.pm-co-stat strong { color: var(--primary-d-2); font-size: 1.05em; }

.pm-co-stat--accent { background: var(--primary); }
.pm-co-stat--accent span { color: var(--primary-l-9); }
.pm-co-stat--accent strong { color: var(--white); }

.pm-co-orders { max-height: 40vh; overflow-y: auto; }

.pm-co-order {
	border-bottom: 1px dashed var(--secondary-d-1);
	padding: 12px 0;
}

.pm-co-order:last-child { border-bottom: 0; }

.pm-co-order__head {
	align-items: center;
	display: flex;
	justify-content: space-between;
	margin-bottom: 6px;
}

.pm-co-order__meta { color: var(--secondary-d-6); font-size: .85em; font-weight: 700; }
.pm-co-order__total { color: var(--primary); font-size: .9em; font-weight: 800; margin-top: 6px; }

/* Cliente clicable en la tabla de pedidos (abre la factura) */
.pm-client-link {
	background: none;
	border: 0;
	color: var(--primary);
	cursor: pointer;
	font: inherit;
	font-weight: 700;
	padding: 0;
	text-align: left;
	text-decoration: underline;
	text-decoration-color: var(--primary-l-7);
	text-underline-offset: 3px;
}
.pm-client-link:hover { text-decoration-color: var(--primary); }

/* Descuentos en el popup de edición */
.pm-e-discounts {
	background: var(--secondary-l-7);
	border-radius: var(--pm-radius-sm);
	display: grid;
	gap: 12px;
	margin: 8px 0 4px;
	padding: 14px;
}

.pm-e-discounts__label {
	color: var(--primary-d-2);
	display: block;
	font-size: .85em;
	font-weight: 700;
	margin-bottom: 6px;
}

.pm-e-calc {
	color: var(--secondary-d-6);
	font-size: .85em;
	font-weight: 700;
	margin: 0;
}

/* Factura del cliente */
.pm-invoice { text-align: center; }

.pm-invoice__logo {
	border-radius: 999px;
	height: 84px;
	margin: 0 auto 10px;
	object-fit: cover;
	width: 84px;
}

.pm-invoice__title { margin: 0 0 2px; }
.pm-invoice__meta { color: var(--secondary-d-6); font-size: .9em; font-weight: 600; margin: 0 0 16px; }

.pm-invoice__items,
.pm-invoice__totals { text-align: left; }

.pm-invoice__line {
	border-bottom: 1px dashed var(--secondary-l-1);
	display: flex;
	gap: 12px;
	justify-content: space-between;
	padding: 9px 0;
}

.pm-invoice__totals { border-top: 2px solid var(--primary-t-2); margin-top: 10px; }
.pm-invoice__line--disc { color: var(--tertiary-d-1); font-weight: 700; }
.pm-invoice__line--total { border-bottom: 0; color: var(--primary); font-size: 1.15em; font-weight: 800; }

.pm-invoice__thanks {
	color: var(--secondary-d-6);
	font-style: italic;
	margin: 14px 0 0;
}

/* ------------------------------------------------------------------ */
/* Inventario                                                          */
/* ------------------------------------------------------------------ */

.pm-filters--inventario { grid-template-columns: 1fr 1fr; }

/* Barra «Agregar stock» */
.pm-inv-add__row {
	align-items: end;
	display: grid;
	gap: 12px;
	grid-template-columns: 1fr 90px auto;
}

@media (max-width: 719px) {
	.pm-inv-add__row { grid-template-columns: 1fr 90px; }
	.pm-inv-add__row .pm-btn { grid-column: 1 / -1; }
}

.pm-inv-editor {
	align-items: center;
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.pm-inv-editor .pm-qty__btn { height: 38px; width: 38px; font-size: 1.1em; }
.pm-inv-editor .pm-qty__input { padding: 7px 0; width: 64px; }

.pm-inv-status { font-size: .85em; font-weight: 700; min-width: 0; }
.pm-inv-status.is-ok { color: var(--primary-l-1); }
.pm-inv-status.is-error { color: var(--tertiary-d-2); }

@media (max-width: 719px) {
	/* En la tarjeta apilada el editor ocupa su propia línea completa */
	.pm-inv-editor { justify-content: flex-end; }
}

/* Chips / pills */
.pm-chips {
	display: flex;
	flex-wrap: nowrap;
	gap: 8px;
	margin: 0 0 22px;
	overflow-x: auto;
	padding-bottom: 6px;
	-webkit-overflow-scrolling: touch;
}

.pm-chip {
	background: var(--secondary-l-4);
	border: 1px solid transparent;
	border-radius: 999px;
	color: var(--primary-d-2);
	cursor: pointer;
	flex: 0 0 auto;
	font: inherit;
	font-size: .95em;
	font-weight: 600;
	padding: 10px 18px;
	transition: background var(--pm-transition), color var(--pm-transition);
}

.pm-chip:hover { background: var(--secondary-d-1); }

.pm-chip.is-active {
	background: var(--primary);
	color: var(--white);
}

.pm-chip--discount {
	background: var(--tertiary-l-9);
	color: var(--tertiary-d-3);
}
.pm-chip--discount:hover { background: var(--tertiary-l-8); }
.pm-chip--discount.is-active { background: var(--tertiary); color: var(--white); }

/* Campos */
.pm-field { display: block; margin-bottom: 14px; }
.pm-field > span {
	color: var(--primary-d-2);
	display: block;
	font-size: .9em;
	font-weight: 700;
	margin-bottom: 5px;
}

.pm-field input,
.pm-field textarea,
.pm-field select {
	background: var(--white);
	border: 1.5px solid var(--secondary-d-1);
	border-radius: var(--pm-radius-sm);
	color: var(--primary-d-4);
	font: inherit;
	padding: 10px 12px;
	transition: border-color var(--pm-transition), box-shadow var(--pm-transition);
	width: 100%;
}

.pm-field input:focus,
.pm-field textarea:focus,
.pm-field select:focus {
	border-color: var(--primary-l-2);
	box-shadow: 0 0 0 3px var(--primary-t-1);
	outline: none;
}

.pm-field--inline { margin-bottom: 0; }

/* Paneles */
.pm-panel {
	background: var(--white);
	border: 1px solid var(--secondary-l-2);
	border-radius: var(--pm-radius);
	box-shadow: var(--pm-shadow);
	margin-bottom: 18px;
	padding: 18px;
}

.pm-panel__label {
	color: var(--primary-d-2);
	font-size: .9em;
	font-weight: 700;
	margin: 0 0 12px;
}

.pm-form-feedback { min-height: 1.2em; margin: 10px 0; font-weight: 600; }
.pm-form-feedback.is-ok { color: var(--primary-l-1); }
.pm-form-feedback.is-error { color: var(--tertiary-d-2); }

/* ------------------------------------------------------------------ */
/* Tienda                                                              */
/* ------------------------------------------------------------------ */

.pm-section { margin-bottom: 34px; }
.pm-section__title {
	color: var(--primary-d-2);
	font-size: 1.25em;
	margin: 0 0 14px;
}

/* Título de sección tipo pill roja (estilo menú) */
.pm-section__pill {
	background: var(--tertiary);
	border-radius: 12px;
	color: var(--white);
	display: inline-block;
	font-size: 1.3em;
	font-style: italic;
	margin: 0 0 8px;
	padding: 8px 26px;
}

/* Lista de productos estilo menú: nombre · línea punteada · precio */
.pm-menu {
	list-style: none;
	margin: 0;
	padding: 0;
}

.pm-menu-item.is-hidden { display: none; }

.pm-menu-row {
	align-items: baseline;
	background: none;
	border: 0;
	border-radius: var(--pm-radius-sm);
	cursor: pointer;
	display: flex;
	font: inherit;
	gap: 12px;
	min-height: 60px;
	padding: 16px 6px;
	text-align: left;
	transition: background var(--pm-transition);
	width: 100%;
}

.pm-menu-row:hover,
.pm-menu-row:active { background: var(--primary-t-1); }

.pm-menu-row__info {
	display: flex;
	flex: 0 1 auto;
	flex-direction: column;
	gap: 2px;
	min-width: 0;
}

.pm-menu-row__name {
	color: var(--primary-d-2);
	font-weight: 600;
}

.pm-menu-row__desc {
	color: var(--secondary-d-6);
	font-size: .8em;
	font-weight: 400;
	line-height: 1.35;
}

.pm-menu-row__leader {
	border-bottom: 2px dotted var(--primary-l-6);
	flex: 1 1 auto;
	min-width: 24px;
	transform: translateY(-4px);
}

.pm-menu-row__price {
	color: var(--tertiary);
	flex: 0 0 auto;
	font-weight: 800;
	white-space: nowrap;
}

/* Indicador «+»: señala que la fila abre el popup para añadir al carrito */
.pm-menu-row__add {
	align-items: center;
	align-self: center;
	background: var(--primary);
	border-radius: 999px;
	box-shadow: 0 2px 8px var(--primary-t-3);
	color: var(--white);
	display: inline-flex;
	flex: 0 0 auto;
	height: 34px;
	justify-content: center;
	transition: background var(--pm-transition), transform var(--pm-transition);
	width: 34px;
}

.pm-menu-row:hover .pm-menu-row__add,
.pm-menu-row:active .pm-menu-row__add {
	background: var(--primary-l-1);
	transform: scale(1.1);
}

.pm-grid {
	display: grid;
	gap: 16px;
	grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
}

@media (min-width: 640px) {
	.pm-grid { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
}

.pm-card {
	background: var(--white);
	border: 1px solid var(--secondary-l-2);
	border-radius: var(--pm-radius);
	box-shadow: var(--pm-shadow);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	transition: box-shadow var(--pm-transition), transform var(--pm-transition);
}

.pm-card:hover { box-shadow: var(--pm-shadow-lg); transform: translateY(-2px); }
.pm-card.is-hidden { display: none; }

.pm-card__media {
	aspect-ratio: 1 / 1;
	background: var(--secondary-l-6);
	overflow: hidden;
}

.pm-card__media img { display: block; height: 100%; object-fit: cover; width: 100%; }

.pm-card__body { display: flex; flex: 1; flex-direction: column; gap: 6px; padding: 12px 14px 14px; }
.pm-card__name { font-size: 1em; margin: 0; }
.pm-card__price { color: var(--primary); font-weight: 800; margin: 0 0 6px; }
.pm-card__add { margin-top: auto; }

/* Modal */
.pm-modal { inset: 0; position: fixed; z-index: 99990; }
.pm-modal[hidden] { display: none; }

.pm-modal__backdrop {
	background: var(--primary-t-7);
	inset: 0;
	position: absolute;
}

.pm-modal__panel {
	background: var(--white);
	border-radius: var(--pm-radius);
	box-shadow: var(--pm-shadow-lg);
	left: 50%;
	max-height: 90vh;
	max-width: 380px;
	overflow-y: auto;
	padding: 22px;
	position: absolute;
	top: 50%;
	transform: translate(-50%, -50%);
	width: calc(100% - 32px);
}

.pm-modal__panel--wide { max-width: 560px; }

.pm-modal__close {
	align-items: center;
	background: var(--secondary-l-4);
	border: 0;
	border-radius: 999px;
	color: var(--primary-d-2);
	cursor: pointer;
	display: inline-flex;
	font-size: 1.5em;
	height: 44px;
	justify-content: center;
	line-height: 1;
	padding: 0;
	position: absolute;
	right: 14px;
	top: 14px;
	width: 44px;
	z-index: 2;
}

.pm-modal__media {
	aspect-ratio: 1 / 1;
	background: var(--secondary-l-6);
	border-radius: var(--pm-radius-sm);
	margin-bottom: 14px;
	overflow: hidden;
}
.pm-modal__media img { display: block; height: 100%; object-fit: cover; width: 100%; }
.pm-modal__name { margin: 0 0 4px; }
.pm-modal__desc { color: var(--secondary-d-6); font-size: .85em; margin: 0 0 8px; }
.pm-modal__price { color: var(--primary); font-weight: 800; margin: 0 0 16px; }

/* Selector de cantidad */
.pm-qty {
	align-items: center;
	display: flex;
	gap: 10px;
	justify-content: center;
	margin-bottom: 18px;
}

.pm-qty__btn {
	align-items: center;
	background: var(--secondary-l-3);
	border: 0;
	border-radius: 999px;
	color: var(--primary-d-2);
	cursor: pointer;
	display: inline-flex;
	font-size: 1.25em;
	font-weight: 700;
	height: 44px;
	justify-content: center;
	line-height: 1;
	padding: 0;
	transition: background var(--pm-transition);
	width: 44px;
}
.pm-qty__btn:hover { background: var(--secondary-d-1); }

.pm-qty__input {
	border: 1.5px solid var(--secondary-d-1);
	border-radius: var(--pm-radius-sm);
	font: inherit;
	font-weight: 700;
	padding: 9px 0;
	text-align: center;
	width: 70px;
}

/* Carrito flotante (abajo izquierda) */
.pm-cart-fab {
	align-items: center;
	background: var(--primary);
	border: 0;
	border-radius: 999px;
	bottom: 22px;
	box-shadow: var(--pm-shadow-lg);
	color: var(--white);
	cursor: pointer;
	display: flex;
	height: 60px;
	justify-content: center;
	left: 22px;
	position: fixed;
	transition: background var(--pm-transition), transform var(--pm-transition);
	width: 60px;
	z-index: 99980;
}

.pm-cart-fab:hover { background: var(--primary-l-1); transform: scale(1.05); }

.pm-cart-fab__badge {
	align-items: center;
	background: var(--tertiary);
	border-radius: 999px;
	color: var(--white);
	display: flex;
	font-size: .75em;
	font-weight: 800;
	height: 22px;
	justify-content: center;
	min-width: 22px;
	padding: 0 5px;
	position: absolute;
	right: -4px;
	top: -4px;
}

/* Drawer del carrito */
.pm-drawer { inset: 0; position: fixed; z-index: 99990; }
.pm-drawer[hidden] { display: none; }
.pm-drawer__backdrop { background: var(--primary-t-7); inset: 0; position: absolute; }

.pm-drawer__panel {
	background: var(--white);
	bottom: 0;
	box-shadow: var(--pm-shadow-lg);
	display: flex;
	flex-direction: column;
	left: 0;
	max-height: 86vh;
	border-radius: var(--pm-radius) var(--pm-radius) 0 0;
	overflow-y: auto;
	padding: 18px;
	position: absolute;
	right: 0;
}

@media (min-width: 720px) {
	.pm-drawer__panel {
		border-radius: var(--pm-radius);
		bottom: auto;
		left: 50%;
		max-width: 460px;
		top: 50%;
		transform: translate(-50%, -50%);
		width: 100%;
	}
}

.pm-drawer__header {
	align-items: center;
	display: flex;
	justify-content: space-between;
	margin-bottom: 12px;
}
.pm-drawer__title { margin: 0; }
.pm-drawer__header .pm-modal__close { position: static; }

.pm-drawer__footer { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }

.pm-step { display: none; }
.pm-step.is-active { display: block; }
.pm-step__hint { color: var(--primary-d-2); font-weight: 600; }

.pm-cart-items { list-style: none; margin: 0; padding: 0; }

.pm-cart-item {
	align-items: center;
	border-bottom: 1px solid var(--secondary-l-2);
	display: flex;
	gap: 10px;
	padding: 12px 0;
}

.pm-cart-item__info { flex: 1; min-width: 0; }
.pm-cart-item__name { font-weight: 700; margin: 0; }
.pm-cart-item__subtotal { color: var(--primary); font-size: 1em; font-weight: 700; margin: 0; }

.pm-cart-item .pm-qty { margin: 0; }
.pm-cart-item .pm-qty__btn { height: 32px; width: 32px; font-size: 1em; }
.pm-cart-item .pm-qty__input { padding: 5px 0; width: 48px; }

.pm-cart-item__remove {
	align-items: center;
	background: var(--tertiary-l-9);
	border: 0;
	border-radius: 999px;
	color: var(--tertiary-d-2);
	cursor: pointer;
	display: inline-flex;
	font-size: 1.3em;
	height: 40px;
	justify-content: center;
	line-height: 1;
	padding: 0;
	transition: background var(--pm-transition);
	width: 40px;
}
.pm-cart-item__remove:hover { background: var(--tertiary-l-8); }

.pm-cart-total {
	align-items: baseline;
	color: var(--primary-d-2);
	display: flex;
	font-size: 1.2em;
	font-weight: 600;
	justify-content: space-between;
	margin: 0;
}

.pm-cart-total strong { font-size: 1.2em; }

.pm-cart-empty { color: var(--secondary-d-5); padding: 24px 0; text-align: center; }

/* Zonas */
.pm-zones { display: grid; gap: 12px; }

.pm-zone {
	background: var(--secondary-l-6);
	border: 2px solid transparent;
	border-radius: var(--pm-radius);
	cursor: pointer;
	font: inherit;
	font-weight: 700;
	padding: 18px;
	text-align: left;
	transition: border-color var(--pm-transition), background var(--pm-transition);
}

.pm-zone:hover { background: var(--secondary-l-3); }
.pm-zone.is-active { background: var(--primary-t-1); border-color: var(--primary); }

/* ------------------------------------------------------------------ */
/* Formulario de agentes                                               */
/* ------------------------------------------------------------------ */

.pm-field--search { position: relative; }

.pm-client-results {
	background: var(--white);
	border: 1px solid var(--secondary-d-1);
	border-radius: var(--pm-radius-sm);
	box-shadow: var(--pm-shadow);
	list-style: none;
	margin: 4px 0 0;
	max-height: 260px;
	overflow-y: auto;
	padding: 4px;
}

.pm-client-results li {
	border-radius: 7px;
	cursor: pointer;
	padding: 9px 12px;
	transition: background var(--pm-transition);
}

.pm-client-results li:hover { background: var(--secondary-l-4); }
.pm-client-results li small { color: var(--secondary-d-5); display: block; }

#pm-add-client { margin-top: 10px; }

.pm-client-form-wrap { margin-top: 14px; }
.pm-client-form-wrap .ff-el-group { margin-bottom: 14px; }

.pm-client-card {
	background: var(--primary-t-1);
	border-radius: var(--pm-radius-sm);
	font-size: .92em;
	margin-top: 10px;
	padding: 12px 14px;
}

.pm-repeater-row {
	align-items: center;
	display: grid;
	gap: 8px;
	grid-template-columns: 1fr 84px 36px;
	margin-bottom: 10px;
}

.pm-repeater-row select,
.pm-repeater-row input {
	border: 1.5px solid var(--secondary-d-1);
	border-radius: var(--pm-radius-sm);
	font: inherit;
	padding: 9px 10px;
	width: 100%;
}

.pm-row-remove {
	align-items: center;
	background: var(--tertiary-l-9);
	border: 0;
	border-radius: 999px;
	color: var(--tertiary-d-2);
	cursor: pointer;
	display: inline-flex;
	font-size: 1.3em;
	height: 40px;
	justify-content: center;
	line-height: 1;
	padding: 0;
	width: 40px;
}
.pm-row-remove:hover { background: var(--tertiary-l-8); }

.pm-summary__row {
	border-bottom: 1px dashed var(--secondary-d-1);
	display: flex;
	justify-content: space-between;
	padding: 8px 0;
}
.pm-summary__row:last-child { border-bottom: 0; }
.pm-summary__row strong { color: var(--primary); }
.pm-summary__row--muted span,
.pm-summary__row--muted strong { color: var(--secondary-d-6); font-weight: 600; }

/* Desglose de descuentos (resumen, popups, tabla) */
.pm-summary__row--discount span,
.pm-summary__row--discount strong,
.pm-amount-discount { color: var(--tertiary-d-1); }

.pm-money-sub {
	color: var(--secondary-d-5);
	display: block;
	font-size: .78em;
	font-weight: 500;
	white-space: nowrap;
}

.pm-money-discount {
	color: var(--tertiary-d-1);
	display: block;
	font-size: .78em;
	font-weight: 700;
	white-space: nowrap;
}

.pm-discounts { display: grid; gap: 12px; margin-top: 14px; }
.pm-discounts__options { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.pm-discounts__active {
	background: var(--tertiary-t-1);
	border-radius: var(--pm-radius-sm);
	color: var(--tertiary-d-3);
	font-size: .9em;
	font-weight: 700;
	margin: 0;
	padding: 10px 12px;
}

/* ------------------------------------------------------------------ */
/* Listado de pedidos                                                  */
/* ------------------------------------------------------------------ */

.pm-filters {
	align-items: end;
	background: var(--secondary-l-7);
	border-radius: var(--pm-radius);
	display: grid;
	gap: 12px;
	grid-template-columns: 1fr 1fr;
	margin-bottom: 18px;
	padding: 14px;
}

@media (min-width: 780px) {
	.pm-filters { grid-template-columns: repeat(4, 1fr) auto; }
}

.pm-table-wrap { overflow-x: auto; }

.pm-table {
	background: var(--white);
	border-collapse: collapse;
	border-radius: var(--pm-radius);
	box-shadow: var(--pm-shadow);
	overflow: hidden;
	width: 100%;
}

.pm-table th {
	background: var(--primary);
	color: var(--white);
	font-size: .85em;
	letter-spacing: .03em;
	padding: 11px 12px;
	text-align: left;
	text-transform: uppercase;
	white-space: nowrap;
}

.pm-table td {
	border-bottom: 1px solid var(--secondary-l-3);
	padding: 11px 12px;
	vertical-align: top;
}

.pm-table tbody tr:hover td { background: var(--secondary-l-8); }
.pm-table__loading { color: var(--secondary-d-5); text-align: center; }
.pm-table--compact td, .pm-table--compact th { padding: 8px 10px; }

.pm-order-products { list-style: none; margin: 0; padding: 0; }
.pm-order-products li { white-space: nowrap; }
.pm-order-products .qty { color: var(--primary); font-weight: 800; margin-right: 4px; }

.pm-badge {
	border-radius: 999px;
	display: inline-block;
	font-size: .85em;
	font-weight: 800;
	padding: 4px 12px;
	text-transform: capitalize;
	white-space: nowrap;
}

.pm-badge--pedido    { background: var(--tertiary-l-9);  color: var(--tertiary-d-3); }
.pm-badge--enviado   { background: var(--secondary-l-1); color: var(--secondary-d-7); }
.pm-badge--entregado { background: var(--primary-t-2);   color: var(--primary-d-2); }
.pm-badge--pagado    { background: var(--primary);       color: var(--white); }

.pm-table-footer {
	align-items: center;
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
	justify-content: space-between;
	margin-top: 14px;
}

.pm-export-group { display: flex; flex-wrap: wrap; gap: 10px; }

.pm-pagination { display: flex; gap: 6px; }

.pm-page-btn {
	background: var(--secondary-l-4);
	border: 0;
	border-radius: var(--pm-radius-sm);
	cursor: pointer;
	font: inherit;
	font-weight: 700;
	min-width: 38px;
	padding: 8px 10px;
	transition: background var(--pm-transition);
}

.pm-page-btn:hover:not(:disabled) { background: var(--secondary-d-1); }
.pm-page-btn.is-active { background: var(--primary); color: var(--white); }
.pm-page-btn:disabled { cursor: default; opacity: .4; }

.pm-edit-grid {
	display: grid;
	gap: 12px;
	grid-template-columns: 1fr 1fr;
	margin-top: 12px;
}

/* Lista de pedidos táctil (solo móvil): fila compacta → tarjeta al tocar */
.pm-orders-list { display: none; }

.pm-order-row {
	align-items: center;
	background: var(--white);
	border: 1px solid var(--secondary-l-2);
	border-radius: var(--pm-radius);
	box-shadow: var(--pm-shadow);
	cursor: pointer;
	display: flex;
	font: inherit;
	gap: 12px;
	justify-content: space-between;
	margin-bottom: 10px;
	min-height: 68px;
	padding: 12px 16px;
	text-align: left;
	transition: background var(--pm-transition);
	width: 100%;
}

.pm-order-row:active { background: var(--secondary-l-7); }

.pm-order-row__main { flex: 1; min-width: 0; }

.pm-order-row__client {
	font-weight: 700;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.pm-order-row__meta { color: var(--secondary-d-6); font-size: .85em; }

.pm-order-row__right { flex: 0 0 auto; text-align: right; }
.pm-order-row__total { color: var(--primary); display: block; font-weight: 800; }

/* Tarjeta de detalle del pedido */
.pm-detail__row {
	border-bottom: 1px dashed var(--secondary-l-1);
	display: flex;
	gap: 14px;
	justify-content: space-between;
	padding: 10px 0;
}

.pm-detail__row:last-child { border-bottom: 0; }
.pm-detail__row > span:first-child { color: var(--secondary-d-6); font-size: .85em; font-weight: 700; text-transform: uppercase; }
.pm-detail__row > span:last-child { font-weight: 600; text-align: right; }
.pm-detail__row .pm-order-products { text-align: right; }
.pm-detail__actions { display: grid; gap: 10px; margin-top: 16px; }

/* Fila del repeater con producto bloqueado (popup de edición) */
.pm-row-product-label {
	background: var(--secondary-l-6);
	border-radius: var(--pm-radius-sm);
	font-weight: 600;
	overflow: hidden;
	padding: 10px 12px;
	text-overflow: ellipsis;
	white-space: nowrap;
}

/* Móvil: la tabla se convierte en tarjetas apiladas (headers via data-label) */
@media (max-width: 719px) {
	/* En la lista de pedidos la tabla se oculta y se usa la lista táctil */
	.pm-lista .pm-table-wrap { display: none; }
	.pm-lista .pm-orders-list { display: block; }

	.pm-table { background: transparent; box-shadow: none; }
	.pm-table thead { display: none; }
	.pm-table tbody,
	.pm-table tr,
	.pm-table td { display: block; width: 100%; }

	.pm-table tr {
		background: var(--white);
		border: 1px solid var(--secondary-l-2);
		border-radius: var(--pm-radius);
		box-shadow: var(--pm-shadow);
		margin-bottom: 14px;
		overflow: hidden;
	}

	.pm-table td {
		align-items: baseline;
		border-bottom: 1px dashed var(--secondary-l-2);
		display: flex;
		gap: 14px;
		justify-content: space-between;
	}

	.pm-table td:last-child { border-bottom: 0; }

	.pm-table td::before {
		color: var(--secondary-d-6);
		content: attr(data-label);
		flex: 0 0 auto;
		font-size: .72em;
		font-weight: 800;
		letter-spacing: .05em;
		text-transform: uppercase;
	}

	.pm-table td.pm-td-action { display: block; }
	.pm-td-action .pm-btn { width: 100%; }

	.pm-table .pm-table__loading { display: block; text-align: center; }
	.pm-table .pm-table__loading::before { content: none; }

	.pm-order-products { text-align: right; }

	/* Filtros más cómodos al tacto */
	.pm-filters { grid-template-columns: 1fr 1fr; }
	.pm-filters .pm-btn { grid-column: 1 / -1; }
	.pm-field select,
	.pm-field input { min-height: 44px; }

	.pm-table-footer { flex-direction: column; align-items: stretch; }
	.pm-pagination { flex-wrap: wrap; justify-content: center; }
	.pm-page-btn { min-height: 42px; }
}

/* ------------------------------------------------------------------ */
/* Contabilidad                                                        */
/* ------------------------------------------------------------------ */

.pm-stats {
	display: grid;
	gap: 12px;
	grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
	margin-bottom: 18px;
}

.pm-stat {
	background: var(--white);
	border: 1px solid var(--secondary-l-2);
	border-radius: var(--pm-radius);
	box-shadow: var(--pm-shadow);
	display: flex;
	flex-direction: column;
	gap: 6px;
	padding: 14px 16px;
}

.pm-stat__label { color: var(--secondary-d-6); font-size: .85em; font-weight: 700; }
.pm-stat__value { color: var(--primary-d-2); font-size: 1.4em; }

.pm-stat--accent { background: var(--primary); border-color: var(--primary); }
.pm-stat--accent .pm-stat__label { color: var(--primary-l-9); }
.pm-stat--accent .pm-stat__value { color: var(--white); }

.pm-stat--danger .pm-stat__value { color: var(--tertiary-d-2); }

.pm-bars {
	align-items: end;
	display: grid;
	gap: 6px;
	grid-template-columns: repeat(12, 1fr);
	height: 160px;
}

.pm-bar { display: flex; flex-direction: column; height: 100%; justify-content: end; text-align: center; }

.pm-bar__fill {
	background: var(--primary-l-2);
	border-radius: 6px 6px 0 0;
	min-height: 2px;
	transition: height .35s ease;
}

.pm-bar.is-max .pm-bar__fill { background: var(--primary); }
.pm-bar__label { color: var(--secondary-d-5); font-size: .68em; font-weight: 700; margin-top: 4px; }

.pm-top-products { list-style: none; margin: 0; padding: 0; }

.pm-top-products li {
	align-items: center;
	border-bottom: 1px dashed var(--secondary-l-1);
	display: flex;
	gap: 10px;
	padding: 8px 0;
}

.pm-top-products .bar {
	background: var(--primary-t-2);
	border-radius: 999px;
	flex: 1;
	height: 10px;
	overflow: hidden;
}

.pm-top-products .bar i {
	background: var(--primary);
	border-radius: 999px;
	display: block;
	height: 100%;
}

.pm-top-products .name { flex: 0 0 40%; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pm-top-products .count { color: var(--primary); font-weight: 800; }

.pm-expense-form {
	align-items: end;
	display: grid;
	gap: 12px;
	grid-template-columns: 1fr 1fr;
	margin-bottom: 14px;
}

@media (min-width: 780px) {
	.pm-expense-form { grid-template-columns: 2fr 1fr 1fr 1fr auto; }
}

/* Página de ajustes (admin) */
.pm-admin h2 { margin-top: 2em; }
