/* ─────────────────────────────────────────
   TOKENS DE DISEÑO — LEGAJO
   Mismo lenguaje que HonorApp (papel vegetal, hairlines, canto vivo,
   rótulos en caja alta), con el azul de cianotipo reemplazado por ocre.

   El ocre elegido es #8A5A16: 5,40:1 sobre el papel y 5,91:1 con blanco
   encima. Pasa AA para texto de cualquier tamaño, que es lo que hace falta
   porque el acento se usa en rótulos chicos, no solo en bordes.
───────────────────────────────────────── */
:root {
  --canvas:    #F4F5F3;   /* papel vegetal, sesgo verde-gris frío */
  --surface:   #FAFBF9;   /* lámina */
  --surface2:  #EAECE8;   /* campo hundido */
  --surface3:  #DDE0DC;   /* campo hundido 2 */
  --wire:      rgba(22,24,26,0.16);
  --wire2:     rgba(22,24,26,0.08);

  /* Acento único — ocre */
  --ocre:      #8A5A16;
  --ocre2:     #A6700F;
  --ocre-bg:   rgba(138,90,22,0.09);
  --ocre-glow: rgba(138,90,22,0.15);

  /* Verde de plano — se usa para lo que ya está resuelto (envases a comprar) */
  --jade:      #3E6B54;
  --jade-bg:   rgba(62,107,84,0.09);

  /* Grafito, de más oscuro a más claro */
  --tinta:     #16181A;
  --tinta2:    #4A5054;
  --tinta3:    #6A7176;   /* 4,86:1 sobre papel — los rótulos son texto chico
                             en caja alta y tienen que pasar AA */
  --tinta4:    #8C9498;   /* placeholders */

  --revision:  #B3402C;   /* rojo de corrección — solo semántico */

  /* Canto vivo en la estructura; radio mínimo solo en lo que se toca */
  --r-sm: 2px;
  --r:    3px;
  --r-lg: 3px;
  --r-xl: 4px;

  --f-ui:    'IBM Plex Sans', system-ui, -apple-system, sans-serif;
  --f-cond:  'IBM Plex Sans Condensed', 'IBM Plex Sans', system-ui, sans-serif;
  --f-mono:  'DM Mono', ui-monospace, SFMono-Regular, Consolas, monospace;
  --f-marca: 'DM Sans', system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* El atributo hidden tiene que ganarle a cualquier display de clase.
   Sin esto, .modal{display:grid} deja el modal en pantalla aunque el JS
   marque hidden y la X "no funciona". */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--f-ui);
  background: var(--canvas);
  color: var(--tinta);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface3); border-radius: 4px; }

h1, h2, h3 { line-height: 1.2; letter-spacing: -0.01em; font-weight: 600; }
p { margin: 0 0 1em; }
em { font-style: normal; color: var(--ocre); font-weight: 600; }

.contenedor { width: 100%; max-width: 1000px; margin: 0 auto; padding: 0 20px; }
.contenedor--angosto { max-width: 760px; }
.contenedor--centrado { display: flex; justify-content: center; }

.saltar {
  position: absolute; left: -9999px; top: 0; z-index: 300;
  background: var(--tinta); color: var(--canvas); padding: 10px 16px;
}
.saltar:focus { left: 0; }

/* ══════════════════════════════════════
   CABECERA
══════════════════════════════════════ */
.cabecera {
  height: 56px;
  border-bottom: 1px solid var(--wire);
  position: sticky; top: 0; z-index: 200;
  background: rgba(244,245,243,0.94);
  backdrop-filter: saturate(1.4) blur(6px);
}
.cabecera__fila {
  height: 100%;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.marca {
  font-family: var(--f-marca);
  font-weight: 800; font-size: 19px; letter-spacing: -0.4px;
  text-transform: uppercase; line-height: 1;
  display: inline-flex; align-items: center; gap: 1px;
  color: var(--tinta);
}
.marca__acento {
  color: var(--surface);
  background: var(--ocre);
  padding: 1px 6px 2px 5px;
  border-radius: var(--r-xl);
  margin-left: 2px;
}
.cabecera__nota {
  font-family: var(--f-cond);
  font-size: 11px; font-weight: 500; letter-spacing: .06em;
  text-transform: uppercase; color: var(--tinta3);
}

/* ══════════════════════════════════════
   LA HERRAMIENTA
══════════════════════════════════════ */
.herramienta { padding: 4px 0 6px; }

/* Rotulo de legajo sobre el titulo: da pie a la caja y evita que el H1
   arranque flotando contra el borde del papel. */
.herramienta__rotulo {
  font-family: var(--f-cond);
  font-size: 10.5px; font-weight: 600; letter-spacing: .16em;
  text-transform: uppercase; color: var(--ocre);
  margin: 0 0 8px; padding-left: 11px; position: relative;
}
.herramienta__rotulo::before {
  content: ""; position: absolute; left: 0; top: 50%;
  width: 4px; height: 4px; margin-top: -2px;
  background: var(--ocre); border-radius: 1px;
}

h1 {
  font-family: var(--f-cond);
  font-size: 34px; font-weight: 700; letter-spacing: -0.5px;
  margin-bottom: 8px;
}
.bajada {
  color: var(--tinta3); font-size: 12.5px; line-height: 1.55;
  max-width: 56ch; margin-bottom: 18px;
}
.bajada strong { color: var(--tinta2); font-weight: 600; }

.calc {
  background: var(--surface);
  border: 1px solid var(--wire);
  border-radius: var(--r);
}

/* ─── Pasos ─── */
.paso { padding: 20px; border-bottom: 1px solid var(--wire2); }
.paso:last-child { border-bottom: 0; }
.paso__cabeza { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.paso__num {
  width: 20px; height: 20px; flex: none;
  background: var(--tinta); color: var(--canvas);
  font-family: var(--f-mono); font-size: 11px; font-weight: 500;
  display: grid; place-items: center; border-radius: var(--r-sm);
}
.paso__titulo {
  font-family: var(--f-cond);
  font-size: 12px; font-weight: 600; letter-spacing: .09em;
  text-transform: uppercase; color: var(--tinta2);
}
.paso__contexto {
  font-family: var(--f-mono); font-size: 11px; color: var(--tinta3);
  margin: -6px 0 14px; letter-spacing: .01em;
}

.volver {
  margin-left: auto; background: none; border: 0; padding: 3px 0;
  font-family: var(--f-cond); font-size: 11px; font-weight: 600;
  letter-spacing: .05em; text-transform: uppercase;
  color: var(--tinta3); cursor: pointer;
  border-bottom: 1px solid transparent;
}
.volver:hover { color: var(--ocre); border-bottom-color: currentColor; }

/* ─── Buscador ─── */
.buscador { position: relative; display: block; margin-bottom: 16px; }
.buscador__icono {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--tinta4); font-size: 14px; pointer-events: none;
}
.buscador input {
  width: 100%; padding: 9px 13px 9px 32px;
  font-family: var(--f-ui); font-size: 13px; color: var(--tinta);
  background: var(--surface2);
  border: 1px solid var(--wire); border-radius: var(--r);
  outline: none; -webkit-appearance: none; appearance: none;
  transition: border-color .15s, box-shadow .15s;
}
.buscador input::placeholder { color: var(--tinta4); }
.buscador input:focus {
  border-color: var(--ocre);
  box-shadow: 0 0 0 3px var(--ocre-glow);
  background: var(--surface);
}

.resultados-busqueda {
  border: 1px solid var(--wire); border-radius: var(--r);
  margin-bottom: 16px; max-height: 320px; overflow-y: auto;
  background: var(--surface);
}
.sugerencia {
  display: block; width: 100%; text-align: left;
  padding: 9px 13px; border: 0; border-bottom: 1px solid var(--wire2);
  background: none; font-family: var(--f-ui); cursor: pointer; color: var(--tinta);
}
.sugerencia:last-child { border-bottom: 0; }
.sugerencia:hover, .sugerencia:focus { background: var(--ocre-bg); outline: none; }
.sugerencia__rubro {
  display: block; font-family: var(--f-cond); font-size: 10px; font-weight: 600;
  letter-spacing: .09em; text-transform: uppercase; color: var(--tinta3);
}
.sugerencia__desc { display: block; font-size: 13px; line-height: 1.4; }
.sugerencia__vacio { padding: 13px; font-size: 13px; color: var(--tinta3); margin: 0; }

/* ─── Grilla de rubros ─── */
.rubros { display: grid; grid-template-columns: 1fr; gap: 6px; }
.rubro {
  display: block; width: 100%; text-align: left;
  padding: 10px 13px;
  background: var(--surface2);
  border: 1px solid var(--wire);
  border-radius: var(--r);
  font-family: var(--f-ui); cursor: pointer; color: var(--tinta);
  transition: border-color .12s, background .12s;
}
.rubro:hover, .rubro:focus-visible {
  border-color: var(--ocre); background: var(--ocre-bg); outline: none;
}
.rubro__nombre {
  display: block; font-family: var(--f-cond);
  font-size: 13px; font-weight: 600; letter-spacing: .01em;
}
.rubro__pista {
  display: block; font-size: 11.5px; color: var(--tinta3);
  line-height: 1.45; margin-top: 1px;
}
.rubro__cuenta {
  display: block; font-family: var(--f-mono); font-size: 10px;
  color: var(--ocre); margin-top: 4px; letter-spacing: .02em;
}

/* ─── Campos ─── */
.campo { display: block; }
.campo__etiqueta {
  display: block; font-size: 11px; font-weight: 600; letter-spacing: .05em;
  text-transform: uppercase; color: var(--tinta3); margin-bottom: 7px;
}
.campo__control {
  width: 100%; padding: 9px 13px;
  background: var(--surface2);
  border: 1px solid var(--wire); border-radius: var(--r);
  font-family: var(--f-ui); font-size: 13px; color: var(--tinta);
  outline: none; transition: border-color .15s, box-shadow .15s;
  -webkit-appearance: none; appearance: none;
}
select.campo__control {
  padding-right: 32px;
  background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath fill='none' stroke='%236A7176' stroke-width='1.4' d='M1 1.8 6 6.2l5-4.4'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; background-size: 11px;
}
.campo__control:focus {
  border-color: var(--ocre);
  box-shadow: 0 0 0 3px var(--ocre-glow);
  background: var(--surface);
}

.campo--cantidad { max-width: 300px; }
.campo__conUnidad { display: flex; align-items: stretch; }
.campo__conUnidad input {
  border-top-right-radius: 0; border-bottom-right-radius: 0;
  font-family: var(--f-mono); font-size: 20px; font-weight: 500;
  padding: 6px 13px; font-variant-numeric: tabular-nums;
}
.campo__unidad {
  display: grid; place-items: center; min-width: 62px; padding: 0 12px;
  background: var(--surface3);
  border: 1px solid var(--wire); border-left: 0;
  border-radius: 0 var(--r) var(--r) 0;
  font-family: var(--f-cond); font-weight: 600; font-size: 13px; color: var(--tinta2);
}
.campo__ayuda { font-size: 11.5px; color: var(--tinta3); margin: 9px 0 0; }

/* ══════════════════════════════════════
   RESULTADO
══════════════════════════════════════ */
.resultado { padding: 20px; background: var(--canvas); border-top: 1px solid var(--wire); }
.resultado__cabeza { margin-bottom: 14px; }
.resultado__titulo {
  font-family: var(--f-cond); font-size: 16px; font-weight: 600; margin-bottom: 2px;
}
.resultado__sub {
  font-family: var(--f-mono); font-size: 11px; color: var(--tinta3); margin: 0;
}

.material {
  background: var(--surface); border: 1px solid var(--wire);
  border-radius: var(--r); padding: 12px 14px; margin-bottom: 6px;
}
.material__nombre {
  font-family: var(--f-cond); font-weight: 600; font-size: 13px; margin: 0 0 7px;
}
.material__cifras { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: baseline; }
.material__cantidad {
  font-family: var(--f-mono); font-size: 17px; font-weight: 500;
  font-variant-numeric: tabular-nums; color: var(--tinta); white-space: nowrap;
}
.material__cantidad span {
  font-family: var(--f-cond); font-size: 11px; font-weight: 600; color: var(--tinta3);
}
.material__flecha { color: var(--tinta4); font-size: 13px; }
.material__envases {
  font-family: var(--f-cond); font-size: 12px; font-weight: 600;
  color: var(--jade); background: var(--jade-bg);
  border-radius: var(--r-sm); padding: 3px 8px;
}
.material__meta {
  font-family: var(--f-mono); font-size: 10px; color: var(--tinta3);
  margin: 8px 0 0; letter-spacing: .01em;
}
.material__nota {
  font-size: 11.5px; color: var(--ocre); background: var(--ocre-bg);
  border-left: 2px solid var(--ocre);
  padding: 6px 9px; margin: 8px 0 0; line-height: 1.45;
}
.resultado__pie { font-size: 11.5px; color: var(--tinta3); margin: 13px 0 0; }

/* ─── Botones ─── */
.acciones { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.boton {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 18px; border: 1px solid transparent; border-radius: var(--r-sm);
  font-family: var(--f-ui); font-size: 11px; font-weight: 700;
  letter-spacing: .06em; text-transform: uppercase;
  background: var(--ocre); color: var(--surface);
  cursor: pointer; transition: all .15s;
}
.boton:hover { background: #6F4A12; }
.boton:focus-visible { outline: 2px solid var(--tinta); outline-offset: 2px; }
.boton--secundario { background: var(--tinta); color: var(--canvas); }
.boton--secundario:hover { background: #292E31; }
.boton--fantasma {
  background: transparent; color: var(--tinta3); border-color: var(--wire);
}
.boton--fantasma:hover { border-color: var(--ocre); color: var(--ocre); background: transparent; }
.boton[data-ok="1"] { background: var(--jade); border-color: var(--jade); color: #fff; }

/* ══════════════════════════════════════
   LISTA DE COMPRA
══════════════════════════════════════ */
.lista { padding: 20px; border-top: 2px solid var(--tinta); background: var(--surface); }
.lista__cabeza { display: flex; align-items: center; gap: 10px; }
.lista__titulo { font-family: var(--f-cond); font-size: 15px; font-weight: 600; }
.lista__contador { font-family: var(--f-mono); font-size: 11px; color: var(--tinta3); font-weight: 400; }
.lista__sub { font-size: 11.5px; color: var(--tinta3); margin: 3px 0 14px; }
.lista__items { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 16px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--surface2); border: 1px solid var(--wire);
  border-radius: 20px; padding: 4px 6px 4px 12px;
  font-size: 11px; color: var(--tinta2);
}
.chip__quitar {
  border: 0; background: none; color: var(--tinta4); cursor: pointer;
  font: inherit; line-height: 1; padding: 3px 5px; border-radius: 50%;
}
.chip__quitar:hover { color: var(--revision); background: rgba(179,64,44,.1); }

/* ══════════════════════════════════════
   ANUNCIOS — huecos vacíos, sin scripts de terceros
══════════════════════════════════════ */
.anuncio {
  display: grid; place-items: center;
  background: var(--surface2);
  border: 1px dashed var(--wire);
  border-radius: var(--r);
  color: var(--tinta4);
}
.anuncio__texto {
  font-family: var(--f-cond); font-size: 10px; font-weight: 600; letter-spacing: .26em;
}
/* Los dos huecos del cuerpo comparten formato de banner ancho */
.anuncio--banner { width: 100%; height: 100px; margin: 26px 0; }
/* El de arriba va pegado a la cabecera y separado del titulo. */
.anuncio--superior { margin: 16px 0 22px; }
.anuncio--modal { width: 100%; height: 220px; margin-top: 14px; }
.anuncio--esquina { width: 100%; height: 92px; }

/* ══════════════════════════════════════
   SECCIONES DE CONTENIDO
══════════════════════════════════════ */
.seccion { padding: 30px 0; }
.seccion--alt { background: var(--surface); border-top: 1px solid var(--wire); border-bottom: 1px solid var(--wire); }
.seccion h2 {
  font-family: var(--f-cond); font-size: 19px; font-weight: 700;
  letter-spacing: -0.2px; margin-bottom: 6px;
}
.seccion__intro {
  color: var(--tinta3); font-size: 12.5px; line-height: 1.5;
  max-width: 62ch; margin-bottom: 0;
}

.pasos { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 10px; }
.pasos__item {
  background: var(--surface); border: 1px solid var(--wire);
  border-radius: var(--r); padding: 14px;
}
.seccion--alt .pasos__item { background: var(--canvas); }
.pasos__num {
  display: grid; place-items: center; width: 19px; height: 19px;
  border-radius: var(--r-sm); background: var(--ocre); color: var(--surface);
  font-family: var(--f-mono); font-size: 10px; font-weight: 500; margin-bottom: 8px;
}
.pasos__item h3 { font-family: var(--f-cond); font-size: 13.5px; margin-bottom: 4px; }
.pasos__item p { margin: 0; font-size: 12px; line-height: 1.5; color: var(--tinta3); }
.pasos__item em { font-weight: 500; }

.tarjetas { display: grid; gap: 10px; margin-top: 16px; }
.tarjeta {
  background: var(--canvas); border: 1px solid var(--wire);
  border-left: 2px solid var(--ocre);
  border-radius: var(--r); padding: 13px 14px;
}
.tarjeta h3 { font-family: var(--f-cond); font-size: 13px; margin-bottom: 4px; }
.tarjeta p { margin: 0; font-size: 12px; line-height: 1.5; color: var(--tinta3); }

.faq {
  background: var(--surface); border: 1px solid var(--wire);
  border-radius: var(--r); margin-bottom: 6px; padding: 0 16px;
}
.faq summary {
  cursor: pointer; padding: 11px 0;
  font-family: var(--f-cond); font-weight: 600; font-size: 13px;
  list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--ocre); font-size: 18px; font-weight: 400; line-height: 1; }
.faq[open] summary::after { content: "\2212"; }
.faq p { font-size: 12px; line-height: 1.55; color: var(--tinta3); margin: 0 0 12px; max-width: 70ch; }

.aviso { font-size: 13px; color: var(--tinta3); margin: 0; }
.aviso--error {
  color: var(--revision); background: rgba(179,64,44,.07);
  border-left: 2px solid var(--revision);
  padding: 12px; border-radius: var(--r);
}

/* ══════════════════════════════════════
   PIE
══════════════════════════════════════ */
.pie {
  background: var(--tinta); color: var(--tinta4);
  padding: 30px 0 36px; margin-top: 0;
}
.pie__marca {
  font-family: var(--f-marca); font-weight: 800; font-size: 15px;
  text-transform: uppercase; letter-spacing: -0.2px;
  color: var(--canvas); margin-bottom: 10px;
}
.pie__nota { font-size: 12px; max-width: 68ch; margin: 0 0 8px; line-height: 1.55; }

/* ══════════════════════════════════════
   MODAL DEL ANUNCIO
══════════════════════════════════════ */
.modal { position: fixed; inset: 0; z-index: 260; display: grid; place-items: center; padding: 20px; }
.modal__fondo { position: absolute; inset: 0; background: rgba(22,24,26,.55); }
.modal__caja {
  position: relative; background: var(--surface);
  border: 1px solid var(--wire); border-radius: var(--r);
  box-shadow: 0 20px 60px rgba(22,24,26,.28);
  padding: 20px; width: 100%; max-width: 380px;
}
.modal__cerrar {
  position: absolute; top: 10px; right: 10px;
  width: 30px; height: 30px; border-radius: var(--r-sm);
  border: 1px solid var(--wire); background: var(--surface);
  color: var(--tinta2); font-size: 13px; cursor: pointer; line-height: 1;
}
.modal__cerrar:hover { background: var(--surface2); color: var(--tinta); border-color: var(--tinta3); }
.modal__titulo {
  font-family: var(--f-cond); font-weight: 600; font-size: 14px; margin: 0 36px 0 0;
}

/* ══════════════════════════════════════
   ANUNCIO DE ESQUINA
══════════════════════════════════════ */
.esquina {
  position: fixed; right: 16px; bottom: 16px; z-index: 240;
  width: 280px; max-width: calc(100vw - 32px);
  background: var(--surface); border: 1px solid var(--wire);
  border-radius: var(--r); box-shadow: 0 14px 40px rgba(22,24,26,.18); padding: 10px;
}
.esquina__cerrar {
  position: absolute; top: -10px; right: -10px;
  width: 24px; height: 24px; border-radius: 50%;
  border: 1px solid var(--wire); background: var(--surface);
  color: var(--tinta2); font-size: 10px; cursor: pointer; line-height: 1;
  box-shadow: 0 2px 8px rgba(22,24,26,.14);
}
.esquina__cerrar:hover { background: var(--surface2); color: var(--tinta); }

/* ══════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════ */
@media (min-width: 600px) {
  .rubros { grid-template-columns: 1fr 1fr; }
  .tarjetas { grid-template-columns: 1fr 1fr; }
}

@media (min-width: 900px) {
  h1 { font-size: 42px; }
  .herramienta { padding-top: 40px; }
  .rubros { grid-template-columns: repeat(3, 1fr); }
  .pasos { grid-template-columns: repeat(3, 1fr); }
  .tarjetas { grid-template-columns: repeat(3, 1fr); }
  .seccion { padding: 52px 0; }
}

@media (max-width: 480px) {
  h1 { font-size: 28px; }
  .cabecera__nota { display: none; }
  .paso, .resultado, .lista { padding: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
  html { scroll-behavior: auto; }
}
