/* Los colores y medidas de toda la app, en un solo sitio */
:root {
  --ink: #1C1F24;          /* texto y botones secundarios */
  --granite: #6D7178;      /* texto secundario (el granito de Compostela) */
  --mist: #EEF0EC;         /* fondos de chips y campos */
  --line: #DFE2DC;         /* separadores */
  --paper: #FFFFFF;        /* hojas y tarjetas */
  --wine: #B0124A;         /* el color de la marca: pines y acciones principales (vino Mencía) */
  --wine-dark: #8C0E3B;
  --wine-soft: #F8E7ED;
  --gold: #E8A800;         /* estrellas y puntos */
  --ok: #1F8A4C;
  --ok-soft: #E3F3E9;
  --error: #C2361F;
  --error-soft: #FBE9E5;

  --display: 'Bricolage Grotesque', system-ui, sans-serif;
  --text: 'Atkinson Hyperlegible Next', system-ui, sans-serif;

  --radius-sheet: 28px;
  --radius-control: 16px;
  --shadow-float: 0 6px 24px rgba(28, 31, 36, 0.16);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }

html, body, #root { height: 100%; margin: 0; }

body {
  font-family: var(--text);
  font-size: 16px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--mist);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

h1, h2, h3 { font-family: var(--display); font-weight: 800; line-height: 1.1; margin: 0; letter-spacing: -0.01em; }
h1 { font-size: 28px; }
h2 { font-size: 22px; }
h3 { font-size: 17px; font-weight: 600; }
p { margin: 0; }

button, input, textarea, select { font: inherit; color: inherit; }

:focus-visible { outline: 3px solid var(--wine); outline-offset: 2px; }

.muted { color: var(--granite); }
.small { font-size: 14px; }

/* ---------- Botones ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; padding: 0 22px;
  border: 0; border-radius: var(--radius-control);
  font-weight: 700; font-size: 16px;
  cursor: pointer; transition: transform 0.1s, background 0.15s;
  text-decoration: none;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { cursor: not-allowed; opacity: 0.45; transform: none; }
.btn-primary { background: var(--wine); color: #fff; }
.btn-primary:not(:disabled):active { background: var(--wine-dark); }
.btn-dark { background: var(--ink); color: #fff; }
.btn-ghost { background: var(--mist); color: var(--ink); }
.btn-block { width: 100%; }
.btn-small { min-height: 40px; padding: 0 16px; font-size: 15px; border-radius: 12px; }

.icon-btn {
  display: grid; place-items: center;
  width: 48px; height: 48px; border: 0; border-radius: 50%;
  background: var(--paper); color: var(--ink);
  box-shadow: var(--shadow-float); cursor: pointer;
}
.icon-btn:active { transform: scale(0.94); }
.icon-btn.plain { box-shadow: none; background: var(--mist); width: 40px; height: 40px; }

/* ---------- Mapa ---------- */

.map { position: fixed; inset: 0; z-index: 0; background: #E8EAE6; }
.leaflet-container { font-family: var(--text); }
/* El mapa de OpenStreetMap tiene mucho color: se apaga para que los únicos colores fuertes sean los pines */
.leaflet-tile-pane { filter: saturate(0.25) contrast(0.92) brightness(1.06); }
.leaflet-control-attribution { font-size: 10px; background: rgba(255, 255, 255, 0.7) !important; }

/* El pin: una píldora con la nota del local y un pico que apunta al sitio exacto */
.pin-icon { background: none; border: 0; }
.pin {
  position: absolute; left: 50%; bottom: 6px; transform: translateX(-50%);
  display: flex; align-items: center; gap: 3px;
  padding: 5px 9px; border-radius: 999px;
  background: var(--wine); color: #fff;
  font-family: var(--display); font-weight: 800; font-size: 14px; white-space: nowrap;
  box-shadow: 0 3px 10px rgba(176, 18, 74, 0.35);
  transition: transform 0.15s, background 0.15s;
}
.pin::after {
  content: ''; position: absolute; left: 50%; bottom: -6px; transform: translateX(-50%);
  border: 6px solid transparent; border-bottom: 0; border-top-color: var(--wine);
}
.pin .star { color: #FFD873; font-size: 11px; }
.pin.is-new { background: var(--paper); color: var(--wine); }
.pin.is-new::after { border-top-color: var(--paper); }
.pin.is-selected { background: var(--ink); color: #fff; transform: translateX(-50%) scale(1.18); z-index: 10; }
.pin.is-selected::after { border-top-color: var(--ink); }

/* Con el mapa alejado, cada local es un punto (ver MapView) */
.dot {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--wine); border: 3px solid #fff;
  box-shadow: 0 2px 8px rgba(176, 18, 74, 0.45);
}
.dot.is-new { background: #fff; border-color: var(--wine); }

.me-dot {
  width: 18px; height: 18px; border-radius: 50%;
  background: #2D6CDF; border: 3px solid #fff;
  box-shadow: 0 0 0 6px rgba(45, 108, 223, 0.2);
}

/* ---------- Capa superior del mapa: búsqueda, filtros y botones ---------- */

.top-bar {
  position: fixed; z-index: 500; left: 0; right: 0; top: 0;
  padding: calc(var(--safe-top) + 12px) 16px 0;
  display: grid; gap: 10px; pointer-events: none;
}
/* La barra no tapa el mapa: solo sus botones reciben los toques, el hueco entre ellos deja tocar los pines */
.top-row { display: flex; gap: 10px; align-items: center; pointer-events: none; }
.top-row > * { pointer-events: auto; }

.search {
  flex: 1; display: flex; align-items: center; gap: 10px;
  height: 52px; padding: 0 16px; border-radius: 999px;
  background: var(--paper); box-shadow: var(--shadow-float);
}
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; font-size: 16px; }
.search input::placeholder { color: var(--granite); }
.search-clear { border: 0; background: var(--mist); width: 28px; height: 28px; border-radius: 50%; cursor: pointer; display: grid; place-items: center; }

.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding-bottom: 4px; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; height: 38px; padding: 0 16px; border-radius: 999px;
  border: 0; background: var(--paper); box-shadow: 0 2px 8px rgba(28, 31, 36, 0.12);
  font-weight: 700; font-size: 15px; cursor: pointer;
}
.chip[aria-pressed='true'] { background: var(--ink); color: #fff; }

.points-pill {
  display: flex; align-items: center; gap: 6px;
  height: 48px; padding: 0 16px 0 12px; border-radius: 999px;
  background: var(--paper); box-shadow: var(--shadow-float);
  font-family: var(--display); font-weight: 800; font-size: 17px; border: 0; cursor: pointer;
}
.points-pill .coin {
  width: 24px; height: 24px; border-radius: 50%; background: var(--gold); color: #fff;
  display: grid; place-items: center; font-size: 13px;
}

.badge-wrap { position: relative; }
.badge {
  position: absolute; top: -2px; right: -2px; min-width: 20px; height: 20px; padding: 0 5px;
  border-radius: 999px; background: var(--wine); color: #fff; font-size: 12px; font-weight: 700;
  display: grid; place-items: center; border: 2px solid #fff;
}

.side-buttons {
  position: fixed; z-index: 500; right: 16px;
  bottom: calc(var(--safe-bottom) + 24px);
  display: grid; gap: 12px; transition: bottom 0.3s;
}
.side-buttons.lifted { bottom: calc(var(--safe-bottom) + 44vh); }

.map-status {
  position: fixed; z-index: 500; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--safe-bottom) + 28px);
  padding: 12px 18px; border-radius: 999px; background: var(--ink); color: #fff;
  font-weight: 600; font-size: 15px; box-shadow: var(--shadow-float); white-space: nowrap;
}
.map-status button { margin-left: 10px; background: none; border: 0; color: #FFD873; font-weight: 700; cursor: pointer; }

/* ---------- Hoja inferior ---------- */

.scrim { position: fixed; inset: 0; z-index: 900; background: rgba(28, 31, 36, 0.35); animation: fade 0.2s; }

.sheet {
  position: fixed; z-index: 1000; left: 0; right: 0; bottom: 0;
  max-height: calc(100% - var(--safe-top) - 24px);
  display: flex; flex-direction: column;
  background: var(--paper); border-radius: var(--radius-sheet) var(--radius-sheet) 0 0;
  box-shadow: 0 -8px 30px rgba(28, 31, 36, 0.18);
  padding-bottom: var(--safe-bottom);
  animation: rise 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
  transition: height 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.sheet.peek { height: 42vh; }
.sheet.full { height: calc(100% - var(--safe-top) - 24px); }
.sheet.auto { height: auto; }

.sheet-handle {
  flex: none; display: grid; place-items: center; height: 28px; width: 100%;
  border: 0; background: none; cursor: grab; touch-action: none;
}
.sheet-handle::before { content: ''; width: 44px; height: 5px; border-radius: 3px; background: var(--line); }
.sheet-body { flex: 1; overflow-y: auto; padding: 0 20px 24px; overscroll-behavior: contain; }
.sheet-head { display: flex; align-items: flex-start; gap: 12px; }
.sheet-head > div { flex: 1; min-width: 0; }

@keyframes rise { from { transform: translateY(100%); } to { transform: translateY(0); } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* ---------- Ficha del local ---------- */

.meta-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin-top: 8px; font-size: 15px; }
.rating { display: inline-flex; align-items: center; gap: 4px; font-weight: 700; }
.rating .star { color: var(--gold); }
.price { font-weight: 700; letter-spacing: 1px; }
.price .off { color: var(--line); }

.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.tag { padding: 4px 10px; border-radius: 999px; background: var(--mist); font-size: 14px; font-weight: 600; }

.quick-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }

.section { margin-top: 28px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 12px; }

.rewards { display: flex; gap: 12px; overflow-x: auto; margin: 0 -20px; padding: 2px 20px 6px; scroll-snap-type: x mandatory; scrollbar-width: none; }
.rewards::-webkit-scrollbar { display: none; }
.reward {
  flex: none; width: 76%; max-width: 300px; scroll-snap-align: start;
  display: flex; flex-direction: column; gap: 6px;
  padding: 16px; border-radius: 20px; background: var(--wine-soft);
}
.reward .cost { font-family: var(--display); font-weight: 800; font-size: 26px; color: var(--wine); line-height: 1; }
.reward .cost small { font-size: 14px; font-weight: 600; }
.reward p { font-size: 14px; color: var(--granite); flex: 1; }
.reward .btn { margin-top: 6px; }
.reward .missing { font-size: 14px; font-weight: 600; color: var(--wine-dark); }

.review { padding: 14px 0; border-top: 1px solid var(--line); }
.review:first-of-type { border-top: 0; padding-top: 0; }
.review-head { display: flex; justify-content: space-between; gap: 8px; font-size: 15px; }
.review-head strong { font-weight: 700; }
.review p { margin-top: 4px; }

.stars-input { display: flex; gap: 4px; justify-content: center; margin: 8px 0 16px; }
.stars-input button {
  width: 52px; height: 52px; border: 0; background: none; cursor: pointer;
  font-size: 38px; line-height: 1; color: var(--line); transition: transform 0.1s, color 0.1s;
}
.stars-input button.on { color: var(--gold); }
.stars-input button:active { transform: scale(1.2); }

.info-row { display: flex; align-items: center; gap: 12px; padding: 14px 0; border-top: 1px solid var(--line); text-decoration: none; color: inherit; }
.info-row:first-of-type { border-top: 0; }
.info-row svg { flex: none; color: var(--granite); }

.empty { padding: 18px; border-radius: 16px; background: var(--mist); text-align: center; color: var(--granite); font-size: 15px; }

/* ---------- Formularios ---------- */

.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field label { font-weight: 700; font-size: 15px; }
.field input, .field textarea {
  width: 100%; min-height: 52px; padding: 14px 16px;
  border: 2px solid transparent; border-radius: var(--radius-control);
  background: var(--mist); font-size: 16px; outline: 0;
}
.field textarea { min-height: 96px; resize: vertical; }
.field input:focus, .field textarea:focus { border-color: var(--ink); background: var(--paper); }
.field .hint { font-size: 14px; color: var(--granite); }
.field .hint.bad { color: var(--error); }
.field input[aria-invalid='true'] { border-color: var(--error); }

.segmented { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border-radius: 16px; background: var(--mist); margin: 16px 0 20px; }
.segmented button { min-height: 44px; border: 0; border-radius: 12px; background: none; font-weight: 700; cursor: pointer; }
.segmented button[aria-pressed='true'] { background: var(--paper); box-shadow: 0 1px 4px rgba(28, 31, 36, 0.12); }

.alert { padding: 12px 14px; border-radius: 14px; font-size: 15px; font-weight: 600; margin-bottom: 14px; }
.alert.error { background: var(--error-soft); color: var(--error); }
.alert.ok { background: var(--ok-soft); color: var(--ok); }

/* ---------- Pantallas completas (canjes, perfil, QR) ---------- */

.screen {
  position: fixed; inset: 0; z-index: 1100; overflow-y: auto;
  background: var(--paper);
  padding: calc(var(--safe-top) + 12px) 20px calc(var(--safe-bottom) + 24px);
  animation: slide 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes slide { from { transform: translateX(100%); } to { transform: translateX(0); } }
.screen-head { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }

.ticket {
  width: 100%; display: flex; align-items: center; gap: 14px; text-align: left;
  padding: 16px; margin-bottom: 10px; border: 0; border-radius: 20px;
  background: var(--mist); cursor: pointer;
}
.ticket.pending { background: var(--wine-soft); }
.ticket .ticket-icon { flex: none; width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; background: var(--paper); color: var(--wine); }
.ticket > div { flex: 1; min-width: 0; }
.ticket strong { display: block; font-weight: 700; }
.status { font-size: 13px; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: var(--paper); white-space: nowrap; }
.status.PENDING { color: var(--wine); }
.status.USED { color: var(--ok); }
.status.EXPIRED { color: var(--granite); }

.qr-screen { display: flex; flex-direction: column; align-items: center; text-align: center; }
.qr-card { margin: 12px 0 18px; padding: 20px; border-radius: 28px; background: #fff; box-shadow: 0 10px 40px rgba(28, 31, 36, 0.14); }
.qr-card svg { display: block; width: min(68vw, 300px); height: auto; }
.countdown { width: min(68vw, 300px); height: 6px; border-radius: 3px; background: var(--mist); overflow: hidden; margin-top: 16px; }
.countdown div { height: 100%; background: var(--wine); transition: width 1s linear; }
.code { font-family: var(--display); font-weight: 800; font-size: 22px; letter-spacing: 2px; margin-top: 6px; }
.done-mark { width: 120px; height: 120px; border-radius: 50%; background: var(--ok); color: #fff; display: grid; place-items: center; margin: 40px 0 20px; animation: pop 0.35s cubic-bezier(0.2, 1.4, 0.4, 1); }
@keyframes pop { from { transform: scale(0.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.big-points { display: flex; align-items: center; gap: 14px; padding: 20px; border-radius: 24px; background: var(--ink); color: #fff; margin: 8px 0 20px; }
.big-points .coin { width: 52px; height: 52px; border-radius: 50%; background: var(--gold); display: grid; place-items: center; font-family: var(--display); font-weight: 800; font-size: 22px; }
.big-points strong { font-family: var(--display); font-size: 40px; font-weight: 800; line-height: 1; }

.how { display: grid; gap: 12px; margin: 8px 0 24px; padding: 0; list-style: none; counter-reset: step; }
.how li { display: flex; gap: 12px; align-items: flex-start; counter-increment: step; }
.how li::before { content: counter(step); flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--wine-soft); color: var(--wine); font-weight: 700; display: grid; place-items: center; font-size: 14px; }

/* ---------- Avisos ---------- */

.toast {
  position: fixed; z-index: 2000; left: 16px; right: 16px; top: calc(var(--safe-top) + 12px);
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px; border-radius: 18px; background: var(--ink); color: #fff;
  font-weight: 600; box-shadow: var(--shadow-float);
  animation: drop 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.toast.ok { background: var(--ok); }
.toast.error { background: var(--error); }
@keyframes drop { from { transform: translateY(-120%); } to { transform: translateY(0); } }

.skeleton { border-radius: 10px; background: linear-gradient(90deg, var(--mist), #F7F8F5, var(--mist)); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

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

/* En un ordenador la app se ve como un móvil centrado: está pensada para el móvil */
@media (min-width: 640px) {
  .sheet, .screen, .toast { left: 50%; right: auto; width: 480px; transform: translateX(-50%); }
  .screen { animation: none; }
  .sheet { animation: none; }
  .top-bar { max-width: 480px; margin: 0 auto; }
}

.ticket:disabled { cursor: default; color: inherit; opacity: 1; }

/* ================= Solo de la app de propietarios ================= */

.page { min-height: 100%; background: var(--paper); padding: calc(var(--safe-top) + 16px) 20px calc(var(--safe-bottom) + 120px); max-width: 520px; margin: 0 auto; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 24px; }

/* El botón de escanear: grande, abajo y centrado, donde llega el pulgar (como el de desbloquear un patinete) */
.scan-dock {
  position: fixed; z-index: 800; left: 0; right: 0; bottom: 0;
  padding: 16px 20px calc(var(--safe-bottom) + 20px);
  background: linear-gradient(to top, var(--paper) 70%, rgba(255, 255, 255, 0));
  display: flex; justify-content: center;
}
.scan-dock .btn { width: 100%; max-width: 480px; min-height: 64px; font-size: 18px; border-radius: 22px; box-shadow: 0 8px 24px rgba(176, 18, 74, 0.35); }

.biz-card {
  width: 100%; display: flex; align-items: center; gap: 14px; text-align: left;
  padding: 16px; margin-bottom: 12px; border: 0; border-radius: 22px; background: var(--mist); cursor: pointer;
}
.biz-card:active { transform: scale(0.99); }
.biz-card > div { flex: 1; min-width: 0; }
.biz-card strong { display: block; font-family: var(--display); font-size: 19px; font-weight: 800; }
.biz-card .muted { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.biz-mark { flex: none; width: 52px; height: 52px; border-radius: 16px; background: var(--wine); color: #fff; display: grid; place-items: center; font-family: var(--display); font-weight: 800; font-size: 17px; }
.biz-mark.is-new { background: var(--paper); color: var(--wine); font-size: 13px; }
.add-card { width: 100%; min-height: 64px; border: 2px dashed var(--line); border-radius: 22px; background: none; font-weight: 700; color: var(--granite); cursor: pointer; }

/* Asistente para dar de alta un local */
.wizard { position: fixed; inset: 0; z-index: 1100; display: flex; flex-direction: column; background: var(--paper); }
.wizard-top { padding: calc(var(--safe-top) + 12px) 20px 0; max-width: 520px; width: 100%; margin: 0 auto; }
.progress { height: 6px; border-radius: 3px; background: var(--mist); overflow: hidden; margin: 14px 0 8px; }
.progress div { height: 100%; background: var(--wine); transition: width 0.3s; }
.wizard-body { flex: 1; overflow-y: auto; padding: 16px 20px 24px; max-width: 520px; width: 100%; margin: 0 auto; }
.wizard-foot { display: flex; gap: 10px; padding: 12px 20px calc(var(--safe-bottom) + 16px); border-top: 1px solid var(--line); max-width: 520px; width: 100%; margin: 0 auto; }
.wizard-foot .btn-primary, .wizard-foot .btn-dark { flex: 1; }

/* Elegir la ubicación: el pin se queda quieto en el centro y se mueve el mapa debajo */
.picker { position: relative; height: 300px; border-radius: 22px; overflow: hidden; margin-bottom: 14px; }
.picker .leaflet-container { position: absolute; inset: 0; }
.crosshair { position: absolute; z-index: 500; left: 50%; top: 50%; transform: translate(-50%, -100%); pointer-events: none; color: var(--wine); filter: drop-shadow(0 3px 4px rgba(0, 0, 0, 0.3)); }
.crosshair-dot { position: absolute; z-index: 499; left: 50%; top: 50%; width: 8px; height: 8px; margin: -4px 0 0 -4px; border-radius: 50%; background: rgba(28, 31, 36, 0.4); pointer-events: none; }
.picker-locate { position: absolute; z-index: 500; right: 12px; bottom: 12px; }

.options { display: grid; gap: 10px; }
.option { display: flex; align-items: center; gap: 14px; width: 100%; min-height: 64px; padding: 0 18px; border: 2px solid var(--line); border-radius: 18px; background: var(--paper); text-align: left; cursor: pointer; }
.option[aria-pressed='true'] { border-color: var(--ink); background: var(--mist); }
.option .price { width: 48px; font-size: 18px; }

.tag-picker { display: flex; flex-wrap: wrap; gap: 8px; }
.tag-picker button { min-height: 44px; padding: 0 16px; border-radius: 999px; border: 2px solid var(--line); background: var(--paper); font-weight: 600; cursor: pointer; }
.tag-picker button[aria-pressed='true'] { border-color: var(--ink); background: var(--ink); color: #fff; }

.review-list { display: grid; gap: 2px; border-radius: 18px; overflow: hidden; }
.review-list > div { display: flex; justify-content: space-between; gap: 16px; padding: 14px 16px; background: var(--mist); }
.review-list span:first-child { color: var(--granite); flex: none; }
.review-list span:last-child { font-weight: 600; text-align: right; }

/* Ficha de un local del propietario */
.mini-map { height: 160px; border-radius: 22px; overflow: hidden; margin-bottom: 18px; }
.mini-map .leaflet-container { height: 100%; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 18px 0 8px; }
.stat { padding: 14px; border-radius: 18px; background: var(--mist); }
.stat strong { display: block; font-family: var(--display); font-weight: 800; font-size: 24px; line-height: 1.1; }
.stat span { font-size: 13px; color: var(--granite); }
.reward-row { display: flex; align-items: center; gap: 14px; padding: 14px 0; border-top: 1px solid var(--line); }
.reward-row:first-of-type { border-top: 0; }
.reward-row .cost { flex: none; width: 64px; height: 52px; border-radius: 14px; background: var(--wine-soft); color: var(--wine); display: grid; place-items: center; font-family: var(--display); font-weight: 800; line-height: 1; text-align: center; }
.reward-row .cost small { display: block; font-size: 11px; font-weight: 600; }
.presets { display: flex; gap: 8px; margin-top: 4px; }
.presets button { flex: 1; min-height: 44px; border: 0; border-radius: 12px; background: var(--mist); font-weight: 700; cursor: pointer; }
.presets button[aria-pressed='true'] { background: var(--ink); color: #fff; }
.danger { margin-top: 36px; padding-top: 20px; border-top: 1px solid var(--line); }

/* Escáner */
.scanner { position: fixed; inset: 0; z-index: 1200; background: #000; color: #fff; display: flex; flex-direction: column; }
.scanner-top { position: absolute; z-index: 3; top: 0; left: 0; right: 0; padding: calc(var(--safe-top) + 18px) 16px; display: flex; align-items: center; justify-content: center; gap: 12px; }
.scanner-top .icon-btn { background: rgba(255, 255, 255, 0.16); color: #fff; box-shadow: none; }
.scanner-top .scanner-back { position: absolute; left: 16px; top: calc(var(--safe-top) + 12px); }
/* El vídeo ocupa toda la pantalla con un tamaño fijo (absolute + inset), no el que le dé el flex: en Safari del iPhone
   un contenedor flexible podía dejarlo sin altura, y la cámara leía el QR pero no se veía */
.scanner-view { position: absolute; inset: 0; overflow: hidden; }
/* La vista previa es el canvas, encima del vídeo (ver scanner.js). Los dos con el mismo tamaño y recorte */
.scanner-view video, .scanner-preview { position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: cover; z-index: 0; }
/* Oscurece un poco arriba y abajo para leer los textos. Antes era una sombra de 9999px alrededor del recuadro, que en
   Safari del iPhone tapaba el vídeo entero */
.scanner-view::after { content: ''; position: absolute; inset: 0; z-index: 1; pointer-events: none; background: linear-gradient(rgba(0, 0, 0, 0.45), transparent 22%, transparent 70%, rgba(0, 0, 0, 0.55)); }
.scanner-frame { position: absolute; z-index: 2; left: 50%; top: 45%; width: min(70vw, 300px); aspect-ratio: 1; transform: translate(-50%, -50%); border-radius: 28px; pointer-events: none; }
.scanner-frame::before { content: ''; position: absolute; inset: 0; border-radius: 28px; border: 4px solid #fff; mask: linear-gradient(#000 0 0) center / calc(100% - 90px) 100% no-repeat exclude, linear-gradient(#000 0 0) center / 100% calc(100% - 90px) no-repeat exclude, linear-gradient(#000 0 0); }
.scanner-below { position: absolute; z-index: 3; left: 0; right: 0; top: calc(45% + min(35vw, 150px) + 20px); display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 0 24px; }
.scanner-hint { margin: 0; text-align: center; font-weight: 600; text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8); }
.scanner-close { background: rgba(255, 255, 255, 0.18); color: #fff; box-shadow: none; min-width: 160px; justify-content: center; gap: 8px; }
.result { text-align: center; padding-top: 8px; }
.result-mark { width: 96px; height: 96px; border-radius: 50%; display: grid; place-items: center; margin: 4px auto 16px; color: #fff; animation: pop 0.35s cubic-bezier(0.2, 1.4, 0.4, 1); }
.result-mark.ok { background: var(--ok); }
.result-mark.bad { background: var(--error); }
/* Las hojas del escáner (el resultado, sin cámara) llevan el color de texto normal, no el blanco del escáner */
.scanner .sheet { color: var(--ink); }
body { background: var(--paper); }
/* "Siguiente" se ve apagado mientras falta algo, pero se puede tocar: así enseña qué falta */
.btn[aria-disabled='true'] { opacity: 0.55; }

/* hidden oculta un elemento aunque su clase le ponga display (.search-clear, .badge...) */
[hidden] { display: none !important; }

/* Un campo con un botón al lado (buscar la dirección, añadir una etiqueta) */
.inline-add { display: flex; gap: 8px; }
.inline-add input { flex: 1; min-width: 0; }
.inline-add .btn { min-height: 52px; }

/* En un ordenador: una columna más ancha, los locales en dos columnas y el asistente y el escáner como paneles */
@media (min-width: 900px) {
  .page { max-width: 960px; display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-content: start; }
  .page > * { grid-column: 1 / -1; margin-bottom: 0; }
  .page > .biz-card { grid-column: auto; }
  .screen { width: 720px; }
  .mini-map, .picker { height: 260px; }

  .wizard, .scanner {
    inset: 5vh calc((100% - 720px) / 2);
    border-radius: var(--radius-sheet); overflow: hidden;
    box-shadow: 0 0 0 100vmax rgba(28, 31, 36, 0.5);
  }
  .wizard-top, .wizard-body, .wizard-foot { max-width: 640px; }
}
