/* ==========================================================================
   Proxxumo — capa de legibilidad y uso en celular
   Se carga DESPUÉS de argon-dashboard.css. Pensada para personas mayores
   usando el celular: letra grande, contraste alto (WCAG AA, ≥ 4,5:1),
   zonas táctiles de al menos 48 px y etiquetas siempre visibles.
   ========================================================================== */

:root {
  --px-navy: #242b57;
  --px-primary: #3b4cc0;        /* azul con contraste 6:1 sobre blanco */
  --px-primary-dark: #2f3d9e;
  --px-success: #15803d;        /* antes #2dce89 (2,1:1) */
  --px-info: #0369a1;           /* antes #11cdef (1,9:1) */
  --px-warning: #b45309;        /* antes #fb6340 (2,9:1) */
  --px-danger: #be123c;
  --px-text: #1f2937;
  --px-muted: #4b5563;          /* antes #8898aa (2,9:1) */
  --px-border: #9aa3b2;
  --px-focus: #f59e0b;
  --px-radius: 12px;
  --px-tap: 48px;
  --px-bottom-nav: 68px;
}

/* ── Tipografía ─────────────────────────────────────────────────────────── */
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
@media (max-width: 767.98px) { html { font-size: 17px; } }

body {
  font-size: 1rem;
  line-height: 1.55;
  color: var(--px-text);
}
p, li, td, th, label, .card-text, .dropdown-item { font-size: 1rem; }
small, .small, .text-sm { font-size: .9rem !important; }
.text-xs { font-size: .85rem !important; }
h1, .h1 { font-size: 1.75rem; } h2, .h2 { font-size: 1.5rem; } h3, .h3 { font-size: 1.3rem; }
.text-muted { color: var(--px-muted) !important; }

/* ── Colores con contraste suficiente ──────────────────────────────────── */
.btn-primary, .bg-primary, .badge-primary { background-color: var(--px-primary) !important; border-color: var(--px-primary) !important; color: #fff !important; }
.btn-primary:hover, .btn-primary:focus { background-color: var(--px-primary-dark) !important; border-color: var(--px-primary-dark) !important; }
.btn-success, .bg-success, .badge-success { background-color: var(--px-success) !important; border-color: var(--px-success) !important; color: #fff !important; }
.btn-info, .bg-info, .badge-info { background-color: var(--px-info) !important; border-color: var(--px-info) !important; color: #fff !important; }
.btn-warning, .bg-warning, .badge-warning { background-color: var(--px-warning) !important; border-color: var(--px-warning) !important; color: #fff !important; }
.btn-danger, .bg-danger, .badge-danger { background-color: var(--px-danger) !important; border-color: var(--px-danger) !important; color: #fff !important; }
.text-primary { color: var(--px-primary) !important; }
.text-success { color: var(--px-success) !important; }
.text-info { color: var(--px-info) !important; }
.text-warning { color: var(--px-warning) !important; }
.text-danger { color: var(--px-danger) !important; }
.btn-outline-primary { color: var(--px-primary); border-color: var(--px-primary); }
a { color: var(--px-primary); }

/* ── Botones: zonas táctiles grandes, sin mayúsculas forzadas ─────────── */
.btn {
  min-height: var(--px-tap);
  padding: .7rem 1.2rem;
  font-size: 1rem;
  font-weight: 600;
  text-transform: none;
  letter-spacing: normal;
  border-radius: var(--px-radius);
  white-space: normal;        /* textos largos pasan a otra línea, no se cortan */
  text-align: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
}
.btn-sm { min-height: 42px; padding: .5rem .9rem; font-size: .95rem; }
.btn-lg { min-height: 56px; font-size: 1.1rem; }
.btn-block { display: flex; width: 100%; }
.badge { font-size: .85rem; padding: .4em .7em; text-transform: none; letter-spacing: normal; }

/* ── Formularios: etiquetas visibles, campos grandes ───────────────────── */
label, .form-control-label { font-weight: 600; color: var(--px-text); margin-bottom: .4rem; }
.form-control, .custom-select, select.form-control {
  min-height: 52px;
  height: auto;
  font-size: 1.05rem;
  color: #111827;
  border: 1.5px solid var(--px-border);
  border-radius: 10px;
  padding: .7rem .9rem;
  box-shadow: none;
}
.form-control::placeholder { color: #6b7280; opacity: 1; }
.input-group-text { min-height: 52px; border: 1.5px solid var(--px-border); }
.input-group .form-control { border-radius: 10px; }
.input-group > .form-control:not(:last-child) { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.input-group > .input-group-append > .btn { border-top-left-radius: 0; border-bottom-left-radius: 0; }
.invalid-feedback, .text-danger.small { font-size: .95rem !important; font-weight: 600; }
.custom-control-label { padding-top: .15rem; }
.custom-control-label::before, .custom-control-label::after { width: 1.4rem; height: 1.4rem; }

/* Foco visible al navegar con teclado o lector de pantalla. */
a:focus-visible, button:focus-visible, .btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid var(--px-focus) !important;
  outline-offset: 2px;
}

/* ── Tarjetas y alertas ─────────────────────────────────────────────────── */
.card { border-radius: var(--px-radius); }
.alert { font-size: 1rem; border-radius: var(--px-radius); }

/* ── Tablas: legibles y sin cortarse en el celular ─────────────────────── */
.table td, .table th { font-size: .95rem; vertical-align: middle; }
.table thead th { font-size: .8rem; color: var(--px-muted); letter-spacing: .02em; }
.dataTables_wrapper { font-size: .95rem; }
.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_length select { min-height: 44px; border: 1.5px solid var(--px-border); border-radius: 10px; padding: .3rem .6rem; }
.dataTables_wrapper .dataTables_paginate .paginate_button { min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; }
@media (max-width: 767.98px) {
  .dataTables_wrapper { overflow-x: auto; }
  .dataTables_wrapper .dataTables_filter, .dataTables_wrapper .dataTables_length { text-align: left; float: none; }
  .dataTables_wrapper .dataTables_filter input { width: 100%; margin-left: 0; display: block; }
}

/* ── Barra de navegación inferior (afiliados, en celular) ─────────────── */
.px-bottom-nav { display: none; }
@media (max-width: 767.98px) {
  .px-bottom-nav {
    display: flex;
    position: fixed;
    left: 0; right: 0; bottom: 0;
    height: calc(var(--px-bottom-nav) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    background: #fff;
    border-top: 1px solid #d1d5db;
    box-shadow: 0 -4px 16px rgba(17, 24, 39, .08);
    z-index: 1030;
  }
  .px-bottom-nav a, .px-bottom-nav button {
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    font-size: .85rem;
    font-weight: 600;
    color: #374151;
    background: none;
    border: 0;
    text-decoration: none;
    min-width: 0;
  }
  .px-bottom-nav i { font-size: 1.35rem; }
  .px-bottom-nav .is-active { color: var(--px-primary); }
  .px-bottom-nav .is-active i { transform: scale(1.08); }
  body.has-bottom-nav .main-content { padding-bottom: calc(var(--px-bottom-nav) + 1.5rem); }
  body.has-bottom-nav .px-whatsapp { bottom: calc(var(--px-bottom-nav) + 14px) !important; }
}

/* ── Botón de WhatsApp: no tapa contenido ──────────────────────────────── */
.px-whatsapp {
  position: fixed; right: 16px; bottom: 20px; z-index: 1031;
  width: 54px; height: 54px; border-radius: 50%;
  background: #128c4b; color: #fff !important;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .25);
}
.px-whatsapp i { font-size: 28px; }

/* ── Avatar con iniciales (si no hay foto) ─────────────────────────────── */
.px-avatar-initials {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--px-primary); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .9rem;
}

/* ── Barra superior de saldos ──────────────────────────────────────────── */
@media (max-width: 767.98px) {
  .balance-label { font-size: .85rem !important; text-transform: none !important; letter-spacing: 0 !important; color: #e5edff !important; }
  .balance-value { font-size: 1.1rem !important; }
}

/* Movimiento reducido para quien lo pide en su sistema. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ── Inicio del afiliado ───────────────────────────────────────────────── */
.px-hello { color: #fff; margin: .25rem 0 1rem; position: relative; z-index: 1; }
/* El header azul de Argon está posicionado: sin esto lo taparía. */
.px-tiles, .px-section { position: relative; z-index: 1; }
.px-hello h1 { color: #fff; font-size: 1.6rem; margin: 0; }
.px-hello p { color: #e5edff; margin: .2rem 0 0; font-size: 1.05rem; }

.px-next-step { border-left: 6px solid var(--px-warning); }
.px-next-step h2 { font-size: 1.2rem; margin-bottom: .35rem; }

.px-tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: .75rem; }
@media (min-width: 768px) { .px-tiles { grid-template-columns: repeat(3, 1fr); } }
.px-tile {
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
  gap: .45rem; min-height: 112px; padding: 1rem .5rem;
  background: #fff; border: 1.5px solid #d1d5db; border-radius: 16px;
  color: var(--px-text) !important; font-weight: 700; font-size: 1.05rem; line-height: 1.25;
  text-decoration: none !important; box-shadow: 0 1px 3px rgba(17, 24, 39, .06);
}
.px-tile i { font-size: 1.9rem; color: var(--px-primary); }
.px-tile:active { background: #eef2ff; }

.px-section { background: #fff; border-radius: 16px; padding: 1.25rem; margin-bottom: 1rem; box-shadow: 0 1px 3px rgba(17, 24, 39, .08); }
.px-section h2 { font-size: 1.2rem; margin-bottom: .9rem; color: var(--px-text); }
.px-figures { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.px-figure { background: #f3f4f6; border-radius: 12px; padding: .75rem; }
.px-figure .v { font-size: 1.45rem; font-weight: 800; color: var(--px-text); display: block; }
.px-figure .l { font-size: .95rem; color: var(--px-muted); }
.px-progress { height: 14px; background: #e5e7eb; border-radius: 99px; overflow: hidden; }
.px-progress > span { display: block; height: 100%; background: var(--px-success); }
.px-list { list-style: none; padding: 0; margin: 0; }
.px-list li { display: flex; justify-content: space-between; align-items: center; gap: .75rem; padding: .8rem 0; border-bottom: 1px solid #e5e7eb; }
.px-list li:last-child { border-bottom: 0; }
.px-list .amount { font-weight: 800; font-size: 1.1rem; }
.px-empty { color: var(--px-muted); text-align: center; padding: 1rem 0; }

/* En las pantallas de acceso el botón de WhatsApp no debe tapar formularios:
   en el celular queda más pequeño y se reserva espacio al final. */
@media (max-width: 767.98px) {
  .px-whatsapp-guest { width: 48px; height: 48px; bottom: 12px; right: 12px; }
  .px-whatsapp-guest i { font-size: 24px; }
  .main-content { padding-bottom: 72px; }
}

/* ── Formularios de dinero (pasar plata, retirar) ───────────────────────── */
.px-form-card { position: relative; z-index: 1; background: #fff; border-radius: 16px; padding: 1.25rem; margin-bottom: 1rem; box-shadow: 0 1px 3px rgba(17,24,39,.08); }
.px-form-card .form-group { margin-bottom: 1.25rem; }
.px-amount-preview { font-size: 1.15rem; font-weight: 700; color: var(--px-success); min-height: 1.6em; }
.px-help { color: var(--px-muted); font-size: .95rem; margin-top: .35rem; }

/* ── Tablas como tarjetas en el celular ────────────────────────────────── */
.dataTables_wrapper { overflow-x: auto; }
@media (max-width: 767.98px) {
  table.px-cards { border: 0 !important; }
  table.px-cards thead { display: none; }
  table.px-cards, table.px-cards tbody, table.px-cards tr, table.px-cards td { display: block; width: 100% !important; }
  table.px-cards tbody tr {
    background: #fff !important; border: 1.5px solid #d1d5db; border-radius: 14px;
    margin-bottom: .75rem; padding: .35rem .9rem; box-shadow: 0 1px 3px rgba(17, 24, 39, .06);
  }
  table.px-cards tbody td {
    display: flex; justify-content: space-between; align-items: center; gap: 1rem;
    border: 0 !important; border-bottom: 1px solid #eef0f3 !important;
    padding: .6rem 0 !important; text-align: right; white-space: normal; font-size: 1rem;
  }
  table.px-cards tbody td:last-child { border-bottom: 0 !important; }
  table.px-cards tbody td[data-label]::before {
    content: attr(data-label); font-weight: 700; color: var(--px-muted);
    text-align: left; flex-shrink: 0; max-width: 45%;
  }
  table.px-cards tbody td .btn { min-width: 44%; }
  table.px-cards tbody td.dataTables_empty { display: block; text-align: center; }
  table.px-cards tbody td.dataTables_empty::before { content: none; }
}

/* ── Tienda en el celular ──────────────────────────────────────────────── */
.px-cart-label { font-weight: 700; }
@media (max-width: 767.98px) {
  /* El carrito flotante tapaba la barra de saldos: va abajo, sobre WhatsApp. */
  #cart-toggle {
    top: auto !important; right: 16px !important;
    bottom: calc(var(--px-bottom-nav) + 82px) !important;
    min-height: 54px; padding: .6rem 1.1rem; box-shadow: 0 6px 18px rgba(17, 24, 39, .3);
  }
  body:not(.has-bottom-nav) #cart-toggle { bottom: 90px !important; }
  /* El panel del carrito medía 400 px: más que la pantalla. */
  .cart-sidebar { width: 100% !important; right: -100% !important; }
  .cart-sidebar.active { right: 0 !important; }
  .entry-qty-controls button, .qty-btn { width: 44px !important; height: 44px !important; font-size: 1.2rem !important; }
  .points-badge, .qty-badge { font-size: .9rem !important; }
}

/* ── Piezas compartidas: lista de datos, estados y notas ───────────────── */
.px-data { margin: 0; }
.px-data > div { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid #eef0f5; }
.px-data > div:last-child { border-bottom: 0; }
.px-data dt { font-weight: 600; color: #4b5563; }
.px-data dd { margin: 0; text-align: right; font-weight: 700; color: #1f2937; word-break: break-word; }
.px-state { display: inline-block; font-weight: 700; font-size: .9rem; border-radius: 999px; padding: 4px 10px; white-space: nowrap; }
.px-state.ok   { background: #dcfce7; color: #166534; }
.px-state.wait { background: #fef3c7; color: #92400e; }
.px-state.miss { background: #fee2e2; color: #991b1b; }
.px-note { background: #eef2ff; color: #1e3a8a; border-radius: 12px; padding: 12px 14px; font-size: 1rem; }

/* ── Invitación a instalar la app ───────────────────────────────────────── */
.px-install { display: flex; align-items: center; gap: 12px; }
.px-install[hidden] { display: none !important; }
.px-install img { border-radius: 12px; flex: 0 0 auto; }
.px-install .t { flex: 1 1 auto; min-width: 0; }
.px-install .t strong { display: block; color: #1f2937; }
.px-install .t span { color: var(--px-muted); font-size: .95rem; }
.px-install .close { min-width: 44px; min-height: 44px; font-size: 1.6rem; }
.px-tiles--3 { grid-template-columns: repeat(3, 1fr); } .px-tiles--3 .px-tile { padding-left: 4px; padding-right: 4px; font-size: .95rem; }

/* ── Opciones grandes (entrega, direcciones) ────────────────────────────── */
.px-choice { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.px-choice-item, .px-address { position: relative; margin: 0; cursor: pointer; display: block; }
.px-choice-item input, .px-address input { position: absolute; opacity: 0; pointer-events: none; }
.px-choice-item > span {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px;
  border: 2px solid #d1d5db; border-radius: 14px; padding: 14px 8px; min-height: 104px; justify-content: center;
}
.px-choice-item i { font-size: 1.6rem; color: var(--px-primary); }
.px-choice-item strong { font-size: 1.05rem; color: #1f2937; }
.px-choice-item small { color: var(--px-muted); font-size: .9rem; }
.px-addresses { display: grid; gap: 8px; margin-bottom: 14px; }
.px-address > span { display: block; border: 2px solid #d1d5db; border-radius: 12px; padding: 12px 14px 12px 44px; }
.px-address > span::before {
  content: ""; position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  width: 20px; height: 20px; border-radius: 50%; border: 2px solid #9ca3af; background: #fff;
}
.px-address strong { display: block; color: #1f2937; }
.px-address small { color: var(--px-muted); font-size: .95rem; }
.px-choice-item input:checked + span, .px-address input:checked + span { border-color: var(--px-primary); background: #eef2ff; }
.px-address input:checked + span::before { border-color: var(--px-primary); box-shadow: inset 0 0 0 4px #fff; background: var(--px-primary); }
.px-choice-item input:focus-visible + span, .px-address input:focus-visible + span { outline: 3px solid #f59e0b; outline-offset: 2px; }
.px-order-item { display: flex; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid #eef0f5; }
.px-order-item:last-child { border-bottom: 0; }
.px-order-item .n { font-weight: 700; color: #1f2937; }
.px-order-item .d { color: var(--px-muted); font-size: .95rem; }
.px-order-item .p { font-weight: 800; white-space: nowrap; color: #1f2937; }
.px-order-total { display: flex; justify-content: space-between; align-items: baseline; border-top: 2px solid #e5e7eb; margin-top: 4px; padding-top: 12px; }
.px-order-total strong { font-size: 1.5rem; color: #1f2937; }

/* El atributo hidden siempre oculta (Bootstrap/flex no lo deben anular). */
[hidden] { display: none !important; }
.px-field-error { color: var(--px-danger); font-weight: 600; font-size: .95rem; margin-top: 6px; display: none; }

/* Mensajes dentro de tarjetas blancas: texto oscuro sobre fondo suave. */
.alert.px-section { border-width: 1.5px; border-style: solid; }
.alert-success.px-section { background: #ecfdf5; color: #065f46; border-color: #a7f3d0; }
.alert-danger.px-section  { background: #fef2f2; color: #991b1b; border-color: #fecaca; }
.alert-warning.px-section { background: #fffbeb; color: #92400e; border-color: #fde68a; }
.alert-info.px-section    { background: #eef2ff; color: #1e3a8a; border-color: #c7d2fe; }
.px-zone-price { font-weight: 800; white-space: nowrap; }

/* Casilla grande con su texto */
.px-check { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; min-height: 44px; cursor: pointer; margin: 0; }
.px-check input[type=checkbox] { width: 22px; height: 22px; flex-shrink: 0; accent-color: var(--px-primary); }
