/* Portal del socio (mobile-first). Misma identidad que el sistema de administración. */
:root {
    --sky-500: #0b91c1;
    --sky-50: #e6f5fa;
    --blue-950: #0b2a3a;
    --ink: #0b2a3a;
    --muted: #5b7a8c;
    --line: #e6edf1;
    --bg: #eef4f7;
    --card: #ffffff;
    --ok-bg: #e6f7f1;
    --ok: #0e7a5a;
    --bad-bg: #fff0f2;
    --bad: #c03648;
    --warn-bg: #fff5e5;
    --warn: #a86a0c;
    --radius: 16px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body.mov {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: Manrope, system-ui, -apple-system, "Segoe UI", sans-serif;
    padding-bottom: 84px; /* lugar para la barra inferior */
}
.mov-wrap { max-width: 560px; margin: 0 auto; padding: 14px 14px 24px; }
a { color: inherit; }

/* Encabezado */
.mov-brand { display: flex; align-items: center; gap: 10px; padding: 6px 2px 14px; }
.mov-brand img { width: 42px; height: 42px; object-fit: contain; }
.mov-brand strong { display: block; font-size: .95rem; }
.mov-brand small { color: var(--muted); font-size: .7rem; }
.mov-brand .salir {
    margin-left: auto; font-size: .75rem; font-weight: 800; color: var(--bad);
    text-decoration: none; border: 1px solid var(--bad); border-radius: 999px;
    padding: 7px 14px; background: var(--bad-bg);
}
.mov-brand .volver {
    flex: 0 0 auto; width: 38px; height: 38px; border-radius: 12px;
    border: 1px solid var(--line); background: #fff; color: var(--ink);
    font-size: .9rem; cursor: pointer;
}

/* Tarjetas */
.card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 18px;
    margin-bottom: 12px;
    box-shadow: 0 10px 30px rgba(5,31,45,.08);
}
.card h2 {
    margin: 0 0 10px;
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--sky-500);
}
.card h2 i { margin-right: 6px; }
.eyebrow { margin: 0; color: var(--sky-500); font-size: .7rem; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
h1.titulo { margin: 2px 0 4px; font-size: 1.25rem; }
.sub { margin: 0; color: var(--muted); font-size: .8rem; }

/* Identidad */
.perfil { display: flex; gap: 12px; align-items: center; }
.avatar {
    flex: 0 0 60px; width: 60px; height: 60px; border-radius: 18px;
    background: var(--sky-500); color: #fff;
    display: grid; place-items: center;
    font-weight: 800; font-size: 1.15rem; overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.perfil h1 { margin: 0; font-size: 1.05rem; }
.perfil p { margin: 2px 0 0; color: var(--muted); font-size: .75rem; }

/* Badges */
.badge {
    display: inline-flex; align-items: center; gap: 8px;
    border-radius: 999px; padding: 10px 16px;
    font-weight: 800; font-size: .82rem; margin-top: 12px;
}
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.deuda { background: var(--bad-bg); color: var(--bad); }
.badge.aviso { background: var(--warn-bg); color: var(--warn); }
.badge.neutro { background: var(--sky-50); color: var(--sky-500); }

/* Filas y avisos */
.fila { display: flex; justify-content: space-between; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line); font-size: .82rem; }
.fila:first-of-type { border-top: 0; }
.fila span { color: var(--muted); }
.fila strong { text-align: right; }
.item { border: 1px solid var(--line); border-radius: 12px; padding: 11px 12px; margin-bottom: 8px; font-size: .8rem; }
.item strong { display: block; }
.item small { display: block; color: var(--muted); margin-top: 3px; font-size: .72rem; }
.item.impaga { border-left: 4px solid var(--bad); }
.item.paga { border-left: 4px solid var(--ok); }
.item.nuevo { border-left: 4px solid var(--sky-500); background: #f4fbfe; }
.vacio { color: var(--muted); font-size: .8rem; margin: 4px 0; }
.total { display: flex; justify-content: space-between; align-items: center; padding-top: 10px; margin-top: 6px; border-top: 2px solid var(--line); font-size: .9rem; }
.total strong:last-child { font-size: 1.05rem; }

/* Accesos */
.accesos { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.acceso {
    display: flex; flex-direction: column; gap: 6px;
    background: var(--card); border-radius: var(--radius);
    padding: 16px 14px; text-decoration: none;
    box-shadow: 0 10px 30px rgba(5,31,45,.08);
    font-size: .8rem; font-weight: 700;
    position: relative;
}
.acceso small { color: var(--muted); font-weight: 400; font-size: .7rem; }
.acceso > i { font-size: 1.25rem; color: var(--sky-500); }
.acceso .contador {
    position: absolute; top: 10px; right: 10px;
    min-width: 22px; height: 22px; border-radius: 999px;
    background: var(--bad); color: #fff;
    font-size: .68rem; font-weight: 800;
    display: grid; place-items: center; padding: 0 6px;
}

/* El atributo hidden debe ganar siempre (ej.: .btn define display y lo pisaba). */
[hidden] { display: none !important; }

/* Botones */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    border: 0; border-radius: 12px; padding: 14px 18px;
    font: inherit; font-weight: 800; font-size: .9rem;
    text-decoration: none; cursor: pointer; width: 100%;
}
.btn-primary { background: var(--sky-500); color: #fff; }
.btn-secondary { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.btn-sm { width: auto; padding: 9px 14px; font-size: .78rem; }

/* Formularios */
.campo { margin-bottom: 12px; }
.campo label { display: block; font-size: .75rem; font-weight: 700; margin-bottom: 5px; }
.campo input {
    width: 100%; border: 1px solid var(--line); border-radius: 12px;
    padding: 14px; font: inherit; font-size: 1rem; background: #fff;
}
.campo input:focus { outline: 2px solid var(--sky-500); border-color: var(--sky-500); }
.campo input[type="file"] { padding: 10px; font-size: .8rem; }
.ayuda { font-size: .72rem; color: var(--muted); margin-top: 5px; }
.alert { border-radius: 12px; padding: 12px 14px; font-size: .8rem; margin-bottom: 12px; display: flex; gap: 10px; align-items: flex-start; }
.alert-error { background: var(--bad-bg); color: var(--bad); }
.alert-info { background: var(--sky-50); color: var(--blue-950); }

/* Login */
.login-logo { text-align: center; padding: 26px 0 6px; }
.login-logo img { width: 84px; height: 84px; object-fit: contain; }
.login-logo h1 { margin: 10px 0 2px; font-size: 1.2rem; }
.login-logo p { margin: 0; color: var(--muted); font-size: .8rem; }

/* Barra inferior */
.tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
    background: #fff; border-top: 1px solid var(--line);
    display: flex; padding: 6px 4px calc(8px + env(safe-area-inset-bottom));
}
.tabbar a {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
    padding: 7px 2px; text-decoration: none; color: var(--muted);
    font-size: .62rem; font-weight: 700; position: relative;
}
.tabbar a i { font-size: 1.15rem; }
.tabbar a.activo { color: var(--sky-500); }
.tabbar .punto {
    position: absolute; top: 4px; right: calc(50% - 20px);
    min-width: 17px; height: 17px; border-radius: 999px;
    background: var(--bad); color: #fff; font-size: .58rem;
    display: grid; place-items: center; padding: 0 4px;
}

/* Botón flotante de instalación (FAB, abajo a la derecha) */
#instalar-app {
    position: fixed; right: 16px; bottom: calc(96px + env(safe-area-inset-bottom)); z-index: 60;
    width: 56px; height: 56px; border: 0; border-radius: 50%;
    background: var(--sky-500); color: #fff; font-size: 1.25rem;
    display: grid; place-items: center; cursor: pointer;
    box-shadow: 0 6px 20px rgba(0, 0, 0, .3);
}
#instalar-app:active { transform: scale(.94); }

/* Ayuda de instalación para iPhone (hoja inferior) */
#instalar-ayuda {
    position: fixed; left: 12px; right: 12px; bottom: calc(96px + env(safe-area-inset-bottom)); z-index: 61;
    background: #fff; border: 1px solid var(--line); border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .25); padding: 16px 16px 14px;
}
#instalar-ayuda h2 { font-size: .95rem; margin: 0 0 8px; }
#instalar-ayuda ol { margin: 0; padding-left: 20px; font-size: .82rem; display: grid; gap: 6px; }
#instalar-ayuda-cerrar {
    position: absolute; top: 8px; right: 8px; width: 32px; height: 32px;
    border: 0; border-radius: 50%; background: #eef2f5; color: var(--muted);
    font-size: .85rem; cursor: pointer;
}

/* QR carnet */
.qr-caja { display: grid; place-items: center; border: 1px solid var(--line); border-radius: 14px; padding: 12px; margin: 14px auto 6px; width: 236px; height: 236px; background: #fff; }
.qr-caja img, .qr-caja canvas { width: 100% !important; height: 100% !important; }
.centrado { text-align: center; }
.pie { text-align: center; color: var(--muted); font-size: .68rem; margin-top: 16px; }

/* Estado de las notificaciones dentro de Avisos. */
.notificaciones-preferencias { margin: 14px 0; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); }
.notificaciones-control { display: inline-flex; align-items: center; gap: 8px; border: 0; border-radius: 999px; padding: 9px 14px; color: #fff; font: inherit; font-size: .78rem; font-weight: 800; cursor: pointer; }
.notificaciones-activadas { background: var(--ok); }
.notificaciones-desactivadas { background: var(--bad); }
#notificaciones-estado-leyenda { margin: 8px 0 0; color: var(--muted); font-size: .72rem; }
.notificaciones-control:disabled { opacity: .65; cursor: wait; }
/* Boton de notificaciones: estados visibles */
.notificaciones-preferencias .notificaciones-control {
    appearance: none;
    -webkit-appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 0;
    border-radius: 999px;
    padding: 10px 16px;
    color: #fff !important;
    font: inherit;
    font-size: .78rem;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 5px 12px rgba(11, 42, 58, .14);
}
.notificaciones-preferencias .notificaciones-control.notificaciones-activadas {
    background: #168a68 !important;
}
.notificaciones-preferencias .notificaciones-control.notificaciones-desactivadas {
    background: #c03648 !important;
}
/* Foto de perfil: miniatura completa y vista ampliada. */
.perfil-foto { flex: 0 0 auto; width: 66px; height: 66px; padding: 0; border: 0; border-radius: 50%; overflow: hidden; background: var(--sky-50); cursor: zoom-in; }
.perfil-foto img { display: block; width: 100%; height: 100%; object-fit: contain; background: var(--sky-50); }
.perfil-foto-modal { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 24px; background: rgba(5, 20, 28, .78); }
.perfil-foto-modal[hidden] { display: none; }
.perfil-foto-modal > img { display: block; max-width: min(92vw, 720px); max-height: 82vh; width: auto; height: auto; object-fit: contain; border-radius: 16px; background: #fff; box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.perfil-foto-cerrar { position: absolute; top: 18px; right: 18px; width: 42px; height: 42px; border: 0; border-radius: 50%; background: #fff; color: var(--ink); font-size: 1.8rem; line-height: 1; cursor: pointer; }
.perfil-modal-abierto { overflow: hidden; }
/* Aviso superior para instalar Mi Club. */
#instalar-app {
    top: calc(12px + env(safe-area-inset-top));
    right: 12px;
    bottom: auto;
    left: 12px;
    width: auto;
    min-height: 58px;
    height: auto;
    padding: 10px 14px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 11px;
    border-radius: 15px;
    background: linear-gradient(135deg, var(--sky-500), #238dcc);
    color: #fff;
    text-align: left;
    font-size: 1rem;
    box-shadow: 0 8px 24px rgba(11, 42, 58, .28);
}
#instalar-app:active { transform: scale(.98); }
#instalar-app > i:first-child {
    flex: 0 0 auto;
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    background: rgba(255, 255, 255, .2);
    font-size: 1.08rem;
}
#instalar-app .instalar-app-text {
    min-width: 0;
    display: grid;
    gap: 2px;
    line-height: 1.15;
}
#instalar-app .instalar-app-text strong { font-size: .86rem; font-weight: 800; }
#instalar-app .instalar-app-text small { font-size: .69rem; opacity: .9; }
#instalar-app .instalar-app-flecha { margin-left: auto; font-size: .82rem; opacity: .9; }
@media (min-width: 600px) {
    #instalar-app {
        left: 50%;
        right: auto;
        width: min(420px, calc(100% - 24px));
        transform: translateX(-50%);
    }
    #instalar-app:active { transform: translateX(-50%) scale(.98); }
}
/* Toast de salida en Inicio. */
#salir-toast {
    position: fixed;
    left: 50%;
    bottom: calc(82px + env(safe-area-inset-bottom));
    z-index: 80;
    max-width: calc(100% - 32px);
    padding: 11px 18px;
    border-radius: 999px;
    background: rgba(18, 36, 47, .95);
    color: #fff;
    font-size: .78rem;
    font-weight: 800;
    text-align: center;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transform: translate(-50%, 12px);
    transition: opacity .18s ease, transform .18s ease;
}
#salir-toast.visible {
    opacity: 1;
    transform: translate(-50%, 0);
}