/* App de clientes de Tatigo. Pensada primero para celular.
   Los colores viven en theme.css (tema claro y oscuro); aquí solo se usan sus variables. */
:root {
  --radius: 16px;
  --tap: 52px; /* alto mínimo de botones: cómodo para el dedo */
  --tabbar-h: 64px;
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 17px;
  line-height: 1.4;
  color: var(--text);
  background: var(--bg);
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
  /* que se sienta como app: sin selección de texto al mantener presionado */
  -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none;
}
input, textarea { -webkit-user-select: text; user-select: text; }

a { color: inherit; }
body.sheet-open { overflow: hidden; }

/* ---------- Estructura ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 8px;
  min-height: 60px;
  padding: 8px 12px;
  padding-top: calc(8px + env(safe-area-inset-top));
  background: var(--header-bg); color: var(--header-text);
}
.topbar .brand-logo { width: 36px; height: 36px; }
.topbar h1 { flex: 1; margin: 0; font-size: 20px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .icon-btn {
  min-width: 48px; min-height: 44px; padding: 0 12px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: 10px;
  background: var(--header-btn); color: var(--header-text);
  font: inherit; font-size: 20px; text-decoration: none; cursor: pointer;
}

/* Encabezado grande de la pantalla de inicio */
.hero {
  background: var(--header-bg); color: var(--header-text);
  padding: 16px 20px 28px;
  padding-top: calc(20px + env(safe-area-inset-top));
  border-radius: 0 0 28px 28px;
}
.hero .brand { display: flex; align-items: center; gap: 10px; font-size: 24px; font-weight: 800; letter-spacing: -.02em; }
.hero h1 { margin: 10px 0 0; font-size: 26px; line-height: 1.2; }
.hero p { margin: 4px 0 0; opacity: .9; }

.content {
  max-width: 680px; margin: 0 auto;
  padding: 16px;
  padding-bottom: calc(var(--tabbar-h) + 32px + env(safe-area-inset-bottom));
}
.content.has-cartbar { padding-bottom: calc(var(--tabbar-h) + 110px + env(safe-area-inset-bottom)); }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: flex;
  background: var(--surface); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar a {
  position: relative;
  flex: 1; min-height: var(--tabbar-h);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  font-size: 13px; text-decoration: none; color: var(--muted);
}
.tabbar a .ico { font-size: 22px; line-height: 1; }
.tabbar a.active { color: var(--brand-text); font-weight: 600; }
.tabbar .count {
  position: absolute; top: 6px; left: calc(50% + 6px);
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px;
  background: var(--brand); color: var(--on-brand);
  font-size: 12px; font-weight: 700; line-height: 20px; text-align: center;
}

/* ---------- Tarjetas ---------- */
.card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; margin-bottom: 12px;
}
.card-link { text-decoration: none; transition: transform .1s; }
.card-link:active { transform: scale(.985); background: var(--surface-2); }
.card-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.card-row strong { font-size: 18px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.stack > * + * { margin-top: 4px; }
.price { font-weight: 700; font-size: 18px; white-space: nowrap; }
.section-title { margin: 22px 0 10px; font-size: 15px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.empty { text-align: center; color: var(--muted); padding: 32px 16px; }
.empty .big { font-size: 56px; display: block; margin-bottom: 8px; }
.error-box { background: var(--danger-soft); color: var(--danger); border: 1px solid var(--danger-line); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 12px; }
.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* Negocio en la lista: avatar con la inicial + datos */
.biz { display: flex; gap: 14px; align-items: center; }
.avatar {
  flex: none; width: 60px; height: 60px; border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; font-weight: 800; color: var(--on-brand);
}
.biz-info { flex: 1; min-width: 0; }
.biz-info strong { display: block; font-size: 18px; }
.biz .chev { color: var(--line-strong); font-size: 22px; }
.tag {
  display: inline-block; padding: 2px 10px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent-text);
  font-size: 13px; font-weight: 600;
}

/* Cabecera del negocio en su menú */
.biz-header { display: flex; gap: 14px; align-items: center; margin-bottom: 4px; }
.biz-header .avatar { width: 72px; height: 72px; font-size: 32px; }
.biz-header h2 { margin: 0 0 4px; font-size: 22px; }

/* Producto del menú */
.item { display: flex; gap: 12px; align-items: center; cursor: pointer; }
.item-info { flex: 1; min-width: 0; }
.item-info strong { display: block; font-size: 17px; }
.item-info .price { display: block; margin-top: 6px; font-size: 17px; }
.add-btn {
  flex: none; width: 48px; height: 48px; border-radius: 50%;
  border: 0; background: var(--brand); color: var(--on-brand);
  font-size: 26px; font-weight: 700; line-height: 1; cursor: pointer;
  box-shadow: 0 3px 10px var(--brand-shadow);
}
.add-btn:active { transform: scale(.92); }
.in-cart { color: var(--accent-text); font-weight: 700; font-size: 14px; }

/* ---------- Badges de estado ---------- */
.badge {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: 13px; font-weight: 600; white-space: nowrap;
  background: var(--neutral-soft); color: var(--muted);
}
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-info { background: var(--info-soft); color: var(--info); }
/* Error y cancelado llevan ícono de advertencia: no dependen solo del color */
.badge-danger::before, .error-box::before { content: "⚠ "; }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap); padding: 0 18px;
  border: 1px solid var(--line); border-radius: 14px;
  background: var(--surface); color: var(--text);
  font: inherit; font-weight: 700; text-decoration: none;
  cursor: pointer;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .55; cursor: default; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.btn-primary:active { background: var(--brand-strong); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--brand-text); }
.btn-danger { background: var(--surface); border-color: var(--danger); color: var(--danger); }
.btn-block { display: flex; width: 100%; }
.btn-lg { min-height: 58px; font-size: 18px; border-radius: 16px; }
.btn-split { justify-content: space-between; padding: 0 20px; }

/* Selector de cantidad: − 2 + */
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); }
.stepper button {
  width: 44px; height: 44px; border: 0; background: transparent;
  font-size: 22px; font-weight: 700; color: var(--brand-text); cursor: pointer;
}
.stepper button:active { background: var(--brand-soft); border-radius: 50%; }
.stepper span { min-width: 28px; text-align: center; font-weight: 700; font-size: 18px; }
.stepper.lg button { width: 56px; height: 56px; font-size: 26px; }
.stepper.lg span { min-width: 44px; font-size: 22px; }

/* Barra flotante "Ver carrito" sobre la barra de pestañas */
.cartbar {
  position: fixed; left: 12px; right: 12px; z-index: 11;
  bottom: calc(var(--tabbar-h) + 12px + env(safe-area-inset-bottom));
  max-width: 656px; margin: 0 auto;
  box-shadow: 0 8px 24px var(--brand-shadow);
}
.cartbar .qty {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 30px; height: 30px; padding: 0 8px; border-radius: 999px;
  background: var(--on-brand-soft); font-size: 15px;
}

/* ---------- Carrito y checkout ---------- */
.cart-line { display: flex; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.cart-line:last-child { border-bottom: 0; }
.cart-line .name { flex: 1; min-width: 0; }
.cart-line .name strong { display: block; }
.totals { margin-top: 4px; }
.totals .row { display: flex; justify-content: space-between; padding: 6px 0; }
.totals .row.total { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 12px; font-size: 20px; font-weight: 800; }

/* ---------- Formularios ---------- */
.form label { display: block; font-weight: 600; margin: 14px 0 6px; }
.form input, .form textarea {
  width: 100%; min-height: var(--tap);
  padding: 12px 14px;
  border: 1px solid var(--line-strong); border-radius: 14px;
  background: var(--input-bg); color: var(--text);
  font: inherit; font-size: 17px; /* 16px o más evita el zoom automático en iPhone */
}
.form textarea { min-height: 96px; resize: vertical; }
.form input:focus, .form textarea:focus { outline: 3px solid var(--focus-ring); border-color: var(--brand); }
.form .hint { font-size: 14px; color: var(--muted); margin-top: 6px; }

/* Opciones tipo botón (método de pago) */
.choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form .choice { position: relative; margin: 0; font-weight: 400; }
.form .choice input { position: absolute; opacity: 0; width: 1px; height: 1px; min-height: 0; }
.choice > span {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  min-height: 84px; padding: 10px 12px;
  border: 2px solid var(--line); border-radius: 16px;
  background: var(--surface); cursor: pointer; font-weight: 600;
}
.choice .ico { font-size: 28px; }
.choice input:checked + span { border-color: var(--brand); background: var(--brand-soft); color: var(--text); }
.choice input:focus-visible + span { outline: 3px solid var(--focus-ring); }

/* Más métodos de pago: rejilla de 3 columnas, botones más compactos */
.pay-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
.pay-grid .choice > span { min-height: 76px; padding: 8px 4px; font-size: 14px; text-align: center; }
.pay-grid .ico { font-size: 24px; }
.choice.soon > span { opacity: .55; border-style: dashed; cursor: default; }
.choice.soon small { font-size: 11px; font-weight: 700; color: var(--accent-text); }

/* Datos de pago de Tatigo en el checkout */
.pay-info { margin-top: 14px; background: var(--accent-soft); border-color: var(--accent); }
.pay-info-title { font-weight: 700; margin: 14px 0 4px; }
.pay-info .pay-info-title { margin-top: 0; }
.pay-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; border-top: 1px solid var(--accent); }
.pay-row > div { min-width: 0; }
.pay-row span, .pay-row strong { display: block; }
.pay-row strong { font-size: 17px; word-break: break-all; -webkit-user-select: text; user-select: text; }
.pay-amount strong { font-size: 20px; color: var(--accent-text); }
.copy-btn {
  flex: none; min-height: 40px; padding: 0 14px; border-radius: 10px;
  border: 1px solid var(--accent); background: var(--surface); color: var(--accent-text);
  font: inherit; font-size: 14px; font-weight: 700; cursor: pointer;
}
.copy-btn:active { background: var(--accent-soft); }

/* Mapa del checkout */
.map-box {
  height: 260px; margin-bottom: 10px;
  border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; z-index: 0;
}
.map-box.map-off { display: flex; align-items: center; justify-content: center; padding: 16px; text-align: center; color: var(--muted); background: var(--surface); }

/* Resultado del cálculo de envío */
.quote { margin-top: 10px; padding: 12px 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); color: var(--muted); font-size: 15px; }
.quote-ok { background: var(--ok-soft); border-color: var(--ok-line); color: var(--ok); }
.quote-bad { background: var(--danger-soft); border-color: var(--danger-line); color: var(--danger); }
.quote-bad::before { content: "⚠ "; }
.quote-fee { display: block; margin-top: 4px; font-size: 18px; font-weight: 800; }

/* ---------- Registro / inicio de sesión ---------- */
.auth { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; background: var(--bg); }
.auth-top {
  background: var(--header-bg); color: var(--header-text); text-align: center;
  padding: calc(48px + env(safe-area-inset-top)) 20px 40px;
  border-radius: 0 0 32px 32px;
}
.auth-top .brand-logo { width: 96px; height: 96px; box-shadow: 0 0 0 4px var(--logo-ring), 0 8px 24px var(--shadow); }
.auth-top .logo { margin: 12px 0 0; font-size: 34px; font-weight: 800; letter-spacing: -.02em; }
.auth-top p { margin: 4px 0 0; opacity: .92; }
.auth-body { width: 100%; max-width: 440px; margin: 0 auto; padding: 8px 20px calc(24px + env(safe-area-inset-bottom)); }
.segmented { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; margin: 20px 0 4px; background: var(--surface-2); border-radius: 14px; }
.segmented a {
  min-height: 46px; display: flex; align-items: center; justify-content: center;
  border-radius: 11px; text-decoration: none; font-weight: 600; color: var(--muted);
}
.segmented a.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 4px var(--shadow); }
.auth-body .btn { margin-top: 24px; }

/* ---------- Hoja inferior: ver sheet.css (un solo componente para las 4 apps) ---------- */
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(100%); } }

/* Pantalla de pedido confirmado */
.success { text-align: center; padding: 28px 8px 8px; }
.success .check {
  width: 96px; height: 96px; margin: 0 auto 14px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--ok-soft); color: var(--ok); font-size: 52px;
  animation: pop .35s ease-out;
}
.success h2 { margin: 0 0 6px; font-size: 26px; }
@keyframes pop { from { transform: scale(.4); opacity: 0; } }

/* Aviso para instalar la app */
/* Tarjeta "Instala Tatigo": logo y texto (2 líneas) arriba, "Instalar" a todo lo ancho abajo, ✕ arriba a la derecha. */
.install-banner { position: relative; display: grid; gap: 12px; background: var(--accent-soft); border-color: var(--accent); }
.install-top { display: flex; align-items: center; gap: 12px; }
.install-banner .brand-logo { flex: none; width: 44px; height: 44px; box-shadow: none; }
.install-banner .txt { display: flex; flex-direction: column; min-width: 0; font-size: 14px; line-height: 1.35; }
.install-banner .txt strong { font-size: 16px; padding-right: 36px; }
.install-banner .btn-primary { min-height: 44px; }
.install-banner .install-x { position: absolute; top: 4px; right: 4px; width: 40px; min-height: 40px; padding: 0; }

/* ---------- Aviso flotante ---------- */
.toast {
  position: fixed; left: 16px; right: 16px; z-index: 40;
  top: calc(68px + env(safe-area-inset-top)); /* arriba, para no tapar la barra del carrito */
  max-width: 480px; margin: 0 auto;
  padding: 14px 16px; border-radius: 14px;
  background: var(--toast-bg); color: var(--toast-text); text-align: center;
  box-shadow: 0 6px 20px var(--shadow);
}
.toast.error { background: var(--danger-soft); color: var(--danger); border: 1px solid var(--danger-line); }
.toast.error::before { content: "⚠ "; }

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

/* En pantallas grandes, la barra de pestañas queda centrada */
@media (min-width: 720px) {
  .tabbar { justify-content: center; }
  .tabbar a { flex: 0 0 140px; }
  .hero > * { max-width: 640px; margin-left: auto; margin-right: auto; }
}

/* ---------- Correo, contraseña y cancelar ---------- */
.auth-body h2 { margin: 16px 0 6px; font-size: 22px; }
.auth-body .btn-ghost { margin-top: 8px; }
.notice { background: var(--warn-soft); border: 1px solid var(--warn-line); border-radius: var(--radius); padding: 12px 14px; color: var(--text); }
.notice p { margin: 6px 0 10px; }
.notice .btn { background: var(--surface); }
.sheet .notice { margin-top: 12px; }
.confirm-actions { display: flex; gap: 10px; margin-top: 20px; }
.confirm-actions .btn { flex: 1; }
.order-cancel { margin-top: 12px; }

/* Pantalla de carga: ver polish.css (.splash) */

/* ---------- Ajustes ---------- */
.settings-list { padding: 4px 16px; }
.settings-option {
  display: flex; align-items: center; gap: 12px;
  min-height: var(--tap); padding: 10px 0;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.settings-option:last-child { border-bottom: 0; }
.settings-option .txt { flex: 1; min-width: 0; }
.settings-option .txt strong { display: block; font-weight: 600; }
.settings-option input { width: 22px; height: 22px; margin: 0; flex: none; accent-color: var(--brand); }
.settings-link { display: flex; align-items: center; gap: 12px; }
.settings-link .txt { flex: 1; }
.settings-link .ico { font-size: 24px; }
.settings-link .chev { color: var(--line-strong); font-size: 22px; }

/* ---------- Documentos legales (/legal) ---------- */
/* Pie con los enlaces: inicio de sesión, Cuenta y Ajustes (también en /negocio y /tati). */
.legal-links { margin: 28px 0 8px; text-align: center; font-size: 14px; color: var(--muted); }
.legal-links nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 16px; }
.legal-links a { color: var(--muted); padding: 6px 0; text-underline-offset: 2px; }
.legal-links p { margin: 6px 0 0; }
/* Casilla "Acepto los Términos y la Política de Privacidad" */
.form label.check-terms {
  display: flex; align-items: flex-start; gap: 12px;
  margin: 18px 0 0; padding: 12px 14px;
  border: 1px solid var(--line-strong); border-radius: 14px; background: var(--surface);
  font-weight: 400; line-height: 1.4; cursor: pointer;
}
.form label.check-terms input {
  flex: none; width: 24px; height: 24px; min-height: 0; margin: 0; padding: 0;
  accent-color: var(--brand);
}
.form label.check-terms a { color: var(--brand-text); font-weight: 600; }
.terms-docs { display: grid; gap: 10px; margin: 12px 0 4px; }
.terms-docs a { text-decoration: none; }

/* ---------- Marcas con varias sedes ---------- */
.tag-branches { background: var(--info-soft); color: var(--info); }
.location-card { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 15px; }
.branch-option { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; font: inherit; color: inherit; }
.branch-option > .stack { flex: 1; min-width: 0; }
.branch-option[disabled] { opacity: .55; }
.branch-option.is-nearest { border-color: var(--ok); box-shadow: 0 0 0 2px var(--ok-line); }
.branch-facts { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }

/* ---------- Efectivo: moneda (dólares, bolívares o pesos) y total en esa moneda ---------- */
.co-currency { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.co-cur {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 72px; padding: 8px 4px;
  border: 2px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--text);
  font: inherit; font-size: 13px; font-weight: 600; text-align: center; cursor: pointer;
}
.co-cur b { font-size: 20px; font-weight: 800; }
.co-cur small { font-size: 11px; color: var(--danger); font-weight: 700; }
.co-cur.active { border-color: var(--brand); background: var(--brand-soft); }
.co-cur:disabled { opacity: .55; cursor: default; }
.co-cash-total { margin: 12px 0 0; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); font-size: 16px; }
.co-cash-total b { font-size: 18px; }
.co-cash-summary { margin-top: 6px; padding-top: 6px; border-top: 1px dashed var(--line-strong); font-size: 16px; }
.co-cs-row { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 4px 0; }
.co-cs-row b { white-space: nowrap; }
.co-cs-total { font-size: 18px; font-weight: 800; }
.co-cs-total b { font-size: 20px; }
/* Monto que no alcanza (o con centavos en dólares): aviso y no deja confirmar */
.co-pay-warn { margin: 8px 0 0; padding: 10px 12px; border-radius: 12px; background: var(--danger-soft); color: var(--danger); border: 1px solid var(--danger-line); font-size: 15px; font-weight: 600; }
/* Lo que se lleva a la vista (al tocar o con el teclado) no queda escondido bajo el encabezado fijo */
.form label, .form h2, .co-currency, .co-cash-total, #co-pay-info { scroll-margin-top: calc(84px + env(safe-area-inset-top)); }
/* Botones de billete ("¿Con cuánto vas a pagar?") */
.co-bills { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 10px; }
.co-bills .chip {
  min-height: 44px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--text); font: inherit; font-size: 16px; font-weight: 700; cursor: pointer;
}
.co-bills .chip.active { border-color: var(--brand); background: var(--brand-soft); }
