/* Estilos compartidos de la tarjeta del cliente y la sección de recepción de Univet */
:root {
  --bg: #eef8fb;
  --surface: #ffffff;
  --fg: #0f2a3d;
  --muted: #4f6d82;
  --line: #d3e6ee;
  --brand: #8fd3f5;
  --brand-fg: #0c2a40;
  --brand-ink: #0b6a9c;
  --accent: #ff6a1f;
  --accent-fg: #1d0a02;
  --sun: #ffd84a;
  --sun-fg: #3a2a00;
  --track: #dcecf4;
  --ok: #1e8a4c;
  --bad: #b4432f;
  --font-display: "Fredoka", "Trebuchet MS", system-ui, sans-serif;
  --font-body: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a1822; --surface: #12293a; --fg: #e6f1f8; --muted: #94b0c4; --line: #22425a;
    --brand: #1e6f99; --brand-fg: #ffffff; --brand-ink: #7cc9f0; --accent: #ff7a3d; --accent-fg: #1d0a02;
    --sun: #ffd84a; --sun-fg: #3a2a00; --track: #1c3a50; --ok: #55c486; --bad: #ee8a76; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0a1822; --surface: #12293a; --fg: #e6f1f8; --muted: #94b0c4; --line: #22425a;
  --brand: #1e6f99; --brand-fg: #ffffff; --brand-ink: #7cc9f0; --accent: #ff7a3d; --accent-fg: #1d0a02;
  --sun: #ffd84a; --sun-fg: #3a2a00; --track: #1c3a50; --ok: #55c486; --bad: #ee8a76; color-scheme: dark;
}
* { box-sizing: border-box; }
html { padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); }
body { margin: 0; background: var(--bg); color: var(--fg); font-family: var(--font-body); font-size: 16px; line-height: 1.5; }
[hidden] { display: none !important; }
img { max-width: 100%; }
h1, h2, h3 { font-family: var(--font-display); margin: 0; text-wrap: balance; line-height: 1.12; }
p { margin: 0; }
a { color: var(--brand-ink); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.num { font-variant-numeric: tabular-nums; }
.sub { color: var(--muted); font-size: 14px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.wrap { max-width: 720px; margin-inline: auto; padding-inline: 16px; padding-block: 16px 64px; display: flex; flex-direction: column; gap: 16px; }

/* Botones y formularios */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 10px 16px; border-radius: 14px; border: 0; font: 600 16px var(--font-body); text-decoration: none; cursor: pointer; text-align: center; color: var(--fg); background: var(--surface); border: 1px solid var(--line); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--accent); color: var(--accent-fg); border-color: transparent; }
.btn.brand { background: var(--brand); color: var(--brand-fg); border-color: transparent; }
.btn.danger { background: var(--bad); color: #fff; border-color: transparent; }
.btn.small { min-height: 38px; padding: 6px 12px; font-size: 14px; border-radius: 10px; }
.btn.wa { background: #1fa855; color: #fff; border-color: transparent; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.inline { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 14px; font-weight: 600; min-width: 0; }
input, select, textarea { font: 400 16px var(--font-body); color: var(--fg); background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 11px 12px; min-height: 48px; width: 100%; min-width: 0; }
textarea { min-height: 80px; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 18px 16px; display: flex; flex-direction: column; gap: 14px; }
.panel h2 { font-size: 22px; font-weight: 700; }
.panel h3 { font-size: 18px; font-weight: 600; }

.msg { border-radius: 12px; padding: 10px 12px; font-size: 14px; background: var(--bg); border: 1px solid var(--line); }
.msg.err { border-color: var(--bad); color: var(--bad); }
.msg.ok { border-color: var(--ok); color: var(--ok); }

/* Encabezado */
.top { background: var(--brand); color: var(--brand-fg); border-radius: 22px; padding: 12px 14px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.top img { width: 54px; height: 54px; flex: none; filter: drop-shadow(0 2px 4px rgba(11,106,156,.25)); }
.top .who { flex: 1 1 160px; min-width: 0; display: flex; flex-direction: column; line-height: 1.2; }
.top .who b { font-family: var(--font-display); font-size: 19px; }
.top .who span { font-size: 13px; opacity: .85; overflow-wrap: anywhere; }
.nav { display: flex; gap: 6px; flex-wrap: wrap; }
.nav .btn { min-height: 40px; padding: 6px 12px; font-size: 14px; background: rgba(255,255,255,.55); border-color: transparent; color: var(--brand-fg); }
.nav .btn[aria-current="page"] { background: var(--sun); color: var(--sun-fg); }

/* Barras de avance */
.bars { display: flex; flex-direction: column; gap: 12px; }
.bar b { font-size: 15px; font-weight: 600; display: flex; justify-content: space-between; gap: 8px; }
.bar b span { color: var(--muted); font-weight: 500; font-variant-numeric: tabular-nums; }
.track { height: 12px; border-radius: 999px; background: var(--track); overflow: hidden; margin-top: 4px; }
.fill { height: 100%; border-radius: 999px; background: var(--brand-ink); }
.bar small { color: var(--muted); font-size: 12px; }
.reward { background: var(--sun); color: var(--sun-fg); border-radius: 14px; padding: 10px 12px; font-size: 14px; font-weight: 600; display: flex; flex-direction: column; gap: 6px; }
.reward small { font-weight: 500; }
.pts { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.pts b { font: 700 34px var(--font-display); }

/* Lista */
.list { display: flex; flex-direction: column; }
.item { display: flex; gap: 10px; justify-content: space-between; align-items: center; padding: 12px 2px; border-bottom: 1px solid var(--line); }
.item:last-child { border-bottom: 0; }
.item .t { min-width: 0; display: flex; flex-direction: column; }
.item .t b { font-weight: 600; overflow-wrap: anywhere; }
.item .t span { font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
button.item { width: 100%; background: none; border: 0; border-bottom: 1px solid var(--line); color: inherit; font: inherit; text-align: left; cursor: pointer; }
.pill { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--track); color: var(--brand-ink); }
.pill.warn { background: var(--sun); color: var(--sun-fg); }

/* Tarjeta del cliente */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 26px; padding: 18px 16px; display: flex; flex-direction: column; gap: 16px; }
.card-top { display: flex; align-items: center; gap: 12px; }
.card-top img { width: 58px; height: 58px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 3px var(--accent); flex: none; }
.card-top h1 { font-size: 24px; }
.card-top span { color: var(--muted); font-size: 14px; }
.qrbox { background: #fff; border-radius: 18px; padding: 14px; align-self: center; display: flex; flex-direction: column; align-items: center; gap: 6px; border: 1px solid var(--line); }
.qrbox canvas { width: 200px; height: 200px; display: block; image-rendering: pixelated; }
.qrbox small { color: #4f6d82; font-size: 13px; font-variant-numeric: tabular-nums; letter-spacing: .06em; }

/* Escáner */
.scan { position: fixed; inset: 0; z-index: 20; background: #000; display: flex; flex-direction: column; }
.scan video { flex: 1; width: 100%; object-fit: cover; min-height: 0; }
.scan .bar2 { padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px)); display: flex; gap: 8px; align-items: center; justify-content: space-between; background: #0c1b24; color: #fff; }
.scan .frame { position: absolute; left: 50%; top: 42%; width: min(70vw, 300px); aspect-ratio: 1; transform: translate(-50%, -50%); border: 3px solid var(--sun); border-radius: 22px; pointer-events: none; }

/* Tarjeta simple: sellos */
.stamps { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.stamp { width: 34px; height: 34px; border-radius: 50%; border: 2px solid var(--line); background: var(--bg); display: grid; place-items: center; font: 700 15px var(--font-display); color: var(--muted); }
.stamp.on { background: var(--brand-ink); border-color: var(--brand-ink); color: #fff; }
.stamp.gift { border-color: var(--accent); color: var(--accent); }
.stamp.gift.on { background: var(--accent); color: #fff; }
.prog b { display: block; font-size: 17px; font-weight: 600; }
.prog small { color: var(--muted); font-size: 14px; }

/* Tienda */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.prod { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 10px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.prod img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 12px; background: var(--bg); }
.prod b { font-weight: 600; font-size: 15px; overflow-wrap: anywhere; }
.prod .precio { font: 700 18px var(--font-display); color: var(--accent); }
.prod small { color: var(--muted); font-size: 12px; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.chip { flex: none; min-height: 38px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--fg); font: 600 14px var(--font-body); cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--brand-ink); color: #fff; border-color: transparent; }
.cartbar { position: fixed; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom, 0px)); z-index: 10; max-width: 696px; margin-inline: auto; }
.qty { display: inline-flex; align-items: center; gap: 8px; }
.qty button { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--fg); font: 700 18px var(--font-body); cursor: pointer; }
.ph { width: 100%; aspect-ratio: 1; border-radius: 12px; background: linear-gradient(145deg, var(--track), var(--bg)); color: var(--brand-ink); display: grid; place-items: center; }
.ph svg { width: 56%; height: 56%; }
.ph.mini { width: 48px; height: 48px; aspect-ratio: auto; flex: none; border-radius: 10px; }

.sumas { display: flex; flex-direction: column; gap: 8px; }
.suma { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; font-size: 16px; }
.suma b { font-weight: 700; }
.suma.desc { color: var(--ok); }
.suma.total { border-top: 1px solid var(--line); padding-top: 10px; font: 700 20px var(--font-display); }
.suma.total b { font-size: 24px; color: var(--accent); }

/* Visor de foto de producto */
.visor-abierto { overflow: hidden; }
.visor { position: fixed; inset: 0; z-index: 100; background: rgba(15,42,61,.78); display: flex; align-items: center; justify-content: center; padding: 16px; }
.visor-caja { position: relative; background: #fff; border-radius: 22px; width: min(520px, 100%); max-height: 100%; overflow: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.visor-x { position: absolute; top: 8px; right: 8px; z-index: 2; width: 44px; height: 44px; border-radius: 50%; border: 0; background: #fff; color: #0f2a3d; font-size: 28px; line-height: 40px; box-shadow: 0 1px 6px rgba(15,42,61,.3); cursor: pointer; }
.visor-marco { overflow: auto; border-radius: 14px; background: #eef8fb; cursor: zoom-in; max-height: 62vh; -webkit-overflow-scrolling: touch; }
.visor-marco.acercado { cursor: zoom-out; }
.visor-img { display: block; width: 100%; height: auto; max-height: 62vh; object-fit: contain; }
.visor-marco.acercado .visor-img { width: 200%; max-width: none; max-height: none; }
.visor-info { display: flex; flex-direction: column; gap: 3px; }
.visor-info b { font-size: 18px; overflow-wrap: anywhere; }
.visor-info .precio { font: 700 20px var(--font-display); color: var(--accent); }
.visor-info small { color: var(--muted); font-size: 13px; }

/* Tarjetas de la tienda: enlace al artículo y efectos al pasar el mouse */
.prod { transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease; }
.prod-media { display: block; overflow: hidden; border-radius: 12px; }
.prod-media img, .prod-media .ph { display: block; transition: transform .35s ease; }
.prod-nombre { color: inherit; text-decoration: none; font-weight: 600; font-size: 15px; overflow-wrap: anywhere; transition: color .2s ease; }
.prod-nombre:focus-visible, .prod-media:focus-visible, .rel-card:focus-visible, .volver:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 8px; }
@media (hover: hover) and (pointer: fine) {
  .prod:hover { transform: translateY(-3px); box-shadow: 0 10px 24px rgba(11,106,156,.18); border-color: var(--brand); }
  .prod:hover .prod-media img, .prod:hover .prod-media .ph { transform: scale(1.07); }
  .prod:hover .prod-nombre, .prod-nombre:hover { color: var(--accent); }
  .rel-card:hover { border-color: var(--brand); box-shadow: 0 8px 20px rgba(11,106,156,.16); }
}
@media (prefers-reduced-motion: reduce) {
  .prod, .prod-media img, .prod-media .ph, .prod-nombre { transition: none; }
  .prod:hover { transform: none; }
  .prod:hover .prod-media img, .prod:hover .prod-media .ph { transform: none; }
}

/* Mensaje del Club */
.club-aviso { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: var(--sun); color: var(--sun-fg); border-radius: 16px; padding: 10px 12px; }
.club-ico { flex: none; width: 34px; height: 34px; border-radius: 50%; background: var(--accent); color: var(--accent-fg); display: grid; place-items: center; font-size: 18px; }
.club-txt { display: flex; flex-direction: column; gap: 2px; flex: 1 1 180px; min-width: 0; }
.club-txt b { font: 600 15px/1.25 var(--font-body); }
.club-txt small { font-size: 12.5px; opacity: .85; }
.club-aviso .btn { background: #fff; color: var(--sun-fg); border-color: transparent; }

/* Página de un artículo */
.prod-pag { display: flex; flex-direction: column; gap: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: 16px; }
.volver { color: var(--brand-ink); font-weight: 600; text-decoration: none; align-self: flex-start; }
.prod-foto { display: block; width: 100%; padding: 0; border: 0; background: var(--bg); border-radius: 18px; overflow: hidden; cursor: zoom-in; }
.prod-foto img { display: block; width: 100%; max-height: 420px; object-fit: contain; }
.prod-foto.ph { aspect-ratio: 4 / 3; cursor: default; }
.prod-datos { display: flex; flex-direction: column; gap: 10px; }
.prod-datos .chip { align-self: flex-start; text-decoration: none; display: inline-flex; align-items: center; }
.prod-datos h1 { font-size: 26px; overflow-wrap: anywhere; }
.precio.grande { font: 700 30px var(--font-display); color: var(--accent); }
.prod-desc { color: var(--muted); }
.prod-compra { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.prod-compra .btn.primary { flex: 1 1 180px; }
.btn.comprar { background: var(--brand-ink); color: #fff; border-color: transparent; width: 100%; }
.prod-pag h2 { font-size: 20px; }
.rel-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; margin-top: 8px; }
.rel-card { display: flex; flex-direction: column; gap: 4px; padding: 8px; border: 1px solid var(--line); border-radius: 14px; background: var(--bg); color: inherit; text-decoration: none; min-width: 0; transition: border-color .2s ease, box-shadow .2s ease; }
.rel-card img, .rel-card .ph { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; }
.rel-n { font-weight: 600; font-size: 14px; overflow-wrap: anywhere; }
.rel-card .precio { font: 700 16px var(--font-display); color: var(--accent); }
@media (min-width: 720px) {
  .prod-pag { display: grid; grid-template-columns: 1fr 1fr; align-items: start; gap: 20px; padding: 22px; }
  .volver, .prod-pag > div:last-child { grid-column: 1 / -1; }
}
