* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

:root {
    --primary:   #1d3557;
    --accent:    #e63946;
    --success:   #1d9e75;
    --warning:   #ef9f27;
    --danger:    #e63946;
    --bg:        #f4f6f8;
    --card:      #ffffff;
    --text:      #1a1a2e;
    --muted:     #6b7280;
    --border:    #e5e7eb;
    --radius:    12px;
    --radius-sm: 8px;
}

html, body {
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 15px;
    line-height: 1.5;
    overflow: hidden;
}

#app {
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Android: dvh para excluir barra de navegación */
body.is-android #app {
    height: 100dvh;
}

/* ── Pantallas ── */
.screen {
    display: none;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    min-height: 0;
    max-height: 100%;
}
.screen.active { display: flex; }

/* ── Header ── */
.header {
    background: var(--primary);
    color: white;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
    padding-top: 16px;
}
.header h1 { font-size: 17px; font-weight: 500; flex: 1; }
.header-btn {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
}

/* ── Contenido scrolleable ── */
.content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 16px;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 24px;
    overscroll-behavior: contain;
    scroll-behavior: auto;
    min-height: 0;
    max-height: 100%;
}

/* ── Cards ── */
.card {
    background: var(--card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 14px;
    margin-bottom: 10px;
}

/* ── Login ── */
.login-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: var(--primary);
}
.login-logo {
    width: 72px;
    height: 72px;
    background: var(--accent);
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
}
.login-title { color: white; font-size: 22px; font-weight: 500; margin-bottom: 4px; }
.login-sub   { color: rgba(255,255,255,0.6); font-size: 13px; margin-bottom: 32px; }
.login-form  { width: 100%; max-width: 360px; }
.form-group  { margin-bottom: 12px; }
.form-label  { color: rgba(255,255,255,0.7); font-size: 12px; margin-bottom: 4px; display: block; }
.form-input  {
    width: 100%;
    background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    color: white;
    font-size: 15px;
    outline: none;
}
.form-input::placeholder { color: rgba(255,255,255,0.4); }
.form-input:focus { border-color: rgba(255,255,255,0.5); background: rgba(255,255,255,0.18); }

/* ── Inputs en cards (fondo claro) ── */
.input-dark {
    width: 100%;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    color: var(--text);
    font-size: 14px;
    outline: none;
    font-family: inherit;
}
.input-dark:focus { border-color: var(--accent); }
.input-dark::placeholder { color: var(--muted); }
select.input-dark { appearance: none; -webkit-appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236b7280' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }

.form-group-inline { margin-bottom: 12px; }
.label-dark { font-size: 12px; color: var(--muted); display: block; margin-bottom: 4px; }

/* ── Input fecha (filtros) ── */
.input-fecha {
    flex: 1;
    min-width: 0;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 8px 10px;
    font-size: 13px;
    color: var(--text);
    outline: none;
    font-family: inherit;
}
.input-fecha:focus { border-color: var(--accent); }

/* ── Botones ── */
.btn {
    width: 100%;
    padding: 13px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: opacity 0.2s;
}
.btn:active { opacity: 0.8; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-accent   { background: var(--accent); color: white; }
.btn-primary  { background: var(--primary); color: white; }
.btn-success  { background: var(--success); color: white; }
.btn-outline  {
    background: none;
    border: 1px solid var(--border);
    color: var(--text);
}
.btn-sm {
    width: auto;
    padding: 7px 14px;
    font-size: 13px;
}

/* ── Búsqueda ── */
.search-wrap {
    position: relative;
    margin-bottom: 12px;
}
.search-input {
    width: 100%;
    padding: 10px 14px 10px 38px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--card);
    font-size: 14px;
    outline: none;
    color: var(--text);
}
.search-input:focus { border-color: var(--accent); }
.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted);
}

/* ── Socio item ── */
.socio-item {
    background: var(--card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 12px 14px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: background 0.15s;
}
.socio-item:active { background: #f9fafb; }
.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 500;
    flex-shrink: 0;
}
.avatar-green  { background: #dcfce7; color: #166534; }
.avatar-red    { background: #fee2e2; color: #991b1b; }
.avatar-yellow { background: #fef9c3; color: #854d0e; }
.avatar-blue   { background: #dbeafe; color: #1e40af; }
.socio-info { flex: 1; min-width: 0; }
.socio-nombre { font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.socio-tel    { font-size: 12px; color: var(--muted); }

/* ── Badges ── */
.badge {
    font-size: 10px;
    padding: 3px 8px;
    border-radius: 20px;
    font-weight: 500;
    white-space: nowrap;
    flex-shrink: 0;
}
.badge-success  { background: #dcfce7; color: #166534; }
.badge-danger   { background: #fee2e2; color: #991b1b; }
.badge-warning  { background: #fef9c3; color: #854d0e; }
.badge-gray     { background: #f3f4f6; color: #374151; }

/* ── Bottom nav ── */
.bottom-nav {
    background: var(--card);
    border-top: 1px solid var(--border);
    display: flex;
    flex-shrink: 0;
    min-height: 56px;
    position: relative;
    z-index: 100;
    flex-grow: 0;
}
.nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 6px 0;
    cursor: pointer;
    color: var(--muted);
    font-size: 10px;
    gap: 3px;
    border: none;
    background: none;
    transition: color 0.15s;
}
.nav-item.active { color: var(--accent); }
.nav-item svg path, .nav-item svg rect, .nav-item svg circle, .nav-item svg line { stroke: currentColor; }

/* ── Filtros ── */
.filter-row {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 2px;
}
.filter-btn {
    padding: 6px 14px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: var(--card);
    font-size: 12px;
    cursor: pointer;
    white-space: nowrap;
    color: var(--text);
    flex-shrink: 0;
}
.filter-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

/* ── Detalle socio ── */
.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
    gap: 8px;
}
.info-row:last-child { border-bottom: none; }
.info-label { color: var(--muted); flex-shrink: 0; }
.info-value { font-weight: 500; text-align: right; }

/* ── Plan selector ── */
.plan-item {
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px;
    margin-bottom: 8px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: border-color 0.15s;
}
.plan-item.selected { border-color: var(--accent); background: #fff5f5; }
.plan-nombre { font-size: 14px; font-weight: 500; }
.plan-precio { font-size: 14px; color: var(--accent); font-weight: 500; }

/* ── Medio pago ── */
.medio-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-bottom: 14px;
}
.medio-item {
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px;
    text-align: center;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.15s;
}
.medio-item.selected { border-color: var(--accent); background: #fff5f5; color: var(--accent); font-weight: 500; }

/* ── Toast ── */
.toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: #1a1a2e;
    color: white;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 13px;
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s;
    white-space: nowrap;
    max-width: 90vw;
    text-align: center;
}
.toast.show { opacity: 1; }

/* ── Loader ── */
.loader {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: var(--muted);
    font-size: 14px;
}
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    margin-right: 8px;
    flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Caja stats ── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 14px;
}
.stat-card {
    background: var(--card);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    padding: 12px;
    text-align: center;
}
.stat-label { font-size: 11px; color: var(--muted); margin-bottom: 4px; }
.stat-value { font-size: 16px; font-weight: 500; }

/* ── Empty state ── */
.empty {
    text-align: center;
    padding: 48px 24px;
    color: var(--muted);
}
.empty-icon { font-size: 40px; margin-bottom: 12px; }
.empty p { font-size: 14px; }

/* ── Footer fijo pantalla pago ── */
.pago-footer {
    background: var(--card);
    border-top: 1px solid var(--border);
    padding: 12px 16px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    flex-shrink: 0;
    flex-grow: 0;
    width: 100%;
}

/* Android: padding extra para barra de gestos */
body.is-android .pago-footer {
    padding-bottom: calc(12px + max(env(safe-area-inset-bottom, 0px), 16px));
}

/* ── Formularios socios ── */
.form-row-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
.seccion-titulo {
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .5px;
    margin-bottom: 12px;
}
.req { color: var(--danger); }
.input-dark textarea { resize: none; }
textarea.input-dark {
    width: 100%;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    color: var(--text);
    font-size: 14px;
    outline: none;
    font-family: inherit;
    resize: none;
}
textarea.input-dark:focus { border-color: var(--accent); }

/* ── Menú lateral ── */
.menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 16px;
    color: rgba(255,255,255,0.85);
    font-size: 14px;
    cursor: pointer;
    transition: background .15s;
}
.menu-item:active { background: rgba(255,255,255,0.08); }