/* =====================================================================
   Cima Natural · Catálogo web
   Paleta y tipografías de la marca (mismas que el panel y el PDF)
   ===================================================================== */
:root {
  --terra-osc:   #3D1F0A;
  --terra-med:   #7B3F1A;
  --brown-dark:  #6B3A1F;
  --brown-mid:   #8B4513;
  --terra-suav:  #C87840;
  --terra-hint:  #D4956A;
  --gold:        #C9973A;
  --gold-light:  #E8C882;
  --cream:       #FBF7F2;
  --cream-alt:   #F3EADF;
  --cream-dark:  #E5D5C0;
  --white:       #FFFFFF;
  --text:        #3A2010;
  --text-mid:    #6B4C35;
  --text-light:  #9C8068;
  --ok:          #2D7A45;
  --danger:      #B0392B;
  --wa:          #1FA855;

  --border:      rgba(123, 63, 26, 0.12);
  --border-mid:  rgba(123, 63, 26, 0.22);
  --shadow-sm:   0 1px 2px rgba(61, 31, 10, 0.05), 0 2px 8px rgba(61, 31, 10, 0.05);
  --shadow:      0 4px 24px rgba(61, 31, 10, 0.08);
  --shadow-lg:   0 18px 50px rgba(61, 31, 10, 0.16);

  --radius:      16px;
  --radius-sm:   10px;
  --serif:       'Playfair Display', Georgia, serif;
  --sans:        'DM Sans', system-ui, -apple-system, sans-serif;
  --topbar-h:    72px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; overflow-x: clip; }
body { overflow-x: clip; }
body {
  font-family: var(--sans);
  background: var(--cream);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img { max-width: 100%; display: block; }
svg { width: 1em; height: 1em; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.wrap { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 24px; }

:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 6px; }

/* ===================== HEADER ===================== */
.topbar {
  position: sticky; top: 0; z-index: 60;
  background: rgba(251, 247, 242, 0.86);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color .25s, box-shadow .25s;
}
.topbar.scrolled { border-bottom-color: var(--border); box-shadow: 0 6px 24px rgba(61,31,10,.06); }
.topbar-in { height: var(--topbar-h); display: flex; align-items: center; gap: 20px; }

.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; margin-right: auto; min-width: 0; }
.brand-logo {
  width: 46px; height: 46px; border-radius: 50%; flex-shrink: 0;
  background: var(--white); border: 1.5px solid var(--terra-hint);
  display: grid; place-items: center; overflow: hidden; position: relative;
  box-shadow: 0 2px 10px rgba(123,63,26,.12);
}
.brand-logo img { width: 100%; height: 100%; object-fit: contain; }
.brand-mono { display: none; font-family: var(--serif); font-weight: 700; font-size: 22px; color: var(--terra-med); }
.brand-logo.sin-logo .brand-mono { display: block; }
.brand-txt { display: flex; flex-direction: column; min-width: 0; }
.brand-name { font-family: var(--serif); font-weight: 700; font-size: 20px; color: var(--terra-osc); line-height: 1.1; letter-spacing: .2px; }
.brand-sub { font-size: 11px; color: var(--text-light); letter-spacing: 1.2px; text-transform: uppercase; margin-top: 2px; }

/* Toggle Mayorista / Minorista */
.lista-toggle {
  position: relative; display: grid; grid-template-columns: 1fr 1fr;
  background: var(--cream-alt); border: 1px solid var(--border);
  border-radius: 999px; padding: 4px; flex-shrink: 0;
}
.lt-btn {
  position: relative; z-index: 1; border: 0; background: none;
  padding: 9px 20px; border-radius: 999px;
  font-size: 14px; font-weight: 600; color: var(--text-mid);
  transition: color .25s;
}
.lt-btn[aria-selected="true"] { color: var(--white); }
.lt-pill {
  position: absolute; top: 4px; bottom: 4px; left: 4px; width: calc(50% - 4px);
  border-radius: 999px;
  background: linear-gradient(135deg, var(--terra-med), var(--brown-dark));
  box-shadow: 0 4px 14px rgba(123,63,26,.3);
  transition: transform .35s cubic-bezier(.4,.1,.2,1);
}
.lista-toggle[data-lista="minorista"] .lt-pill { transform: translateX(100%); }

/* Botones WhatsApp */
.btn-wa {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--wa); color: var(--white); text-decoration: none;
  padding: 10px 16px; border-radius: 999px; font-weight: 600; font-size: 14px;
  box-shadow: 0 4px 14px rgba(31,168,85,.28);
  transition: transform .15s, box-shadow .15s, background .15s;
  flex-shrink: 0;
}
.btn-wa svg { width: 18px; height: 18px; fill: currentColor; }
.btn-wa:hover { background: #18934A; transform: translateY(-1px); box-shadow: 0 6px 18px rgba(31,168,85,.34); }

/* ===================== INDICADOR "PRECIOS ACTUALIZADOS" ===================== */
.live {
  display: inline-flex; align-items: center; gap: 8px; flex-shrink: 0;
  background: var(--white); border: 1px solid var(--border);
  padding: 7px 13px 7px 11px; border-radius: 999px;
  font-size: 12.5px; font-weight: 500; color: var(--text-mid); white-space: nowrap;
}
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--gold); position: relative; flex-shrink: 0; }
.live[data-estado="vivo"] .live-dot { background: #2FB566; }
.live[data-estado="vivo"] .live-dot::after {
  content: ''; position: absolute; inset: -4px; border-radius: 50%;
  border: 2px solid #2FB566; animation: ping 1.8s ease-out infinite;
}
.live[data-estado="offline"] .live-dot { background: #E08A3C; }
@keyframes ping { from { transform: scale(.6); opacity: .9; } to { transform: scale(1.8); opacity: 0; } }

/* ===================== TOOLBAR ===================== */
.toolbar {
  position: sticky; top: var(--topbar-h); z-index: 50;
  background: rgba(251, 247, 242, 0.92);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 16px 0 12px;
}
.tb-row { display: flex; gap: 14px; align-items: center; }
.search {
  flex: 1; display: flex; align-items: center; gap: 10px;
  background: var(--white); border: 1.5px solid var(--border-mid);
  border-radius: 999px; padding: 0 8px 0 16px; height: 46px;
  transition: border-color .2s, box-shadow .2s;
  box-shadow: var(--shadow-sm);
}
.search:focus-within { border-color: var(--terra-suav); box-shadow: 0 0 0 4px rgba(200,120,64,.14); }
.search svg { width: 18px; height: 18px; stroke: var(--text-light); fill: none; stroke-width: 2; stroke-linecap: round; flex-shrink: 0; }
.search input { flex: 1; min-width: 0; border: 0; outline: none; background: none; font-size: 15px; height: 100%; }
.search input::placeholder { color: var(--text-light); }
.search input::-webkit-search-cancel-button { display: none; }
.search-clear { border: 0; background: var(--cream-alt); width: 30px; height: 30px; border-radius: 50%; font-size: 18px; line-height: 1; color: var(--text-mid); }

.tb-opts { display: flex; gap: 14px; align-items: center; flex-shrink: 0; }
.switch { display: inline-flex; align-items: center; gap: 9px; font-size: 14px; color: var(--text-mid); cursor: pointer; user-select: none; white-space: nowrap; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch-ui { width: 38px; height: 22px; border-radius: 999px; background: var(--cream-dark); position: relative; transition: background .2s; flex-shrink: 0; }
.switch-ui::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--white); box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: transform .2s; }
.switch input:checked + .switch-ui { background: var(--terra-med); }
.switch input:checked + .switch-ui::after { transform: translateX(16px); }
.switch input:focus-visible + .switch-ui { outline: 2px solid var(--gold); outline-offset: 2px; }

.select select {
  appearance: none; -webkit-appearance: none;
  background: var(--white) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%237B3F1A' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 14px center;
  border: 1.5px solid var(--border-mid); border-radius: 999px;
  height: 46px; padding: 0 38px 0 16px; font-size: 14px; color: var(--text-mid);
  box-shadow: var(--shadow-sm);
}

.chips {
  display: flex; gap: 8px; margin-top: 12px; overflow-x: auto; padding-bottom: 4px;
  scrollbar-width: none; -webkit-overflow-scrolling: touch;
  mask-image: linear-gradient(90deg, #000 92%, transparent);
  -webkit-mask-image: linear-gradient(90deg, #000 92%, transparent);
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex-shrink: 0; border: 1px solid var(--border-mid); background: var(--white);
  padding: 7px 14px; border-radius: 999px; font-size: 13px; font-weight: 500; color: var(--text-mid);
  transition: all .18s; white-space: nowrap;
}
.chip:hover { border-color: var(--terra-suav); color: var(--terra-med); }
.chip[aria-pressed="true"] { background: var(--terra-osc); border-color: var(--terra-osc); color: var(--cream); }
.chip-n { opacity: .6; margin-left: 5px; font-size: 12px; font-variant-numeric: tabular-nums; }

/* ===================== CATÁLOGO ===================== */
.catalogo { padding-top: 32px; padding-bottom: 60px; min-height: 50vh; }

.seccion { margin-bottom: 40px; scroll-margin-top: calc(var(--topbar-h) + 150px); animation: fadeUp .45s ease both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 14px; padding: 0 4px; }
.sec-title {
  font-family: var(--serif); font-weight: 600; font-size: 26px; color: var(--terra-osc);
  display: flex; align-items: center; gap: 12px;
}
.sec-title::before { content: ''; width: 5px; height: 26px; border-radius: 3px; background: linear-gradient(var(--terra-suav), var(--terra-med)); }
.sec-count { font-size: 13px; color: var(--text-light); white-space: nowrap; }

.tabla {
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
}

/* Cabecera de columnas */
.fila, .fila-head {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) repeat(var(--ncols), minmax(96px, 128px)) 52px;
  align-items: center;
}
.fila-head {
  background: var(--terra-osc); color: var(--terra-hint);
  font-size: 11.5px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase;
}
.fila-head > div { padding: 13px 12px; text-align: center; }
.fila-head > div:first-child { text-align: left; padding-left: 22px; color: var(--cream); letter-spacing: 1.4px; }
.fila-head .col-dest { color: var(--gold-light); }

.fila { border-top: 1px solid var(--border); transition: background .15s; }
.fila:first-of-type { border-top: 0; }
.fila:nth-child(even) { background: #FDFAF6; }
.fila:hover { background: var(--cream-alt); }

.f-prod { padding: 14px 12px 14px 22px; min-width: 0; }
.f-nombre { font-weight: 600; font-size: 15.5px; color: var(--text); line-height: 1.3; }
.f-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.tag { font-size: 11px; font-weight: 600; padding: 2px 9px; border-radius: 999px; letter-spacing: .2px; }
.tag-sin { background: rgba(176,57,43,.1); color: var(--danger); }
.tag-base { background: var(--cream-alt); color: var(--text-mid); }
.f-ings { margin-top: 6px; font-size: 12.5px; color: var(--terra-suav); font-style: italic; line-height: 1.45; }

.f-precio { text-align: center; padding: 10px 6px; font-variant-numeric: tabular-nums; }
.f-precio .lbl { display: none; }
.f-precio .val { font-size: 15px; font-weight: 500; color: var(--text-mid); white-space: nowrap; }
.f-precio.dest .val { font-weight: 700; color: var(--terra-med); font-size: 16px; }
.f-precio.nulo .val { color: var(--cream-dark); }
.f-precio .val.flash { animation: flash 2.2s ease; border-radius: 6px; }
@keyframes flash {
  0%   { background: rgba(201,151,58,.45); box-shadow: 0 0 0 6px rgba(201,151,58,.45); }
  100% { background: transparent; box-shadow: 0 0 0 6px transparent; }
}

.fila.agotado .f-nombre { color: var(--text-light); }
.fila.agotado .f-precio .val { color: var(--text-light); font-weight: 400; text-decoration: line-through; text-decoration-color: rgba(156,128,104,.5); }
.f-sin-precios { grid-column: 2 / span var(--ncols); text-align: center; font-size: 13px; color: var(--text-light); font-style: italic; padding: 10px; }

.f-wa { display: flex; justify-content: center; padding-right: 10px; }
.wa-mini {
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center;
  color: var(--wa); background: rgba(31,168,85,.08); border: 1px solid rgba(31,168,85,.18);
  transition: all .15s; text-decoration: none;
}
.wa-mini svg { width: 17px; height: 17px; fill: currentColor; }
.wa-mini:hover { background: var(--wa); color: var(--white); transform: scale(1.06); }

mark { background: rgba(232,200,130,.55); color: inherit; border-radius: 3px; padding: 0 1px; }

/* Mix: ingredientes como chips */
.ings-chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 7px; }
.ing-chip { font-size: 11.5px; color: var(--terra-med); background: #FBF1E6; border: 1px solid #F0DCC6; padding: 2px 8px; border-radius: 999px; }

/* Skeleton */
.skeleton { display: grid; gap: 12px; }
.sk-title, .sk-row {
  border-radius: 12px;
  background: linear-gradient(90deg, var(--cream-alt) 25%, #FAF3EA 50%, var(--cream-alt) 75%);
  background-size: 200% 100%; animation: shimmer 1.4s infinite;
}
.sk-title { height: 30px; width: 220px; margin-top: 18px; }
.sk-row { height: 64px; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* Estado vacío / error */
.vacio { text-align: center; padding: 40px 20px 80px; }
.vacio-ic { font-size: 44px; margin-bottom: 10px; }
.vacio-t { font-family: var(--serif); font-size: 22px; color: var(--terra-osc); }
.vacio-s { color: var(--text-light); margin: 6px 0 18px; }
.btn-outline {
  display: inline-block; text-decoration: none;
  border: 1.5px solid var(--terra-med); background: none; color: var(--terra-med);
  padding: 10px 20px; border-radius: 999px; font-weight: 600; font-size: 14px; transition: all .15s;
}
.btn-outline:hover { background: var(--terra-med); color: var(--cream); }

.aviso {
  background: var(--white); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 36px 24px; text-align: center; box-shadow: var(--shadow);
}
.aviso h2 { font-family: var(--serif); color: var(--terra-osc); font-size: 22px; margin-bottom: 6px; }
.aviso p { color: var(--text-mid); margin-bottom: 18px; }

/* ===================== FOOTER ===================== */
.footer { background: var(--terra-osc); color: rgba(251,247,242,.7); padding: 36px 0 44px; }
.footer-in { display: flex; justify-content: space-between; gap: 24px; align-items: center; flex-wrap: wrap; }
.footer .brand-name { color: var(--cream); font-size: 22px; }
.footer-brand { display: flex; flex-direction: column; gap: 3px; }
.footer-sub { font-size: 12px; letter-spacing: 1.4px; text-transform: uppercase; color: var(--terra-hint); }
.footer-legal { font-size: 13px; max-width: 520px; }

/* Flotantes */
.wa-float {
  position: fixed; right: 18px; bottom: calc(18px + env(safe-area-inset-bottom)); z-index: 70;
  width: 58px; height: 58px; border-radius: 50%; display: none; place-items: center;
  background: var(--wa); color: var(--white); box-shadow: 0 8px 26px rgba(31,168,85,.45);
}
.wa-float svg { width: 30px; height: 30px; fill: currentColor; }
.to-top {
  position: fixed; left: 50%; bottom: 22px; z-index: 65; transform: translateX(-50%);
  border: 0; background: var(--terra-osc); color: var(--cream);
  width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center;
  box-shadow: var(--shadow-lg); opacity: .92;
}
.to-top svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }

/* ===================== RESPONSIVE ===================== */
@media (max-width: 960px) {
  .tb-opts .switch span:last-child { font-size: 13px; }
}

@media (max-width: 820px) {
  :root { --topbar-h: 64px; }
  .wrap { padding: 0 16px; }
  .topbar-in { gap: 10px; }
  .brand-logo { width: 40px; height: 40px; }
  .brand-name { font-size: 17px; }
  .brand-sub { display: none; }
  .btn-wa-top { display: none; }
  .wa-float { display: grid; }
  .lt-btn { padding: 8px 14px; font-size: 13px; }

  .topbar-in { height: auto; min-height: var(--topbar-h); flex-wrap: wrap; padding-top: 10px; padding-bottom: 10px; row-gap: 8px; }
  .live { order: 3; width: 100%; justify-content: center; padding: 0 0 2px; font-size: 12px; background: none; border: 0; }
  .brand { gap: 9px; }
  .brand-logo { width: 38px !important; height: 38px !important; }
  .brand-name { font-size: 15.5px !important; white-space: nowrap; }
  .lt-btn { padding: 8px 11px !important; font-size: 12.5px; }
  .topbar .wrap { padding-left: 14px; padding-right: 14px; }
  .topbar-in { column-gap: 8px; }

  .toolbar { padding: 12px 0 10px; position: relative; top: 0; }
  .tb-row { flex-wrap: wrap; gap: 10px; }
  .search { flex-basis: 100%; height: 44px; }
  .tb-opts { width: 100%; justify-content: space-between; }
  .select select { height: 38px; font-size: 13px; }

  .catalogo { padding-top: 22px; }
  .sec-title { font-size: 22px; }
  .sec-title::before { height: 22px; }

  /* Tabla → tarjetas */
  .tabla { background: none; border: 0; box-shadow: none; overflow: visible; display: grid; gap: 10px; }
  .fila-head { display: none; }
  .fila {
    display: grid; grid-template-columns: 1fr auto; gap: 0;
    background: var(--white) !important; border: 1px solid var(--border);
    border-radius: 14px; box-shadow: var(--shadow-sm); overflow: hidden;
  }
  .f-prod { grid-column: 1; padding: 14px 8px 10px 16px; }
  .f-wa { grid-column: 2; grid-row: 1; align-self: start; padding: 12px 12px 0 0; }
  .f-precios-m {
    grid-column: 1 / -1; display: grid;
    grid-template-columns: repeat(auto-fit, minmax(72px, 1fr));
    border-top: 1px solid var(--border); background: #FDFAF6;
  }
  .f-precio { padding: 9px 4px 10px; border-left: 1px solid var(--border); }
  .f-precio:first-child { border-left: 0; }
  .f-precio .lbl { display: block; font-size: 10.5px; font-weight: 700; letter-spacing: .7px; text-transform: uppercase; color: var(--text-light); margin-bottom: 1px; }
  .f-precio.dest { background: #FBF1E6; }
  .f-precio.dest .lbl { color: var(--terra-suav); }
  .f-precio.nulo { display: none; }
  .f-sin-precios { grid-column: 1 / -1; border-top: 1px solid var(--border); }
  .to-top { left: 18px; transform: none; bottom: calc(26px + env(safe-area-inset-bottom)); }
}

/* En desktop los precios quedan directamente en la grilla de la fila */
@media (min-width: 821px) {
  .f-precios-m { display: contents; }
}

@media (max-width: 380px) {
  .brand-name { font-size: 14.5px !important; }
  .lt-btn { padding: 7px 9px !important; }
  .switch { font-size: 13px; }
}

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

@media print {
  .toolbar, .wa-float, .to-top, .f-wa, .lista-toggle, .btn-wa { display: none !important; }
  .fila { break-inside: avoid; }
}

/* =====================================================================
   BARRA SUPERIOR EN MARRÓN (header + buscador/filtros)
   Diferencia la navegación del fondo claro donde arranca la lista.
   ===================================================================== */
.topbar {
  background: var(--terra-osc);
  backdrop-filter: none; -webkit-backdrop-filter: none;
  border-bottom: 1px solid rgba(232,200,130,.12);
}
.topbar.scrolled { border-bottom-color: rgba(232,200,130,.12); box-shadow: none; }
.brand-name { color: var(--cream); }
.brand-sub { color: var(--terra-hint); }
.brand-logo { border-color: var(--gold); box-shadow: 0 2px 12px rgba(0,0,0,.25); }

.live {
  background: rgba(255,255,255,.07); border-color: rgba(255,255,255,.14);
  color: rgba(251,247,242,.85);
}
.live[data-estado="vivo"] .live-dot { background: #5DDB8C; }
.live[data-estado="vivo"] .live-dot::after { border-color: #5DDB8C; }

.lista-toggle { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.14); }
.lt-btn { color: rgba(251,247,242,.75); }
.lt-btn[aria-selected="true"] { color: var(--terra-osc); }
.lt-pill { background: linear-gradient(135deg, var(--gold-light), var(--gold)); box-shadow: 0 4px 14px rgba(0,0,0,.3); }

.toolbar {
  background: var(--terra-osc);
  backdrop-filter: none; -webkit-backdrop-filter: none;
  border-bottom: 0;
  box-shadow: 0 10px 30px rgba(61,31,10,.18);
}
.search { border-color: transparent; box-shadow: none; }
.search:focus-within { border-color: var(--gold); box-shadow: 0 0 0 4px rgba(201,151,58,.25); }
.select select { border-color: transparent; box-shadow: none; }
.switch { color: rgba(251,247,242,.85); }
.switch-ui { background: rgba(255,255,255,.18); }
.switch input:checked + .switch-ui { background: var(--gold); }

.chip { background: rgba(255,255,255,.06); border-color: rgba(255,255,255,.16); color: rgba(251,247,242,.85); }
.chip:hover { border-color: var(--gold-light); color: var(--cream); background: rgba(255,255,255,.1); }
.chip[aria-pressed="true"] { background: var(--gold-light); border-color: var(--gold-light); color: var(--terra-osc); font-weight: 600; }

@media (max-width: 820px) {
  .live { background: none; border: 0; }
  .toolbar { box-shadow: none; }
}

/* =====================================================================
   PEDIDO / CARRITO
   ===================================================================== */
body.bloqueado { overflow: hidden; }
body.con-pedido .catalogo { padding-bottom: 120px; }

/* Botón del header */
.cart-btn {
  position: relative; display: inline-flex; align-items: center; gap: 8px; flex-shrink: 0;
  border: 1px solid rgba(255,255,255,.18); background: rgba(255,255,255,.08); color: var(--cream);
  padding: 10px 16px; border-radius: 999px; font-weight: 600; font-size: 14px; transition: background .15s;
}
.cart-btn:hover { background: rgba(255,255,255,.14); }
.cart-btn svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.cart-badge {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px;
  background: var(--gold-light); color: var(--terra-osc); font-size: 11.5px; font-weight: 700;
  display: inline-grid; place-items: center;
}
.cart-btn.pulso { animation: pulso .5s ease; }
@keyframes pulso { 50% { transform: scale(1.08); } }

/* Columna del botón Agregar en la tabla (escritorio) */
@media (min-width: 821px) {
  .fila, .fila-head { grid-template-columns: minmax(220px, 1fr) repeat(var(--ncols), minmax(92px, 124px)) 132px; }
}
.f-add { display: flex; justify-content: center; padding: 8px 12px 8px 4px; }
.btn-add {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-width: 104px; height: 36px; padding: 0 14px; border-radius: 999px;
  border: 1.5px solid var(--terra-suav); background: var(--white); color: var(--terra-med);
  font-weight: 600; font-size: 13px; white-space: nowrap; transition: all .15s;
}
.btn-add svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; }
.btn-add:hover { background: var(--terra-med); border-color: var(--terra-med); color: var(--cream); }
.btn-add.en-pedido { background: var(--terra-med); border-color: var(--terra-med); color: var(--cream); }
.btn-add.en-pedido:hover { background: var(--terra-osc); }
.btn-add:disabled { opacity: .45; cursor: not-allowed; background: var(--white); color: var(--text-light); border-color: var(--cream-dark); }

/* Barra inferior del pedido */
.cart-bar {
  position: fixed; z-index: 80; left: 50%; transform: translateX(-50%);
  bottom: calc(16px + env(safe-area-inset-bottom));
  width: min(560px, calc(100% - 24px));
  display: flex; align-items: center; gap: 12px;
  background: var(--terra-osc); color: var(--cream);
  border: 1px solid rgba(232,200,130,.25); border-radius: 18px;
  padding: 10px 12px 10px 14px; box-shadow: 0 14px 40px rgba(61,31,10,.38);
  text-align: left; animation: subir .3s cubic-bezier(.2,.8,.3,1);
}
@keyframes subir { from { transform: translate(-50%, 30px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }
.cb-ic { position: relative; width: 42px; height: 42px; border-radius: 12px; background: rgba(255,255,255,.1); display: grid; place-items: center; flex-shrink: 0; }
.cb-ic svg { width: 22px; height: 22px; fill: none; stroke: var(--gold-light); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.cb-n { position: absolute; top: -6px; right: -6px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 999px; background: var(--gold-light); color: var(--terra-osc); font-size: 11px; font-weight: 700; display: grid; place-items: center; }
.cb-info { display: flex; flex-direction: column; flex: 1; min-width: 0; line-height: 1.2; }
.cb-lbl { font-size: 12px; color: rgba(251,247,242,.7); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cb-total { font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; }
.cb-go { display: inline-flex; align-items: center; gap: 4px; background: var(--gold-light); color: var(--terra-osc); font-weight: 700; font-size: 14px; padding: 10px 12px 10px 16px; border-radius: 12px; flex-shrink: 0; }
.cb-go svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }

/* Fondo oscuro detrás de los paneles */
.overlay { position: fixed; inset: 0; z-index: 90; background: rgba(30,14,4,.5); backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px); animation: aparecer .2s ease; }
@keyframes aparecer { from { opacity: 0; } }

/* Panel para elegir la cantidad (modal en escritorio, hoja inferior en celular) */
.sheet {
  position: fixed; z-index: 100; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(460px, calc(100% - 32px)); max-height: calc(100vh - 40px); overflow-y: auto;
  background: var(--white); border-radius: 22px; padding: 26px 24px 22px;
  box-shadow: var(--shadow-lg); animation: zoomIn .22s ease;
}
@keyframes zoomIn { from { opacity: 0; transform: translate(-50%, -48%) scale(.97); } }
.sheet-handle { display: none; }
.sheet-close {
  position: absolute; top: 14px; right: 14px; width: 34px; height: 34px; border-radius: 50%;
  border: 0; background: var(--cream-alt); color: var(--text-mid); font-size: 22px; line-height: 1;
  display: grid; place-items: center;
}
.sh-head { padding-right: 36px; }
.sh-cat { font-size: 11px; font-weight: 700; letter-spacing: 1.4px; text-transform: uppercase; color: var(--terra-suav); }
.sh-nombre { font-family: var(--serif); font-size: 23px; font-weight: 600; color: var(--terra-osc); line-height: 1.2; margin-top: 3px; }
.sh-ings { font-size: 12.5px; color: var(--terra-suav); font-style: italic; margin-top: 5px; }
.sh-ings:empty { display: none; }

.sh-tiers { display: grid; grid-template-columns: repeat(auto-fit, minmax(84px, 1fr)); gap: 6px; margin: 18px 0; }
.tier { border: 1.5px solid var(--cream-dark); border-radius: 12px; padding: 8px 6px; text-align: center; transition: all .15s; }
.tier-kg { display: block; font-size: 11px; font-weight: 600; color: var(--text-light); white-space: nowrap; }
.tier-p { display: block; font-size: 14px; font-weight: 600; color: var(--text-mid); font-variant-numeric: tabular-nums; }
.tier.activo { border-color: var(--terra-med); background: #FBF1E6; }
.tier.activo .tier-kg { color: var(--terra-suav); }
.tier.activo .tier-p { color: var(--terra-med); font-weight: 700; }

.sh-qty { display: flex; align-items: center; gap: 10px; }
.qty-btn {
  width: 52px; height: 52px; flex-shrink: 0; border-radius: 16px;
  border: 1.5px solid var(--border-mid); background: var(--cream); color: var(--terra-med);
  font-size: 26px; font-weight: 500; line-height: 1; display: grid; place-items: center; transition: all .12s;
}
.qty-btn:active { transform: scale(.95); background: var(--cream-alt); }
.qty-btn:disabled { opacity: .35; }
.qty-field {
  flex: 1; display: flex; align-items: baseline; justify-content: center; gap: 6px;
  height: 52px; border: 1.5px solid var(--border-mid); border-radius: 16px; padding: 0 14px;
  align-items: center; transition: border-color .15s;
}
.qty-field:focus-within { border-color: var(--terra-suav); box-shadow: 0 0 0 4px rgba(200,120,64,.14); }
.qty-field input { width: 100%; min-width: 0; border: 0; outline: 0; text-align: right; font-size: 22px; font-weight: 700; color: var(--terra-osc); background: none; font-variant-numeric: tabular-nums; }
.qty-field span { font-size: 16px; font-weight: 600; color: var(--text-light); flex-shrink: 0; width: 44%; }

.sh-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.qchip { border: 1px solid var(--border-mid); background: var(--white); color: var(--text-mid); padding: 6px 12px; border-radius: 999px; font-size: 13px; font-weight: 500; }
.qchip.activo { background: var(--terra-osc); border-color: var(--terra-osc); color: var(--cream); }
.sh-min { font-size: 12px; color: var(--text-light); margin-top: 8px; }
.sh-min:empty { display: none; }

.sh-resumen { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 18px; background: var(--cream); border-radius: 14px; padding: 12px 14px; }
.sh-resumen > div { display: flex; flex-direction: column; }
.sh-r-lbl { font-size: 11.5px; color: var(--text-light); }
.sh-r-val { font-size: 16px; font-weight: 600; color: var(--text-mid); font-variant-numeric: tabular-nums; }
.sh-r-sub { font-size: 20px; font-weight: 700; color: var(--terra-osc); }
.sh-hint { margin-top: 10px; font-size: 12.5px; color: var(--ok); background: rgba(45,122,69,.08); border-radius: 10px; padding: 8px 12px; }

.sh-acciones { display: flex; gap: 10px; margin-top: 18px; }
.btn-primario {
  flex: 1; height: 52px; border: 0; border-radius: 16px;
  background: linear-gradient(135deg, var(--terra-med), var(--terra-osc)); color: var(--cream);
  font-weight: 700; font-size: 15.5px; box-shadow: 0 8px 20px rgba(123,63,26,.28);
}
.btn-primario:disabled { opacity: .5; box-shadow: none; }
.btn-quitar { height: 52px; padding: 0 18px; border-radius: 16px; border: 1.5px solid rgba(176,57,43,.3); background: none; color: var(--danger); font-weight: 600; }

/* Carrito (panel lateral en escritorio, hoja completa en celular) */
.drawer {
  position: fixed; z-index: 100; top: 0; right: 0; bottom: 0; width: min(440px, 100%);
  background: var(--cream); display: flex; flex-direction: column;
  box-shadow: -20px 0 60px rgba(30,14,4,.25); animation: deslizar .28s cubic-bezier(.2,.8,.3,1);
}
@keyframes deslizar { from { transform: translateX(100%); } }
.dr-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 20px 20px 14px; background: var(--terra-osc); color: var(--cream); }
.dr-head h3 { font-family: var(--serif); font-size: 24px; font-weight: 600; }
.dr-sub { font-size: 13px; color: var(--terra-hint); margin-top: 2px; }
.dr-close { position: static; background: rgba(255,255,255,.12); color: var(--cream); }
.dr-body { flex: 1; overflow-y: auto; padding: 14px 16px 8px; }
.dr-items { display: grid; gap: 8px; }
.dr-item { background: var(--white); border: 1px solid var(--border); border-radius: 14px; padding: 12px 12px 12px 14px; display: grid; grid-template-columns: 1fr auto; gap: 8px 10px; align-items: center; }
.dr-item.no-disp { opacity: .6; }
.di-nombre { font-weight: 600; font-size: 14.5px; line-height: 1.3; color: var(--text); }
.di-det { font-size: 12.5px; color: var(--text-light); margin-top: 2px; font-variant-numeric: tabular-nums; }
.di-det b { color: var(--terra-suav); font-weight: 600; }
.di-sub { font-weight: 700; font-size: 15px; color: var(--terra-osc); text-align: right; font-variant-numeric: tabular-nums; }
.di-ctrl { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.mini-qty { display: inline-flex; align-items: center; border: 1px solid var(--border-mid); border-radius: 999px; overflow: hidden; }
.mini-qty button { width: 34px; height: 32px; border: 0; background: var(--cream); color: var(--terra-med); font-size: 18px; line-height: 1; }
.mini-qty button:disabled { opacity: .35; }
.mini-qty span { min-width: 74px; text-align: center; font-size: 13.5px; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.di-acc { display: flex; gap: 4px; }
.icon-btn { border: 0; background: none; color: var(--text-light); font-size: 12.5px; font-weight: 600; padding: 6px 8px; border-radius: 8px; }
.icon-btn:hover { background: var(--cream-alt); color: var(--terra-med); }
.icon-btn.peligro:hover { color: var(--danger); background: rgba(176,57,43,.08); }
.dr-vacio { text-align: center; padding: 50px 20px; color: var(--text-light); }
.dr-vacio b { display: block; font-family: var(--serif); font-size: 20px; color: var(--terra-osc); margin: 8px 0 4px; }
.dr-aviso { font-size: 12px; background: #FFF6E5; color: #8A5A00; border-radius: 10px; padding: 8px 12px; margin-bottom: 8px; }

.dr-form { margin-top: 16px; display: grid; gap: 12px; }
.campo { display: grid; gap: 5px; }
.campo > span { font-size: 13px; font-weight: 600; color: var(--text-mid); }
.campo em { color: var(--danger); font-style: normal; }
.campo small { font-weight: 400; color: var(--text-light); }
.campo input, .campo textarea {
  width: 100%; border: 1.5px solid var(--border-mid); background: var(--white); border-radius: 12px;
  padding: 12px 14px; font-size: 16px; outline: 0; resize: vertical; transition: border-color .15s, box-shadow .15s;
}
.campo input:focus, .campo textarea:focus { border-color: var(--terra-suav); box-shadow: 0 0 0 4px rgba(200,120,64,.14); }
.campo.error input { border-color: var(--danger); box-shadow: 0 0 0 4px rgba(176,57,43,.12); }

.dr-foot { padding: 14px 16px calc(14px + env(safe-area-inset-bottom)); background: var(--white); border-top: 1px solid var(--border); }
.dr-total { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 12px; }
.dr-total span { font-size: 14px; color: var(--text-mid); }
.dr-total strong { font-size: 24px; color: var(--terra-osc); font-variant-numeric: tabular-nums; }
.btn-enviar { width: 100%; justify-content: center; height: 54px; border: 0; border-radius: 16px; font-size: 16px; }
.btn-enviar svg { width: 21px; height: 21px; }
.btn-enviar:disabled { background: var(--cream-dark); box-shadow: none; color: var(--text-light); transform: none; cursor: not-allowed; }
.dr-legal { font-size: 11.5px; color: var(--text-light); text-align: center; margin-top: 8px; }
.link-btn { display: block; margin: 6px auto 0; border: 0; background: none; color: var(--text-light); font-size: 12.5px; text-decoration: underline; text-underline-offset: 2px; padding: 4px; }

.dr-ok { text-align: center; padding: 40px 16px; }
.dr-ok-ic { width: 64px; height: 64px; border-radius: 50%; background: rgba(31,168,85,.12); color: var(--wa); display: grid; place-items: center; margin: 0 auto 14px; font-size: 30px; }
.dr-ok h4 { font-family: var(--serif); font-size: 22px; color: var(--terra-osc); margin-bottom: 6px; }
.dr-ok p { color: var(--text-mid); font-size: 14px; margin-bottom: 20px; }
.dr-ok .btn-primario { width: 100%; margin-bottom: 8px; }

/* Aviso flotante */
.toast {
  position: fixed; z-index: 120; left: 50%; transform: translateX(-50%);
  bottom: calc(100px + env(safe-area-inset-bottom));
  background: var(--terra-osc); color: var(--cream); font-size: 14px; font-weight: 500;
  padding: 10px 18px; border-radius: 999px; box-shadow: var(--shadow-lg); white-space: nowrap;
  animation: aparecer .2s ease;
}

/* ---------- Celular ---------- */
@media (max-width: 820px) {
  .cart-btn { display: none; }
  body.con-pedido .wa-float { display: none; }
  body.con-pedido .to-top { bottom: calc(96px + env(safe-area-inset-bottom)); }

  /* Botón Agregar dentro de la tarjeta, arriba a la derecha */
  .fila { position: relative; }
  .f-prod { grid-column: 1 / -1; padding-right: 16px; }
  .f-nombre { padding-right: 112px; min-height: 30px; display: flex; align-items: center; }
  .f-add { position: absolute; top: 11px; right: 12px; padding: 0; }
  .btn-add { min-width: 0; height: 34px; padding: 0 13px; font-size: 13px; }
  .f-precios-m { grid-template-columns: repeat(auto-fit, minmax(58px, 1fr)) !important; }
  .f-precio .val { font-size: 14.5px; }

  .cart-bar { bottom: calc(10px + env(safe-area-inset-bottom)); width: calc(100% - 20px); border-radius: 16px; }

  /* Hoja inferior */
  .sheet {
    left: 0; right: 0; top: auto; bottom: 0; transform: none; width: 100%;
    max-height: 92vh; border-radius: 24px 24px 0 0;
    padding: 10px 18px calc(18px + env(safe-area-inset-bottom));
    animation: subirHoja .28s cubic-bezier(.2,.8,.3,1);
  }
  @keyframes subirHoja { from { transform: translateY(100%); } }
  .sheet-handle { display: block; width: 42px; height: 5px; border-radius: 3px; background: var(--cream-dark); margin: 0 auto 14px; }
  .sheet-close { top: 18px; right: 14px; }
  .sh-nombre { font-size: 21px; }
  .sh-tiers { margin: 14px 0; }

  .drawer { width: 100%; animation: subirHoja .3s cubic-bezier(.2,.8,.3,1); }
  .dr-head { padding: calc(16px + env(safe-area-inset-top)) 16px 12px; }
}
/* =====================================================================
   MOBILE: las categorías (chips) quedan siempre visibles al scrollear.
   La barra es sticky; JS (ajustarFiltrosFijos) la sube lo justo para que
   el buscador y las opciones se vayan y quede solo la fila de categorías.
   ===================================================================== */
@media (max-width: 820px) {
  .toolbar {
    position: sticky;
    top: var(--topbar-h);
    padding-bottom: 8px;
    box-shadow: 0 8px 18px rgba(61,31,10,.22);
  }
  .chips { margin-top: 10px; padding-bottom: 2px; }
}
