/* MarketBox — Estilos principales */

        /* ============================================
           VARIABLES Y BASE
        ============================================ */
        :root {
            --green: #22c55e;
            --green-dark: #16a34a;
            --green-light: #dcfce7;
            --orange: #f97316;
            --bg: #f3f4f6;
            --white: #ffffff;
            --text: #111827;
            --muted: #6b7280;
            --border: #e5e7eb;
            --radius: 16px;
            --shadow: 0 2px 12px rgba(0,0,0,0.08);
            --shadow-lg: 0 8px 30px rgba(0,0,0,0.12);
        }

        * { box-sizing: border-box; }
        body {
            background: var(--bg);
            font-family: 'Segoe UI', system-ui, sans-serif;
            color: var(--text);
            padding-bottom: 80px;
            -webkit-tap-highlight-color: transparent;
        }

        /* ============================================
           HEADER UNIFICADO (logo + búsqueda + usuario + carrito)
        ============================================ */
        .app-header {
            background: var(--white);
            padding: 0 16px;
            border-bottom: 1px solid var(--border);
            position: sticky;
            top: 0;
            z-index: 1000;
            min-height: 60px;
        }
        .header-inner {
            display: flex;
            align-items: center;
            gap: 10px;
            height: 60px;
        }

        /* Menú hamburguesa — solo móvil */
        .btn-menu {
            background: none; border: none; padding: 4px 8px;
            color: var(--text); cursor: pointer; flex-shrink: 0;
            display: flex; align-items: center;
            border-radius: 8px;
            transition: background 0.15s;
        }
        .btn-menu:hover { background: var(--bg); }
        .btn-menu i { font-size: 1.6rem; }
        /* El botón hamburguesa es visible en TODOS los tamaños */

        /* Logo */
        .header-logo {
            display: flex; align-items: center; gap: 8px;
            flex-shrink: 0; text-decoration: none; color: inherit;
        }
        .header-logo img {
            width: 38px; height: 38px;
            border-radius: 10px; object-fit: cover;
        }
        .header-logo-fallback {
            width: 38px; height: 38px;
            background: var(--green); border-radius: 10px;
            display: none; align-items: center; justify-content: center;
            flex-shrink: 0;
        }
        .header-logo-text h1 {
            margin: 0; font-size: 0.95rem;
            font-weight: 700; line-height: 1.15;
        }
        .header-logo-text p {
            margin: 0; font-size: 0.68rem; color: var(--muted);
        }

        /* Buscador — crece en el espacio disponible */
        .header-search {
            flex: 1;
            background: var(--bg);
            border-radius: 50px;
            padding: 8px 16px;
            display: flex; align-items: center; gap: 8px;
            min-width: 0;
        }
        .header-search i { color: var(--muted); flex-shrink: 0; font-size: 0.9rem; }
        .header-search input {
            border: none; background: transparent;
            outline: none; width: 100%;
            font-size: 0.88rem; color: var(--text);
        }
        .header-search input::placeholder { color: var(--muted); }

        /* En móvil el buscador va a segunda fila */
        @media (max-width: 575px) {
            .app-header { padding: 0 12px 10px; min-height: auto; }
            .header-inner { flex-wrap: wrap; height: auto; padding-top: 10px; gap: 8px; }
            .header-search { order: 10; flex-basis: 100%; margin-top: 2px; }
        }

        /* Nombre de usuario (desktop) */
        .header-username {
            display: none;
            font-size: 0.82rem; font-weight: 600;
            color: var(--text); flex-shrink: 0;
            white-space: nowrap;
        }
        @media (min-width: 768px) { .header-username { display: block; } }

        /* Badge del carrito */
        #cartBadge {
            display: none;
            align-items: center; justify-content: center;
            width: 18px; height: 18px;
            font-size: 0.62rem; font-weight: 700;
        }

        /* Ocultar el searchBar separado — ahora está dentro del header */
        #searchBar { display: none !important; }

        /* ============================================
           CATEGORÍAS — BARRA STICKY HORIZONTAL (todas las pantallas)
        ============================================ */
        .category-scroll {
            display: flex;
            overflow-x: auto;
            gap: 8px;
            padding: 10px 16px;
            scrollbar-width: none;
            background: var(--white);
            border-bottom: 1px solid var(--border);
            position: sticky;
            top: 60px;
            z-index: 190;
            -webkit-overflow-scrolling: touch;
            box-shadow: 0 2px 8px rgba(0,0,0,0.04);
        }
        .category-scroll::-webkit-scrollbar { display: none; }

        /* El de compra rapida no es sticky */
        #quickCategoryFilters {
            position: static;
            top: auto;
            box-shadow: none;
            background: var(--bg);
        }

        .category-btn {
            display: inline-flex;
            align-items: center;
            gap: 6px;
            background: var(--white);
            border: 1.5px solid var(--border);
            border-radius: 50px;
            padding: 6px 16px;
            white-space: nowrap;
            font-size: 0.83rem;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.18s;
            color: var(--text);
            flex-shrink: 0;
        }
        .category-btn.active {
            background: var(--green);
            border-color: var(--green);
            color: white;
            box-shadow: 0 2px 8px rgba(34,197,94,0.3);
        }
        .category-btn:hover:not(.active) { border-color: var(--green); color: var(--green-dark); }

        /* ============================================
           VISTAS
        ============================================ */
        .view-section { display: none; }
        .view-section.active { display: block; }

        /* Desktop: layout con sidebar de categorías */
        .home-layout {
            padding: 12px;
        }
        .products-main { width: 100%; }
        .categories-sidebar { display: none; }

        @media (min-width: 768px) {
            .home-layout {
                max-width: 1280px;
                margin: 0 auto;
                padding: 20px 20px 0;
            }
            /* Sidebar siempre oculta — reemplazada por barra horizontal sticky */
            .categories-sidebar { display: none !important; }
            .products-main { width: 100%; }

            /* Quick buy desktop: centrado con max-width */
            #quick-buy-view .container-fluid { max-width: 960px; margin: 0 auto; }
            #quick-buy-view .category-scroll { max-width: 960px; margin: 0 auto; }
        }

        /* ============================================
           PRODUCTOS — CARDS (Imagen 1)
        ============================================ */
        .section-label {
            font-size: 0.95rem;
            font-weight: 700;
            padding: 0 4px;
            margin-bottom: 10px;
            margin-top: 4px;
        }

        .product-card {
            background: var(--white);
            border-radius: var(--radius);
            overflow: hidden;
            border: 1px solid var(--border);
            cursor: pointer;
            transition: box-shadow 0.2s, transform 0.2s;
        }
        .product-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }

        .product-img-wrap { position: relative; overflow: hidden; }
        .product-img {
            width: 100%;
            height: 160px;
            object-fit: cover;
            display: block;
        }

        /* Badge descuento */
        .badge-discount {
            position: absolute;
            top: 10px; left: 10px;
            background: var(--orange);
            color: white;
            font-size: 0.72rem;
            font-weight: 700;
            padding: 3px 10px;
            border-radius: 50px;
        }

        /* Botón favorito */
        .btn-fav {
            position: absolute;
            top: 8px; right: 8px;
            width: 34px; height: 34px;
            background: rgba(255,255,255,0.88);
            border: none;
            border-radius: 50%;
            display: flex; align-items: center; justify-content: center;
            font-size: 1rem;
            cursor: pointer;
            color: var(--muted);
            box-shadow: 0 1px 6px rgba(0,0,0,0.12);
            transition: all 0.2s;
        }
        .btn-fav:hover, .btn-fav.active { color: #ef4444; }
        .btn-fav.active i { color: #ef4444; }

        .product-body { padding: 10px 12px 12px; }
        .product-name {
            font-size: 0.88rem;
            font-weight: 600;
            margin: 0 0 2px;
            line-height: 1.3;
        }
        .product-desc {
            font-size: 0.75rem;
            color: var(--muted);
            margin: 0 0 8px;
            line-height: 1.3;
            display: -webkit-box;
            -webkit-line-clamp: 1;
            line-clamp: 1;
            -webkit-box-orient: vertical;
            overflow: hidden;
        }
        .product-footer {
            display: flex;
            justify-content: space-between;
            align-items: flex-end;
        }
        .price-old {
            font-size: 0.78rem;
            color: var(--muted);
            text-decoration: line-through;
            line-height: 1;
        }
        .price-new {
            font-size: 1.1rem;
            font-weight: 700;
            color: var(--green);
            line-height: 1.1;
        }
        .price-unit { font-size: 0.72rem; color: var(--muted); }

        /* Botón + en la tarjeta */
        .btn-add {
            width: 36px; height: 36px;
            background: var(--green);
            border: none;
            border-radius: 50%;
            display: flex; align-items: center; justify-content: center;
            color: white;
            font-size: 1.2rem;
            cursor: pointer;
            box-shadow: 0 2px 8px rgba(34,197,94,0.4);
            flex-shrink: 0;
            transition: background 0.2s, transform 0.15s;
        }
        .btn-add:hover { background: var(--green-dark); transform: scale(1.08); }

        /* ============================================
           MENÚ LATERAL — OFFCANVAS (Imagen 2)
        ============================================ */
        /* Offcanvas menu lateral — visible en TODAS las resoluciones */
        #mobileMenu {
            position: fixed;
            top: 0; left: 0;
            height: 100%;
            width: 300px !important;
            z-index: 1055 !important;
            background: white;
            transform: translateX(-100%);
            transition: transform 0.28s ease-in-out, visibility 0.28s !important;
            visibility: hidden;
            overflow-y: auto;
            border-right: none !important;
            box-shadow: 4px 0 24px rgba(0,0,0,0.18) !important;
            /* Anular cualquier comportamiento responsive de Bootstrap */
            display: flex !important;
            flex-direction: column;
        }
        #mobileMenu.show {
            transform: translateX(0) !important;
            visibility: visible !important;
        }
        .offcanvas-backdrop {
            z-index: 1054 !important;
        }

        .side-menu-header {
            background: var(--green);
            padding: 24px 20px;
            color: white;
            position: relative;
        }
        .side-menu-avatar {
            width: 52px; height: 52px;
            background: rgba(255,255,255,0.25);
            border-radius: 50%;
            display: flex; align-items: center; justify-content: center;
            font-size: 1.4rem;
            margin-bottom: 10px;
        }
        .side-menu-name { font-weight: 700; font-size: 1.05rem; margin: 0; }
        .side-menu-city { font-size: 0.82rem; opacity: 0.88; margin: 0; }
        .side-menu-close {
            position: absolute;
            top: 16px; right: 16px;
            background: rgba(255,255,255,0.25);
            border: none;
            border-radius: 50%;
            width: 30px; height: 30px;
            display: flex; align-items: center; justify-content: center;
            color: white;
            cursor: pointer;
        }

        .side-menu-section { padding: 12px 20px 4px; }
        .side-menu-section-title {
            font-size: 0.68rem;
            font-weight: 600;
            text-transform: uppercase;
            letter-spacing: 0.08em;
            color: var(--muted);
            margin: 0 0 6px;
        }
        .side-menu-item {
            display: flex;
            align-items: center;
            gap: 12px;
            padding: 11px 20px;
            color: var(--text);
            text-decoration: none;
            font-size: 0.9rem;
            border-radius: 0;
            transition: background 0.15s;
            cursor: pointer;
        }
        .side-menu-item:hover { background: var(--bg); }
        .side-menu-item i { font-size: 1.1rem; width: 22px; text-align: center; }
        .side-menu-item .icon-home { color: var(--green); }
        .side-menu-item .icon-quick { color: #eab308; }
        .side-menu-item .icon-account { color: #3b82f6; }

        /* ============================================
           COMPRA RÁPIDA (Imagen 3)
        ============================================ */
        .quick-header {
            background: var(--white);
            padding: 16px;
            border-bottom: 1px solid var(--border);
        }

        .quick-group-title {
            font-size: 0.9rem;
            font-weight: 700;
            padding: 14px 16px 8px;
            display: flex;
            align-items: center;
            gap: 6px;
        }
        .quick-group-body {
            background: var(--white);
            border-radius: var(--radius);
            margin: 0 12px 16px;
            overflow: hidden;
            border: 1px solid var(--border);
        }
        /* ─── Compra Rápida — tarjetas ─────────────────── */
        .quick-card {
            border: 1px solid rgba(0,0,0,.06);
            transition: box-shadow .15s, transform .15s;
            max-width: 860px;
        }
        @media (min-width: 992px) {
            .quick-card { margin-left: auto; margin-right: auto; }
            #quickBuyContainer .mb-4 { max-width: 860px; margin-left: auto; margin-right: auto; }
        }
        .quick-card:hover {
            box-shadow: 0 4px 14px rgba(0,0,0,.09) !important;
            transform: translateY(-1px);
        }
        .quick-card img {
            transition: transform .2s;
        }
        .quick-card:hover img { transform: scale(1.04); }

        /* ─── Páginas estáticas ──────────────────────────── */
        #page-view .page-body h2,
        #page-view .page-body h3 { margin-top: 1.4rem; margin-bottom: .6rem; font-weight: 700; }
        #page-view .page-body p  { margin-bottom: .9rem; color: #444; }
        #page-view .page-body ul { padding-left: 1.4rem; margin-bottom: .9rem; }
        #page-view .page-body li { margin-bottom: .4rem; color: #444; }
        #page-view .page-body a  { color: var(--green); }

                /* Barra flotante de total (Imagen 3 abajo) */
        #quickBuyBar {
            display: none;
            position: fixed;
            bottom: 70px; left: 0; right: 0;
            background: var(--white);
            border-top: 1px solid var(--border);
            padding: 12px 16px;
            align-items: center;
            justify-content: space-between;
            z-index: 900;
            box-shadow: 0 -4px 20px rgba(0,0,0,0.08);
        }
        .quick-bar-label { font-size: 0.82rem; color: var(--muted); }
        .quick-bar-total { font-size: 1.15rem; font-weight: 700; color: var(--green); }
        .btn-ver-carrito {
            background: var(--green);
            color: white;
            border: none;
            border-radius: 50px;
            padding: 10px 22px;
            font-weight: 700;
            font-size: 0.9rem;
            cursor: pointer;
            transition: background 0.2s;
        }
        .btn-ver-carrito:hover { background: var(--green-dark); }

        /* ============================================
           CARRITO SIDEBAR (Imagen 4)
        ============================================ */
        .cart-overlay {
            position: fixed; top: 0; left: 0;
            width: 100%; height: 100%;
            background: rgba(0,0,0,0.5);
            z-index: 1990;
            display: none;
        }
        .cart-overlay.show { display: block; }

        .cart-sidebar {
            position: fixed; top: 0; right: -420px;
            width: 100%; max-width: 420px;
            height: 100%;
            background: var(--white);
            z-index: 2000;
            transition: right 0.3s ease;
            display: flex; flex-direction: column;
        }
        .cart-sidebar.open { right: 0; }

        .cart-header {
            padding: 16px 20px;
            border-bottom: 1px solid var(--border);
            display: flex;
            align-items: center;
            gap: 10px;
        }
        .cart-header h5 { margin: 0; font-weight: 700; flex: 1; font-size: 1rem; }

        .cart-body {
            flex: 1;
            overflow-y: auto;
            padding: 0;
            /* Asegura que el scroll funcione en iOS también */
            -webkit-overflow-scrolling: touch;
        }
        /* El div interno de items mantiene su padding */
        #cartItems { padding: 8px 0; }

        .cart-item-row {
            display: flex;
            gap: 14px;
            padding: 14px 20px;
            background: var(--white);
            border-bottom: 1px solid var(--bg);
        }
        .cart-item-img {
            width: 70px; height: 70px;
            border-radius: 12px;
            object-fit: cover;
            flex-shrink: 0;
        }
        .cart-item-details { flex: 1; min-width: 0; }
        .cart-item-name { font-weight: 600; font-size: 0.9rem; margin-bottom: 2px; }
        .cart-item-variant { font-size: 0.78rem; color: var(--muted); margin-bottom: 4px; }
        .cart-item-price { font-weight: 700; color: var(--green); font-size: 0.95rem; margin-bottom: 8px; }

        .cart-qty-controls { display: flex; align-items: center; gap: 6px; }
        .cart-qty-btn {
            width: 30px; height: 30px;
            border: 1.5px solid var(--border);
            border-radius: 8px;
            background: var(--white);
            display: flex; align-items: center; justify-content: center;
            cursor: pointer;
            font-size: 0.85rem;
            color: var(--text);
            transition: all 0.15s;
        }
        .cart-qty-btn:hover { border-color: var(--green); color: var(--green); }
        .cart-qty-val { font-weight: 600; min-width: 20px; text-align: center; font-size: 0.9rem; }
        .cart-delete-btn {
            width: 30px; height: 30px;
            border: none;
            background: #fee2e2;
            border-radius: 8px;
            display: flex; align-items: center; justify-content: center;
            color: #ef4444;
            cursor: pointer;
            font-size: 0.85rem;
            margin-left: 4px;
        }
        .cart-delete-btn:hover { background: #fecaca; }

        #cartFooter {
            padding: 16px 20px;
            border-top: 1px solid var(--border);
            background: var(--white);
        }
        .cart-totals { margin-bottom: 14px; }
        .cart-total-row {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 4px 0;
            font-size: 0.9rem;
        }
        .cart-total-row.grand-total {
            font-size: 1.05rem;
            font-weight: 700;
            padding-top: 10px;
            border-top: 1px solid var(--border);
            margin-top: 6px;
        }
        .cart-total-row.grand-total span:last-child { color: var(--green); }
        .btn-checkout {
            width: 100%;
            background: var(--green);
            color: white;
            border: none;
            border-radius: 50px;
            padding: 14px;
            font-weight: 700;
            font-size: 1rem;
            cursor: pointer;
            display: flex; align-items: center; justify-content: center; gap: 8px;
            transition: background 0.2s;
        }
        .btn-checkout:hover { background: var(--green-dark); }

        /* ============================================
           BOTTOM NAV
        ============================================ */
        .bottom-nav {
            position: fixed; bottom: 0; left: 0; right: 0;
            background: var(--white);
            display: flex;
            padding: 8px 0 10px;
            border-top: 1px solid var(--border);
            z-index: 1050;
        }
        .nav-item-mobile {
            flex: 1;
            text-align: center;
            color: var(--muted);
            text-decoration: none;
            font-size: 0.72rem;
            font-weight: 500;
            transition: color 0.2s;
            cursor: pointer;
            display: flex; flex-direction: column; align-items: center; gap: 2px;
        }
        .nav-item-mobile i { font-size: 1.4rem; display: block; }
        .nav-item-mobile.active { color: var(--green); }

        /* ============================================
           FOOTER
        ============================================ */
        .site-footer {
            background: var(--white);
            padding: 40px 16px 20px;
            border-top: 1px solid var(--border);
            margin-top: 40px;
        }
        .footer-title { font-weight: 700; margin-bottom: 12px; font-size: 0.95rem; }
        .footer-links { list-style: none; padding: 0; margin: 0; }
        .footer-links a {
            text-decoration: none; color: var(--muted);
            font-size: 0.85rem; display: block; margin-bottom: 8px;
        }
        .footer-links a:hover { color: var(--green); }

        /* ============================================
           CUENTA
        ============================================ */
        /* ══════════════════════════════════════════
           CUENTA — AUTH + PERFIL
        ══════════════════════════════════════════ */

        /* ─ Pantalla de login/registro ─ */
        .auth-screen {
            min-height: 60vh;
            display: flex; align-items: center; justify-content: center;
            padding: 24px 16px;
        }
        .auth-box {
            background: white;
            border-radius: 20px;
            box-shadow: 0 8px 32px rgba(0,0,0,0.10);
            width: 100%; max-width: 420px;
            overflow: hidden;
        }
        .auth-box-header {
            background: linear-gradient(135deg, #16a34a, #22c55e);
            padding: 28px 24px 20px;
            text-align: center; color: white;
        }
        .auth-box-header .auth-logo {
            width: 64px; height: 64px;
            border-radius: 16px;
            object-fit: cover;
            display: block;
            margin: 0 auto 10px;
            box-shadow: 0 4px 14px rgba(0,0,0,0.15);
        }
        .auth-box-header h5 { margin:0; font-size:1.2rem; font-weight:800; }
        .auth-box-header p  { margin:4px 0 0; font-size:.85rem; opacity:.88; }

        .auth-tabs {
            display: flex;
            border-bottom: 2px solid var(--border);
        }
        .auth-tab {
            flex: 1; padding: 13px; text-align: center;
            font-weight: 700; font-size: .9rem;
            cursor: pointer; color: var(--muted);
            background: none; border: none;
            border-bottom: 3px solid transparent;
            margin-bottom: -2px;
            transition: all .18s;
        }
        .auth-tab.active { color: var(--green); border-bottom-color: var(--green); }
        .auth-body { padding: 24px; }
        .auth-body .form-control {
            background: var(--bg); border: 1.5px solid var(--bg);
            border-radius: 10px; padding: 11px 14px;
        }
        .auth-body .form-control:focus {
            background: white; border-color: var(--green);
            box-shadow: 0 0 0 3px rgba(34,197,94,.12);
        }
        .auth-body .form-label { font-size:.82rem; font-weight:600; color: var(--text); }
        .auth-submit {
            width: 100%;
            background: linear-gradient(135deg,#16a34a,#22c55e);
            color: white; border: none; border-radius: 50px;
            padding: 13px; font-weight: 700; font-size: 1rem;
            cursor: pointer; margin-top: 4px;
            box-shadow: 0 4px 12px rgba(34,197,94,.3);
            transition: all .2s;
        }
        .auth-submit:hover { transform: translateY(-1px); }
        .auth-submit:disabled { opacity:.6; cursor:not-allowed; transform:none; }

        /* ─ Vista de perfil (logueado) ─ */
        .profile-screen { background: var(--bg); min-height: 60vh; }

        /* Banner superior */
        .profile-banner {
            background: linear-gradient(135deg, #16a34a, #22c55e);
            padding: 24px 20px 60px;
            position: relative;
        }
        .profile-banner-top {
            display: flex; align-items: center; gap: 14px;
        }
        .profile-avatar {
            width: 62px; height: 62px;
            background: rgba(255,255,255,.25);
            border-radius: 50%;
            display: flex; align-items: center; justify-content: center;
            font-size: 1.8rem; flex-shrink: 0;
            border: 3px solid rgba(255,255,255,.5);
        }
        .profile-name  { font-size: 1.1rem; font-weight: 800; color: white; margin:0; }
        .profile-phone { font-size: .82rem; color: rgba(255,255,255,.85); margin:2px 0 0; }
        .profile-doc   { font-size: .78rem; color: rgba(255,255,255,.75); margin:1px 0 0; }
        .profile-logout {
            margin-left: auto;
            background: rgba(255,255,255,.18);
            border: 1.5px solid rgba(255,255,255,.4);
            color: white; border-radius: 50px;
            padding: 6px 14px; font-size: .78rem; font-weight: 600;
            cursor: pointer; flex-shrink:0;
            transition: background .15s;
        }
        .profile-logout:hover { background: rgba(255,255,255,.3); }

        /* Tabs de secciones */
        .profile-tabs-wrap {
            background: white;
            box-shadow: 0 2px 8px rgba(0,0,0,.07);
            position: sticky; top: 60px; z-index: 50;
        }
        .profile-tabs {
            display: flex; overflow-x: auto;
            scrollbar-width: none;
            padding: 0 16px;
        }
        .profile-tabs::-webkit-scrollbar { display:none; }
        .profile-tab {
            flex-shrink: 0;
            padding: 13px 18px;
            font-size: .84rem; font-weight: 700;
            color: var(--muted); cursor: pointer;
            border-bottom: 3px solid transparent;
            background: none; border-top: none;
            border-left: none; border-right: none;
            white-space: nowrap; transition: all .18s;
        }
        .profile-tab.active { color: var(--green); border-bottom-color: var(--green); }
        .profile-tab i { margin-right: 5px; }

        /* Contenido de cada tab */
        .profile-tab-pane { display: none; padding: 20px 16px; }
        .profile-tab-pane.active { display: block; }

        /* Card genérica */
        .pf-card {
            background: white; border-radius: 16px;
            padding: 20px; margin-bottom: 14px;
            box-shadow: 0 1px 6px rgba(0,0,0,.06);
        }
        .pf-card-title {
            font-size: .8rem; font-weight: 700;
            text-transform: uppercase; letter-spacing: .05em;
            color: var(--muted); margin-bottom: 16px;
        }
        .pf-field { margin-bottom: 14px; }
        .pf-field label { font-size:.8rem; font-weight:600; color:var(--muted); display:block; margin-bottom:4px; }
        .pf-field .form-control {
            background: var(--bg); border: 1.5px solid var(--bg);
            border-radius: 10px; padding: 10px 14px; font-size: .9rem;
        }
        .pf-field .form-control:focus {
            background: white; border-color: var(--green);
            box-shadow: 0 0 0 3px rgba(34,197,94,.12);
        }
        .pf-save-btn {
            width: 100%; background: var(--green); color: white;
            border: none; border-radius: 50px; padding: 12px;
            font-weight: 700; cursor: pointer; font-size: .95rem;
            transition: background .2s;
        }
        .pf-save-btn:hover { background: var(--green-dark); }

        /* Dirección guardada */
        .address-item {
            display: flex; gap: 12px; align-items: flex-start;
            padding: 14px 0; border-bottom: 1px solid var(--bg);
        }
        .address-item:last-child { border: none; padding-bottom: 0; }
        .address-icon {
            width: 38px; height: 38px; background: var(--green-light);
            border-radius: 10px; display: flex; align-items: center;
            justify-content: center; font-size: 1.1rem; flex-shrink:0;
        }
        .address-main { font-size: .9rem; font-weight: 600; }
        .address-sub  { font-size: .78rem; color: var(--muted); }
        .btn-add-address {
            display: flex; align-items: center; gap: 8px;
            width: 100%; padding: 12px 16px;
            background: var(--green-light); border: 2px dashed var(--green);
            border-radius: 12px; color: var(--green);
            font-weight: 700; font-size: .88rem; cursor: pointer;
            margin-top: 8px; justify-content: center;
            transition: background .15s;
        }
        .btn-add-address:hover { background: #d1fae5; }

        /* Historial de pedidos */
        .order-history-item {
            background: white; border-radius: 14px;
            padding: 16px; margin-bottom: 12px;
            box-shadow: 0 1px 6px rgba(0,0,0,.06);
            cursor: pointer; transition: box-shadow .18s;
        }
        .order-history-item:hover { box-shadow: 0 4px 14px rgba(0,0,0,.1); }
        .order-history-header {
            display: flex; align-items: center; gap: 10px;
            margin-bottom: 10px;
        }
        .order-history-num {
            font-weight: 800; font-size: .95rem; color: var(--green);
        }
        .order-history-date {
            font-size: .75rem; color: var(--muted); margin-left: auto;
        }
        .order-status-badge {
            font-size: .7rem; font-weight: 700;
            padding: 3px 10px; border-radius: 50px;
            display: inline-flex; align-items: center; gap: 4px;
        }
        .status-pending    { background:#fef9c3; color:#854d0e; }
        .status-confirmed  { background:#dbeafe; color:#1e40af; }
        .status-preparing  { background:#ede9fe; color:#5b21b6; }
        .status-ready      { background:#dcfce7; color:#166534; }
        .status-delivered  { background:#dcfce7; color:#166534; }
        .status-cancelled  { background:#fee2e2; color:#991b1b; }

        .order-history-products {
            font-size: .82rem; color: var(--muted);
            white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
        }
        .order-history-total {
            font-weight: 700; font-size: .95rem;
            color: var(--text); margin-top: 6px;
        }
        .orders-empty {
            text-align: center; padding: 40px 20px; color: var(--muted);
        }
        .orders-empty i { font-size: 3rem; display:block; margin-bottom:12px; opacity:.4; }

        /* Modal detalle de pedido */
        .order-detail-item {
            display: flex; align-items: center; gap: 12px;
            padding: 10px 0; border-bottom: 1px solid var(--bg);
        }
        .order-detail-item:last-child { border: none; }
        .order-detail-img {
            width: 44px; height: 44px; border-radius: 10px;
            object-fit: cover; flex-shrink:0;
        }

        /* Account card legacy */
        .account-card {
            background: var(--white);
            border-radius: var(--radius);
            padding: 20px; margin-bottom: 16px;
            border: 1px solid var(--border);
        }

        /* ============================================
           MODAL PRODUCTO
        ============================================ */
        .quantity-control { display: flex; align-items: center; gap: 10px; }
        .quantity-btn {
            width: 34px; height: 34px;
            border: 1.5px solid var(--border);
            border-radius: 8px;
            background: var(--white);
            display: flex; align-items: center; justify-content: center;
            cursor: pointer;
            font-size: 1rem;
        }
        .price { font-size: 1.3rem; font-weight: 700; color: var(--green); }
        .price-original { text-decoration: line-through; color: var(--muted); font-size: 0.9rem; }


        /* ============================================
           CHECKOUT MODAL
        ============================================ */
        /* ── Checkout: secciones ── */
        .co-section {
            border-bottom: 6px solid var(--bg);
        }
        .co-section:last-child { border-bottom: none; }
        .co-section-title {
            font-weight: 700;
            font-size: 0.88rem;
            color: var(--green-dark);
            padding: 12px 16px 8px;
            background: var(--green-light);
            letter-spacing: 0.02em;
        }
        .co-section-body {
            padding: 14px 16px;
        }

        /* Totales */
        .co-totals { margin-top: 12px; }
        .co-total-row {
            display: flex; justify-content: space-between;
            font-size: 0.88rem; padding: 4px 0;
        }
        .co-total-row.grand {
            font-size: 1.1rem; font-weight: 800;
            border-top: 2px solid var(--border);
            padding-top: 10px; margin-top: 6px;
        }
        .co-total-row.grand span:last-child { color: var(--green); }

        /* Tipo de entrega */
        .delivery-type-row {
            display: grid; grid-template-columns: 1fr 1fr;
            gap: 10px; margin-bottom: 14px;
        }
        .delivery-type-btn {
            border: 2px solid var(--border);
            border-radius: 14px;
            padding: 14px 10px;
            text-align: center;
            cursor: pointer;
            background: white;
            transition: all 0.18s;
        }
        .delivery-type-btn .dt-icon { font-size: 1.8rem; display: block; margin-bottom: 4px; }
        .delivery-type-btn .dt-label { font-weight: 700; display: block; font-size: 0.88rem; }
        .delivery-type-btn .dt-sub { font-size: 0.72rem; color: var(--muted); }
        .delivery-type-btn.active {
            border-color: var(--green);
            background: var(--green-light);
            color: var(--green-dark);
            box-shadow: 0 0 0 2px rgba(34,197,94,0.15);
        }

        /* Info plaza */
        .plaza-info {
            display: flex; align-items: center; gap: 10px;
            background: #eff6ff; border: 1px solid #bfdbfe;
            border-radius: 10px; padding: 12px 14px;
            font-size: 0.85rem;
        }

        /* Resumen items */
        .order-summary-items {
            max-height: 120px; overflow-y: auto;
        }
        .summary-item-row {
            display: flex; align-items: center;
            padding: 7px 0; font-size: 0.84rem;
            border-bottom: 1px solid var(--bg);
            gap: 4px;
        }
        .summary-item-row:last-child { border: none; }
        .summary-item-name { color: var(--text); flex: 1; min-width: 0; }
        .summary-item-qty {
            color: var(--muted); font-size: 0.75rem;
            background: var(--bg); border-radius: 6px;
            padding: 2px 6px; flex-shrink: 0;
        }
        .summary-item-price { font-weight: 700; color: var(--green); flex-shrink: 0; }

        /* Métodos de pago */
        .payment-grid {
            display: grid;
            grid-template-columns: repeat(2, 1fr);
            gap: 10px;
        }
        @media (min-width: 480px) {
            .payment-grid { grid-template-columns: repeat(3, 1fr); }
        }
        .payment-option input[type="radio"] { display: none; }
        .payment-card {
            border: 2px solid var(--border);
            border-radius: 14px;
            padding: 12px 8px 10px;
            text-align: center;
            cursor: pointer;
            transition: all 0.18s;
            background: white;
            height: 100%;
        }
        .payment-option input:checked + .payment-card {
            border-color: var(--green);
            background: var(--green-light);
            box-shadow: 0 0 0 2px rgba(34,197,94,0.15);
        }
        .payment-card:hover { border-color: var(--green); transform: translateY(-1px); }
        .payment-icon {
            font-size: 1.8rem; display: block;
            margin-bottom: 5px; line-height: 1;
        }
        .payment-label { font-size: 0.82rem; font-weight: 700; display: block; line-height: 1.2; }
        .payment-sub { font-size: 0.68rem; color: var(--muted); display: block; margin-top: 2px; }

        /* Info transferencia */
        .transfer-info {
            background: #fefce8;
            border: 1px solid #fde047;
            border-radius: 10px;
            padding: 12px 14px;
            font-size: 0.83rem;
            margin-top: 12px;
            display: none;
            line-height: 1.7;
        }
        .transfer-info.show { display: block; }

        /* Modal checkout — scroll completo del formulario */
        #checkoutModal .modal-dialog {
            margin: 10px auto;
            max-height: calc(100vh - 20px);
        }
        #checkoutModal .modal-content {
            max-height: calc(100vh - 20px);
            overflow-y: auto;
            -webkit-overflow-scrolling: touch;
        }
        /* Quitar max-height del resumen de items — el scroll lo da el modal completo */
        #checkoutModal .order-summary-items {
            max-height: none;
            overflow-y: visible;
        }
        @media (max-width: 575px) {
            #checkoutModal .modal-dialog {
                margin: 0;
                max-width: 100%;
                max-height: 100vh;
            }
            #checkoutModal .modal-content {
                max-height: 100vh;
                border-radius: 0 !important;
                min-height: 100vh;
            }
        }

        /* Botón confirmar */
        .btn-confirm-order {
            flex: 1;
            background: linear-gradient(135deg, #16a34a, #22c55e);
            color: white;
            border: none;
            border-radius: 50px;
            padding: 13px 24px;
            font-size: 1rem;
            font-weight: 700;
            cursor: pointer;
            display: flex; align-items: center; justify-content: center; gap: 8px;
            transition: all 0.2s;
            box-shadow: 0 4px 12px rgba(34,197,94,0.35);
        }
        .btn-confirm-order:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(34,197,94,0.45); }
        .btn-confirm-order:disabled {
            background: var(--muted); cursor: not-allowed;
            transform: none; box-shadow: none; opacity: 0.7;
        }

        /* ══ Pantalla de confirmación de pedido ══ */
        .order-success {
            display: none;
            padding: 0;
            background: var(--bg);
        }
        .success-header {
            background: linear-gradient(135deg, #16a34a, #22c55e);
            color: white;
            text-align: center;
            padding: 28px 20px 24px;
        }
        .success-check-circle {
            width: 64px; height: 64px;
            background: rgba(255,255,255,0.25);
            border-radius: 50%;
            display: flex; align-items: center; justify-content: center;
            margin: 0 auto 14px;
            font-size: 2rem;
            animation: pop 0.4s cubic-bezier(0.175,0.885,0.32,1.275);
        }
        @keyframes pop {
            0%   { transform: scale(0); opacity: 0; }
            100% { transform: scale(1); opacity: 1; }
        }
        .success-title {
            font-size: 1.3rem; font-weight: 800;
            margin: 0 0 6px; color: white;
        }
        .success-order-num {
            font-size: 1rem; font-weight: 700;
            background: rgba(255,255,255,0.2);
            display: inline-block;
            padding: 4px 16px; border-radius: 50px;
            letter-spacing: 0.05em;
        }

        /* Tarjeta blanca con detalles */
        .success-card {
            background: white;
            margin: 16px;
            border-radius: 16px;
            padding: 18px;
            box-shadow: 0 2px 12px rgba(0,0,0,0.07);
        }
        .success-row {
            display: flex; gap: 12px; align-items: flex-start;
            padding: 10px 0;
            border-bottom: 1px solid var(--bg);
        }
        .success-row:last-of-type { border-bottom: none; }
        .success-row-icon {
            font-size: 1.3rem; flex-shrink: 0; margin-top: 1px;
        }
        .success-row-label {
            font-size: 0.72rem; color: var(--muted);
            text-transform: uppercase; letter-spacing: 0.04em;
            font-weight: 600; margin-bottom: 2px;
        }
        .success-row-value {
            font-size: 0.92rem; font-weight: 600; color: var(--text);
        }
        .success-divider {
            border-top: 1px dashed var(--border);
            margin: 12px 0;
        }

        /* Items en confirmación */
        .success-item-row {
            display: flex; align-items: center; gap: 10px;
            padding: 7px 0;
            font-size: 0.85rem;
            border-bottom: 1px solid var(--bg);
        }
        .success-item-row:last-child { border: none; }
        .success-item-img {
            width: 38px; height: 38px;
            border-radius: 8px; object-fit: cover; flex-shrink: 0;
        }
        .success-item-name { flex: 1; font-weight: 600; }
        .success-item-detail { font-size: 0.75rem; color: var(--muted); }
        .success-item-price { font-weight: 700; color: var(--green); white-space: nowrap; }

        /* Totales */
        .success-total-row {
            display: flex; justify-content: space-between;
            font-size: 0.88rem; padding: 3px 0;
        }
        .success-total-row.grand {
            font-size: 1.05rem; font-weight: 800;
            border-top: 2px solid var(--border);
            padding-top: 10px; margin-top: 6px;
        }
        .success-total-row.grand span:last-child { color: var(--green); }

        /* Aviso transferencia */
        .success-transfer-notice {
            background: #fefce8;
            border: 1px solid #fde047;
            border-radius: 12px;
            margin: 0 16px 16px;
            padding: 12px 16px;
            font-size: 0.83rem;
            color: #854d0e;
            display: flex; align-items: flex-start; gap: 6px;
        }

        /* Botón seguir comprando */
        .btn-success-continue {
            display: block;
            width: calc(100% - 32px);
            margin: 0 16px 20px;
            background: linear-gradient(135deg, #16a34a, #22c55e);
            color: white;
            border: none;
            border-radius: 50px;
            padding: 14px;
            font-size: 1rem; font-weight: 700;
            cursor: pointer;
            box-shadow: 0 4px 12px rgba(34,197,94,0.35);
            transition: all 0.2s;
        }
        .btn-success-continue:hover {
            transform: translateY(-1px);
            box-shadow: 0 6px 18px rgba(34,197,94,0.45);
        }
        /* ============================================
           TOAST
        ============================================ */
        #toastContainer { z-index: 3000; }
    
        /* ============================================
           GRID DE PRODUCTOS Y SECCIONES
        ============================================ */
        .products-grid {
            display: grid;
            grid-template-columns: repeat(2, 1fr);
            gap: 12px;
            padding-bottom: 8px;
        }
        @media (min-width: 576px)  { .products-grid { grid-template-columns: repeat(3, 1fr); } }
        @media (min-width: 992px)  { .products-grid { grid-template-columns: repeat(4, 1fr); gap: 16px; } }
        @media (min-width: 1200px) { .products-grid { grid-template-columns: repeat(5, 1fr); } }

        .products-scroll {
            display: flex;
            overflow-x: auto;
            gap: 12px;
            padding-bottom: 10px;
            scrollbar-width: none;
        }
        .products-scroll::-webkit-scrollbar { display: none; }
        .products-scroll .product-card {
            min-width: 150px;
            max-width: 170px;
            flex-shrink: 0;
        }

        .section-title {
            font-size: 1rem;
            font-weight: 700;
            margin: 16px 0 10px;
            display: flex;
            align-items: center;
            gap: 6px;
        }

        /* Aliases de clases usadas en renderProductCard */
        .discount-badge {
            position: absolute;
            top: 10px; left: 10px;
            background: var(--orange);
            color: white;
            font-size: 0.72rem;
            font-weight: 700;
            padding: 3px 10px;
            border-radius: 50px;
        }
        .fav-btn {
            position: absolute;
            top: 8px; right: 8px;
            width: 34px; height: 34px;
            background: rgba(255,255,255,0.88);
            border: none; border-radius: 50%;
            display: flex; align-items: center; justify-content: center;
            font-size: 1rem; cursor: pointer;
            color: var(--muted);
            box-shadow: 0 1px 6px rgba(0,0,0,0.12);
            transition: all 0.2s;
        }
        .fav-btn:hover, .fav-btn.active { color: #ef4444; }
        .fav-btn.active i { color: #ef4444; }

        .product-info { padding: 10px 12px 12px; }
        .product-name {
            font-size: 0.88rem; font-weight: 600;
            line-height: 1.3; margin-bottom: 6px;
            display: -webkit-box; -webkit-line-clamp: 2;
            line-clamp: 2;
            -webkit-box-orient: vertical; overflow: hidden;
        }
        .product-price-row { display: flex; align-items: baseline; gap: 6px; margin-bottom: 2px; }
        .product-price { font-size: 1rem; font-weight: 700; color: var(--green); }
        .product-price-old { font-size: 0.78rem; color: var(--muted); text-decoration: line-through; }
        .product-variant-label { font-size: 0.72rem; color: var(--muted); }

        .product-add-btn {
            position: absolute;
            bottom: 10px; right: 10px;
            width: 32px; height: 32px;
            background: var(--green);
            color: white; border: none; border-radius: 50%;
            display: flex; align-items: center; justify-content: center;
            font-size: 1rem; cursor: pointer;
            box-shadow: 0 2px 8px rgba(34,197,94,0.4);
            transition: all 0.2s;
        }
        .product-add-btn:hover { background: var(--green-dark); transform: scale(1.1); }

        /* Necesario para que el botón + esté posicionado */
        .product-card { position: relative; }
        /* ============================================
           VARIANTES EN TARJETA — CHIPS CLICABLES
        ============================================ */
        .product-variants {
            display: flex;
            flex-wrap: wrap;
            gap: 4px;
            padding: 0 10px 10px;
        }
        .variant-chip {
            display: inline-flex;
            align-items: center;
            padding: 3px 9px;
            border: 1.5px solid var(--border);
            border-radius: 50px;
            font-size: 0.7rem;
            font-weight: 600;
            color: var(--text);
            background: var(--white);
            cursor: pointer;
            transition: all 0.15s;
            white-space: nowrap;
            line-height: 1.3;
        }
        .variant-chip:hover {
            border-color: var(--green);
            color: var(--green-dark);
            background: var(--green-light);
        }
        .variant-chip.selected {
            background: var(--green);
            border-color: var(--green);
            color: white;
        }
        .variant-chip-price {
            font-weight: 700;
            margin-left: 3px;
            opacity: 0.85;
        }

        /* ── Improved product card ─────────────────── */
        .product-card {
            background: var(--white);
            border-radius: var(--radius);
            overflow: hidden;
            border: 1px solid var(--border);
            cursor: pointer;
            transition: box-shadow 0.2s, transform 0.2s;
            display: flex;
            flex-direction: column;
        }
        .product-card:hover {
            box-shadow: var(--shadow-lg);
            transform: translateY(-3px);
        }

        .product-img-wrap {
            position: relative;
            overflow: hidden;
            background: #f9fafb;
        }
        .product-img {
            width: 100%;
            height: 150px;
            object-fit: cover;
            display: block;
            transition: transform 0.3s;
        }
        .product-card:hover .product-img { transform: scale(1.04); }

        /* Price display in card info */
        .product-info {
            padding: 10px 10px 4px;
            flex: 1;
        }
        .product-cat-label {
            font-size: 0.62rem;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.07em;
            color: var(--green-dark);
            opacity: 0.7;
            margin-bottom: 3px;
        }
        .product-name {
            font-size: 0.875rem;
            font-weight: 600;
            line-height: 1.3;
            margin-bottom: 5px;
            display: -webkit-box;
            -webkit-line-clamp: 2;
            line-clamp: 2;
            -webkit-box-orient: vertical;
            overflow: hidden;
            color: var(--text);
        }
        .product-price-row {
            display: flex;
            align-items: baseline;
            gap: 6px;
            margin-bottom: 2px;
        }
        .product-price {
            font-size: 1rem;
            font-weight: 700;
            color: var(--green-dark);
        }
        .product-price-old {
            font-size: 0.75rem;
            color: var(--muted);
            text-decoration: line-through;
        }
        .product-variant-label {
            font-size: 0.7rem;
            color: var(--muted);
            margin-bottom: 2px;
        }

        /* + button repositioned to top-right of info */
        .product-add-btn {
            position: absolute;
            bottom: 10px;
            right: 10px;
            width: 32px; height: 32px;
            background: var(--green);
            color: white;
            border: none;
            border-radius: 50%;
            display: flex; align-items: center; justify-content: center;
            font-size: 1rem;
            cursor: pointer;
            box-shadow: 0 2px 8px rgba(34,197,94,0.4);
            transition: all 0.2s;
            z-index: 2;
        }
        .product-add-btn:hover { background: var(--green-dark); transform: scale(1.12); }

        /* Discount badge */
        .discount-badge {
            position: absolute;
            top: 8px; left: 8px;
            background: #f97316;
            color: white;
            font-size: 0.7rem;
            font-weight: 700;
            padding: 2px 9px;
            border-radius: 50px;
            z-index: 2;
        }

        /* Fav button */
        .fav-btn {
            position: absolute;
            top: 8px; right: 8px;
            width: 32px; height: 32px;
            background: rgba(255,255,255,0.9);
            border: none; border-radius: 50%;
            display: flex; align-items: center; justify-content: center;
            font-size: 0.95rem;
            cursor: pointer;
            color: var(--muted);
            box-shadow: 0 1px 6px rgba(0,0,0,0.12);
            transition: all 0.2s;
            z-index: 2;
        }
        .fav-btn:hover, .fav-btn.active { color: #ef4444; }
        .fav-btn.active i { color: #ef4444; }

        /* Section titles */
        .section-title {
            font-size: 1.05rem;
            font-weight: 700;
            margin: 16px 0 10px;
            display: flex;
            align-items: center;
            gap: 6px;
            color: var(--text);
        }

        /* Destacados scroll */
        .products-scroll {
            display: flex;
            overflow-x: auto;
            gap: 12px;
            padding-bottom: 10px;
            scrollbar-width: none;
        }
        .products-scroll::-webkit-scrollbar { display: none; }
        .products-scroll .product-card {
            min-width: 158px;
            max-width: 175px;
            flex-shrink: 0;
        }

        /* Grid normal */
        .products-grid {
            display: grid;
            grid-template-columns: repeat(2, 1fr);
            gap: 12px;
            padding-bottom: 8px;
        }
        @media (min-width: 576px)  { .products-grid { grid-template-columns: repeat(3, 1fr); } }
        @media (min-width: 992px)  { .products-grid { grid-template-columns: repeat(4, 1fr); gap: 16px; } }
        @media (min-width: 1200px) { .products-grid { grid-template-columns: repeat(5, 1fr); } }

        /* ════════════════════════════════════════════
           CUENTA — PERFIL PROFESIONAL v2
        ════════════════════════════════════════════ */

        /* ── Estadísticas rápidas del header ─────── */
        #profileStats {
            display: flex;
            align-items: center;
            gap: 0;
            margin-top: 12px;
            background: var(--bg);
            border-radius: 12px;
            padding: 10px 0;
            overflow: hidden;
        }
        .profile-stat {
            flex: 1;
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 2px;
        }
        .profile-stat-val {
            font-size: 1.15rem;
            font-weight: 800;
            color: var(--green-dark);
            line-height: 1;
        }
        .profile-stat-lbl {
            font-size: 0.68rem;
            color: var(--muted);
            font-weight: 500;
            text-transform: uppercase;
            letter-spacing: .04em;
        }
        .profile-stat-divider {
            width: 1px;
            height: 32px;
            background: var(--border);
        }

        /* ── Tabs de perfil ──────────────────────── */
        .profile-tabs {
            display: flex;
            gap: 0;
            background: var(--bg);
            border-radius: 12px;
            padding: 4px;
            margin-bottom: 20px;
        }
        .profile-tab {
            flex: 1;
            border: none;
            background: transparent;
            border-radius: 9px;
            padding: 9px 8px;
            font-size: .83rem;
            font-weight: 600;
            color: var(--muted);
            cursor: pointer;
            transition: all .18s;
        }
        .profile-tab.active {
            background: var(--white);
            color: var(--green-dark);
            box-shadow: 0 1px 6px rgba(0,0,0,.08);
        }

        /* ── Tarjetas de dirección ───────────────── */
        .address-card {
            display: flex;
            align-items: flex-start;
            gap: 12px;
            background: var(--white);
            border: 1.5px solid var(--border);
            border-radius: 14px;
            padding: 14px 16px;
            margin-bottom: 10px;
            transition: all .18s;
        }
        .address-card:hover { box-shadow: var(--shadow); }
        .address-card--primary {
            border-color: var(--green);
            background: linear-gradient(135deg, #f0fdf4 0%, #ffffff 100%);
        }
        .address-card-icon {
            font-size: 1.4rem;
            flex-shrink: 0;
            margin-top: 1px;
        }
        .address-card-body { flex: 1; min-width: 0; }
        .address-card-top {
            display: flex;
            align-items: center;
            gap: 8px;
            flex-wrap: wrap;
            margin-bottom: 3px;
        }
        .address-badge-primary {
            background: var(--green);
            color: white;
            font-size: .65rem;
            font-weight: 700;
            padding: 2px 8px;
            border-radius: 50px;
            text-transform: uppercase;
            letter-spacing: .04em;
        }
        .address-card-name {
            font-size: .9rem;
            font-weight: 600;
            color: var(--text);
        }
        .address-card-sub {
            font-size: .78rem;
            color: var(--muted);
        }
        .address-card-actions {
            display: flex;
            gap: 4px;
            flex-shrink: 0;
        }
        .addr-btn {
            width: 32px; height: 32px;
            border-radius: 8px;
            border: 1.5px solid var(--border);
            background: var(--white);
            display: flex; align-items: center; justify-content: center;
            font-size: .82rem;
            cursor: pointer;
            transition: all .15s;
            color: var(--muted);
        }
        .addr-btn--ghost:hover { border-color: var(--green); color: var(--green-dark); }
        .addr-btn--danger:hover { border-color: #fecaca; background: #fee2e2; color: #ef4444; }

        /* Estado vacío de direcciones */
        #noAddressesMsg {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            gap: 6px;
            padding: 32px 16px;
            color: var(--muted);
            font-size: .88rem;
            text-align: center;
        }

        /* Formulario agregar dirección */
        #addAddressForm {
            display: none;
            background: var(--bg);
            border-radius: 14px;
            padding: 16px;
            margin-top: 12px;
            border: 1.5px dashed var(--border);
        }
        #addAddressTitle {
            font-weight: 700;
            font-size: .9rem;
            margin-bottom: 12px;
            color: var(--text);
        }

        /* ── Historial de pedidos ─────────────────── */
        .order-history-card {
            background: var(--white);
            border: 1.5px solid var(--border);
            border-radius: 14px;
            padding: 14px 16px;
            margin-bottom: 12px;
            cursor: pointer;
            transition: all .18s;
        }
        .order-history-card:hover {
            box-shadow: var(--shadow);
            border-color: var(--green-light);
            transform: translateY(-1px);
        }
        .order-history-card-header {
            display: flex;
            justify-content: space-between;
            align-items: flex-start;
            margin-bottom: 10px;
        }
        .order-history-num {
            display: block;
            font-weight: 700;
            font-size: .9rem;
            color: var(--text);
        }
        .order-history-date {
            display: block;
            font-size: .72rem;
            color: var(--muted);
            margin-top: 2px;
        }

        /* Timeline de progreso */
        .order-progress {
            display: flex;
            align-items: center;
            margin: 8px 0 12px;
            overflow: hidden;
        }
        .order-progress-step {
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 4px;
            flex-shrink: 0;
        }
        .order-progress-dot {
            width: 10px; height: 10px;
            border-radius: 50%;
            background: var(--border);
            border: 2px solid var(--border);
            transition: all .2s;
        }
        .order-progress-step.done .order-progress-dot {
            background: var(--green);
            border-color: var(--green);
        }
        .order-progress-step.current .order-progress-dot {
            background: var(--white);
            border-color: var(--green);
            box-shadow: 0 0 0 3px rgba(34,197,94,.2);
        }
        .order-progress-lbl {
            font-size: .58rem;
            color: var(--muted);
            white-space: nowrap;
            font-weight: 500;
        }
        .order-progress-step.done .order-progress-lbl,
        .order-progress-step.current .order-progress-lbl { color: var(--green-dark); font-weight: 700; }
        .order-progress-line {
            flex: 1;
            height: 2px;
            background: var(--border);
            margin: 0 3px;
            margin-bottom: 16px;
            transition: background .2s;
        }
        .order-progress-line.done { background: var(--green); }

        .order-history-card-body {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 8px;
        }
        .order-history-items {
            font-size: .82rem;
            color: var(--text);
            flex: 1;
            min-width: 0;
            overflow: hidden;
            white-space: nowrap;
            text-overflow: ellipsis;
            margin-right: 8px;
        }
        .order-history-total {
            font-size: .95rem;
            font-weight: 700;
            color: var(--green-dark);
            flex-shrink: 0;
        }
        .order-history-card-footer {
            display: flex;
            justify-content: space-between;
            align-items: center;
        }
        .order-see-detail {
            font-size: .75rem;
            font-weight: 600;
            color: var(--green-dark);
        }

        /* Estado vacío de pedidos */
        .orders-empty {
            text-align: center;
            padding: 40px 20px;
            color: var(--muted);
        }
        .orders-empty-icon {
            font-size: 3rem;
            margin-bottom: 12px;
        }

        /* Badges de estado (globales) */
        .order-status-badge {
            display: inline-flex;
            align-items: center;
            gap: 4px;
            padding: 4px 10px;
            border-radius: 50px;
            font-size: .72rem;
            font-weight: 700;
            white-space: nowrap;
        }
        .status-pending   { background: #fef3c7; color: #92400e; }
        .status-confirmed { background: #d1fae5; color: #065f46; }
        .status-preparing { background: #dbeafe; color: #1e40af; }
        .status-ready     { background: #ede9fe; color: #5b21b6; }
        .status-delivered { background: #d1fae5; color: #065f46; }
        .status-cancelled { background: #fee2e2; color: #991b1b; }

        /* Detail items */
        .order-detail-item {
            display: flex;
            align-items: center;
            gap: 12px;
            padding: 10px 0;
            border-bottom: 1px solid var(--bg);
        }
        .order-detail-item:last-child { border: none; }
        .order-detail-img {
            width: 48px; height: 48px;
            border-radius: 10px;
            object-fit: cover;
            flex-shrink: 0;
            background: var(--bg);
        }
/* ═══════════════════════════════════════════════════════════════
   FORMULARIO DE DIRECCIÓN ESTRUCTURADA — MarketBox Pasto
   Prefijo: .co-
═══════════════════════════════════════════════════════════════ */

.co-section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: .9rem;
    color: var(--text);
    margin-top: 4px;
}

.co-step-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--green);
    color: white;
    font-size: .7rem;
    font-weight: 700;
    flex-shrink: 0;
}

.co-input {
    background: var(--bg) !important;
    border: 1.5px solid var(--border) !important;
    border-radius: 10px !important;
    padding: 9px 12px !important;
    font-size: .875rem !important;
    transition: border-color .2s, box-shadow .2s;
}
.co-input:focus {
    border-color: var(--green) !important;
    box-shadow: 0 0 0 3px rgba(34,197,94,.12) !important;
    background: white !important;
    outline: none;
}
.co-input.is-invalid { border-color: #ef4444 !important; box-shadow: none !important; }
.co-input.is-valid   { border-color: var(--green) !important; }

.co-select {
    appearance: none !important;
    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") !important;
    background-repeat: no-repeat !important;
    background-position: right 10px center !important;
    padding-right: 28px !important;
}

.co-letter {
    text-transform: uppercase;
    text-align: center;
    font-weight: 600;
    letter-spacing: .05em;
}

.co-hash {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--green-dark);
    line-height: 1;
    padding-bottom: 4px;
    padding-left: 6px;
}

.co-complement-type {
    max-width: 130px !important;
    flex: none !important;
    border-radius: 10px 0 0 10px !important;
    border-right: none !important;
}
.co-complement-type + .co-input {
    border-radius: 0 10px 10px 0 !important;
}

.co-input-prefix {
    background: var(--bg) !important;
    border: 1.5px solid var(--border) !important;
    border-right: none !important;
    border-radius: 10px 0 0 10px !important;
    font-size: .8rem;
    color: var(--muted);
    padding: 9px 10px !important;
    line-height: 1.5;
}
.co-input-prefix + .co-input {
    border-radius: 0 10px 10px 0 !important;
}

.co-addr-preview {
    background: linear-gradient(135deg, #dcfce7 0%, #f0fdf4 100%);
    border: 1.5px solid #86efac;
    border-radius: 10px;
    padding: 9px 14px;
    font-size: .82rem;
    font-weight: 600;
    color: var(--green-dark);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
    animation: coFadeIn .25s ease;
}
.co-addr-preview.d-none { display: none !important; }

@keyframes coFadeIn {
    from { opacity:0; transform:translateY(-4px); }
    to   { opacity:1; transform:translateY(0); }
}

.co-geo-btn {
    background: #f0fdf4;
    border: 1.5px dashed #86efac;
    color: var(--green-dark);
    font-size: .85rem;
    font-weight: 600;
    padding: 9px 14px;
    border-radius: 10px;
    transition: all .2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    cursor: pointer;
}
.co-geo-btn:hover   { background: #dcfce7; border-style: solid; color: var(--green-dark); }
.co-geo-btn:disabled { opacity: .6; cursor: not-allowed; }

.co-geo-status {
    font-size: .8rem;
    padding: 7px 12px;
    border-radius: 8px;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.co-geo-status.success { background: #dcfce7; color: var(--green-dark); }
.co-geo-status.error   { background: #fef2f2; color: #dc2626; }
.co-geo-status.loading { background: #f0fdf4; color: var(--green-dark); }

.co-textarea {
    resize: vertical;
    min-height: 58px;
}

.co-hint {
    color: var(--muted);
    font-size: .76rem;
    margin-top: 3px;
}

.co-optional {
    font-size: .68rem;
    font-weight: 400;
    color: var(--muted);
    background: var(--bg);
    padding: 1px 7px;
    border-radius: 8px;
    margin-left: 6px;
    vertical-align: middle;
}

.co-guest-tip {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 10px;
    padding: 8px 12px;
    font-size: .78rem;
    color: var(--green-dark);
    margin-top: 4px;
}

.co-addr-card {
    background: white;
    border: 1.5px solid var(--border);
    border-radius: 14px;
    padding: 16px;
}

@media (max-width: 480px) {
    .co-complement-type { max-width: 100px !important; }
    .co-section-title   { font-size: .82rem; }
    .co-hash            { font-size: 1.1rem; }
}

/* ═══════════════════════════════════════════════════════════════
   MÉTODOS DE PAGO — MarketBox
═══════════════════════════════════════════════════════════════ */

/* Opción de método de pago */
.pm-option {
    transition: border-color .2s, box-shadow .2s;
}
.pm-option:has(input:checked) {
    border-color: var(--green) !important;
    box-shadow: 0 0 0 2px rgba(34,197,94,.15) !important;
    background: #f0fdf4;
}
.pm-option.pm-disabled {
    background: #f9fafb !important;
}

/* Panel de info de pago — animación de entrada */
.pm-info-panel {
    animation: coFadeIn .2s ease;
}