/* ======================================================================
   LOYPIN — Design System
   Producido por Cid & Engel Studio
   ====================================================================== */

:root {
    /* --- Paleta de marca --- */
    --ink-900: #0b0f1a;
    --ink-800: #12182b;
    --ink-700: #1b2340;
    --ink-600: #2a3358;

    --porcelain: #f9f7f3;
    --porcelain-dim: #efece4;

    --gold-300: #fbdb9a;
    --gold-400: #f7c55c;
    --gold-500: #e88f3e;
    --gold-600: #d9740f;

    --text-900: #14192b;
    --text-600: #565f78;
    --text-muted: #8991a8;

    --success: #1fa97e;
    --success-bg: #e7f7f1;
    --error: #e0453f;
    --error-bg: #fdecec;

    --border: #e7e3da;
    --border-strong: #d8d3c6;

    --radius-sm: 10px;
    --radius: 16px;
    --radius-lg: 24px;
    --radius-pill: 999px;

    --shadow-xs: 0 1px 2px rgba(18, 24, 43, 0.05);
    --shadow-sm: 0 4px 14px rgba(18, 24, 43, 0.07);
    --shadow-md: 0 10px 28px rgba(18, 24, 43, 0.12);
    --shadow-lg: 0 24px 60px rgba(18, 24, 43, 0.20);
    --shadow-gold: 0 10px 24px rgba(232, 143, 62, 0.35);

    --ease: cubic-bezier(0.22, 1, 0.36, 1);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);

    --font-display: 'Space Grotesk', 'Segoe UI', system-ui, sans-serif;
    --font-body: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;

    /* Fondo de página/tarjetas "de app" — separado de --porcelain porque
       --porcelain también se usa en otros CSS (landing-v2.css) como color
       CLARO fijo (p. ej. texto sobre paneles oscuros), que no debe invertirse
       solo porque el tema general cambió a oscuro. */
    --app-bg: var(--porcelain);
    --app-bg-dim: var(--porcelain-dim);

    /* --- Alias retrocompatibles usados en estilos inline de algunas páginas --- */
    --loypin-primary: var(--ink-900);
    --loypin-bg: var(--app-bg);
    --loypin-card-bg: #ffffff;
    --loypin-border: var(--border);
    --loypin-text: var(--text-900);
    --loypin-muted: var(--text-600);
    --loypin-error: var(--error);
    --loypin-radius: var(--radius);
}

/* ---------------------------------------------------------------------
   Tema oscuro automático — sigue la preferencia del sistema operativo
   (prefers-color-scheme), SIN selector manual en la interfaz. No hay
   "botón de cambiar tema" en las pantallas de app (login, registro,
   wallet, paneles): el navegador ya sabe si el usuario prefiere oscuro
   y esto solo reacomoda las variables de color — nada de JS necesario,
   así que tampoco hay parpadeo claro→oscuro al cargar.
   --------------------------------------------------------------------- */
@media (prefers-color-scheme: dark) {
    :root {
        /* OJO: --porcelain / --porcelain-dim / --ink-* NO se tocan aquí a
           propósito — landing-v2.css los reutiliza como colores fijos
           (p. ej. texto claro sobre un panel siempre-oscuro), y si se
           invirtieran aquí ese texto se volvía oscuro-sobre-oscuro e
           ilegible. Solo se redefine el fondo "de app". */
        --app-bg: #0e1220;
        --app-bg-dim: #171c30;

        --text-900: #f1f2f7;
        --text-600: #b6bbcf;
        --text-muted: #838aa3;

        --success-bg: rgba(31, 169, 126, 0.16);
        --error-bg: rgba(224, 69, 63, 0.16);

        --border: #2a3050;
        --border-strong: #3a4166;

        --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.25);
        --shadow-sm: 0 4px 14px rgba(0, 0, 0, 0.32);
        --shadow-md: 0 10px 28px rgba(0, 0, 0, 0.4);
        --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.5);

        --loypin-card-bg: #171c30;
        --loypin-bg: var(--app-bg);
        --cliente-nav-bg: rgba(23, 28, 48, 0.85);
    }
}

/* ---------------------------------------------------------------------
   Reset & base
   --------------------------------------------------------------------- */
* { box-sizing: border-box; }
*::selection { background: var(--gold-400); color: var(--ink-900); }

html { -webkit-tap-highlight-color: transparent; scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: var(--font-body);
    background: var(--app-bg);
    color: var(--text-900);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    /* BUGFIX: "both" mantenía para siempre el transform del último frame
       (translateY(0)) aplicado sobre <body> — y CUALQUIER transform
       distinto de "none" en un ancestro convierte a sus descendientes
       position:fixed en "fixed respecto a ESE ancestro" en vez de respecto
       a la ventana. Por eso la barra inferior (.cliente-nav, position:
       fixed) no se quedaba pegada abajo al hacer scroll: en cuanto el
       fade-in de entrada terminaba, dejaba de ser "fija a la pantalla" y
       pasaba a moverse junto con el <body>. Quitando "both" el transform
       vuelve a "none" en cuanto termina la animación (0.5s) y position:
       fixed vuelve a funcionar normal — el fade-in de entrada se ve
       exactamente igual, solo que ya no dura para siempre.  */
    animation: page-fade-in 0.5s var(--ease);
    position: relative;
    min-height: 100vh;
}

/* Fondo con textura suave: puntos + degradado dorado difuso, muy sutil */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    background:
        radial-gradient(circle at 12% 8%, rgba(232, 143, 62, 0.08), transparent 40%),
        radial-gradient(circle at 88% 92%, rgba(27, 35, 64, 0.06), transparent 45%),
        radial-gradient(rgba(18, 24, 43, 0.05) 1px, transparent 1px);
    background-size: auto, auto, 22px 22px;
    pointer-events: none;
}

@keyframes page-fade-in {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

main {
    max-width: 480px;
    margin: 0 auto;
    padding: 28px 20px 60px;
    position: relative;
    z-index: 1;
}

a { color: inherit; }

h1, h2, h3 {
    font-family: var(--font-display);
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--text-900);
    margin: 0 0 6px;
}
h1 { font-size: 1.7rem; line-height: 1.2; }
h2 { font-size: 1.08rem; margin-top: 30px; margin-bottom: 10px; }
h2::before {
    content: "";
    display: inline-block;
    width: 8px; height: 8px;
    margin-right: 8px;
    border-radius: 3px;
    background: linear-gradient(135deg, var(--gold-400), var(--gold-600));
    vertical-align: middle;
    transform: translateY(-1px) rotate(45deg);
}

main > p { color: var(--text-600); }

p.error, [role="alert"] {
    color: var(--error);
    font-size: 0.88rem;
    min-height: 1.2em;
    font-weight: 500;
    transition: opacity 0.2s var(--ease);
}
p.error:not(:empty), [role="alert"]:not(:empty) {
    animation: shake 0.4s var(--ease);
}
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
}

hr { border: none; border-top: 1px solid var(--border); }

/* ---------------------------------------------------------------------
   Formularios
   --------------------------------------------------------------------- */
form { display: flex; flex-direction: column; gap: 16px; margin-top: 18px; }

label {
    display: flex;
    flex-direction: column;
    gap: 7px;
    font-size: 0.86rem;
    font-weight: 600;
    color: var(--text-600);
}

input:not([type="checkbox"]):not([type="radio"]), select, textarea {
    font-family: var(--font-body);
    font-size: 1rem;
    padding: 13px 15px;
    border-radius: var(--radius-sm);
    border: 1.5px solid var(--border);
    background: var(--loypin-card-bg);
    color: var(--text-900);
    transition: border-color 0.18s var(--ease), box-shadow 0.18s var(--ease), transform 0.1s var(--ease);
    outline: none;
    width: 100%;
}
input:not([type="checkbox"]):not([type="radio"]):hover, select:hover, textarea:hover { border-color: var(--border-strong); }
input:not([type="checkbox"]):not([type="radio"]):focus, select:focus, textarea:focus {
    border-color: var(--gold-500);
    box-shadow: 0 0 0 4px rgba(232, 143, 62, 0.15);
}
input[type="color"] { padding: 4px; height: 44px; cursor: pointer; }
input::placeholder { color: var(--text-muted); }

.password-toggle-wrap { position: relative; }
.password-toggle-wrap input { padding-right: 42px; }
.password-toggle-btn {
    /* Ancho/alto fijos + flex centrado: antes el botón solo tenía padding,
       así que al cambiar el emoji (👁 vs 🙈, que no miden lo mismo) el
       icono "brincaba" de lugar en cada click. Con caja fija el icono
       siempre queda centrado en el mismo punto. */
    position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
    width: 32px; height: 32px;
    display: flex; align-items: center; justify-content: center;
    background: none; border: none; box-shadow: none; padding: 0;
    font-size: 1rem; line-height: 1; cursor: pointer; color: var(--text-muted);
}
.password-toggle-btn:hover { color: var(--text-900); }

/* Checkboxes y radios: reset propio, sin el padding/border/width del input
   genérico de arriba (eso era lo que dejaba el checkbox de "Acepto términos"
   deformado y prácticamente imposible de marcar). */
input[type="checkbox"], input[type="radio"] {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    margin: 0;
    padding: 0;
    accent-color: var(--gold-500);
    cursor: pointer;
}

/* ---------------------------------------------------------------------
   Botones
   --------------------------------------------------------------------- */
button, a.btn {
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 700;
    padding: 14px 20px;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: #fff;
    background: linear-gradient(135deg, var(--ink-700), var(--ink-900));
    box-shadow: var(--shadow-sm);
    transition: transform 0.16s var(--ease-spring), box-shadow 0.2s var(--ease), opacity 0.15s var(--ease), filter 0.15s var(--ease);
    position: relative;
    overflow: hidden;
    isolation: isolate;
}
button::before, a.btn::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(120deg, transparent, rgba(255,255,255,0.28), transparent);
    transform: translateX(-120%);
    transition: transform 0.5s var(--ease);
    z-index: -1;
}
button:hover::before, a.btn:hover::before { transform: translateX(120%); }
button:hover, a.btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}
button:active, a.btn:active { transform: translateY(0) scale(0.98); }
button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* Botón principal dorado — CTAs importantes (planes, registro) */
button[type="submit"], a.btn {
    background: linear-gradient(135deg, var(--gold-400), var(--gold-600));
    color: var(--ink-900);
    box-shadow: var(--shadow-gold);
}
button[type="submit"]:hover, a.btn:hover {
    box-shadow: 0 14px 30px rgba(232, 143, 62, 0.45);
}

/* Botones secundarios (outline) — usados como enlaces de acción menores */
button.btn-outline, a.btn-outline {
    background: var(--loypin-card-bg);
    color: var(--text-900);
    border: 1.5px solid var(--border-strong);
    box-shadow: none;
    text-decoration: none;
}
button.btn-outline:hover, a.btn-outline:hover {
    border-color: var(--gold-500);
    background: var(--app-bg-dim);
}

/* ---------------------------------------------------------------------
   Marca / logo
   --------------------------------------------------------------------- */
.brand-mark {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 22px;
}
.brand-mark img {
    width: 44px; height: 44px;
    border-radius: 13px;
    box-shadow: var(--shadow-sm);
    animation: float-badge 5s ease-in-out infinite;
}
.brand-mark .brand-name {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--text-900);
    letter-spacing: -0.01em;
}
.brand-mark .brand-tag {
    display: block;
    font-family: var(--font-body);
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--gold-600);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin-top: 1px;
}
@keyframes float-badge {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-4px) rotate(-2deg); }
}

/* ---------------------------------------------------------------------
   Auth pages (login / registro / landing)
   --------------------------------------------------------------------- */
main.auth-page {
    max-width: 460px;
    animation: rise-in 0.55s var(--ease) backwards;
}
@keyframes rise-in {
    from { opacity: 0; transform: translateY(18px) scale(0.985); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
main.auth-page h1 { font-size: 1.9rem; }
.checkbox-row {
    display: flex; align-items: flex-start; gap: 8px;
    font-size: 0.82rem; color: var(--text-muted); font-weight: 400;
    margin: 4px 0;
}
.checkbox-row input[type="checkbox"] { margin-top: 2px; }
.checkbox-row a { color: var(--text-600); text-decoration: underline; }
main.auth-page a.btn { margin-top: 6px; }
main.auth-page a.btn + a.btn { margin-top: 10px; }
main.auth-page > p:last-child {
    text-align: center;
    margin-top: 22px;
    font-size: 0.92rem;
}
main.auth-page > p:last-child a {
    color: var(--gold-600);
    font-weight: 700;
    text-decoration: none;
    border-bottom: 1.5px solid transparent;
    transition: border-color 0.15s var(--ease);
}
main.auth-page > p:last-child a:hover { border-color: var(--gold-500); }

/* ---------------------------------------------------------------------
   Landing (index.php)
   --------------------------------------------------------------------- */
main.landing-page {
    max-width: 640px;
    animation: rise-in 0.55s var(--ease) backwards;
}
main.landing-page h1 { font-size: 2rem; margin-top: 6px; }
.landing-sub { color: var(--text-600); font-size: 0.98rem; line-height: 1.6; margin-bottom: 8px; }
.landing-split { display: flex; flex-direction: column; gap: 16px; margin-top: 24px; }
.landing-panel {
    background: var(--loypin-card-bg); border: 1.5px solid var(--border); border-radius: var(--radius-lg);
    padding: 26px 24px; box-shadow: var(--shadow-sm);
}
.landing-panel-icon { font-size: 1.8rem; display: block; margin-bottom: 6px; }
.landing-panel h2 { margin: 0 0 12px; }
.landing-benefits { list-style: none; padding: 0; margin: 0 0 20px; display: flex; flex-direction: column; gap: 9px; }
.landing-benefits li {
    font-size: 0.88rem; color: var(--text-600); padding-left: 24px; position: relative; line-height: 1.4;
}
.landing-benefits li::before {
    content: "✓"; position: absolute; left: 0; top: 1px;
    width: 16px; height: 16px; border-radius: 50%; background: var(--success);
    color: #fff; font-size: 0.62rem; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
}
.landing-panel a.btn { width: 100%; }
.landing-panel-dark {
    background: linear-gradient(150deg, var(--ink-800), var(--ink-900));
    border-color: var(--ink-900);
}
.landing-panel-dark h2, .landing-panel-dark .landing-panel-icon { color: #fff; }
.landing-panel-dark .landing-benefits li { color: #c8cbe0; }
.landing-panel-dark .landing-benefits li::before { background: var(--gold-400); color: var(--ink-900); }
.landing-btn-gold { background: linear-gradient(135deg, var(--gold-400), var(--gold-600)); color: var(--ink-900); }

@media (min-width: 700px) {
    .landing-split { flex-direction: row; }
    .landing-panel { flex: 1; }
}

/* ---------------------------------------------------------------------
   Planes
   --------------------------------------------------------------------- */
.billing-toggle {
    display: flex; gap: 6px; background: var(--app-bg-dim); border-radius: var(--radius-pill);
    padding: 4px; margin: 20px 0 6px;
}
.billing-option {
    flex: 1; background: transparent; color: var(--text-600); box-shadow: none;
    padding: 10px 8px; font-size: 0.82rem; border-radius: var(--radius-pill);
    display: flex; align-items: center; justify-content: center; gap: 6px;
}
.billing-option.active { background: var(--loypin-card-bg); color: var(--text-900); box-shadow: var(--shadow-xs); }
.billing-option .save-badge {
    background: var(--success-bg); color: var(--success); font-size: 0.68rem; font-weight: 800;
    padding: 1px 6px; border-radius: var(--radius-pill);
}
.billing-option.active .save-badge { background: var(--gold-400); color: var(--ink-900); }
.price-billed-as { font-size: 0.76rem; color: var(--text-muted); margin: -10px 0 14px; }

.plans-grid { display: flex; flex-direction: column; gap: 18px; margin-top: 22px; }

.plan-card {
    background: var(--loypin-card-bg);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    position: relative;
    box-shadow: var(--shadow-sm);
    transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease), border-color 0.25s var(--ease);
    animation: rise-in 0.5s var(--ease) backwards;
    overflow: hidden;
}
.plan-card:nth-of-type(1) { animation-delay: 0.02s; }
.plan-card:nth-of-type(2) { animation-delay: 0.10s; }
.plan-card:nth-of-type(3) { animation-delay: 0.18s; }
.plan-card::after {
    content: "";
    position: absolute;
    top: -60%; left: -20%;
    width: 60%; height: 220%;
    background: linear-gradient(120deg, transparent, rgba(232,143,62,0.06), transparent);
    transform: rotate(15deg);
    pointer-events: none;
}
.plan-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-md);
    border-color: var(--border-strong);
}
.plan-card h2 { margin-top: 0; display: flex; align-items: center; gap: 8px; }
.plan-card .price {
    font-family: var(--font-display);
    font-size: 1.8rem;
    font-weight: 700;
    margin: 6px 0 14px;
    background: linear-gradient(135deg, var(--ink-800), var(--ink-600));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.plan-card .features { list-style: none; padding: 0; margin: 0 0 18px; font-size: 0.92rem; color: var(--text-600); }
.plan-card .features li {
    padding: 7px 0 7px 26px;
    position: relative;
    border-bottom: 1px dashed var(--border);
}
.plan-card .features li:last-child { border-bottom: none; }
.plan-card .features li::before {
    content: "✓";
    position: absolute; left: 0; top: 7px;
    width: 18px; height: 18px;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.7rem; font-weight: 700;
    color: #fff;
    background: var(--success);
    border-radius: 50%;
}
.plan-card .features li.feature-no {
    color: var(--text-muted);
}
.plan-card .features li.feature-no::before {
    content: "✕";
    background: var(--border-strong);
    color: #fff;
}

.plan-business {
    border-color: var(--gold-500);
    border-width: 2px;
    box-shadow: var(--shadow-gold);
    transform: scale(1.02);
}
.plan-business::before {
    content: "★ Más elegido";
    position: absolute;
    top: 14px; right: -34px;
    background: linear-gradient(135deg, var(--gold-400), var(--gold-600));
    color: var(--ink-900);
    font-size: 0.7rem;
    font-weight: 800;
    padding: 5px 38px;
    transform: rotate(38deg);
    box-shadow: 0 4px 10px rgba(232,143,62,0.4);
    letter-spacing: 0.02em;
}

/* ---------------------------------------------------------------------
   Panel admin
   --------------------------------------------------------------------- */
.admin-page {
    max-width: 980px;
    padding-top: 0;
}

.admin-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 20px;
    margin: 0 0 26px;
    background: linear-gradient(135deg, var(--ink-800), var(--ink-900));
    color: #fff;
    box-shadow: var(--shadow-md);
    width: 100%;
}
.admin-topbar-inner {
    max-width: 940px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    width: 100%;
}
.admin-topbar .brand-mark { margin-bottom: 0; }
.admin-topbar .brand-mark .brand-name { color: #fff; }
.admin-topbar-actions { display: flex; align-items: center; gap: 10px; }
.admin-topbar-actions a {
    font-size: 0.86rem;
    font-weight: 600;
    text-decoration: none;
    color: rgba(255,255,255,0.75);
    transition: color 0.15s var(--ease);
}
.admin-topbar-actions a:hover { color: #fff; }
.admin-topbar-actions a.btn {
    padding: 10px 16px;
    font-size: 0.86rem;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 14px;
    margin-bottom: 26px;
}
.stat-card {
    background: var(--loypin-card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 20px;
    box-shadow: var(--shadow-xs);
    animation: rise-in 0.4s var(--ease) backwards;
    transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-sm); }
.stat-card .stat-label {
    font-size: 0.76rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 700;
    color: var(--text-muted);
}
.stat-card .stat-value {
    font-family: var(--font-display);
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-900);
    margin-top: 4px;
}

.panel-card {
    background: var(--loypin-card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 22px;
}

.admin-table-wrap { overflow-x: auto; }
.admin-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 6px;
    font-size: 0.9rem;
}
.admin-table thead th {
    text-align: left;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    padding: 10px 12px;
    border-bottom: 2px solid var(--border);
}
.admin-table tbody tr { transition: background 0.15s var(--ease); }
.admin-table tbody tr:hover { background: var(--app-bg-dim); }
.admin-table th, .admin-table td {
    border-bottom: 1px solid var(--border);
    padding: 12px;
    text-align: left;
    vertical-align: middle;
}
.admin-table tbody tr:last-child td { border-bottom: none; }
.admin-table a {
    font-weight: 700;
    color: var(--gold-600);
    text-decoration: none;
}
.admin-table a:hover { text-decoration: underline; }

/* Badges de estado */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 11px;
    border-radius: var(--radius-pill);
    font-size: 0.74rem;
    font-weight: 700;
    white-space: nowrap;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-verified   { background: var(--success-bg); color: var(--success); }
.badge-pending    { background: #fff4e0; color: var(--gold-600); }
.badge-rejected   { background: var(--error-bg); color: var(--error); }
.badge-active     { background: var(--success-bg); color: var(--success); }
.badge-trial      { background: #eef1fb; color: #5065c9; }
.badge-past_due   { background: var(--error-bg); color: var(--error); }
.badge-canceled   { background: #f1f1f1; color: var(--text-muted); }
.badge-free       { background: linear-gradient(135deg, var(--gold-300), var(--gold-500)); color: var(--ink-900); }

.section-title-row {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
}

/* ---------------------------------------------------------------------
   Panel negocio
   --------------------------------------------------------------------- */
.business-panel { max-width: 560px; }
.business-panel nav {
    margin-top: 26px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.business-panel nav a {
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    background: var(--loypin-card-bg);
    border: 1px solid var(--border);
    text-decoration: none;
    font-weight: 600;
    color: var(--text-900);
    transition: transform 0.15s var(--ease), box-shadow 0.15s var(--ease), border-color 0.15s var(--ease);
}
.business-panel nav a:hover {
    transform: translateX(4px);
    box-shadow: var(--shadow-sm);
    border-color: var(--gold-500);
}

/* ---------------------------------------------------------------------
   Cliente (bottom nav, home)
   --------------------------------------------------------------------- */
main.cliente-page { padding-bottom: 96px; }

.cliente-nav {
    position: fixed;
    bottom: 14px; left: 14px; right: 14px;
    display: flex;
    justify-content: space-around;
    background: var(--cliente-nav-bg, rgba(255,255,255,0.85));
    backdrop-filter: blur(14px) saturate(160%);
    -webkit-backdrop-filter: blur(14px) saturate(160%);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 10px 6px;
    max-width: 460px;
    margin: 0 auto;
    box-shadow: var(--shadow-lg);
    z-index: 40;
}
.cliente-nav a {
    text-decoration: none;
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 700;
    text-align: center;
    flex: 1;
    padding: 6px 4px;
    border-radius: var(--radius-sm);
    transition: color 0.2s var(--ease), transform 0.2s var(--ease-spring), background 0.2s var(--ease);
}
.cliente-nav a:hover { transform: translateY(-2px); }
.cliente-nav a.active {
    color: var(--ink-900);
    background: linear-gradient(135deg, var(--gold-300), var(--gold-400));
}

/* ---------------------------------------------------------------------
   Utilidades de animación / carga
   --------------------------------------------------------------------- */
@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}
.skeleton, [id$="populares"]:empty, [id$="mapa"]:empty {
    position: relative;
    color: transparent !important;
    background: linear-gradient(90deg, var(--app-bg-dim) 25%, var(--app-bg) 50%, var(--app-bg-dim) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.4s ease-in-out infinite;
    border-radius: var(--radius-sm);
}

.spin {
    display: inline-block;
    width: 1em; height: 1em;
    border: 2px solid rgba(255,255,255,0.4);
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

::-webkit-scrollbar { height: 8px; width: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 8px; }

/* ---------------------------------------------------------------------
   Responsive: paneles admin/negocio más anchos en pantallas grandes
   --------------------------------------------------------------------- */
@media (min-width: 720px) {
    .admin-page { padding-left: 32px; padding-right: 32px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
        scroll-behavior: auto !important;
    }
}

/* =======================================================================
   Kit de componentes — Fase 2/3/4 (analítica, campañas, compras, etc.)
   Extiende el mismo lenguaje visual (ink/porcelain/gold, --radius,
   --shadow-*, --ease) para que las pantallas nuevas se sientan parte del
   mismo producto, no un módulo pegado encima.
   ========================================================================= */

/* --- Tarjetas de estadística (analítica del negocio, resúmenes) --- */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    margin: 16px 0 26px;
}
.stat-card {
    background: var(--loypin-card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 18px;
    box-shadow: var(--shadow-xs);
    transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.stat-card .stat-label {
    font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em;
    color: var(--text-muted); font-weight: 700; margin-bottom: 6px;
}
.stat-card .stat-value {
    font-family: var(--font-display); font-size: 1.6rem; font-weight: 700;
    color: var(--text-900); line-height: 1.1;
}
.stat-card .stat-sub { font-size: 0.76rem; color: var(--text-muted); margin-top: 4px; }
.stat-card .stat-value.stat-up { color: var(--success); }
.stat-card .stat-value.stat-down { color: var(--error); }
.stat-card .stat-trend { font-size: 0.72rem; font-weight: 700; margin-left: 6px; }
.stat-trend.up { color: var(--success); }
.stat-trend.down { color: var(--error); }

/* --- Barra de progreso simple (onboarding, metas) --- */
.progress-track {
    width: 100%; height: 8px; border-radius: var(--radius-pill);
    background: var(--app-bg-dim); overflow: hidden;
}
.progress-fill {
    height: 100%; border-radius: var(--radius-pill);
    background: linear-gradient(90deg, var(--gold-500), var(--gold-400));
    transition: width 0.5s var(--ease);
}

/* --- Checklist de onboarding --- */
.checklist { display: flex; flex-direction: column; gap: 2px; }
.checklist-item {
    display: flex; align-items: center; gap: 12px; padding: 12px 4px;
    border-bottom: 1px dashed var(--border);
}
.checklist-item:last-child { border-bottom: none; }
.checklist-check {
    flex-shrink: 0; width: 26px; height: 26px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.85rem; border: 2px solid var(--border-strong); color: transparent;
    transition: all 0.25s var(--ease-spring);
}
.checklist-item.done .checklist-check {
    background: var(--success); border-color: var(--success); color: #fff;
}
.checklist-item.done .checklist-label { color: var(--text-muted); text-decoration: line-through; }
.checklist-label { flex: 1 1 auto; font-weight: 600; font-size: 0.9rem; }
.checklist-item a.checklist-cta { font-size: 0.78rem; font-weight: 700; color: var(--gold-600); white-space: nowrap; }

/* --- Timeline (historial de movimientos) --- */
.timeline { display: flex; flex-direction: column; }
.timeline-item {
    display: flex; gap: 12px; padding: 10px 0;
    border-bottom: 1px dashed var(--border);
}
.timeline-item:last-child { border-bottom: none; }
.timeline-dot {
    flex-shrink: 0; width: 10px; height: 10px; border-radius: 50%; margin-top: 5px;
    background: var(--gold-500);
}
.timeline-item.tl-redeem .timeline-dot { background: var(--error); }
.timeline-item.tl-earn .timeline-dot { background: var(--success); }
.timeline-body { flex: 1 1 auto; }
.timeline-title { font-weight: 700; font-size: 0.88rem; color: var(--text-900); }
.timeline-meta { font-size: 0.76rem; color: var(--text-muted); margin-top: 2px; }
.timeline-amount { font-weight: 700; font-size: 0.92rem; white-space: nowrap; }
.timeline-amount.tl-plus { color: var(--success); }
.timeline-amount.tl-minus { color: var(--error); }

/* --- Control segmentado (pestañas tipo iOS, para reemplazar botones sueltos) --- */
.segmented { display: inline-flex; background: var(--app-bg-dim); border-radius: var(--radius-pill); padding: 4px; gap: 2px; }
.segmented button {
    border: none; background: transparent; padding: 8px 16px; border-radius: var(--radius-pill);
    font-size: 0.82rem; font-weight: 700; color: var(--text-muted); box-shadow: none;
}
.segmented button::before { display: none; }
.segmented button:hover { transform: none; box-shadow: none; background: var(--loypin-card-bg); }
.segmented button.active { background: var(--loypin-card-bg); color: var(--text-900); box-shadow: var(--shadow-xs); }

/* --- Contenedor de tabla con scroll horizontal seguro --- */
.table-card {
    background: var(--loypin-card-bg); border: 1px solid var(--border); border-radius: var(--radius);
    overflow-x: auto; box-shadow: var(--shadow-xs); margin-bottom: 20px;
}
.table-card table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.table-card th {
    text-align: left; padding: 12px 14px; font-size: 0.7rem; text-transform: uppercase;
    letter-spacing: 0.04em; color: var(--text-muted); border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.table-card td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table-card tbody tr:last-child td { border-bottom: none; }
.table-card tbody tr:hover { background: var(--app-bg); }

/* --- Banner de alerta / insight accionable --- */
.insight-banner {
    display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px;
    border-radius: var(--radius); background: linear-gradient(135deg, #fff8ea, #fff);
    border: 1px solid var(--gold-300); margin-bottom: 16px;
}
.insight-banner .insight-icon { font-size: 1.3rem; flex-shrink: 0; }
.insight-banner strong { display: block; margin-bottom: 2px; }
.insight-banner p { margin: 0; font-size: 0.84rem; color: var(--text-600); }

/* --- Poster/cartel imprimible --- */
@media print {
    body * { visibility: hidden; }
    #poster-print, #poster-print * { visibility: visible; }
    #poster-print { position: absolute; inset: 0; }
    .no-print { display: none !important; }
}