/* ============================================
   MercaGo - Hoja de estilos responsive
   Paleta: teal oscuro (#0f5e5e) + blanco
   ============================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #0f5e5e;
    --primary-light: #1a8f8f;
    --primary-dark: #0a3f3f;
    --accent: #ff7a00;
    --bg: #f5f7f9;
    --white: #ffffff;
    --text: #1a1a1a;
    --text-light: #6b7280;
    --border: #e5e7eb;
    --radius: 14px;
    --shadow: 0 2px 8px rgba(0,0,0,0.06);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
}

html, body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

body {
    min-height: 100vh;
    padding-bottom: 70px; /* espacio para bottom-nav en movil */
}

img { max-width: 100%; display: block; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
a { text-decoration: none; color: inherit; }

/* ================= HEADER ================= */
.header {
    background: var(--white);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
}

.header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    max-width: 1280px;
    margin: 0 auto;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 22px;
    font-weight: 500;
    color: var(--primary);
}
.logo strong { font-weight: 800; color: var(--primary-light); }

.icon-btn {
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    border-radius: 50%;
    transition: background .2s;
    position: relative;
}
.icon-btn:hover { background: rgba(15,94,94,0.08); }

.cart-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    background: var(--accent);
    color: white;
    font-size: 11px;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

.search-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg);
    border-radius: 12px;
    padding: 10px 14px;
    margin: 0 16px 12px;
    max-width: 600px;
}
.search-bar input {
    border: none;
    background: transparent;
    outline: none;
    flex: 1;
    font-size: 15px;
    font-family: inherit;
}

/* ---------- SEARCH WRAPPER (autocompletado) ---------- */
.search-wrapper {
    position: relative;
    max-width: 600px;
    margin: 0 16px 12px;
}
@media (min-width: 768px) {
    .search-wrapper { margin: 0 24px 16px; max-width: 720px; margin-left: auto; margin-right: auto; }
}

.search-wrapper .search-bar {
    margin: 0;
}

.search-clear {
    background: transparent;
    border: none;
    color: var(--text-light);
    font-size: 22px;
    cursor: pointer;
    width: 24px;
    height: 24px;
    display: none;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    line-height: 1;
    padding: 0;
}
.search-clear:hover { background: rgba(0,0,0,0.08); color: var(--text); }
.search-clear.visible { display: flex; }

/* Dropdown */
.search-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--white);
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.18);
    border: 1px solid var(--border);
    max-height: 420px;
    overflow-y: auto;
    z-index: 200;
    display: none;
    animation: dropdownFade .15s ease;
}
.search-dropdown.open { display: block; }

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

.search-dropdown-loading,
.search-dropdown-empty {
    padding: 18px;
    text-align: center;
    color: var(--text-light);
    font-size: 14px;
}

.search-dropdown-list {
    display: flex;
    flex-direction: column;
}

.search-result-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    transition: background .12s;
    text-align: left;
    background: var(--white);
    border-left: 3px solid transparent;
    width: 100%;
}
.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover,
.search-result-item.active {
    background: #f0f9f9;
    border-left-color: var(--primary);
}
.search-result-thumb {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    object-fit: cover;
    background: #e5e7eb;
    flex-shrink: 0;
}
.search-result-thumb-placeholder {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 700;
    flex-shrink: 0;
}
.search-result-info {
    flex: 1;
    min-width: 0;
}
.search-result-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.search-result-name mark {
    background: #fef3c7;
    color: var(--text);
    padding: 0 2px;
    border-radius: 2px;
}
.search-result-meta {
    font-size: 12px;
    color: var(--text-light);
    margin-top: 2px;
}
.search-result-price {
    font-size: 14px;
    font-weight: 700;
    color: var(--primary);
    flex-shrink: 0;
}
.search-result-discount {
    font-size: 11px;
    color: var(--accent);
    font-weight: 600;
    margin-left: 4px;
}
.search-result-original-price {
    font-size: 11px;
    color: var(--text-light);
    text-decoration: line-through;
    margin-left: 4px;
}

/* ---------- MODAL DETALLE DE PRODUCTO ---------- */
.product-detail {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
    padding: 24px;
}
@media (min-width: 640px) {
    .product-detail { grid-template-columns: 1fr 1fr; }
}

.product-detail-image {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 14px;
    overflow: hidden;
    background: #f0f2f5;
    display: flex;
    align-items: center;
    justify-content: center;
}
.product-detail-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.product-detail-image-placeholder {
    font-size: 48px;
    font-weight: 800;
    color: var(--white);
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.product-detail-info {
    display: flex;
    flex-direction: column;
}
.product-detail-category {
    font-size: 12px;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}
.product-detail-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 12px;
    line-height: 1.3;
}
.product-detail-rating {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 16px;
    font-size: 14px;
    color: var(--text-light);
}
.rating-stars {
    color: #fbbf24;
    font-size: 16px;
    letter-spacing: 1px;
}
.product-detail-price-row {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.product-detail-price {
    font-size: 28px;
    font-weight: 800;
    color: var(--primary);
}
.product-detail-original-price {
    font-size: 16px;
    color: var(--text-light);
    text-decoration: line-through;
}
.product-detail-discount-badge {
    background: var(--accent);
    color: var(--white);
    font-size: 12px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 6px;
}
.product-detail-description {
    font-size: 14px;
    color: var(--text);
    line-height: 1.6;
    margin-bottom: 20px;
    padding: 14px;
    background: var(--bg);
    border-radius: 10px;
}
.product-detail-actions {
    margin-top: auto;
    display: flex;
    gap: 10px;
}
.product-detail-actions .btn-primary {
    flex: 1;
}

/* ================= MAIN ================= */
.main-content {
    max-width: 1280px;
    margin: 0 auto;
    padding: 16px;
}

.section {
    margin-bottom: 28px;
}

.section-title {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 14px;
    color: var(--text);
}

/* ================= HERO BANNER ================= */
.hero-banner {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    border-radius: 20px;
    padding: 28px 24px;
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 28px;
    overflow: hidden;
    position: relative;
}
.hero-text { flex: 1; z-index: 2; }
.hero-text h1 {
    font-size: 24px;
    font-weight: 800;
    margin-bottom: 8px;
    line-height: 1.25;
}
.hero-text p {
    opacity: 0.92;
    margin-bottom: 16px;
    font-size: 14px;
}
.hero-image {
    opacity: 0.85;
    flex-shrink: 0;
}

.btn-primary {
    background: var(--accent);
    color: var(--white);
    padding: 12px 22px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 14px;
    transition: transform .15s, box-shadow .15s;
}
.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(255,122,0,0.35);
}
.btn-block { width: 100%; }

/* ================= CATEGORIES ================= */
/* Scroll horizontal deslizable: las categorias se muestran en fila
   y se deslizan de izquierda a derecha cuando no caben todas */
.categories-grid {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 10px;
    margin-bottom: 6px;
    scrollbar-width: thin;
    scrollbar-color: var(--primary-light) var(--bg);
    /* Ocultar scrollbar en movil para mejor apariencia, visible en desktop */
    scroll-snap-type: x mandatory;
}
/* Estilo del scrollbar en navegadores webkit (Chrome, Safari, Edge) */
.categories-grid::-webkit-scrollbar {
    height: 6px;
}
.categories-grid::-webkit-scrollbar-track {
    background: var(--bg);
    border-radius: 3px;
}
.categories-grid::-webkit-scrollbar-thumb {
    background: var(--primary-light);
    border-radius: 3px;
}
.categories-grid::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

.category-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 14px 8px;
    text-align: center;
    cursor: pointer;
    transition: transform .15s, box-shadow .15s;
    box-shadow: var(--shadow);
    /* Tamano fijo para que todas las tarjetas sean iguales y se deslicen horizontalmente */
    flex: 0 0 auto;
    width: 80px;
    min-width: 80px;
    scroll-snap-align: start;
}
.category-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* Contenedor del carrusel de categorias con flechas de navegacion */
.categories-carousel-wrapper {
    position: relative;
}
.categories-carousel-wrapper .categories-grid {
    scroll-snap-type: x mandatory;
}
/* Flechas de navegacion (solo visibles en desktop) */
.category-nav-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--white);
    border: 1px solid var(--border);
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    display: none; /* Ocultas por defecto, visibles en desktop */
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 5;
    color: var(--primary);
    transition: background .15s, transform .15s;
}
.category-nav-arrow:hover {
    background: var(--primary);
    color: var(--white);
    transform: translateY(-50%) scale(1.1);
}
.category-nav-arrow.left {
    left: -8px;
}
.category-nav-arrow.right {
    right: -8px;
}
@media (min-width: 768px) {
    .category-nav-arrow {
        display: flex;
    }
}
/* Indicador "Desliza" para movil */
.categories-swipe-hint {
    text-align: right;
    font-size: 11px;
    color: var(--text-light);
    margin-bottom: 4px;
    font-style: italic;
}
@media (min-width: 768px) {
    .categories-swipe-hint { display: none; }
}
.category-icon {
    font-size: 28px;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 40px;
}
.category-icon-img {
    /* La imagen se adapta al tamaño del contenedor de la categoria */
    width: 100%;
    max-width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 10px;
    display: block;
    margin: 0 auto 6px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}
.category-name {
    font-size: 11px;
    font-weight: 500;
    color: var(--text);
    word-break: break-word;
    line-height: 1.2;
}

/* ================= PRODUCTS ================= */
.products-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
}
.product-card {
    background: var(--white);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform .15s, box-shadow .15s;
    display: flex;
    flex-direction: column;
}
.product-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}
.product-image {
    width: 100%;
    aspect-ratio: 1;
    background: #f0f2f5;
    object-fit: cover;
    position: relative;
}
.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.discount-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    background: var(--accent);
    color: white;
    font-size: 11px;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 6px;
}
.product-info {
    padding: 12px;
    flex: 1;
    display: flex;
    flex-direction: column;
}
.product-name {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 4px;
    line-height: 1.3;
}
.product-category {
    font-size: 11px;
    color: var(--text-light);
    margin-bottom: 8px;
}
.product-price-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
}
.product-price {
    font-size: 16px;
    font-weight: 700;
    color: var(--primary);
}
.product-original-price {
    font-size: 11px;
    color: var(--text-light);
    text-decoration: line-through;
    display: block;
}
.add-cart-btn {
    background: var(--primary);
    color: white;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s;
}
.add-cart-btn:hover { background: var(--primary-light); }

/* ================= SIDEBAR ================= */
.sidebar, .cart-drawer {
    position: fixed;
    top: 0;
    bottom: 0;
    width: 280px;
    background: var(--white);
    z-index: 1000;
    box-shadow: var(--shadow-lg);
    transition: transform .25s ease;
    display: flex;
    flex-direction: column;
}
.sidebar {
    left: 0;
    transform: translateX(-100%);
}
.sidebar.open { transform: translateX(0); }

.cart-drawer {
    right: 0;
    transform: translateX(100%);
}
.cart-drawer.open { transform: translateX(0); }

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    border-bottom: 1px solid var(--border);
}
.sidebar-header h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary);
}
.sidebar-nav {
    padding: 12px;
    flex: 1;
}
.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 10px;
    color: var(--text);
    font-size: 15px;
    font-weight: 500;
    transition: background .15s;
}
.sidebar-nav a:hover { background: var(--bg); }
.sidebar-nav svg { color: var(--primary); }

.overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: opacity .25s;
}
.overlay.active { opacity: 1; visibility: visible; }

/* ================= CART DRAWER ================= */
.cart-items {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
}
.empty-cart {
    text-align: center;
    color: var(--text-light);
    padding: 40px 20px;
}
.cart-item {
    display: flex;
    gap: 10px;
    padding: 10px;
    border-bottom: 1px solid var(--border);
}
.cart-item img {
    width: 56px;
    height: 56px;
    border-radius: 8px;
    object-fit: cover;
}
.cart-item-info { flex: 1; }
.cart-item-name {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 4px;
}
.cart-item-price {
    font-size: 13px;
    color: var(--primary);
    font-weight: 700;
}
.cart-item-qty {
    font-size: 12px;
    color: var(--text-light);
}
.remove-btn {
    color: #ef4444;
    font-size: 18px;
    padding: 0 6px;
}
.cart-footer {
    padding: 16px;
    border-top: 1px solid var(--border);
}
.cart-total {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
    font-size: 16px;
}
.cart-total strong { color: var(--primary); font-size: 18px; }

/* ================= BOTTOM NAV (Mobile) ================= */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--white);
    display: flex;
    justify-content: space-around;
    padding: 8px 0;
    box-shadow: 0 -2px 12px rgba(0,0,0,0.08);
    z-index: 100;
}
.bottom-nav a {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    color: var(--text-light);
    font-size: 11px;
    padding: 4px 12px;
    border-radius: 8px;
    transition: color .15s;
    position: relative;
}
.bottom-nav a.active, .bottom-nav a:hover {
    color: var(--primary);
}

/* ================= RESPONSIVE: TABLET ================= */
@media (min-width: 768px) {
    .header-top { padding: 16px 24px; }
    .search-bar { margin: 0 24px 16px; }
    .main-content { padding: 24px; }

    .hero-banner { padding: 40px 36px; }
    .hero-text h1 { font-size: 30px; }
    .hero-text p { font-size: 16px; }
    .hero-image svg { width: 160px; height: 160px; }

    .categories-grid { gap: 14px; }
    .category-card { padding: 16px 10px; width: 90px; min-width: 90px; }
    .category-icon { font-size: 34px; height: 48px; }
    .category-icon-img { max-width: 56px; height: 56px; }
    .category-name { font-size: 12px; }

    .products-grid { grid-template-columns: repeat(3, 1fr); gap: 18px; }
    .product-info { padding: 14px; }

    body { padding-bottom: 0; }
    .bottom-nav { display: none; }
}

/* ================= RESPONSIVE: DESKTOP ================= */
@media (min-width: 1024px) {
    .hero-banner { padding: 48px 44px; }
    .hero-text h1 { font-size: 36px; }
    .hero-text p { font-size: 17px; }

    .categories-grid { gap: 16px; }
    .category-card { width: 100px; min-width: 100px; }
    .category-icon { font-size: 38px; height: 54px; }
    .category-icon-img { max-width: 64px; height: 64px; }
    .products-grid { grid-template-columns: repeat(4, 1fr); gap: 22px; }

    .product-info { padding: 16px; }
    .product-name { font-size: 15px; }

    .search-bar { max-width: 720px; margin-left: auto; margin-right: auto; }
}

/* ================= RESPONSIVE: EXTRA LARGE ================= */
@media (min-width: 1440px) {
    .products-grid { grid-template-columns: repeat(5, 1fr); }
}

/* ============================================
   AUTH / PROFILE
   ============================================ */
.auth-view {
    max-width: 600px;
    margin: 0 auto;
    padding: 16px;
    padding-bottom: 90px;
}
@media (min-width: 768px) {
    .auth-view { padding: 24px; padding-bottom: 40px; }
}

.auth-container {
    width: 100%;
}

.auth-card {
    background: var(--white);
    border-radius: 18px;
    padding: 28px 22px;
    box-shadow: var(--shadow);
    text-align: center;
    animation: fadeIn .25s ease;
}
@media (min-width: 768px) {
    .auth-card { padding: 40px 36px; }
}

.auth-card h2 {
    font-size: 24px;
    color: var(--primary);
    margin-bottom: 8px;
    font-weight: 700;
}

.auth-subtitle {
    color: var(--text-light);
    font-size: 14px;
    margin-bottom: 24px;
    line-height: 1.5;
}

.auth-card svg {
    margin-bottom: 8px;
}

.btn-secondary {
    background: var(--white);
    color: var(--primary);
    border: 2px solid var(--primary);
    padding: 12px 22px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 14px;
    margin-top: 10px;
    transition: background .15s, color .15s;
}
.btn-secondary:hover {
    background: var(--primary);
    color: var(--white);
}

.btn-danger {
    background: #ef4444;
    color: var(--white);
    padding: 12px 22px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 14px;
    margin-top: 10px;
    transition: background .15s;
}
.btn-danger:hover { background: #dc2626; }

.auth-benefits {
    margin-top: 28px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
    text-align: left;
}
.benefit-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    color: var(--text);
    font-size: 14px;
}
.benefit-icon {
    font-size: 22px;
    width: 36px;
    text-align: center;
}

.back-btn {
    background: none;
    color: var(--primary);
    font-size: 14px;
    margin-bottom: 16px;
    padding: 6px 0;
    display: inline-block;
    cursor: pointer;
}

/* ---------- FORM ---------- */
.form-group {
    margin-bottom: 14px;
    text-align: left;
}
.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 6px;
}
.form-group input {
    width: 100%;
    padding: 11px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border .15s, box-shadow .15s;
    background: var(--white);
}
.form-group input:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(26,143,143,0.12);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}
@media (min-width: 540px) {
    .form-row { grid-template-columns: 1fr 1fr; }
}

.form-error {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 12px;
    text-align: left;
}
.form-success {
    background: #f0fdf4;
    color: #15803d;
    border: 1px solid #bbf7d0;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 12px;
    text-align: left;
}

.auth-link {
    margin-top: 16px;
    font-size: 13px;
    color: var(--text-light);
}
.auth-link a {
    color: var(--primary);
    font-weight: 600;
    text-decoration: underline;
}

.demo-info {
    margin-top: 20px;
    padding: 12px;
    background: var(--bg);
    border-radius: 8px;
    font-size: 12px;
    color: var(--text-light);
    text-align: left;
    line-height: 1.6;
}

/* ---------- PERFIL LOGUEADO ---------- */
.profile-header {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}
.profile-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: var(--white);
    font-size: 32px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 12px;
}

.profile-info {
    text-align: left;
    margin-bottom: 20px;
}
.profile-info-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}
.profile-info-item:last-child { border-bottom: none; }
.profile-info-label {
    font-weight: 600;
    color: var(--text-light);
    min-width: 110px;
    font-size: 13px;
}
.profile-info-value {
    color: var(--text);
    flex: 1;
    word-break: break-word;
}

.profile-actions {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ============================================
   PANEL DE ADMINISTRACION
   ============================================ */
.role-badge {
    display: inline-block;
    margin-top: 8px;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
    background: var(--bg);
    color: var(--text-light);
}
.role-badge.admin {
    background: #fef3c7;
    color: #92400e;
}
.role-badge.admin-junior {
    background: #dbeafe;
    color: #1e40af;
}

.admin-panel {
    margin-top: 20px;
    padding: 20px;
    background: linear-gradient(135deg, #fff7ed 0%, #fef3c7 100%);
    border: 1px solid #fbbf24;
    border-radius: 14px;
    text-align: left;
}
.admin-panel-title {
    font-size: 16px;
    color: #92400e;
    font-weight: 700;
    margin-bottom: 4px;
}
.admin-subtitle {
    font-size: 13px;
    color: var(--text-light);
    margin-bottom: 16px;
}

.admin-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}
@media (min-width: 540px) {
    .admin-actions { grid-template-columns: 1fr 1fr; }
}

.admin-action-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    background: var(--white);
    border: 1px solid #fbbf24;
    border-radius: 10px;
    color: #92400e;
    font-weight: 600;
    font-size: 13px;
    text-align: left;
    cursor: pointer;
    transition: all .15s;
}
.admin-action-btn:hover {
    background: #fff7ed;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(251,191,36,0.2);
}
.admin-action-btn.admin-super {
    border-color: #0f5e5e;
    color: var(--primary);
    background: linear-gradient(135deg, #ffffff, #e0f2f2);
}
.admin-action-btn.admin-super:hover {
    box-shadow: 0 4px 12px rgba(15,94,94,0.2);
}
.admin-action-icon {
    font-size: 20px;
    width: 28px;
    text-align: center;
}

/* ============================================
   MODALES
   ============================================ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    animation: fadeIn .15s ease;
}
.modal-content {
    background: var(--white);
    border-radius: 16px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.modal-large {
    max-width: 800px;
}
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    background: var(--white);
    z-index: 1;
    border-radius: 16px 16px 0 0;
}
.modal-header h3 {
    font-size: 18px;
    color: var(--primary);
    font-weight: 700;
}
.modal-close {
    background: none;
    font-size: 28px;
    color: var(--text-light);
    cursor: pointer;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}
.modal-close:hover { background: var(--bg); }

.modal-content form { padding: 20px; }

.modal-footer {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 16px;
}
.modal-footer .btn-primary,
.modal-footer .btn-secondary {
    margin-top: 0;
    min-width: 110px;
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 10px;
}
.checkbox-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    cursor: pointer;
}
.checkbox-group label {
    margin: 0;
    cursor: pointer;
}

.form-info-box {
    background: #e0f2f2;
    border-left: 3px solid var(--primary);
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 13px;
    color: var(--primary-dark);
    margin: 10px 0;
    line-height: 1.5;
}

/* ---------- ADMIN LISTAS ---------- */
.admin-list {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.admin-list-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg);
    border-radius: 10px;
    border: 1px solid var(--border);
}
.admin-list-item img {
    width: 50px;
    height: 50px;
    border-radius: 8px;
    object-fit: cover;
    background: #e5e7eb;
}
.admin-list-item-info {
    flex: 1;
    min-width: 0;
}
.admin-list-item-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.admin-list-item-meta {
    font-size: 12px;
    color: var(--text-light);
    margin-top: 2px;
}
.admin-list-item-actions {
    display: flex;
    gap: 6px;
}
.admin-icon-btn {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 16px;
    border: none;
    transition: background .15s;
}
.admin-edit-btn {
    background: #dbeafe;
    color: #1e40af;
}
.admin-edit-btn:hover { background: #bfdbfe; }
.admin-delete-btn {
    background: #fee2e2;
    color: #b91c1c;
}
.admin-delete-btn:hover { background: #fecaca; }

.empty-list-msg {
    text-align: center;
    color: var(--text-light);
    padding: 30px;
    font-size: 14px;
}

/* ---------- CREAR CATEGORIA ---------- */
.category-create-form {
    padding: 20px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
}
.category-create-form h4 {
    font-size: 14px;
    color: var(--primary);
    margin-bottom: 12px;
    font-weight: 700;
}
.category-create-form .btn-primary {
    margin-top: 0;
    width: 100%;
}

/* Subir imagen de categoria */
.category-image-upload-area {
    border: 2px dashed var(--border);
    border-radius: 10px;
    padding: 14px;
    text-align: center;
    transition: border-color .15s, background .15s;
}
.category-image-upload-area:hover {
    border-color: var(--primary-light);
    background: #f0f9f9;
}
.category-image-upload-area .receipt-upload-btn {
    padding: 8px;
    font-size: 13px;
}
.category-image-preview {
    margin-top: 10px;
    text-align: center;
}
.category-image-preview img {
    max-width: 80px;
    max-height: 80px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    margin: 0 auto;
    object-fit: cover;
}
.category-image-preview .product-image-remove-btn {
    display: block;
    margin: 8px auto 0;
    font-size: 11px;
    padding: 4px 10px;
}

/* ---------- USUARIOS ---------- */
.user-role-tag {
    padding: 3px 10px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.user-role-tag.client {
    background: #f3f4f6;
    color: #4b5563;
}
.user-role-tag.admin {
    background: #fef3c7;
    color: #92400e;
}
.user-role-tag.admin-junior {
    background: #dbeafe;
    color: #1e40af;
}

/* ============================================
   FORMULARIO DE CHECKOUT - FINALIZA TU PEDIDO
   ============================================ */
.modal-small {
    max-width: 420px;
}

.checkout-section {
    padding: 18px 20px;
    border-bottom: 1px solid var(--border);
}
.checkout-section:last-of-type {
    border-bottom: none;
}
.checkout-section-title {
    font-size: 15px;
    color: var(--primary);
    font-weight: 700;
    margin-bottom: 12px;
}
.checkout-hint {
    font-size: 12px;
    color: var(--text-light);
    margin-bottom: 12px;
    font-style: italic;
}

/* Selects y textareas del checkout */
.checkout-section select,
.checkout-section textarea {
    width: 100%;
    padding: 11px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border .15s, box-shadow .15s;
    background: var(--white);
    color: var(--text);
}
.checkout-section select:focus,
.checkout-section textarea:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(26,143,143,0.12);
}
.checkout-section textarea {
    resize: vertical;
    min-height: 70px;
}

/* Opciones de metodo de entrega */
.delivery-options {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}
@media (min-width: 540px) {
    .delivery-options { grid-template-columns: 1fr 1fr; }
}
.delivery-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    border: 2px solid var(--border);
    border-radius: 12px;
    cursor: pointer;
    transition: all .15s;
    background: var(--white);
}
.delivery-option:hover {
    border-color: var(--primary-light);
    background: #f0f9f9;
}
.delivery-option input[type="radio"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    cursor: pointer;
    flex-shrink: 0;
}
.delivery-option input[type="radio"]:checked + .delivery-option-content {
    color: var(--primary);
}
.delivery-option:has(input:checked) {
    border-color: var(--primary);
    background: #e0f2f2;
    box-shadow: 0 0 0 3px rgba(26,143,143,0.12);
}
.delivery-option-content {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}
.delivery-icon {
    font-size: 28px;
    flex-shrink: 0;
}
.delivery-option-content strong {
    display: block;
    font-size: 14px;
    color: var(--text);
    font-weight: 600;
}
.delivery-option-content small {
    display: block;
    font-size: 12px;
    color: var(--text-light);
    margin-top: 2px;
}
.delivery-option-content .delivery-note {
    font-size: 11px;
    color: var(--primary);
    font-weight: 600;
    margin-top: 4px;
    padding: 2px 6px;
    background: #e0f2f2;
    border-radius: 4px;
    display: inline-block;
}

/* Secciones condicionales */
.delivery-section {
    animation: fadeIn .2s ease;
}

/* Caja de informacion */
.checkout-info-box {
    background: linear-gradient(135deg, #fff7ed 0%, #fef3c7 100%);
    border: 1px solid #fbbf24;
    border-radius: 10px;
    padding: 14px 16px;
    margin-top: 8px;
}
.checkout-info-box p {
    font-size: 13px;
    color: #78350f;
    line-height: 1.5;
    margin-bottom: 8px;
}
.checkout-info-box p:last-child { margin-bottom: 0; }
.checkout-schedule {
    background: var(--white);
    padding: 8px 12px;
    border-radius: 6px;
    border-left: 3px solid var(--primary);
}
.checkout-warning {
    color: #b91c1c !important;
    font-weight: 500;
}

/* Resumen */
.checkout-summary {
    background: var(--bg);
    border-radius: 0 0 0 0;
}
.checkout-summary .checkout-section-title {
    color: var(--text);
    border-bottom: 2px solid var(--primary);
    padding-bottom: 8px;
    margin-bottom: 14px;
}
.summary-product-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    font-size: 13px;
    color: var(--text);
    border-bottom: 1px dashed var(--border);
}
.summary-product-item:last-child { border-bottom: none; }
.summary-product-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding-right: 8px;
}
.summary-product-qty {
    color: var(--text-light);
    margin: 0 6px;
    font-size: 12px;
}
.summary-product-price {
    font-weight: 600;
    color: var(--text);
    flex-shrink: 0;
}
.summary-subtotal {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    margin-top: 6px;
    border-top: 1px solid var(--border);
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}
.summary-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    font-size: 14px;
    color: var(--text);
    border-bottom: 1px solid var(--border);
}
.summary-row:last-child { border-bottom: none; }
.summary-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 12px;
    margin-top: 10px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: var(--white);
    border-radius: 10px;
    font-size: 16px;
}
.summary-total strong {
    font-size: 20px;
    font-weight: 800;
}
.summary-label-empty {
    text-align: center;
    color: var(--text-light);
    padding: 20px;
    font-size: 13px;
    font-style: italic;
}

/* Advertencia de monto minimo de compra */
.summary-min-warning {
    background: #fef3c7;
    border: 1px solid #f59e0b;
    border-radius: 8px;
    padding: 10px 12px;
    margin-top: 12px;
    font-size: 12px;
    color: #92400e;
    line-height: 1.5;
}
.summary-min-warning strong {
    color: #78350f;
}

/* Info box de recojo en terminal */
.terminal-info-box {
    background: linear-gradient(135deg, #e0f2f2 0%, #cffafe 100%);
    border: 1px solid #06b6d4;
    border-radius: 10px;
    padding: 14px 16px;
    margin-top: 8px;
}
.terminal-info-box p {
    font-size: 13px;
    color: #155e75;
    line-height: 1.7;
    margin-bottom: 6px;
}
.terminal-info-box p:last-child { margin-bottom: 0; }
.terminal-info-box strong {
    color: #0e7490;
    font-weight: 700;
}

/* Hint de campos de formulario */
.field-hint {
    display: block;
    font-size: 11px;
    color: var(--text-light);
    margin-top: 4px;
    font-style: italic;
}

/* Pantalla de exito */
.order-success {
    padding: 30px 24px;
    text-align: center;
}
.order-success-icon {
    width: 72px;
    height: 72px;
    margin: 0 auto 16px;
    border-radius: 50%;
    background: #10b981;
    color: var(--white);
    font-size: 36px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: popIn .3s ease;
}
@keyframes popIn {
    0% { transform: scale(0); opacity: 0; }
    60% { transform: scale(1.1); }
    100% { transform: scale(1); opacity: 1; }
}
.order-success h2 {
    color: var(--primary);
    font-size: 22px;
    margin-bottom: 8px;
}
.order-success p {
    color: var(--text);
    font-size: 14px;
    margin-bottom: 16px;
    line-height: 1.5;
}
.order-success-detail {
    background: var(--bg);
    padding: 14px;
    border-radius: 10px;
    font-size: 13px;
    color: var(--text);
    margin-bottom: 18px;
    text-align: left;
}
.order-success-detail strong {
    color: var(--primary);
    display: inline-block;
    min-width: 110px;
}

/* ============================================
   PANTALLA DE PAGO (Pedido confirmado)
   ============================================ */
.payment-container {
    padding: 0;
}
.payment-section {
    padding: 18px 20px;
    border-bottom: 1px solid var(--border);
}
.payment-section:last-of-type {
    border-bottom: none;
}
.payment-section-title {
    font-size: 14px;
    color: var(--primary);
    font-weight: 700;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.payment-hint {
    font-size: 12px;
    color: var(--text-light);
    margin-bottom: 12px;
    font-style: italic;
}

/* Codigo de pedido */
.payment-order-code {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: var(--white);
    border-radius: 10px;
    flex-wrap: wrap;
    gap: 8px;
}
.order-code-label {
    font-size: 13px;
    opacity: 0.9;
}
.order-code-value {
    font-size: 20px;
    font-weight: 800;
    letter-spacing: 1px;
    background: var(--white);
    color: var(--primary);
    padding: 4px 12px;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
}

/* Total */
.payment-total-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    background: #fff7ed;
    border: 2px solid #fbbf24;
    border-radius: 10px;
}
.payment-total-label {
    font-size: 14px;
    color: #92400e;
    font-weight: 600;
}
.payment-total-value {
    font-size: 26px;
    color: #92400e;
    font-weight: 800;
}

/* QR */
.qr-box {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: var(--bg);
    border-radius: 10px;
    min-height: 240px;
    margin-bottom: 10px;
}
.qr-box img {
    max-width: 220px;
    max-height: 220px;
    width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
.qr-placeholder {
    text-align: center;
    color: var(--text-light);
    padding: 20px;
}
.qr-placeholder p {
    font-size: 13px;
    margin-top: 10px;
    line-height: 1.5;
}
.qr-instruction {
    text-align: center;
    font-size: 13px;
    color: var(--text);
    font-weight: 600;
    margin-top: 6px;
}

/* Subir comprobante */
.receipt-upload-area {
    border: 2px dashed var(--border);
    border-radius: 10px;
    padding: 20px;
    text-align: center;
    transition: border-color .15s, background .15s;
}
.receipt-upload-area:hover {
    border-color: var(--primary-light);
    background: #f0f9f9;
}
.receipt-upload-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: var(--primary);
    font-weight: 600;
    font-size: 14px;
    padding: 10px;
    cursor: pointer;
    width: 100%;
}
.receipt-upload-btn svg {
    color: var(--primary);
}
.receipt-preview {
    margin-top: 12px;
    position: relative;
}
.receipt-preview img {
    max-width: 100%;
    max-height: 240px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
.receipt-change-btn {
    margin-top: 10px;
    background: var(--bg);
    color: var(--primary);
    border: 1px solid var(--primary);
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}
.receipt-change-btn:hover {
    background: var(--primary);
    color: var(--white);
}

/* Subir imagen de producto */
.product-image-upload-area {
    border: 2px dashed var(--border);
    border-radius: 10px;
    padding: 16px;
    text-align: center;
    transition: border-color .15s, background .15s;
}
.product-image-upload-area:hover {
    border-color: var(--primary-light);
    background: #f0f9f9;
}
.product-image-upload-area .receipt-upload-btn {
    padding: 8px;
    font-size: 13px;
}
.product-image-preview {
    margin-top: 12px;
    position: relative;
    text-align: center;
}
.product-image-preview img {
    max-width: 100%;
    max-height: 200px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    margin: 0 auto;
}
.product-image-preview .receipt-change-btn {
    margin-top: 8px;
    margin-right: 6px;
}
.product-image-remove-btn {
    margin-top: 8px;
    background: #fee2e2;
    color: #b91c1c;
    border: 1px solid #fca5a5;
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}
.product-image-remove-btn:hover {
    background: #fecaca;
}
.product-image-hint {
    font-size: 11px;
    color: var(--text-light);
    margin-top: 10px;
    line-height: 1.4;
    font-style: italic;
}

/* Verificacion de comprobante subido */
.receipt-verification {
    margin-top: 10px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #15803d;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    animation: popIn .25s ease;
}
.verification-icon {
    width: 22px;
    height: 22px;
    background: #16a34a;
    color: var(--white);
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    flex-shrink: 0;
}

/* Estado de pago */
.payment-status {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 10px;
    background: #fef3c7;
    border: 1px solid #fbbf24;
}
.payment-status.verified {
    background: #f0fdf4;
    border-color: #bbf7d0;
}
.payment-status-icon {
    font-size: 28px;
    flex-shrink: 0;
}
.payment-status strong {
    display: block;
    font-size: 14px;
    color: var(--text);
    margin-bottom: 2px;
}
.payment-status p {
    font-size: 12px;
    color: var(--text-light);
    line-height: 1.4;
    margin: 0;
}
.payment-status.verified strong { color: #15803d; }
.payment-status.verified p { color: #166534; }

/* ============================================
   GESTION DE PEDIDOS (ADMIN)
   ============================================ */
.admin-action-btn.admin-orders {
    border-color: #7c3aed;
    color: #6d28d9;
    background: linear-gradient(135deg, #ffffff, #ede9fe);
}
.admin-action-btn.admin-orders:hover {
    box-shadow: 0 4px 12px rgba(124,58,237,0.2);
}

.admin-order-card {
    background: var(--bg);
    border-radius: 12px;
    padding: 14px;
    margin-bottom: 12px;
    border-left: 4px solid var(--primary);
}
.admin-order-card.verified {
    border-left-color: #16a34a;
}
.admin-order-card.pending-payment {
    border-left-color: #f59e0b;
}
.admin-order-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}
.admin-order-code {
    font-family: 'Courier New', monospace;
    font-weight: 700;
    font-size: 15px;
    color: var(--primary);
}
.admin-order-date {
    font-size: 12px;
    color: var(--text-light);
}
.admin-order-info {
    font-size: 13px;
    color: var(--text);
    line-height: 1.5;
    margin-bottom: 8px;
}
.admin-order-info strong {
    color: var(--text);
    display: inline-block;
    min-width: 90px;
}
.order-status-tag {
    padding: 3px 10px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.order-status-tag.pendiente-pago { background: #fef3c7; color: #92400e; }
.order-status-tag.pago-verificado { background: #d1fae5; color: #065f46; }
.order-status-tag.cancelado { background: #fee2e2; color: #991b1b; }

.admin-order-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 10px;
}
.admin-mini-btn {
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: background .15s;
}
.admin-mini-btn.view { background: #e0f2f2; color: var(--primary); }
.admin-mini-btn.view:hover { background: #b3e0e0; }
.admin-mini-btn.verify { background: #d1fae5; color: #065f46; }
.admin-mini-btn.verify:hover { background: #a7f3d0; }
.admin-mini-btn.verify:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Detalle de pedido para admin */
.admin-order-detail {
    padding: 20px;
}
.admin-order-detail h4 {
    font-size: 14px;
    color: var(--primary);
    margin: 16px 0 8px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.admin-order-detail h4:first-child { margin-top: 0; }
.admin-order-detail-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 14px;
    color: var(--text);
    border-bottom: 1px solid var(--border);
}
.admin-order-detail-row strong {
    color: var(--text-light);
    min-width: 110px;
}
.admin-order-receipt-preview {
    margin: 10px 0;
    text-align: center;
}
.admin-order-receipt-preview img {
    max-width: 100%;
    max-height: 400px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

/* Subir QR desde admin */
.admin-qr-upload {
    margin-top: 14px;
    padding: 14px;
    background: var(--bg);
    border-radius: 10px;
}
.admin-qr-upload label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    display: block;
    margin-bottom: 6px;
}
.admin-qr-upload input[type="file"] {
    width: 100%;
    padding: 8px;
    border: 1px dashed var(--border);
    border-radius: 6px;
    background: var(--white);
    font-size: 13px;
}
.admin-qr-current {
    margin-top: 10px;
    text-align: center;
}
.admin-qr-current img {
    max-width: 180px;
    max-height: 180px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

/* ============================================
   EXPORTAR / IMPORTAR PRODUCTOS
   ============================================ */
.admin-action-btn.admin-export {
    border-color: #0891b2;
    color: #0e7490;
    background: linear-gradient(135deg, #ffffff, #cffafe);
}
.admin-action-btn.admin-export:hover {
    box-shadow: 0 4px 12px rgba(8,145,178,0.2);
}
.admin-action-btn.admin-import {
    border-color: #7c3aed;
    color: #6d28d9;
    background: linear-gradient(135deg, #ffffff, #ede9fe);
}
.admin-action-btn.admin-import:hover {
    box-shadow: 0 4px 12px rgba(124,58,237,0.2);
}

/* Export modal */
.export-products-content,
.import-products-content {
    padding: 20px;
}
.export-info-box,
.import-info-box {
    background: #e0f2f2;
    border-left: 3px solid var(--primary);
    padding: 12px 14px;
    border-radius: 6px;
    font-size: 13px;
    color: var(--primary-dark);
    margin-bottom: 16px;
    line-height: 1.5;
}
.export-actions-top {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}
.export-count {
    font-size: 13px;
    color: var(--text-light);
    font-weight: 600;
    margin-left: auto;
}

/* Lista de productos exportables */
.export-product-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: var(--bg);
    border-radius: 8px;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: background .12s, border-color .12s;
}
.export-product-item:hover {
    background: #e0f2f2;
    border-color: var(--primary-light);
}
.export-product-item.selected {
    background: #d1fae5;
    border-color: #10b981;
}
.export-product-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    cursor: pointer;
    flex-shrink: 0;
}
.export-product-item img {
    width: 42px;
    height: 42px;
    border-radius: 6px;
    object-fit: cover;
    flex-shrink: 0;
}
.export-product-item-info {
    flex: 1;
    min-width: 0;
}
.export-product-item-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.export-product-item-meta {
    font-size: 12px;
    color: var(--text-light);
    margin-top: 2px;
}

/* Import modal */
.import-upload-area {
    border: 2px dashed var(--border);
    border-radius: 10px;
    padding: 30px 20px;
    text-align: center;
    transition: border-color .15s, background .15s;
}
.import-upload-area:hover {
    border-color: var(--primary-light);
    background: #f0f9f9;
}
.import-hint {
    font-size: 12px;
    color: var(--text-light);
    margin-top: 10px;
}
.import-file-info {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 8px;
    padding: 12px 14px;
    font-size: 13px;
    color: #15803d;
    margin-top: 14px;
    line-height: 1.7;
}
.import-file-info strong {
    color: #166534;
}
#importExecuteBtn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ============================================
   PANEL DE ESTADISTICAS (ADMIN)
   ============================================ */
.admin-action-btn.admin-stats {
    border-color: #db2777;
    color: #be185d;
    background: linear-gradient(135deg, #ffffff, #fce7f3);
}
.admin-action-btn.admin-stats:hover {
    box-shadow: 0 4px 12px rgba(219,39,119,0.2);
}
.admin-action-btn.admin-qr {
    border-color: #059669;
    color: #047857;
    background: linear-gradient(135deg, #ffffff, #d1fae5);
}
.admin-action-btn.admin-qr:hover {
    box-shadow: 0 4px 12px rgba(5,150,105,0.2);
}
.admin-action-btn.admin-stock {
    border-color: #ea580c;
    color: #c2410c;
    background: linear-gradient(135deg, #ffffff, #ffedd5);
    position: relative;
}
.admin-action-btn.admin-stock:hover {
    box-shadow: 0 4px 12px rgba(234,88,12,0.2);
}

/* Badge de stock en el boton */
.stock-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #ef4444;
    color: var(--white);
    font-size: 11px;
    font-weight: 700;
    min-width: 20px;
    height: 20px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
    border: 2px solid var(--white);
    animation: pulse 2s infinite;
}
@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* Modal de alertas de stock */
.stock-alerts-content {
    padding: 20px;
}
.stock-section {
    margin-bottom: 24px;
}
.stock-section:last-child { margin-bottom: 0; }
.stock-section-title {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid;
    display: flex;
    align-items: center;
    gap: 8px;
}
.stock-section-out { color: #b91c1c; border-color: #ef4444; }
.stock-section-low { color: #92400e; border-color: #f59e0b; }

.stock-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.stock-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: var(--bg);
    border-radius: 8px;
    border-left: 4px solid var(--primary);
}
.stock-item.out {
    border-left-color: #ef4444;
    background: #fef2f2;
}
.stock-item.low {
    border-left-color: #f59e0b;
    background: #fffbeb;
}
.stock-item img {
    width: 42px;
    height: 42px;
    border-radius: 6px;
    object-fit: cover;
    flex-shrink: 0;
}
.stock-item-info {
    flex: 1;
    min-width: 0;
}
.stock-item-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.stock-item-meta {
    font-size: 12px;
    color: var(--text-light);
    margin-top: 2px;
}
.stock-item-status {
    font-size: 12px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    flex-shrink: 0;
}
.stock-item-status.out {
    background: #fee2e2;
    color: #991b1b;
}
.stock-item-status.low {
    background: #fef3c7;
    color: #92400e;
}
.stock-empty {
    text-align: center;
    padding: 20px;
    color: var(--text-light);
    font-size: 13px;
    font-style: italic;
}

/* Estado de stock en el detalle de producto */
.product-stock-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 16px;
}
.product-stock-status.available {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #10b981;
}
.product-stock-status.unavailable {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #ef4444;
}
.product-stock-status.low {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #f59e0b;
}
.product-stock-status .stock-icon {
    font-size: 16px;
}

/* Producto agotado - tarjetas */
.product-card.product-unavailable {
    opacity: 0.75;
}
.product-card.product-unavailable .product-image {
    position: relative;
}
.product-out-of-stock-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
}
.product-out-of-stock-overlay span {
    background: #ef4444;
    color: var(--white);
    padding: 8px 18px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 1px;
    text-transform: uppercase;
    border: 2px solid var(--white);
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

/* Boton agregar al carrito deshabilitado */
.add-cart-btn.add-cart-disabled {
    background: #9ca3af !important;
    cursor: not-allowed !important;
    opacity: 0.6;
}
.add-cart-btn.add-cart-disabled:hover {
    background: #9ca3af !important;
    transform: none;
}

/* ============================================
   HISTORIAL DE ACTIVIDAD (ADMIN)
   ============================================ */
.admin-action-btn.admin-history {
    border-color: #4f46e5;
    color: #4338ca;
    background: linear-gradient(135deg, #ffffff, #e0e7ff);
}
.admin-action-btn.admin-history:hover {
    box-shadow: 0 4px 12px rgba(79,70,229,0.2);
}

.activity-log-content {
    padding: 20px;
}
.activity-log-filters {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.activity-log-filters label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
}
.activity-log-filters select {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 13px;
    background: var(--white);
    color: var(--text);
    cursor: pointer;
}

.activity-log-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 60vh;
    overflow-y: auto;
}

.activity-log-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 10px 12px;
    background: var(--bg);
    border-radius: 8px;
    border-left: 4px solid var(--primary);
    flex-wrap: wrap;
}
.activity-log-item.role-client { border-left-color: #3b82f6; }
.activity-log-item.role-admin { border-left-color: #f59e0b; }
.activity-log-item.role-admin-junior { border-left-color: #06b6d4; }

.activity-log-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
    background: var(--white);
    border: 1px solid var(--border);
}

.activity-log-content-row {
    flex: 1;
    min-width: 0;
}
.activity-log-action {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 2px;
}
.activity-log-desc {
    font-size: 12px;
    color: var(--text-light);
    line-height: 1.4;
}
.activity-log-meta {
    font-size: 11px;
    color: var(--text-light);
    margin-top: 4px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.activity-log-user {
    font-weight: 600;
    color: var(--primary);
}
.activity-log-role-tag {
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}
.activity-log-role-tag.client { background: #dbeafe; color: #1e40af; }
.activity-log-role-tag.admin { background: #fef3c7; color: #92400e; }
.activity-log-role-tag.admin-junior { background: #cffafe; color: #155e75; }
.activity-log-role-tag.anonimo { background: #f3f4f6; color: #4b5563; }

.activity-log-empty {
    text-align: center;
    padding: 30px 20px;
    color: var(--text-light);
    font-size: 14px;
    font-style: italic;
}

/* Barra de cabecera en gestion de pedidos */
.admin-orders-header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    background: linear-gradient(135deg, #fee2e2, #fef3c7);
    border: 1px solid #fca5a5;
    border-radius: 10px;
    margin-bottom: 14px;
    flex-wrap: wrap;
    gap: 10px;
}
.orders-count {
    font-size: 14px;
    font-weight: 700;
    color: #991b1b;
}
.admin-orders-header-bar .btn-danger {
    margin-top: 0;
    background: #dc2626;
    color: var(--white);
    padding: 8px 16px;
    font-size: 13px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: background .15s;
}
.admin-orders-header-bar .btn-danger:hover {
    background: #b91c1c;
}

/* ============================================
   AYUDA Y SOPORTE
   ============================================ */
.help-link {
    margin-top: 12px;
    border-top: 1px solid var(--border);
    padding-top: 12px !important;
    color: var(--primary) !important;
}
.help-link svg {
    color: var(--primary);
}

.help-content {
    padding: 24px 20px;
    text-align: center;
}
.help-icon-container {
    margin-bottom: 16px;
}
.help-content h4 {
    font-size: 20px;
    color: var(--primary);
    margin-bottom: 8px;
    font-weight: 700;
}
.help-subtitle {
    font-size: 14px;
    color: var(--text-light);
    margin-bottom: 24px;
    line-height: 1.5;
}

.whatsapp-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    background: #25D366;
    color: var(--white);
    border: none;
    padding: 14px 20px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: all .15s;
    box-shadow: 0 4px 14px rgba(37, 211, 102, 0.3);
    font-family: inherit;
}
.whatsapp-btn:hover {
    background: #1da851;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(37, 211, 102, 0.4);
}
.whatsapp-btn:active {
    transform: translateY(0);
}
.whatsapp-btn svg {
    color: var(--white);
}

.help-info-box {
    background: var(--bg);
    border-radius: 10px;
    padding: 14px;
    margin: 20px 0;
    text-align: left;
}
.help-info-box p {
    font-size: 13px;
    color: var(--text);
    margin-bottom: 6px;
    line-height: 1.5;
}
.help-info-box p:last-child { margin-bottom: 0; }
.help-info-box strong { color: var(--primary); }

.help-note {
    font-size: 12px;
    color: var(--text-light);
    line-height: 1.5;
    font-style: italic;
    text-align: center;
    margin-top: 16px;
}

/* Modal QR global */
.global-qr-content {
    padding: 20px;
}
.global-qr-info-box {
    background: #e0f2f2;
    border-left: 3px solid var(--primary);
    padding: 12px 14px;
    border-radius: 6px;
    font-size: 13px;
    color: var(--primary-dark);
    margin-bottom: 20px;
    line-height: 1.5;
}
.global-qr-info-box strong {
    color: var(--primary);
}

.global-qr-preview-area {
    text-align: center;
}
.global-qr-current {
    margin-bottom: 20px;
}
.global-qr-current img {
    max-width: 240px;
    max-height: 240px;
    border-radius: 10px;
    box-shadow: 0 4px 14px rgba(0,0,0,0.15);
    margin: 0 auto;
}
.global-qr-current-label {
    font-size: 12px;
    color: var(--text-light);
    margin-top: 8px;
    font-weight: 600;
}

.global-qr-upload-area {
    border: 2px dashed var(--border);
    border-radius: 10px;
    padding: 24px 20px;
    text-align: center;
    transition: border-color .15s, background .15s;
    margin-top: 10px;
}
.global-qr-upload-area:hover {
    border-color: var(--primary-light);
    background: #f0f9f9;
}
.global-qr-hint {
    font-size: 12px;
    color: var(--text-light);
    margin-top: 10px;
    font-style: italic;
}

.stats-container {
    padding: 20px;
    max-height: 80vh;
    overflow-y: auto;
}

/* Tarjetas de metricas */
.stats-overview {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}
@media (min-width: 640px) {
    .stats-overview { grid-template-columns: repeat(4, 1fr); }
}

.stat-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px 14px;
    position: relative;
    overflow: hidden;
    transition: transform .15s, box-shadow .15s;
}
.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}
.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--primary);
}
.stat-card.sales::before { background: #10b981; }
.stat-card.orders::before { background: #3b82f6; }
.stat-card.products::before { background: #f59e0b; }
.stat-card.users::before { background: #8b5cf6; }
.stat-card.sold::before { background: #ec4899; }
.stat-card.avg::before { background: #06b6d4; }

.stat-icon {
    font-size: 24px;
    margin-bottom: 8px;
}
.stat-label {
    font-size: 11px;
    color: var(--text-light);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}
.stat-value {
    font-size: 20px;
    color: var(--text);
    font-weight: 800;
    line-height: 1.2;
}
@media (min-width: 640px) {
    .stat-value { font-size: 24px; }
}
.stat-subtext {
    font-size: 11px;
    color: var(--text-light);
    margin-top: 4px;
}

/* Seccion de estadisticas */
.stats-section {
    margin-bottom: 24px;
}
.stats-section-title {
    font-size: 14px;
    color: var(--primary);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
    padding-bottom: 6px;
    border-bottom: 2px solid var(--primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Tabla de productos mas vendidos */
.stats-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.stats-table th {
    background: var(--primary);
    color: var(--white);
    padding: 8px 10px;
    text-align: left;
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}
.stats-table th:first-child { border-radius: 6px 0 0 0; }
.stats-table th:last-child { border-radius: 0 6px 0 0; }
.stats-table td {
    padding: 8px 10px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
}
.stats-table tr:nth-child(even) td { background: var(--bg); }
.stats-table tr:hover td { background: #e0f2f2; }
.stats-table .rank {
    font-weight: 700;
    color: var(--primary);
    text-align: center;
    width: 36px;
}
.stats-table .rank.top-1 { color: #f59e0b; }
.stats-table .rank.top-2 { color: #6b7280; }
.stats-table .rank.top-3 { color: #d97706; }
.stats-table .product-name {
    font-weight: 600;
    color: var(--text);
}
.stats-table .quantity-cell {
    text-align: center;
    font-weight: 700;
    color: var(--primary);
}
.stats-table .revenue-cell {
    text-align: right;
    font-weight: 600;
    color: #10b981;
}

/* Barra de progreso visual para top productos */
.top-product-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--bg);
    border-radius: 8px;
    margin-bottom: 6px;
}
.top-product-rank {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--primary);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
    flex-shrink: 0;
}
.top-product-rank.rank-1 { background: #f59e0b; }
.top-product-rank.rank-2 { background: #6b7280; }
.top-product-rank.rank-3 { background: #d97706; }
.top-product-info {
    flex: 1;
    min-width: 0;
}
.top-product-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.top-product-bar {
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    margin-top: 4px;
    overflow: hidden;
}
.top-product-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--primary-light));
    border-radius: 3px;
    transition: width .5s ease;
}
.top-product-stats {
    text-align: right;
    flex-shrink: 0;
}
.top-product-qty {
    font-size: 13px;
    font-weight: 700;
    color: var(--primary);
}
.top-product-revenue {
    font-size: 11px;
    color: var(--text-light);
    margin-top: 2px;
}

/* Ventas por ciudad */
.city-stats-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: var(--bg);
    border-radius: 8px;
    margin-bottom: 6px;
    gap: 12px;
}
.city-stats-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    flex: 1;
    min-width: 0;
}
.city-stats-bar {
    flex: 1;
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
    margin: 0 12px;
}
.city-stats-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #3b82f6, #06b6d4);
    border-radius: 4px;
    transition: width .5s ease;
}
.city-stats-value {
    font-size: 13px;
    font-weight: 700;
    color: #10b981;
    flex-shrink: 0;
    text-align: right;
}
.city-stats-orders {
    font-size: 11px;
    color: var(--text-light);
}

/* Pedidos recientes */
.recent-order-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: var(--bg);
    border-radius: 8px;
    margin-bottom: 6px;
    gap: 10px;
    flex-wrap: wrap;
}
.recent-order-code {
    font-family: 'Courier New', monospace;
    font-weight: 700;
    font-size: 13px;
    color: var(--primary);
}
.recent-order-city {
    font-size: 12px;
    color: var(--text-light);
    margin-top: 2px;
}
.recent-order-total {
    font-weight: 700;
    color: #10b981;
    font-size: 14px;
}
.recent-order-status {
    font-size: 10px;
    padding: 3px 8px;
    border-radius: 8px;
    font-weight: 700;
    text-transform: uppercase;
}
.recent-order-status.verified { background: #d1fae5; color: #065f46; }
.recent-order-status.pending { background: #fef3c7; color: #92400e; }
.recent-order-status.cancelled { background: #fee2e2; color: #991b1b; }

.stats-loading {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-light);
}
.stats-loading .compressing-spinner {
    margin: 0 auto 12px;
}
.stats-empty {
    text-align: center;
    padding: 30px 20px;
    color: var(--text-light);
    font-size: 13px;
    font-style: italic;
}

/* Grid de dos columnas para top productos y ventas por ciudad */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}
@media (min-width: 768px) {
    .stats-grid { grid-template-columns: 1fr 1fr; }
}

/* ============================================
   EDITAR USUARIO / CAMBIAR CONTRASEÑA (ADMIN)
   ============================================ */
.admin-mini-btn.edit {
    background: #dbeafe;
    color: #1e40af;
}
.admin-mini-btn.edit:hover { background: #bfdbfe; }
.admin-mini-btn.password {
    background: #fef3c7;
    color: #92400e;
}
.admin-mini-btn.password:hover { background: #fde68a; }

.admin-user-row .admin-list-item-actions {
    gap: 6px;
}

.edit-user-info-box {
    background: #e0f2f2;
    border-left: 3px solid var(--primary);
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 13px;
    color: var(--primary-dark);
    margin-bottom: 16px;
    line-height: 1.6;
}
.edit-user-info-box strong {
    color: var(--primary);
}

.password-info-box {
    background: #fef3c7;
    border-left: 3px solid #f59e0b;
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 13px;
    color: #92400e;
    margin-bottom: 16px;
    line-height: 1.5;
}
.password-info-box strong {
    color: #78350f;
}

.password-warning {
    background: #fee2e2;
    border: 1px solid #fca5a5;
    border-radius: 6px;
    padding: 10px 14px;
    font-size: 12px;
    color: #991b1b;
    margin: 12px 0;
    line-height: 1.5;
}
.password-warning strong {
    color: #7f1d1d;
}

/* ============================================
   NOTIFICACION DE PAGO VERIFICADO
   ============================================ */
.payment-notification {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    border: 2px solid #10b981;
    border-radius: 14px;
    padding: 18px;
    margin-top: 20px;
    margin-bottom: 16px;
    display: flex;
    align-items: flex-start;
    gap: 14px;
    animation: slideIn .3s ease;
}
@keyframes slideIn {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}
.payment-notification-icon {
    width: 44px;
    height: 44px;
    background: #10b981;
    color: var(--white);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    font-weight: 700;
    flex-shrink: 0;
}
.payment-notification-content {
    flex: 1;
}
.payment-notification-title {
    font-size: 15px;
    font-weight: 700;
    color: #065f46;
    margin-bottom: 4px;
}
.payment-notification-text {
    font-size: 13px;
    color: #047857;
    line-height: 1.5;
    margin-bottom: 8px;
}
.payment-notification-close {
    background: transparent;
    border: none;
    color: #047857;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: underline;
    padding: 0;
}
.notification-badge {
    position: absolute;
    top: 0;
    right: 0;
    background: #ef4444;
    color: var(--white);
    font-size: 10px;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

/* ============================================
   SPINNER DE COMPRESIÓN
   ============================================ */
.compressing-spinner {
    width: 28px;
    height: 28px;
    border: 3px solid var(--bg);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============================================
   VISTA MIS PEDIDOS (CLIENTE)
   ============================================ */
.my-orders-view {
    max-width: 900px;
    margin: 0 auto;
    padding: 16px;
    padding-bottom: 90px; /* espacio extra para bottom-nav en movil */
    min-height: 60vh;
    animation: fadeIn .2s ease;
}
@media (min-width: 768px) {
    .my-orders-view { padding: 24px; padding-bottom: 40px; }
}

.my-orders-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.my-orders-header h2 {
    font-size: 22px;
    color: var(--primary);
    font-weight: 700;
    flex: 1;
    min-width: 0;
}
@media (min-width: 768px) {
    .my-orders-header h2 { font-size: 24px; }
}

/* En movil, el boton "Volver" debe ser claro y grande */
.my-orders-header .back-btn {
    font-size: 14px;
    padding: 8px 14px;
    background: var(--bg);
    border-radius: 8px;
    font-weight: 600;
    border: 1px solid var(--border);
}
@media (min-width: 768px) {
    .my-orders-header .back-btn {
        background: none;
        border: none;
        padding: 6px 0;
    }
}

.my-orders-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.my-order-card {
    background: var(--white);
    border-radius: 14px;
    box-shadow: var(--shadow);
    overflow: hidden;
    border-left: 5px solid var(--primary);
    transition: box-shadow .15s;
}
.my-order-card:hover { box-shadow: var(--shadow-lg); }
.my-order-card.cancelled {
    border-left-color: #ef4444;
    opacity: 0.85;
}
.my-order-card.verified {
    border-left-color: #10b981;
}
.my-order-card.pending {
    border-left-color: #f59e0b;
}

.my-order-card-header {
    padding: 14px 16px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}
.my-order-code-block {
    flex: 1;
    min-width: 0;
}
.my-order-code {
    font-family: 'Courier New', monospace;
    font-weight: 700;
    font-size: 15px;
    color: var(--primary);
    word-break: break-all;
}
@media (min-width: 768px) {
    .my-order-code { font-size: 17px; }
}
.my-order-date {
    font-size: 11px;
    color: var(--text-light);
    margin-top: 2px;
}
@media (min-width: 768px) {
    .my-order-date { font-size: 12px; }
}
.my-order-status-tag {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    flex-shrink: 0;
}
@media (min-width: 768px) {
    .my-order-status-tag { font-size: 11px; padding: 4px 12px; }
}
.my-order-status-tag.pendiente-pago { background: #fef3c7; color: #92400e; }
.my-order-status-tag.pago-verificado { background: #d1fae5; color: #065f46; }
.my-order-status-tag.cancelado { background: #fee2e2; color: #991b1b; }

.my-order-card-body {
    padding: 14px 16px;
}
.my-order-summary-row {
    display: flex;
    justify-content: space-between;
    padding: 5px 0;
    font-size: 13px;
    color: var(--text);
    border-bottom: 1px dashed var(--border);
    gap: 8px;
}
.my-order-summary-row:last-of-type { border-bottom: none; }
.my-order-summary-row strong {
    color: var(--text-light);
    min-width: 90px;
    font-weight: 600;
    flex-shrink: 0;
}
@media (min-width: 768px) {
    .my-order-summary-row { font-size: 14px; }
    .my-order-summary-row strong { min-width: 110px; }
}
.my-order-summary-row .value {
    text-align: right;
    color: var(--text);
    word-break: break-word;
    flex: 1;
}
.my-order-items-preview {
    margin-top: 10px;
    padding: 10px 12px;
    background: var(--bg);
    border-radius: 8px;
    font-size: 12px;
    color: var(--text);
    line-height: 1.6;
}
@media (min-width: 768px) {
    .my-order-items-preview { font-size: 13px; }
}
.my-order-items-preview strong {
    color: var(--primary);
    display: block;
    margin-bottom: 4px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.my-order-card-actions {
    padding: 12px 16px;
    background: var(--bg);
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    border-top: 1px solid var(--border);
    align-items: center;
}
.my-order-btn {
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: background .15s, transform .1s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
@media (min-width: 768px) {
    .my-order-btn { padding: 9px 16px; font-size: 13px; }
}
.my-order-btn:active { transform: translateY(1px); }
.my-order-btn.view { background: #e0f2f2; color: var(--primary); }
.my-order-btn.view:hover { background: #b3e0e0; }
.my-order-btn.cancel { background: #fee2e2; color: #b91c1c; }
.my-order-btn.cancel:hover { background: #fecaca; }
.my-order-btn.cancel:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #f3f4f6;
    color: var(--text-light);
}
.my-order-btn.download { background: #d1fae5; color: #065f46; }
.my-order-btn.download:hover { background: #a7f3d0; }
.my-order-btn.pay { background: #fef3c7; color: #92400e; }
.my-order-btn.pay:hover { background: #fde68a; }

.my-orders-empty {
    text-align: center;
    padding: 50px 20px;
    color: var(--text-light);
}
.my-orders-empty svg {
    margin-bottom: 16px;
    opacity: 0.4;
}
.my-orders-empty p {
    font-size: 15px;
    margin-bottom: 16px;
}
.my-orders-empty .btn-primary {
    display: inline-block;
}

/* Detalle de pedido para cliente */
.my-order-detail {
    padding: 20px;
}
@media (min-width: 768px) {
    .my-order-detail { padding: 24px; }
}
.my-order-detail-section {
    margin-bottom: 24px;
}
.my-order-detail-section h4 {
    font-size: 13px;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 700;
    margin-bottom: 10px;
    padding-bottom: 6px;
    border-bottom: 2px solid var(--primary);
}
.my-order-detail-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    font-size: 13px;
    color: var(--text);
    border-bottom: 1px solid var(--border);
    gap: 12px;
}
@media (min-width: 768px) {
    .my-order-detail-row { font-size: 14px; }
}
.my-order-detail-row:last-child { border-bottom: none; }
.my-order-detail-row strong {
    color: var(--text-light);
    min-width: 100px;
    font-weight: 600;
    flex-shrink: 0;
}
@media (min-width: 768px) {
    .my-order-detail-row strong { min-width: 130px; }
}
.my-order-detail-row .value {
    text-align: right;
    color: var(--text);
    word-break: break-word;
    flex: 1;
}
.my-order-detail-product {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    font-size: 13px;
    border-bottom: 1px dashed var(--border);
    gap: 8px;
}
@media (min-width: 768px) {
    .my-order-detail-product { font-size: 14px; }
}
.my-order-detail-product:last-child { border-bottom: none; }
.my-order-detail-product-name {
    flex: 1;
    color: var(--text);
    min-width: 0;
}
.my-order-detail-product-qty {
    color: var(--text-light);
    margin: 0 8px;
    font-size: 11px;
    flex-shrink: 0;
}
@media (min-width: 768px) {
    .my-order-detail-product-qty { font-size: 12px; margin: 0 12px; }
}
.my-order-detail-product-price {
    font-weight: 600;
    color: var(--text);
    flex-shrink: 0;
}
.my-order-detail-total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 14px;
    margin-top: 12px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: var(--white);
    border-radius: 10px;
    font-size: 15px;
}
@media (min-width: 768px) {
    .my-order-detail-total-row { font-size: 16px; }
}
.my-order-detail-total-row strong {
    font-size: 18px;
    font-weight: 800;
}
@media (min-width: 768px) {
    .my-order-detail-total-row strong { font-size: 20px; }
}

/* Banner informativo en la vista de pedidos */
.my-orders-info-banner {
    background: linear-gradient(135deg, #e0f2f2 0%, #d1fae5 100%);
    border: 1px solid #6ee7b7;
    border-radius: 12px;
    padding: 12px 14px;
    margin-bottom: 16px;
    font-size: 12px;
    color: #065f46;
    line-height: 1.5;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}
@media (min-width: 768px) {
    .my-orders-info-banner { padding: 14px 16px; font-size: 13px; margin-bottom: 20px; }
}
.my-orders-info-banner-icon {
    font-size: 20px;
    flex-shrink: 0;
}
@media (min-width: 768px) {
    .my-orders-info-banner-icon { font-size: 22px; }
}
