/* ==========================================================================
   centurion — estilos base (mobile-first).
   Los colores salen del tema del sitio (variables inyectadas en <head>);
   todo lo que se deriva de ellos (sombras, tintes, radios) se define acá.
   ========================================================================== */

:root {
  /* Fallbacks: si el tema no las define, mandan estas. */
  --bg: #f6f6f7; --surface: #fff; --text: #191a1e; --muted: #71717a;
  --primary: #e8590c; --primary-contrast: #fff; --accent: #1f2937;
  --border: #e4e4e7; --radius: 14px;

  /* Derivadas (ningún tema las pisa). Cada una lleva primero un valor plano
     y después el color-mix: el navegador que no lo entienda se queda con el plano. */
  --radius-sm: 10px;
  --radius-lg: 22px;
  --shadow-1: 0 1px 2px rgba(15, 17, 26, .05), 0 1px 3px rgba(15, 17, 26, .04);
  --shadow-2: 0 10px 30px rgba(15, 17, 26, .13), 0 2px 8px rgba(15, 17, 26, .06);
  --shadow-nav: 0 -1px 14px rgba(15, 17, 26, .10);
  --tint: rgba(128, 128, 128, .08);
  --tint: color-mix(in srgb, var(--primary) 9%, transparent);
  --tint-strong: rgba(128, 128, 128, .16);
  --tint-strong: color-mix(in srgb, var(--primary) 18%, transparent);
}

*, *::before, *::after { box-sizing: border-box; }
/* Cualquier `display` de autor le gana al `[hidden]{display:none}` del navegador (misma
   especificidad, hoja de autor después). Sin esto, todo lo que el JS oculta con el atributo
   `hidden` —los botones "Aplicar", las flechas del carrusel, el form del carrito— se sigue
   viendo apenas su clase declara un display. */
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: var(--primary); }
h1, h2, h3, h4 { line-height: 1.22; letter-spacing: -.015em; }
h1 { font-size: 1.55rem; font-weight: 800; }
h2 { font-size: 1.2rem; font-weight: 700; }
h3 { font-size: 1rem; font-weight: 700; }
hr { border: 0; border-top: 1px solid var(--border); margin: 22px 0; }
code { background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 1px 5px; }

.container { max-width: 1080px; margin: 0 auto; padding: 16px 16px 48px; }
.container.narrow { max-width: 520px; }
.container.mid { max-width: 820px; }
.muted { color: var(--muted); }
/* Solo para lectores de pantalla. */
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.small { font-size: .85rem; }
.center { text-align: center; }

/* Ícono inline (partials/icon.ejs): hereda color y tamaño del contexto.
   pointer-events:none para que un click sobre el dibujo lo reciba el botón que lo contiene
   (si no, e.target es un <path> y los handlers que miran el botón se pierden el click). */
.ic { width: 1em; height: 1em; display: inline-block; vertical-align: -.14em; flex: 0 0 auto; pointer-events: none; }

/* ---------- Estado vacío ---------- */
.empty {
  text-align: center; color: var(--muted);
  padding: 56px 20px; margin: 0;
  display: flex; flex-direction: column; align-items: center; gap: 14px;
}
.empty .ic { width: 44px; height: 44px; opacity: .4; }
.empty p { margin: 0; font-size: 1rem; }

/* ==========================================================================
   Header público
   ========================================================================== */
/* ⚠️ Nada de `backdrop-filter`/`filter`/`transform` acá: cualquiera de los tres convierte al
   header en bloque contenedor de sus hijos `position: fixed`, y la barra de pestañas del
   celular (.topnav) es justamente eso — con el efecto puesto, en vez de irse al pie del
   teléfono se cuelga del header y le tapa la marca. Además el desenfoque cuesta caro en los
   celulares baratos, que es con lo que compra este público. */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 10px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.brand {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none; color: var(--text);
  font-weight: 800; font-size: 1.15rem; letter-spacing: -.02em;
  min-width: 0; padding: 2px 0;
}
.brand img { max-height: 44px; width: auto; object-fit: contain; }
.brand span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topactions { display: flex; align-items: center; gap: 10px; }

.langbtn {
  display: inline-flex; align-items: center; gap: 5px;
  text-decoration: none; font-size: .78rem; font-weight: 700; color: var(--muted);
  border: 1px solid var(--border); border-radius: 999px; padding: 6px 11px;
  transition: color .15s, border-color .15s;
}
.langbtn:hover { color: var(--text); border-color: var(--muted); }

/* Navegación con ícono + etiqueta: en desktop vive en el header y en el celular
   baja a una barra de pestañas fija abajo (el patrón que ya conocen de las apps). */
.topnav { display: flex; align-items: stretch; gap: 2px; }
.navitem {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  min-width: 64px; padding: 6px 10px;
  text-decoration: none; color: var(--muted);
  font-size: .69rem; font-weight: 700; line-height: 1;
  border-radius: 12px;
  transition: color .15s, background .15s;
}
.navitem .ic { width: 22px; height: 22px; }
.navitem:hover { color: var(--text); background: var(--bg); }
.navitem.on { color: var(--primary); background: var(--tint); }
.navitem.cta { color: var(--primary-contrast); background: var(--primary); }
.navitem.cta:hover { color: var(--primary-contrast); background: var(--primary); filter: brightness(1.07); }
.navicon { position: relative; display: flex; }
.cartcount {
  position: absolute; top: -7px; right: -10px;
  background: var(--primary); color: var(--primary-contrast);
  border: 2px solid var(--surface);
  border-radius: 999px; font-size: .64rem; font-weight: 800;
  min-width: 19px; height: 19px; line-height: 15px; text-align: center; padding: 0 3px;
}
.navitem.cta .cartcount { background: var(--primary-contrast); color: var(--primary); }

@media (min-width: 761px) {
  .topbar { padding: 12px 26px; }
  .brand { font-size: 1.3rem; }
  .brand img { max-height: 56px; }
  .navitem { flex-direction: row; gap: 8px; font-size: .84rem; padding: 9px 14px; min-width: 0; }
  .navitem .ic { width: 19px; height: 19px; }
}
@media (max-width: 760px) {
  .topnav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
    display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 0;
    padding: 7px 6px calc(7px + env(safe-area-inset-bottom, 0px));
    background: var(--surface);
    border-top: 1px solid var(--border);
    box-shadow: var(--shadow-nav);
  }
  .navitem { min-width: 0; padding: 5px 2px; border-radius: 10px; }
  .navitem.cta { background: transparent; color: var(--primary); }
  .navitem.cta .cartcount { background: var(--primary); color: var(--primary-contrast); }
}

/* Cotización del real en pesos argentinos (los clientes son minoristas de Argentina).
   Va debajo del header y NO es sticky: en el celular otra barra fija se come la pantalla. */
.ratebar {
  display: flex; align-items: center; justify-content: center; gap: 6px 16px; flex-wrap: wrap;
  padding: 8px 16px;
  background: var(--tint);
  border-bottom: 1px solid var(--border);
  font-size: .82rem; color: var(--muted);
}
.ratebar .rate-v { display: inline-flex; align-items: center; gap: 7px; color: var(--text); font-weight: 600; }
.ratebar .ic { width: 15px; height: 15px; color: var(--primary); }
.ratebar a { color: var(--muted); text-decoration: none; border-bottom: 1px dotted currentColor; }
.ratebar a:hover { color: var(--text); }

/* ==========================================================================
   Botones
   ========================================================================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid transparent; cursor: pointer; text-decoration: none; text-align: center;
  background: var(--primary); color: var(--primary-contrast);
  font-family: inherit; font-weight: 700; font-size: .93rem; line-height: 1.2;
  padding: 11px 18px; border-radius: var(--radius-sm);
  transition: filter .15s, transform .08s, background .15s, color .15s, border-color .15s;
}
.btn:hover { filter: brightness(1.07); }
.btn:active { transform: scale(.98); }
.btn .ic { width: 17px; height: 17px; }
.btn.small { padding: 8px 13px; font-size: .84rem; border-radius: 9px; }
.btn.small .ic { width: 15px; height: 15px; }
.btn.big { width: 100%; padding: 15px; font-size: 1.02rem; }
.btn.ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn.ghost:hover { background: var(--surface); border-color: var(--muted); filter: none; }
.btn.danger { background: #dc2626; color: #fff; }
.btn.wa { background: #25d366; color: #05391c; }
.btn[disabled] { opacity: .55; cursor: wait; }
.linkbtn {
  background: none; border: 0; color: var(--muted); cursor: pointer;
  font-family: inherit; font-size: .88rem; text-decoration: underline; padding: 4px;
}
.linkbtn:hover { color: var(--text); }

/* ==========================================================================
   Catálogo: encabezado, chips, filtros y grilla
   ========================================================================== */
.catalogo { max-width: 1320px; }

.cathead {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 14px;
  flex-wrap: wrap; padding: 6px 0 16px;
}
.cathead h1 { margin: 0 0 2px; }
.cat-count { color: var(--muted); font-size: .9rem; font-weight: 600; }
.cathead-tools { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.sortform { display: flex; align-items: center; gap: 8px; }
.sortlabel {
  display: inline-flex; align-items: center; gap: 8px; margin: 0;
  white-space: nowrap; color: var(--muted); font-size: .84rem; font-weight: 600;
}
.sortlabel select {
  width: auto; margin-top: 0; padding: 9px 11px;
  background: var(--surface); border-radius: var(--radius-sm); font-weight: 600; font-size: .86rem;
}
/* En el celular el "Ordenar por" no entra al lado del botón de filtros: manda el select. */
@media (max-width: 560px) { .sortlabel > span { display: none; } }

/* Chips de categoría: el filtro más usado, siempre a un toque en el celular
   (en desktop ya está la columna de filtros al costado). */
.chips {
  display: none; gap: 8px; overflow-x: auto; padding: 2px 0 16px;
  -webkit-overflow-scrolling: touch; scrollbar-width: none;
  margin: 0 -16px; padding-left: 16px; padding-right: 16px;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  white-space: nowrap; text-decoration: none; font-size: .87rem; font-weight: 650;
  color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: 999px; padding: 8px 15px;
  transition: background .15s, border-color .15s, color .15s;
}
.chip .n { color: var(--muted); font-weight: 600; font-size: .8em; margin-left: 3px; }
.chip.on { background: var(--primary); color: var(--primary-contrast); border-color: var(--primary); }
.chip.on .n { color: inherit; opacity: .75; }
@media (max-width: 900px) { .chips { display: flex; } }
/* En el painel no hay columna de filtros al costado: los chips son el filtro, también en la PC. */
.chips.always { display: flex; flex-wrap: wrap; overflow: visible; margin: 0; padding: 2px 0 16px; }

/* Filtros activos, como pastillas con × (así se ve y se deshace de un toque) */
.activefilters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding-bottom: 14px; }
.fpill {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--tint); color: var(--text);
  border: 1px solid var(--border); border-radius: 999px;
  padding: 5px 11px; font-size: .82rem; font-weight: 650; text-decoration: none;
}
.fpill .ic { width: 13px; height: 13px; opacity: .6; }
.fpill:hover { border-color: var(--muted); }
.fpill.clear { background: transparent; color: var(--muted); }

.cat-layout { display: grid; grid-template-columns: 236px 1fr; gap: 32px; align-items: start; }

.filters { position: sticky; top: 84px; max-height: calc(100vh - 104px); overflow-y: auto; padding-right: 4px; }
.filters-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.filters-head h2 { margin: 0; font-size: 1.02rem; }
.filters-close { display: none; background: none; border: 0; cursor: pointer; color: var(--text); padding: 4px; }
.filters-close .ic { width: 20px; height: 20px; }
.limparlink { display: inline-flex; align-items: center; gap: 5px; font-size: .82rem; font-weight: 650; text-decoration: none; }
.limparlink .ic { width: 13px; height: 13px; }

.fgroup { border-top: 1px solid var(--border); padding: 16px 0; }
.fgroup h3 {
  margin: 0 0 10px; font-size: .74rem; font-weight: 800;
  text-transform: uppercase; letter-spacing: .09em; color: var(--muted);
}
.flist { display: flex; flex-direction: column; gap: 1px; }
.flist a {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  text-decoration: none; color: var(--text); font-size: .91rem;
  padding: 7px 10px; border-radius: 9px;
  transition: background .12s;
}
.flist a:hover { background: var(--surface); }
.flist a.on { font-weight: 800; background: var(--tint); box-shadow: inset 3px 0 0 var(--primary); }
.fcount { color: var(--muted); font-size: .76rem; font-weight: 600; }
.fcheck {
  display: flex; align-items: center; gap: 10px; font-weight: 400; color: var(--text);
  font-size: .91rem; margin: 0; padding: 7px 10px; border-radius: 9px; cursor: pointer;
}
.fcheck:hover { background: var(--surface); }
.fcheck input[type="checkbox"] { width: auto; margin: 0; flex: 0 0 auto; accent-color: var(--primary); }
.fcheck span:first-of-type { flex: 1; }

.btn-filters { display: none; }
.backdrop { position: fixed; inset: 0; z-index: 110; background: rgba(0, 0, 0, .5); }

@media (max-width: 900px) {
  .cat-layout { grid-template-columns: 1fr; gap: 0; }
  .btn-filters { display: inline-flex; }
  .filters {
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 120;
    width: min(330px, 88vw); max-height: none;
    background: var(--bg); border-right: 1px solid var(--border);
    padding: 18px; overflow-y: auto;
    transform: translateX(-105%); transition: transform .28s cubic-bezier(.2, .8, .2, 1);
    box-shadow: 0 0 44px rgba(0, 0, 0, .28);
  }
  .filters.open { transform: none; }
  .filters-close { display: block; }
  .cathead { align-items: center; }
  .cathead h1 { font-size: 1.3rem; }
}

/* ---------- Grilla de productos ---------- */
.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (min-width: 640px) { .grid { grid-template-columns: repeat(3, 1fr); gap: 18px; } }
@media (min-width: 1100px) { .grid { grid-template-columns: repeat(4, 1fr); } }

.card {
  position: relative;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-1);
  transition: box-shadow .2s, transform .2s, border-color .2s;
}
@media (hover: hover) {
  .card:hover { box-shadow: var(--shadow-2); transform: translateY(-3px); border-color: transparent; }
  .card:hover .card-img img { transform: scale(1.05); }
}
.card-img {
  position: relative; display: block; width: 100%; padding: 0; border: 0;
  background: #fff; cursor: zoom-in; overflow: hidden;
}
.card-img img {
  width: 100%; aspect-ratio: 1; object-fit: cover;
  transition: transform .4s cubic-bezier(.2, .8, .2, 1);
}
.imgcount {
  position: absolute; bottom: 8px; right: 8px;
  display: inline-flex; align-items: center; gap: 4px;
  background: rgba(0, 0, 0, .58); color: #fff;
  font-size: .7rem; font-weight: 700; border-radius: 8px; padding: 3px 7px;
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
}
.imgcount .ic { width: 12px; height: 12px; }
.card-out {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255, 255, 255, .62);
  -webkit-backdrop-filter: saturate(.25); backdrop-filter: saturate(.25);
}
.card-out span {
  background: #18181b; color: #fff;
  font-size: .72rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase;
  border-radius: 999px; padding: 6px 14px;
}
.card-body { padding: 13px 13px 14px; display: flex; flex-direction: column; gap: 5px; flex: 1; }
.cardmeta {
  color: var(--muted); font-size: .7rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .07em;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.card-body h3 { margin: 0; font-size: .96rem; font-weight: 700; }
.grade { color: var(--muted); font-size: .8rem; }
.card-foot { margin-top: auto; padding-top: 10px; display: flex; flex-direction: column; gap: 9px; }
.price { font-size: 1.22rem; font-weight: 800; letter-spacing: -.02em; }
.badge.out {
  align-self: flex-start; background: var(--border); color: var(--muted);
  font-size: .74rem; font-weight: 700; border-radius: 8px; padding: 4px 9px;
}
.locked {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: .84rem; font-weight: 700; text-decoration: none;
  color: var(--text); background: var(--tint);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 9px 12px; justify-content: center;
}
.locked .ic { width: 15px; height: 15px; color: var(--primary); }
.locked:hover { border-color: var(--primary); }
.btn.add { width: 100%; }

/* ---------- Modal de producto ---------- */
.modal[hidden] { display: none; }
.modal {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(10, 11, 15, .66);
  -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
  display: flex; align-items: flex-end; justify-content: center;
}
@media (min-width: 640px) { .modal { align-items: center; padding: 24px; } }
.pm-box {
  background: var(--surface); width: 100%; max-width: 560px; max-height: 92vh;
  overflow-y: auto; border-radius: var(--radius-lg) var(--radius-lg) 0 0; position: relative;
  box-shadow: var(--shadow-2);
}
@media (min-width: 640px) { .pm-box { border-radius: var(--radius-lg); } }
@media (min-width: 900px) {
  .pm-box { max-width: 920px; display: grid; grid-template-columns: 1.05fr .95fr; max-height: 86vh; }
  .pm-media { border-right: 1px solid var(--border); }
  .pm-info { align-content: start; overflow-y: auto; }
}
.pm-close {
  position: absolute; top: 10px; right: 10px; z-index: 3;
  background: rgba(0, 0, 0, .5); color: #fff; border: 0; border-radius: 999px;
  width: 36px; height: 36px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.pm-close .ic { width: 18px; height: 18px; }
.pm-imgwrap { position: relative; background: #fff; }
.pm-img { width: 100%; aspect-ratio: 1; max-height: 58vh; object-fit: contain; }
@media (min-width: 900px) { .pm-img { max-height: none; } }
.pm-prev, .pm-next {
  position: absolute; top: 50%; transform: translateY(-50%);
  background: rgba(0, 0, 0, .42); color: #fff; border: 0; border-radius: 999px;
  width: 40px; height: 40px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.pm-prev .ic, .pm-next .ic { width: 20px; height: 20px; }
.pm-prev { left: 10px; } .pm-next { right: 10px; }
.pm-counter {
  position: absolute; bottom: 10px; right: 12px;
  background: rgba(0, 0, 0, .58); color: #fff;
  font-size: .74rem; font-weight: 700; border-radius: 8px; padding: 3px 9px;
}
.pm-thumbs { display: flex; gap: 8px; overflow-x: auto; padding: 10px 12px; scrollbar-width: none; }
.pm-thumbs::-webkit-scrollbar { display: none; }
.pm-thumbs button {
  flex: 0 0 auto; width: 58px; height: 58px; padding: 0; cursor: pointer;
  background: #fff; border: 2px solid var(--border); border-radius: 10px; overflow: hidden;
}
.pm-thumbs button.on { border-color: var(--primary); }
.pm-thumbs img { width: 100%; height: 100%; object-fit: cover; }
.pm-info { padding: 18px; display: flex; flex-direction: column; gap: 10px; }
.pm-info h2 { margin: 0; font-size: 1.32rem; }
.pm-meta { margin: 0; }
.pm-desc { margin: 0; color: var(--muted); white-space: pre-line; font-size: .92rem; }
.pm-price { font-size: 1.6rem; }
/* Combo de color de la ficha. Va pegado al botón de agregar porque es parte de la misma
   decisión: qué par se lleva. `margin-bottom: 0` porque el `label` global trae 12px. */
.pm-corwrap { margin-bottom: 0; display: flex; flex-direction: column; gap: 5px; }
.pm-cor { width: 100%; }
/* El color agotado se muestra deshabilitado y no escondido: que el modelo venga en cinco
   colores es información de venta. */
.pm-cor option:disabled { color: var(--muted); }
.pm-info .btn { margin-top: 4px; }

/* Botón/link de un solo disparo (data-once, ver public/js/app.js): ya se tocó y está
   navegando. Se apaga a la vista y deja de recibir clicks — sin esto se podía pedir dos veces. */
.is-busy, .is-busy .btn { opacity: .55; pointer-events: none; cursor: default; }

/* El alta en el câmbio va con una línea de ayuda debajo: el botón solo no dice por qué
   aparece justo ahí. */
.ocard-cta { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; text-align: right; }

/* ==========================================================================
   Formularios y tarjetas de contenido
   ========================================================================== */
label { display: block; font-size: .84rem; font-weight: 650; color: var(--muted); margin-bottom: 12px; }
input, select, textarea {
  display: block; width: 100%; margin-top: 5px;
  font: inherit; color: var(--text);
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 11px 13px;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  outline: 0; border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--tint);
}
input[type="file"] { padding: 9px; }
.checkline { display: flex; align-items: center; gap: 9px; font-weight: 650; color: var(--text); margin-bottom: 14px; cursor: pointer; font-size: .9rem; }
.checkline input[type="checkbox"] { display: inline-block; width: auto; margin: 0; flex: 0 0 auto; accent-color: var(--primary); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-items: end; }
.row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; align-items: end; }
@media (max-width: 560px) { .row3 { grid-template-columns: 1fr 1fr; } }
.inline-form { display: inline-flex; gap: 8px; align-items: center; }
.inline-form input, .inline-form select { margin-top: 0; width: auto; }

.authbox {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 22px; margin: 16px 0;
  box-shadow: var(--shadow-1);
}
.authbox h1 { margin-top: 0; }
.authbox.success { text-align: center; display: flex; flex-direction: column; gap: 10px; }
.authbox .sub { margin: -4px 0 18px; color: var(--muted); font-size: .92rem; }
.orderid { font-size: 1.2rem; font-weight: 800; letter-spacing: .5px; }
.authhead { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-bottom: 18px; text-align: center; }
.authhead img { max-height: 64px; width: auto; }
.authhead .ic { width: 34px; height: 34px; color: var(--primary); }

/* ---------- Banners / avisos ---------- */
.banner {
  display: flex; align-items: flex-start; gap: 9px;
  border-radius: var(--radius-sm); padding: 11px 14px; margin: 12px 0; font-size: .9rem;
}
.banner .ic { width: 17px; height: 17px; margin-top: 2px; }
.banner.ok { background: #dcfce7; color: #14532d; border: 1px solid #86efac; }
.banner.err { background: #fee2e2; color: #7f1d1d; border: 1px solid #fca5a5; }
.banner.warn { background: #fef9c3; color: #713f12; border: 1px solid #fde047; }
.errlist { margin: 6px 0 0; padding-left: 18px; }
.errlist li { margin: 2px 0; }

/* ==========================================================================
   Carrito
   ========================================================================== */
.cartrow {
  display: grid; grid-template-columns: 72px 1fr auto; gap: 12px; align-items: center;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 11px; margin-bottom: 10px;
  box-shadow: var(--shadow-1);
}
.cartrow img { width: 72px; height: 72px; object-fit: cover; border-radius: var(--radius-sm); background: #fff; }
.cr-main { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.cr-name { font-weight: 700; font-size: .93rem; }
/* El color elegido. Va resaltado y no en gris como la grade: es lo que distingue dos filas
   del mismo modelo, así que tiene que leerse de un vistazo. */
.cr-cor { font-size: .82rem; font-weight: 650; }
.cr-cor:empty { display: none; }
/* Línea del carrito que se agotó mientras estaba adentro: se ve, pero se ve apagada y no suma
   al total. El pedido la va a descartar igual, así que esconderla sería peor. */
.cartrow.out { opacity: .6; }
.cartrow.out .cr-cor { color: #dc2626; font-weight: 700; }
.cr-grade { color: var(--muted); font-size: .78rem; }
.cr-price { color: var(--muted); font-size: .84rem; }
.cr-qty { display: flex; align-items: center; gap: 2px; background: var(--bg); border: 1px solid var(--border); border-radius: 999px; padding: 3px; }
.cr-qty span { min-width: 26px; text-align: center; font-weight: 700; font-size: .92rem; }
.qbtn {
  width: 30px; height: 30px; border-radius: 999px; border: 0;
  background: transparent; color: var(--text); font-size: 1.15rem; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.qbtn:hover { background: var(--surface); }
.cr-side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.cr-sub { font-weight: 800; font-size: 1rem; }
.cr-del { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 2px; display: flex; }
.cr-del .ic { width: 16px; height: 16px; }
.cr-del:hover { color: #dc2626; }
@media (max-width: 520px) {
  .cartrow { grid-template-columns: 64px 1fr; row-gap: 10px; }
  .cartrow img { width: 64px; height: 64px; }
  .cr-qty { grid-column: 1 / 2; justify-self: start; }
  .cr-side { grid-column: 2 / 3; flex-direction: row; align-items: center; justify-content: flex-end; gap: 12px; }
}
.cartsummary {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; margin-top: 16px; box-shadow: var(--shadow-1);
}
.carttotal {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 1.05rem; font-weight: 650; padding-bottom: 14px; margin-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.carttotal strong { font-size: 1.5rem; font-weight: 800; letter-spacing: -.02em; }
.cart-note { margin: 12px 0 0; text-align: center; color: var(--muted); font-size: .84rem; }

/* ==========================================================================
   Meus pedidos (cliente) y pedidos del painel
   ========================================================================== */
.ocard {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; margin-bottom: 12px; box-shadow: var(--shadow-1);
}
.ocard.new { border-color: var(--primary); box-shadow: 0 0 0 2px var(--tint-strong), var(--shadow-1); }
.ocard-head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.ocard-head strong { font-size: .95rem; letter-spacing: .01em; }
.ocard-cust { margin: 7px 0; font-size: .9rem; }
.ocard.off { opacity: .7; }
.ocard-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.ocard-total { display: flex; flex-direction: column; gap: 1px; }
.ocard-total strong { font-size: 1.15rem; font-weight: 800; letter-spacing: -.02em; }

/* Líneas del pedido (una fila de la pestaña Itens cada una). La cancelada se ve tachada y
   apagada: no suma al total, pero el cliente tiene que ver qué se cayó. */
.oitems {
  list-style: none; margin: 11px 0; padding: 4px 13px;
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.oitems li {
  display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: baseline;
  padding: 8px 0; border-bottom: 1px solid var(--border); font-size: .88rem;
}
.oitems li:last-child { border-bottom: 0; }
.oi-qty { font-weight: 800; color: var(--muted); min-width: 26px; }
.oi-main { display: flex; flex-direction: column; min-width: 0; }
.oi-sub { font-weight: 700; white-space: nowrap; display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.oitems li.cut .oi-main strong, .oitems li.cut .oi-price { text-decoration: line-through; }
.oitems li.cut { opacity: .6; }

.status-pill {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: .71rem; font-weight: 800; border-radius: 999px; padding: 4px 11px;
  text-transform: uppercase; letter-spacing: .06em;
  background: var(--border); color: var(--muted);
}
.status-pill .dot { width: 6px; height: 6px; border-radius: 999px; background: currentColor; }
.st-to_confirm { background: #fef9c3; color: #854d0e; }
.st-confirmed { background: #e0e7ff; color: #3730a3; }
.st-paid { background: #dcfce7; color: #14532d; }
.st-shipped { background: #dbeafe; color: #1e3a8a; }
.st-cancelled { background: #fee2e2; color: #7f1d1d; }

/* ==========================================================================
   Toast
   ========================================================================== */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px);
  display: flex; align-items: center; gap: 8px;
  background: var(--text); color: var(--bg);
  border-radius: 999px; padding: 11px 20px; font-weight: 650; font-size: .9rem;
  box-shadow: var(--shadow-2);
  opacity: 0; pointer-events: none; transition: opacity .22s, transform .22s; z-index: 200;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
@media (max-width: 760px) { .toast { bottom: 88px; } }

/* ==========================================================================
   Footer público
   ========================================================================== */
.footer { background: var(--surface); border-top: 1px solid var(--border); margin-top: 44px; }
.footgrid {
  display: flex; flex-wrap: wrap; gap: 20px; justify-content: space-between; align-items: center;
  padding-top: 26px; padding-bottom: 26px;
}
.footbrand { display: flex; align-items: center; gap: 10px; font-weight: 800; }
.footbrand img { max-height: 40px; width: auto; }
.footcontact { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.footcontact a, .footcontact span {
  display: inline-flex; align-items: center; gap: 7px;
  text-decoration: none; font-weight: 650; font-size: .88rem; color: var(--text);
  background: var(--bg); border: 1px solid var(--border); border-radius: 999px; padding: 7px 13px;
}
.footcontact a:hover { border-color: var(--primary); }
.footcontact .ic { width: 15px; height: 15px; color: var(--primary); }
.copy { color: var(--muted); font-size: .8rem; width: 100%; border-top: 1px solid var(--border); padding-top: 14px; }
/* La barra de pestañas del celular es fija: el footer necesita lugar debajo. */
@media (max-width: 760px) { .footer { margin-bottom: 72px; } }

/* ==========================================================================
   Panel (distribuidor + admin)
   ========================================================================== */
.panelbar {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  background: var(--surface); border-bottom: 1px solid var(--border); padding: 10px 14px;
}
.panelbrand { font-weight: 800; }
.panelbar-right { display: flex; align-items: center; gap: 12px; }
.panelbar-right a { text-decoration: none; }
.sairline { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.panelnav {
  display: flex; gap: 4px; overflow-x: auto; -webkit-overflow-scrolling: touch;
  background: var(--surface); border-bottom: 1px solid var(--border); padding: 0 8px;
  position: sticky; top: 0; z-index: 40; scrollbar-width: none;
}
.panelnav::-webkit-scrollbar { display: none; }
.panelnav a {
  white-space: nowrap; text-decoration: none; color: var(--muted); font-weight: 600; font-size: .9rem;
  padding: 12px 10px; border-bottom: 3px solid transparent;
}
.panelnav a.on { color: var(--text); border-bottom-color: var(--primary); }

.pagehead { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }

.statgrid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 14px 0; }
@media (min-width: 640px) { .statgrid { grid-template-columns: repeat(4, 1fr); } }
.stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 14px; text-align: center; text-decoration: none; color: var(--text);
}
.stat strong { display: block; font-size: 1.6rem; }
.stat span { color: var(--muted); font-size: .8rem; }
.stat.hot { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }

.helpbox { background: var(--surface); border: 1px dashed var(--border); border-radius: 12px; padding: 14px 18px; margin: 16px 0; }
.helpbox h3 { margin-top: 0; }
.helpbox ol { padding-left: 20px; }

.dropzone { position: relative; border: 2px dashed var(--border); border-radius: var(--radius); padding: 28px 16px; text-align: center; background: var(--bg); }
.dropzone.dragover { border-color: var(--primary); background: var(--surface); }
.dropzone input[type="file"] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; margin: 0; }
.dropzone-text { color: var(--muted); font-weight: 600; pointer-events: none; }
.filelist { list-style: none; padding: 0; margin: 10px 0 0; display: flex; flex-direction: column; gap: 6px; }
.filelist li { display: flex; justify-content: space-between; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; font-size: .82rem; }
.filelist li span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.filterbar { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0; }
.filterbar input, .filterbar select { width: auto; flex: 1; min-width: 130px; margin-top: 0; }

.pcard {
  display: grid; grid-template-columns: 110px 1fr; gap: 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 12px; margin-bottom: 10px;
}
@media (max-width: 560px) { .pcard { grid-template-columns: 84px 1fr; } }
.pcard-imgwrap { position: relative; }
.pcard-imgs img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; }
.pid { font-size: .7rem; color: var(--muted); word-break: break-all; margin-top: 4px; }
.warnchip { font-size: .72rem; color: #b45309; font-weight: 700; margin-top: 4px; }
.pcard-main .actions { display: flex; gap: 8px; margin-top: 4px; }

/* Produtos y Rascunhos: lista de fichas plegables (<details>), un producto por fila */
.draftlist { display: flex; flex-direction: column; gap: 10px; }
/* scroll-margin: al volver de guardar (#p-<id>) la ficha no queda debajo del nav pegajoso. */
.draftcard { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; scroll-margin-top: 64px; }
.draftcard[open] { border-color: var(--primary); }
.draftcard .actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 12px; }
/* Excluir a la derecha, lejos de Salvar: son el mismo form y no conviene tocarlo sin querer. */
.draftcard .actions .danger { margin-left: auto; }
.draftcard .actions .pid { margin: 0; }
.drafthead { display: flex; align-items: center; gap: 10px; padding: 10px 12px; cursor: pointer; list-style: none; }
.drafthead::-webkit-details-marker { display: none; }
.drafthead:hover { background: var(--bg); border-radius: 12px; }
.draftthumb { flex: 0 0 auto; width: 52px; height: 52px; object-fit: contain; background: #fff; border-radius: 8px; border: 1px solid var(--border); }
.drafthead-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.drafthead-main strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.draftfalta { color: #b45309; font-weight: 700; }
.drafthead-chev { color: var(--muted); transition: transform .15s; }
.draftcard[open] .drafthead-chev { transform: rotate(180deg); }
.draftbody { padding: 10px 12px 12px; border-top: 1px solid var(--border); }
.draftimgs { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 6px; -webkit-overflow-scrolling: touch; }
.draftimgs img { width: 84px; height: 84px; object-fit: contain; background: #fff; border-radius: 8px; border: 1px solid var(--border); }
.draftimg-item { display: flex; flex-direction: column; align-items: center; gap: 2px; flex: 0 0 auto; width: 84px; }
.draftimg-item .linkbtn { font-size: .68rem; padding: 2px; text-align: center; line-height: 1.2; }
.mainbadge { font-size: .68rem; font-weight: 700; color: var(--primary); }

/* Resumen de la ficha cerrada: categoría · costo → venta · cores · fotos. */
/* Dos renglones como mucho: en el celular la ficha cerrada tiene que seguir siendo una fila.
   Los "·" van solo en la PC: en el celular los datos saltan de renglón y el punto quedaba suelto
   al principio de la línea. */
.pmeta { display: flex; flex-wrap: wrap; column-gap: 12px; max-height: 3em; overflow: hidden; }
.pmeta span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
@media (min-width: 640px) {
  .pmeta { column-gap: 0; }
  .pmeta span + span::before { content: "·"; margin: 0 6px; }
}
/* Status del producto en el resumen */
.pst {
  flex: 0 0 auto; font-size: .68rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em;
  border-radius: 999px; padding: 3px 9px; background: var(--border); color: var(--muted);
}
.pst-ativo { background: #dcfce7; color: #14532d; }
.pst-esgotado, .pst-sem-estoque { background: #fee2e2; color: #7f1d1d; }
.pst-rascunho { background: #fef9c3; color: #854d0e; }
@media (max-width: 420px) { .draftthumb { width: 44px; height: 44px; } }

/* Campos de la ficha (partials/productfields.ejs). Grilla de 6 columnas en el celular y 12 en la
   PC: cada campo ocupa lo que necesita, así entran 3-5 por renglón.
     celular: Marca Modelo / Categoria Preço / Status Gênero Grade / Embalagem Cor / Descrição
     PC:      Marca Modelo Categoria Preço / Status Gênero Grade Embalagem Cor / Descrição */
.pfields { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px 8px; align-items: start; }
.pfields label { margin: 0; font-size: .76rem; min-width: 0; }
.pfields input, .pfields select, .pfields textarea { margin-top: 3px; padding: 8px 9px; font-size: .9rem; }
.pfields textarea { resize: vertical; min-height: 44px; }
.pfields .hint { display: block; margin-top: 3px; font-weight: 500; font-size: .74rem; }
.f-marca, .f-modelo { grid-column: span 3; }
.f-cat { grid-column: span 4; }
.f-preco, .f-status, .f-genero, .f-grade, .f-emb { grid-column: span 2; }
.f-cor { grid-column: span 4; }
.f-desc { grid-column: 1 / -1; }
.pfields.no-status .f-cor { grid-column: span 6; }
@media (max-width: 420px) { .pfields select { padding-left: 6px; padding-right: 2px; font-size: .86rem; } }
@media (min-width: 640px) {
  .pfields { grid-template-columns: repeat(12, minmax(0, 1fr)); }
  .f-marca, .f-cat { grid-column: span 3; }
  .f-modelo { grid-column: span 4; }
  .f-cor { grid-column: span 4; }
  .pfields.no-status .f-cor { grid-column: span 6; }
}

/* Categorias: una fila por categoría, todo en una línea (Nome, Ordem, Status, Produtos, botones).
   En el celular los botones quedan solo con el ícono y la cantidad de produtos se pinta ADENTRO
   del campo Nome, a la derecha, para que la fila entre en 360px. */
.addline { display: flex; gap: 8px; margin: 12px 0 16px; }
.addline input { margin: 0; flex: 1; min-width: 0; }
.catlist { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.catrow {
  /* Anchos fijos salvo el Nome: el encabezado es otra grilla y tiene que caer en las mismas columnas. */
  display: grid; grid-template-columns: minmax(0, 1fr) 76px 116px 70px 104px 104px; gap: 8px; align-items: center;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 8px 10px;
}
.catrow input, .catrow select { margin: 0; padding: 8px 10px; }
.catrow .btn { width: 100%; }
.catrow .btn .ic { width: 15px; height: 15px; }
.catrow.cathdr {
  background: none; border: 0; padding: 0 10px; font-size: .72rem; font-weight: 800;
  text-transform: uppercase; letter-spacing: .06em; color: var(--muted);
}
.cathdr span:nth-child(4) { text-align: center; }
.catcount {
  text-align: center; font-weight: 800; font-size: .84rem;
  background: var(--tint); color: var(--text); border-radius: 999px; padding: 4px 0;
}
.catcount.zero { background: transparent; color: var(--muted); font-weight: 600; }
.catrow .lbl { margin-left: 2px; }
@media (max-width: 600px) {
  .catrow { grid-template-columns: minmax(0, 1fr) 40px 80px 34px 34px; gap: 4px; padding: 5px; }
  .catrow.cathdr { padding: 0 5px; font-size: .62rem; letter-spacing: .02em; }
  .cathdr span:nth-child(2) { text-align: center; }
  .catrow input, .catrow select { font-size: .88rem; }
  .catrow > input[name="nome"] { grid-column: 1; grid-row: 1; padding-right: 36px; }
  .catrow > input[name="ordem"] { grid-column: 2; grid-row: 1; padding: 8px 4px; text-align: center; }
  .catrow > select { grid-column: 3; grid-row: 1; padding: 8px 4px; }
  .catrow > .catcount { grid-column: 1; grid-row: 1; justify-self: end; margin-right: 6px; min-width: 24px; padding: 2px 6px; font-size: .74rem; }
  .catrow > .btn { padding: 8px 0; }
  .catrow > .btn:nth-of-type(1) { grid-column: 4; grid-row: 1; }
  .catrow > .btn:nth-of-type(2) { grid-column: 5; grid-row: 1; }
  .catrow .lbl, .cathdr .catcount-h { display: none; }
}

/* Pedidos del painel: tabla de ítems (una fila de la pestaña Itens cada una). Mientras el pedido
   se puede tocar, cada línea tiene su casilla: la desmarcada se ve tachada y no suma. */
.itable { width: 100%; border-collapse: collapse; margin: 11px 0; font-size: .88rem; }
.itable th {
  text-align: left; font-size: .7rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); padding: 0 8px 6px; border-bottom: 1px solid var(--border);
}
.itable td { padding: 9px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
.itable tr:last-child td { border-bottom: 0; }
.itable .num { text-align: right; white-space: nowrap; }
.itable td.num { font-weight: 700; }
.itable .ic-col { width: 30px; padding-right: 0; }
.itable input[type="checkbox"] { width: 18px; height: 18px; margin: 1px 0 0; accent-color: var(--primary); cursor: pointer; }
.iname { display: flex; flex-direction: column; gap: 1px; margin: 0; font-size: inherit; font-weight: 400; color: var(--text); cursor: pointer; }
span.iname { cursor: default; }
.itable tr.cut td, .itable tr:has(input[name="keep"]:not(:checked)) td { color: var(--muted); }
.itable tr.cut .iname strong, .itable tr.cut td.num,
.itable tr:has(input[name="keep"]:not(:checked)) .iname strong,
.itable tr:has(input[name="keep"]:not(:checked)) td.num { text-decoration: line-through; }
.itable .status-pill { margin-top: 4px; }
.ocard-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.ostatus { margin-top: 10px; flex-wrap: wrap; }
.ostatus select { padding: 7px 10px; }

.rowcard {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 12px 14px; margin-bottom: 8px;
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: center;
}
.rowcard-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.rowcard-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.credbox .btn { margin-top: 8px; margin-right: 8px; }

/* Selector de tema del painel del distribuidor (Configurações) */
.themegrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 10px; margin: 10px 0 16px; }
.themecard { border: 2px solid var(--border); border-radius: 12px; padding: 8px; cursor: pointer; display: block; }
.themecard.on, .themecard:has(input:checked) { border-color: var(--primary); }
.themecard strong { font-size: .82rem; font-weight: 700; }
.themecard input { accent-color: var(--primary); margin-right: 6px; vertical-align: middle; }
.themeprev { display: block; border: 1px solid; border-radius: 8px; padding: 8px; margin-bottom: 8px; }
.themeprev-bar { display: block; border-radius: 6px; padding: 8px; margin-bottom: 8px; }
.themeprev-bar i { display: block; height: 6px; width: 65%; border-radius: 3px; opacity: .75; }
.themeprev-btn { display: inline-block; border-radius: 999px; padding: 4px 12px; font-size: .72rem; font-weight: 800; }
.btn.ghost.danger { background: transparent; color: #dc2626; border-color: #dc2626; }

.swatches { display: flex; gap: 10px; flex-wrap: wrap; margin: 4px 0 14px; }
.swatch { display: inline-flex; align-items: center; gap: 3px; font-size: .75rem; color: var(--muted); }
.swatch i { width: 14px; height: 14px; border-radius: 4px; border: 1px solid var(--border); display: inline-block; }
.logopreview { background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 8px; margin-bottom: 10px; max-height: 80px; width: auto; }
