/* Red Mayorista — sistema de diseño
   Personalidad: negro tinta + lima (ahorro). Superficies blancas sobre gris claro, tipografía firme,
   objetivos táctiles grandes y paneles inferiores como en apps de delivery. */

:root {
  --bg: #F4F5F7;
  --surface: #FFFFFF;
  --surface-2: #F4F5F7;
  --ink: #0B0D12;
  --text: #0B0D12;
  --text-2: #3A3F4A;
  --muted: #6B7180;
  --line: #E6E8EC;
  --line-strong: #D5D8DE;
  --primary: #0B0D12;          /* botones principales */
  --on-primary: #FFFFFF;
  --lime: #C5F036;             /* acento de marca: ahorro, ofertas, estados activos */
  --lime-ink: #1B2600;
  --lime-soft: #F1FBD3;
  --success: #0A7F4F;
  --success-soft: #E5F5EC;
  --warn: #9A5B00;
  --warn-soft: #FFF3D6;
  --danger: #C22B35;
  --danger-soft: #FCE8EA;
  --info: #2457C5;
  --info-soft: #E7EEFC;

  --r-sm: 10px;
  --r: 14px;
  --r-lg: 20px;
  --shadow-sm: 0 1px 2px rgba(11, 13, 18, .06);
  --shadow: 0 1px 2px rgba(11, 13, 18, .04), 0 6px 20px rgba(11, 13, 18, .06);
  --shadow-lg: 0 18px 48px rgba(11, 13, 18, .18);
  --tab-h: 64px;
  --side-w: 248px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0B0D12; --surface: #15181F; --surface-2: #1C2029; --ink: #F4F5F7; --text: #F4F5F7;
    --text-2: #C9CDD6; --muted: #8D94A3; --line: #262A34; --line-strong: #343947;
    --primary: #F4F5F7; --on-primary: #0B0D12; --lime-soft: #26300F; --success: #4ED09A;
    --success-soft: #11291F; --warn: #F2B541; --warn-soft: #2D2410; --danger: #FF6B74;
    --danger-soft: #331418; --info: #7EA6FF; --info-soft: #172240;
    --shadow: 0 1px 2px rgba(0,0,0,.3); --shadow-lg: 0 18px 48px rgba(0,0,0,.5);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: 15px/1.45 Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-feature-settings: "cv11", "ss01";
  background: var(--bg); color: var(--text);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
h1, h2, h3 { letter-spacing: -.02em; color: var(--text); }
h1 { font-size: 1.75rem; line-height: 1.15; font-weight: 800; margin: 0; }
h2 { font-size: 1.15rem; font-weight: 700; margin: 0; }
h3 { font-size: 1rem; font-weight: 650; margin: 0; }
p { margin: 0; }
a { color: inherit; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.num { font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }

/* ---------- iconos ---------- */
.i { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round; }
.i-sm { width: 16px; height: 16px; }
.i-lg { width: 26px; height: 26px; }

/* ---------- marca ---------- */
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
.brand .mark { width: 34px; height: 34px; border-radius: 10px; background: #0B0D12; display: grid; place-items: center; flex: none; }
.brand .mark { color: #C5F036; }
.brand .mark svg { width: 22px; height: 22px; }
.brand .word { font-weight: 800; letter-spacing: -.03em; font-size: 1.08rem; line-height: 1; }
.brand .word span { font-weight: 500; color: var(--muted); }

/* ---------- estructura ---------- */
.app { min-height: 100dvh; }
.sidebar { display: none; }
.main { min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 12px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.6) blur(14px); -webkit-backdrop-filter: saturate(1.6) blur(14px);
}
.top-context { flex: 1; min-width: 0; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.view { max-width: 1180px; margin: 0 auto; padding: 4px 16px calc(var(--tab-h) + 96px + env(safe-area-inset-bottom)); }

body.is-auth .topbar, body.is-auth .tabbar, body.is-auth .sidebar, body.is-auth .cartbar { display: none !important; }
body.is-auth .app { display: block; }
body.is-auth .view { max-width: none; padding: 0; }

.icon-btn, .avatar-btn {
  position: relative; display: grid; place-items: center; width: 42px; height: 42px; padding: 0;
  border-radius: 999px; border: 0; background: var(--surface); color: var(--text); cursor: pointer;
  box-shadow: var(--shadow-sm);
}
.avatar-btn { background: var(--ink); color: var(--bg); font-weight: 700; font-size: .85rem; font-family: inherit; }
.dot-badge {
  position: absolute; top: 2px; right: 2px; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 999px; background: var(--danger); color: #fff; font-size: .68rem; font-weight: 700;
  display: grid; place-items: center; border: 2px solid var(--bg);
}

.deliver { display: flex; align-items: center; gap: 10px; min-width: 0; background: none; border: 0; padding: 0; color: var(--text); font: inherit; cursor: pointer; max-width: 100%; }
.deliver .pin { width: 38px; height: 38px; border-radius: 999px; background: var(--surface); display: grid; place-items: center; box-shadow: var(--shadow-sm); flex: none; }
.deliver small { display: block; color: var(--muted); font-size: .72rem; font-weight: 500; }
.deliver b { display: block; font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.deliver > span { min-width: 0; text-align: left; }
.top-title { font-weight: 700; font-size: 1rem; }
@media (max-width: 959px) { body[data-role=retailer] .brand-mobile { display: none; } .brand-mobile .word { display: none; } }

/* barra inferior (móvil) */
.tabbar {
  position: fixed; inset: auto 0 0 0; z-index: 30;
  height: calc(var(--tab-h) + env(safe-area-inset-bottom)); padding: 0 8px env(safe-area-inset-bottom);
  display: flex; background: var(--surface); border-top: 1px solid var(--line);
}
.tabbar a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  text-decoration: none; color: var(--muted); font-size: .7rem; font-weight: 600; position: relative;
}
.tabbar a .i { width: 23px; height: 23px; }
.tabbar a.active { color: var(--text); }
.tabbar a.active::before {
  content: ""; position: absolute; top: 0; width: 28px; height: 3px; border-radius: 0 0 3px 3px; background: var(--text);
}
.tabbar .count { position: absolute; top: 7px; left: calc(50% + 6px); min-width: 17px; height: 17px; padding: 0 4px;
  border-radius: 999px; background: var(--lime); color: var(--lime-ink); font-size: .65rem; font-weight: 800; display: grid; place-items: center; }

/* escritorio: menú lateral */
@media (min-width: 960px) {
  .app { display: grid; grid-template-columns: var(--side-w) 1fr; }
  .sidebar {
    display: flex; flex-direction: column; gap: 28px; position: sticky; top: 0; height: 100dvh;
    padding: 22px 14px 16px; background: var(--surface); border-right: 1px solid var(--line);
  }
  .sidebar .brand { padding: 0 10px; }
  .side-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
  .side-nav a {
    display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 12px;
    color: var(--text-2); text-decoration: none; font-weight: 600; font-size: .93rem;
  }
  .side-nav a:hover { background: var(--surface-2); }
  .side-nav a.active { background: var(--ink); color: var(--bg); }
  .side-nav a .count { margin-left: auto; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px;
    background: var(--lime); color: var(--lime-ink); font-size: .72rem; font-weight: 800; display: grid; place-items: center; }
  .side-user {
    display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 14px; border: 1px solid var(--line);
    background: var(--surface); color: var(--text); cursor: pointer; text-align: left; font: inherit;
  }
  .side-user:hover { background: var(--surface-2); }
  .side-user .av { width: 36px; height: 36px; font-size: .78rem; background: var(--ink); color: var(--bg); }
  .side-user b { display: block; font-size: .88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .side-user small { color: var(--muted); font-size: .76rem; }
  .side-user > span:not(.av) { min-width: 0; flex: 1; }
  .tabbar, .brand-mobile, .avatar-btn { display: none !important; }
  .topbar { padding: 18px 32px 8px; }
  .view { padding: 8px 32px 64px; }
}

/* ---------- encabezados de página ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 6px 0 20px; flex-wrap: wrap; }
.page-head p { color: var(--muted); margin-top: 4px; }
.section-head { display: flex; align-items: center; justify-content: space-between; margin: 28px 0 12px; gap: 12px; }
.link { color: var(--text); font-weight: 600; font-size: .9rem; text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1.5px; cursor: pointer; background: none; border: 0; padding: 0; font-family: inherit; }

/* ---------- botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 48px; padding: 0 20px; border-radius: 12px; border: 0; cursor: pointer;
  font-family: inherit; font-weight: 600; font-size: .95rem; line-height: 1; text-decoration: none; white-space: nowrap;
  background: var(--primary); color: var(--on-primary);
  transition: transform .12s var(--ease), opacity .15s, background .15s;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .4; cursor: default; transform: none; }
.btn.block { width: 100%; }
.btn.lg { height: 54px; font-size: 1rem; border-radius: 14px; }
.btn.sm { height: 36px; padding: 0 14px; font-size: .85rem; border-radius: 10px; }
.btn.secondary { background: var(--surface-2); color: var(--text); }
.btn.outline { background: transparent; color: var(--text); box-shadow: inset 0 0 0 1.5px var(--line-strong); }
.btn.lime { background: var(--lime); color: var(--lime-ink); }
.btn.danger { background: var(--danger-soft); color: var(--danger); }
.btn .spacer { flex: 1; }
.icon-only { width: 40px; height: 40px; padding: 0; border-radius: 999px; display: grid; place-items: center; flex: none;
  border: 0; background: var(--surface-2); color: var(--text); cursor: pointer; }
.icon-only.ghost { background: none; color: var(--muted); }
.icon-only.danger { color: var(--danger); background: var(--danger-soft); }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2.5px solid var(--text); outline-offset: 2px;
}

/* ---------- formularios ---------- */
.field { margin-top: 14px; }
.field > label { display: block; font-size: .82rem; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.control { position: relative; display: flex; align-items: center; }
.control > .i { position: absolute; left: 14px; color: var(--muted); pointer-events: none; }
.control > .i + input { padding-left: 44px; }
.control .suffix { position: absolute; right: 14px; color: var(--muted); font-weight: 600; pointer-events: none; }
.control .eye { position: absolute; right: 6px; width: 38px; height: 38px; border: 0; background: none; color: var(--muted); cursor: pointer; display: grid; place-items: center; border-radius: 10px; }
.control .eye + input, .control input:has(+ .eye) { padding-right: 48px; }
input, select, textarea {
  font: inherit; font-size: 16px; color: var(--text); background: var(--surface-2);
  border: 1.5px solid transparent; border-radius: 12px; padding: 0 14px; width: 100%; height: 50px;
  transition: border-color .15s, background .15s;
}
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236B7180' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 40px; }
textarea { height: auto; min-height: 88px; padding: 12px 14px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--text); background-color: var(--surface); }
input::placeholder, textarea::placeholder { color: var(--muted); }
.hint { display: block; min-height: 1.2em; margin-top: 5px; font-size: .78rem; color: var(--muted); }
.hint:empty { min-height: 0; margin: 0; }
.hint.ok { color: var(--success); font-weight: 600; }
.hint.bad { color: var(--danger); font-weight: 600; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.form-section { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.form-section > h3 + p { color: var(--muted); font-size: .85rem; margin-top: 2px; }

/* interruptor */
.switch { position: relative; display: inline-block; width: 50px; height: 30px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--line-strong); transition: background .2s; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 999px; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .2s var(--ease); }
.switch input:checked + span { background: var(--success); }
.switch input:checked + span::after { transform: translateX(20px); }
.switch input:focus-visible + span { outline: 2.5px solid var(--text); outline-offset: 2px; }

/* control segmentado */
.segmented { display: inline-flex; padding: 4px; gap: 2px; border-radius: 12px; background: var(--surface); box-shadow: var(--shadow-sm); overflow-x: auto; max-width: 100%; }
.segmented button { border: 0; background: none; padding: 8px 14px; border-radius: 9px; font-family: inherit; font-weight: 600; font-size: .87rem; color: var(--muted); cursor: pointer; white-space: nowrap; }
.segmented button.active { background: var(--ink); color: var(--bg); }
.segmented .n { margin-left: 6px; opacity: .7; }

/* ---------- superficies ---------- */
.card { background: var(--surface); border-radius: var(--r-lg); padding: 18px; box-shadow: var(--shadow); }
.stack > * + * { margin-top: 12px; }
.row { display: flex; align-items: center; gap: 12px; }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }

.chip { display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 10px; border-radius: 999px;
  font-size: .76rem; font-weight: 700; background: var(--surface-2); color: var(--text-2); white-space: nowrap; }
.chip .i { width: 14px; height: 14px; }
.chip.lime { background: var(--lime); color: var(--lime-ink); }
.chip.success { background: var(--success-soft); color: var(--success); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.danger { background: var(--danger-soft); color: var(--danger); }
.chip.info { background: var(--info-soft); color: var(--info); }
.chip.dark { background: var(--ink); color: var(--bg); }

/* ---------- tienda (minorista) ---------- */
.hello { margin: 4px 0 16px; }
.hello p { color: var(--muted); margin-top: 4px; font-size: 1rem; }
.search { position: relative; }
.search > .i { position: absolute; left: 18px; top: 50%; transform: translateY(-50%); color: var(--text); z-index: 1; }
.search input { height: 56px; padding-left: 52px; border-radius: 999px; background: var(--surface); box-shadow: var(--shadow); font-weight: 500; }

.promo {
  position: relative; overflow: hidden; margin-top: 16px; padding: 20px 22px; border-radius: var(--r-lg);
  background: #0B0D12; color: #fff; display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.promo h2 { color: #fff; font-size: 1.2rem; line-height: 1.2; max-width: 260px; }
.promo p { color: rgba(255,255,255,.7); margin-top: 6px; font-size: .88rem; max-width: 300px; }
.promo .big { font-size: 2.6rem; font-weight: 800; letter-spacing: -.04em; color: var(--lime); line-height: 1; white-space: nowrap; position: relative; z-index: 1; text-align: right; }
.promo .big small { font-size: .78rem; font-weight: 600; color: rgba(255,255,255,.7); display: block; letter-spacing: 0; margin-bottom: 4px; }
.promo::after { content: ""; position: absolute; right: -70px; top: -70px; width: 220px; height: 220px; border-radius: 999px; background: radial-gradient(circle, rgba(197,240,54,.25), transparent 70%); }

.cats { display: flex; gap: 8px; overflow-x: auto; margin: 22px -16px 4px; padding: 4px 16px 6px; scrollbar-width: none; }
.cats::-webkit-scrollbar { display: none; }
.cat { flex: none; display: flex; flex-direction: column; align-items: center; gap: 7px; width: 80px; border: 0; background: none; padding: 0; cursor: pointer; font-family: inherit; font-weight: 600; font-size: .76rem; color: var(--text-2); text-align: center; line-height: 1.2; }
.cat .tile { width: 64px; height: 64px; border-radius: 20px; transition: transform .15s var(--ease), box-shadow .15s; }
.cat.active .tile { box-shadow: 0 0 0 2.5px var(--bg), 0 0 0 4.5px var(--text); }
.cat.active { color: var(--text); }
.cat:active .tile { transform: scale(.95); }
@media (min-width: 960px) { .cats { margin: 22px 0 4px; padding: 4px 2px 6px; } }

.tile { display: grid; place-items: center; background: var(--t-bg); color: var(--t-ink); border-radius: 16px; }
.tile .i { width: 40%; height: 40%; stroke-width: 1.6; }
.t-all { --t-bg: #E9EBEF; --t-ink: #0B0D12; }
.t-basket { --t-bg: #FFF1CC; --t-ink: #8A5600; }
.t-soda { --t-bg: #DFEBFF; --t-ink: #1D4FA8; }
.t-sparkles { --t-bg: #DDF5E8; --t-ink: #0A6F45; }
.t-heart { --t-bg: #FDE3EA; --t-ink: #AF1F48; }
.t-package { --t-bg: #ECE7FB; --t-ink: #5130B0; }
@media (prefers-color-scheme: dark) {
  .t-all { --t-bg: #262A34; --t-ink: #F4F5F7; }
  .t-basket { --t-bg: #33290F; --t-ink: #FFC94D; }
  .t-soda { --t-bg: #15254A; --t-ink: #8DB2FF; }
  .t-sparkles { --t-bg: #10301F; --t-ink: #5DDB9E; }
  .t-heart { --t-bg: #3A1520; --t-ink: #FF8FAE; }
  .t-package { --t-bg: #251B45; --t-ink: #B8A3FF; }
}

.pgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 12px; }
@media (min-width: 640px) { .pgrid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .pgrid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 24px 18px; } .pcard-media .tile .i { width: 30%; height: 30%; } }
@media (min-width: 1400px) { .pgrid { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.pcard { cursor: pointer; min-width: 0; }
.pcard-media { position: relative; }
.pcard-media .tile { aspect-ratio: 5 / 4; border-radius: var(--r-lg); transition: transform .2s var(--ease); }
.pcard:hover .pcard-media .tile { transform: scale(1.015); }
.pcard .deal { position: absolute; top: 10px; left: 10px; }
.fab {
  position: absolute; right: 10px; bottom: 10px; height: 40px; min-width: 40px; border-radius: 999px; border: 0;
  background: var(--surface); color: var(--text); box-shadow: var(--shadow); display: grid; place-items: center; cursor: pointer;
  transition: transform .12s var(--ease); font-family: inherit;
}
.fab:active { transform: scale(.9); }
.fab.in { background: #0B0D12; color: #fff; font-weight: 800; font-size: .9rem; padding: 0 14px; }
.pcard-body { padding: 10px 2px 0; }
.price { font-weight: 800; font-size: 1.12rem; letter-spacing: -.02em; }
.price small { font-weight: 500; font-size: .8rem; color: var(--muted); margin-left: 3px; letter-spacing: 0; }
.pcard h3 { font-size: .92rem; font-weight: 500; color: var(--text-2); margin-top: 2px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pcard .meta { font-size: .78rem; color: var(--muted); margin-top: 3px; }
.save { color: var(--success); font-weight: 700; }

/* barra flotante del carrito */
.cartbar {
  position: fixed; z-index: 25; left: 16px; right: 16px; bottom: calc(var(--tab-h) + 12px + env(safe-area-inset-bottom));
  max-width: 560px; margin: 0 auto;
}
.cartbar .btn { width: 100%; height: 58px; border-radius: 16px; box-shadow: var(--shadow-lg); padding: 0 9px 0 12px; animation: rise .3s var(--ease); background: #0B0D12; color: #fff; }
.cartbar .qty { min-width: 32px; height: 32px; padding: 0 8px; border-radius: 999px; background: var(--lime); color: var(--lime-ink); display: grid; place-items: center; font-weight: 800; font-size: .85rem; }
.cartbar .tot { background: rgba(255,255,255,.12); padding: 0 12px; height: 40px; border-radius: 11px; display: grid; place-items: center; font-variant-numeric: tabular-nums; }
@media (min-width: 960px) { .cartbar { left: calc(var(--side-w) + 32px); right: 32px; bottom: 24px; } }
@keyframes rise { from { transform: translateY(16px); opacity: 0; } }

/* stepper */
.stepper { display: inline-flex; align-items: center; height: 44px; border-radius: 999px; background: var(--surface-2); flex: none; }
.stepper button { width: 44px; height: 44px; border: 0; background: none; color: var(--text); cursor: pointer; display: grid; place-items: center; border-radius: 999px; }
.stepper button:active { background: var(--line); }
.stepper input { width: 56px; height: 44px; text-align: center; background: none; border: 0; padding: 0; font-weight: 700; border-radius: 0; font-variant-numeric: tabular-nums; }
.stepper input:focus { background: none; }
.stepper.lg { height: 54px; }
.stepper.lg button { width: 50px; height: 54px; }
.stepper.lg input { height: 54px; width: 64px; font-size: 1.15rem; }
input[type=number] { -moz-appearance: textfield; }
input::-webkit-outer-spin-button, input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* detalle de producto */
.pd-media .tile { height: 190px; border-radius: var(--r-lg); }
.pd-media .tile .i { width: 72px; height: 72px; }
.pd-title { margin-top: 16px; }
.pd-title h2 { font-size: 1.35rem; margin-top: 6px; }
.pd-title .price { font-size: 1.5rem; margin-top: 8px; }
.tiers-list { margin-top: 18px; border-radius: var(--r); background: var(--surface-2); padding: 6px; }
.tiers-list > small { display: block; padding: 6px 10px 4px; color: var(--muted); font-weight: 700; font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; }
.tier-row { display: flex; align-items: center; gap: 10px; padding: 11px 12px; border-radius: 10px; }
.tier-row.on { background: var(--surface); box-shadow: var(--shadow-sm); }
.tier-row .q { flex: 1; font-weight: 600; font-size: .9rem; }
.tier-row .p { font-weight: 800; font-variant-numeric: tabular-nums; }
.upsell { display: flex; align-items: center; gap: 10px; margin-top: 12px; padding: 12px 14px; border-radius: var(--r); background: var(--lime-soft); color: var(--text); font-size: .88rem; }
.upsell .i { color: var(--success); }
.sheet-footer { position: sticky; bottom: -20px; margin: 20px -20px -20px; padding: 14px 20px 20px; background: var(--surface); border-top: 1px solid var(--line); display: flex; gap: 12px; align-items: center; }
.sheet-footer .btn { flex: 1; }

/* carrito */
.cart-item { display: flex; gap: 14px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.cart-item:first-child { padding-top: 4px; }
.cart-item:last-child { border-bottom: 0; padding-bottom: 4px; }
.cart-item .tile { width: 76px; height: 76px; flex: none; border-radius: 16px; }
.cart-item .info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.cart-item h3 { font-size: .95rem; font-weight: 600; }
.cart-item .controls { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; }
.cart-item .stepper { height: 38px; }
.cart-item .stepper button { width: 38px; height: 38px; }
.cart-item .stepper input { height: 38px; width: 48px; font-size: .92rem; }
.cart-item .line-total { font-weight: 800; white-space: nowrap; font-variant-numeric: tabular-nums; }
.layout-2 { display: grid; gap: 16px; }
@media (min-width: 960px) { .layout-2 { grid-template-columns: minmax(0, 1fr) 360px; align-items: start; gap: 24px; } .layout-2 > .aside { position: sticky; top: 90px; } }
.sum-row { display: flex; justify-content: space-between; padding: 6px 0; color: var(--text-2); font-variant-numeric: tabular-nums; }
.sum-row.total { color: var(--text); font-weight: 800; font-size: 1.25rem; padding-top: 14px; margin-top: 8px; border-top: 1px solid var(--line); }
.addr { display: flex; gap: 12px; align-items: center; padding: 14px; border-radius: var(--r); background: var(--surface-2); margin: 16px 0; }
.addr b { display: block; font-size: .9rem; }
.addr small { color: var(--muted); }
.trust { display: flex; align-items: center; gap: 8px; justify-content: center; margin-top: 12px; color: var(--muted); font-size: .8rem; }

/* seguimiento (tracker) */
.tracker { list-style: none; margin: 18px 0 4px; padding: 0; display: flex; }
.tracker li { flex: 1; position: relative; display: flex; flex-direction: column; align-items: center; gap: 7px; text-align: center; min-width: 0; }
.tracker li::before { content: ""; position: absolute; top: 15px; right: 50%; width: 100%; height: 3px; background: var(--line); z-index: 0; }
.tracker li:first-child::before { display: none; }
.tracker li.done::before, .tracker li.current::before { background: var(--text); }
.tracker .dot { position: relative; z-index: 1; width: 32px; height: 32px; border-radius: 999px; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); }
.tracker .dot .i { width: 16px; height: 16px; }
.tracker li.done .dot { background: var(--text); color: var(--bg); }
.tracker li.current .dot { background: var(--lime); color: var(--lime-ink); box-shadow: 0 0 0 4px var(--lime-soft); }
.tracker .lbl { font-size: .7rem; font-weight: 600; color: var(--muted); line-height: 1.2; padding: 0 2px; max-width: 100%; }
@media (max-width: 480px) { .tracker .lbl { font-size: .62rem; letter-spacing: -.01em; } .tracker li:not(.current) .lbl { color: var(--muted) !important; } }
.tracker li.done .lbl, .tracker li.current .lbl { color: var(--text); }

.order-card .head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.order-card .head small { color: var(--muted); display: block; margin-top: 3px; }
.order-card .items { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.order-card .it { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; font-size: .9rem; color: var(--text-2); }
.order-card .it span:last-child { font-variant-numeric: tabular-nums; white-space: nowrap; }
.order-card .foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.order-card .foot b { font-size: 1.1rem; font-variant-numeric: tabular-nums; }
.cancelled { display: flex; align-items: center; gap: 8px; margin-top: 14px; padding: 10px 12px; border-radius: 12px; background: var(--danger-soft); color: var(--danger); font-weight: 600; font-size: .88rem; }
details.more summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 6px; font-weight: 600; font-size: .88rem; margin-top: 12px; }
details.more summary::-webkit-details-marker { display: none; }
details.more summary .i { transition: transform .15s; }
details.more[open] summary .i { transform: rotate(90deg); }
.delivery { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.delivery:last-child { border-bottom: 0; }
.delivery > .i { color: var(--muted); margin-top: 2px; }
.delivery b { font-size: .9rem; }
.delivery small { display: block; color: var(--muted); font-size: .8rem; }
.delivery .qtys { margin-left: auto; text-align: right; font-size: .82rem; color: var(--text-2); white-space: nowrap; }

/* ---------- métricas ---------- */
.kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 960px) { .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; } }
.kpi { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.kpi .ic { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: var(--surface-2); }
.kpi .label { color: var(--muted); font-size: .8rem; font-weight: 600; }
.kpi .value { font-size: 1.4rem; font-weight: 800; letter-spacing: -.03em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.kpi.hero { grid-column: 1 / -1; background: #0B0D12; color: #fff; }
.kpi.hero .label { color: rgba(255,255,255,.7); }
.kpi.hero .value { font-size: 2.3rem; color: var(--lime); }
.kpi.hero .split { display: flex; gap: 28px; flex-wrap: wrap; }
.kpi.hero .split div { color: rgba(255,255,255,.65); font-size: .8rem; }
.kpi.hero .split b { display: block; color: #fff; font-size: 1.02rem; margin-top: 2px; font-variant-numeric: tabular-nums; }
@media (min-width: 960px) { .kpi.hero { grid-column: span 2; grid-row: span 2; justify-content: space-between; } }
.callout { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.callout .ic { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; background: var(--lime); color: var(--lime-ink); flex: none; }
.callout .grow p { color: var(--muted); font-size: .88rem; margin-top: 2px; }
.bars .bar-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 12px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: .9rem; }
.bars .bar-row:last-child { border-bottom: 0; }
.bars .bar-row > span:last-child { font-weight: 700; font-variant-numeric: tabular-nums; }
.bars .track { grid-column: 1 / -1; height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.bars .fill { height: 100%; border-radius: 99px; background: var(--text); }
.grid-2 { display: grid; gap: 16px; }
@media (min-width: 960px) { .grid-2 { grid-template-columns: 1fr 1fr; } }

/* listas tipo ajustes */
.list { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow); overflow: hidden; }
.list-row { display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-bottom: 1px solid var(--line); min-height: 66px; }
.list-row:last-child { border-bottom: 0; }
.list-row .grow b { display: block; font-size: .93rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-row .grow small { display: block; color: var(--muted); font-size: .8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-row .tile { width: 48px; height: 48px; border-radius: 14px; flex: none; }
.av { width: 40px; height: 40px; border-radius: 999px; background: var(--surface-2); color: var(--text); display: grid; place-items: center; font-weight: 700; font-size: .82rem; flex: none; }
.av.lg { width: 64px; height: 64px; font-size: 1.2rem; background: var(--ink); color: var(--bg); }
.pct { width: 92px; flex: none; }
.pct input { height: 42px; padding-right: 30px; text-align: right; font-weight: 600; }
.pct .suffix { right: 12px; }
.prod-meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }

/* tablas */
.table-wrap { overflow-x: auto; margin: 0 -18px; padding: 0 18px; }
table { width: 100%; border-collapse: collapse; font-size: .88rem; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-weight: 600; font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; }
tr:last-child td { border-bottom: 0; }
td.r, th.r { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* estados vacíos y esqueletos */
.empty { text-align: center; padding: 56px 20px; }
.empty .ic { width: 76px; height: 76px; border-radius: 999px; background: var(--surface); box-shadow: var(--shadow); display: grid; place-items: center; margin: 0 auto 18px; }
.empty .ic .i { width: 30px; height: 30px; }
.empty h2 { margin-bottom: 6px; }
.empty p { color: var(--muted); max-width: 320px; margin: 0 auto 20px; }
.skel { background: linear-gradient(90deg, var(--line) 0%, var(--surface-2) 50%, var(--line) 100%); background-size: 200% 100%; animation: shimmer 1.2s infinite linear; border-radius: 12px; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- acceso ---------- */
.auth-wrap { min-height: 100dvh; display: grid; background: var(--surface); }
@media (min-width: 960px) { .auth-wrap { grid-template-columns: minmax(420px, 1fr) minmax(480px, 1fr); } }
.auth-aside { display: none; }
@media (min-width: 960px) {
  .auth-aside {
    display: flex; flex-direction: column; justify-content: space-between; padding: 44px 52px; min-height: 100dvh;
    background: #0B0D12; color: #fff; position: sticky; top: 0; overflow: hidden;
  }
  .auth-aside::after { content: ""; position: absolute; width: 560px; height: 560px; right: -200px; bottom: -200px; border-radius: 999px; background: radial-gradient(circle, rgba(197,240,54,.24), transparent 65%); }
  .auth-aside .brand { color: #fff; }
  .auth-aside .brand .mark { background: var(--lime); color: #0B0D12; }
  .auth-aside .brand .word span { color: rgba(255,255,255,.6); }
  .auth-aside h2 { color: #fff; font-size: 2.7rem; line-height: 1.04; letter-spacing: -.045em; font-weight: 800; max-width: 480px; }
  .auth-aside h2 em { font-style: normal; color: var(--lime); }
  .props { display: grid; gap: 20px; margin-top: 40px; position: relative; z-index: 1; }
  .prop { display: flex; gap: 14px; align-items: flex-start; }
  .prop .ic { width: 44px; height: 44px; border-radius: 12px; background: rgba(255,255,255,.08); display: grid; place-items: center; color: var(--lime); flex: none; }
  .prop b { display: block; }
  .prop span { color: rgba(255,255,255,.6); font-size: .9rem; }
  .auth-aside footer { color: rgba(255,255,255,.45); font-size: .8rem; position: relative; z-index: 1; }
}
.auth-main { display: flex; justify-content: center; padding: calc(28px + env(safe-area-inset-top)) 22px 40px; }
@media (min-width: 960px) { .auth-main { align-items: center; padding: 48px; } }
.auth-box { width: 100%; max-width: 420px; }
.auth-box > .brand { display: flex; width: max-content; margin-bottom: 32px; }
@media (min-width: 960px) { .auth-box > .brand { display: none; } }
.auth-box h1 { font-size: 2rem; letter-spacing: -.035em; }
.auth-box .sub { color: var(--muted); margin: 8px 0 8px; font-size: 1rem; }
.auth-box .btn.lg { margin-top: 24px; }
.back { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 20px; color: var(--text); font-weight: 600; text-decoration: none; font-size: .9rem; background: none; border: 0; padding: 0; cursor: pointer; font-family: inherit; }
.or { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: .82rem; margin: 28px 0 14px; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.forgot { display: flex; justify-content: flex-end; margin-top: 12px; }
.demo { margin-top: 28px; padding: 14px; border-radius: var(--r); background: var(--surface-2); }
.demo p { font-size: .8rem; color: var(--muted); margin-bottom: 10px; }
.demo .row { flex-wrap: wrap; gap: 8px; }
.demo .btn { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.roles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 8px; }
.role { position: relative; cursor: pointer; display: block; }
.role input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.role .box { display: flex; flex-direction: column; gap: 12px; padding: 16px 14px; border-radius: 14px; border: 1.5px solid var(--line-strong); height: 100%; transition: border-color .15s, box-shadow .15s, background .15s; }
.role .box .i { width: 26px; height: 26px; }
.role b { display: block; font-size: .92rem; }
.role small { color: var(--muted); font-size: .78rem; }
.role input:checked + .box { border-color: var(--text); box-shadow: inset 0 0 0 1px var(--text); background: var(--surface-2); }
.role input:focus-visible + .box { outline: 2.5px solid var(--text); outline-offset: 2px; }
.status-hero { text-align: center; padding-top: 32px; }
.status-hero .ic { width: 84px; height: 84px; border-radius: 999px; display: grid; place-items: center; margin: 0 auto 24px; background: var(--surface-2); }
.status-hero .ic .i { width: 36px; height: 36px; }
.status-hero .ic.lime { background: var(--lime); color: var(--lime-ink); }
.status-hero p { color: var(--muted); margin: 10px auto 0; max-width: 360px; }
.status-hero .btn { margin-top: 28px; }
.legal { color: var(--muted); font-size: .78rem; text-align: center; margin-top: 16px; }

/* ---------- panel inferior (sheet) ---------- */
dialog.sheet {
  border: 0; padding: 0; margin: auto auto 0; width: 100%; max-width: 100%; max-height: 92dvh;
  border-radius: 24px 24px 0 0; background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg);
  overflow: hidden;
}
dialog.sheet[open] { display: flex; flex-direction: column; animation: sheet-up .32s var(--ease); }
dialog.sheet::backdrop { background: rgba(11, 13, 18, .45); animation: fade .2s; }
.sheet-handle { width: 40px; height: 5px; border-radius: 99px; background: var(--line-strong); margin: 10px auto 0; flex: none; }
#modal-body { padding: 14px 20px calc(20px + env(safe-area-inset-bottom)); overflow-y: auto; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.sheet-head h2 { font-size: 1.3rem; }
@media (min-width: 720px) {
  dialog.sheet { margin: auto; width: min(540px, 92vw); border-radius: 24px; max-height: 88vh; }
  dialog.sheet[open] { animation: pop .22s var(--ease); }
  .sheet-handle { display: none; }
  #modal-body { padding: 24px; }
  .sheet-footer { bottom: -24px; margin: 20px -24px -24px; padding: 16px 24px 24px; }
}
@keyframes sheet-up { from { transform: translateY(100%); } }
@keyframes pop { from { transform: scale(.96); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }

/* avisos */
.note { display: flex; gap: 12px; padding: 14px 2px; border-bottom: 1px solid var(--line); text-decoration: none; color: inherit; }
.note:last-child { border-bottom: 0; }
.note .ic { width: 42px; height: 42px; border-radius: 999px; background: var(--surface-2); display: grid; place-items: center; flex: none; }
.note b { display: block; font-size: .92rem; font-weight: 600; }
.note p { color: var(--text-2); font-size: .86rem; margin-top: 2px; }
.note time { color: var(--muted); font-size: .75rem; display: block; margin-top: 4px; }
.note.unread .ic { background: var(--lime); color: var(--lime-ink); }

.profile { display: flex; align-items: center; gap: 14px; margin: 6px 0 14px; }
.profile b { display: block; font-size: 1.1rem; }
.info-row { display: flex; align-items: center; gap: 12px; padding: 13px 0; border-bottom: 1px solid var(--line); font-size: .92rem; min-width: 0; }
.info-row > span { min-width: 0; overflow-wrap: anywhere; }
.info-row .i { color: var(--muted); }

/* toast */
.toast {
  position: fixed; z-index: 100; left: 50%; top: calc(14px + env(safe-area-inset-top));
  transform: translate(-50%, -20px); opacity: 0; pointer-events: none;
  display: flex; align-items: center; gap: 10px; width: max-content; max-width: min(92vw, 440px);
  padding: 12px 18px 12px 12px; border-radius: 14px; background: #0B0D12; color: #fff;
  font-weight: 600; font-size: .9rem; box-shadow: var(--shadow-lg); transition: .25s var(--ease);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast .ic { width: 24px; height: 24px; border-radius: 99px; background: var(--lime); color: var(--lime-ink); display: grid; place-items: center; flex: none; }
.toast .ic .i { width: 14px; height: 14px; stroke-width: 3; }
.toast.error .ic { background: var(--danger); color: #fff; }

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

/* ---------- fotos de producto ---------- */
.tile.photo { background: var(--surface-2); overflow: hidden; }
.tile.photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-pick { display: flex; gap: 14px; align-items: center; padding: 14px; border-radius: var(--r); border: 1.5px dashed var(--line-strong); transition: border-color .15s, background .15s; }
.photo-pick.drag { border-color: var(--text); background: var(--surface-2); }
.photo-pick b { display: block; font-size: .92rem; }
.photo-pick small { display: block; color: var(--muted); font-size: .8rem; margin-top: 2px; }
.photo-pick .preview { position: relative; width: 96px; height: 96px; flex: none; border-radius: 14px; overflow: hidden; background: var(--surface-2); color: var(--muted); display: grid; place-items: center; }
.photo-pick .preview .i { width: 28px; height: 28px; }
.photo-pick .preview img { width: 100%; height: 100%; object-fit: cover; }
.photo-pick .preview.busy::after { content: ""; position: absolute; inset: 0; background: color-mix(in srgb, var(--surface) 70%, transparent) ; }
.photo-pick .preview.busy::before { content: ""; position: absolute; z-index: 1; width: 26px; height: 26px; border-radius: 99px; border: 3px solid var(--line-strong); border-top-color: var(--text); animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.thumbs { display: flex; gap: 6px; margin-top: 14px; }
.thumbs img, .thumbs span { width: 44px; height: 44px; border-radius: 10px; object-fit: cover; background: var(--surface-2); display: grid; place-items: center; color: var(--muted); }
.pd-media .tile.photo { height: 260px; background: #fff; }
.pd-media .tile.photo img { object-fit: contain; }
#modal-body:focus { outline: none; }

/* ---------- iPhone: el fondo detrás de las barras de Safari coincide con la pantalla ---------- */
html { background: var(--bg); }
html:has(body.is-auth), body.is-auth { background: var(--surface); }

/* ---------- vista previa de la plataforma ---------- */
.preview-pill { display: flex; align-items: center; gap: 10px; padding: 6px 6px 6px 14px; border-radius: 999px; background: var(--lime); color: var(--lime-ink); max-width: 100%; width: max-content; }
.preview-pill > span { min-width: 0; }
.preview-pill small { display: block; font-size: .68rem; font-weight: 600; opacity: .75; line-height: 1.1; }
.preview-pill b { display: block; font-size: .88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.2; }
.preview-pill .btn { background: #0B0D12; color: #fff; flex: none; }
.preview-option { width: 100%; border: 0; background: none; text-align: left; font: inherit; color: inherit; cursor: pointer; }
.preview-option:hover { background: var(--surface-2); }
@media (max-width: 959px) { body.is-preview .brand-mobile { display: none; } }
