/* Pulido común de las 4 apps (cliente, /negocio, /tati y /admin). Se carga AL FINAL: unifica letra, escala de texto,
   radios, sombras, botones e iconos con las variables de theme.css, y agrega siluetas de carga, fundido de fotos y
   microinteracciones. Las animaciones solo usan transform y opacity y respetan "reducir movimiento". */

/* ---------- Letra y números ---------- */
body { font-family: var(--font); -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
button, input, select, textarea { font-family: inherit; }
/* Precios y montos con números tabulares (las cifras no "bailan" al cambiar) */
.price, .money, .ob-amt, .ob-val, .st-item-price, .totals, .stat .n, .sales-row, .cart-line, .pr-price, .pr-regular,
.cartbar, .st-dtile .price, .pay-amount, .quote-fee, .badge, .dot, .count { font-variant-numeric: tabular-nums; }

/* ---------- Escala de texto (la de la limpieza visual, también en /negocio, /tati y /admin) ---------- */
.topbar h1 { font-size: 19px; font-weight: 800; letter-spacing: -0.02em; }
.section-title { font-size: 13px; font-weight: 700; letter-spacing: .04em; }
h2.title, .content > h2:not(.section-title):not(.st-hello) { font-size: 21px; font-weight: 800; letter-spacing: -0.02em; }
.card-row strong, .card > strong, .biz-info strong, .sheet h3 + p strong { font-size: 16.5px; font-weight: 700; letter-spacing: -0.01em; }
.small { font-size: 13.5px; }
.muted.small, .small.muted, .hint { font-weight: 500; }

/* ---------- Radios, sombras y espacios (múltiplos de 4) ---------- */
.card, .notice, .error-box, .quote, .install-banner, .segmented, .pay-info, .toast { border-radius: var(--r-md); }
.btn, .btn-lg, input:not([type="checkbox"]):not([type="radio"]):not([type="range"]), select, textarea, .choice > span { border-radius: var(--r-md); }
.segmented a { border-radius: var(--r-sm); }
.avatar { border-radius: var(--r-md); }
.card { padding: var(--s-4); margin-bottom: var(--s-3); }
.toast { box-shadow: var(--shadow-md); }
.cartbar { box-shadow: var(--shadow-md); }

/* ---------- Botones: un solo tamaño por tipo ---------- */
.btn { min-height: 48px; font-weight: 700; font-size: 16px; gap: var(--s-2); }
.btn-lg { min-height: 54px; font-size: 17px; }
.btn .ph-i { width: 20px; height: 20px; flex: none; }

/* ---------- Iconos: un mismo estilo y tamaño (20–24 px), color del tema ---------- */
.ph-i { display: inline-block; width: 1.2em; height: 1.2em; vertical-align: -0.22em; flex: none; }
.tabbar a .ico .ph-i, .tabbar .ph-i { width: 24px; height: 24px; display: block; margin: 0 auto; }
.tabbar a.active .ph-i { color: var(--brand-text); }
.chip .ph-i, .st-chip .ph-i { width: 18px; height: 18px; }
.i-ok { color: var(--ok-dot, #34C759); }
.toggle-row .ph-i, .status-card .ph-i { width: 14px; height: 14px; vertical-align: 0; }
/* Iconos 3D (Fluent Emoji): imágenes con su tamaño; texto de respaldo si no hay imagen */
.e3d { display: inline-block; vertical-align: middle; object-fit: contain; flex: none; }
.e3d-txt { line-height: 1; }
.empty .big { display: block; margin: 0 auto 8px; }
.empty .big .e3d { width: 96px; height: 96px; }
.st-chip .e3d { width: 22px; height: 22px; margin-right: 2px; }
.st-perm-ico .e3d { width: 80px; height: 80px; }
.st-grid-item .ico .e3d { width: 40px; height: 40px; }
.st-fallback-ico .e3d { width: clamp(64px, 22vw, 112px); height: auto; aspect-ratio: 1; filter: drop-shadow(0 6px 10px rgb(0 0 0 / .14)); }
.st-btile .st-fallback-ico .e3d, .st-viewed .st-fallback-ico .e3d, .st-dtile .st-fallback-ico .e3d { width: 64px; }
.food-chip .e3d { width: 20px; height: 20px; }

/* ---------- Siluetas de carga (con brillo suave que solo usa transform) ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.sk-wrap { display: block; padding-top: var(--s-1); }
.sk { position: relative; display: block; overflow: hidden; background: var(--sk); border-radius: var(--r-sm); }
.sk::after {
  content: ""; position: absolute; inset: 0; transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, var(--sk-hi), transparent);
  animation: sk-shine 1.3s ease-in-out infinite;
}
@keyframes sk-shine { to { transform: translateX(100%); } }

/* ---------- Pantalla al abrir la app: fondo de Tatigo y el logo "TG" con un pequeño rebote ---------- */
.splash {
  position: relative; min-height: 100vh; min-height: 100dvh; display: grid; place-content: center; justify-items: center; gap: 18px;
  background: var(--tatigo-red); color: #fff;
}
/* En oscuro, el fondo de la app (la app de clientes pone su encabezado en blanco: no se usa --header-bg). */
:root[data-theme="dark"] .splash { background: var(--bg); color: var(--text); }
.splash-t.brand-logo {
  width: 104px; height: 104px; box-shadow: 0 0 0 5px #fff, 0 14px 30px rgb(0 0 0 / .25);
  animation: tg-bounce-in .9s cubic-bezier(.3, 1.4, .5, 1) both, tg-hop 1.6s ease-in-out .9s infinite;
}
:root[data-theme="dark"] .splash-t.brand-logo { box-shadow: 0 0 0 5px var(--surface-2), 0 14px 30px rgb(0 0 0 / .45); }
@keyframes tg-bounce-in {
  0% { transform: scale(.5) translateY(20px); opacity: 0; }
  45% { transform: scale(1.06) translateY(-10px); opacity: 1; }
  70% { transform: scale(.97) translateY(2px); }
  100% { transform: none; }
}
@keyframes tg-hop { 0%, 60%, 100% { transform: none; } 30% { transform: translateY(-8px); } 45% { transform: translateY(1px) scaleY(.97); } }

/* ---------- Círculo de carga propio: anillo rojo de Tatigo alrededor del logo "TG" (versión plana, se distingue mejor así de pequeño) ---------- */
.tg-spin { position: relative; display: inline-grid; place-items: center; width: var(--spin, 44px); height: var(--spin, 44px); flex: none; }
.tg-spin::before {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  border: max(3px, calc(var(--spin, 44px) / 12)) solid var(--sk); border-top-color: var(--tatigo-red); border-right-color: var(--tatigo-red);
  animation: tg-spin .8s linear infinite;
}
.tg-spin-t { width: 58%; height: 58%; border-radius: 50%; background: var(--logo-sm) center / contain no-repeat; }
@keyframes tg-spin { to { transform: rotate(360deg); } }
.tg-spin-block { display: grid; place-items: center; padding: 40px 0; }

/* Botón ocupado (Polish.busy): el texto se oculta y aparece el círculo con el logo pequeño. */
.btn.is-busy { position: relative; color: transparent !important; pointer-events: none; }
.btn.is-busy > * { visibility: hidden; }
.btn.is-busy::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: 24px; height: 24px; margin: -12px 0 0 -12px; border-radius: 50%;
  border: 3px solid rgb(0 0 0 / .12); border-top-color: var(--tatigo-red); border-right-color: var(--tatigo-red);
  animation: tg-spin .8s linear infinite;
}
.btn.is-busy::before {
  content: ""; position: absolute; left: 50%; top: 50%; width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%;
  background: var(--logo-sm) center / contain no-repeat;
}
.btn-primary.is-busy::after, .btn-danger.is-busy::after { border-color: rgb(255 255 255 / .3); border-top-color: #fff; border-right-color: #fff; }
.btn.is-busy:disabled { opacity: 1; }

/* Tarda más de lo normal: mensaje amable y "Reintentar". */
.slow-note { display: grid; justify-items: center; gap: 8px; margin: 16px auto; padding: 14px 16px; max-width: 320px; text-align: center;
  border-radius: var(--r-md); background: var(--surface); color: var(--text); box-shadow: var(--shadow-md); animation: tg-fade .3s ease-out; }
.slow-note p { margin: 0; font-weight: 700; }
.splash .slow-note { position: absolute; left: 16px; right: 16px; bottom: calc(32px + env(safe-area-inset-bottom)); }
@keyframes tg-fade { from { opacity: 0; transform: translateY(8px); } }

/* Reducir movimiento: sin giros, rebotes ni brillos; el logo quieto. */
@media (prefers-reduced-motion: reduce) {
  .sk::after { animation: none; display: none; }
  .splash-t.brand-logo, .slow-note { animation: none; }
  .tg-spin::before, .btn.is-busy::after { animation: none; border-color: var(--tatigo-red); }
}
.sk-line { margin: 0 0 var(--s-2); border-radius: 6px; }
.sk-title { margin: var(--s-1) 0 var(--s-4); }
.sk-row { display: flex; gap: var(--s-3); overflow: hidden; margin-bottom: var(--s-4); }
.sk-quick { display: flex; flex-direction: column; align-items: center; gap: var(--s-2); }
.sk-circle { width: 32px; height: 32px; border-radius: 50%; }
.sk-pill { width: 110px; height: 40px; border-radius: 999px; flex: none; }
.sk-pill.sk-wide { width: 100%; height: 48px; margin: var(--s-3) 0; }
.sk-banner { height: 130px; border-radius: var(--r-md); margin-bottom: var(--s-6); }
.sk-card { margin-bottom: var(--s-6); }
.sk-cover { aspect-ratio: 16 / 8; border-radius: var(--r-md); margin-bottom: var(--s-3); }
.sk-tile { flex: none; width: 70%; }
.sk-tile-ph { aspect-ratio: 16 / 9; border-radius: var(--r-md); margin-bottom: var(--s-2); }
.sk-hero { height: 200px; margin: calc(-1 * var(--s-4)) calc(-1 * var(--s-4)) var(--s-4); border-radius: 0; }
.sk-item { display: flex; gap: var(--s-3); align-items: center; padding: var(--s-3) 0; border-bottom: 1px solid var(--line); }
.sk-item-txt { flex: 1; min-width: 0; }
.sk-thumb { width: 96px; height: 96px; border-radius: var(--r-md); flex: none; }
.sk-avatar { width: 48px; height: 48px; border-radius: var(--r-md); flex: none; }
.sk-box { padding: var(--s-4); margin-bottom: var(--s-3); border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); }
.sk-between { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); }
.sk-badge { width: 80px; height: 22px; border-radius: 999px; }
.sk-btn { height: 48px; border-radius: var(--r-md); margin-top: var(--s-3); }
.sk-btn-lg { height: 54px; }
.sk-stepper { width: 104px; height: 40px; border-radius: 999px; }
.sk-cartline { padding: var(--s-2) 0; }

/* ---------- Error al cargar ---------- */
.error-state { display: flex; flex-direction: column; align-items: center; gap: var(--s-2); padding: var(--s-8) var(--s-4); }
.error-state strong { font-size: 18px; font-weight: 800; color: var(--text); }
.error-state p { margin: 0 0 var(--s-2); max-width: 340px; }

/* ---------- Fotos: fundido al cargar ---------- */
img.fx { opacity: 0; }
img.fx.fx-in { opacity: 1; transition: opacity .35s ease-out; }

/* ---------- Avisos (toasts): abajo, encima de la barra de búsqueda o de la de pestañas ---------- */
.toast {
  top: auto; bottom: calc(var(--tabbar-h, 0px) + env(safe-area-inset-bottom) + 16px);
  opacity: 0; transform: translateY(16px); transition: opacity .22s ease, transform .22s ease; pointer-events: none;
}
.toast.show { opacity: 1; transform: none; }
body.has-search .toast { bottom: calc(var(--search-h, 52px) + env(safe-area-inset-bottom) + 24px); }
body.has-search.cartbar-on .toast { bottom: calc(var(--search-h, 52px) + env(safe-area-inset-bottom) + 92px); }
body.has-first-pill .toast { bottom: calc(var(--search-h, 52px) + env(safe-area-inset-bottom) + 64px); }
body.sheet-open .toast { z-index: 60; }

/* ---------- Microinteracciones (solo con movimiento permitido) ---------- */
@media (prefers-reduced-motion: no-preference) {
  /* Botones que se hunden levemente al presionarlos */
  .btn, .chip, .st-chip, .st-quick, .st-icon, .st-round, .st-fav, .st-arrow, .st-fbtn, .stepper button, .tabbar a,
  .st-addr, .st-menu-row, .st-grid-item, .food-chip span, .icon-btn, .copy-btn {
    transition: transform .12s ease, background-color .15s ease, color .15s ease;
  }
  .btn:active:not(:disabled), .chip:active, .st-chip:active, .st-quick:active, .st-icon:active, .st-round:active, .st-fav:active,
  .st-arrow:active, .st-fbtn:active, .stepper button:active:not(:disabled), .tabbar a:active, .st-addr:active, .st-menu-row:active,
  .st-grid-item:active, .food-chip span:active, .icon-btn:active, .copy-btn:active { transform: scale(.97); }
  /* Corazón: pequeño latido al marcarlo */
  .st-fav.beat .ph-i, .st-round.beat .ph-i { animation: heart-beat .42s ease-out; }
  @keyframes heart-beat { 30% { transform: scale(1.35); } 60% { transform: scale(.92); } 100% { transform: scale(1); } }
  /* Contador del carrito: rebote */
  .bump { animation: bump .4s cubic-bezier(.3, 1.6, .5, 1); }
  @keyframes bump { 40% { transform: scale(1.35); } 100% { transform: scale(1); } }
  /* Entrada suave a la página de un negocio */
  .page-in { animation: page-in .28s ease-out; }
  @keyframes page-in { from { opacity: 0; transform: translateY(10px); } }
}
.st-fav.on, .st-round.on { color: var(--tatigo-red); }

/* Iconos de los contadores (− +), del "+" sobre las fotos y de los botones redondos */
.stepper button .ph-i { width: 20px; height: 20px; vertical-align: 0; }
.stepper.lg button .ph-i { width: 24px; height: 24px; }
.st-plus .ph-i { width: 20px; height: 20px; }
.st-round .ph-i, .st-icon .ph-i, .topbar .icon-btn .ph-i { width: 22px; height: 22px; vertical-align: 0; }
.stepper button { display: inline-flex; align-items: center; justify-content: center; }
/* Producto: el botón "Agregar" queda abajo aunque el producto tenga poco contenido */
.st-item-sheet { display: flex; flex-direction: column; }
.st-item-sheet .st-item { flex: 1 0 auto; }
.st-arrow .ph-i { width: 22px; height: 22px; vertical-align: 0; }

/* Marco de foco: solo al navegar con teclado (:focus-visible). Con el dedo o el mouse, o cuando la app pone el foco
   sola (ej. al volver a la app), no aparece el recuadro. Los campos de texto conservan el suyo al escribir. */
:focus:not(:focus-visible) { outline: none; }

/* Lo oculto con el atributo hidden siempre queda oculto (aunque su clase ponga display: flex o grid) */
[hidden] { display: none !important; }
.segmented a { gap: 6px; }
.segmented .ph-i { width: 20px; height: 20px; vertical-align: 0; }
/* Icono junto a una palabra en texto normal (lo marca polish.js) */
.ph-i.ph-before { margin-inline-end: .3em; }
.ph-i.ph-after { margin-inline-start: .3em; }
/* Estrellas de las reseñas (icono lleno = estrella dada) */
.st-stars { color: #F5A623; letter-spacing: 0; display: inline-flex; gap: 2px; vertical-align: -2px; }
.st-stars .ph-i { width: 16px; height: 16px; vertical-align: 0; }
.st-stars.lg .ph-i { width: 26px; height: 26px; }
.st-rate button .ph-i { width: 38px; height: 38px; vertical-align: 0; }
.star .ph-i { width: 1em; height: 1em; vertical-align: -0.12em; }
.success .check .ph-i { width: 40px; height: 40px; vertical-align: 0; }
.st-addr .check .ph-i, .st-sheet-opt .check .ph-i { width: 20px; height: 20px; vertical-align: 0; }
/* Flechitas: ▾ junto a un texto y › al final de una fila */
.ph-i.caret { width: 14px; height: 14px; vertical-align: -1px; }
.chev .ph-i { width: 18px; height: 18px; vertical-align: 0; display: block; }
.st-near { display: inline-flex; align-items: center; gap: 4px; }
.st-near .ph-i { width: 16px; height: 16px; vertical-align: 0; }
