/* ═══════════════════════════════════════════════════════════════════════════
   MAYORISTAS (mayor.html) · lo que la tienda no tiene.
   Se carga DESPUÉS de css/style.css: tarjetas, rejilla, colores y letra son
   los de la tienda. Todo lo de aquí empieza por .mz- o cuelga de body.mayor,
   así que no puede cambiar nada de index.html.
   ═══════════════════════════════════════════════════════════════════════════ */
body.mayor { padding-top: 66px; padding-bottom: 40px; }
body.mayor .header-main-inner { justify-content: flex-start; }

.mz-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--green-primary); color: #fff;
  font-weight: 800; font-size: .82rem; letter-spacing: .3px;
  padding: 6px 12px; border-radius: 50px; white-space: nowrap;
}
.mz-acciones { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.mz-acciones[hidden] { display: none; }
/* ── 538 · Barra como la de la tienda (clases de style.css) ── */
/* Los contadores de style.css son display:flex: sin esto `hidden` no los oculta. */
.mz-acciones [hidden] { display: none !important; }
/* En el móvil la tienda saca el carrito de la barra de arriba (tiene una barra
   flotante abajo). Aquí pasa a un botón redondo flotante abajo a la derecha:
   así el saludo «Hola, <negocio>» tiene sitio en la barra (medido: con el
   carrito arriba, a 390 px solo se leía «C…» y a 360 px desaparecía). */
@media (max-width: 900px) {
  body.mayor { padding-bottom: 96px; }
  body.mayor .header-actions .cart-btn:not([hidden]) {
    display: flex !important; position: fixed; z-index: 5;
    right: 16px; bottom: calc(18px + env(safe-area-inset-bottom, 0px));
    width: 60px; height: 60px; min-width: 0; padding: 0; border-radius: 50%;
    align-items: center; justify-content: center;
    box-shadow: 0 6px 18px rgba(26, 124, 62, .45);
  }
  body.mayor .header-actions .cart-btn > span:not(.cart-badge) { display: none; }
  body.mayor .header-actions .cart-btn i { font-size: 1.4rem; }
  body.mayor .header-actions .cart-btn .cart-badge { top: 2px; right: 2px; width: 22px; height: 22px; font-size: .72rem; border: 2px solid #fff; }
  .mz-toast { bottom: calc(92px + env(safe-area-inset-bottom, 0px)); }
}
/* Escáner dentro del buscador (solo visible en la app, regla de style.css) */
.mz-buscar .mz-scan {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  min-height: 38px; min-width: 42px; padding: 0 8px; font-size: 1.35rem;
}
.mz-buscar .mz-scan:active { transform: translateY(-50%) scale(.92); }
html.es-app-nativa .mz-buscar input { padding-right: 52px; }

/* ── 538 · Mi cuenta ── */
#mzCuenta a.acc-card { display: block; text-decoration: none; color: inherit; }
.mz-tarjeta { background: #fff; border: 1px solid #e8eee9; border-radius: 14px; padding: 16px; margin-bottom: 14px; }
.mz-tit { font-size: .98rem; font-weight: 800; color: var(--green-dark); display: flex; align-items: center; gap: 8px; margin: 0 0 4px; }
.mz-opc { font-weight: 500; color: var(--text-light); font-size: .76rem; }
.mz-form textarea {
  font: 500 1rem var(--font); padding: 11px 13px; border: 2px solid var(--border); border-radius: var(--radius-sm);
  outline: none; background: #fff; width: 100%; resize: vertical;
}
.mz-form textarea:focus { border-color: var(--green-light); }
.mz-form input:disabled { background: var(--bg-light); color: var(--text-medium); }
.mz-btn--naranja { background: linear-gradient(135deg, #e07b00, #f59e0b); }
.mz-btn--naranja:hover { background: #c96d00; }
.mz-gps {
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%;
  padding: 12px 14px; border-radius: 12px; border: 2px dashed #f0b35c; background: #fff8ef;
  color: #b45f00; font-weight: 700; font-size: .92rem;
}
.mz-gps:hover { background: #ffefd9; }
.mz-gps[disabled] { opacity: .6; cursor: wait; }
.mz-ub-estado { font-size: .84rem; font-weight: 600; color: var(--green-dark); background: var(--green-pale); border-radius: 10px; padding: 8px 12px; margin: 0; }
.mz-ub-estado[hidden] { display: none; }
.mz-mapa { border-radius: 14px; overflow: hidden; border: 1.5px solid #e2e8f0; background: #fff; }
.mz-mapa[hidden] { display: none; }
/* 538 · mapa con el punto arrastrable (Leaflet). z-index bajo: que no tape el panel. */
.mz-mapa__lienzo { width: 100%; height: 240px; position: relative; z-index: 0; background: #eef2ee; }
.mz-mapa__pie { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 10px; padding: 8px 12px; font-size: .78rem; color: var(--text-medium); border-top: 1px solid #eef2ee; }
.mz-mapa__acc { display: flex; gap: 12px; }
.mz-link { background: none; border: 0; padding: 4px 0; color: #b45f00; font-weight: 700; font-size: .84rem; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.mz-link[hidden] { display: none; }
.mz-link--rojo { color: #c62828; }
#ubElegir { align-self: center; }
/* 540 · Las mismas ayudas de ubicación dentro del carrito */
.mz-ubic-carrito { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.mz-ubic-carrito #cuElegir { align-self: center; }
.mz-ubic-carrito .mz-error { margin: 0; }

/* Notificaciones */
.mz-noti { display: flex; gap: 12px; align-items: flex-start; background: #fff; border: 1px solid #e8eee9; border-radius: 14px; padding: 12px 14px; margin-bottom: 10px; }
.mz-noti--nueva { border-color: #8fd3dc; background: #f2fbfc; }
.mz-noti__ico { width: 38px; height: 38px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center; background: #e0f4f6; color: #0097a7; }
.mz-noti--aprobada .mz-noti__ico, .mz-noti--entregado .mz-noti__ico { background: var(--green-pale); color: var(--green-primary); }
.mz-noti--cancelado .mz-noti__ico { background: #fdecea; color: #c62828; }
.mz-noti__txt { min-width: 0; }
.mz-noti__tit { font-weight: 800; font-size: .92rem; color: var(--text-dark); }
.mz-noti__msg { font-size: .86rem; color: var(--text-medium); margin-top: 2px; line-height: 1.4; }
.mz-noti__fecha { font-size: .74rem; color: var(--text-light); margin-top: 4px; }

/* Favoritos */
.mz-fav { cursor: pointer; }
.mz-fav__quitar { width: 38px; height: 38px; border-radius: 50%; background: #fdecea; color: #e74c3c; font-size: 1rem; }
.mz-fav__quitar:hover { background: #fbd5d1; }
.mz-det-fav { flex: 0 0 auto; margin-left: auto; }

/* ── 539 · Volver a la tienda normal (en la app no hay botón «atrás») ── */
.mz-ir-detal {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  margin-top: 14px; padding: 10px; border-radius: 12px;
  color: var(--green-dark); font-weight: 700; font-size: .9rem; text-decoration: none;
}
.mz-ir-detal:hover, .mz-ir-detal:active { background: var(--green-pale); }
.account-panel-footer .mz-ir-detal { margin-top: 8px; }

/* ── 539 · Dentro de la app (html.es-app-nativa la pone js/nativo.js) ──
   La cabecera fija ya baja por debajo del notch (regla de style.css); el
   contenido tiene que bajar lo mismo. El fondo del borde es el de la página
   (style.css lo pone oscuro porque la tienda acaba en su pie oscuro). */
html.es-app-nativa.pag-mayor,
html.es-app-nativa.pag-mayor body { background-color: var(--bg-light); }
html.es-app-nativa body.mayor { padding-top: calc(66px + env(safe-area-inset-top, 0px)); }
html.es-app-nativa .mz-panel { padding-top: env(safe-area-inset-top, 0px); }
html.es-app-nativa #mzDetalle { padding-top: calc(12px + env(safe-area-inset-top, 0px)); padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px)); }

/* ── Entrar / crear cuenta ── */
.mz-auth { min-height: calc(100vh - 110px); display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.mz-auth[hidden] { display: none; }
.mz-auth__caja { width: 100%; max-width: 420px; background: #fff; border-radius: var(--radius-lg); box-shadow: var(--shadow-md); padding: 28px 24px; }
.mz-auth h1 { font-size: 1.5rem; font-weight: 800; color: var(--green-dark); text-align: center; }
.mz-auth__sub { text-align: center; color: var(--text-medium); font-size: .92rem; margin: 4px 0 18px; }
.mz-tabs { display: grid; grid-template-columns: 1fr 1fr; background: var(--bg-light); border-radius: 50px; padding: 4px; margin-bottom: 18px; }
.mz-tab { background: none; border-radius: 50px; padding: 9px; font-weight: 700; color: var(--text-medium); }
.mz-tab.activo { background: #fff; color: var(--green-primary); box-shadow: var(--shadow-sm); }
.mz-form { display: flex; flex-direction: column; gap: 12px; }
.mz-form[hidden] { display: none; }
.mz-form label, .mz-campo { display: flex; flex-direction: column; gap: 5px; font-size: .85rem; font-weight: 600; color: var(--text-dark); }
.mz-form input, .mz-campo input, .mz-campo textarea {
  font: 500 1rem var(--font); padding: 11px 13px; border: 2px solid var(--border); border-radius: var(--radius-sm);
  outline: none; background: #fff; width: 100%; resize: vertical;
}
.mz-form input:focus, .mz-campo input:focus, .mz-campo textarea:focus { border-color: var(--green-light); }
.mz-clave { position: relative; display: block; }
.mz-clave input { padding-right: 44px; }
.mz-ver { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); background: none; color: var(--text-light); padding: 8px; }
.mz-error { background: #fdecea; color: #b42318; border-radius: var(--radius-sm); padding: 9px 12px; font-size: .88rem; font-weight: 600; }
.mz-error[hidden] { display: none; }
.mz-nota { text-align: center; color: var(--text-light); font-size: .8rem; }

.mz-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--green-primary); color: #fff; border-radius: 50px;
  padding: 12px 20px; font-weight: 700; font-size: 1rem; width: 100%;
  transition: background var(--transition), transform var(--transition);
}
.mz-btn:hover { background: var(--green-dark); }
.mz-btn:active { transform: scale(.98); }
.mz-btn[disabled] { opacity: .6; cursor: wait; }
.mz-btn--sec { background: #fff; color: var(--green-primary); border: 2px solid var(--green-primary); width: auto; padding: 9px 18px; font-size: .9rem; }
.mz-btn--sec:hover { background: var(--green-pale); }

/* ── Tienda ── */
.mz-aviso {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  background: #fff8e1; border: 1px solid #f9d77e; color: #6b4e00;
  border-radius: var(--radius); padding: 12px 16px; margin: 16px 0 4px; font-size: .9rem;
}
.mz-aviso[hidden] { display: none; }
.mz-aviso > i { font-size: 1.3rem; color: var(--orange-accent); }
.mz-aviso > div { flex: 1 1 220px; }
.mz-cab { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 18px 0 14px; }
.mz-filtros { display: flex; gap: 10px; flex-wrap: wrap; flex: 1 1 360px; justify-content: flex-end; }
.mz-buscar { position: relative; flex: 1 1 220px; max-width: 360px; }
.mz-buscar > i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-light); }
.mz-buscar input, .mz-filtros select {
  width: 100%; font: 500 .95rem var(--font); padding: 10px 12px 10px 36px;
  border: 2px solid var(--border); border-radius: 50px; outline: none; background: #fff;
}
.mz-filtros select { padding-left: 14px; flex: 0 1 220px; width: auto; }
.mz-estado { color: var(--text-medium); text-align: center; padding: 24px 0; }
.mz-estado:empty { display: none; }
.mz-mas { text-align: center; margin: 22px 0 10px; }
.mz-mas[hidden] { display: none; }

/* Tarjeta: la de la tienda + la unidad al por mayor */
.mz-grid .product-info { padding-bottom: 62px; }
.mz-unidad {
  display: inline-flex; align-items: center; gap: 5px; margin-bottom: 8px;
  background: var(--green-pale); color: var(--green-dark);
  font-size: .76rem; font-weight: 700; padding: 3px 9px; border-radius: 50px;
}
/* 536 · descripción al por mayor (o la normal): gris, como mucho 3 líneas */
.mz-desc {
  font-size: .78rem; line-height: 1.35; color: var(--text-medium); margin: 2px 0 8px;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
/* 537 · detalle del producto: el de la tienda (style.css) + estos ajustes */
.mz-grid .product-card { cursor: pointer; }
.mz-grid .mz-ctl { cursor: default; }
#mzDetalle .car-slide { flex: 0 0 100%; width: 100%; }
#mzDetalle .car-viewport { touch-action: pan-y; }
#mzDetalle .mz-unidad { align-self: flex-start; margin-bottom: 14px; }
#mzDetalle .modal-desc { white-space: pre-line; }
#mzDetalle .mz-sinprecio { font-size: .95rem; }
.mz-det-nota { font-size: .82rem; font-weight: 600; color: var(--green-dark); margin: -8px 0 12px; }
.mz-sinprecio { font-size: .82rem; font-weight: 700; color: var(--orange-accent); }
.mz-grid .product-card .add-cart-btn[disabled] { opacity: .45; cursor: not-allowed; background: #fff; color: var(--text-light); border-color: var(--border); }

/* ── Paneles laterales (carrito y pedidos) ── */
.mz-fondo { position: fixed; inset: 0; background: rgba(15, 30, 20, .45); z-index: 1500; }
.mz-fondo[hidden] { display: none; }
.mz-panel {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(440px, 100%); z-index: 1600;
  background: #fff; display: flex; flex-direction: column; box-shadow: var(--shadow-lg);
}
.mz-panel[hidden] { display: none; }
.mz-panel__cab { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.mz-panel__cab h2 { font-size: 1.1rem; font-weight: 800; color: var(--green-dark); display: flex; gap: 8px; align-items: center; }
.mz-cerrar { background: var(--bg-light); width: 36px; height: 36px; border-radius: 50%; font-size: 1.1rem; color: var(--text-medium); }
.mz-panel__cuerpo { flex: 1; overflow-y: auto; padding: 14px 16px; }
.mz-panel__cuerpo h3 { font-size: .95rem; font-weight: 800; margin: 18px 0 8px; }
.mz-panel__pie { border-top: 1px solid var(--border); padding: 12px 16px calc(14px + env(safe-area-inset-bottom)); }
.mz-panel__pie[hidden] { display: none; }
.mz-vacio { text-align: center; color: var(--text-medium); padding: 40px 10px; }
.mz-vacio i { font-size: 2.4rem; color: var(--border); display: block; margin-bottom: 10px; }
/* 549 · carrito vacío a color (mismo dibujo que la tienda) */
.mz-vacio__ilustracion { display: block; width: 180px; max-width: 70%; height: auto; margin: 0 auto 6px; }
.mz-vacio__tit { display: block; font-size: 1.15rem; font-weight: 800; color: var(--red-accent); margin-bottom: 4px; }

.mz-linea { display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid #eef2ee; }
.mz-linea img { width: 52px; height: 52px; object-fit: contain; border-radius: 8px; background: #f6f8f6; }
.mz-linea__nom { font-weight: 700; font-size: .88rem; line-height: 1.3; }
.mz-linea__det { font-size: .78rem; color: var(--text-medium); }
.mz-linea__der { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.mz-linea__sub { font-weight: 800; color: var(--green-primary); font-size: .9rem; white-space: nowrap; }
.mz-paso { display: inline-flex; align-items: center; gap: 4px; background: var(--green-pale); border-radius: 50px; padding: 2px; }
.mz-paso button { width: 28px; height: 28px; border-radius: 50%; background: #fff; color: var(--green-primary); font-size: .8rem; }
.mz-paso input { width: 44px; text-align: center; border: 0; background: transparent; font: 800 .95rem var(--font); -moz-appearance: textfield; }
.mz-paso input::-webkit-outer-spin-button, .mz-paso input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.mz-opcion { display: flex; gap: 10px; align-items: flex-start; border: 2px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; margin-bottom: 8px; cursor: pointer; }
.mz-opcion:has(input:checked) { border-color: var(--green-primary); background: var(--green-pale); }
.mz-opcion input { margin-top: 4px; accent-color: var(--green-primary); }
.mz-opcion span { display: flex; flex-direction: column; font-size: .9rem; }
.mz-opcion small { color: var(--text-medium); font-size: .8rem; }
.mz-campo { margin-top: 10px; }
#campoDireccion[hidden] { display: none; }

.mz-fila { display: flex; justify-content: space-between; font-size: .92rem; padding: 2px 0; }
.mz-fila--total { font-size: 1.12rem; font-weight: 800; color: var(--green-dark); border-top: 1px dashed var(--border); margin-top: 4px; padding-top: 6px; }
.mz-panel__pie .mz-error { margin: 8px 0 0; }
.mz-panel__pie .mz-btn { margin-top: 10px; }

/* Mis pedidos */
.mz-ped { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; margin-bottom: 10px; }
.mz-ped__cab { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.mz-ped__num { font-weight: 800; }
.mz-ped__fecha { font-size: .78rem; color: var(--text-light); }
.mz-ped__det { font-size: .82rem; color: var(--text-medium); margin: 6px 0; }
.mz-ped__tot { font-weight: 800; color: var(--green-primary); }
.mz-est { font-size: .72rem; font-weight: 800; padding: 3px 9px; border-radius: 50px; text-transform: uppercase; letter-spacing: .3px; white-space: nowrap; }
.mz-est--pendiente  { background: #fff3cd; color: #8a6100; }
.mz-est--procesando { background: #e3f2fd; color: #0d47a1; }
.mz-est--enviado    { background: #ede7f6; color: #4527a0; }
.mz-est--entregado  { background: var(--green-pale); color: var(--green-dark); }
.mz-est--cancelado  { background: #fdecea; color: #b42318; }

.mz-toast {
  position: fixed; left: 50%; bottom: calc(22px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  z-index: 2000; background: var(--text-dark); color: #fff; padding: 12px 18px; border-radius: 50px;
  font-weight: 600; font-size: .9rem; box-shadow: var(--shadow-lg); max-width: calc(100% - 32px); text-align: center;
}
.mz-toast[hidden] { display: none; }

@media (max-width: 600px) {
  body.mayor { padding-top: 62px; }
  html.es-app-nativa body.mayor { padding-top: calc(62px + env(safe-area-inset-top, 0px)); }
  body.mayor .header-main-inner { gap: 6px; padding-left: 10px; padding-right: 10px; }
  body.mayor .logo-img { height: 40px; }
  /* 538 · en el móvil la insignia queda solo con el icono para que quepa la barra */
  .mz-badge { padding: 7px 8px; font-size: 0; gap: 0; }
  .mz-badge i { font-size: .9rem; }
  body.mayor .header-actions { flex: 1 1 0; min-width: 0; justify-content: flex-end; gap: 0; }
  body.mayor .header-actions .action-btn { padding: 6px 4px; min-width: 0; flex-shrink: 0; }
  body.mayor .header-actions .action-btn > span:not(.favorites-badge):not(.cart-badge) { white-space: nowrap; }
  body.mayor .client-greeting { min-width: 0; flex-shrink: 1; gap: 6px; padding: 4px 8px 4px 5px; margin-right: 2px; }
  body.mayor .client-greeting-text { min-width: 0; }
  body.mayor .client-name, body.mayor .client-hello { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .mz-filtros select { flex: 1 1 100%; }
  .mz-buscar { max-width: none; }
}
/* 538 · Teléfonos estrechos: la insignia se oculta para que quepa el saludo
   (la tienda tampoco la tiene; la página sigue diciendo «Mayoristas» en el título). */
@media (max-width: 429px) {
  body.mayor .mz-badge { display: none; }
}
@media (max-width: 360px) {
  body.mayor .logo-img { height: 34px; }
}
