/* ============================================================
   ui.css — Sistema visual tipo iOS (el mismo lenguaje que BarberOS)
   Se carga DESPUÉS de nexfit_styles.css y cambia la apariencia sin tocar la
   estructura. Principios:
   1. Tipografía del sistema (SF en Apple, Inter en el resto), en minúscula
      normal: nada de etiquetas en mayúsculas con letra de máquina.
   2. Superficies planas y agrupadas; la jerarquía la dan el tamaño, el peso
      y el espacio, no los bordes ni los brillos.
   3. Un solo color de acción (--accent: el verde Bitxio por defecto; cada
      gimnasio elige el suyo en Configuración) y los colores de estado de
      sistema para ok / aviso / error.
   4. Nada se parte en dos líneas por falta de espacio: botones, píldoras y
      títulos van en una línea y, si no caben, se recortan con elipsis.
   Base portada de BarberOS/ui.css; lo propio de Bitxio va al final.
   ============================================================ */

:root {
  --bg: #000000;
  --bg-1: #1C1C1E;
  --bg-2: #2C2C2E;
  --bg-3: #3A3A3C;
  --line: rgba(84, 84, 88, 0.36);
  --line-strong: rgba(84, 84, 88, 0.65);
  --ink: #F5F5F7;
  --ink-2: rgba(235, 235, 245, 0.78);
  --ink-3: rgba(235, 235, 245, 0.55);
  --ink-4: rgba(235, 235, 245, 0.3);
  /* El color de cada gimnasio lo pone applyThemeColors (app.js) encima de estos. */
  --accent: #9eff00;
  --accent-2: #b5ff33;
  --accent-soft: rgba(158, 255, 0, 0.16);
  --accent-ink: #000000;
  --ok: #30D158;
  --warn: #FF9F0A;
  --bad: #FF453A;

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 18px;
  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", system-ui, sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", "Segoe UI", system-ui, sans-serif;
  --shadow-color: rgba(0, 0, 0, 0.5);
  --modal-bg: rgba(0, 0, 0, 0.5);
  --sombra-1: 0 1px 2px rgba(0, 0, 0, 0.3);
  --sombra-2: 0 8px 30px rgba(0, 0, 0, 0.45);
  --vidrio: rgba(28, 28, 30, 0.72);
}

[data-theme="light"] {
  --bg: #F2F2F7;
  --bg-1: #FFFFFF;
  --bg-2: #F2F2F7;
  --bg-3: #E5E5EA;
  --line: rgba(60, 60, 67, 0.14);
  --line-strong: rgba(60, 60, 67, 0.29);
  --ink: #1D1D1F;
  --ink-2: rgba(60, 60, 67, 0.88);
  --ink-3: rgba(60, 60, 67, 0.62);
  --ink-4: rgba(60, 60, 67, 0.32);
  /* Verde Bitxio oscurecido hasta leerse sobre blanco (5.3:1). */
  --accent: #3d7a00;
  --accent-2: #336600;
  --accent-soft: rgba(61, 122, 0, 0.12);
  --accent-ink: #FFFFFF;
  --ok: #248A3D;
  --warn: #C93400;
  --bad: #D70015;
  --shadow-color: rgba(0, 0, 0, 0.08);
  --modal-bg: rgba(0, 0, 0, 0.25);
  --sombra-1: 0 1px 2px rgba(0, 0, 0, 0.06);
  --sombra-2: 0 10px 40px rgba(0, 0, 0, 0.12);
  --vidrio: rgba(255, 255, 255, 0.72);
}

/* ---------- Base ---------- */
/* Mayúsculas y letra de máquina venían también escritas en línea dentro de los
   componentes (style={{ textTransform: 'uppercase', fontFamily: 'var(--font-mono)' }}).
   En vez de perseguirlas una por una: nada va en mayúsculas, y la "mono" pasa a
   ser la misma tipografía con cifras tabulares, que es lo único que aportaba. */
*, *::before, *::after { text-transform: none !important; }
:root { --font-mono: var(--font-sans); }
[style*="letter-spacing"], [class] { letter-spacing: -0.005em; }
[style*="letter-spacing"] { letter-spacing: -0.005em !important; }
body { font-variant-numeric: tabular-nums; }
body {
  font-family: var(--font-sans);
  font-size: 15px;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
.mono { font-family: var(--font-sans) !important; font-variant-numeric: tabular-nums; letter-spacing: 0 !important; }
::selection { background: var(--accent-soft); color: inherit; }
:focus-visible { outline: 3px solid var(--accent-soft); outline-offset: 2px; }

/* Ninguna etiqueta en mayúsculas de máquina: tamaño y peso hacen la jerarquía */
.field label, .hero .eyebrow, .hero-meta .item .l, .tbl th, .nav-section,
.kpi .label, .kpi .l, .stat-mini .l, .settings-card-subtitle, .brand-tag,
.user-meta .r, .section-subtitle, .label, .eyebrow {
  text-transform: none !important;
  letter-spacing: -0.005em !important;
  font-family: var(--font-sans) !important;
}

/* ---------- Menú lateral ---------- */
.sidebar { background: var(--bg-1); border-right: 1px solid var(--line); }
[data-theme="light"] .sidebar { background: rgba(255,255,255,0.86); backdrop-filter: saturate(180%) blur(20px); }
.brand { height: 64px; padding: 0 18px; border-bottom: none; }
.brand::after { content: none !important; }
.brand-mark {
  font-family: var(--font-display) !important; font-weight: 700; font-size: 17px;
  text-transform: none; letter-spacing: -0.02em !important;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.brand-mark .accent { text-shadow: none; }
.brand-tag {
  border: none; background: var(--accent-soft); color: var(--accent);
  font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px;
}
.nav { padding: 6px 10px 12px; gap: 1px; }
.nav-section {
  font-size: 12px; font-weight: 600; color: var(--ink-3);
  padding: 16px 10px 6px !important;
}
.nav-section::before { content: none !important; }
.nav-item {
  font-size: 14px; font-weight: 500; padding: 8px 10px; border-radius: 8px;
  color: var(--ink) !important; gap: 10px;
}
.sidebar .nav-item:hover { transform: none; background: var(--bg-2); }
.nav-item .ico { color: var(--accent); opacity: 1; }
.nav-item.active, .sidebar .nav-item.active { background: var(--accent) !important; color: var(--accent-ink) !important; }
.nav-item.active::before, .sidebar .nav-item.active::before { content: none !important; }
.nav-item.active .ico, .sidebar .nav-item.active .ico { color: var(--accent-ink) !important; }
.nav-item .badge {
  font-family: var(--font-sans); font-size: 12px; font-weight: 500;
  background: transparent !important; color: var(--ink-3) !important; padding: 0;
}
.nav-item.active .badge { color: var(--accent-ink) !important; opacity: .85; }
/* "Cerrar sesión" trae su rojo en línea; la regla de arriba lo pisaba. */
.nav-item[style*="--bad"] { color: var(--bad) !important; }
.sidebar-foot { border-top: 1px solid var(--line); }
.user-chip { box-shadow: none; font-family: var(--font-sans); font-weight: 600; }
.user-meta .n { font-size: 13px; }
.user-meta .r { font-size: 12px; }

/* ---------- Barra superior ---------- */
.topbar {
  height: 60px; padding: 0 28px; border-bottom: 1px solid var(--line);
  background: var(--vidrio); backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  flex-wrap: nowrap !important;
}
.topbar .title {
  font-family: var(--font-display); font-weight: 700; font-size: 20px;
  text-transform: none; letter-spacing: -0.02em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0;
}
.topbar .clock { font-family: var(--font-sans); font-size: 13px; }
.clock .dot { box-shadow: none; background: var(--ok); }
.checkin-quick {
  text-transform: none; letter-spacing: -0.01em; font-weight: 600; font-size: 14px;
  border-radius: 999px; padding: 8px 14px; white-space: nowrap; flex-shrink: 0;
}

/* ---------- Encabezado de cada sección (hero) ---------- */
.content { padding: 28px 32px; }
.hero {
  background: transparent; border: none; padding: 4px 0 8px !important;
  box-shadow: none; overflow: visible;
}
.hero::after { content: none !important; }
.hero .eyebrow { font-size: 13px; font-weight: 600; color: var(--ink-3); margin-bottom: 2px; }
.hero h1 {
  font-family: var(--font-display) !important; font-size: 32px; font-weight: 700;
  letter-spacing: -0.025em !important; text-transform: none !important; line-height: 1.1;
  color: var(--ink); margin: 0 0 6px;
}
.hero h1 .accent { color: inherit; }
.hero p { font-size: 15px; max-width: 560px; }
.hero-meta { border-top: none !important; padding-top: 14px; }
.hero-meta .item .l { font-size: 13px; font-weight: 500; }
.hero-meta .item .v { font-family: var(--font-display); font-weight: 700; letter-spacing: -0.02em; text-shadow: none !important; }

/* ---------- Paneles y tarjetas ---------- */
.panel, .settings-card, .kpi, .emp-card, .plan-card, .stat-mini {
  background: var(--bg-1); border: none !important; border-radius: var(--radius-lg);
  box-shadow: var(--sombra-1);
}
.kpi { border-left: none !important; }
.kpi::before { content: none !important; }
/* La barra de color al costado sobra: el número ya va en el color de su estado. */
.kpi .bar { display: none !important; }
.kpi:hover { transform: none; box-shadow: var(--sombra-1); }
.kpi .value { font-family: var(--font-display); font-weight: 700; letter-spacing: -0.02em; }
.kpi .label { font-size: 13px !important; font-weight: 600; color: var(--ink-2); }
.panel-head { border-bottom: 1px solid var(--line); gap: 10px; }
.panel-head h3, .section-title, .settings-card-title {
  font-family: var(--font-display) !important; font-weight: 700; font-size: 17px;
  text-transform: none !important; letter-spacing: -0.02em !important;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.panel-head h3 { flex: 0 1 auto; min-width: 0; }
.settings-card-icon { border-radius: 10px; }
.empty::before { content: none !important; }

/* ---------- Botones ---------- */
.btn {
  font-family: var(--font-sans); text-transform: none !important; letter-spacing: -0.01em !important;
  font-weight: 600; font-size: 14px; border-radius: 10px; padding: 8px 14px;
  white-space: nowrap; box-shadow: none !important; transform: none !important;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: none; background: var(--bg-2); color: var(--accent);
}
.btn:hover { background: var(--bg-3); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border: none; }
.btn.primary:hover { background: var(--accent-2); }
/* Algunos botones traían color de texto escrito en línea (#000): el primario siempre lleva la tinta del acento */
.btn.primary, .btn.primary * { color: var(--accent-ink) !important; }
.btn.ghost { background: transparent; border: none; color: var(--accent); }
.btn.ghost:hover { background: var(--accent-soft); }
/* Opciones de a dos o tres (forma de pago, agregar/restar stock): la no elegida también
   se ve como botón; sin fondo parecía texto suelto al lado de la elegida */
.metodo-pago > .btn.ghost { background: var(--bg-2); color: var(--ink-2); }
.btn.danger { background: transparent; color: var(--bad); border: none; }
.btn.danger:hover { background: rgba(255, 69, 58, 0.12); }
/* Acción destructiva principal (rojo lleno con letra blanca), como en iOS. */
.btn.destructive, .btn.destructive * { background: var(--bad); color: #fff !important; }
.btn.destructive * { background: transparent; }
.btn.destructive:hover { background: var(--bad); filter: brightness(1.08); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn.lg { padding: 12px 20px; font-size: 15px; border-radius: 12px; }

/* ---------- Campos ---------- */
.field label { font-size: 13px; font-weight: 500; color: var(--ink-2); }
.input, .select, select.input, textarea.input {
  background: var(--bg-2); border: 1px solid transparent; border-radius: 10px;
  font-size: 15px; color: var(--ink); padding: 10px 12px;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.input:focus, .select:focus {
  outline: none; background: var(--bg-1); border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}
.input::placeholder { color: var(--ink-4); }
/* Selector de archivo del navegador: se viste como botón del sistema */
input[type="file"] { font: inherit; font-size: 14px; color: var(--ink-3); max-width: 100%; }
input[type="file"]::file-selector-button {
  font: inherit; font-weight: 600; font-size: 14px; color: var(--accent);
  background: var(--bg-2); border: none; border-radius: 10px; padding: 8px 14px;
  margin-right: 10px; cursor: pointer;
}
input[type="file"]::file-selector-button:hover { background: var(--bg-3); }
/* Las columnas de formulario pueden encoger: si no, el renglón más ancho (p. ej. el
   selector de logo) estiraba todo el formulario y cortaba los campos a la derecha. */
.form-grid > *, .field { min-width: 0; }
.field .input { max-width: 100%; }

/* Casillas de sí/no como interruptor de iOS. Sigue siendo un checkbox (mismo onChange
   y mismo valor en los formularios); solo cambia cómo se ve. */
input[type="checkbox"] {
  appearance: none; -webkit-appearance: none; flex-shrink: 0; position: relative;
  width: 46px !important; height: 28px !important; margin: 0; border-radius: 14px;
  background: var(--bg-3); cursor: pointer; transition: background .2s ease; vertical-align: middle;
}
input[type="checkbox"]::after {
  content: ''; position: absolute; top: 2px; left: 2px; width: 24px; height: 24px; border-radius: 50%;
  background: #fff; box-shadow: 0 2px 4px rgba(0,0,0,.3); transition: transform .2s ease;
}
input[type="checkbox"]:checked { background: var(--ok); }
input[type="checkbox"]:checked::after { transform: translateX(18px); }
input[type="checkbox"]:disabled { opacity: .45; cursor: not-allowed; }
input[type="checkbox"]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Píldoras y chips ---------- */
.chip, .pill {
  text-transform: none !important; letter-spacing: -0.005em !important;
  font-family: var(--font-sans) !important; font-weight: 600; font-size: 13px;
  border-radius: 999px; white-space: nowrap;
}
.chip { background: var(--bg-2); border: none; color: var(--ink); padding: 6px 14px; flex: 0 0 auto; }
.chip.active { background: var(--ink); color: var(--bg); }
.pill { padding: 2px 9px; font-size: 12px; }
/* Píldoras de estado: tinte del color de estado, sin borde ni brillo. */
.pill { border: none !important; }
.pill .dot { box-shadow: none !important; }
.pill.activo { background: var(--accent-soft); }
.pill.por_renovar { background: rgba(255, 159, 10, 0.14); }
.pill.vencido { background: rgba(255, 69, 58, 0.14); }
.pill.ausente { background: var(--bg-2); }
/* Pestañas de sección (Reportes, Configuración…): una sola fila que se desliza, no dos
   renglones. Dentro de una columna flex de alto fijo no se encogen (recortaba los botones). */
.chips, .reportes-subtabs-sticky, .settings-subtabs-sticky {
  flex-wrap: nowrap !important; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch;
  flex-shrink: 0; min-height: max-content; padding-top: 2px; padding-bottom: 2px;
}
.chips::-webkit-scrollbar, .reportes-subtabs-sticky::-webkit-scrollbar, .settings-subtabs-sticky::-webkit-scrollbar { display: none; }

/* ---------- Tablas ---------- */
/* El encabezado queda pegado arriba mientras la lista corre por debajo: necesita
   fondo opaco (el del panel), si no las filas se ven a través y parece que se mueve. */
.tbl th {
  font-size: 12px !important; font-weight: 500; color: var(--ink-3) !important;
  white-space: nowrap; background: var(--bg-1) !important;
  position: sticky; top: 0; z-index: 2;
  box-shadow: inset 0 -1px 0 var(--line);
}
.cell-name .meta .n { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cell-name .meta { min-width: 0; }
.avatar { border: none; border-radius: 50%; font-family: var(--font-sans); font-weight: 600; }
.content-table .toolbar { position: relative; z-index: 3; background: var(--bg-1); border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
.tbl td { border-color: var(--line) !important; }
.tbl-wrap, .panel-body { -webkit-overflow-scrolling: touch; }
.solo-movil { display: none; }

/* ---------- Ventanas (modal) ---------- */
.modal-backdrop { background: var(--modal-bg); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.modal { background: var(--bg-1); border: none; border-radius: 22px; box-shadow: var(--sombra-2); }
.modal-head { border-bottom: none; padding: 20px 22px 6px; }
.modal-head h2 {
  font-family: var(--font-display); font-weight: 700; font-size: 20px;
  text-transform: none; letter-spacing: -0.02em;
}
.modal-head .close { border: none; background: var(--bg-2); border-radius: 50%; width: 30px; height: 30px; color: var(--ink-3); }
.modal-body { padding: 14px 22px 18px; }
.modal-foot { border-top: 1px solid var(--line); background: transparent !important; padding: 12px 22px 20px; }

/* ---------- Toast ---------- */
.toast { border-radius: 14px; backdrop-filter: blur(20px); font-weight: 500; }

/* ---------- Barra superior: alto fijo para lo que se pega debajo ---------- */
:root { --alto-barra: 60px; }
.topbar { z-index: 30 !important; }

/* ============================================================
   PROPIO DE BITXIO
   ============================================================ */

/* POS: encabezado sin caja, título grande como en iOS */
.pos-header { background: transparent !important; border: none !important; padding: 0 !important; margin-bottom: 16px !important; }
.pos-header h2 { font-family: var(--font-display); font-size: 28px; font-weight: 700; letter-spacing: -0.025em; white-space: nowrap; }
.pos-turno { border-left: none !important; border-radius: var(--radius-lg) !important; }
/* Tarjetas de producto: superficie elevada sin borde; el agotado conserva su tinte rojo. */
.pos-card { background: var(--bg-2); border: none; border-radius: 16px; }
.pos-card:hover { border-color: transparent; box-shadow: 0 0 0 2px var(--accent); }
.pos-card.agotado { border: none; box-shadow: none; }
.pos-badge { font-weight: 700; }

/* ---------- Teléfono / tablet ---------- */
@media (max-width: 768px) {
  :root { --alto-barra: 56px; }
  /* El contenido termina por encima de la barra de pestañas (ver "CELULAR COMO APP"). */
  .main { padding: 0 0 calc(var(--alto-tabbar) + env(safe-area-inset-bottom) + 12px) !important; }
  .content, .content.dashboard-shell, .content.reportes-shell { padding: 16px !important; }
  .topbar { padding: 10px 16px; height: 56px; position: sticky; top: 0; z-index: 20; gap: 8px; }
  /* Barra como la de iOS: menú, título y las acciones como botones redondos de ícono.
     Con texto, "Check-in rápido" quedaba fuera de la pantalla y el título se aplastaba
     a 0 px. El texto se oculta solo a la vista (sigue siendo el nombre del botón). */
  .topbar .title { font-size: 17px; flex: 1 1 auto; display: block; }
  .topbar .clock { display: none; }
  .topbar > div[style*="margin-left: auto"] { margin-left: 0 !important; gap: 8px !important; }
  .topbar .lbl-largo { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .topbar .checkin-quick, .topbar .btn {
    width: 38px; height: 38px; padding: 0 !important; margin: 0 !important; gap: 0 !important;
    border-radius: 50% !important; flex: 0 0 auto; justify-content: center;
  }
  .hero h1 { font-size: 26px; }
  .panel { padding: 0; }
  .form-grid { grid-template-columns: minmax(0, 1fr) !important; }
  .settings-card-body { padding: 16px !important; }
  .settings-card-head { padding: 16px !important; }
  .settings-header { flex-wrap: wrap; gap: 12px; }
  .settings-card-body [style*="display: flex"] { flex-wrap: wrap; }
  .settings-card-body [style*="display: flex"] > .input { min-width: 0; flex: 1 1 180px; }
  /* El menú lateral cerrado no debe dejar su sombra asomada por el borde */
  .sidebar:not(.open) { box-shadow: none !important; }
  .pos-header h2 { font-size: 24px; }
  /* Cifras de dos en dos, como los widgets de iOS (una por fila obligaba a desplazarse
     mucho para ver cuatro números). */
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 10px !important; }
  .kpi { padding: 14px !important; }
  /* Tamaño fluido: 28 px a 375 px y ~24 px a 320 px, donde "$129.00" ya se cortaba */
  .kpi .value { font-size: clamp(20px, 7.5vw, 28px) !important; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .kpi .delta { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}
@media (max-width: 640px) {
  .solo-movil { display: block; }
  /* Tablas como listas de iOS: se esconden las columnas secundarias (su dato clave va
     debajo del nombre, en .solo-movil) y la primera columna se queda con el espacio. */
  .col-sec { display: none !important; }
  .content-table .tbl { min-width: 0 !important; }
  .tbl th[style*="width"] { width: auto !important; }
  .tbl-socios td:first-child, .tbl-ranking td:nth-child(2) { max-width: 0; width: 100%; }
  .tbl .lbl-largo { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  /* En la lista el estado queda en el punto de color (el subtítulo ya va en ese color);
     el texto sigue ahí para lectores de pantalla. */
  .tbl .pill { font-size: 0 !important; padding: 6px !important; gap: 0 !important; background: transparent !important; }
  .tbl .pill .dot { width: 10px; height: 10px; }
  .tbl th, .tbl td { padding-left: 12px !important; padding-right: 12px !important; }
  .toolbar { flex-wrap: wrap; gap: 10px; padding: 14px !important; }
  .toolbar .search { min-width: 0; flex: 1 1 100%; }
  .panel-head { flex-wrap: wrap; }
  /* Alertas de renovación como fila de lista de iOS: avatar, nombre y detalle en una
     línea cada uno, y "Renovar" al final. La fila medía 378 px y empujaba el panel fuera
     de la pantalla. La píldora repite lo que ya dice el detalle en rojo/naranja, y el
     botón de WhatsApp abre la misma ficha que "Renovar". */
  .panels > *, .dashboard-shell .panels > .panel { min-width: 0; }
  .alert-row .pill, .alert-row .act .btn.ghost { display: none; }
  .alert-row .n, .alert-row .meta > div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}

/* ============================================================
   CELULAR COMO APP
   Barra de pestañas abajo, menú "Más" como hoja, ventanas que suben desde
   abajo y respeto del notch / barra de inicio cuando se instala en la
   pantalla de inicio (viewport-fit=cover en index.html).
   ============================================================ */
.tabbar { display: none; }
:root { --alto-tabbar: 0px; }

@media (max-width: 768px) {
  :root { --alto-tabbar: 60px; }
  html, body { background: var(--bg); -webkit-tap-highlight-color: transparent; }
  button, a, [role="button"], label, .pos-card { touch-action: manipulation; }

  /* iOS hace zoom al tocar un campo con letra menor a 16 px: todos a 16. */
  input, select, textarea, .input { font-size: 16px !important; }
  input[type="checkbox"] { font-size: 0 !important; }

  /* Barra superior bajo la barra de estado del teléfono */
  .topbar {
    padding-top: calc(10px + env(safe-area-inset-top)) !important;
    height: calc(56px + env(safe-area-inset-top)) !important;
    padding-left: calc(16px + env(safe-area-inset-left)) !important;
    padding-right: calc(16px + env(safe-area-inset-right)) !important;
  }
  .hamburger { display: none !important; }            /* la reemplaza la barra de pestañas */
  .topbar .checkin-topbar { display: none !important; } /* Check-in ya está en la barra */

  /* ---------- Barra de pestañas ---------- */
  .tabbar {
    display: grid; grid-template-columns: repeat(5, 1fr); align-items: end;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 95;
    height: calc(var(--alto-tabbar) + env(safe-area-inset-bottom));
    padding: 0 env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
    background: var(--vidrio);
    backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-top: 1px solid var(--line);
  }
  .tab {
    height: var(--alto-tabbar); border: none; background: none; cursor: pointer; font: inherit;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    color: var(--ink-3); font-size: 10.5px; font-weight: 600; letter-spacing: 0;
    -webkit-tap-highlight-color: transparent; user-select: none;
  }
  .tab .ico { width: 24px; height: 24px; }
  .tab.activa { color: var(--accent); }
  .tab:active { opacity: .55; }
  .tab-central { color: var(--ink-2); }
  .tab-central-circulo {
    width: 48px; height: 48px; border-radius: 50%; margin-top: -20px;
    display: flex; align-items: center; justify-content: center;
    background: var(--accent); color: var(--accent-ink);
    box-shadow: 0 6px 18px rgba(0, 0, 0, .45), 0 0 0 4px var(--bg);
  }
  .tab-central-circulo .ico { width: 24px; height: 24px; }
  .tab-central:active .tab-central-circulo { transform: scale(.94); }

  /* Botón flotante de cobros: por encima de la barra */
  .fab-cobros { bottom: calc(var(--alto-tabbar) + env(safe-area-inset-bottom) + 14px) !important; right: 16px !important; width: 52px !important; height: 52px !important; }
  /* Avisos (toast) por encima de la barra */
  .toast { bottom: calc(var(--alto-tabbar) + env(safe-area-inset-bottom) + 14px) !important; max-width: calc(100vw - 32px); }

  /* ---------- "Más": el menú lateral pasa a ser una hoja desde abajo ---------- */
  .sidebar {
    position: fixed !important; top: auto !important; left: 0 !important; right: 0; bottom: 0;
    width: 100% !important; height: auto !important; max-height: 86dvh;
    border-right: none; border-radius: 22px 22px 0 0;
    padding-bottom: env(safe-area-inset-bottom);
    overflow-y: auto; overscroll-behavior: contain;
    transform: translateY(105%); transition: transform .34s cubic-bezier(.32, .72, 0, 1) !important;
    z-index: 2000; box-shadow: 0 -10px 40px rgba(0, 0, 0, .5) !important;
  }
  .sidebar.open { transform: translateY(0); }
  .sidebar::before {                                   /* agarradera de la hoja */
    content: ''; display: block; flex-shrink: 0; width: 38px; height: 5px; border-radius: 3px;
    background: var(--ink-4); margin: 8px auto 2px;
  }
  .sidebar .brand { height: auto; padding: 8px 20px 4px; }
  .sidebar .en-barra { display: none !important; }    /* ya están en la barra de pestañas */
  .sidebar .nav { padding: 4px 12px 8px; }
  .sidebar .nav-item { padding: 13px 12px; font-size: 16px; border-radius: 12px; }
  .sidebar .nav-section { padding: 14px 12px 4px !important; }
  .mobile-overlay { z-index: 1999 !important; }

  /* ---------- Ventanas como hojas que suben desde abajo ---------- */
  .modal-backdrop { align-items: flex-end !important; padding: 0 !important; }
  .modal-backdrop > .modal {
    width: 100% !important; max-width: none !important; max-height: 94dvh !important;
    margin: 0 !important; border-radius: 22px 22px 0 0 !important;
    padding-bottom: env(safe-area-inset-bottom);
    animation: hojaSube .34s cubic-bezier(.32, .72, 0, 1);
  }
  .modal-head { padding: 18px 18px 6px; }
  .modal-body { padding: 12px 18px 16px; }
  .modal-foot { padding: 12px 18px 16px; }
  .modal-foot .btn { flex: 1; min-height: 46px; font-size: 16px; }
}
@keyframes hojaSube { from { transform: translateY(100%); } to { transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .modal-backdrop > .modal { animation: none !important; }
  .sidebar { transition: none !important; }
}

/* ---------- Celular: tablas como tarjetas y tamaños para el dedo ---------- */
@media (max-width: 640px) {
  /* Inventario (planes y productos): cada fila es una tarjeta. Nombre y precio arriba,
     el detalle debajo y las acciones en su propia fila. Antes había que deslizar la
     tabla de lado (831 px de productos en 323 px de pantalla). */
  .tbl-tarjetas { min-width: 0 !important; }
  .tbl-tarjetas thead { display: none; }
  .tbl-tarjetas tbody tr {
    display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 12px; row-gap: 3px;
    padding: 12px 14px; border-bottom: 1px solid var(--line);
  }
  .tbl-tarjetas tbody tr:last-child { border-bottom: none; }
  .tbl-tarjetas td { display: block; padding: 0 !important; border: none !important; text-align: left !important; min-width: 0; }
  .tbl-tarjetas td:nth-child(1) { grid-column: 1; grid-row: 1; font-size: 15px; }
  .tbl-planes td:nth-child(2) { grid-column: 1; grid-row: 2; font-size: 13px; color: var(--ink-3); }
  .tbl-planes td:nth-child(3) { grid-column: 2; grid-row: 1; font-size: 16px; }
  .tbl-productos td:nth-child(2) { grid-column: 2; grid-row: 1; font-size: 16px; }
  .tbl-productos td:nth-child(3) { grid-column: 1; grid-row: 2; font-size: 13px; color: var(--ink-3); }
  .tbl-productos td:nth-child(3)::before { content: 'Stock  '; white-space: pre; }
  .tbl-tarjetas td:last-child { grid-column: 1 / -1; grid-row: 3; margin-top: 8px; }
  .tbl-tarjetas td:last-child > div { display: flex !important; flex-wrap: wrap; gap: 6px !important; }
  .tbl-tarjetas td:last-child .btn { background: var(--bg-2); padding: 8px 12px; font-size: 13px; min-height: 36px; }

  /* Textos largos (p. ej. la descripción del Historial) se parten en vez de empujar la tabla */
  .tbl td { overflow-wrap: break-word; }
  /* Montos, horas y cifras nunca se parten ("$1 / 5.0 / 0"): cede el texto de al lado */
  .tbl td.mono, .tbl td .mono, .tbl td[style*="text-align: right"] { white-space: nowrap; overflow-wrap: normal; }

  /* Pestañas de filtro y de sección: alto mínimo cómodo para el dedo */
  .chip { min-height: 36px; padding: 8px 14px; display: inline-flex; align-items: center; }
  .btn { min-height: 36px; }
  .btn[style*="font-size: 10"], .btn[style*="font-size: 11"] { font-size: 13px !important; padding: 6px 12px !important; }
}

@media (max-width: 640px) {
  /* Historial: cada registro como tarjeta. Acción arriba, descripción y abajo fecha · usuario.
     Con 4 columnas de 40 px de relleno la tabla no cabía. */
  .tbl-actividad thead { display: none; }
  .tbl-actividad tbody tr { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 8px; row-gap: 2px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
  .tbl-actividad td { display: block; padding: 0 !important; border: none !important; min-width: 0; overflow-wrap: anywhere; }
  .tbl-actividad td:nth-child(3) { grid-column: 1 / -1; grid-row: 1; font-weight: 600; }
  .tbl-actividad td:nth-child(4) { grid-column: 1 / -1; grid-row: 2; font-size: 14px; color: var(--ink-2); }
  .tbl-actividad td:nth-child(1) { grid-column: 1; grid-row: 3; font-size: 12px !important; color: var(--ink-3) !important; }
  .tbl-actividad td:nth-child(2) { grid-column: 2; grid-row: 3; font-size: 12px; color: var(--ink-3); }
  .tbl-actividad td[colspan] { grid-column: 1 / -1; grid-row: 1; padding: 24px 0 !important; }
  /* Botones chiquitos escritos en línea (p. ej. "Registrar retiro") */
  .btn-chico { min-height: 34px; padding: 6px 14px !important; font-size: 13px !important; border-radius: 10px !important; }
}

/* ---------- Celular: ficha del socio como ficha de contacto ---------- */
@media (max-width: 768px) {
  /* Antes iba todo en una fila: foto, datos y 8 botones; los botones quedaban fuera de
     la pantalla. Ahora: foto y datos arriba, Check-in y Renovar como botones grandes,
     y el resto de acciones en una grilla de dos. */
  .detail-head { flex-wrap: wrap; gap: 14px; padding: 6px 0 18px; }
  .detail-head > :first-child { flex: 0 0 64px !important; width: 64px !important; min-width: 64px !important; max-width: 64px !important; height: 64px !important; font-size: 22px !important; border-radius: 50% !important; }
  .detail-head .info { flex: 1 1 0; min-width: 0; }
  .detail-head h1 { font-size: 26px; line-height: 1.1; overflow-wrap: anywhere; }
  .detail-head .sub { gap: 6px 14px; font-size: 13px; }
  .detail-head .actions { flex: 1 1 100%; display: grid !important; grid-template-columns: 1fr 1fr; gap: 8px; }
  .detail-head .actions > * { width: 100%; min-width: 0; }
  .detail-head .actions .btn { width: 100%; min-height: 44px; border-radius: 12px; background: var(--bg-1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .detail-head .actions .btn.primary { background: var(--accent); }
  /* Check-in (último) y Renovar plan (penúltimo) van primero y a todo el ancho */
  .detail-head .actions > :nth-last-child(1), .detail-head .actions > :nth-last-child(2) { grid-column: 1 / -1; }
  .detail-head .actions > :nth-last-child(1) { order: -2; }
  .detail-head .actions > :nth-last-child(2) { order: -1; }
  .detail-head .actions > div { display: flex !important; gap: 8px !important; }
  .stat-row { grid-template-columns: 1fr 1fr; gap: 10px; }

  /* Listas con su propio scroll: en el teléfono un scroll dentro de otro incomoda;
     la lista crece y se desplaza con la página. */
  .tbl-wrap.capped { max-height: none; overflow-y: visible; }
  /* Botón de cerrar de las hojas: un poco más grande para el dedo */
  .modal-head .close { width: 34px; height: 34px; }
}

@media (max-width: 640px) {
  /* Pestañas de sección: separación entre ícono y texto */
  .chip { gap: 6px; }
  /* Título grande de iOS sin párrafo de relleno debajo: en el teléfono empujaba lo
     importante media pantalla hacia abajo. */
  .hero > p { display: none; }
}

/* ---------- Celular: animaciones de la barra de pestañas ---------- */
@media (max-width: 768px) {
  /* Píldora que se desliza hasta la pestaña activa con efecto resorte (--i la pone app.js). */
  .tabbar { --i: 0; }
  .tab-indicador {
    position: absolute; top: 7px; left: calc((var(--i) + 0.5) * 20%);
    width: 58px; height: 30px; margin-left: -29px; border-radius: 999px;
    background: var(--accent-soft); pointer-events: none;
    transition: left .5s cubic-bezier(.34, 1.56, .64, 1);
  }
  .tab { position: relative; transition: color .25s ease; }
  .tab .ico { transition: transform .15s ease; }
  /* Al presionar, el ícono se achica (como en iOS); al activarse, rebota. */
  .tab:active { opacity: 1; }
  .tab:active .ico { transform: scale(.82); }
  .tab.activa .ico { animation: tabRebote .5s cubic-bezier(.34, 1.56, .64, 1); }
  .tab-central-circulo { transition: transform .15s ease, box-shadow .15s ease; }
  .tab-central:active .tab-central-circulo { transform: scale(.9); }
  .tab-central:active .ico { transform: none; }

  /* Socios, Rankings e Historial: lo de arriba (búsqueda, filtros) queda fijo y solo se
     desplaza la lista. Antes la página entera corría y la búsqueda se iba con el scroll.
     La sección ocupa justo el alto entre la barra superior y la de pestañas. */
  .content.content-table {
    flex: none !important; overflow: hidden !important; display: flex; flex-direction: column;
    height: calc(100dvh - 56px - env(safe-area-inset-top) - var(--alto-tabbar) - env(safe-area-inset-bottom) - 12px) !important;
    padding: 12px !important;
  }
  .content-table .panel { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
  .content-table .toolbar, .content-table > .hero { flex: 0 0 auto; }
  .content-table .tbl-wrap { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
}
@keyframes tabRebote {
  0% { transform: scale(.75) translateY(3px); }
  55% { transform: scale(1.15) translateY(-2px); }
  100% { transform: none; }
}

/* Silueta mientras carga (POS la primera vez): bloques con un brillo que pasa */
.esqueleto { background: linear-gradient(90deg, var(--bg-1) 30%, var(--bg-2) 50%, var(--bg-1) 70%) !important; background-size: 300% 100% !important; animation: brilloEsqueleto 1.3s ease-in-out infinite; box-shadow: none !important; }
@keyframes brilloEsqueleto { from { background-position: 100% 0; } to { background-position: 0 0; } }

@media (prefers-reduced-motion: reduce) {
  .tab-indicador { transition: none; }
  .tab.activa .ico { animation: none; }
  .esqueleto { animation: none; }
}

/* Los textos ocultos a la vista (.lbl-largo, position: absolute) se anclan a su botón.
   Sin esto se ubicaban respecto de la página y la estiraban: en Socios la página podía
   desplazarse 5800 px de vacío aunque la lista tuviera su propio scroll. */
.btn, .checkin-quick, .tbl-wrap { position: relative; }

/* ---------- Nada más ancho que la pantalla ---------- */
@media (max-width: 768px) {
  /* Tablas dentro de ventanas (historial de stock, etc.): sin el ancho mínimo de 500 px
     que traen las tablas en el celular; dentro de una hoja no hay de dónde sacarlo. */
  .modal .tbl { min-width: 0 !important; }
  .modal .tbl th, .modal .tbl td { padding: 8px 6px !important; white-space: normal !important; font-size: 13px; }
  /* Forma de pago (Efectivo · Transferencia · Tarjeta): los tres se reparten el ancho */
  .metodo-pago > .btn { flex: 1 1 0 !important; min-width: 0; padding: 9px 6px !important; font-size: 13px; overflow: hidden; text-overflow: ellipsis; }
  /* Check-in: el estado queda en el punto de color */
  .checkin-fila { padding: 10px 6px !important; gap: 10px !important; }
  .checkin-fila .pill { font-size: 0 !important; padding: 6px !important; gap: 0 !important; background: transparent !important; }
  .checkin-fila .pill .dot { width: 10px; height: 10px; }
  /* Alertas: el botón de recordatorio baja a su propia fila, a todo el ancho */
  .alerta-fila { padding: 14px !important; }
  .alerta-fila > a, .alerta-fila > a .btn { width: 100%; }
  /* Vista previa del ticket: se ajusta al ancho de la hoja */
  .ticket-print-area { max-width: 100%; box-sizing: border-box; }
  /* Red de seguridad: si algo quedara más ancho, se recorta en vez de dejar deslizar
     toda la pantalla de lado. clip (no hidden) para no romper lo que va fijo arriba. */
  html, body, .app { overflow-x: clip; }
  .main { overflow-x: clip !important; }  /* el base trae hidden: volvía a .main un contenedor de scroll y la barra superior no quedaba fija */
}
@media (max-width: 400px) {
  .metodo-pago > .btn .ico { display: none; }
}
@media (max-width: 768px) {
  /* La lista del check-in llega a los bordes de la hoja: su margen negativo debe igualar
     el relleno de la hoja en el celular (18 px, no los 24 del escritorio). */
  .checkin-lista { margin: 0 -18px !important; }
}

/* ---------- Textos cortos en el celular (componente Txt) ---------- */
.txt-corto { display: none; }
@media (max-width: 640px) {
  .txt-largo { display: none; }
  .txt-corto { display: inline; }
}
/* Texto dentro de un botón: si no cabe, se corta con … al final (no por los dos lados,
   que es lo que pasaba con el texto centrado). */
.btn > span:not(.lbl-largo):not(.txt-largo):not(.txt-corto),
.btn > .txt-largo, .btn > .txt-corto { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 640px) { .btn > .txt-largo { display: none; } }
/* Teléfonos muy angostos (iPhone SE): en Rankings se esconde la racha para que el
   nombre del socio se lea entero. */
@media (max-width: 400px) { .col-angosta { display: none !important; } }
@media (max-width: 400px) {
  /* Teléfonos angostos: menos margen por celda (cada columna gastaba 24 px en relleno) */
  .tbl th, .tbl td { padding-left: 8px !important; padding-right: 8px !important; }
  .tbl th:first-child, .tbl td:first-child { padding-left: 12px !important; }
}
@media (max-width: 400px) {
  /* Alertas del Inicio: fila más compacta para que el nombre entre al lado de "Renovar" */
  .alert-row { padding: 10px 12px !important; gap: 10px !important; }
  .alert-row .act .btn { padding: 8px 12px; }
  /* Rankings: el puesto ya identifica la fila; la foto se esconde y el nombre se lee entero */
  .tbl-ranking .cell-name .avatar { display: none; }
}

/* ============================================================
   HOJA "MÁS" COMO AJUSTES DE iOS (celular)
   Perfil arriba (gimnasio + quién usa la app), opciones en tarjetas agrupadas
   con ícono en recuadro de color y flecha, "Cerrar sesión" aparte.
   ============================================================ */
.nav-grupo { display: contents; }   /* en escritorio los grupos no cuentan para el layout */
.hoja-cerrar { display: none; }

@media (max-width: 768px) {
  .sidebar {
    background: var(--bg) !important; max-width: 640px; margin: 0 auto;
    padding-bottom: calc(env(safe-area-inset-bottom) + 20px) !important;
  }
  .hoja-cerrar {
    display: flex; align-items: center; justify-content: center;
    position: absolute; top: 14px; right: 16px; z-index: 2;
    width: 30px; height: 30px; border-radius: 50%; border: none; cursor: pointer;
    background: var(--bg-2); color: var(--ink-3);
  }

  /* Perfil: el gimnasio y, debajo, quién usa la app (toca para cambiar de usuario).
     Visualmente una sola tarjeta con dos filas. */
  .sidebar .brand {
    margin: 30px 16px 0; padding: 16px !important; height: auto;
    background: var(--bg-1); border-radius: 14px 14px 0 0;
  }
  .sidebar .brand-mark { font-size: 21px !important; font-weight: 800; }
  .sidebar .sidebar-foot {
    order: 1; margin: 0 16px; padding: 12px 16px !important;
    background: var(--bg-1); border-radius: 0 0 14px 14px; border-top: 1px solid var(--line) !important;
  }
  .sidebar .sidebar-foot:active { background: var(--bg-2); }
  .sidebar .sidebar-foot .user-chip { width: 42px; height: 42px; font-size: 18px; border-radius: 50%; }
  .sidebar .sidebar-foot .user-meta { gap: 3px; }
  .sidebar .sidebar-foot .user-meta .n { font-size: 16px; }
  .sidebar .sidebar-foot .user-meta .r { font-size: 13px; }
  .sidebar .sidebar-foot::after,
  .sidebar .nav-grupo .nav-item::after {             /* flecha › */
    content: ''; flex-shrink: 0; width: 8px; height: 8px; margin-right: 4px;
    border-top: 2px solid var(--ink-4); border-right: 2px solid var(--ink-4); transform: rotate(45deg);
  }
  .sidebar .nav { order: 2; padding: 0 16px 8px; }

  /* Secciones y grupos */
  .sidebar .nav-section { padding: 22px 16px 7px !important; font-size: 13px; font-weight: 500; color: var(--ink-3); }
  .sidebar .nav-grupo { display: flex; flex-direction: column; background: var(--bg-1); border-radius: 14px; overflow: hidden; }
  .sidebar .nav-grupo .nav-item {
    position: relative; min-height: 50px; padding: 9px 14px !important; gap: 14px;
    font-size: 16px; font-weight: 500; border-radius: 0 !important; background: transparent;
  }
  .sidebar .nav-grupo .nav-item:active { background: var(--bg-2) !important; }
  /* La pantalla en la que estás: fila resaltada suave (no el relleno verde del escritorio) */
  .sidebar .nav-grupo .nav-item.active { background: var(--bg-2) !important; color: var(--ink) !important; }
  .sidebar .nav-grupo .nav-item.active .ico { color: #fff !important; }
  /* Línea fina entre filas, empezando después del ícono */
  .sidebar .nav-grupo .nav-item:not(.en-barra) ~ .nav-item::before {
    content: '' !important; position: absolute; top: 0; left: 58px; right: 0; height: 1px;
    background: var(--line) !important; box-shadow: none !important; width: auto !important; border-radius: 0 !important;
  }
  /* Ícono en recuadro de color, como en Ajustes */
  .sidebar .nav-grupo .nav-item .ico {
    width: 30px !important; height: 30px !important; flex: 0 0 30px !important; padding: 6px; border-radius: 8px;
    background: var(--c, var(--bg-3)); color: #fff !important; stroke-width: 2;
  }
  /* Contador (Alertas) como globo rojo antes de la flecha */
  .sidebar .nav-grupo .nav-item .badge {
    margin-left: auto; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 11px;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--bad) !important; color: #fff !important; font-size: 13px !important; font-weight: 600 !important; opacity: 1 !important;
  }
  .sidebar .nav-grupo .nav-item:not(:has(.badge))::after { margin-left: auto; }
  .sidebar .nav-grupo .nav-item:has(.badge)::after { margin-left: 8px; }

  /* Cerrar sesión: aparte, centrado y en rojo */
  .sidebar .nav-grupo-salir { margin-top: 26px; }
  .sidebar .nav-grupo-salir .nav-item { justify-content: center; color: var(--bad) !important; margin-top: 0 !important; }
  .sidebar .nav-grupo-salir .nav-item .ico, .sidebar .nav-grupo-salir .nav-item::after { display: none; }
}

/* ============================================================
   CELULAR: PANTALLA QUIETA, COMO UNA APP
   Antes se desplazaba la página entera: la barra de direcciones del navegador
   aparecía y desaparecía (todo saltaba) y al llegar arriba la pantalla se
   estiraba o se recargaba. Ahora la página no se mueve: la barra de arriba y la
   de pestañas quedan fijas y solo se desplaza el contenido del medio (.main).
   ============================================================ */
@media (max-width: 768px) {
  :root { --tope: calc(56px + env(safe-area-inset-top)); }
  html, body { height: 100%; overflow: hidden !important; overscroll-behavior: none; }
  .main {
    position: fixed !important; inset: 0; height: auto !important;
    overflow-y: auto !important; overflow-x: hidden !important;
    overscroll-behavior-y: contain; -webkit-overflow-scrolling: touch;
  }
  /* Espacio de la barra de arriba como espaciador (no como padding-top): con padding,
     lo que se pega arriba (pestañas de Reportes y Ajustes) quedaba 56 px más abajo en
     Chrome, y Safari no cuenta el padding igual. Con un espaciador es igual en todos. */
  .main::before { content: ''; display: block; flex: 0 0 var(--tope); height: var(--tope); }
  /* La barra de arriba, fija sobre el contenido (que pasa por debajo, difuminado) */
  .topbar { position: fixed !important; top: 0; left: 0; right: 0; z-index: 30 !important; }
  /* Lo que se pega arriba dentro de una pantalla va justo debajo de la barra */
  .settings-header { position: static !important; }
  .settings-subtabs-sticky, .reportes-subtabs-sticky { top: var(--tope) !important; }
  /* Las pestañas que se deslizan llegan al borde de la pantalla (como en Socios): el botón
     cortado en el borde avisa que hay más, sin desvanecido encima */
  .settings-subtabs-sticky, .reportes-subtabs-sticky {
    margin-left: -16px !important; margin-right: -16px !important;
    padding-left: 16px !important; padding-right: 16px !important; scroll-padding-left: 16px;
  }
  .reportes-subtabs-sticky { margin-right: -20px !important; }  /* su contenedor suma 4 px a la derecha */
}

/* ============================================================
   CELULAR: SOCIOS Y ALERTAS COMO LISTAS DE iOS
   ============================================================ */
@media (max-width: 768px) {
  /* ---------- Socios ----------
     Búsqueda con botón redondo "+" al lado, filtros debajo (con desvanecido que avisa
     que se deslizan) y la lista en una tarjeta, sin encabezados de tabla. */
  .content.content-table.socios-vista { padding: 10px 0 0 !important; }  /* sin el relleno de 12 px de las listas: los márgenes los pone la tarjeta */
  .socios-vista > .panel { background: transparent !important; box-shadow: none !important; border-radius: 0 !important; }
  .socios-vista .toolbar {
    display: grid !important; grid-template-columns: minmax(0, 1fr) auto; gap: 10px !important;
    padding: 0 16px 10px !important; background: transparent !important; border: none !important;
  }
  .socios-vista .toolbar .search { grid-column: 1; grid-row: 1; min-width: 0; }
  .socios-vista .toolbar > .btn {
    grid-column: 2; grid-row: 1; width: 44px; height: 44px; min-height: 44px;
    padding: 0 !important; border-radius: 50% !important;
  }
  .socios-vista .toolbar > .btn .ico { width: 20px; height: 20px; }
  .socios-vista .toolbar > div[style*="flex: 1"] { display: none; }
  .socios-vista .toolbar .chips { grid-column: 1 / -1; grid-row: 2; margin: 0 -16px; padding: 2px 16px !important; }
  .socios-vista .tbl-wrap { margin: 0 16px; background: var(--bg-1); border-radius: 14px; }
  .socios-vista .tbl thead { display: none; }
  .socios-vista .tbl tbody tr:last-child td { border-bottom: none !important; }

  /* (Aquí había un desvanecido a la derecha de toda fila .chips: se pintaba siempre,
     también en filas que no se deslizan, y quedaba como una sombra rara sobre el último
     botón, p. ej. "Racha" en Rankings. Las filas que sí se deslizan llegan al borde de la
     pantalla y el botón cortado ya avisa que hay más.) */

  /* ---------- Alertas ----------
     Antes era una caja de alto fijo con la lista desplazándose adentro (diseño de
     escritorio): quedaba bajo la barra de pestañas y con doble scroll. Ahora fluye. */
  .content.alertas-shell { flex: none !important; height: auto !important; overflow: visible !important; display: block !important; }
  .alertas-shell > .panel { margin-bottom: 16px !important; }
  .alertas-email > div:first-child { padding: 16px !important; }
  .alertas-email > div:first-child > div:first-child > div:first-child { font-size: 16px !important; }
  .alertas-email .btn { width: 100%; justify-content: center; min-height: 46px; }
  .alertas-list-panel { overflow: visible !important; }
  .alertas-list-panel .toolbar { padding: 0 !important; }
  /* Ausentes · Vencidos · Por vencer: tres pestañas iguales con el número arriba. En una
     fila de píldoras no cabían (379 px) y "Por Vencer" se salía de la tarjeta. */
  /* Las pestañas quedan fijas bajo la barra de arriba al bajar por la lista (como las de
     Reportes); la tarjeta de correo sí se va con el scroll */
  .alertas-list-panel .toolbar {
    display: block !important; position: sticky; top: var(--tope); z-index: 5;
    background: var(--bg-1); border-radius: 22px 22px 0 0;
  }
  .alertas-list-panel .chips {
    display: grid !important; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px !important;
    padding: 12px 14px !important; width: 100%; min-width: 0; overflow: visible !important;
  }
  .alertas-list-panel .chip {
    flex-direction: column; justify-content: center; gap: 1px !important; min-width: 0;
    min-height: 58px; padding: 8px 4px !important; border-radius: 14px; white-space: nowrap;
  }
  .alertas-list-panel .chip .chip-num { order: -1; font-family: var(--font-display); font-size: 20px; font-weight: 700; line-height: 1.1; }
  .alertas-list-panel .chip .chip-lbl { font-size: 12px; font-weight: 600; }
  .alertas-list-panel .chip .chip-sep { display: none; }
  .alertas-list-scroll { overflow: visible !important; padding: 0 !important; }
  .alertas-lista { gap: 0 !important; }
  /* Cada socio como fila: avatar, nombre y detalle, y un botón redondo de WhatsApp */
  .alerta-fila {
    flex-wrap: nowrap !important; gap: 12px !important; padding: 12px 14px !important;
    background: transparent !important; border-left: none !important; border-radius: 0 !important;
    border-bottom: 1px solid var(--line);
  }
  .alerta-fila:last-child { border-bottom: none; }
  .alerta-fila > div:first-child { flex: 1 1 auto !important; gap: 12px !important; }
  .alerta-fila > a, .alerta-fila > a .btn { width: auto !important; }
  .alerta-fila > a { flex: 0 0 auto; }   /* sin esto la fila aplastaba el botón redondo a una píldora */
  .alerta-fila .alerta-wa .btn {
    width: 44px !important; height: 44px; min-height: 44px; padding: 0 !important; border-radius: 50% !important;
    background: rgba(37, 211, 102, 0.16) !important; border: none !important;
  }
  .alerta-fila .alerta-wa .btn .ico { width: 20px; height: 20px; }
  .alerta-fila > span { font-size: 11px !important; padding: 0 !important; white-space: nowrap; }
}

/* ============================================================
   CELULAR: POS COMO APP
   Orden por uso: estado del turno, productos para vender, accesos de caja y
   fecha, y al final transacciones e historial. Antes los productos quedaban a
   media pantalla, debajo del título, tres botones dispares y la fecha.
   ============================================================ */
@media (max-width: 768px) {
  .content.pos-shell { display: flex !important; flex-direction: column; }
  .pos-shell > .pos-turno, .pos-shell > .pos-apertura { order: 1; }
  .pos-shell > .pos-productos { order: 2; }
  .pos-shell > .pos-header { order: 3; }
  .pos-shell > .pos-columnas { order: 4; }
  .pos-shell > .pos-turno, .pos-shell > .pos-apertura, .pos-shell > .pos-productos, .pos-shell > .pos-header { margin-bottom: 16px !important; }

  /* El título repite el de la barra de arriba ("POS") */
  .pos-header h2 { display: none; }
  /* Accesos de caja: tres iguales, ícono arriba y texto abajo, como accesos rápidos de iOS */
  .pos-header-acciones { display: flex !important; flex-wrap: wrap; gap: 8px !important; }
  .pos-header-acciones > .btn {
    flex: 1 1 0 !important; flex-direction: column; gap: 6px !important; min-height: 70px;
    padding: 10px 6px !important; border: none !important; border-radius: 14px !important;
    background: var(--bg-1) !important; color: var(--ink) !important;
    font-size: 12.5px !important; font-weight: 600; white-space: normal !important; text-align: center;
  }
  .pos-header-acciones > .btn .ico { width: 22px; height: 22px; color: var(--accent); }
  .pos-header-acciones > .btn.danger .ico { color: var(--bad); }
  .pos-header-acciones > .btn > span { white-space: normal !important; overflow: visible !important; }
  .pos-header-acciones input[type="date"] { flex: 1 1 100% !important; }

  /* Turno abierto: Corte Z como botón de verdad (antes era solo texto rojo) */
  .pos-turno > .btn { background: rgba(255, 69, 58, 0.14) !important; min-height: 46px; border-radius: 12px !important; font-size: 15px !important; }

  /* Transacción abierta: cada movimiento como fila. Detalle arriba y hora debajo,
     monto a la derecha y la acción (anular / borrar) como botón tocable. */
  div:has(> .tbl-trans) { padding: 2px 14px !important; }
  .tbl-trans tbody tr {
    display: grid; grid-template-columns: minmax(0, 1fr) auto auto; column-gap: 10px; row-gap: 2px;
    align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line);
  }
  .tbl-trans tbody tr:last-child { border-bottom: none; }
  .tbl-trans td { display: block; padding: 0 !important; border: none !important; width: auto !important; }
  .tbl-trans td:nth-child(2) { grid-column: 1; grid-row: 1; font-size: 14px !important; color: var(--ink) !important; }
  .tbl-trans td:nth-child(1) { grid-column: 1; grid-row: 2; font-size: 12px !important; }
  .tbl-trans td:nth-child(3) { grid-column: 2; grid-row: 1 / 3; font-size: 15px !important; font-weight: 600; }
  .tbl-trans td:nth-child(4) { grid-column: 3; grid-row: 1 / 3; }
  .tbl-trans td:nth-child(4) button { width: 38px; height: 38px; padding: 0 !important; border-radius: 10px !important; font-size: 16px !important; }
  .tbl-trans td:nth-child(4):empty { display: none; }
}
@media (max-width: 768px) {
  /* Transacciones e Historial apilados: cada panel con su alto natural. Con flex: 1
     (pensado para repartir el ANCHO en escritorio) se repartían el alto y el panel de
     transacciones quedaba recortado: los últimos movimientos no se podían ver. */
  .pos-columnas > .panel { flex: 0 0 auto !important; }
}
@media (max-width: 768px) {
  /* Con una ventana abierta se esconden la barra de pestañas y el botón de cobros, como
     en iOS (la hoja los cubre). Hace falta porque .main es fixed y crea su propio
     contexto de apilamiento: las ventanas que viven dentro de una pantalla (vender,
     Corte Z, ajustar stock...) no podían pasarle por encima a la barra con z-index, y
     la barra tapaba los botones del pie de la hoja. */
  .app:has(.modal-backdrop) .tabbar,
  body:has(.modal-backdrop) .fab-cobros { display: none !important; }
}

/* ============================================================
   CELULAR: TABLAS DE REPORTES
   Tenían el ancho mínimo de 500 px de las tablas y se salían de la pantalla.
   ============================================================ */
@media (max-width: 768px) {
  /* Ingresos por producto / por plan: 4 columnas cortas, entran sin ancho mínimo */
  .rep-agrupada { min-width: 0 !important; }
  .rep-agrupada td:first-child { overflow-wrap: break-word; }

  /* Gastos, adelantos y cartera: cada registro como tarjeta */
  .rep-gastos, .rep-adelantos, .rep-cartera { min-width: 0 !important; }
  .rep-gastos thead, .rep-adelantos thead, .rep-cartera thead { display: none; }
  .rep-gastos tbody tr, .rep-adelantos tbody tr, .rep-cartera tbody tr {
    display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 12px; row-gap: 3px;
    align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line);
  }
  .rep-gastos tbody tr:last-child, .rep-adelantos tbody tr:last-child, .rep-cartera tbody tr:last-child { border-bottom: none; }
  /* .tbl.rep-*: le gana a .tbl td:first-child (relleno de 12 px en ≤400 px) */
  .tbl.rep-gastos td, .tbl.rep-adelantos td, .tbl.rep-cartera td { display: block; padding: 0 !important; border: none !important; text-align: left !important; min-width: 0; }

  /* Gastos: descripción y monto arriba; fecha y responsable debajo */
  .rep-gastos td:nth-child(1) { grid-column: 1; grid-row: 1; }
  .rep-gastos td:nth-child(4) { grid-column: 2; grid-row: 1; }
  .rep-gastos td:nth-child(2) { grid-column: 1; grid-row: 2; font-size: 12px !important; color: var(--ink-3) !important; }
  .rep-gastos td:nth-child(3) { grid-column: 1; grid-row: 3; font-size: 12px; color: var(--ink-3) !important; }

  /* Adelantos: empleado y monto arriba; motivo y fecha debajo; estado a la derecha */
  .rep-adelantos td:nth-child(1) { grid-column: 1; grid-row: 1; }
  .rep-adelantos td:nth-child(5) { grid-column: 2; grid-row: 1; }
  .rep-adelantos td:nth-child(2) { grid-column: 1; grid-row: 2; font-size: 13px; }
  .rep-adelantos td:nth-child(3) { grid-column: 1; grid-row: 3; font-size: 12px !important; color: var(--ink-3) !important; }
  .rep-adelantos td:nth-child(4) { grid-column: 2; grid-row: 2 / 4; justify-self: end; }
  .rep-adelantos td:nth-child(n+6) { grid-column: 1 / -1; }

  /* Cartera: socio y monto arriba; concepto y teléfono debajo, alineados con el nombre */
  .rep-cartera td:nth-child(1) { grid-column: 1; grid-row: 1; }
  .rep-cartera td:nth-child(4) { grid-column: 2; grid-row: 1 / 4; }
  .rep-cartera td:nth-child(3) { grid-column: 1; grid-row: 2; padding-left: 46px !important; }
  .rep-cartera td:nth-child(3) > div { font-size: 13px !important; }
  .rep-cartera td:nth-child(2) { grid-column: 1; grid-row: 3; padding-left: 46px !important; font-size: 12px; color: var(--ink-3) !important; }
}
@media (max-width: 400px) {
  /* El detalle de las cifras ("15 socios pendientes") baja de línea en vez de cortarse */
  .kpi .delta { white-space: normal; overflow: visible; }
}

/* ============================================================
   CELULAR: INVENTARIO (membresías, productos e historial de stock)
   ============================================================ */
@media (max-width: 640px) {
  /* Relleno parejo en las tarjetas: .tbl td:first-child (relleno de 12 px en ≤400 px)
     le ganaba a .tbl-tarjetas td y corría el nombre respecto a "Stock" y los botones */
  .tbl.tbl-tarjetas td { padding: 0 !important; }

  /* Acciones como los botones de Contactos de iOS: ícono sobre el texto, todas del mismo
     ancho y en una sola fila (con el texto al lado, "Eliminar" quedaba solo abajo) */
  .tbl-tarjetas td:last-child > div {
    display: grid !important; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 8px !important;
  }
  .tbl-tarjetas td:last-child .btn {
    flex-direction: column; gap: 4px; min-height: 54px; padding: 8px 2px; font-size: 12px; border-radius: 12px; min-width: 0;
  }
  .tbl-tarjetas td:last-child .btn .ico { width: 18px; height: 18px; }

  /* Historial de stock: sin caja con scroll propio dentro de la hoja (doble scroll) y
     cada movimiento como fila: tipo y motivo con la cantidad grande a la derecha;
     fecha y stock resultante debajo */
  .log-stock { max-height: none !important; overflow: visible !important; }
  .tbl-log thead { display: none; }
  .tbl-log tbody tr {
    display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 12px; row-gap: 4px;
    padding: 12px 0; border-bottom: 1px solid var(--line);
  }
  .tbl-log tbody tr:last-child { border-bottom: none; }
  .tbl.tbl-log td { display: block; padding: 0 !important; border: none !important; text-align: left !important; min-width: 0; }
  .tbl-log td:nth-child(2) { grid-column: 1; grid-row: 1; }
  .tbl-log td:nth-child(3) { grid-column: 2; grid-row: 1; font-size: 17px; text-align: right !important; }
  .tbl-log td:nth-child(1) { grid-column: 1; grid-row: 2; font-size: 12px; color: var(--ink-3); }
  .tbl-log td:nth-child(4) { grid-column: 2; grid-row: 2; font-size: 12px; color: var(--ink-3); font-weight: 500 !important; text-align: right !important; }
  .tbl-log td:nth-child(4)::before { content: 'Stock '; }
  .tbl-log td[colspan] { grid-column: 1 / -1; grid-row: 1; text-align: center !important; }
}

/* ============================================================
   CELULAR: RANKINGS
   La lista se desplaza dentro de la pantalla (como Socios) y el encabezado se comía
   230 px: a la lista le quedaban 327 px de 812. El título repetía el de la barra de
   arriba y las cifras van en tarjetas compactas de 2 x 2.
   ============================================================ */
@media (max-width: 640px) {
  .rankings-vista > .hero { margin-bottom: 12px !important; padding: 0 !important; }
  .rankings-vista > .hero .eyebrow, .rankings-vista > .hero h1 { display: none; }
  .rankings-vista .hero-meta {
    display: grid !important; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px !important;
    padding-top: 0 !important; margin-top: 0 !important;
  }
  .rankings-vista .hero-meta .item { background: var(--bg-1); border-radius: 14px; padding: 9px 12px; min-width: 0; }
  .rankings-vista .hero-meta .item .l { font-size: 11px !important; }
  .rankings-vista .hero-meta .item .v { font-size: 18px !important; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}

/* ============================================================
   CELULAR: CONFIGURACIÓN
   ============================================================ */
@media (max-width: 768px) {
  /* Interruptores como una fila de Ajustes de iOS: texto a la izquierda e interruptor a la
     derecha. La regla de flex-wrap de las tarjetas los partía: el interruptor quedaba solo
     arriba (uno centrado y otro a la izquierda) y el texto debajo. */
  .settings-card-body .fila-switch {
    display: flex !important; flex-direction: row !important; flex-wrap: nowrap !important; align-items: center; gap: 14px !important;
  }
  .fila-switch > input[type="checkbox"] { order: 2; }
  .fila-switch > label { flex: 1 1 auto; min-width: 0; font-size: 14px !important; line-height: 1.35; }
  .fila-switch-nota { margin-left: 0 !important; }

  /* Personal: engranaje, papelera y ver PIN del tamaño del dedo (eran de 21 a 30 px) */
  .emp-card .btn.ghost:has(> .ico:only-child) { width: 40px; height: 40px; padding: 0 !important; justify-content: center; }
  .pin-toggle { padding: 10px !important; margin: -10px 0; }
  .emp-card .btn.ghost:not(:has(> .ico:only-child)) { font-size: 13px !important; padding: 8px 12px !important; }
}
@media (max-width: 768px) {
  /* Listas con caja de 300 px y scroll propio dentro de una hoja (permisos del empleado,
     adelantos): en el celular fluyen con la hoja, sin doble scroll */
  .lista-sin-caja { max-height: none !important; overflow: visible !important; padding-right: 0 !important; }
}
@media (max-width: 640px) {
  /* Reporte de asistencias: empleado y horas arriba, fecha debajo, entrada y salida al final */
  .table-responsive:has(> .tbl-asistencias) { overflow: visible !important; }
  .tbl-asistencias { min-width: 0 !important; width: 100%; }
  .tbl-asistencias thead { display: none; }
  .tbl-asistencias tbody tr {
    display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 12px; row-gap: 3px;
    padding: 12px 0; border-bottom: 1px solid var(--line);
  }
  .tbl-asistencias tbody tr:last-child { border-bottom: none; }
  .table.tbl-asistencias td { display: block; padding: 0 !important; border: none !important; text-align: left; min-width: 0; white-space: nowrap; }
  .tbl-asistencias td:nth-child(2) { grid-column: 1; grid-row: 1; font-size: 15px; overflow: hidden; text-overflow: ellipsis; }
  .tbl-asistencias td:nth-child(5) { grid-column: 2; grid-row: 1; text-align: right; font-size: 15px; font-weight: 700; }
  .tbl-asistencias td:nth-child(1) { grid-column: 1; grid-row: 2; font-size: 12px; color: var(--ink-3); }
  .tbl-asistencias td:nth-child(3) { grid-column: 1; grid-row: 3; font-size: 13px; }
  .tbl-asistencias td:nth-child(4) { grid-column: 2; grid-row: 3; font-size: 13px; text-align: right; }
  .tbl-asistencias td:nth-child(3)::before { content: 'Entrada '; color: var(--ink-3); }
  .tbl-asistencias td:nth-child(4):not(.sin-salida)::before { content: 'Salida '; color: var(--ink-3); }
}

/* ============================================================
   CELULAR: HISTORIAL DEL SISTEMA
   ============================================================ */
@media (max-width: 640px) {
  .historial-vista > .section-header { margin-bottom: 12px !important; }
  /* El rango iba en una tarjeta entera con la palabra "Rango:" para un solo desplegable */
  .historial-filtro { background: transparent !important; border: none !important; padding: 0 !important; margin-bottom: 12px !important; gap: 8px !important; }
  .historial-filtro > span:first-child { display: none; }
  .historial-filtro > select { flex: 1 1 100%; width: 100%; min-height: 44px; }
  .historial-filtro > input[type="date"] { flex: 1 1 0; width: auto !important; min-width: 0; }
  /* La tarjeta de la lista mide lo que tiene (con pocos registros quedaba un hueco vacío)
     y, si son muchos, la lista se desplaza dentro como en Socios */
  .historial-vista > .panel { flex: 0 1 auto !important; }
  /* Cada registro como fila de lista: la acción en negrita (sin la etiqueta negra) y
     debajo del detalle, la fecha y quién lo hizo en gris */
  .tbl-actividad td:nth-child(3) > span { background: none !important; padding: 0 !important; font-size: 15px !important; }
  .tbl-actividad td:nth-child(2) > span { background: none !important; padding: 0 !important; color: var(--ink-3) !important; font-size: 12px !important; }
  .tbl-actividad td:nth-child(2)::before { content: '· '; }
  .tbl-actividad tbody tr { column-gap: 4px !important; }  /* solo separa fecha y usuario: lo demás ocupa la fila entera */
}

/* ============================================================
   CELULAR: CHECK-IN
   ============================================================ */
@media (max-width: 768px) {
  /* La lista usa el alto de la hoja: los 8 resultados entran sin scroll propio. Si la
     pantalla se achica (teclado abierto), la lista se desplaza y la búsqueda queda arriba. */
  .checkin-lista { max-height: calc(94dvh - 170px) !important; }
}
/* Lector de QR propio: el video llena el recuadro cuadrado */
.lector-qr video { width: 100% !important; height: 100% !important; object-fit: cover; display: block; }

/* ============================================================
   CELULAR: INICIO (DASHBOARD)
   ============================================================ */
@media (max-width: 768px) {
  /* La columna derecha trae 4 px de relleno para su scroll de escritorio: Asistencia y
     Top rachas quedaban 4 px más angostas que Alertas */
  .dashboard-shell .right-column { padding-right: 0 !important; }
  /* Encabezado con acción (Alertas de renovación): "Ver todos" a la derecha del título y el
     conteo debajo. Antes "Ver todos" bajaba solo a otra línea y dejaba un hueco. */
  .dashboard-shell .panel-head:has(> .actions) {
    display: grid !important; grid-template-columns: minmax(0, 1fr) auto; column-gap: 12px; row-gap: 2px; align-items: center;
  }
  .dashboard-shell .panel-head:has(> .actions) > h3 { grid-column: 1; grid-row: 1; }
  .dashboard-shell .panel-head:has(> .actions) > .count { grid-column: 1; grid-row: 2; margin: 0 !important; }
  .dashboard-shell .panel-head:has(> .actions) > .actions { grid-column: 2; grid-row: 1 / 3; margin: 0 !important; }
}
@media (max-width: 768px) {
  /* Hojas por pasos (Nuevo socio): el mismo alto en los tres pasos. Cambiaba de 640 a 400 y
     a 500 px y el borde de arriba saltaba en cada "Siguiente". */
  .modal-backdrop > .modal.modal-pasos { height: min(94dvh, 660px); }
}
@media (max-width: 768px) {
  /* Ticket: Enviar · Guardar · Imprimir en tres partes iguales y arriba; Cerrar debajo */
  .modal-foot .ticket-acciones { order: -1; width: 100%; display: grid !important; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .modal-foot .ticket-acciones .btn { min-width: 0; padding-left: 6px !important; padding-right: 6px !important; }
}
@media (max-width: 768px) {
  /* Con una hoja abierta el aviso baja desde arriba, como las notificaciones de iOS: abajo
     tapaba los botones de la hoja (p. ej. Enviar / Guardar / Imprimir del ticket). */
  body:has(.modal-backdrop) .toast {
    top: calc(env(safe-area-inset-top) + 10px); bottom: auto !important; animation: toastBaja .25s;
  }
}
@keyframes toastBaja { from { transform: translate(-50%, -12px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }
@media (max-width: 400px) {
  /* A 320 px "Imprimir" con su ícono no entraba en un tercio: ícono sobre el texto */
  .modal-foot .ticket-acciones .btn { flex-direction: column; gap: 2px !important; font-size: 13px !important; min-height: 54px; }
}

/* Leyenda de asistencia: el cuadrito "Sin asistir" lleva la clase .empty y se llevaba el
   relleno de 60 px de los estados vacíos (medía 42 x 122 px en vez de 10 x 10) */
.att-legend .sq { padding: 0 !important; flex: 0 0 auto; }

/* ============================================================
   CELULAR: FICHA DEL SOCIO
   ============================================================ */
@media (max-width: 640px) {
  /* Socio vencido: "Renovar plan" (el botón resaltado) va primero, antes del check-in */
  .detail-head .actions > .btn.primary:nth-last-child(2) { order: -3; }
  /* Historial: "Revertir" del tamaño del dedo (era de 72 x 28 px) */
  .history-row .btn { min-height: 36px !important; padding: 6px 12px !important; font-size: 12px !important; }
}
@media (max-width: 640px) {
  /* Historial de visitas: sin caja de 320 px con scroll propio dentro de la página;
     muestra las 15 más recientes y el resto con "Ver las N visitas" */
  .history-list { max-height: none !important; overflow: visible !important; }
  .history-list:not(.ver-todo) > .history-row:nth-child(n+16) { display: none; }
}
/* Cobrar deuda: el monto se ve grande, como en una app de pagos (>= 16 px: iOS no hace zoom) */
#cobro-monto { font-size: 22px !important; font-weight: 700; min-height: 52px; }

/* Aviso de versión nueva (app.js): píldora arriba, se toca para recargar */
.aviso-version {
  position: fixed; top: calc(env(safe-area-inset-top) + 10px); left: 50%; transform: translateX(-50%); z-index: 210;
  display: flex; align-items: center; gap: 8px; padding: 10px 16px; border: none; border-radius: 999px;
  background: var(--accent); color: var(--accent-ink, #000); font: 600 14px var(--font-sans);
  box-shadow: 0 8px 24px rgba(0,0,0,.35); cursor: pointer; white-space: nowrap; max-width: calc(100vw - 32px);
  animation: toastBaja .25s;
}
