/* ============================================================
   Portal de pedidos Mondel — estilos
   Mobile first. Los tokens de color viven en :root y se
   redefinen para el tema oscuro del sistema.
   ============================================================ */
:root {
  --ink: #152534; --ink-2: #44586b; --ink-3: #7b8d9d;
  --ground: #eef1f3; --surface: #ffffff; --line: #d9e0e6;
  --accent: #b8761c; --accent-soft: #f6ecd9;
  --brand: #152534; --on-brand: #ffffff;
  --ok: #2e7d4f; --ok-soft: #e3f2e9; --warn: #b4532a; --bad: #b3261e; --bad-soft: #fbe9e7;
  --shadow: 0 1px 2px rgba(21,37,52,.06), 0 8px 20px rgba(21,37,52,.05);
  --r: 10px;
  --nav-inf: 62px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --ink: #e8edf1; --ink-2: #a6b6c3; --ink-3: #74879a;
    --ground: #101820; --surface: #18232e; --line: #2a3a48;
    --accent: #e0a34a; --accent-soft: #2a2115;
    --brand: #e8edf1; --on-brand: #101820;
    --ok: #5cba84; --ok-soft: #14301f; --warn: #e08a5e; --bad: #f28b82; --bad-soft: #3a1f1c;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 20px rgba(0,0,0,.25);
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { height: 100%; }
/* body crece con el contenido (min-height, no height): si tuviera altura fija,
   la cabecera sticky dejaría de pegarse en cuanto el scroll pasara de una pantalla. */
body {
  margin: 0; background: var(--ground); color: var(--ink);
  font-family: "IBM Plex Sans", system-ui, -apple-system, sans-serif;
  font-size: 15px; line-height: 1.45; -webkit-font-smoothing: antialiased;
  padding-top: env(safe-area-inset-top, 0px);
  display: flex; flex-direction: column; min-height: 100%;
}
main { flex: 1; }
a { color: inherit; }
h1 { font-family: Newsreader, Georgia, serif; font-weight: 600; font-size: 26px; line-height: 1.15; margin: 0 0 6px; text-wrap: balance; }
code { font-family: "IBM Plex Mono", ui-monospace, monospace; font-size: .92em; }
.muted { color: var(--ink-3); }
.small { font-size: 12.5px; }
.eyebrow { font-size: 11.5px; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 4px; }
.wordmark { font-family: Newsreader, Georgia, serif; font-weight: 600; font-size: 22px; letter-spacing: .10em; text-transform: uppercase; color: var(--brand); text-decoration: none; line-height: 1; }
.pill { display: inline-block; font-size: 10px; letter-spacing: .06em; text-transform: uppercase; padding: 2px 7px; border-radius: 999px; background: var(--accent-soft); color: var(--warn); font-weight: 600; margin-left: 6px; vertical-align: middle; }

/* ---------- Botones y formularios ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid transparent; border-radius: 8px; padding: 11px 18px; font: inherit; font-weight: 600; font-size: 14px; cursor: pointer; text-decoration: none; }
.btn-primario { background: var(--brand); color: var(--on-brand); }
.btn-secundario { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn:focus-visible, input:focus-visible, .chip:focus-visible, .fav:focus-visible, .dropzone:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
label { display: block; font-size: 13px; font-weight: 500; color: var(--ink-2); margin: 14px 0 6px; }
input[type=email], input[type=password], input[type=search], input[type=text] {
  width: 100%; padding: 11px 13px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--ground); color: var(--ink); font: inherit; font-size: 15px;
}
input:focus { background: var(--surface); }
.error { background: var(--bad-soft); color: var(--bad); border-radius: 8px; padding: 10px 12px; font-size: 13.5px; margin-top: 14px; }

/* ---------- Acceso ---------- */
.login { max-width: 420px; margin: 0 auto; padding: 48px 16px 32px; }
.login-marca { text-align: center; margin-bottom: 26px; }
.login-marca .wordmark { font-size: 30px; }
.login-sub { font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); margin-top: 6px; }
.login-card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 24px 20px; box-shadow: var(--shadow); }
.login-card h1 { font-size: 24px; }
.login-card .btn { width: 100%; margin-top: 18px; }
.login-enlaces { display: flex; flex-direction: column; gap: 8px; margin-top: 18px; font-size: 13.5px; }
.login-enlaces a { color: var(--ink-2); }
.login-pie { text-align: center; font-size: 12px; margin-top: 22px; }

/* ---------- Cascarón ---------- */
/* El contenedor entero es el que se pega arriba: un sticky solo se mantiene
   mientras su padre siga en pantalla, y #shell abarca toda la página. */
#shell { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; }
.cab { background: var(--surface); border-bottom: 1px solid var(--line); }
.cab-in { max-width: 1080px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 16px; }
.nav-sup { display: none; gap: 4px; margin-left: 12px; }
.nav-sup a { text-decoration: none; padding: 7px 12px; border-radius: 8px; font-size: 14px; color: var(--ink-2); }
.nav-sup a.activo { background: var(--ground); color: var(--ink); font-weight: 600; }
.quien { margin-left: auto; text-align: right; line-height: 1.2; min-width: 0; }
.quien-nombre { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 42vw; }
.quien-rol { font-size: 11px; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-3); }
.btn-salir { display: inline-flex; width: 36px; height: 36px; align-items: center; justify-content: center; border-radius: 8px; color: var(--ink-3); border: 1px solid var(--line); flex: 0 0 auto; }
.btn-salir svg { width: 18px; height: 18px; }
.nav-inf { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom, 0px); }
.nav-inf a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 9px 4px 8px; text-decoration: none; color: var(--ink-3); font-size: 11px; font-weight: 500; }
.nav-inf a.activo { color: var(--brand); }
.nav-inf svg { width: 22px; height: 22px; }
main { padding-bottom: calc(var(--nav-inf) + env(safe-area-inset-bottom, 0px)); }
@media (min-width: 760px) {
  .nav-sup { display: flex; }
  .nav-inf { display: none; }
  main { padding-bottom: 24px; }
  .quien-nombre { max-width: none; }
}
.pie { text-align: center; font-size: 11px; color: var(--ink-3); padding: 14px 16px calc(14px + var(--nav-inf)); }
@media (min-width: 760px) { .pie { padding-bottom: 14px; } }

/* ---------- Páginas ---------- */
.pagina { max-width: 1080px; margin: 0 auto; padding: 20px 16px; }
.pagina-cab { margin-bottom: 18px; }
.accesos { display: grid; gap: 10px; grid-template-columns: 1fr; }
@media (min-width: 560px) { .accesos { grid-template-columns: 1fr 1fr; } }
@media (min-width: 900px) { .accesos { grid-template-columns: repeat(3, 1fr); } }
.acceso { display: flex; gap: 14px; align-items: flex-start; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; text-decoration: none; box-shadow: var(--shadow); }
.acceso svg { width: 26px; height: 26px; color: var(--accent); flex: 0 0 auto; margin-top: 2px; }
.acceso-titulo { font-weight: 600; font-size: 15px; }
.acceso-texto { font-size: 13px; color: var(--ink-2); margin-top: 2px; }
.acceso-prox { opacity: .6; pointer-events: none; }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 22px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; }
.tile-v { font-family: Newsreader, Georgia, serif; font-size: 30px; font-weight: 600; line-height: 1; font-variant-numeric: tabular-nums; }
.tile-l { font-size: 12px; color: var(--ink-3); margin-top: 4px; }

/* ---------- Catálogo ---------- */
.cat-cab { position: sticky; top: calc(57px + env(safe-area-inset-top, 0px)); z-index: 15; background: var(--surface); border-bottom: 1px solid var(--line); padding: 10px 16px 0; }
.cat-cab > * { max-width: 1080px; margin-left: auto; margin-right: auto; }
.buscar { position: relative; }
.buscar input { padding-left: 38px; }
.buscar svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--ink-3); }
.chips { display: flex; gap: 6px; overflow-x: auto; padding: 10px 0 10px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: 0 0 auto; padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; background: transparent; color: var(--ink-2); font: inherit; font-size: 13px; cursor: pointer; white-space: nowrap; }
.chip[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: var(--on-brand); font-weight: 500; }
.chip .n { opacity: .6; margin-left: 5px; font-variant-numeric: tabular-nums; }
.cat-cuenta { font-size: 12.5px; color: var(--ink-3); margin-bottom: 12px; }
.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (min-width: 620px) { .grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 900px) { .grid { grid-template-columns: repeat(4, 1fr); } }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; display: flex; flex-direction: column; box-shadow: var(--shadow); }
.card.on { border-color: var(--accent); }
.card-off { opacity: .55; }
.ph { position: relative; aspect-ratio: 1; background: #fff; display: flex; align-items: center; justify-content: center; }
.ph img { width: 100%; height: 100%; object-fit: contain; display: block; }
.sin-img-in { display: none; flex-direction: column; align-items: center; justify-content: center; gap: 6px; width: 100%; height: 100%; background: repeating-linear-gradient(135deg, var(--ground) 0 8px, var(--surface) 8px 16px); color: var(--ink-3); }
.sin-img-in svg { width: 26px; height: 26px; opacity: .45; }
.sin-img-in span { font-family: "IBM Plex Mono", ui-monospace, monospace; font-size: 10px; letter-spacing: .04em; }
.ph.sin-img .sin-img-in { display: flex; }
.tag { position: absolute; top: 7px; left: 7px; font-size: 9.5px; letter-spacing: .06em; text-transform: uppercase; padding: 3px 6px; border-radius: 4px; font-weight: 600; }
.tag-gen { background: var(--accent-soft); color: var(--warn); }
.tag-none { background: var(--ground); color: var(--ink-3); border: 1px solid var(--line); }
.tag-off { background: var(--bad-soft); color: var(--bad); top: auto; bottom: 7px; }
.fav { position: absolute; top: 4px; right: 4px; width: 34px; height: 34px; border: 0; background: transparent; color: var(--line); font-size: 22px; line-height: 1; cursor: pointer; border-radius: 50%; }
.fav:hover { color: var(--accent); }
.fav-on { color: var(--accent); }
.body { padding: 10px 11px 11px; display: flex; flex-direction: column; gap: 5px; flex: 1; }
.sku { font-family: "IBM Plex Mono", ui-monospace, monospace; font-size: 10.5px; color: var(--ink-3); letter-spacing: .02em; }
.nm { font-size: 13.5px; font-weight: 500; line-height: 1.3; text-wrap: balance; }
.meta { font-size: 12px; color: var(--ink-2); margin-top: auto; padding-top: 4px; }
.meta b { font-weight: 600; color: var(--ink); }
.step { display: flex; align-items: center; margin-top: 8px; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--ground); }
.step button { flex: 0 0 38px; height: 36px; border: 0; background: transparent; color: var(--ink-2); font: inherit; font-size: 19px; line-height: 1; cursor: pointer; }
.step button:hover { background: var(--line); color: var(--ink); }
.step input { flex: 1; min-width: 0; width: 100%; border: 0; background: transparent; text-align: center; font: inherit; font-size: 14px; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; -moz-appearance: textfield; padding: 0; }
.step input::-webkit-outer-spin-button, .step input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.card.on .step { background: var(--accent-soft); border-color: var(--accent); }
.vacio { padding: 50px 16px; text-align: center; color: var(--ink-3); }
.barra { position: fixed; left: 0; right: 0; bottom: calc(var(--nav-inf) + env(safe-area-inset-bottom, 0px)); z-index: 25; background: var(--surface); border-top: 1px solid var(--line); padding: 10px 16px; box-shadow: 0 -4px 20px rgba(21,37,52,.07); }
@media (min-width: 760px) { .barra { bottom: 0; padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px)); } }
.barra-in { max-width: 1080px; margin: 0 auto; display: flex; align-items: center; gap: 14px; }
.barra-sum { flex: 1; min-width: 0; }
.barra-sum .l { font-size: 11px; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-3); }
.barra-sum .v { font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }
.barra-sum .eta { font-size: 11.5px; color: var(--ink-3); margin-top: 2px; }
.catalogo .pagina { padding-bottom: 96px; }

/* ---------- Admin: fotos ---------- */
.dropzone { border: 2px dashed var(--line); border-radius: 14px; padding: 28px 18px; text-align: center; background: var(--surface); cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.dropzone svg { width: 30px; height: 30px; color: var(--accent); }
.dropzone.sobre { border-color: var(--accent); background: var(--accent-soft); }
.cola-cab { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 20px 0 12px; }
.cola-acciones { margin-left: auto; display: flex; gap: 8px; }
.cola-lista { display: flex; flex-direction: column; gap: 8px; }
.cola-item { display: grid; grid-template-columns: 56px 1fr auto; gap: 12px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 8px 12px 8px 8px; }
.cola-item.error { border-color: var(--bad); }
.cola-item.ok { border-color: var(--ok); }
.cola-thumb { width: 56px; height: 56px; border-radius: 6px; background: #fff; border: 1px solid var(--line); overflow: hidden; display: flex; align-items: center; justify-content: center; }
.cola-thumb img { width: 100%; height: 100%; object-fit: contain; }
.cola-info { min-width: 0; }
.cola-nombre { font-size: 13.5px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cola-detalle { font-size: 12px; color: var(--ink-3); }
.cola-item.error .cola-detalle { color: var(--bad); }
.cola-estado { font-size: 12px; font-weight: 600; color: var(--ink-3); white-space: nowrap; }
.cola-item.ok .cola-estado { color: var(--ok); }
.cola-item.error .cola-estado { color: var(--bad); }

/* ---------- Avisos ---------- */
#avisos { position: fixed; left: 16px; right: 16px; bottom: calc(var(--nav-inf) + 14px + env(safe-area-inset-bottom, 0px)); z-index: 60; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
@media (min-width: 760px) { #avisos { bottom: 24px; } }
.aviso { background: var(--ink); color: var(--ground); padding: 10px 16px; border-radius: 8px; font-size: 13.5px; max-width: 480px; opacity: 0; transform: translateY(8px); transition: opacity .25s, transform .25s; box-shadow: var(--shadow); }
.aviso.visible { opacity: 1; transform: none; }
.aviso-ok { background: var(--ok); color: #fff; }
.aviso-error { background: var(--bad); color: #fff; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
