/* ============================================================
   abierto24horas — App móvil (design system propio)
   ============================================================ */
/* Los colores salen de la paleta de la web (assets/css/style.css). La app y la
   web tienen que verse de la misma familia, asi que aqui NO se inventa ningun
   tono: cada token apunta a su equivalente y se anota cual es. Si cambia alli,
   cambia aqui.  --acc = --accent · --ink = --ink · --ink-2 = --ink-soft
   --line = --line · --ok = --open · --surf = --bg · --bg = --bg-alt */
:root {
  --bg: #f5f7fb;     /* web --bg-alt */
  --surf: #ffffff;   /* web --bg */
  --surf-2: #eef2f7;
  --ink: #101828;    /* web --ink */
  --ink-2: #51607a;  /* web --ink-soft */
  --line: #e4e9f2;   /* web --line */
  --acc: #f59e0b;    /* web --accent */
  --acc-hot: #fbbf24;/* web --accent-hot */
  --acc-ink: #000;   /* texto sobre naranja: negro. El blanco da 2,3 de contraste y falla */
  --acc-soft: #fff8ec; /* web --accent-bg */
  --acc-dark: #b45309; /* web --accent-dark */
  --ok: #047857;     /* web --open. OJO: hace de FONDO en .et--ver y en el interruptor,
                        con letra blanca encima, asi que tiene que quedarse oscuro. */
  --ok-txt: #047857; /* el mismo verde pero cuando hace de TEXTO (.d-abierto). En claro
                        coinciden; en oscuro NO pueden, y por eso son dos tokens. */
  --nav-h: 64px;
  --radio: 14px;     /* web --radius */
  --sombra: 0 1px 3px rgba(13,24,48,.08);        /* web --shadow */
  --sombra-alta: 0 12px 34px rgba(13,24,48,.22); /* la geometria es de la app; el tinte, de la web */
}
:root[data-tema="dark"], :root[data-tema="auto"] {
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root[data-tema="auto"] {
    /* los azules de noche de la web: --night-950 / --night-800 / --night-650 */
    --bg: #050914; --surf: #0d1830; --surf-2: #1a2a52; --ink: #f2f6fc; --ink-2: #9fb0c8;
    --line: #1a2a52; --acc-soft: #2a2113; --sombra: 0 2px 10px rgba(0,0,0,.4);
    /* Los dos colores de TEXTO hay que aclararlos o no se leen sobre el azul de
       noche: el ambar oscuro daba 3,16:1 y el verde 3,16:1, con 4,5:1 exigido.
       Con el ambar se hace lo mismo que la web en sus franjas nocturnas
       (style.css:55 usa --accent en el pie oscuro). Afecta al reloj, al chip de
       ubicacion, a la distancia, a la pestana activa y a «Abierto 24 h». */
    --acc-dark: #f59e0b; --ok-txt: #34d399;
  }
}
:root[data-tema="dark"] {
  /* los azules de noche de la web: --night-950 / --night-800 / --night-650 */
  --bg: #050914; --surf: #0d1830; --surf-2: #1a2a52; --ink: #f2f6fc; --ink-2: #9fb0c8;
  --line: #1a2a52; --acc-soft: #2a2113; --sombra: 0 2px 10px rgba(0,0,0,.4);
  /* mismos dos colores de texto aclarados que en el bloque de arriba */
  --acc-dark: #f59e0b; --ok-txt: #34d399;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  background: var(--bg); color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-ui, sans-serif;
  font-size: 16px; line-height: 1.45; overscroll-behavior-y: contain;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

.app { max-width: 560px; margin: 0 auto; min-height: 100%; position: relative; }

/* ---------- CABECERA ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40; display: flex; align-items: center; justify-content: space-between;
  gap: .6rem; padding: calc(env(safe-area-inset-top) + .55rem) .9rem .55rem;
  background: color-mix(in srgb, var(--surf) 88%, transparent);
  backdrop-filter: saturate(180%) blur(14px); border-bottom: 1px solid var(--line);
}
.topbar__brand { display: flex; align-items: center; gap: .45rem; font-weight: 800; letter-spacing: -.02em; font-size: 1.02rem; }
.topbar__brand img { border-radius: 8px; }
.topbar__brand b { color: var(--acc); }
.topbar__geo {
  display: flex; align-items: center; gap: .3rem; background: var(--surf-2); border: 1px solid var(--line);
  border-radius: 999px; padding: .45rem .8rem; font-size: .82rem; font-weight: 600; min-height: 40px; color: var(--ink);
}
.topbar__geo--on { background: var(--acc-soft); border-color: var(--acc); color: var(--acc-dark); }

/* ---------- VISTAS ---------- */
.views { padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + .8rem); }
.view { display: none; animation: entra .22s ease both; }
.view--on { display: block; }
@keyframes entra { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.hero-mini { padding: 1rem .9rem .5rem; }
.hero-mini h1 { font-size: 1.35rem; letter-spacing: -.02em; display: flex; align-items: baseline; gap: .5rem; }
.hero-mini__hora { font-size: .95rem; color: var(--acc-dark); background: var(--acc-soft); border-radius: 999px; padding: .1rem .55rem; font-weight: 800; }
.hero-mini p { color: var(--ink-2); font-size: .88rem; }

/* ---------- FILTROS ---------- */
.filtro-bar { display: flex; gap: .4rem; align-items: center; padding: .35rem .9rem .5rem; }
.fbtn {
  display: inline-flex; align-items: center; gap: .35rem; white-space: nowrap; min-height: 44px;
  background: var(--surf); border: 1px solid var(--line); border-radius: 999px; padding: .5rem .9rem;
  font-size: .86rem; font-weight: 700; box-shadow: var(--sombra);
}
.fbtn--main { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.fbtn__badge { background: var(--acc); color: var(--acc-ink); border-radius: 999px; font-size: .7rem; padding: 0 .35rem; font-weight: 900; }
.fscroll { display: flex; gap: .35rem; overflow-x: auto; scrollbar-width: none; }
.fscroll::-webkit-scrollbar { display: none; }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .3rem; }
.chip {
  min-height: 42px; display: inline-flex; align-items: center; gap: .3rem; white-space: nowrap;
  background: var(--surf); border: 1px solid var(--line); border-radius: 999px; padding: .4rem .85rem;
  font-size: .85rem; font-weight: 600; color: var(--ink);
}
.chip--on { background: var(--ink); color: var(--bg); border-color: var(--ink); }

/* ---------- LISTA / TARJETAS ---------- */
.lista { display: flex; flex-direction: column; gap: .6rem; padding: .3rem .9rem 1rem; }
.card {
  display: flex; gap: .8rem; align-items: center; background: var(--surf); border: 1px solid var(--line);
  border-radius: var(--radio); padding: .8rem; box-shadow: var(--sombra); min-height: 84px;
  transition: transform .12s ease; text-align: left; width: 100%;
}
.card:active { transform: scale(.985); }
.card--prem { border: 1.5px solid var(--acc); background: linear-gradient(180deg, var(--acc-soft), var(--surf) 60%); }
.card__ico {
  width: 52px; height: 52px; flex: 0 0 52px; border-radius: 14px; background: var(--surf-2);
  display: grid; place-items: center; font-size: 1.5rem; overflow: hidden;
}
.card__ico img { width: 100%; height: 100%; object-fit: cover; }
.card__cuerpo { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: .1rem; }
.card__tit { display: flex; align-items: center; gap: .35rem; font-weight: 800; font-size: 1rem; letter-spacing: -.01em; }
.card__tit span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card__sub, .card__serv { font-size: .82rem; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card__serv { color: var(--acc-dark); font-weight: 600; }
.card__der { display: flex; flex-direction: column; align-items: flex-end; gap: .3rem; flex: 0 0 auto; }
.km { font-weight: 900; font-size: .95rem; color: var(--acc-dark); }
.fav { font-size: 1.4rem; line-height: 1; background: none; border: 0; padding: .1rem .2rem; color: var(--acc-dark); }
/* nowrap y flex:0 0 auto: la insignia lleva simbolo y palabra («✦ Elite»), y sin
   esto el flex la parte en dos lineas y sale un chip redondo. Antes ponia
   «Destacado», una sola palabra, y no se notaba. El nombre es el que debe
   recortarse, que para eso tiene el ellipsis de arriba. */
.et { font-size: .64rem; font-weight: 900; text-transform: uppercase; letter-spacing: .05em; border-radius: 999px; padding: .1rem .4rem; white-space: nowrap; flex: 0 0 auto; }
.et--prem { background: linear-gradient(135deg, #f1f5f9, #cbd5e1 45%, #94a3b8); color: #1e293b; }
.et--elite { background: linear-gradient(135deg, #fde68a, var(--acc-hot) 45%, var(--acc)); color: #000; box-shadow: 0 2px 8px rgba(245,158,11,.45); }
.et--ver { background: var(--ok); color: #fff; }

/* estados */
.skel { height: 84px; border-radius: var(--radio); background: linear-gradient(90deg, var(--surf) 25%, var(--surf-2) 37%, var(--surf) 63%); background-size: 400% 100%; animation: sh 1.2s infinite linear; }
@keyframes sh { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }
.vacio { text-align: center; padding: 2.4rem 1.2rem; color: var(--ink-2); }
.vacio__ico { font-size: 2.6rem; display: block; margin-bottom: .5rem; }
.vacio b { color: var(--ink); display: block; margin-bottom: .3rem; }

/* ---------- MAPA ---------- */
.mapa-wrap { position: relative; }
#mapa { height: calc(100vh - var(--nav-h) - 58px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); min-height: 380px; }
.mapa-fab {
  position: absolute; right: .8rem; bottom: 4.2rem; z-index: 500; width: 52px; height: 52px; border-radius: 50%;
  background: var(--surf); border: 1px solid var(--line); box-shadow: var(--sombra-alta); font-size: 1.3rem;
}
.mapa-leyenda {
  position: absolute; left: .8rem; bottom: .9rem; z-index: 500; background: color-mix(in srgb, var(--surf) 92%, transparent);
  border: 1px solid var(--line); border-radius: 999px; padding: .3rem .7rem; font-size: .72rem; display: flex; align-items: center; gap: .3rem;
}
.pt { width: 10px; height: 10px; border-radius: 50%; background: #64748b; display: inline-block; border: 2px solid #0f172a; }
.pt--prem { background: var(--acc); border-color: var(--acc-dark); width: 13px; height: 13px; }

/* ---------- BUSCAR ---------- */
.buscador { position: relative; padding: .9rem .9rem .3rem; }
.buscador input {
  width: 100%; min-height: 52px; border-radius: 14px; border: 1px solid var(--line); background: var(--surf);
  padding: .8rem 2.6rem .8rem 1rem; font-size: 1rem; box-shadow: var(--sombra);
}
.buscador input:focus { outline: 2px solid var(--acc); }
#q-clear { position: absolute; right: 1.4rem; top: 1.55rem; background: none; border: 0; font-size: 1.1rem; color: var(--ink-2); }
.btn-ia {
  margin: .5rem .9rem .2rem; width: calc(100% - 1.8rem); min-height: 50px; border-radius: 14px;
  border: 1px dashed var(--acc); background: var(--acc-soft); color: var(--acc-dark); font-weight: 800;
}
.cats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: .55rem; padding: .8rem .9rem 1rem; }
.cat-t {
  background: var(--surf); border: 1px solid var(--line); border-radius: 14px; padding: .85rem .4rem;
  display: flex; flex-direction: column; align-items: center; gap: .2rem; box-shadow: var(--sombra); min-height: 96px; justify-content: center;
}
.cat-t__i { font-size: 1.7rem; }
.cat-t__n { font-size: .76rem; font-weight: 700; text-align: center; line-height: 1.2; }
.cat-t__c { font-size: .68rem; color: var(--ink-2); }

/* ---------- MÁS ---------- */
.mas-lista { display: flex; flex-direction: column; gap: .5rem; padding: .3rem .9rem 1rem; }
.mas-item {
  display: flex; align-items: center; justify-content: space-between; gap: .8rem; width: 100%;
  background: var(--surf); border: 1px solid var(--line); border-radius: 14px; padding: .85rem 1rem;
  min-height: 62px; box-shadow: var(--sombra); text-align: left;
}
.mas-item span { display: flex; flex-direction: column; }
.mas-item small { color: var(--ink-2); font-size: .76rem; font-weight: 400; }
.mas-select { background: var(--surf-2); border: 1px solid var(--line); border-radius: 10px; padding: .5rem; min-height: 42px; }
.switch { appearance: none; width: 50px; height: 30px; border-radius: 999px; background: var(--surf-2); border: 1px solid var(--line); position: relative; transition: background .18s; flex: 0 0 auto; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .18s; }
.switch:checked { background: var(--ok); border-color: var(--ok); }
.switch:checked::after { transform: translateX(20px); }
/* Llamada a los duenos de negocio. Dentro de la app NO se cobra nada: este
   enlace lleva a la web, que es donde se contrata. Vale igual para Android
   (TWA) y para iPhone (en iOS el interceptor de app-shell.js lo saca fuera). */
.mas-cta { display: block; text-decoration: none; color: var(--ink); background: var(--acc-soft); border: 1.5px solid var(--acc); border-radius: var(--radio); padding: 1rem; }
.mas-cta b { display: block; font-size: .98rem; letter-spacing: -.01em; }
.mas-cta small { display: block; color: var(--ink-2); font-size: .8rem; margin-top: .25rem; line-height: 1.4; }
.mas-cta__btn { display: inline-block; margin-top: .75rem; background: var(--acc); color: var(--acc-ink); font-weight: 800; font-size: .86rem; border-radius: 999px; padding: .5rem .95rem; }
.mas-pie { color: var(--ink-2); font-size: .74rem; padding: .8rem .3rem; display: flex; flex-direction: column; gap: .3rem; }
.mas-pie a { text-decoration: underline; }

/* ---------- BARRA INFERIOR ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; display: grid; grid-template-columns: repeat(5, 1fr);
  background: color-mix(in srgb, var(--surf) 92%, transparent); backdrop-filter: saturate(180%) blur(14px);
  border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom);
  max-width: 560px; margin: 0 auto;
}
.tab {
  background: none; border: 0; padding: .5rem 0 .45rem; display: flex; flex-direction: column; align-items: center; gap: .1rem;
  font-size: .68rem; font-weight: 700; color: var(--ink-2); min-height: var(--nav-h);
}
.tab__i { font-size: 1.35rem; line-height: 1.1; transition: transform .16s ease; }
.tab--on { color: var(--acc-dark); }
.tab--on .tab__i { transform: translateY(-2px) scale(1.12); }

/* ---------- DETALLE ---------- */
.detalle { position: fixed; inset: 0; z-index: 80; background: var(--bg); overflow-y: auto; animation: sube .24s ease both; }
@keyframes sube { from { transform: translateY(100%); } to { transform: none; } }
.detalle__inner { max-width: 560px; margin: 0 auto; padding-bottom: calc(env(safe-area-inset-bottom) + 1.2rem); }
.d-top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: .6rem; padding: calc(env(safe-area-inset-top) + .5rem) .9rem .5rem; background: color-mix(in srgb, var(--surf) 90%, transparent); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.d-back { width: 44px; height: 44px; border-radius: 50%; background: var(--surf-2); border: 1px solid var(--line); font-size: 1.2rem; }
.d-top b { font-size: .95rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.d-hero { padding: 1rem .9rem .3rem; }
.d-hero h1 { font-size: 1.5rem; letter-spacing: -.02em; line-height: 1.15; }
.d-etiquetas { display: flex; gap: .35rem; margin: .5rem 0; flex-wrap: wrap; }
.d-abierto { color: var(--ok-txt); font-weight: 800; font-size: .88rem; }
.d-fotos { display: flex; gap: .5rem; overflow-x: auto; padding: .6rem .9rem; scrollbar-width: none; }
.d-fotos::-webkit-scrollbar { display: none; }
.d-fotos img { height: 168px; border-radius: 14px; border: 1px solid var(--line); background: var(--surf); object-fit: cover; }
.d-fotos img.contain { object-fit: contain; padding: .4rem; }
.d-acciones { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; padding: .5rem .9rem .3rem; }
.d-acciones .btn { min-height: 56px; font-size: 1rem; }
.d-acciones .btn--full { grid-column: 1 / -1; }
.btn { border-radius: 14px; border: 1px solid var(--line); background: var(--surf); font-weight: 800; display: inline-flex; align-items: center; justify-content: center; gap: .4rem; min-height: 50px; padding: .7rem 1rem; }
.btn--acc { background: var(--acc); color: var(--acc-ink); border-color: var(--acc); }
.btn--ink { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn--ghost { background: var(--surf); }
.d-bloque { padding: .8rem .9rem; }
.d-bloque h2 { font-size: 1.05rem; margin-bottom: .5rem; }
.d-datos { display: flex; flex-direction: column; gap: .4rem; }
.d-dato { display: flex; gap: .5rem; align-items: baseline; font-size: .95rem; }
.d-dato b { color: var(--ink-2); font-weight: 600; min-width: 88px; font-size: .82rem; text-transform: uppercase; letter-spacing: .03em; }
.d-serv { display: flex; flex-wrap: wrap; gap: .4rem; }
.d-serv span { background: var(--surf); border: 1px solid var(--line); border-radius: 999px; padding: .35rem .75rem; font-size: .85rem; box-shadow: var(--sombra); }
.d-texto { white-space: pre-line; color: var(--ink); font-size: .95rem; }
.d-mapa { height: 190px; border-radius: 14px; overflow: hidden; border: 1px solid var(--line); }
.d-cta { margin: .5rem .9rem; padding: .9rem 1rem; border: 1px dashed var(--acc); background: var(--acc-soft); border-radius: 14px; font-size: .88rem; color: var(--ink); }

/* ---------- SHEETS ---------- */
.sheet { position: fixed; inset: 0; z-index: 90; }
.sheet__fondo { position: absolute; inset: 0; background: rgba(3,7,18,.5); animation: fade .2s ease both; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.sheet__panel {
  position: absolute; left: 0; right: 0; bottom: 0; max-width: 560px; margin: 0 auto;
  background: var(--surf); border-radius: 22px 22px 0 0; padding: .5rem 1rem calc(env(safe-area-inset-bottom) + 1rem);
  max-height: 86vh; overflow-y: auto; animation: sube .26s cubic-bezier(.2,.8,.2,1) both; box-shadow: var(--sombra-alta);
}
.sheet__panel--alto { height: 80vh; display: flex; flex-direction: column; }
.sheet__grip { width: 42px; height: 5px; border-radius: 99px; background: var(--line); margin: .3rem auto .7rem; }
.sheet h2 { font-size: 1.15rem; margin-bottom: .6rem; }
.sheet h3 { font-size: .82rem; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-2); margin: .9rem 0 .4rem; }
.sheet__lab { font-size: .9rem; }
.range { width: 100%; accent-color: var(--acc); height: 38px; }
.sheet__acciones { display: grid; grid-template-columns: 1fr 2fr; gap: .5rem; margin-top: 1rem; }

/* chat */
.chat { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: .5rem; padding: .3rem 0; }
.chat__b, .chat__u { max-width: 88%; padding: .6rem .85rem; border-radius: 14px; font-size: .93rem; }
.chat__b { background: var(--surf-2); align-self: flex-start; }
.chat__u { background: var(--ink); color: var(--bg); align-self: flex-end; }
.chat__form { display: flex; gap: .4rem; padding-top: .5rem; }
.chat__form input { flex: 1; min-height: 48px; border-radius: 999px; border: 1px solid var(--line); background: var(--surf-2); padding: .6rem 1rem; }
.chat__nota { font-size: .68rem; color: var(--ink-2); text-align: center; padding-top: .4rem; }

/* pull to refresh + toast */
.pull { height: 0; overflow: hidden; display: grid; place-items: center; transition: height .18s; }
.pull--on { height: 44px; }
.spin { width: 22px; height: 22px; border: 2.5px solid var(--line); border-top-color: var(--acc); border-radius: 50%; animation: gira .7s linear infinite; }
@keyframes gira { to { transform: rotate(360deg); } }
.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 1rem);
  z-index: 100; background: var(--ink); color: var(--bg); padding: .7rem 1.2rem; border-radius: 999px;
  font-size: .88rem; font-weight: 700; box-shadow: var(--sombra-alta); animation: entra .2s ease both; max-width: 90vw; text-align: center;
}
