/* ==================== RESET & BASE ==================== */
:root {
    --primary-blue: #1D4ED8;       /* Azul profesional principal */
    --primary-blue-soft: #3B82F6;  /* Azul más suave para hover */
    --primary-blue-light: #60A5FA; /* Azul claro para accents */
    --primary-blue-dark: #1E40AF;  /* Azul oscuro para estados */
    --border-subtle: #e2e8f0;      /* Bordes sutiles */
}

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

body {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f8fafc;
    color: #1e293b;
    min-height: 100vh;
    padding: 20px 14px;
    line-height: 1.5;
}

.container {
    max-width: 1240px;
    margin: 0 auto;
}

/* ==================== ENCABEZADO DEL PORTAL ==================== */
.portal-header {
    background: white;
    padding: 20px 24px;
    border-radius: 18px;
    margin-bottom: 16px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.03);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 14px;
}

.header-logo {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    object-fit: contain;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
}

.header-titles h1 {
    font-size: 1.45rem;
    font-weight: 800;
    color: #0f172a;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.header-titles p {
    color: #64748b;
    font-size: 0.85rem;
    font-weight: 500;
}

.badge-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #eff6ff;
    color: var(--primary-blue);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
    border: 1px solid #bfdbfe;
}

/* ==================== CALCULADORA DE MARGEN ==================== */
.margin-calculator-panel {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 18px;
    padding: 16px 20px;
    margin-bottom: 16px;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.03);
    transition: all 0.25s;
}

.margin-calculator-panel.active {
    border-color: #cbd5e1;
    background: #ffffff;
}

.margin-calc-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.margin-calc-title {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.calc-icon {
    font-size: 1.6rem;
    background: #f8fafc;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #e2e8f0;
    flex-shrink: 0;
}

.margin-calc-title h3 {
    font-size: 1.05rem;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.2;
}

.calc-subtitle {
    font-size: 0.78rem;
    color: #64748b;
    margin-top: 2px;
}

/* Switch Toggle */
.switch-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.switch-label {
    font-size: 0.82rem;
    font-weight: 700;
    color: #334155;
}

.switch-container {
    position: relative;
    display: inline-block;
    width: 46px;
    height: 24px;
}

.switch-container input {
    opacity: 0;
    width: 0;
    height: 0;
}

.switch-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #cbd5e1;
    transition: 0.3s;
    border-radius: 30px;
}

.switch-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.switch-container input:checked + .switch-slider {
    background-color: var(--primary-blue);
}

.switch-container input:checked + .switch-slider:before {
    transform: translateX(22px);
}

/* Margin Controls */
.margin-controls {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid #f1f5f9;
    animation: fadeIn 0.25s ease;
}

.margin-controls-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.margin-presets-label {
    font-size: 0.82rem;
    font-weight: 700;
    color: #475569;
}

.margin-presets {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.margin-preset-btn {
    padding: 6px 12px;
    border: 1px solid #cbd5e1;
    background: #f8fafc;
    color: #334155;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s;
}

.margin-preset-btn:hover {
    background: #eff6ff;
    color: var(--primary-blue);
    border-color: var(--primary-blue);
}

.margin-preset-btn.active {
    background: var(--primary-blue);
    color: white;
    border-color: var(--primary-blue);
    box-shadow: 0 2px 8px rgba(29, 78, 216, 0.25);
}

.custom-margin-box {
    display: flex;
    align-items: center;
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 2px 8px;
}

.custom-margin-box span {
    font-weight: 700;
    color: #64748b;
    font-size: 0.8rem;
}

.custom-margin-input {
    width: 55px;
    padding: 4px 2px;
    border: none;
    background: transparent;
    font-size: 0.82rem;
    font-weight: 700;
    color: #1e293b;
    outline: none;
}

.margin-help-text {
    font-size: 0.78rem;
    color: #64748b;
}

/* ==================== TOOLBAR SECTION ==================== */
.toolbar-section {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 18px;
    padding: 16px 20px;
    margin-bottom: 20px;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.03);
}

.search-bar-row {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 14px;
}

.search-input-wrapper {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
    min-width: 0;
}

.search-icon {
    position: absolute;
    left: 14px;
    font-size: 1rem;
    color: #94a3b8;
    pointer-events: none;
}

.search-box {
    width: 100%;
    padding: 12px 14px 12px 40px;
    font-size: 0.92rem;
    font-family: inherit;
    border: 1.5px solid #cbd5e1;
    border-radius: 12px;
    transition: all 0.2s;
    background: #f8fafc;
}

.search-box:focus {
    outline: none;
    border-color: var(--primary-blue);
    background: white;
    box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.12);
}

/* Selector de Vista: Cuadrícula vs Lista */
.view-toggle-group {
    display: flex;
    background: #eff6ff;
    padding: 3px;
    border-radius: 10px;
    border: 1px solid var(--border-subtle);
    flex-shrink: 0;
}

.view-toggle-btn {
    padding: 7px 12px;
    border: none;
    background: transparent;
    color: #64748b;
    border-radius: 7px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.view-toggle-btn.active {
    background: var(--primary-blue);
    color: white;
    box-shadow: 0 2px 5px rgba(29, 78, 216, 0.25);
}

.view-toggle-btn:hover:not(.active) {
    background: #eff6ff;
    color: var(--primary-blue);
}

/* ==================== FILTROS AVANZADOS Y ORDENAMIENTO ==================== */
.header-status {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.install-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--primary-blue);
    color: white;
    border: none;
    padding: 7px 14px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(29, 78, 216, 0.25);
}

.install-btn:hover {
    background: var(--primary-blue-dark);
    transform: translateY(-1px);
}

.logout-catalog-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: transparent;
    color: #475569;
    border: 1px solid var(--border-subtle);
    padding: 7px 14px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

.logout-catalog-btn:hover {
    background: #fee2e2;
    border-color: #fecaca;
    color: #b91c1c;
}

.filters-row {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    padding-top: 12px;
    margin-top: 4px;
    border-top: 1px solid var(--border-subtle);
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 7px;
}

.filter-label {
    font-size: 0.78rem;
    font-weight: 700;
    color: #475569;
    white-space: nowrap;
}

.filter-select {
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 600;
    color: #1e293b;
    background: #f8fafc;
    border: 1.5px solid var(--border-subtle);
    border-radius: 9px;
    padding: 7px 10px;
    cursor: pointer;
    transition: all 0.2s;
    outline: none;
}

.filter-select:focus {
    border-color: var(--primary-blue);
    background: white;
    box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.12);
}

.filter-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
}

.filter-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.filter-toggle-slider {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 22px;
    background-color: #cbd5e1;
    border-radius: 30px;
    transition: 0.25s;
    flex-shrink: 0;
}

.filter-toggle-slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    border-radius: 50%;
    transition: 0.25s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

.filter-toggle input:checked + .filter-toggle-slider {
    background-color: var(--primary-blue);
}

.filter-toggle input:checked + .filter-toggle-slider:before {
    transform: translateX(18px);
}

.filter-toggle-text {
    font-size: 0.8rem;
    font-weight: 700;
    color: #475569;
    white-space: nowrap;
}

.clear-filters-btn {
    background: #fee2e2;
    color: #b91c1c;
    border: none;
    padding: 7px 12px;
    border-radius: 9px;
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.clear-filters-btn:hover {
    background: #fecaca;
}

/* ==================== PESTAÑAS UNIFICADAS (TABS) ==================== */
.tabs-navigation-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-subtle);
    flex-wrap: wrap;
}

.tabs-navigation {
    display: flex;
    align-items: center;
    gap: 8px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 2px;
}

.tabs-navigation::-webkit-scrollbar {
    display: none;
}

.tab-btn {
    padding: 8px 16px;
    border: 1px solid var(--border-subtle);
    border-radius: 30px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 700;
    transition: all 0.2s;
    background: white;
    color: #475569;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.tab-btn:hover {
    background: #eff6ff;
    color: var(--primary-blue);
    border-color: #bfdbfe;
}

.tab-btn.active {
    background: var(--primary-blue);
    color: white;
    border-color: var(--primary-blue);
    box-shadow: 0 2px 6px rgba(29, 78, 216, 0.25);
}

.tab-emoji {
    font-size: 1rem;
}

.results-badge {
    font-size: 0.82rem;
    font-weight: 600;
    color: #64748b;
    background: #f8fafc;
    padding: 5px 12px;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    white-space: nowrap;
}

/* ==================== VISTA EN CUADRÍCULA (GRID) ==================== */
.products-container.view-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.product-card {
    background: white;
    border-radius: 18px;
    overflow: hidden;
    border: 1px solid #e2e8f0;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.03);
    transition: all 0.25s;
    display: flex;
    flex-direction: column;
}

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(15, 23, 42, 0.08);
    border-color: var(--primary-blue-soft);
}

.product-card.card-agotado {
    border-color: #fecaca;
    background: #fffafa;
}

.product-image-container {
    width: 100%;
    height: 250px;
    background: #f8fafc;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid #f1f5f9;
}

.product-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 10px;
    transition: transform 0.3s ease;
}

.product-card:hover .product-image {
    transform: scale(1.03);
}

.image-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f1f5f9;
    color: #94a3b8;
    font-size: 3rem;
}

.product-info {
    padding: 18px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.product-badges-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
}

.product-tag {
    display: inline-block;
    padding: 3px 9px;
    background: #eff6ff;
    color: var(--primary-blue);
    border-radius: 10px;
    font-size: 0.72rem;
    font-weight: 700;
}

.product-badge-agotado {
    display: inline-block;
    padding: 3px 9px;
    background: #fee2e2;
    color: #991b1b;
    border-radius: 10px;
    font-size: 0.72rem;
    font-weight: 700;
}

.product-name {
    font-size: 1.12rem;
    font-weight: 800;
    color: #0f172a;
    margin-bottom: 6px;
    line-height: 1.3;
}

.product-description {
    color: #64748b;
    font-size: 0.82rem;
    margin-bottom: 12px;
    line-height: 1.4;
}

/* Tallas */
.sizes-container {
    margin-bottom: 14px;
}

.sizes-label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    color: #475569;
}

.sizes-badges-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.size-badge {
    padding: 5px 10px;
    background: #f8fafc;
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.78rem;
    font-weight: 700;
    color: #334155;
    transition: all 0.15s;
}

.size-badge:hover {
    background: #eff6ff;
    border-color: var(--primary-blue);
    color: var(--primary-blue);
}

.size-badge.selected {
    background: var(--primary-blue);
    color: white;
    border-color: var(--primary-blue);
}

/* Pricing Breakdown */
.pricing-box {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 10px 12px;
    margin-top: auto;
    margin-bottom: 12px;
}

.pricing-standard {
    text-align: center;
}

.pricing-standard .price-label {
    font-size: 0.72rem;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
}

.pricing-standard .price-amount {
    font-size: 1.55rem;
    font-weight: 800;
    color: var(--primary-blue);
}

.pricing-breakdown {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.price-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
}

.price-row.cost-row {
    color: #64748b;
    font-weight: 600;
}

.price-row.profit-row {
    color: var(--primary-blue);
    font-weight: 700;
}

.profit-pill {
    background: #d1fae5;
    color: #065f46;
    padding: 2px 7px;
    border-radius: 6px;
    font-size: 0.75rem;
}

.price-row.pvp-row {
    padding-top: 5px;
    border-top: 1px dashed #cbd5e1;
    font-size: 0.88rem;
}

.pvp-label {
    font-weight: 800;
    color: #0f172a;
}

.pvp-value {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--primary-blue);
}

/* Botón de WhatsApp */
.whatsapp-btn {
    width: 100%;
    padding: 11px;
    background: #25D366;
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.92rem;
    font-weight: 700;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.whatsapp-btn:hover {
    background: #128C7E;
    transform: translateY(-2px);
}

.whatsapp-btn.btn-agotado {
    background: #64748b;
}

/* ==================== VISTA EN LISTA COMPACTA (LIST) ==================== */
.products-container.view-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.product-list-item {
    background: white;
    border-radius: 14px;
    padding: 12px 16px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.02);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    transition: all 0.2s;
}

.product-list-item:hover {
    border-color: #cbd5e1;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.05);
}

.product-list-item.card-agotado {
    background: #fffcfc;
    border-color: #fecaca;
}

.list-item-main {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.list-thumb {
    width: 62px;
    height: 62px;
    border-radius: 10px;
    object-fit: contain;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    flex-shrink: 0;
    padding: 3px;
}

.list-thumb-placeholder {
    width: 62px;
    height: 62px;
    border-radius: 10px;
    background: #f1f5f9;
    color: #94a3b8;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.list-info {
    min-width: 0;
    flex: 1;
}

.list-title-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
    flex-wrap: wrap;
}

.list-name {
    font-size: 0.98rem;
    font-weight: 800;
    color: #0f172a;
}

.list-sizes-row {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

.list-sizes-label {
    font-size: 0.72rem;
    font-weight: 700;
    color: #64748b;
    margin-right: 2px;
}

.list-item-footer {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-shrink: 0;
}

.list-pricing-box {
    text-align: right;
    min-width: 125px;
}

.list-cost {
    font-size: 0.78rem;
    color: #64748b;
    font-weight: 600;
}

.list-pvp {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--primary-blue);
}

.list-profit-tag {
    font-size: 0.72rem;
    font-weight: 700;
    color: #047857;
}

.list-action-btn {
    padding: 8px 14px;
    background: #25D366;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.list-action-btn:hover {
    background: #128C7E;
}

/* ==================== MENSAJES Y LOADING ==================== */
.no-results {
    grid-column: 1 / -1;
    text-align: center;
    padding: 45px 15px;
    background: #eff6ff;
    border-radius: 16px;
    color: var(--primary-blue);
    font-size: 0.95rem;
    font-weight: 600;
    border: 1px solid #bfdbfe;
}

.loading {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 15px;
    color: #64748b;
    font-size: 1rem;
    font-weight: 600;
}

/* ==================== OPTIMIZACIÓN MÓVIL (MOBILE-FIRST) ==================== */
@media (max-width: 768px) {
    body {
        padding: 10px 8px;
    }

    .portal-header {
        padding: 12px 14px;
        border-radius: 14px;
        margin-bottom: 10px;
    }

    .header-logo {
        width: 38px;
        height: 38px;
    }

    .header-titles h1 {
        font-size: 1.15rem;
    }

    .header-titles p {
        font-size: 0.75rem;
    }

    .badge-status {
        padding: 4px 10px;
        font-size: 0.72rem;
    }

    .margin-calculator-panel {
        padding: 12px 14px;
        border-radius: 14px;
        margin-bottom: 10px;
    }

    .calc-icon {
        width: 34px;
        height: 34px;
        font-size: 1.2rem;
    }

    .margin-calc-title h3 {
        font-size: 0.92rem;
    }

    .calc-subtitle {
        display: none; /* Ocultar subtítulo largo en móvil para ahorrar espacio */
    }

    .switch-label {
        font-size: 0.75rem;
    }

    .margin-controls {
        margin-top: 10px;
        padding-top: 10px;
    }

    .margin-presets-label {
        font-size: 0.75rem;
    }

    .margin-preset-btn {
        padding: 5px 9px;
        font-size: 0.76rem;
    }

    .toolbar-section {
        padding: 12px 14px;
        border-radius: 14px;
        margin-bottom: 12px;
    }

    .search-bar-row {
        margin-bottom: 10px;
        gap: 8px;
    }

    .search-box {
        padding: 10px 12px 10px 36px;
        font-size: 0.85rem;
    }

    .search-icon {
        left: 12px;
        font-size: 0.9rem;
    }

    .view-toggle-btn {
        padding: 6px 9px;
        font-size: 0.78rem;
    }

    .view-text {
        display: none; /* En celular solo muestra el icono 🔲 / ☰ */
    }

    /* Pestañas en celular: deslizamiento horizontal fluido */
    .tabs-navigation-wrapper {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
        padding-top: 10px;
    }

    .tabs-navigation {
        width: 100%;
        padding-bottom: 4px;
    }

    .tab-btn {
        padding: 6px 12px;
        font-size: 0.8rem;
    }

    .results-badge {
        text-align: center;
        font-size: 0.75rem;
        padding: 4px 8px;
    }

    /* Cuadrícula en celular */
    .products-container.view-grid {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .product-image-container {
        height: 220px;
    }

    .product-info {
        padding: 14px;
    }

    .product-name {
        font-size: 1.05rem;
    }

    /* Lista compacta en celular */
    .product-list-item {
        flex-direction: column;
        align-items: stretch;
        padding: 12px;
        gap: 10px;
    }

    .list-item-main {
        gap: 10px;
    }

    .list-thumb, .list-thumb-placeholder {
        width: 55px;
        height: 55px;
    }

    .list-name {
        font-size: 0.92rem;
    }

    .list-item-footer {
        justify-content: space-between;
        border-top: 1px solid #f1f5f9;
        padding-top: 8px;
        gap: 8px;
    }

    .list-pricing-box {
        text-align: left;
        min-width: 0;
    }

    .list-pvp {
        font-size: 1.08rem;
    }

    .list-action-btn {
        padding: 7px 12px;
        font-size: 0.78rem;
    }
}

/* ==================== FILTROS EN MÓVIL ==================== */
@media (max-width: 640px) {
    .filters-row {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 10px;
        align-items: center;
    }

    /* El selector "Ordenar" ocupa toda la primera fila */
    .filters-row > .filter-group:first-child {
        grid-column: 1 / -1;
    }

    .filter-group {
        min-width: 0;
    }

    .filter-select {
        flex: 1;
        min-width: 0;
        width: 100%;
        font-size: 0.78rem;
        padding: 6px 8px;
    }

    /* "Solo disponibles" a la izquierda */
    .filter-toggle {
        justify-self: start;
        gap: 7px;
    }

    .filter-toggle-text {
        font-size: 0.78rem;
        white-space: normal;
    }

    /* Botón "Limpiar filtros" a la derecha, misma fila */
    .clear-filters-btn {
        justify-self: end;
        padding: 7px 12px;
    }

    .install-btn {
        font-size: 0.72rem;
        padding: 6px 10px;
    }

    .logout-catalog-btn {
        font-size: 0.72rem;
        padding: 6px 10px;
    }
}

/* ==================== LOGIN EN LA RAÍZ (CATÁLOGO) ==================== */
.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 45%, #f8fafc 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 9000;
}

.login-card {
    background: white;
    width: 100%;
    max-width: 420px;
    border-radius: 24px;
    padding: 40px 32px;
    box-shadow: 0 25px 60px -12px rgba(29, 78, 216, 0.28);
    border: 1px solid var(--border-subtle);
    text-align: center;
    animation: loginFadeIn 0.3s ease;
}

.login-header .login-logo {
    width: 90px;
    height: 90px;
    object-fit: contain;
    margin: 0 auto 16px;
    border-radius: 16px;
    box-shadow: 0 12px 30px rgba(29, 78, 216, 0.18);
    border: 1px solid var(--border-subtle);
}

.login-header h2 {
    font-size: 1.55rem;
    color: #1e293b;
    margin-bottom: 8px;
}

.login-header p {
    color: #64748b;
    font-size: 0.9rem;
    margin-bottom: 24px;
    line-height: 1.4;
}

.login-error {
    background: #fee2e2;
    color: #991b1b;
    padding: 12px 14px;
    border-radius: 12px;
    margin-bottom: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    border: 1px solid #fecaca;
    text-align: left;
}

.login-card .form-group {
    text-align: left;
    margin-bottom: 18px;
}

.login-card label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #374151;
    font-size: 0.88rem;
}

.login-card input {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-size: 0.95rem;
    font-family: inherit;
    background: white;
    transition: all 0.2s;
}

.login-card input:focus {
    outline: none;
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.12);
}

.login-btn {
    width: 100%;
    padding: 13px;
    margin-top: 6px;
    background: var(--primary-blue);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.25s;
    box-shadow: 0 4px 15px rgba(29, 78, 216, 0.3);
}

.login-btn:hover {
    background: var(--primary-blue-dark);
    transform: translateY(-2px);
}

.login-btn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
    transform: none;
}

.login-help {
    margin-top: 18px;
    font-size: 0.8rem;
    color: #94a3b8;
}

@keyframes loginFadeIn {
    from {
        opacity: 0;
        transform: translateY(14px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ==================== PANTALLA DE VERIFICACIÓN DE ACCESO ==================== */
.auth-loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    z-index: 9500;
}

.auth-loading p {
    color: #64748b;
    font-weight: 600;
    font-size: 0.95rem;
}

.auth-spinner {
    width: 44px;
    height: 44px;
    border: 4px solid #dbeafe;
    border-top-color: var(--primary-blue, #1D4ED8);
    border-radius: 50%;
    animation: authSpin 0.8s linear infinite;
}

@keyframes authSpin {
    to { transform: rotate(360deg); }
}
