        :root {
            --bg-body: #f3f5f5;
            --bg-card: #ffffff;
            --text-main: #6c7e87;
            --text-muted: #333c40;
            --accent: #1f785c;
            --accent-hover: #ccfbec;
            --accent-sec: #1f785c;
            --border: #e2e5e7;
            --white: #ffffff;
            --instruction-green: #1f785c;
            --danger: #ef4444;
            --success: #1f785c;
        }

        * {
            box-sizing: border-box;
            font-family: 'Lexend', sans-serif;
            -webkit-tap-highlight-color: transparent;
        }

        body {
            background-color: #f3f5f5;
            color: var(--text-main);
            margin: 0;
            padding: 0;
            display: flex;
            flex-direction: column;
            /* justify-content: center; */
            /* align-items: center; */
            min-height: 100vh;
            overflow-x: hidden;
            position: relative;
        }

        .app-container {
            width: 100%;
            max-width: 400px;
            text-align: center;
            position: relative;
            z-index: 10;
        }

        .page-content {
            padding: 6px 16px 20px;
            display: flex;
            flex-direction: column;
            align-items: center;
            width: 100%;
            flex: 1; /* empuja el footer al fondo cuando el contenido es corto */
        }

        @media (max-width: 768px) {
            .page-content {
                padding: 4px 12px 18px;
            }
        }

        .card {
            background: var(--bg-body);
            padding: 25px;
            border-radius: 30px;
            color: var(--text-main);
            margin-top: 4px;
        }

        h2 {
            font-weight: 700;
            font-size: 1.3rem;
            margin-bottom: 5px;
            color: var(--text-main);
        }

        h3 {
            font-size: 1rem;
            margin-bottom: 15px;
            color: var(--text-main);
        }

        p {
            font-size: 0.85rem;
            color: var(--text-main);
            margin-bottom: 20px;
        }

        .input-group {
            text-align: left;
            margin-bottom: 12px;
        }

        label {
            display: block;
            font-size: 0.7rem;
            font-weight: 700;
            margin-bottom: 4px;
            margin-left: 12px;
            color: var(--text-main);
            text-transform: uppercase;
        }

        input,
        select,
        textarea {
            width: 100%;
            padding: 12px;
            border: 2px solid #f0f0f0;
            border-radius: 15px;
            font-size: 16px; /* mínimo 16px evita el zoom automático en iOS Safari */
            outline: none;
            transition: 0.3s;
            text-align: center;
            background: white;
            color: var(--text-main);
        }

        input:focus {
            border-color: var(--accent-sec);
            background: #fffcfd;
        }

        .btn-main {
            width: 100%;
            padding: 16px;
            border-radius: 50px;
            border: none;
            font-weight: 700;
            cursor: pointer;
            text-transform: uppercase;
            margin-top: 10px;
            transition: 0.3s;
            font-size: 0.8rem;
        }

        .btn-generate {
            background: #e1e5b2;
            color: #1f2b2f;
            border: 1px solid rgba(31, 43, 47, 0.15);
        }

        .btn-generate:disabled {
            background: #ccc;
            cursor: not-allowed;
        }

        .btn-secondary {
            background: transparent;
            color: var(--accent-sec);
            border: 1px solid var(--accent-sec);
            font-size: 0.7rem;
            padding: 8px 15px;
            margin-top: 10px;
            border-radius: 20px;
            text-transform: uppercase;
            cursor: pointer;
        }

        .tabs {
            display: flex;
            gap: 5px;
            margin-bottom: 15px;
            background: rgba(255, 255, 255, 0.1);
            padding: 5px;
            border-radius: 50px;
        }

        .tab-btn {
            flex: 1;
            padding: 10px 5px;
            border-radius: 40px;
            border: none;
            background: transparent;
            color: var(--text-main);
            font-size: 0.65rem;
            font-weight: 700;
            cursor: pointer;
            text-transform: uppercase;
        }

        .tab-btn.active {
            background: var(--accent);
            color: #ffffff;
        }

        #terms-screen {
            text-align: left;
        }

        .terms-box {
            font-size: 0.8rem;
            color: var(--text-main);
            line-height: 1.4;
            height: 250px;
            overflow-y: auto;
            background: #f9f9f9;
            padding: 15px;
            border-radius: 15px;
            margin-bottom: 15px;
            border: 1px solid #eee;
        }

        .check-container {
            display: flex;
            align-items: center;
            gap: 10px;
            font-size: 0.75rem;
            color: #333;
            margin-bottom: 15px;
            cursor: pointer;
        }

        .check-container input {
            width: auto;
            margin: 0;
        }

        .success-msg {
            color: var(--instruction-green);
            font-weight: 700;
            font-size: 0.85rem;
            margin-top: 15px;
            display: none;
            padding: 10px;
            background: #e8f5e9;
            border-radius: 15px;
        }

        .hidden {
            display: none !important;
        }

        /* ─── Anunciar Mi Entrada — nuevo diseño ─── */
        .anunciar-circle-wrap { text-align: center; margin: 24px 0 18px; }

        /* ── Botón anunciar: basado en SVG imagen ── */
        .anunciar-img-btn {
            position: relative;
            display: inline-block;
            cursor: pointer;
            user-select: none; -webkit-user-select: none;
            -webkit-tap-highlight-color: transparent;
            transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1),
                        filter 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
        }
        .anunciar-btn-img {
            width: 220px;
            height: 220px;
            display: block;
            pointer-events: none;
        }
        /* Estado: presionado/cargando — se queda abajo con pulso de brillo */
        .anunciar-img-btn.anunciar-pressed {
            transform: scale(0.93) translateY(8px);
            animation: anunciarPulse 1.1s ease-in-out infinite;
        }
        @keyframes anunciarPulse {
            0%, 100% { filter: brightness(1); }
            50%       { filter: brightness(0.82); }
        }
        /* Estado: esperando confirmación — parpadeo de atención */
        .anunciar-img-btn.confirmar-pendiente {
            animation: confirmarPulse 1.6s ease-in-out infinite;
        }
        @keyframes confirmarPulse {
            0%, 100% { transform: scale(1);    filter: drop-shadow(0 0 0px rgba(239,68,68,0)); }
            50%       { transform: scale(1.04); filter: drop-shadow(0 0 18px rgba(239,68,68,0.55)); }
        }
        /* ── Selector de 3 placas ── */
        .placas-selector {
            display: grid;
            grid-template-columns: 1fr 1fr 1fr;
            gap: 9px;
            margin: 0 0 14px;
        }
        .placa-slot {
            background: #fff;
            border: 2px solid #e2e5e7;
            border-radius: 16px;
            padding: 12px 6px 10px;
            text-align: center;
            cursor: pointer;
            position: relative;
            transition: border-color 0.2s, background 0.2s, transform 0.12s;
            min-height: 82px;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            gap: 3px;
            user-select: none;
            -webkit-user-select: none;
            -webkit-tap-highlight-color: transparent;
        }
        .placa-slot:active { transform: scale(0.95); }
        .placa-slot.activa {
            border-color: #1f785c;
            background: #f0faf7;
        }
        .placa-slot.vacia {
            border: 2px dashed #c8cfd3;
            background: #fafafa;
        }
        .placa-slot-valor {
            font-size: 0.88rem;
            font-weight: 800;
            letter-spacing: 0.08em;
            color: #333c40;
            line-height: 1.1;
            word-break: break-all;
        }
        .placa-slot.activa .placa-slot-valor { color: #1f785c; }
        .placa-slot-label {
            font-size: 0.58rem;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.06em;
            color: #9aa8af;
        }
        .placa-slot-check {
            width: 14px; height: 14px;
            background: #1f785c;
            border-radius: 50%;
            display: flex; align-items: center; justify-content: center;
            margin-bottom: 1px; flex-shrink: 0;
        }
        .placa-slot-edit {
            position: absolute;
            top: 5px; right: 5px;
            background: none; border: none; cursor: pointer;
            padding: 3px; color: #c8cfd3; line-height: 1;
            -webkit-tap-highlight-color: transparent;
        }
        .placa-slot-edit:active { color: #333c40; }
        .placa-slot-add-icon {
            font-size: 1.5rem; color: #c8cfd3;
            line-height: 1; font-weight: 300;
        }
        .placa-activa-label {
            font-size: 0.72rem; font-weight: 700;
            text-transform: uppercase; letter-spacing: 0.06em;
            color: #9aa8af; text-align: center; margin: 0 0 10px;
        }
        .btn-modo-amigo-pill {
            border: 2px solid var(--accent); border-radius: 30px;
            background: transparent; color: var(--accent);
            font-weight: 700; font-size: 0.88rem;
            padding: 10px 28px; cursor: pointer;
            display: inline-flex; align-items: center; gap: 8px;
        }
        .placa-modal-overlay {
            position: fixed; inset: 0;
            background: rgba(30,38,42,0.55);
            backdrop-filter: blur(6px);
            -webkit-backdrop-filter: blur(6px);
            z-index: 300; display: flex;
            align-items: center; justify-content: center;
            padding: 20px;
        }
        .placa-modal-box {
            background: #ffffff;
            border-radius: 28px;
            padding: 32px 28px 28px;
            max-width: 340px;
            width: 100%;
            text-align: center;
            box-shadow: 0 24px 60px rgba(0,0,0,0.18), 0 4px 16px rgba(0,0,0,0.08);
        }
        .placa-modal-box p {
            font-weight: 700; font-size: 1rem;
            color: #333c40; margin: 0 0 20px; line-height: 1.4;
        }
        .placa-input-modal {
            font-size: 2.1rem; font-weight: 800; letter-spacing: 0.14em;
            border: 2px solid #e2e5e7; border-radius: 16px;
            padding: 14px 12px; width: 100%; text-align: center;
            margin-bottom: 24px; box-sizing: border-box;
            background: #fafafa; color: #1f3a30;
            transition: border-color 0.2s;
            outline: none;
        }
        .placa-input-modal:focus {
            border-color: #1f785c;
            background: #fff;
        }
        .placa-modal-save-btn { display: none; } /* legacy — no usar */

        /* ── Botón Guardar ── */
        .placa-btn-save {
            width: 100%;
            padding: 16px;
            background: #1f785c;
            color: #ffffff;
            border: none;
            border-radius: 50px;
            font-size: 0.95rem;
            font-weight: 700;
            cursor: pointer;
            letter-spacing: 0.02em;
            transition: background 0.2s, transform 0.1s;
            font-family: inherit;
        }
        .placa-btn-save:active { transform: scale(0.97); background: #185f49; }

        /* ── Botón Eliminar ── */
        .placa-btn-delete {
            width: 100%;
            padding: 14px;
            background: transparent;
            color: #c62828;
            border: 2px solid #c62828;
            border-radius: 50px;
            font-size: 0.9rem;
            font-weight: 700;
            cursor: pointer;
            display: none;
            align-items: center;
            justify-content: center;
            gap: 8px;
            margin-top: 10px;
            transition: background 0.2s, transform 0.1s;
            font-family: inherit;
        }
        .placa-btn-delete:active { transform: scale(0.97); background: #fdecea; }

        /* ─── Manual de uso ─── */
        .btn-manual-link {
            background: none; border: none; cursor: pointer;
            font-size: 0.8rem; font-weight: 600; color: var(--text-main);
            opacity: 0.6; text-decoration: none; padding: 0;
            font-family: inherit;
        }
        .btn-manual-link:hover { opacity: 0.9; }
        .manual-overlay {
            position: fixed; inset: 0; background: rgba(0,0,0,0.45);
            z-index: 400; display: flex; align-items: flex-end;
            justify-content: center;
            padding-top: 72px; /* evita solapamiento con el header fijo de la app */
            box-sizing: border-box;
        }
        .manual-sheet {
            background: #fff; border-radius: 28px 28px 0 0;
            width: 100%; max-width: 540px;
            max-height: 100%; overflow-y: auto;
            padding: 0 0 64px 0;
            -webkit-overflow-scrolling: touch;
        }
        .manual-header {
            position: sticky; top: 0; background: #fff;
            padding: 18px 24px 14px;
            border-bottom: 1px solid #e2e5e7;
            display: flex; align-items: center; gap: 12px;
            z-index: 1;
        }
        .manual-close-btn {
            width: 32px; height: 32px; border-radius: 50%;
            background: #f0f2f3; border: none; cursor: pointer;
            display: flex; align-items: center; justify-content: center;
            flex-shrink: 0;
        }
        .manual-header-title {
            font-size: 1rem; font-weight: 800; color: #333c40; margin: 0;
        }
        .manual-body { padding: 24px 24px 0; }
        .manual-section { margin-bottom: 28px; }
        .manual-section-header {
            display: flex; align-items: center; gap: 10px;
            margin-bottom: 10px;
        }
        .manual-icon {
            width: 36px; height: 36px; border-radius: 10px;
            background: #f0faf7; display: flex; align-items: center;
            justify-content: center; flex-shrink: 0;
        }
        .manual-section-title {
            font-size: 0.95rem; font-weight: 800; color: #1f785c; margin: 0;
        }
        .manual-section-body {
            font-size: 0.82rem; color: #6c7e87; line-height: 1.65;
            margin: 0; padding-left: 46px;
            text-align: left;
        }
        .manual-section-body strong { color: #333c40; }
        .manual-divider {
            border: none; border-top: 1px solid #e2e5e7; margin: 0 0 28px 0;
        }
        .manual-tip {
            background: #f3f5f5; border-radius: 14px;
            padding: 14px 16px; margin-top: 8px; margin-left: 46px;
            font-size: 0.78rem; color: #6c7e87; line-height: 1.6;
            text-align: left;
        }
        .manual-tip strong { color: #333c40; }

        #qr-render-area {
            position: absolute;
            left: -9999px;
            top: 0;
            width: 350px;
            background: white;
            padding: 30px;
            color: #2d1a24;
            text-align: center;
        }

        .png-title {
            font-weight: 700;
            font-size: 1.2rem;
            margin-bottom: 15px;
            border-bottom: 2px solid #f0f0f0;
            padding-bottom: 10px;
            color: #6c7e87;
        }

        .png-info {
            text-align: left;
            font-size: 0.9rem;
            line-height: 1.5;
            margin-bottom: 15px;
        }

        .png-footer {
            font-size: 0.7rem;
            color: var(--text-main);
            margin-top: 10px;
        }

        /* Nombre de colonia en el header */
        .header-colonia-name {
            font-size: 0.7rem;
            font-weight: 700;
            color: var(--accent);
            opacity: 0.75;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            max-width: 140px;
            flex: 1;
            text-align: left;
            padding-left: 8px;
        }

        /* Estilos adicionales para Admin */
        .instruction-text {
            font-size: 0.72rem;
            color: var(--instruction-green);
            font-weight: 600;
            margin: 10px 0;
            line-height: 1.4;
        }

        #carnet-render-area {
            position: absolute;
            left: -9999px;
            top: 0;
            width: 400px;
            height: 600px;
            background: #fff;
            color: #6c7e87;
            overflow: hidden;
        }

        /* ── Onboarding ── */
        #onboarding-screen {
            position: fixed;
            inset: 0;
            background: #f3f5f5;
            z-index: 9000;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: flex-start;
            padding: 48px 24px 40px;
            overflow-y: auto;
            -webkit-overflow-scrolling: touch;
            animation: fadeIn 0.4s ease;
        }

        @keyframes fadeIn {
            from {
                opacity: 0;
            }

            to {
                opacity: 1;
            }
        }

        .onboarding-logo {
            background: var(--accent);
            padding: 18px 24px;
            border-radius: 20px;
            margin-bottom: 28px;
        }

        .onboarding-logo img {
            width: 90px;
            display: block;
        }

        .onboarding-title {
            font-size: 1.1rem;
            font-weight: 700;
            color: var(--accent);
            margin-bottom: 6px;
            text-align: center;
        }

        .onboarding-sub {
            font-size: 0.75rem;
            color: var(--text-main);
            text-align: center;
            margin-bottom: 28px;
            opacity: 0.75;
        }

        .onboarding-cards {
            display: flex;
            flex-direction: column;
            gap: 12px;
            width: 100%;
            max-width: 340px;
            margin-bottom: 28px;
        }

        .ob-card {
            background: rgba(255, 255, 255, 0.07);
            border: 1px solid #ccfbec;
            border-radius: 16px;
            padding: 14px 16px;
            display: flex;
            align-items: flex-start;
            gap: 14px;
        }

        .ob-icon {
            width: 38px;
            height: 38px;
            border-radius: 10px;
            background: rgba(11, 109, 90, 0.1);
            display: flex;
            align-items: center;
            justify-content: center;
            flex-shrink: 0;
        }

        .ob-icon svg {
            width: 20px;
            height: 20px;
            fill: var(--accent);
        }

        .ob-text {
            flex: 1;
        }

        .ob-label {
            font-size: 0.8rem;
            font-weight: 700;
            color: var(--accent);
            margin-bottom: 3px;
        }

        .ob-desc {
            font-size: 0.7rem;
            color: var(--text-main);
            opacity: 0.8;
            line-height: 1.45;
        }

        .btn-onboarding {
            width: 100%;
            max-width: 340px;
            padding: 15px;
            border-radius: 50px;
            border: none;
            background: var(--accent);
            color: #ffffff;
            font-family: 'Lexend', sans-serif;
            font-weight: 700;
            font-size: 0.88rem;
            cursor: pointer;
            box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
        }

        /* ── Check icon animation ── */
        .check-icon {
            width: 80px;
            height: 80px;
            margin-bottom: 18px;
            flex-shrink: 0;
        }

        .check-circle {
            stroke: var(--accent);
            stroke-width: 3;
            fill: none;
            stroke-dasharray: 226;
            stroke-dashoffset: 226;
            animation: draw-circle 0.5s ease forwards;
        }

        .check-tick {
            stroke: var(--accent);
            stroke-width: 3.5;
            fill: none;
            stroke-linecap: round;
            stroke-linejoin: round;
            stroke-dasharray: 60;
            stroke-dashoffset: 60;
            animation: draw-tick 0.35s ease 0.45s forwards;
        }

        @keyframes draw-circle {
            to {
                stroke-dashoffset: 0;
            }
        }

        @keyframes draw-tick {
            to {
                stroke-dashoffset: 0;
            }
        }

        /* Reset animation on re-show */
        .check-icon.replay .check-circle {
            animation: none;
            stroke-dashoffset: 0;
        }

        .check-icon.replay .check-tick {
            animation: none;
            stroke-dashoffset: 0;
        }

        /* ── Success overlay (check + mensaje) ── */
        #success-overlay {
            position: fixed;
            inset: 0;
            background: rgba(18, 18, 18, 0.85);
            z-index: 8000;
            display: none;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            padding: 30px;
            text-align: center;
        }

        #success-overlay.show {
            display: flex;
        }

        #success-overlay .success-title {
            font-size: 1.2rem;
            font-weight: 700;
            color: var(--accent);
            margin-bottom: 8px;
        }

        #success-overlay .success-sub {
            font-size: 0.82rem;
            color: rgba(233, 207, 154, 0.7);
            line-height: 1.5;
            max-width: 280px;
        }

        #success-overlay .share-row {
            margin-top: 20px;
            display: flex;
            gap: 10px;
            justify-content: center;
        }

        .btn-share {
            padding: 12px 22px;
            border-radius: 50px;
            border: none;
            background: var(--accent);
            color: #ffffff;
            font-family: 'Lexend', sans-serif;
            font-weight: 700;
            font-size: 0.8rem;
            cursor: pointer;
            display: flex;
            align-items: center;
            gap: 7px;
        }

        .btn-share svg {
            width: 16px;
            height: 16px;
            fill: #f3f5f5;
        }

        .btn-share-outline {
            padding: 12px 22px;
            border-radius: 50px;
            border: 1.5px solid var(--accent);
            background: transparent;
            color: rgba(233, 207, 154, 0.7);
            font-family: 'Lexend', sans-serif;
            font-size: 0.8rem;
            cursor: pointer;
        }

        /* ── Delivery link overlay ── */
        #delivery-overlay {
            position: fixed;
            inset: 0;
            background: rgba(18, 18, 18, 0.88);
            z-index: 8000;
            display: none;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            padding: 30px;
            text-align: center;
            gap: 16px;
        }
        #delivery-overlay.show { display: flex; }
        #delivery-overlay .success-title {
            font-size: 1.2rem;
            font-weight: 800;
            color: #ffffff;
            margin-bottom: 4px;
        }
        #delivery-overlay .success-sub {
            font-size: 0.82rem;
            color: rgba(255,255,255,0.65);
            line-height: 1.6;
            max-width: 300px;
        }
        .del-link-box {
            background: rgba(255,255,255,0.1);
            border: 1.5px solid rgba(255,255,255,0.2);
            border-radius: 14px;
            padding: 14px 18px;
            width: 100%;
            max-width: 340px;
            display: flex;
            flex-direction: column;
            gap: 8px;
        }
        .del-link-label {
            font-size: 0.62rem;
            font-weight: 700;
            color: rgba(255,255,255,0.5);
            text-transform: uppercase;
            letter-spacing: 0.08em;
        }
        .del-link-url {
            font-size: 0.78rem;
            color: #69e9c2;
            word-break: break-all;
            font-weight: 600;
        }
        .btn-del-share {
            background: var(--accent);
            color: #ffffff;
            border: none;
            border-radius: 50px;
            padding: 14px 28px;
            font-family: 'Lexend', sans-serif;
            font-weight: 700;
            font-size: 0.88rem;
            cursor: pointer;
            display: flex;
            align-items: center;
            gap: 8px;
            width: 100%;
            max-width: 340px;
            justify-content: center;
        }
        .btn-del-copy {
            background: rgba(255,255,255,0.1);
            color: rgba(255,255,255,0.8);
            border: 1.5px solid rgba(255,255,255,0.2);
            border-radius: 50px;
            padding: 12px 28px;
            font-family: 'Lexend', sans-serif;
            font-weight: 600;
            font-size: 0.82rem;
            cursor: pointer;
            width: 100%;
            max-width: 340px;
        }
        .btn-del-close {
            background: none;
            color: rgba(255,255,255,0.45);
            border: none;
            font-family: 'Lexend', sans-serif;
            font-size: 0.78rem;
            cursor: pointer;
            margin-top: 4px;
        }

        /* ── Pestaña Mis Pases ── */
        #tab-pases .pase-item {
            background: white;
            border-radius: 16px;
            padding: 14px 16px;
            margin-bottom: 10px;
            text-align: left;
            position: relative;
        }

        .pase-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 6px;
        }

        .pase-tipo {
            font-size: 0.65rem;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 1px;
            color: var(--text-main);
            background: rgba(18, 18, 18, 0.08);
            padding: 3px 8px;
            border-radius: 20px;
        }

        .pase-estado-activo {
            font-size: 0.65rem;
            font-weight: 700;
            color: var(--instruction-green);
        }

        .pase-estado-expirado {
            font-size: 0.65rem;
            font-weight: 700;
            color: var(--text-main);
        }

        .pase-visitante {
            font-size: 0.85rem;
            font-weight: 700;
            color: var(--text-main);
            margin-bottom: 4px;
        }

        .pase-countdown {
            font-size: 0.7rem;
            color: #c0392b;
            font-weight: 600;
        }

        .pase-countdown.safe {
            color: var(--instruction-green);
        }

        .pase-meta {
            font-size: 0.68rem;
            color: var(--text-main);
            margin-top: 4px;
        }

        .pase-actions {
            display: flex;
            gap: 8px;
            margin-top: 10px;
        }

        .btn-pase-share {
            flex: 1;
            padding: 9px;
            border-radius: 50px;
            border: none;
            background: #f3f5f5;
            color: var(--accent);
            font-size: 0.72rem;
            font-weight: 700;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 5px;
        }

        .btn-pase-share svg {
            width: 13px;
            height: 13px;
            fill: var(--accent);
        }

        .btn-pase-share:disabled {
            background: #ddd;
            color: var(--text-main);
            cursor: not-allowed;
        }

        #pases-empty {
            text-align: center;
            padding: 30px 0;
            color: var(--text-muted);
            font-size: 0.8rem;
        }

        /* ── Welcome Screen (tabs de entrada) ── */
        #welcome-screen {
            background: var(--bg-card);
            border-radius: 30px;
            padding: 28px 22px 22px;
            margin-top: 4px;
            width: 100%;
        }

        .welcome-logo {
            display: flex;
            justify-content: center;
            margin-bottom: 22px;
        }

        .welcome-logo img {
            width: 52px;
            opacity: 0.9;
        }

        .welcome-tabs {
            display: flex;
            gap: 4px;
            margin-bottom: 20px;
            background: #f0f2f2;
            padding: 4px;
            border-radius: 14px;
        }

        .welcome-tab-btn {
            flex: 1;
            padding: 11px 6px;
            border-radius: 10px;
            border: none;
            background: transparent;
            color: var(--text-main);
            font-family: 'Lexend', sans-serif;
            font-size: 0.62rem;
            font-weight: 700;
            cursor: pointer;
            text-transform: none;
            letter-spacing: 0;
            transition: background 0.25s, color 0.25s;
        }

        .welcome-tab-btn.active {
            background: var(--accent);
            color: #ffffff;
        }

        .welcome-tab-content {
            display: none;
        }

        .welcome-tab-content.active {
            display: block;
        }

        /* File upload area */
        .file-upload-area {
            border: 2px dashed #d0d7d9;
            border-radius: 16px;
            padding: 18px 14px;
            text-align: center;
            cursor: pointer;
            transition: border-color 0.25s, background 0.25s;
            margin-bottom: 4px;
            position: relative;
        }

        .file-upload-area:hover,
        .file-upload-area.has-file {
            border-color: var(--accent);
            background: rgba(11, 109, 90, 0.04);
        }

        .file-upload-area input[type="file"] {
            position: absolute;
            inset: 0;
            opacity: 0;
            cursor: pointer;
            width: 100%;
            height: 100%;
        }

        .file-upload-icon {
            width: 36px;
            height: 36px;
            background: rgba(11, 109, 90, 0.1);
            border-radius: 10px;
            display: flex;
            align-items: center;
            justify-content: center;
            margin: 0 auto 8px;
        }

        .file-upload-icon svg {
            width: 18px;
            height: 18px;
            fill: var(--accent);
        }

        .file-upload-label {
            font-size: 0.72rem;
            font-weight: 700;
            color: var(--accent);
            display: block;
            margin-bottom: 2px;
        }

        .file-upload-hint {
            font-size: 0.64rem;
            color: var(--text-main);
            opacity: 0.7;
        }

        .file-upload-name {
            font-size: 0.7rem;
            font-weight: 600;
            color: var(--accent);
            margin-top: 8px;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            max-width: 200px;
            margin-left: auto;
            margin-right: auto;
            display: none;
        }

        /* Registration success message */
        #reg-success-msg {
            display: none;
            text-align: center;
            padding: 20px 10px;
        }

        #reg-success-msg .reg-check {
            width: 56px;
            height: 56px;
            background: rgba(11, 109, 90, 0.1);
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            margin: 0 auto 14px;
        }

        #reg-success-msg .reg-check svg {
            width: 26px;
            height: 26px;
            fill: var(--accent);
        }

        #reg-success-msg p {
            font-size: 0.78rem;
            color: var(--text-main);
            margin: 0;
            line-height: 1.5;
        }

        #reg-success-msg strong {
            color: var(--accent);
        }

        /* ── PAGAR RECIBO ── */
        .nav-btn-pago {
            border: 2px solid var(--accent) !important;
            color: var(--accent) !important;
            font-weight: 700;
        }
        .nav-btn-pago.active {
            background: var(--accent) !important;
            color: #fff !important;
        }

        .pago-info-card {
            background: linear-gradient(135deg, #e8f5f1 0%, #f0faf7 100%);
            border: 1.5px solid rgba(11,109,90,0.18);
            border-radius: 18px;
            padding: 16px 18px;
            margin-bottom: 16px;
        }
        .pago-info-row {
            display: flex;
            gap: 12px;
            justify-content: space-around;
        }
        .pago-info-item {
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 4px;
        }
        .pago-info-label {
            font-size: 0.64rem;
            font-weight: 700;
            color: var(--accent);
            text-transform: uppercase;
            letter-spacing: 0.04em;
        }
        .pago-info-valor {
            font-size: 1.1rem;
            font-weight: 700;
            color: var(--text-main);
        }
        .pago-fecha-limite {
            color: #e05c2a;
        }
        .pago-link-anchor {
            display: block;
            text-align: center;
            text-decoration: none;
            color: #fff;
            background: var(--accent);
        }
        .pago-link-anchor:hover {
            background: #175e49;
            color: #fff;
        }

        /* ── MORA BLOQUEO ── */
        #mora-bloqueo-card {
            display: none;
            background: #fff8f2;
            border: 2px solid #e8956a;
            border-radius: 18px;
            padding: 20px 18px;
            text-align: center;
            margin-top: 8px;
        }
        #mora-bloqueo-card svg {
            fill: #e05c2a;
            margin-bottom: 8px;
        }
        #mora-bloqueo-card p {
            font-size: 0.78rem;
            color: #7a3a14;
            margin-bottom: 12px;
            line-height: 1.5;
        }
        .btn-mora-reactivar {
            background: #e05c2a;
            color: #fff;
            border: none;
            border-radius: 50px;
            padding: 13px 20px;
            font-weight: 700;
            font-size: 0.8rem;
            cursor: pointer;
            width: 100%;
            text-transform: uppercase;
            font-family: 'Lexend', sans-serif;
            transition: 0.2s;
        }
        .btn-mora-reactivar:hover {
            background: #bf4c22;
        }

        /* ── REACTIVAR POR MORA ── */
        .wtab-mora {
            color: var(--text-main) !important;
        }
        .wtab-mora.active {
            background: var(--accent) !important;
            color: #fff !important;
        }
        .mora-aviso-card {
            display: flex;
            gap: 10px;
            align-items: flex-start;
            background: #f3f5f5;
            border: 1.5px solid #e2e5e7;
            border-radius: 14px;
            padding: 14px;
            margin-bottom: 16px;
            color: #6c7e87;
        }
        .mora-aviso-card svg {
            flex-shrink: 0;
            fill: #6c7e87;
            margin-top: 2px;
        }
        .mora-aviso-card p {
            font-size: 0.74rem;
            margin: 0;
            color: #6c7e87;
            line-height: 1.5;
        }

        /* ── PAGO OVERLAY ── */
        #pago-overlay {
            display: none;
            position: fixed;
            inset: 0;
            background: rgba(255,255,255,0.96);
            z-index: 9000;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            padding: 30px 20px;
            text-align: center;
        }
        #pago-overlay.show {
            display: flex;
        }

        /* ── Splash Screen ── */
        #splash {
            position: fixed;
            inset: 0;
            background: #e2e5e7;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            z-index: 99999;
            transition: opacity 0.45s ease;
        }
        #splash img {
            width: 140px;
            height: auto;
        }
        #splash.fade-out {
            opacity: 0;
            pointer-events: none;
        }
        .inv-tipo-btn {
            padding: 10px 8px;
            border: 1.5px solid #e2e5e7;
            border-radius: 10px;
            background: #fff;
            font-size: 0.82rem;
            font-weight: 600;
            color: #333c40;
            cursor: pointer;
            transition: border-color 0.15s, background 0.15s;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 6px;
        }
        .inv-tipo-btn svg { flex-shrink: 0; }
        .inv-tipo-btn.selected {
            border-color: var(--accent);
            background: #f0faf7;
            color: var(--accent);
            font-weight: 700;
        }
        /* Overlay de invitación — mismo estilo que delivery */
        #inv-overlay {
            position: fixed;
            inset: 0;
            background: rgba(18, 18, 18, 0.88);
            z-index: 8000;
            display: none;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            padding: 30px;
            text-align: center;
            gap: 14px;
        }
        #inv-overlay.show { display: flex; }
        #inv-overlay .success-title {
            font-size: 1.2rem;
            font-weight: 800;
            color: #ffffff;
            margin-bottom: 2px;
        }
        #inv-overlay .inv-overlay-meta {
            font-size: 0.75rem;
            color: rgba(255,255,255,0.55);
        }
        #inv-overlay .success-sub {
            font-size: 0.82rem;
            color: rgba(255,255,255,0.65);
            line-height: 1.6;
            max-width: 300px;
        }
        .inv-disclaimer-box {
            background: rgba(255,255,255,0.08);
            border: 1.5px solid rgba(255,255,255,0.15);
            border-radius: 10px;
            padding: 12px 14px;
            font-size: 0.74rem;
            color: rgba(255,255,255,0.55);
            line-height: 1.55;
            max-width: 340px;
            text-align: left;
        }
        .inv-dur-btn {
            padding: 8px 14px;
            border: 1.5px solid #e2e5e7;
            border-radius: 20px;
            background: #fff;
            font-size: 0.82rem;
            font-weight: 600;
            color: #333c40;
            cursor: pointer;
            transition: border-color 0.15s, background 0.15s;
        }
        .inv-dur-btn.selected {
            border-color: var(--accent);
            background: #f0faf7;
            color: var(--accent);
            font-weight: 700;
        }
        .inv-card {
            background: #fff;
            border: 1.5px solid #e2e5e7;
            border-radius: 12px;
            padding: 14px 14px 12px;
            margin-bottom: 10px;
        }
        .inv-card-tipo { font-size: 0.72rem; font-weight: 700; color: var(--accent); text-transform: uppercase; margin-bottom: 4px; }
        .inv-card-ref  { font-size: 0.92rem; font-weight: 700; color: #1a2224; margin-bottom: 4px; }
        .inv-card-exp  { font-size: 0.75rem; color: #6c7e87; margin-bottom: 10px; }
        .inv-card-actions { display: flex; gap: 8px; }
        .btn-inv-copy   { flex:1; padding:8px; background:#f0faf7; border:1.5px solid #a7f3d0; border-radius:8px; font-size:0.8rem; font-weight:700; color:var(--accent); cursor:pointer; }
        .btn-inv-share  { flex:1; padding:8px; background:#f0faf7; border:1.5px solid #a7f3d0; border-radius:8px; font-size:0.8rem; font-weight:700; color:var(--accent); cursor:pointer; }
        .btn-inv-revoke { flex:0 0 auto; padding:8px 12px; background:#fff5f5; border:1.5px solid #fecaca; border-radius:8px; font-size:0.8rem; font-weight:700; color:#ef4444; cursor:pointer; }

  /* ── GPS Portones toggles ── */
  #gps-portones-wrap {
    display: none;
    flex-direction: column;
    margin: 20px 16px 4px;
    border-radius: 10px;
    border: 1px solid #d0e8da;
    overflow: hidden;
    background: #f5fbf7;
  }
  #gps-portones-wrap .gps-header {
    background: #f5fbf7;
    padding: 10px 14px 6px;
    font-size: 0.72rem;
    font-weight: 700;
    color: #1f785c;
    letter-spacing: 0.06em;
    border-bottom: 1px solid #d0e8da;
  }
  .gps-porton-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #f5fbf7;
    border-top: 1px solid #e6f4ec;
    padding: 10px 14px;
    gap: 12px;
  }
  .gps-porton-row:first-of-type { border-top: none; }
  .gps-porton-row .gps-porton-label {
    font-size: 0.83rem;
    color: #374c3e;
    flex: 1;
    line-height: 1.35;
  }
  .sw-label { cursor:pointer; display:inline-flex; align-items:center; }
  .sw-label input { display:none; }
  .sw-track {
    width:38px; height:21px; background:#c5d5cb; border-radius:999px;
    position:relative; transition:background 0.2s; flex-shrink:0;
  }
  .sw-label input:checked + .sw-track { background:#1f785c; }
  .sw-track::after {
    content:''; position:absolute; top:2.5px; left:2.5px;
    width:16px; height:16px; border-radius:50%; background:#fff;
    transition:left 0.2s; box-shadow:0 1px 3px rgba(0,0,0,.2);
  }
  .sw-label input:checked + .sw-track::after { left:19.5px; }
  .sw-label { cursor:pointer; display:inline-flex; align-items:center; }
  .sw-label input { display:none; }
  .sw-track {
    width:40px; height:22px; background:#2a3a2e; border-radius:999px;
    position:relative; transition:background 0.2s; flex-shrink:0;
  }
  .sw-label input:checked + .sw-track { background:#1f785c; }
  .sw-track::after {
    content:''; position:absolute; top:3px; left:3px;
    width:16px; height:16px; border-radius:50%; background:#fff;
    transition:left 0.2s; box-shadow:0 1px 3px rgba(0,0,0,.35);
  }
  .sw-label input:checked + .sw-track::after { left:21px; }

        #amigo-fab {
            position: fixed;
            bottom: 24px;
            left: 50%;
            transform: translateX(-50%);
            background: #fff;
            border: 2.5px solid var(--accent);
            border-radius: 50px;
            padding: 11px 22px 11px 16px;
            display: flex;
            align-items: center;
            gap: 8px;
            box-shadow: 0 4px 16px rgba(31,120,92,0.2);
            cursor: pointer;
            z-index: 99999;
            text-decoration: none;
        }
        #amigo-fab:hover { box-shadow: 0 6px 24px rgba(31,120,92,0.35); }
        .amigo-fab-icon { display: flex; align-items: center; }
        .amigo-fab-icon img { width: 18px; height: 18px; }
        .amigo-fab-label {
            font-family: 'Lexend', sans-serif;
            font-size: 0.82rem;
            color: var(--accent);
            font-weight: 600;
            line-height: 1;
            white-space: nowrap;
        }

        #notif-fab {
            position: fixed;
            bottom: 24px;
            left: 24px;
            width: 48px;
            height: 48px;
            border-radius: 50%;
            background: #e4e8ea;
            border: none;
            cursor: pointer;
            display: none;
            align-items: center;
            justify-content: center;
            box-shadow: 0 3px 12px rgba(0,0,0,0.15);
            z-index: 99998;
            transition: background 0.2s, box-shadow 0.2s;
        }
        #notif-fab.has-notif {
            background: #ef4444;
            box-shadow: 0 4px 16px rgba(239,68,68,0.4);
        }
        #notif-fab svg { width: 22px; height: 22px; }
        #notif-fab-count {
            position: absolute;
            top: -4px;
            right: -4px;
            background: #ef4444;
            color: #fff;
            border-radius: 50%;
            min-width: 18px;
            height: 18px;
            font-size: 0.58rem;
            font-weight: 800;
            display: none;
            align-items: center;
            justify-content: center;
            padding: 0 3px;
            border: 2px solid #fff;
            line-height: 1;
        }
        #notif-fab-count.visible { display: inline-flex; }

        /* Toast residente */
        #res-notif-toast {
            position: fixed;
            top: 70px;
            left: 50%;
            transform: translateX(-50%) translateY(-10px);
            background: #1f785c;
            color: #fff;
            border-radius: 14px;
            padding: 13px 18px;
            max-width: 340px;
            width: calc(100% - 32px);
            box-shadow: 0 6px 24px rgba(0,0,0,0.2);
            z-index: 99999;
            opacity: 0;
            transition: opacity 0.3s, transform 0.3s;
            pointer-events: none;
        }
        #res-notif-toast.show {
            opacity: 1;
            transform: translateX(-50%) translateY(0);
            pointer-events: auto;
        }
        #res-notif-toast { cursor: pointer; }
        .res-toast-title { font-weight: 700; font-size: 0.82rem; margin-bottom: 3px; }
        .res-toast-body  { font-size: 0.76rem; opacity: 0.9; }
        .res-toast-cta   { font-size: 0.65rem; opacity: 0.65; margin-top: 5px; text-align: right; }

        @keyframes notif-fab-pulse {
            0%   { transform: scale(1); }
            30%  { transform: scale(1.28); }
            60%  { transform: scale(0.94); }
            100% { transform: scale(1); }
        }
        #notif-fab.pulse { animation: notif-fab-pulse 0.55s ease; }

        /* Sección notificaciones */
        .notif-item {
            background: #fff;
            border: 1.5px solid #e2e8f0;
            border-radius: 14px;
            padding: 14px 16px;
            margin-bottom: 10px;
            cursor: pointer;
            transition: border-color 0.2s;
        }
        .notif-item.unread { border-left: 4px solid var(--accent); }
        .notif-item-title  { font-weight: 700; font-size: 0.82rem; color: var(--text-main); margin-bottom: 4px; }
        .notif-item-body   { font-size: 0.76rem; color: #6c7e87; line-height: 1.5; }
        .notif-item-time   { font-size: 0.68rem; color: #a0adb3; margin-top: 5px; }
        .notif-detail-overlay {
            position: fixed; inset: 0; background: rgba(0,0,0,0.4);
            z-index: 100000; display: flex; align-items: flex-end;
        }
        .notif-detail-sheet {
            background: #fff; border-radius: 22px 22px 0 0;
            padding: 24px 20px 36px; width: 100%; max-height: 80vh; overflow-y: auto;
        }
        .notif-detail-titulo { font-weight: 700; font-size: 1rem; color: var(--text-main); margin-bottom: 10px; }
        .notif-detail-cuerpo { font-size: 0.86rem; color: #4a5568; line-height: 1.7; white-space: pre-wrap; }
        .notif-compose-area  { width: 100%; border: 1.5px solid #e2e8f0; border-radius: 10px; padding: 10px 14px; font-family: var(--font); font-size: 16px; resize: vertical; min-height: 90px; outline: none; }
        .notif-compose-area:focus { border-color: var(--accent); }

        /* ── CHAT THREAD (residente) ── */
        .conv-item { background:#fff; border:1.5px solid #e2e8f0; border-radius:14px; padding:14px 16px; margin-bottom:10px; cursor:pointer; transition:border-color 0.2s; }
        .conv-item:hover { border-color: var(--accent); }
        .conv-item.unread { border-left:4px solid var(--accent); }
        .conv-item-header { display:flex; align-items:center; justify-content:space-between; margin-bottom:5px; }
        .conv-item-title { font-weight:700; font-size:0.82rem; color:var(--text-main); display:flex; align-items:center; gap:6px; }
        .conv-item-time  { font-size:0.68rem; color:#a0adb3; white-space:nowrap; }
        .conv-item-preview { font-size:0.76rem; color:#6c7e87; line-height:1.4; }
        .chat-thread-r { display:flex; flex-direction:column; gap:10px; padding:4px 0 16px; }
        .chat-bw-r { display:flex; flex-direction:column; }
        .chat-bw-r.from-me    { align-items:flex-end; }
        .chat-bw-r.from-admin { align-items:flex-start; }
        .chat-b-r { max-width:78%; padding:7px 11px; border-radius:12px; font-size:0.8rem; line-height:1.4; word-break:break-word; }
        .chat-b-r.from-me    { background:var(--accent); color:#fff; border-bottom-right-radius:3px; }
        .chat-b-r.from-admin { background:#f0f4f5; color:#333c40; border-bottom-left-radius:3px; }
        .chat-b-meta-r { font-size:0.6rem; margin-top:2px; opacity:0.75; }
        .chat-bw-r.from-me    .chat-b-meta-r { text-align:right; color:rgba(255,255,255,0.8); }
        .chat-bw-r.from-admin .chat-b-meta-r { text-align:left; color:#9aa8af; }
        .chat-read-r { font-size:0.58rem; color:#a0adb3; margin-top:2px; text-align:right; }
        .notif-section-label { font-size:0.68rem; font-weight:700; letter-spacing:0.08em; text-transform:uppercase; color:#a0adb3; margin:14px 0 8px; }
