/* === MERCAHORRO — Design System v4 (wireframe fidelity) === */

@import url('https://fonts.googleapis.com/css2?family=Sora:wght@400;600;700;800&family=Plus+Jakarta+Sans:wght@400;500;600;700&family=Caveat:wght@700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  /* ── Wireframe palette ─────────────────── */
  --ink:        #14250a;
  --ink-soft:   #5d6b4d;
  --paper:      #ffffff;
  --cream:      #eef3e6;
  --line:       #1f3d12;
  --accent:     #55A605;
  --accent-deep:#084006;
  --accent-light:#79c81c;
  --tan:        #c5d6a8;
  --brown:      #084006;
  --mute:       #e8efe0;
  --success:    #2a7d4f;
  --danger:     #F23005;
  --orange:     #F29F05;
  --red:        #F23005;

  /* ── Functional aliases ────────────────── */
  --c-primary:  var(--accent);
  --c-bg:       var(--cream);
  --c-surface:  var(--paper);
  --c-text:     var(--ink);
  --c-muted:    var(--ink-soft);
  --c-border:   var(--line);
  --c-success:  var(--success);
  --c-danger:   var(--danger);

  /* ── Shadows ───────────────────────────── */
  --sh:    2px 2px 0 var(--line);
  --sh-lg: 3px 3px 0 var(--line);
  --sh-up: -2px -2px 0 var(--line);

  /* ── Geometry ──────────────────────────── */
  --r-xs:  6px;
  --r-sm:  10px;
  --r:     12px;
  --r-lg:  16px;
  --r-xl:  22px;
  --appbar-h: 52px;
  --nav-h:    62px;
  --sb-h:     0px;

  /* ── Typography ────────────────────────── */
  --font-d: 'Sora', system-ui, sans-serif;
  --font-b: 'Plus Jakarta Sans', system-ui, sans-serif;
  --font-script: 'Caveat', cursive;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;
}

/* ─── RESET ───────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; overflow: hidden; }
body {
  font-family: var(--font-b);
  background: var(--paper);
  color: var(--ink);
  font-size: 14px;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
.hidden { display: none !important; }

/* ─── APPBAR ──────────────────────────────────────────── */
#appbar {
  display: flex; align-items: center;
  height: calc(var(--appbar-h) + var(--sb-h));
  padding: var(--sb-h) 8px 0;
  background: var(--accent);
  border-bottom: 2px solid var(--line);
  color: var(--paper);
  position: fixed; top: 0; left: 0; right: 0;
  z-index: 100;
}
#appbar h1 {
  flex: 1; margin: 0 6px;
  font-family: var(--font-d);
  font-size: 17px; font-weight: 800;
  letter-spacing: -.4px; color: var(--paper);
}
#appbar .icon-btn { color: var(--paper); }
.icon-btn {
  background: transparent; border: 0; color: var(--ink);
  font-size: 20px; padding: 8px 10px; cursor: pointer;
  border-radius: var(--r-sm); line-height: 1;
  transition: background .12s;
}
.icon-btn:active { background: var(--mute); }

/* ─── MAIN VIEW ───────────────────────────────────────── */
main#view {
  position: fixed;
  top: calc(var(--appbar-h) + var(--sb-h)); bottom: var(--nav-h);
  left: 0; right: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  background: var(--paper);
}
main#view.fullscreen { top: 0; bottom: 0; background: var(--paper); }

/* ─── BOTTOM NAV (5 items, FAB floats over center) ────── */
#bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  height: var(--nav-h);
  background: var(--paper);
  border-top: 2px solid var(--line);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  align-items: center;
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.nav-item {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 3px;
  padding: 6px 4px; cursor: pointer;
  -webkit-tap-highlight-color: transparent; position: relative;
}
.nav-icon  {
  width: 22px; height: 22px;
  background: var(--ink-soft);
  -webkit-mask-size: contain;
          mask-size: contain;
  -webkit-mask-repeat: no-repeat;
          mask-repeat: no-repeat;
  -webkit-mask-position: center;
          mask-position: center;
  transition: transform .18s cubic-bezier(.34,1.56,.64,1), background .18s;
  display: block;
}
.nav-item.active .nav-icon { background: var(--accent); }
.nav-icon.ic-home   { -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'><path d='M3 11l9-7 9 7v9a1 1 0 0 1-1 1h-5v-6h-6v6H4a1 1 0 0 1-1-1z'/></svg>"); mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'><path d='M3 11l9-7 9 7v9a1 1 0 0 1-1 1h-5v-6h-6v6H4a1 1 0 0 1-1-1z'/></svg>"); }
.nav-icon.ic-search { -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'><circle cx='11' cy='11' r='6'/><path d='m20 20-4-4'/></svg>"); mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'><circle cx='11' cy='11' r='6'/><path d='m20 20-4-4'/></svg>"); }
.nav-icon.ic-list   { -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'><path d='M8 6h13M8 12h13M8 18h13'/><circle cx='3.5' cy='6' r='1.2'/><circle cx='3.5' cy='12' r='1.2'/><circle cx='3.5' cy='18' r='1.2'/></svg>"); mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'><path d='M8 6h13M8 12h13M8 18h13'/><circle cx='3.5' cy='6' r='1.2'/><circle cx='3.5' cy='12' r='1.2'/><circle cx='3.5' cy='18' r='1.2'/></svg>"); }
.nav-icon.ic-store  { -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'><path d='M3 9l1.5-4h15L21 9M4 9v11h16V9M9 14h6'/></svg>"); mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'><path d='M3 9l1.5-4h15L21 9M4 9v11h16V9M9 14h6'/></svg>"); }
.nav-icon.ic-user   { -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'><circle cx='12' cy='8' r='4'/><path d='M4 21c1-4 5-6 8-6s7 2 8 6'/></svg>"); mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'><circle cx='12' cy='8' r='4'/><path d='M4 21c1-4 5-6 8-6s7 2 8 6'/></svg>"); }
.nav-label { font-size: 9px; font-weight: 700; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .4px; transition: color .18s; }
.nav-item.active .nav-icon  { transform: translateY(-2px) scale(1.1); }
.nav-item.active .nav-label { color: var(--accent); }
.nav-item.active::after {
  content: ''; position: absolute; bottom: 5px;
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--accent);
}
.nav-item:active .nav-icon { transform: scale(.9); }
.nav-item.is-fab-slot { pointer-events: auto; }
.nav-item.is-fab-slot .nav-icon { opacity: 0; }
.nav-item.is-fab-slot .nav-label { display: none; }
.nav-item.is-fab-slot .nav-badge { top: -10px; right: calc(50% - 22px); }

.nav-badge {
  position: absolute; top: 2px; right: calc(50% - 18px);
  background: var(--accent-deep); color: var(--paper);
  border-radius: 10px; font-size: 9px; font-weight: 800;
  min-width: 16px; height: 16px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 4px; border: 1.5px solid var(--line);
}

/* ─── FAB (centered scanner, floats above nav) ────────── */
#fab-scanner {
  position: fixed;
  bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px) - 18px);
  left: 50%; transform: translateX(-50%);
  width: 58px; height: 58px; border-radius: 50%;
  background: var(--accent);
  color: var(--paper); border: 2.5px solid var(--line);
  font-size: 0;
  box-shadow: 0 4px 0 var(--line);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  z-index: 110;
  transition: transform .15s, box-shadow .15s;
}
#fab-scanner::before {
  content: '';
  width: 22px; height: 22px;
  background: var(--paper);
  -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M4 8V5a1 1 0 0 1 1-1h3M20 8V5a1 1 0 0 0-1-1h-3M4 16v3a1 1 0 0 0 1 1h3M20 16v3a1 1 0 0 1-1 1h-3M7 12h10'/></svg>") center/contain no-repeat;
          mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M4 8V5a1 1 0 0 1 1-1h3M20 8V5a1 1 0 0 0-1-1h-3M4 16v3a1 1 0 0 0 1 1h3M20 16v3a1 1 0 0 1-1 1h-3M7 12h10'/></svg>") center/contain no-repeat;
}
#fab-scanner:active {
  transform: translateX(-50%) translateY(3px);
  box-shadow: 0 1px 0 var(--line);
}

/* ─── DRAWER ──────────────────────────────────────────── */
.drawer {
  position: fixed; top: 0; bottom: 0; left: 0;
  width: 280px; background: var(--paper);
  z-index: 200; border-right: 2px solid var(--line);
  box-shadow: 4px 0 0 var(--line);
  transform: translateX(-100%);
  transition: transform .26s cubic-bezier(.4,0,.2,1);
}
.drawer.open { transform: translateX(0); }
.drawer-bg {
  position: fixed; inset: 0; background: rgba(26,22,20,.4); z-index: 190;
}
.drawer-header {
  background: var(--accent);
  border-bottom: 2px solid var(--line);
  padding: 22px 16px 18px;
  display: flex; align-items: center; gap: 14px;
}
.drawer-header img {
  width: 54px; height: 54px; border-radius: 50%;
  border: 2px solid var(--line); object-fit: cover; background: var(--cream);
}
.drawer-header strong { display: block; font-family: var(--font-d); font-size: 15px; color: var(--paper); font-weight: 800; }
.drawer-header small {
  font-size: 11px; color: rgba(253,250,242,.75);
  display: block; margin-top: 2px;
}
.drawer ul { list-style: none; padding: 6px 0; margin: 0; }
.drawer li {
  padding: 13px 18px; cursor: pointer; font-size: 14px; font-weight: 600;
  display: flex; align-items: center; gap: 12px;
  border-bottom: 1px dashed rgba(42,34,29,.2);
  transition: background .12s;
}
.drawer li:active { background: var(--mute); }

/* ─── CARDS / BOXES ───────────────────────────────────── */
.card, .box {
  background: var(--paper);
  border: 2px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--sh);
}
.card { padding: 14px; margin-bottom: 10px; }
.card h2 {
  margin: 0 0 12px;
  font-family: var(--font-d); font-size: 15px; font-weight: 800;
  letter-spacing: -.3px;
}
.box-cream  { background: var(--cream) !important; }
.box-coral  { background: var(--accent) !important; color: var(--paper) !important; }
.box-mute   { background: var(--mute) !important; }

/* ─── PAGE PADDING ────────────────────────────────────── */
.page-pad { padding: 12px 14px; }

/* ─── GRID ────────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }

/* ─── FORMS ───────────────────────────────────────────── */
.field { margin-bottom: 12px; }
.field label {
  display: block; font-size: 10px; font-weight: 700;
  color: var(--ink-soft); margin-bottom: 5px;
  text-transform: uppercase; letter-spacing: .6px;
}
.field input, .field select, .field textarea {
  width: 100%; padding: 11px 13px;
  border: 2px solid var(--line); border-radius: var(--r);
  font-size: 14px; font-family: var(--font-b);
  background: var(--paper); color: var(--ink);
  box-shadow: var(--sh);
  transition: border-color .15s;
  -webkit-appearance: none; appearance: none;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--accent); outline: none;
  box-shadow: 2px 2px 0 var(--accent);
}
.field-box {
  padding: 10px 12px; cursor: pointer;
}
.field-box .lbl-xs { font-size: 10px; color: var(--ink-soft); letter-spacing: .5px; text-transform: uppercase; margin-bottom: 3px; }
.field-box .lbl    { font-size: 14px; font-weight: 500; }

/* ─── BUTTONS ─────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--paper); color: var(--ink);
  padding: 11px 18px; border: 2px solid var(--line); border-radius: var(--r);
  font-size: 14px; font-weight: 700; font-family: var(--font-b);
  cursor: pointer; width: 100%; letter-spacing: -.2px;
  box-shadow: var(--sh);
  transition: transform .1s, box-shadow .1s;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: translate(2px,2px); box-shadow: none; }
.btn.coral  { background: var(--accent); color: var(--paper); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.outline { background: transparent; box-shadow: none; border-color: var(--line); }
.btn.outline:active { background: var(--mute); }
.btn.sm { padding: 7px 12px; font-size: 12px; width: auto; }
.btn-row { display: flex; gap: 8px; }

/* ─── SEARCH INPUT (hero style) ──────────────────────── */
.search-wrap { position: relative; }
.search-wrap input {
  width: 100%; padding: 11px 13px 11px 40px;
  border: 2px solid var(--line); border-radius: var(--r);
  font-size: 14px; font-family: var(--font-b);
  background: var(--paper); color: var(--ink);
  box-shadow: var(--sh); outline: none;
}
.search-wrap input:focus { border-color: var(--accent); box-shadow: 2px 2px 0 var(--accent); }
.search-icon {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--ink-soft); font-size: 15px; pointer-events: none;
}

/* ─── CHIPS ───────────────────────────────────────────── */
.chip {
  display: inline-flex; align-items: center;
  border: 1.5px solid var(--line); border-radius: 999px;
  padding: 4px 11px; font-size: 11px; font-weight: 600;
  background: var(--paper); cursor: pointer;
  white-space: nowrap;
  transition: all .12s;
}
.chip.active, .chip.coral { background: var(--accent); color: var(--paper); border-color: var(--line); }
.chip.cream  { background: var(--danger); color: var(--paper); }
.chip.mute   { background: var(--mute); }
.chip:active { transform: scale(.95); }

.chips-row {
  display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none;
  padding: 0 14px 4px;
}
.chips-row::-webkit-scrollbar { display: none; }

/* ─── BANNER SLIDER ───────────────────────────────────── */
.slider-wrap { margin-bottom: 10px; }
.slider {
  position: relative; width: 100%; aspect-ratio: 16/9; margin: 0 auto;
  overflow: hidden; border-radius: var(--r);
  background: linear-gradient(135deg, var(--accent), var(--accent-deep)); border: 2px solid var(--line);
  box-shadow: var(--sh);
}
.slider-track { display: flex; height: 100%; transition: transform .4s cubic-bezier(.25,.46,.45,.94); }
.slider-slide {
  flex: 0 0 100%; height: 100%;
  background-size: cover; background-position: 40% center;
  background-color: var(--accent);
  position: relative;
}
.slider-slide-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(26,22,20,.55) 0%, transparent 55%);
  display: flex; align-items: flex-end; padding: 8px 10px;
}
.slider-slide-content { color: var(--paper); font-weight: 700; font-size: 12px; }
.slider-arrow {
  position: absolute; top: 50%; transform: translateY(-50%);
  z-index: 10; background: rgba(255,255,255,0.88); border: 2px solid var(--line);
  border-radius: 50%; width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 700; color: var(--ink);
  cursor: pointer; box-shadow: var(--sh); padding: 0; line-height: 1;
}
.slider-arrow-prev { left: 8px; }
.slider-arrow-next { right: 8px; }
.slider-arrow:active { background: var(--cream); }
.dotnav { display: flex; gap: 5px; justify-content: center; margin-top: 6px; }
.dotnav i { width: 6px; height: 6px; border-radius: 50%; background: rgba(42,34,29,.25); display: block; border: 1px solid var(--line); transition: all .3s; }
.dotnav i.on { background: var(--accent); width: 18px; border-radius: 3px; }

/* ─── LIST ITEMS ──────────────────────────────────────── */
.list-item {
  display: flex; gap: 10px; padding: 10px 12px;
  background: var(--paper); border-radius: var(--r);
  border: 2px solid var(--line); box-shadow: var(--sh);
  margin-bottom: 8px; align-items: center;
  cursor: pointer; transition: transform .1s, box-shadow .1s;
}
.list-item:active { transform: translate(2px,2px); box-shadow: none; }
.list-item img {
  width: 52px; height: 52px; border-radius: var(--r-sm);
  object-fit: cover; background: var(--mute); flex-shrink: 0;
  border: 1.5px solid var(--line);
}
.list-item .li-body  { flex: 1; min-width: 0; }
.list-item .li-title { font-weight: 700; font-size: 13px; margin-bottom: 2px; }
.list-item .li-sub   { color: var(--ink-soft); font-size: 11px; line-height: 1.3; }
.list-item .li-price {
  color: var(--ink); font-weight: 800; font-size: 16px;
  font-family: var(--font-d); white-space: nowrap; letter-spacing: -.5px;
}

/* ─── RANKING CARDS ───────────────────────────────────── */
.rank-card {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; background: var(--paper);
  border: 2px solid var(--line); border-radius: var(--r);
  box-shadow: var(--sh); margin-bottom: 8px;
  cursor: pointer; transition: transform .1s, box-shadow .1s;
}
.rank-card:active    { transform: translate(2px,2px); box-shadow: none; }
.rank-card.is-best   { border-color: var(--accent); border-width: 2.5px; background: var(--cream); }
.rank-num {
  font-family: var(--font-d); font-size: 26px; font-weight: 800;
  color: var(--ink-soft); width: 26px; text-align: center; flex-shrink: 0;
}
.rank-card.is-best .rank-num { color: var(--accent-deep); }
.rank-body { flex: 1; min-width: 0; }
.rank-store { font-weight: 700; font-size: 14px; }
.rank-meta  { font-size: 11px; color: var(--ink-soft); margin-top: 1px; }
.rank-right { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex-shrink: 0; }
.rank-price { font-family: var(--font-d); font-size: 17px; font-weight: 800; letter-spacing: -.5px; }
.rank-card.is-best .rank-price { color: var(--accent-deep); }
.rank-amount {
  font-family: var(--font-d); font-size: 17px; font-weight: 800;
  letter-spacing: -.5px; display: block;
}
.rank-card.is-best .rank-amount { color: var(--accent-deep); }

/* ─── BADGES ──────────────────────────────────────────── */
.best-badge {
  display: inline-block;
  background: var(--accent-deep); color: var(--paper);
  border: 1.5px solid var(--line);
  border-radius: 999px; padding: 2px 8px;
  font-size: 9px; font-weight: 800; letter-spacing: .6px;
  text-transform: uppercase; margin-top: 3px;
}
.savings-tag {
  background: var(--danger); color: var(--paper);
  padding: 3px 9px; border-radius: var(--r-xs);
  font-size: 11px; font-weight: 800;
  border: 1.5px solid var(--line);
  display: inline-block; transform: rotate(-2deg);
  flex-shrink: 0;
}
.badge         { background: var(--accent); color: var(--paper); padding: 3px 10px; border-radius: 50px; font-size: 10px; font-weight: 800; letter-spacing: .3px; text-transform: uppercase; display: inline-flex; }
.badge.gold    { background: linear-gradient(135deg, #FFD700, #FFA500); color: #3a2800; }
.badge.silver  { background: linear-gradient(135deg, #E0E0E0, #B0B0B0); color: #333; }
.badge.green   { background: var(--success); color: #fff; }

/* ─── SECTION HEADER ──────────────────────────────────── */
.section-header {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px;
}
.section-header h2 {
  font-family: var(--font-d); font-size: 14px; font-weight: 800;
  margin: 0; text-transform: uppercase;
  letter-spacing: .2px; color: var(--ink-soft);
}
.section-header .see-all { font-size: 12px; color: var(--accent); font-weight: 700; cursor: pointer; }

/* ─── HOME HEADING ────────────────────────────────────── */
.home-title {
  font-family: var(--font-d); font-size: 24px; font-weight: 800;
  letter-spacing: -.6px; line-height: 1.1; margin: 0 0 10px;
  color: var(--ink);
}
.sketchy-underline {
  background-image: linear-gradient(var(--accent), var(--accent));
  background-repeat: no-repeat; background-size: 100% 5px;
  background-position: 0 90%; padding: 0 2px;
}

/* ─── PROMO CARD (horizontal scroll) ─────────────────── */
.promo-scroll {
  display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none;
  padding-bottom: 4px;
}
.promo-scroll::-webkit-scrollbar { display: none; }
.promo-card {
  width: 100px; flex-shrink: 0;
  background: var(--paper); border: 2px solid var(--line);
  border-radius: var(--r); box-shadow: var(--sh); padding: 8px;
  cursor: pointer;
}
.promo-card img, .promo-card .promo-img {
  width: 100%; aspect-ratio: 1; border-radius: var(--r-sm);
  object-fit: cover; background: var(--mute);
  border: 1.5px solid var(--line); margin-bottom: 6px;
}
.promo-card .promo-name { font-size: 11px; font-weight: 600; line-height: 1.2; margin-bottom: 4px; }

/* ─── SAVINGS BOX ─────────────────────────────────────── */
.savings-box {
  background: var(--cream); border: 2px solid var(--line);
  border-radius: var(--r); box-shadow: var(--sh); padding: 12px 14px; margin-bottom: 10px;
}
.savings-box .sb-label { font-size: 10px; text-transform: uppercase; letter-spacing: .5px; color: var(--ink-soft); margin-bottom: 4px; }
.savings-box .sb-amount {
  font-family: var(--font-d); font-size: 28px; font-weight: 800;
  letter-spacing: -1px; color: var(--accent-deep);
}
.savings-box .sb-sub { font-size: 11px; color: var(--ink-soft); margin-top: 2px; }

/* ─── SHORTCUT GRID ───────────────────────────────────── */
.shortcut-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.shortcut-btn {
  background: var(--paper); border: 2px solid var(--line);
  border-radius: var(--r); box-shadow: var(--sh);
  padding: 16px 6px; text-align: center;
  cursor: pointer; transition: transform .1s, box-shadow .1s;
}
.shortcut-btn:active { transform: translate(2px,2px); box-shadow: none; }
.shortcut-icon  { font-size: 26px; display: block; margin-bottom: 6px; }
.shortcut-label { font-size: 10px; font-weight: 700; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .3px; }

/* ─── COMPARISON RESULT ───────────────────────────────── */
.cmp-winner {
  background: var(--cream); border: 2px solid var(--line);
  border-radius: var(--r); box-shadow: var(--sh); padding: 12px 14px; margin-bottom: 10px;
}
.cmp-winner .cw-label { font-size: 10px; text-transform: uppercase; letter-spacing: .5px; color: var(--ink-soft); margin-bottom: 4px; }
.cmp-winner .cw-store { font-family: var(--font-d); font-size: 18px; font-weight: 800; color: var(--accent-deep); }
.cmp-winner .cw-price { font-family: var(--font-d); font-size: 26px; font-weight: 800; letter-spacing: -1px; }
.cmp-winner .cw-saving { color: var(--ink-soft); font-size: 12px; margin-top: 4px; }

.route-card {
  background: var(--paper); border: 2px solid var(--line);
  border-radius: var(--r); box-shadow: var(--sh); padding: 12px; margin-bottom: 10px;
}
.route-card .rc-head {
  display: flex; align-items: center; gap: 10px;
  padding-bottom: 10px; border-bottom: 1.5px dashed rgba(42,34,29,.25); margin-bottom: 8px;
}
.rc-num  { font-family: var(--font-d); font-size: 28px; font-weight: 800; color: var(--ink-soft); width: 28px; }
.rc-name { font-weight: 800; font-size: 15px; }
.rc-addr { font-size: 11px; color: var(--ink-soft); margin-top: 1px; }
.rc-total{ font-family: var(--font-d); font-weight: 800; font-size: 18px; margin-left: auto; color: var(--accent-deep); }
.rc-item {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 0; border-bottom: 1px dashed rgba(42,34,29,.18);
}
.rc-item:last-child { border-bottom: 0; padding-bottom: 0; }
.rc-item img { width: 36px; height: 36px; border-radius: var(--r-xs); object-fit: cover; background: var(--mute); border: 1.5px solid var(--line); }
.rc-item-name  { flex: 1; font-size: 12px; font-weight: 600; }
.rc-item-qty   { font-size: 11px; color: var(--ink-soft); }
.rc-item-price { font-weight: 800; font-size: 13px; font-family: var(--font-d); }

/* ─── PRICE BARS ──────────────────────────────────────── */
.price-bar-wrap { margin-top: 6px; }
.price-bar { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.price-bar-label { flex: 0 0 80px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-soft); font-size: 11px; font-weight: 600; }
.price-bar-track { flex: 1; height: 10px; background: var(--mute); border: 1.5px solid var(--line); border-radius: var(--r-xs); overflow: hidden; }
.price-bar-fill  { height: 100%; background: var(--accent); transition: width .6s cubic-bezier(.4,0,.2,1); }
.price-bar-fill.best  { background: var(--success); }
.price-bar-val { flex: 0 0 68px; text-align: right; font-weight: 800; font-size: 13px; font-family: var(--font-d); }

/* ─── QTY CONTROL ─────────────────────────────────────── */
.qty { display: inline-flex; align-items: center; gap: 8px; }
.qty button {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--paper); color: var(--ink); border: 2px solid var(--line);
  font-size: 16px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; line-height: 1;
  transition: transform .1s, box-shadow .1s;
  box-shadow: var(--sh);
}
.qty button:active { transform: translate(2px,2px); box-shadow: none; }
.qty span { min-width: 26px; text-align: center; font-weight: 800; font-size: 15px; font-family: var(--font-d); }

/* ─── AUTH SCREENS ────────────────────────────────────── */
.auth-screen {
  position: fixed; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 20px;
  background: var(--cream);
  overflow-y: auto;
  z-index: 200;
}
.auth-logo-ring {
  width: 88px; height: 88px; border-radius: 50%;
  background: var(--paper); border: 2.5px solid var(--line);
  box-shadow: var(--sh-lg);
  display: flex; align-items: center; justify-content: center;
  font-size: 40px; margin-bottom: 12px;
}
.auth-logo-title {
  font-family: var(--font-d); font-size: 34px; font-weight: 800;
  text-align: center; line-height: 1; margin-bottom: 6px;
  letter-spacing: -1px;
}
.auth-logo-title span { color: var(--accent); }
.auth-logo-sub { font-size: 13px; color: var(--ink-soft); text-align: center; margin-bottom: 24px; }
.auth-form { width: 100%; max-width: 340px; }
.link-text { text-align: center; margin-top: 12px; color: var(--accent); cursor: pointer; font-weight: 700; font-size: 13px; }

/* ─── PROFILE ─────────────────────────────────────────── */
.profile-card {
  background: var(--accent); border: 2px solid var(--line);
  border-radius: var(--r); box-shadow: var(--sh-lg);
  padding: 16px; color: var(--paper); margin-bottom: 12px;
}
.profile-card .pc-name { font-family: var(--font-d); font-size: 22px; font-weight: 800; margin-bottom: 2px; }
.profile-card .pc-sub  { font-size: 12px; opacity: .75; margin-bottom: 12px; }
.profile-card .pc-stats {
  display: flex; gap: 0;
  border-top: 1.5px dashed rgba(253,250,242,.4); padding-top: 10px; margin-top: 8px;
}
.pc-stat { flex: 1; text-align: center; }
.pc-stat-val { font-family: var(--font-d); font-size: 22px; font-weight: 800; display: block; }
.pc-stat-lbl { font-size: 10px; opacity: .7; text-transform: uppercase; letter-spacing: .4px; }

.menu-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 13px 4px; border-bottom: 1px dashed rgba(42,34,29,.2);
  cursor: pointer; font-size: 14px; font-weight: 600;
}
.menu-row:last-child { border-bottom: 0; }
.menu-row:active { color: var(--accent); }

/* ─── FACTURA UPLOAD AREA ─────────────────────────────── */
.fc-upload-area {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  border: 2px dashed var(--line); border-radius: var(--r);
  padding: 28px 16px; cursor: pointer; gap: 4px;
  background: var(--cream); transition: background .15s; text-decoration: none;
  min-height: 100px;
}
.fc-upload-area:active { background: var(--mute); }
.fc-upload-icon  { font-size: 32px; line-height: 1; }
.fc-upload-label { font-size: 14px; font-weight: 700; color: var(--ink); }

/* ─── FACTURA ROWS ────────────────────────────────────── */
.fai-row {
  background: var(--paper); border: 2px solid var(--line);
  border-radius: var(--r); padding: 10px; box-shadow: var(--sh); margin-bottom: 8px;
}
.fai-row.matched   { border-left: 4px solid var(--success); }
.fai-row.revisar   { border-left: 4px solid #f0c34a; }
.fai-row.unmatched { border-left: 4px solid var(--accent); }

/* Select de tienda que aún requiere selección explícita */
#fc-tie.fc-need { border-color: var(--accent); background: #fff5f2; }

/* ─── AUTOCOMPLETE PRODUCTO (factura) ─────────────────── */
.fc-ac-box { position: relative; }
.fc-ac-input { width: 100%; }
.fc-ac-results {
  position: absolute; top: calc(100% + 2px); left: 0; right: 0;
  background: var(--paper); border: 2px solid var(--line);
  border-radius: var(--r-sm); box-shadow: var(--sh);
  max-height: 220px; overflow-y: auto; z-index: 50;
}
.fc-ac-item {
  padding: 9px 12px; font-size: 13px; line-height: 1.3;
  cursor: pointer; border-bottom: 1px solid rgba(31,61,18,.12);
}
.fc-ac-item:last-child { border-bottom: 0; }
.fc-ac-item:hover, .fc-ac-item:active { background: rgba(31,61,18,.08); }
.fc-ac-empty {
  padding: 10px 12px; font-size: 12px; color: var(--ink-soft); text-align: center;
}

/* ─── DOTTED DIVIDER ──────────────────────────────────── */
.dotted-divider { height: 0; border-top: 1.5px dashed rgba(42,34,29,.25); margin: 8px 0; }

/* ─── TOAST ───────────────────────────────────────────── */
.toast {
  position: fixed; bottom: calc(var(--nav-h) + 12px); left: 50%;
  transform: translateX(-50%);
  background: var(--ink); color: var(--paper);
  padding: 10px 20px; border-radius: var(--r); z-index: 300;
  font-size: 13px; font-weight: 700; box-shadow: var(--sh);
  white-space: nowrap; max-width: calc(100vw - 32px);
  border: 2px solid var(--line);
}

/* ─── LOADER ──────────────────────────────────────────── */
.loader {
  position: fixed; inset: 0; background: rgba(253,250,242,.6);
  display: flex; align-items: center; justify-content: center;
  z-index: 250;
}
.spinner {
  width: 40px; height: 40px;
  border: 3px solid var(--mute); border-top-color: var(--accent);
  border-radius: 50%; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── SKELETON ────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--mute) 25%, var(--cream) 50%, var(--mute) 75%);
  background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: var(--r-sm);
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ─── EMPTY STATE ─────────────────────────────────────── */
.empty { text-align: center; color: var(--ink-soft); padding: 36px 20px; font-size: 13px; line-height: 1.6; }
.empty-icon { font-size: 48px; display: block; margin-bottom: 10px; opacity: .4; }

/* ─── PAGE TRANSITION ─────────────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
.page-enter { animation: fadeUp .2s ease both; }

/* ─── UTILITY ─────────────────────────────────────────── */
.row    { display: flex; align-items: center; }
.col    { display: flex; flex-direction: column; }
.between{ justify-content: space-between; }
.gap-4  { gap: 4px; } .gap-6 { gap: 6px; } .gap-8 { gap: 8px; }
.gap-10 { gap: 10px; } .gap-12 { gap: 12px; }
.fw-800 { font-weight: 800; } .fw-600 { font-weight: 600; }
.font-d { font-family: var(--font-d); }
.font-script { font-family: var(--font-script); }
.text-accent { color: var(--accent); }
.text-muted  { color: var(--ink-soft); }
.text-success{ color: var(--success); }
.mb-0   { margin-bottom: 0; }

/* ─── WIREFRAME PRIMITIVES (hand-h, lbl, ph, note) ─────── */
.hand-h {
  font-family: var(--font-d);
  font-weight: 800;
  letter-spacing: -.025em;
  line-height: 1.0;
  color: var(--ink);
}
.lbl    { font-family: var(--font-b); font-size: 13px; line-height: 1.3; font-weight: 500; }
.lbl-sm { font-size: 11px; color: var(--ink-soft); line-height: 1.3; }
.lbl-xs { font-size: 10px; color: var(--ink-soft); letter-spacing: .5px; text-transform: uppercase; font-weight: 700; }
.ph {
  background:
    repeating-linear-gradient(45deg,
      rgba(42,34,29,.08) 0 6px,
      transparent 6px 12px);
  border: 1.5px dashed var(--line);
  border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  color: var(--ink-soft);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: .5px;
  text-align: center;
  padding: 4px;
}
.tienda-avatar {
  width: 44px; height: 44px;
  flex-shrink: 0;
  border-radius: var(--r-sm);
  background: var(--accent);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  font-weight: 800;
  line-height: 1;
  font-family: var(--font-b);
  letter-spacing: -.02em;
}
.note {
  font-family: var(--font-d);
  font-weight: 700;
  color: var(--accent-deep);
  font-size: 14px;
  line-height: 1.1;
}

/* ─── AUTH LOGO (wireframe OnbA style) ──────────────── */
.auth-brand {
  font-family: var(--font-d);
  font-weight: 800;
  font-size: 38px;
  line-height: .95;
  text-align: center;
  letter-spacing: -1.5px;
  color: var(--ink);
}
.auth-brand .puntot {
  display: block;
  font-family: var(--font-script);
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0;
  font-size: 1.15em;
  line-height: 1;
  margin-top: -4px;
}

/* ─── ONBOARDING PROGRESS BARS ─────────────────────── */
.onb-bars { display: flex; gap: 4px; margin-bottom: 6px; }
.onb-bars i {
  flex: 1; height: 5px; border-radius: 3px;
  background: var(--mute);
  border: 1px solid var(--line);
  display: block;
}
.onb-bars i.on { background: var(--accent); border-color: var(--line); }

/* ─── CIRCULAR LOGO RING (small) ─────────────────────── */
.logo-circle {
  width: 92px; height: 92px; border-radius: 50%;
  border: 2.5px solid var(--line);
  background: var(--paper);
  box-shadow: var(--sh-lg);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto;
}

/* ─── HERO SEARCH HEADING ───────────────────────────── */
.hero-q {
  font-family: var(--font-d);
  font-weight: 800;
  font-size: 26px;
  line-height: 1.05;
  letter-spacing: -.6px;
  color: var(--ink);
  margin: 0 0 10px;
}
.hero-q .sketchy-underline {
  background-image: linear-gradient(var(--accent), var(--accent));
  background-repeat: no-repeat;
  background-size: 100% 5px;
  background-position: 0 92%;
  padding: 0 2px;
}

/* ─── PIN / LOCATION HEADER ────────────────────────── */
.loc-pin {
  display: inline-flex; align-items: center; gap: 4px;
  font-weight: 700; font-size: 14px;
}
.loc-pin svg { color: var(--accent); }

/* ═══════════ DESKTOP LAYOUT (≥1024px) ═══════════════════ */
:root {
  --d-topbar-h: 64px;
  --d-sidebar-w: 220px;
  --d-content-max: 1100px;
}

.dtopbar { display: none; }
.dsidebar { display: none; }

@media (min-width: 1024px) {
  html, body { overflow: auto; }

  /* Hide mobile chrome */
  #appbar, #bottom-nav, #fab-scanner { display: none !important; }

  /* Topbar */
  .dtopbar {
    display: block;
    position: fixed; top: 0; left: 0; right: 0; height: var(--d-topbar-h);
    background: var(--accent);
    border-bottom: 2px solid var(--line);
    z-index: 120;
  }
  .dtopbar-inner {
    max-width: 1280px; margin: 0 auto;
    height: 100%;
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 24px;
  }
  .dlogo {
    font-family: var(--font-d);
    font-size: 22px; font-weight: 800;
    letter-spacing: -.5px; cursor: pointer;
    color: var(--paper);
  }
  .dlogo .dot { color: var(--orange); }
  .dtopbar-right { display: flex; align-items: center; gap: 10px; }
  .davatar {
    width: 32px; height: 32px; border-radius: 50%;
    border: 2px dashed var(--line);
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 700; color: var(--ink-soft);
    background: var(--paper); cursor: pointer;
  }

  /* Sidebar */
  .dsidebar {
    display: block;
    position: fixed;
    top: var(--d-topbar-h);
    left: max(0px, calc((100% - 1280px) / 2 + 24px));
    width: var(--d-sidebar-w);
    padding: 24px 0 24px 0;
    z-index: 110;
  }
  .dsidebar ul { list-style: none; margin: 0; padding: 0; }
  .dsidebar li {
    font-family: var(--font-b);
    font-size: 14px; font-weight: 600; color: var(--ink);
    padding: 8px 12px; margin-bottom: 2px;
    border-radius: 8px; cursor: pointer;
    transition: background .15s;
  }
  .dsidebar li:hover { background: var(--mute); }
  .dsidebar li.active { background: var(--cream); font-weight: 800; }

  /* Main view */
  main#view {
    position: static;
    margin: 0 auto;
    padding-top: var(--d-topbar-h);
    padding-left: calc(max(0px, (100vw - 1280px) / 2) + 24px + var(--d-sidebar-w) + 24px);
    padding-right: calc(max(0px, (100vw - 1280px) / 2) + 24px);
    max-width: 100vw;
    min-height: 100vh;
    background: var(--paper);
    overflow: visible;
  }
  main#view.fullscreen {
    padding-top: 0;
    padding-left: 0;
    padding-right: 0;
  }
  /* Auth screens: handled by position:fixed on .auth-screen base rule */

  /* Page padding wider on desktop */
  .page-pad { padding: 24px 0; max-width: var(--d-content-max); }

  /* Toast: no bottom-nav on desktop, align to viewport bottom */
  .toast { bottom: 20px; }

  /* Home: rework for desktop panel */
  body.is-desktop .d-mobile-only { display: none !important; }

  /* Banner full-width hero */
  body.is-desktop #home-slider .slider { max-width: 640px; }

  /* Mi panel (desktop) */
  .d-panel-head {
    display: flex; align-items: center; justify-content: space-between;
    margin: 10px 0 14px;
  }
  .d-panel-head h2 {
    font-family: var(--font-d); font-size: 28px; font-weight: 800;
    margin: 0; letter-spacing: -.6px;
  }
  .d-panel-actions { display: flex; gap: 8px; }
  .d-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 18px;
  }
  .d-stat {
    background: var(--paper);
    border: 2px solid var(--line);
    border-radius: var(--r);
    box-shadow: var(--sh);
    padding: 16px 18px;
  }
  .d-stat-val {
    font-family: var(--font-d); font-size: 30px; font-weight: 800;
    letter-spacing: -.8px; line-height: 1; color: var(--ink);
    margin-bottom: 6px;
  }
  .d-stat-lbl { font-size: 11px; color: var(--ink-soft); font-weight: 600; }

  /* Top ahorros grid on desktop */
  body.is-desktop #home-top-ahorros {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px;
  }
  body.is-desktop #home-top-ahorros .list-item { margin-bottom: 0; }

  /* Hide mobile home sections we replace with panel */
  body.is-desktop #home-hero,
  body.is-desktop #home-cats-header,
  body.is-desktop #home-cats,
  body.is-desktop .shortcut-grid,
  body.is-desktop #home-pin-row,
  body.is-desktop #home-search-wrap,
  body.is-desktop #home-savings { display: none; }
  body.is-desktop #home-main-bottom .section-header h2 { display: none; }
  body.is-desktop #home-main-bottom .section-header .see-all { font-size: 13px; }

  /* Search wrap on desktop: wider, less prominent (moved into topbar later if needed) */
  body.is-desktop .search-wrap { max-width: 520px; }
}

/* Always hide desktop-only on non-desktop */
body:not(.is-desktop) .d-desktop-only { display: none !important; }

/* ── PERFIL REDISEÑO ─────────────────────────────────────── */
.pf-header { display:flex; justify-content:space-between; align-items:center; margin-bottom:16px; }
.pf-user-row { display:flex; align-items:center; gap:12px; margin-bottom:14px; }
.pf-avatar-circle { width:64px; height:64px; border-radius:50%; background:var(--mute); border:2px solid var(--line); display:flex; align-items:center; justify-content:center; font-size:26px; font-weight:800; overflow:hidden; flex-shrink:0; cursor:pointer; }
.pf-stats-grid { display:grid; grid-template-columns:1fr 1fr; gap:8px; margin-bottom:16px; }
.pf-stat-box { background:var(--cream); border:2px solid var(--line); border-radius:var(--r); padding:10px; text-align:center; box-shadow:var(--sh); }
.pf-stat-val { font-family:var(--font-d); font-size:26px; font-weight:800; letter-spacing:-.5px; }
.pf-stat-lbl { font-size:11px; color:var(--ink-soft); margin-top:2px; }
.pf-menu-row { display:flex; justify-content:space-between; align-items:center; padding:11px 4px; border-bottom:1px dashed rgba(42,34,29,.2); cursor:pointer; }
.pf-menu-row:active { background:var(--cream); }

/* ── BÚSQUEDA SearchC ────────────────────────────────────── */
.best-option-box { background:var(--cream); border:2px solid var(--line); border-radius:var(--r); padding:10px 12px; margin-bottom:12px; box-shadow:var(--sh); }
.other-options-row { display:flex; justify-content:space-between; align-items:center; padding:8px 2px; border-bottom:1px dashed rgba(42,34,29,.2); }

/* ── RANK CARD (DetailRanking) — unified with main .rank-card above */

/* ── ADMIN DASHBOARD ──────────────────────────────────────── */

.admin-tabs {
  display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 4px;
}
.admin-tab {
  padding: 6px 14px; border-radius: 20px; border: 2px solid var(--line);
  background: transparent; font-size: 13px; font-family: var(--font-b);
  cursor: pointer; color: var(--ink-soft);
  transition: background .12s, color .12s, box-shadow .12s;
}
.admin-tab:hover { background: var(--mute); color: var(--ink); }
.admin-tab.active {
  background: var(--accent); color: var(--paper);
  border-color: var(--line); box-shadow: var(--sh);
}

.admin-table-wrap { overflow-x: auto; border-radius: var(--r); border: 2px solid var(--line); box-shadow: var(--sh); }
.admin-table {
  width: 100%; border-collapse: collapse; font-size: 13px;
}
.admin-table th {
  padding: 10px 12px; text-align: left; font-size: 10px; font-weight: 700;
  letter-spacing: .06em; text-transform: uppercase; color: var(--ink-soft);
  border-bottom: 2px solid var(--line); background: var(--cream);
}
.admin-table td {
  padding: 10px 12px; border-bottom: 1px solid rgba(42,34,29,.15); vertical-align: middle;
}
.admin-table tr:last-child td { border-bottom: 0; }
.admin-table tr:hover td { background: var(--cream); }

.inline-inp {
  border: 0; background: transparent; font-family: var(--font-b);
  font-size: 13px; color: var(--ink); width: 100%; outline: none;
  border-bottom: 1px solid transparent;
}
.inline-inp:focus { border-bottom-color: var(--accent); }

.role-badge {
  display: inline-block; padding: 2px 8px; border-radius: 20px;
  font-size: 10px; font-weight: 700; letter-spacing: .04em;
}
.badge-ok  { background: #d1fae5; color: #065f46; }
.badge-off { background: #fee2e2; color: #991b1b; }

.rol-sel {
  border: 2px solid var(--line); border-radius: var(--r-xs); padding: 3px 8px;
  font-size: 12px; font-family: var(--font-b); color: var(--ink);
  background: var(--paper); cursor: pointer;
}

.admin-table select {
  border: 2px solid var(--line); border-radius: var(--r-xs); padding: 3px 8px;
  font-size: 12px; color: var(--ink); background: var(--paper);
  font-family: var(--font-b); cursor: pointer;
}

/* === City Picker Overlay === */
.city-overlay {
  position: fixed; inset: 0; z-index: 3000;
  background: rgba(26,22,20,.55);
  display: flex; align-items: flex-end; justify-content: center;
}
.city-modal {
  background: var(--paper); width: 100%; max-height: 75vh;
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  border: 2px solid var(--line); border-bottom: 0;
  display: flex; flex-direction: column;
  box-shadow: var(--sh-lg);
}
.city-modal-hdr {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 20px 12px; border-bottom: 2px solid var(--mute);
  font-family: var(--font-d); font-weight: 700; font-size: 15px;
}
.city-search-inp {
  margin: 12px 16px 8px;
  border: 2px solid var(--line); border-radius: var(--r);
  padding: 10px 12px; font-size: 14px; font-family: var(--font-b);
  color: var(--ink); background: var(--cream); width: calc(100% - 32px);
  box-sizing: border-box; outline: none;
  transition: border-color .15s;
}
.city-search-inp:focus { border-color: var(--accent); box-shadow: 2px 2px 0 var(--accent); }
.city-list { overflow-y: auto; flex: 1; }
.city-opt {
  padding: 12px 20px; border-bottom: 1px solid rgba(42,34,29,.1);
  cursor: pointer; font-size: 14px; font-family: var(--font-b);
  transition: background .1s;
}
.city-opt:hover { background: var(--mute); }
.city-opt:active, .city-opt.selected { background: var(--cream); font-weight: 600; }

/* ── Desktop city popover (anchored to chip) ─────────────── */
.city-popover-backdrop {
  position: fixed; inset: 0; z-index: 3000;
  background: transparent;
}
.city-popover {
  position: fixed; z-index: 3001;
  width: 300px;
  background: var(--paper);
  border: 2px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: 4px 4px 0 var(--line);
  display: flex; flex-direction: column;
  max-height: 420px;
  overflow: hidden;
  animation: fadeUp .15s ease both;
}
.city-popover .city-search-inp {
  margin: 10px 12px 6px;
  width: calc(100% - 24px);
}
.city-popover .city-list { flex: 1; overflow-y: auto; }
.city-popover .city-opt {
  padding: 9px 16px; font-size: 13px;
}

/* === Tienda product row action buttons === */
.td-prod-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 0; border-bottom: 1px solid var(--mute);
}
.td-prod-row:last-child { border-bottom: 0; }
.td-prod-img { width: 44px; height: 44px; border-radius: var(--r-sm); object-fit: cover; flex-shrink: 0; }
.td-prod-body { flex: 1; min-width: 0; }
.td-prod-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.td-prod-date { font-size: 11px; color: var(--ink-soft); }
.td-prod-price { font-size: 14px; font-weight: 700; flex-shrink: 0; }
.td-prod-actions { display: flex; gap: 5px; flex-shrink: 0; }
.td-act-btn {
  width: 32px; height: 32px; border-radius: 50%; border: 1.5px solid var(--line);
  background: var(--cream); cursor: pointer; font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s;
}
.td-act-btn:active { background: var(--mute); }
.td-act-btn.coral { background: var(--accent); color: #fff; border-color: var(--accent); }

/* === Rank card add button === */
.rank-add-btn {
  width: 28px; height: 28px; border-radius: 50%; border: 1.5px solid var(--line);
  background: var(--cream); cursor: pointer; font-size: 16px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; margin-top: 3px; transition: background .15s;
}
.rank-add-btn:active { background: var(--accent); color: var(--paper); border-color: var(--accent); }

/* === Precio preferida chip (comparar resultado) === */
.rc-pref-chip {
  font-size: 11px; color: var(--ink-soft);
  background: var(--cream); border: 1px solid var(--line);
  border-radius: 6px; padding: 5px 8px; margin: 2px 0 6px;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.rc-pref-btn {
  font-size: 11px; font-weight: 600; padding: 3px 10px;
  border: 1.5px solid var(--accent); border-radius: 12px;
  background: transparent; color: var(--accent);
  cursor: pointer; white-space: nowrap;
}
.rc-pref-btn:active { background: var(--accent); color: var(--paper); }

/* === Modal de ruta de compras (mapa) === */
.ruta-modal {
  position: fixed; inset: 0; z-index: 9999;
  background: var(--paper); display: flex; flex-direction: column;
  transform: translateY(100%);
  transition: transform .38s cubic-bezier(.25,.8,.2,1);
}
.ruta-modal.is-open { transform: translateY(0); }
.ruta-hdr {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px 12px; border-bottom: 1.5px solid var(--line); flex-shrink: 0;
}
.ruta-hdr-title {
  flex: 1; font-family: var(--font-d); font-size: 18px; font-weight: 700; margin: 0;
}
.ruta-hdr-stats { font-size: 11px; color: var(--ink-soft); text-align: right; line-height: 1.5; }
.ruta-close-btn {
  background: none; border: none; cursor: pointer;
  font-size: 22px; color: var(--ink); padding: 2px 8px;
  border-radius: 6px; line-height: 1;
}
#_ruta-map-el { flex: 0 0 42vh; background: var(--mute); z-index: 0; min-height: 200px; }
.ruta-stops-wrap { flex: 1; overflow-y: auto; padding: 8px 16px 32px; }
.ruta-stop-row {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 0; border-bottom: 1px solid var(--line);
}
.ruta-stop-row:last-child { border-bottom: none; }
.ruta-num-pin {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--accent); color: var(--paper);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 14px; flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
}
.ruta-stop-body { flex: 1; min-width: 0; }
.ruta-stop-name {
  font-weight: 700; font-size: 14px; color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ruta-stop-addr {
  font-size: 12px; color: var(--ink-soft); margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ruta-go-btn {
  flex-shrink: 0; font-size: 12px; font-weight: 600;
  padding: 6px 14px; border: 1.5px solid var(--accent);
  border-radius: 20px; background: transparent; color: var(--accent);
  cursor: pointer; transition: background .15s, color .15s;
}
.ruta-go-btn:active { background: var(--accent); color: var(--paper); }

/* === PRODUCT DETAIL redesign (pd-*) === */
.pd-breadcrumb {
  display: flex; align-items: center; gap: 4px;
  font-size: 12px; color: var(--ink-soft);
  padding: 10px 14px 6px;
}
.pd-bc-link { cursor: pointer; transition: color .15s; }
.pd-bc-link:hover { color: var(--accent); }
.pd-bc-sep { opacity: .35; }

.pd-layout { display: flex; flex-direction: column; }

.pd-img-box {
  position: relative;
  background: #fff;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  min-height: 240px;
  border-bottom: 2px solid var(--line);
}
.pd-img {
  width: 100%; max-height: 380px;
  object-fit: contain; padding: 24px;
}
.pd-fav-btn {
  position: absolute; top: 10px; right: 10px;
  width: 36px; height: 36px; border-radius: 50%;
  background: rgba(255,255,255,.85);
  border: 1.5px solid rgba(42,34,29,.18);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  color: var(--ink-soft); transition: color .15s;
}
.pd-fav-btn:active { color: var(--accent-deep); }

.pd-info-panel { flex: 1; }
.pd-info-card { padding: 16px 14px; background: var(--paper); }

.pd-category {
  font-size: 11px; color: var(--accent-deep); font-weight: 700;
  text-transform: uppercase; letter-spacing: .5px; margin-bottom: 6px; cursor: pointer;
}
.pd-product-name {
  font-family: var(--font-d); font-size: 19px; font-weight: 800;
  letter-spacing: -.4px; line-height: 1.15; margin-bottom: 4px; color: var(--ink);
}
.pd-product-desc { font-size: 12px; color: var(--ink-soft); margin-bottom: 8px; line-height: 1.5; }
.pd-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 4px; }
.pd-stock {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; color: var(--success); font-weight: 600; margin-top: 8px;
}
.pd-divider { height: 0; border-top: 1.5px dashed rgba(42,34,29,.2); margin: 14px 0; }
.pd-unit-info { font-size: 12px; color: var(--ink-soft); margin-bottom: 2px; }
.pd-price-main {
  font-family: var(--font-d); font-size: 36px; font-weight: 800;
  letter-spacing: -1.5px; color: var(--accent-deep); line-height: 1; margin-bottom: 10px;
}
.pd-savings-chip {
  display: inline-flex; align-items: center; gap: 5px;
  background: #d1fae5; color: var(--success);
  border-radius: 6px; padding: 4px 10px;
  font-size: 11px; font-weight: 700; margin-bottom: 14px;
}
.pd-cta-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 14px 18px;
  background: var(--accent-deep); color: #fff;
  border: 2px solid var(--line); border-radius: var(--r);
  font-size: 15px; font-weight: 700; font-family: var(--font-b);
  cursor: pointer; letter-spacing: -.2px;
  box-shadow: var(--sh); transition: transform .1s, box-shadow .1s;
  -webkit-tap-highlight-color: transparent;
}
.pd-cta-btn:active { transform: translate(2px,2px); box-shadow: none; }

@media (min-width: 680px) {
  .pd-layout { flex-direction: row; align-items: stretch; border-bottom: 2px solid var(--line); }
  .pd-img-box {
    flex: 0 0 52%; min-height: 340px;
    border-bottom: none; border-right: 2px solid var(--line);
  }
  .pd-img { max-height: 500px; }
  .pd-info-panel { display: flex; flex-direction: column; }
  .pd-info-card {
    padding: 24px 20px; flex: 1;
    display: flex; flex-direction: column;
  }
  .pd-product-name { font-size: 22px; }
  .pd-price-main { font-size: 42px; }
  .pd-cta-btn { margin-top: auto; }
}

@media (min-width: 1024px) {
  .pd-breadcrumb { max-width: var(--d-content-max); }
  .pd-layout { max-width: var(--d-content-max); }
}

/* ─── PROMO PRICE ─────────────────────────────────────── */
.precio-tachado {
  text-decoration: line-through;
  color: var(--ink-soft);
  font-size: .8em;
  font-weight: 400;
  line-height: 1;
}
.precio-promo {
  color: var(--danger);
  font-weight: 800;
  line-height: 1;
}
.promo-tag {
  display: inline-flex; align-items: center; gap: 3px;
  background: var(--danger); color: #fff;
  font-size: 10px; font-weight: 700; letter-spacing: .3px;
  border-radius: 4px; padding: 2px 5px;
  line-height: 1.2;
}

/* ─── CUSTOM MODAL ────────────────────────────────────── */
.ma-modal-overlay {
  position: fixed; inset: 0; z-index: 9500;
  background: rgba(8,64,6,.45);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  animation: fadeIn .15s ease both;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.ma-modal {
  background: var(--paper);
  border: 2px solid var(--line);
  border-radius: var(--r-xl);
  box-shadow: var(--sh-lg);
  padding: 24px 20px 20px;
  width: 100%; max-width: 360px;
  animation: scaleIn .15s ease both;
}
@keyframes scaleIn {
  from { opacity: 0; transform: scale(.94); }
  to   { opacity: 1; transform: scale(1); }
}

.ma-modal__title {
  font-family: var(--font-d);
  font-size: 18px; font-weight: 800;
  color: var(--ink); margin-bottom: 16px;
}

.ma-modal__input {
  width: 100%; box-sizing: border-box;
  padding: 12px 14px;
  border: 2px solid var(--line);
  border-radius: var(--r);
  font-size: 15px; font-family: var(--font-b);
  color: var(--ink); background: var(--cream);
  outline: none; transition: border-color .15s, box-shadow .15s;
}
.ma-modal__input:focus {
  border-color: var(--accent);
  box-shadow: 2px 2px 0 var(--accent);
}
.ma-modal__input.error {
  border-color: var(--danger);
  box-shadow: 2px 2px 0 var(--danger);
}

.ma-modal__actions {
  display: flex; gap: 10px; margin-top: 16px;
}
.ma-modal__actions .btn { flex: 1; }
