/* === Reset & Base === */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --color-primary: #0C4DA2;
    --color-primary-dark: #093a7a;
    --color-primary-light: #e8f0fc;
    --color-primary-hover: #d4e4f7;
    --color-header-bg: #ffffff;
    --color-nav-bg: #373737;
    --color-accent-green: #28a745;
    --color-price: #c8a415;
    --color-text: #373737;
    --color-text-light: #666;
    --color-text-muted: #999;
    --color-border: #e0e0e0;
    --color-border-soft: var(--color-border-soft);
    --color-bg: #f4f6f9;
    --color-white: #fff;
    --color-surface: #ffffff;
    --color-surface-2: var(--color-surface-2);
    --color-on-primary: #ffffff;
    --color-overlay: rgba(0,0,0,0.5);
    --color-overlay-hover: rgba(0,0,0,0.08);
    --color-stock-ok: #28a745;
    --color-stock-low: #e67e22;
    --color-stock-no: #dc3545;
    --color-offer: #e53935;
    --color-category-bg: #f5c518;
    --color-category-text: #333;
    --font-family: 'Nunito', 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
    --shadow-card: 0 1px 4px rgba(12,77,162,0.08);
    --shadow-card-hover: 0 6px 20px rgba(12,77,162,0.15);
    --radius: 6px;
    --radius-lg: 10px;
    --radius-pill: 9999px;
}

[data-theme="oscuro"] {
    --color-bg: #1a1d23;
    --color-surface: #242830;
    --color-surface-2: #2c313a;
    --color-white: #242830;
    --color-text: #e6e8eb;
    --color-text-light: #b0b4ba;
    --color-text-muted: #7d8189;
    --color-border: #3a3f48;
    --color-border-soft: #2c313a;
    --color-primary: #4d8fe0;
    --color-primary-dark: #6ba3e8;
    --color-primary-light: #1f2a3a;
    --color-primary-hover: #2a3a52;
    --color-header-bg: #1f232a;
    --color-nav-bg: #14171c;
    --color-overlay: rgba(0,0,0,0.7);
    --color-overlay-hover: rgba(255,255,255,0.08);
    --shadow-card: 0 1px 4px rgba(0,0,0,0.4);
    --shadow-card-hover: 0 6px 20px rgba(0,0,0,0.55);
}

[data-theme="contrastado"] {
    --color-bg: #ffffff;
    --color-surface: #ffffff;
    --color-surface-2: #ffffff;
    --color-text: #000000;
    --color-text-light: #000000;
    --color-text-muted: #222222;
    --color-border: #000000;
    --color-border-soft: #000000;
    --color-primary: #003a8c;
    --color-primary-dark: #002966;
    --color-primary-light: #ffffff;
    --color-primary-hover: #d6e4f5;
    --color-header-bg: #000000;
    --color-nav-bg: #000000;
    --shadow-card: none;
    --shadow-card-hover: 0 0 0 2px #000000;
}

[data-theme="grises"] {
    --color-primary: #555555;
    --color-primary-dark: #333333;
    --color-primary-light: #ececec;
    --color-primary-hover: #dddddd;
    --color-accent-green: #6b6b6b;
    --color-price: #404040;
    --color-stock-ok: #555555;
    --color-stock-low: #888888;
    --color-stock-no: #2a2a2a;
    --color-offer: #2a2a2a;
    --color-category-bg: #d0d0d0;
    --color-header-bg: #ffffff;
    --color-nav-bg: #2a2a2a;
    --shadow-card: 0 1px 4px rgba(0,0,0,0.08);
    --shadow-card-hover: 0 6px 20px rgba(0,0,0,0.18);
}

[data-theme="vivos"] {
    --color-bg: #fffaf0;
    --color-surface: #ffffff;
    --color-surface-2: #fff5e0;
    --color-text: #2a1a05;
    --color-text-light: #6b4a1a;
    --color-text-muted: #a37a3a;
    --color-border: #ffd9a8;
    --color-border-soft: #ffe9c4;
    --color-primary: #ff8c00;
    --color-primary-dark: #cc6a00;
    --color-primary-light: #fff0d6;
    --color-primary-hover: #ffd9a8;
    --color-accent-green: #84cc16;
    --color-price: #d97706;
    --color-stock-ok: #84cc16;
    --color-stock-low: #facc15;
    --color-stock-no: #ef4444;
    --color-offer: #ef4444;
    --color-category-bg: #fde047;
    --color-category-text: #2a1a05;
    --color-header-bg: #ffffff;
    --color-nav-bg: #2a1a05;
    --shadow-card: 0 1px 6px rgba(255,140,0,0.18);
    --shadow-card-hover: 0 8px 24px rgba(255,140,0,0.32);
}

[data-theme="pastel"] {
    --color-bg: #faf6f2;
    --color-surface: #ffffff;
    --color-surface-2: #fbf7f3;
    --color-text: #4a4458;
    --color-text-light: #6f6886;
    --color-text-muted: #a39db3;
    --color-border: #e6dfd5;
    --color-border-soft: #f2ece2;
    --color-primary: #8aa9d4;
    --color-primary-dark: #6b8cb8;
    --color-primary-light: #e5edfa;
    --color-primary-hover: #d5e1f1;
    --color-accent-green: #8ccfb1;
    --color-price: #c4a361;
    --color-stock-ok: #8ccfb1;
    --color-stock-low: #f0b48f;
    --color-stock-no: #e69a9a;
    --color-offer: #d99eb8;
    --color-category-bg: #f5e4b8;
    --color-category-text: #4a4458;
    --color-header-bg: #f1ebf5;
    --color-nav-bg: #7f7392;
    --shadow-card: 0 1px 4px rgba(138,169,212,0.12);
    --shadow-card-hover: 0 6px 20px rgba(138,169,212,0.22);
}

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: var(--font-family);
    color: var(--color-text);
    background: var(--color-bg);
    line-height: 1.5;
    font-size: 14px;
    display: flex;
    flex-direction: column;
}

/* === Header === */
.app-header {
    background: var(--color-header-bg);
    color: var(--color-text);
    border-bottom: 3px solid var(--color-primary);
    flex-shrink: 0;
}

.header-top {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 10px 24px;
}

.header-logo {
    display: flex;
    align-items: center;
    flex: 0 0 auto;
    cursor: pointer;
}

.header-logo img {
    height: 50px;
    width: auto;
    display: block;
}

.header-banner {
    flex: 0 0 60%;
    margin: 0 auto;
    display: flex;
    justify-content: center;
}

.header-banner img {
    width: 100%;
    height: auto;
    max-height: 80px;
    border-radius: var(--radius);
    display: block;
}

/* Banner dinámico (carpeta CMS "BANNERS"): carrusel de desplazamiento horizontal
   dentro de la misma caja (.header-banner, 60% / max 80px). Un track flex se
   traslada con translateX(-idx*100%); flechas izq/dcha que aparecen al hover.
   Lo rellena loadHeaderBanners()/wireHeaderBanner() en app.js. */
.header-banner-slides {
    position: relative;
    width: 100%;
    height: 80px;
    overflow: hidden;
    border-radius: var(--radius);
}

.header-banner-track {
    display: flex;
    height: 100%;
    width: 100%;
    transition: transform .5s ease;
    /* transform: translateX(-idx*100%) lo fija wireHeaderBanner() en línea */
}

.header-banner-slide {
    flex: 0 0 100%;
    width: 100%;
    height: 100%;
    background-position: center;
    background-repeat: no-repeat;
    background-size: contain;
    cursor: pointer;
}

/* Flechas de navegación manual: ocultas hasta pasar el ratón por el banner. */
.header-banner-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    width: 30px;
    height: 30px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, .45);
    color: #fff;
    font-size: 20px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: opacity .2s ease, background .2s ease;
}

.header-banner-slides:hover .header-banner-arrow {
    opacity: 1;
}

.header-banner-arrow:hover {
    background: rgba(0, 0, 0, .7);
}

.header-banner-arrow.prev {
    left: 8px;
}

.header-banner-arrow.next {
    right: 8px;
}

.header-tabs {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 6px 24px;
    border-top: 1px solid var(--color-border-soft);
}

.tab-nav {
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
}

/* Botones-logo de marca (Covaldroper / Tien 21 / Ofifast / Cisval).
   Sin recuadro; altura igual a la de los .tab-button (14px × line-height 1.5 = 21px
   de texto + 10px de padding = 31px). position:relative ancla el tooltip ::after. */
.tab-brand {
    position: relative;
    display: inline-flex;
    align-items: center;
    padding: 0;
    transition: opacity 0.2s;
}

.tab-brand img {
    height: 31px;
    width: auto;
    display: block;
}

/* Solo se atenúa el logo, no el grupo entero: opacity sobre el <a> crearía un
   grupo de opacidad que rebajaría también el tooltip ::after. */
.tab-brand:hover img {
    opacity: 0.8;
}

/* Tooltip estilado (data-tooltip → ::after). Aparece debajo del logo; el header
   no tiene overflow:hidden, así que se ve sobre la página. Theme-aware vía vars. */
.tab-brand[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-top: 8px;
    padding: 4px 8px;
    font-size: 12px;
    white-space: nowrap;
    border-radius: var(--radius);
    background: var(--color-surface);
    color: var(--color-text);
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-card-hover);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    z-index: 1000;
    transition: opacity 0.15s;
}

.tab-brand[data-tooltip]:hover::after,
.tab-brand[data-tooltip]:focus-visible::after {
    opacity: 1;
    visibility: visible;
}

/* Necesario para que el atributo `hidden` (applyGroupMenus, tope 'brands') oculte el
   logo: la regla .tab-brand{display:inline-flex} de autor gana a la UA [hidden]{display:none}.
   Especificidad (0,2,0) > .tab-brand (0,1,0), así que no hace falta !important. */
.tab-brand[hidden] {
    display: none;
}

.tab-button {
    padding: 5px 18px;
    border: none;
    border-radius: var(--radius-pill);
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    cursor: pointer;
    background: var(--color-border-soft);
    color: var(--color-text-muted);
    transition: background 0.2s, color 0.2s;
    white-space: nowrap;
    font-family: inherit;
    letter-spacing: 0.6px;
}

.tab-button:hover {
    background: #e0e0e0;
}

.tab-button.active {
    background: var(--color-accent-green);
    color: var(--color-white);
}

.tab-button.active:hover {
    background: #219a38;
}

/* page-almacen es hijo directo de <body> (display:flex, columna) junto a .app-header.
   Sin esto, su altura es auto y .main-layout > .content no puede hacer overflow-y:auto. */
#page-almacen {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}
#page-almacen[hidden] {
    display: none;
}

/* === Placeholder de pestañas en construcción === */
.tab-placeholder {
    max-width: 720px;
    margin: 60px auto;
    padding: 32px;
    text-align: center;
    background: var(--color-header-bg);
    border: 1px dashed var(--color-border-soft);
    border-radius: var(--radius);
}

.tab-placeholder h2 {
    margin: 0 0 12px;
    color: var(--color-primary);
    font-size: 22px;
    font-weight: 700;
}

.tab-placeholder p {
    margin: 0;
    color: var(--color-text-muted);
    font-size: 14px;
}

/* === Nav bar === */
.nav-bar {
    background: var(--color-nav-bg);
    padding: 0 20px;
    display: flex;
    align-items: center;
    gap: 2px;
    overflow-x: auto;
    flex-shrink: 0;
}

.nav-bar a {
    color: var(--color-white);
    text-decoration: none;
    padding: 10px 14px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    white-space: nowrap;
    transition: background 0.2s;
    letter-spacing: 0.3px;
}

.nav-bar a:hover,
.nav-bar a.active {
    background: var(--color-primary);
    border-radius: var(--radius) var(--radius) 0 0;
}

/* Boletines destacado en rojo y negrita */
#nav-boletines {
    color: #e11d1d;
    font-weight: 800;
}
#nav-boletines:hover,
#nav-boletines.active {
    color: var(--color-white);
}

/* === Layout === */
.main-layout {
    display: flex;
    width: 100%;
    padding: 15px;
    gap: 15px;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

/* === Sidebar === */
.sidebar {
    width: 260px;
    flex-shrink: 0;
    overflow-y: auto;
}

.main-layout.filters-hidden .sidebar {
    display: none;
}

.btn-filtros-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 16px;
    border: 2px solid var(--color-border);
    border-radius: var(--radius-pill);
    background: var(--color-primary-light);
    color: var(--color-primary);
    font-family: var(--font-family);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s, border-color 0.2s;
}

.btn-filtros-toggle:hover {
    background: var(--color-primary-hover);
}

.btn-filtros-toggle[aria-expanded="false"] {
    background: var(--color-white);
    color: var(--color-text-muted);
}

.btn-filtros-toggle.has-active-filters {
    background: var(--color-primary);
    color: var(--color-white);
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(12, 77, 162, 0.18);
}

.btn-filtros-toggle.has-active-filters:hover {
    background: var(--color-primary-dark);
}

.btn-filtros-toggle svg {
    width: 16px;
    height: 16px;
}

.btn-clear-filters {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 50%;
    color: #000;
    padding: 0;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.btn-clear-filters:hover {
    background: var(--color-overlay-hover);
}

.btn-clear-filters svg {
    width: 20px;
    height: 20px;
    display: block;
}

/* === Facet groups === */
.facet-group {
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-top: none;
}

.facet-group:first-child {
    border-top: 1px solid var(--color-border);
    border-radius: var(--radius) var(--radius) 0 0;
}

.facet-group:last-child {
    border-radius: 0 0 var(--radius) var(--radius);
}

.facet-group:only-child {
    border-radius: var(--radius);
}

.facet-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 14px;
    cursor: pointer;
    user-select: none;
    transition: background 0.15s;
    border-bottom: 1px solid var(--color-border);
    background: var(--color-primary-dark);
}

.facet-header:hover {
    background: var(--color-primary);
}

.facet-label {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--color-white);
    letter-spacing: 0.3px;
}

.facet-chevron {
    font-size: 10px;
    color: rgba(255,255,255,0.7);
}

.facet-values {
    max-height: 220px;
    overflow-y: auto;
}

.facet-value {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 14px;
    cursor: pointer;
    transition: background 0.1s;
    border-bottom: 1px solid var(--color-border-soft);
}

.facet-value:hover {
    background: var(--color-primary-light);
}

.facet-value.active {
    background: var(--color-primary-light);
    color: var(--color-primary);
    font-weight: 600;
}

.facet-value-name {
    font-size: 12px;
    color: inherit;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    min-width: 0;
}

.facet-value-count {
    font-size: 10px;
    color: var(--color-text-muted);
    background: var(--color-border-soft);
    padding: 1px 7px;
    border-radius: 10px;
    margin-left: 6px;
    flex-shrink: 0;
}

.facet-value.active .facet-value-count {
    background: var(--color-primary);
    color: var(--color-white);
}

/* === Active filter chips === */
.active-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
}

.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: var(--color-primary-light);
    color: var(--color-primary);
    padding: 4px 10px;
    border-radius: var(--radius-pill);
    font-size: 12px;
    font-weight: 600;
    cursor: default;
}

.chip-remove {
    cursor: pointer;
    font-size: 14px;
    font-weight: 700;
    line-height: 1;
    opacity: 0.7;
    transition: opacity 0.15s;
}

.chip-remove:hover {
    opacity: 1;
}

/* === Content area === */
.content {
    flex: 1;
    min-width: 0;
    overflow-y: auto;
}

/* === Search bar === */
.toolbar-sticky {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--color-bg);
    padding-bottom: 10px;
}

.search-bar-container {
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 12px 15px;
    margin-bottom: 12px;
}

.search-bar-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

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

.search-input-wrapper .search-icon {
    position: absolute;
    left: 12px;
    color: var(--color-text-muted);
    width: 18px;
    height: 18px;
    pointer-events: none;
}

.search-input {
    width: 100%;
    padding: 11px 44px 11px 42px;
    border: 2px solid var(--color-border);
    border-radius: var(--radius-pill);
    font-size: 14px;
    font-family: var(--font-family);
    outline: none;
    transition: border-color 0.2s;
}

.search-input:focus {
    border-color: var(--color-primary);
}

.search-input::placeholder {
    color: var(--color-text-muted);
}

.btn-search {
    background: var(--color-primary);
    color: var(--color-white);
    border: none;
    padding: 11px 28px;
    border-radius: var(--radius-pill);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    white-space: nowrap;
    letter-spacing: 0.3px;
}

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

.btn-search:active {
    transform: translateY(0);
}

/* === Results header === */
.results-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--color-border);
    font-size: 13px;
    color: var(--color-text-light);
}

.results-header .results-count {
    font-weight: 600;
    color: var(--color-text);
}

.results-header .results-count strong {
    color: var(--color-primary);
}

.results-header .results-time {
    font-size: 12px;
    color: var(--color-text-muted);
}

.view-toggle {
    display: flex;
    gap: 4px;
}

.view-toggle button {
    background: var(--color-white);
    border: 1px solid var(--color-border);
    padding: 6px 10px;
    cursor: pointer;
    border-radius: var(--radius);
    color: var(--color-text-muted);
    transition: all 0.15s;
    display: flex;
    align-items: center;
}

.view-toggle button.active,
.view-toggle button:hover {
    background: var(--color-primary);
    color: var(--color-white);
    border-color: var(--color-primary);
}

.sort-select {
    background: var(--color-white);
    border: 1px solid var(--color-border);
    padding: 6px 28px 6px 10px;
    border-radius: var(--radius);
    font-size: 12px;
    font-family: var(--font-family);
    font-weight: 600;
    color: var(--color-text);
    cursor: pointer;
    outline: none;
    transition: border-color 0.2s;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
}

.sort-select:hover {
    border-color: var(--color-primary);
}

.sort-select:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px rgba(12, 77, 162, 0.15);
}

.toolbar-separator {
    width: 1px;
    height: 20px;
    background: var(--color-border);
    margin: 0 4px;
    align-self: center;
}

.products-grid.stock-only .product-card.no-stock-card {
    display: none;
}

.products-grid.hide-prices .product-precio {
    visibility: hidden;
}

.product-modal-overlay.hide-prices .modal-price-box {
    visibility: hidden;
}

.product-modal-overlay.hide-prices .modal-price-taxes {
    visibility: hidden;
}

.product-modal-overlay.hide-prices .modal-tab[data-tab="precios"] {
    display: none;
}

/* Cuando se ocultan los precios pero el artículo tiene PVP, mostrar SOLO el PVP
   en grande. Se usa `display:none` en los hermanos (no `visibility:hidden`) para
   que el PVP arranque pegado a la izquierda en todas las cards y quede alineado
   columna a columna — con visibility los hermanos seguían ocupando su espacio y
   los PVPs aparecían en posiciones X distintas según qué hermano tuviera cada
   card. El tag "PVP" va en su propio span (.precio-pvp-tag) para poder darle un
   tamaño menor que los dígitos. */
.products-grid.hide-prices .product-precio > .precio-valor,
.products-grid.hide-prices .product-precio > .precio-tachado,
.products-grid.hide-prices .product-precio > .precio-unidad {
    display: none;
}
.products-grid.hide-prices .product-precio .precio-pvp {
    visibility: visible;
    font-size: 22px;
    font-weight: 800;
    color: var(--color-text);
    letter-spacing: 0;
}
.products-grid.hide-prices .product-precio .precio-pvp .precio-pvp-tag {
    font-size: 0.6em;
    font-weight: 700;
    opacity: 0.7;
}

.product-modal-overlay.hide-prices .modal-price-box h4,
.product-modal-overlay.hide-prices .modal-price-box .modal-price-tachado,
.product-modal-overlay.hide-prices .modal-price-box .modal-price-main,
.product-modal-overlay.hide-prices .modal-price-box .modal-price-unit {
    display: none;
}
.product-modal-overlay.hide-prices .modal-price-box .modal-price-pvp {
    visibility: visible;
    font-size: 24px;
    font-weight: 800;
    color: var(--color-text);
    margin-left: 0;
    letter-spacing: 0;
}
.product-modal-overlay.hide-prices .modal-price-box .modal-price-pvp .modal-price-pvp-tag {
    font-size: 0.6em;
    font-weight: 700;
    opacity: 0.7;
}

/* === Product Grid === */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 12px;
}

.products-grid.list-view {
    grid-template-columns: 1fr;
}

/* === Product Card === */
.product-card {
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: box-shadow 0.2s;
    display: flex;
    flex-direction: column;
    cursor: pointer;
    position: relative;
}

.product-card:hover {
    box-shadow: var(--shadow-card-hover);
}

/* --- Image --- */
.product-card-image {
    width: 100%;
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-surface-2);
    border-bottom: 1px solid var(--color-border-soft);
    padding: 15px;
}

.product-card-image svg {
    width: 80px;
    height: 80px;
    color: #ddd;
}

.product-card-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* --- Body --- */
.product-card-body {
    padding: 12px 15px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.product-marca {
    font-size: 12px;
    font-weight: 800;
    color: var(--color-primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* --- Brand logo --- */
.marca-logo {
    height: 32px;
    width: auto;
    max-width: 100px;
    object-fit: contain;
    vertical-align: middle;
    margin-right: 4px;
}

.modal-marca-logo {
    height: 64px;
    max-width: 160px;
}

.product-nombre {
    font-size: 13px;
    font-weight: 700;
    color: var(--color-text);
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-categoria {
    margin-top: 4px;
}

.product-categoria span {
    background: var(--color-category-bg);
    color: var(--color-category-text);
    padding: 2px 10px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* --- Copyable codes feedback --- */
.copyable {
    cursor: pointer;
    transition: background 0.15s;
}

.copyable:hover {
    background: #d0d0d0;
}

.copyable.copied {
    background: #c8e6c9;
}

.copyable.copied::after {
    content: ' \2713';
    color: var(--color-stock-ok);
    font-weight: 700;
}

.copy-toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: #323232;
    color: #fff;
    padding: 10px 22px;
    border-radius: 8px;
    font-size: 0.9rem;
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.25s, transform 0.25s;
    pointer-events: none;
    box-shadow: 0 4px 16px rgba(0,0,0,0.25);
}

.copy-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* --- Codes (ID + GTIN) --- */
.product-codes {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
    flex-wrap: wrap;
}

.product-code,
.product-gtin {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: var(--color-text);
    background: #e8e8e8;
    padding: 3px 8px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-weight: 700;
}

.product-code svg,
.product-gtin svg {
    flex-shrink: 0;
    color: var(--color-text-light);
}

/* --- Footer --- */
.product-card-footer {
    padding: 12px 15px;
    border-top: 1px solid var(--color-border-soft);
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: auto;
}

/* --- Price --- */
.product-precio {
    display: flex;
    align-items: baseline;
    gap: 4px;
    flex-wrap: wrap;
}

.product-precio .precio-valor {
    font-size: 28px;
    font-weight: 800;
    color: #111;
}

.product-precio .precio-cents {
    font-size: 18px;
    font-weight: 700;
}

.product-precio .precio-unidad {
    font-size: 12px;
    font-weight: 400;
    color: var(--color-text-muted);
}

.product-precio .precio-tachado {
    font-size: 14px;
    font-weight: 400;
    color: var(--color-text-muted);
    text-decoration: line-through;
}

/* PVP de referencia (solo cuando hay oferta): al lado del precio del socio,
   más pequeño y en gris para no competir visualmente. */
.product-precio .precio-pvp {
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text-muted);
    letter-spacing: 0.2px;
}

/* Cuando el artículo está en oferta el precio destacado va en rojo, haya o no
   precio tachado (también cuando el precio de oferta iguala al de tarifa). */
.product-precio:has(.precio-tachado) .precio-valor,
.product-precio:has(.precio-tachado) .precio-cents,
.product-precio.en-oferta .precio-valor,
.product-precio.en-oferta .precio-cents {
    color: #dc2626;
}

/* --- Master box --- */
.product-masterbox {
    font-size: 10px;
    font-weight: 700;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* --- Order (qty + button) --- */
.product-order {
    display: flex;
    align-items: center;
    gap: 6px;
}

.order-qty {
    width: 60px;
    padding: 6px 4px 6px 10px;
    border: 2px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 13px;
    font-family: var(--font-family);
    font-weight: 600;
    text-align: center;
    outline: none;
    transition: border-color 0.2s;
    -moz-appearance: textfield;
}

.order-qty::-webkit-inner-spin-button,
.order-qty::-webkit-outer-spin-button {
    opacity: 1;
}

.order-qty:focus {
    border-color: var(--color-accent-green);
}

.btn-add {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 7px 14px;
    background: var(--color-accent-green);
    color: var(--color-white);
    border: none;
    border-radius: var(--radius);
    font-size: 12px;
    font-weight: 700;
    font-family: var(--font-family);
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: background 0.2s, transform 0.1s;
}

.btn-add:hover {
    background: #219a38;
    transform: translateY(-1px);
}

.btn-add:active {
    transform: translateY(0);
}

.btn-add svg {
    flex-shrink: 0;
}

/* --- Stock --- */
.product-stock {
    font-size: 14px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 3px;
    text-align: center;
}

.product-stock.in-stock {
    color: var(--color-stock-ok);
    background: #e8f5e9;
}

.product-stock.no-stock {
    color: var(--color-stock-no);
    background: #ffebee;
}

.product-stock .stock-num {
    font-size: 22px;
    font-weight: 800;
    line-height: 1;
    vertical-align: middle;
}

/* === Product Card (List view) === */
.products-grid.list-view .product-card {
    flex-direction: row;
}

.products-grid.list-view .product-card-image {
    width: 160px;
    height: 140px;
    flex-shrink: 0;
    border-bottom: none;
    border-right: 1px solid var(--color-border-soft);
}

.products-grid.list-view .product-card-image svg {
    width: 50px;
    height: 50px;
}

.products-grid.list-view .product-card-body {
    flex: 1;
    padding: 12px 15px;
}

.products-grid.list-view .product-card-footer {
    border-top: none;
    border-left: 1px solid var(--color-border-soft);
    justify-content: center;
    padding: 12px 20px;
    min-width: 200px;
}

/* === Infinite scroll === */
#scroll-sentinel {
    height: 1px;
}

.loading-more {
    grid-column: 1 / -1;
    text-align: center;
    padding: 20px;
    color: var(--color-text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

/* === Loading === */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: var(--color-text-muted);
    gap: 10px;
}

.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--color-border);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* === Empty state === */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--color-text-muted);
}

.empty-state svg {
    width: 64px;
    height: 64px;
    margin-bottom: 15px;
    color: #ddd;
}

.empty-state h3 {
    font-size: 16px;
    color: var(--color-text-light);
    margin-bottom: 5px;
}

.empty-state p {
    font-size: 13px;
}

/* === Product Modal === */
.product-modal-overlay {
    position: fixed;
    inset: 0;
    background: var(--color-overlay);
    z-index: 1000;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 40px 20px 20px;
}

.product-modal {
    background: var(--color-white);
    border-radius: var(--radius-lg);
    max-width: 900px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    position: relative;
    animation: modalIn 0.2s ease-out;
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.95) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: var(--color-primary);
    color: var(--color-white);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    position: sticky;
    top: 0;
    z-index: 2;
}

.modal-header h2 {
    font-size: 15px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.modal-close {
    background: none;
    border: none;
    color: var(--color-white);
    font-size: 24px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    opacity: 0.8;
    transition: opacity 0.15s;
}

.modal-close:hover {
    opacity: 1;
}

/* Top section: image + info */
.modal-top {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 20px;
    padding: 20px;
    border-bottom: 1px solid var(--color-border);
}

.modal-image {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-surface-2);
    border-radius: var(--radius);
    border: 1px solid var(--color-border-soft);
    padding: 15px;
    min-height: 250px;
}

.modal-image-download {
    position: absolute;
    bottom: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.65);
    border: 1px solid rgba(0, 0, 0, 0.75);
    border-radius: 6px;
    color: #fff;
    cursor: pointer;
    padding: 0;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.modal-image-download:hover {
    background: #000;
    border-color: #000;
    color: #fff;
}

.modal-image-download:disabled {
    opacity: 0.5;
    cursor: wait;
}

.modal-image img {
    max-width: 100%;
    max-height: 250px;
    object-fit: contain;
}

.modal-image svg {
    width: 100px;
    height: 100px;
    color: #ddd;
}

.modal-info {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.modal-info .product-marca {
    font-size: 13px;
}

.modal-info .product-nombre {
    font-size: 16px;
    -webkit-line-clamp: unset;
    overflow: visible;
}

.modal-info .product-categoria {
    margin-bottom: 6px;
}

.modal-codes {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 4px;
}

.modal-codes .code-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: var(--color-text);
    background: var(--color-border-soft);
    padding: 4px 10px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-weight: 600;
}

.modal-codes .code-label {
    font-family: var(--font-family);
    font-weight: 700;
    color: var(--color-text-light);
    font-size: 10px;
    text-transform: uppercase;
}

.modal-ventas {
    margin-top: 6px;
    font-size: 16.8px;
    color: var(--color-text-light);
}

/* Price + Order boxes */
.modal-boxes {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    padding: 0 20px;
    margin: -1px 0 0 0;
}

.modal-price-box,
.modal-order-box {
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 14px 16px;
    background: #fafcff;
}

.modal-price-box h4,
.modal-order-box h4 {
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-text-muted);
    margin-bottom: 8px;
}

.modal-price-box .modal-price-main {
    font-size: 28px;
    font-weight: 800;
    color: #111;
}

.modal-price-box .modal-price-main .modal-price-cents {
    font-size: 18px;
}

.modal-price-box .modal-price-unit {
    font-size: 13px;
    color: var(--color-text-muted);
    font-weight: 400;
}

.modal-price-box .modal-price-tachado {
    font-size: 14px;
    color: var(--color-text-muted);
    text-decoration: line-through;
    margin-right: 6px;
}

/* PVP de referencia en el modal (mismo criterio que la card). */
.modal-price-box .modal-price-pvp {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text-muted);
    margin-left: 8px;
    letter-spacing: 0.2px;
}

/* Cuando el artículo está en oferta el precio destacado va en rojo, haya o no
   precio tachado (mismo criterio que la card). */
.modal-price-box:has(.modal-price-tachado) .modal-price-main,
.modal-price-box:has(.modal-price-tachado) .modal-price-main .modal-price-cents,
.modal-price-box.en-oferta .modal-price-main,
.modal-price-box.en-oferta .modal-price-main .modal-price-cents {
    color: #dc2626;
}

.modal-price-box .modal-price-taxes {
    font-size: 12px;
    color: var(--color-text-light);
    margin-top: 4px;
}

.modal-order-box .modal-order-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.modal-order-box .modal-order-qty {
    width: 70px;
    padding: 8px 4px 8px 12px;
    border: 2px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 14px;
    font-family: var(--font-family);
    font-weight: 600;
    text-align: center;
    outline: none;
}

.modal-order-box .modal-order-qty:focus {
    border-color: var(--color-accent-green);
}

.modal-order-box .modal-btn-add {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 16px;
    background: var(--color-accent-green);
    color: var(--color-white);
    border: none;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 700;
    font-family: var(--font-family);
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: background 0.2s;
}

.modal-order-box .modal-btn-add:hover {
    background: #219a38;
}

.modal-order-box .modal-order-info {
    font-size: 11px;
    color: var(--color-text-light);
    line-height: 1.6;
}

/* Stock indicator */
.modal-stock {
    padding: 0 20px;
    margin-top: 12px;
}

.modal-stock-badge {
    display: inline-block;
    font-size: 13px;
    font-weight: 700;
    padding: 6px 14px;
    border-radius: var(--radius);
}

.modal-stock-badge.in-stock {
    color: var(--color-stock-ok);
    background: #e8f5e9;
}

.modal-stock-badge.no-stock {
    color: var(--color-stock-no);
    background: #ffebee;
}

.modal-stock-badge .stock-num {
    font-size: 28px;
    font-weight: 800;
    line-height: 1;
    vertical-align: middle;
}

/* Tabs */
.modal-tabs {
    display: flex;
    border-bottom: 2px solid var(--color-border);
    margin-top: 16px;
    padding: 0 20px;
    gap: 2px;
    overflow-x: auto;
}

.modal-tab {
    padding: 10px 18px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: var(--color-text-muted);
    cursor: pointer;
    border: none;
    background: none;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    transition: color 0.15s, border-color 0.15s;
    white-space: nowrap;
    font-family: var(--font-family);
}

.modal-tab:hover {
    color: var(--color-primary);
}

.modal-tab.active {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
}

.tab-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: var(--color-primary);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    margin-left: 4px;
    vertical-align: middle;
}

.modal-tab-content {
    padding: 20px;
    min-height: 120px;
}

/* Tables inside tabs */
.modal-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.modal-table th {
    text-align: left;
    padding: 8px 12px;
    background: var(--color-primary);
    color: var(--color-white);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.modal-table th:first-child {
    border-radius: var(--radius) 0 0 0;
}

.modal-table th:last-child {
    border-radius: 0 var(--radius) 0 0;
}

.modal-table td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--color-border-soft);
}

.modal-table tr:nth-child(even) td {
    background: var(--color-surface-2);
}

.modal-table tr:hover td {
    background: var(--color-primary-light);
}

.modal-equiv-link {
    background: transparent;
    border: none;
    padding: 0;
    color: var(--color-primary);
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.modal-equiv-link:hover {
    color: var(--color-primary-dark);
}

.doc-download-link {
    color: var(--color-primary);
    font-weight: 600;
    text-decoration: none;
    font-size: 12px;
}

.doc-download-link:hover {
    text-decoration: underline;
}

.modal-table tr.tarifa-socio-highlight td {
    background: #e8f5e9;
    font-weight: 600;
}

/* Detail grid inside Detalles tab */
.modal-detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.modal-detail-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.modal-detail-item .detail-label {
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-text-muted);
}

.modal-detail-item .detail-value {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text);
}

/* Proveedor info grid */
.modal-prov-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

/* Loading inside modal */
.modal-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: var(--color-text-muted);
    gap: 10px;
}

/* No data text */
.modal-no-data {
    text-align: center;
    padding: 30px;
    color: var(--color-text-muted);
    font-size: 13px;
}

/* === Brands View === */
.brands-view {
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
    padding: 15px;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

.brands-search-wrapper {
    margin-bottom: 15px;
}

.brands-search {
    width: 100%;
    max-width: 400px;
    padding: 11px 18px;
    border: 2px solid var(--color-border);
    border-radius: var(--radius-pill);
    font-size: 14px;
    font-family: var(--font-family);
    outline: none;
    transition: border-color 0.2s;
}

.brands-search:focus {
    border-color: var(--color-primary);
}

.brands-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
}

.brand-card {
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: box-shadow 0.2s, transform 0.15s;
}

.brand-card:hover {
    box-shadow: var(--shadow-card-hover);
    transform: translateY(-2px);
}

.brand-logo-wrapper {
    width: 100%;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.brand-logo {
    max-width: 100%;
    max-height: 80px;
    object-fit: contain;
}

.brand-placeholder {
    width: 60px;
    height: 60px;
    background: var(--color-border-soft);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-muted);
    font-size: 24px;
    font-weight: 800;
}

.brand-name {
    font-size: 12px;
    font-weight: 700;
    text-align: center;
    color: var(--color-text);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

.brand-count {
    font-size: 10px;
    font-weight: 700;
    color: var(--color-text-muted);
    background: var(--color-border-soft);
    padding: 2px 8px;
    border-radius: 10px;
}

/* === Oferta blocks in modal === */
.oferta-block {
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 14px 16px;
    margin-bottom: 12px;
    background: #fafcff;
}

.oferta-header-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.oferta-header-info strong {
    font-size: 14px;
    color: var(--color-primary);
}

.oferta-dates {
    font-size: 12px;
    color: var(--color-text-muted);
}

.oferta-pvp {
    font-size: 13px;
    font-weight: 700;
    color: var(--color-price);
    margin-bottom: 8px;
}

/* === Nombre del socio (clickable: abre el modal de cerrar sesión) === */
.socio-box {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    flex: 0 0 auto;
    line-height: 1.2;
}

.socio-usuario {
    font-size: 11px;
    font-weight: 500;
    color: var(--color-text-muted);
    white-space: nowrap;
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 1px 10px 0;
    user-select: none;
}

/* Sin usuario (sesión sin resolver) el texto va vacío: no dejamos hueco. */
.socio-usuario:empty {
    display: none;
}

.socio-name {
    font-size: 13px;
    font-weight: 700;
    color: var(--color-text-muted);
    white-space: nowrap;
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
    padding: 4px 10px;
    border-radius: var(--radius-pill);
    transition: background 0.15s, color 0.15s;
    user-select: none;
}

.socio-name:hover {
    background: rgba(220, 53, 69, 0.10);
    color: #dc3545;
}

.socio-name:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

.socio-name.has-socio {
    color: var(--color-accent-green);
}

.socio-name.has-socio:hover {
    color: #dc3545;
}

/* === Socio card === */
.socio-card.selected {
    border-color: var(--color-accent-green);
    box-shadow: 0 0 0 2px var(--color-accent-green);
    background: #f0fff4;
}

.socio-meta {
    font-size: 10px;
    color: var(--color-text-muted);
    text-align: center;
    line-height: 1.4;
}

/* === Quitar socio button === */
.btn-quitar-socio {
    background: var(--color-stock-no);
    color: var(--color-white);
    border: none;
    padding: 8px 18px;
    border-radius: var(--radius-pill);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    font-family: var(--font-family);
    transition: background 0.2s;
    white-space: nowrap;
}

.btn-quitar-socio:hover {
    background: #c62828;
}

/* === Responsive === */
@media (max-width: 768px) {
    .main-layout {
        flex-direction: column;
        overflow-y: auto;
    }

    .sidebar {
        width: 100%;
        overflow-y: visible;
    }

    .content {
        overflow-y: visible;
    }

    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    }

    .products-grid.list-view .product-card {
        flex-direction: column;
    }

    .products-grid.list-view .product-card-image {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--color-border-soft);
    }

    .products-grid.list-view .product-card-footer {
        border-left: none;
        border-top: 1px solid var(--color-border-soft);
    }

    .header {
        flex-direction: column;
        align-items: flex-start;
    }

    .nav-bar {
        padding: 0 10px;
    }

    /* Modal responsive */
    .product-modal-overlay {
        padding: 10px;
    }

    .modal-top {
        grid-template-columns: 1fr;
    }

    .modal-image {
        min-height: 180px;
    }

    .modal-boxes {
        grid-template-columns: 1fr;
    }

    .modal-detail-grid,
    .modal-prov-grid {
        grid-template-columns: 1fr;
    }

    .modal-tabs {
        padding: 0 10px;
    }

    .modal-tab {
        padding: 10px 12px;
        font-size: 11px;
    }

    .modal-table {
        font-size: 12px;
    }

    .modal-table th,
    .modal-table td {
        padding: 6px 8px;
    }
}

@media (max-width: 480px) {
    .products-grid {
        grid-template-columns: 1fr;
    }

    .search-bar-container {
        flex-direction: column;
    }

    .btn-search {
        width: 100%;
    }
}

.badge-obsoleto {
    display: inline-block;
    width: fit-content;
    align-self: flex-start;
    background: #dc2626;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 4px;
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-boletin {
    display: inline-block;
    width: fit-content;
    align-self: flex-start;
    background: #7c3aed;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 4px;
    margin-top: 4px;
    margin-right: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-oferta {
    display: inline-block;
    width: fit-content;
    align-self: flex-start;
    background: var(--color-offer);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 4px;
    margin-top: 4px;
    margin-right: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-top {
    display: inline-block;
    width: fit-content;
    align-self: flex-start;
    background: #f59e0b;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 4px;
    margin-top: 4px;
    margin-right: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ribbon-novedad {
    position: absolute;
    top: 0;
    left: 0;
    width: 110px;
    height: 110px;
    overflow: hidden;
    pointer-events: none;
    z-index: 5;
}

.ribbon-novedad span {
    position: absolute;
    display: block;
    width: 160px;
    top: 24px;
    left: -42px;
    transform: rotate(-45deg);
    background: #dc2626;
    color: #fff;
    text-align: center;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    padding: 4px 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* === Login page === */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    padding: 20px;
    margin: 0;
    font-family: 'Nunito', system-ui, sans-serif;
}

.login-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    width: 100%;
    max-width: 400px;
    padding: 32px 28px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.login-logo {
    display: flex;
    justify-content: center;
    margin-bottom: 4px;
}

.login-logo img {
    max-height: 48px;
}

.login-title {
    margin: 0;
    text-align: center;
    font-size: 20px;
    font-weight: 700;
    color: var(--color-text);
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.login-form label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 13px;
    font-weight: 700;
    color: var(--color-text);
}

.login-form input {
    font-family: inherit;
    font-size: 15px;
    padding: 10px 12px;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    background: #fff;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.login-form input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-light);
}

.login-error {
    min-height: 20px;
    color: #b00020;
    font-size: 13px;
    font-weight: 600;
    text-align: center;
    visibility: hidden;
}

.login-error.is-visible {
    visibility: visible;
}

.login-submit {
    font-family: inherit;
    font-size: 15px;
    font-weight: 700;
    padding: 11px;
    border: none;
    border-radius: 6px;
    background: var(--color-primary);
    color: #fff;
    cursor: pointer;
    transition: background 0.15s;
}

.login-submit:hover:not(:disabled) {
    background: var(--color-primary-dark);
}

.login-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Variante de éxito reutilizando el hueco de .login-error (p.ej. "hemos enviado
   un e-mail"): en rojo diría justo lo contrario de lo que ha pasado. */
.login-error.is-ok {
    color: #1b7a3d;
}

/* "¿Has olvidado tu contraseña?" bajo el botón de entrar. Es un <button> y no un
   <a> porque no navega: lee el usuario del formulario y hace un POST. */
.login-link {
    background: none;
    border: none;
    padding: 0;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    color: var(--color-primary);
    cursor: pointer;
    text-align: center;
    text-decoration: underline;
}

.login-link:hover:not(:disabled) {
    color: var(--color-primary-dark);
}

.login-link:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Recordatorio de la política de claves en la página de cambio. */
.login-hint {
    margin: 0;
    font-size: 12px;
    line-height: 1.4;
    color: var(--color-text-light);
    text-align: center;
}

/* === Mi Información: landing fija con accesos del socio === */
/* Hijo directo de <body> (flex column): rellena el alto restante y hace scroll
   propio cuando el grid desborda (mismo patrón que #page-almacen). */
#page-mi-informacion {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    /* Sin esto, overflow-x computa a auto (un eje no-visible fuerza el otro a auto) y el
       popover del calendario, anclado a la derecha, asoma una barra de scroll horizontal. */
    overflow-x: hidden;
}
/* Accesos agrupados en rectángulos horizontales (INFO_GROUPS). El contenedor
   #info-grid (clase .info-groups) apila los grupos; cada .info-group es un
   rectángulo con su título y, dentro, una .info-grid con sus tarjetas. */
.info-groups {
    display: flex;
    flex-direction: column;
    gap: 22px;
}
.info-group {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 16px 18px 20px;
    box-shadow: var(--shadow-card);
}
.info-group-title {
    margin: 0 0 14px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--color-primary-light);
    font-size: 13px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--color-primary);
}
.info-landing {
    max-width: 1100px;
    margin: 0 auto;
    padding: 24px 24px 60px;
}
.info-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 26px 32px;
    margin-bottom: 26px;
    border-radius: var(--radius-lg);
    background: linear-gradient(120deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    color: #fff;
    box-shadow: var(--shadow-card);
}
.info-hero-text h1 {
    margin: 0 0 8px;
    font-size: clamp(22px, 3vw, 32px);
    font-weight: 800;
}
.info-hero-text p {
    margin: 0;
    font-size: clamp(14px, 1.4vw, 17px);
    opacity: 0.93;
    max-width: 54ch;
}
/* Botón "Comercial y consultas": abre la página de Contacto. */
.info-gestor {
    flex-shrink: 0;
    background: #fff;
    padding: 14px 26px;
    border: none;
    font: inherit;
    font-size: 16px;
    font-weight: 700;
    color: var(--color-primary);
    border-radius: var(--radius);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.info-gestor:hover,
.info-gestor:focus-visible {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.24);
    outline: none;
}
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
    gap: 16px;
}
.info-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 18px 20px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    text-decoration: none;
    box-shadow: var(--shadow-card);
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}
.info-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-card-hover);
    border-color: var(--color-primary);
}
.info-card-avatar {
    flex-shrink: 0;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    font-weight: 800;
    color: #fff;
    background: var(--color-primary);
}
.info-card-body {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}
.info-card-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--color-text);
}
.info-card-desc {
    font-size: 13px;
    color: var(--color-text-light);
    line-height: 1.35;
}
/* Avatares con colores cíclicos para dar variedad visual al grid. */
.info-card:nth-child(6n+1) .info-card-avatar { background: #0c4da2; }
.info-card:nth-child(6n+2) .info-card-avatar { background: #28a745; }
.info-card:nth-child(6n+3) .info-card-avatar { background: #e67e22; }
.info-card:nth-child(6n+4) .info-card-avatar { background: #8e44ad; }
.info-card:nth-child(6n+5) .info-card-avatar { background: #c0392b; }
.info-card:nth-child(6n+6) .info-card-avatar { background: #16a085; }
@media (max-width: 640px) {
    .info-hero { flex-direction: column; align-items: flex-start; }
    .info-grid { grid-template-columns: 1fr; }
}

/* === Mi Información: buscador de movimientos (facturas/albaranes) === */
.info-landing[hidden],
.info-subview[hidden] { display: none; }
.info-subview {
    max-width: 95%;
    margin: 0 auto;
    padding: 24px 24px 60px;
}
/* Vuelta a la rejilla agrupada desde una sub-vista (sustituye al viejo ítem "Menú"
   de la barra superior). Botón discreto tipo enlace. */
.info-back {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 16px;
    padding: 6px 12px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    color: var(--color-primary);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}
.info-back:hover {
    background: var(--color-primary-light);
    border-color: var(--color-primary);
}
/* Título de la vista de documentos (lo fija openDocsSearch según el acceso). */
.mov-title {
    margin: 0 0 16px;
    font-size: 20px;
    font-weight: 800;
    color: var(--color-text);
}
/* Conmutador de tipo dentro de la vista de documentos (p.ej. órdenes: SDIR/MPR). */
.docs-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}
.docs-selector[hidden] { display: none; }
.docs-sel-btn {
    padding: 7px 16px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 999px;
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.docs-sel-btn:hover { border-color: var(--color-primary); }
.docs-sel-btn.active {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: #fff;
}
/* Formularios de contacto (Consultas / Visita) por mailto, en pestañas .docs-selector. */
.info-form-intro { margin: 0 0 18px; color: var(--color-text-light); font-size: 14px; max-width: 60ch; }
.info-form { display: flex; flex-direction: column; gap: 16px; max-width: 620px; }
.info-field { display: flex; flex-direction: column; gap: 6px; }
.info-field > span { font-size: 13px; font-weight: 700; color: var(--color-text); }
.info-field input,
.info-field select,
.info-field textarea {
    font: inherit;
    padding: 10px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-surface);
    color: var(--color-text);
    width: 100%;
}
.info-field textarea { resize: vertical; }
.info-field input:focus,
.info-field select:focus,
.info-field textarea:focus { outline: none; border-color: var(--color-primary); }
.info-form-submit {
    align-self: flex-start;
    padding: 10px 22px;
    background: var(--color-primary);
    color: #fff;
    border: 0;
    border-radius: var(--radius);
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s;
}
.info-form-submit:hover { background: var(--color-primary-dark); }
/* Ficha del comercial en Solicitud de visita. */
.info-contact-card {
    display: flex;
    align-items: center;
    gap: 18px;
    max-width: 620px;
    margin-bottom: 22px;
    padding: 16px 18px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
}
.info-contact-foto { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.info-contact-datos { display: flex; flex-direction: column; gap: 2px; }
.info-contact-datos strong { font-size: 17px; color: var(--color-text); }
.info-contact-rol { font-size: 13px; color: var(--color-text-muted); margin-bottom: 4px; }
.info-contact-datos a { font-size: 14px; color: var(--color-primary); text-decoration: none; }
.info-contact-datos a:hover { text-decoration: underline; }
/* Mensaje de resultado en formularios (p.ej. cambio de clave). */
.info-form-msg { font-size: 14px; padding: 10px 12px; border-radius: var(--radius); max-width: 620px; }
.info-form-msg.is-ok { background: #e6f4ea; color: #1e7e34; border: 1px solid #b7e0c1; }
.info-form-msg.is-error { background: #fdecea; color: #b02a37; border: 1px solid #f5c2c7; }
/* Ver perfil: ficha de datos del socio + tabla de usuarios. */
.perfil-card {
    max-width: 620px;
    margin-bottom: 22px;
    padding: 16px 18px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
}
.perfil-row { display: flex; gap: 14px; padding: 6px 0; }
.perfil-row + .perfil-row { border-top: 1px solid var(--color-border); }
.perfil-label { flex: 0 0 130px; font-size: 13px; font-weight: 700; color: var(--color-text-muted); }
.perfil-val { font-size: 15px; color: var(--color-text); }
.perfil-val small { color: var(--color-text-muted); }
.perfil-subtitle { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 12px; font-size: 15px; font-weight: 800; color: var(--color-text); }
/* Código/descripción de una línea de movimiento → ficha de producto (modal de
   Almacén). Texto normal en la tabla; el hover revela que es clicable. */
.mov-art-link { color: inherit; text-decoration: none; cursor: pointer; }
.mov-art-link:hover { color: var(--color-primary); text-decoration: underline; }

.mov-search {
    display: flex;
    gap: 10px;
    margin-bottom: 18px;
    position: relative; /* ancla del popover de calendario (.mov-cal) */
}
.mov-search-input {
    flex: 1;
    min-width: 0;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 10px 14px;
    font-size: 15px;
    color: var(--color-text);
    background: var(--color-surface);
}
.mov-search-input:focus { outline: none; border-color: var(--color-primary); }
/* Descargas (Volcado): el selector de tipo no crece como el input de texto. */
.volc-tipo { flex: 0 0 auto; min-width: 220px; cursor: pointer; }
.mov-search-btn {
    flex-shrink: 0;
    background: var(--color-primary);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    padding: 10px 22px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
}
.mov-search-btn:hover { background: var(--color-primary-dark); }

/* Botón de fechas (secundario, a la derecha de Buscar) */
.mov-date-btn {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--color-surface);
    color: var(--color-text);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 9px 16px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
}
.mov-date-btn:hover { border-color: var(--color-primary); color: var(--color-primary); }
.mov-date-btn svg { flex-shrink: 0; opacity: 0.85; }
.mov-date-btn.has-range {
    border-color: var(--color-primary);
    color: var(--color-primary);
    background: var(--color-primary-light);
    font-weight: 700;
}

/* Popover del calendario de rango */
.mov-cal {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 40;
    width: 300px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card), 0 8px 28px rgba(0, 0, 0, 0.14);
    padding: 14px;
}
.mov-cal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}
.mov-cal-title { font-size: 15px; font-weight: 700; color: var(--color-text); }
.mov-cal-nav {
    width: 30px;
    height: 30px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-surface);
    color: var(--color-text);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
}
.mov-cal-nav:hover { border-color: var(--color-primary); color: var(--color-primary); }
.mov-cal-weekdays, .mov-cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}
.mov-cal-weekdays {
    margin-bottom: 4px;
}
.mov-cal-weekdays span {
    text-align: center;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--color-text-muted);
    padding: 4px 0;
}
.mov-cal-day {
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: var(--color-text);
    font-size: 13px;
    border-radius: var(--radius);
    cursor: pointer;
}
.mov-cal-day.is-empty { visibility: hidden; cursor: default; }
.mov-cal-day:not(.is-empty):hover { background: var(--color-primary-light); }
.mov-cal-day.is-today { font-weight: 800; box-shadow: inset 0 0 0 1px var(--color-primary); }
.mov-cal-day.in-range { background: var(--color-primary-light); border-radius: 0; }
.mov-cal-day.is-start, .mov-cal-day.is-end {
    background: var(--color-primary);
    color: #fff;
    font-weight: 700;
    box-shadow: none;
}
.mov-cal-day.is-start { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.mov-cal-day.is-end { border-top-left-radius: 0; border-bottom-left-radius: 0; }
/* Día único seleccionado (inicio sin fin, o rango de 1 día): pastilla redondeada */
.mov-cal-day.is-start.is-end { border-radius: var(--radius); }
.mov-cal-foot {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-top: 12px;
}
.mov-cal-clear, .mov-cal-apply {
    border-radius: var(--radius);
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
}
.mov-cal-clear {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    color: var(--color-text-light);
}
.mov-cal-clear:hover { border-color: var(--color-primary); color: var(--color-primary); }
.mov-cal-apply {
    background: var(--color-primary);
    border: 1px solid var(--color-primary);
    color: #fff;
}
.mov-cal-apply:hover { background: var(--color-primary-dark); }

@media (max-width: 640px) {
    .mov-cal { left: 0; right: 0; width: auto; }
}

.mov-results { display: flex; flex-direction: column; gap: 10px; }
.mov-loading, .mov-empty, .mov-error {
    padding: 28px;
    text-align: center;
    color: var(--color-text-light);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
}
.mov-error { color: var(--color-danger, #c0392b); }

/* Tabla de resultados */
.mov-tabla-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-size: 13px;
    color: var(--color-text-light);
}
/* Botón "Descargar Excel" del listado (en la barra de contador o el subtítulo). */
.mov-export {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    color: #1e7e34;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}
.mov-export:hover { background: #e6f4ea; border-color: #1e7e34; }
.mov-tabla {
    width: 100%;
    border-collapse: collapse;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    font-size: 14px;
}
.mov-tabla th, .mov-tabla td {
    padding: 11px 14px;
    border-bottom: 1px solid var(--color-border);
    text-align: left;
}
.mov-tabla th {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--color-text-muted);
}
.mov-tabla tbody tr:last-child td { border-bottom: none; }
.mov-tabla tbody tr:hover { background: var(--color-primary-light); }
.mov-tabla .num { text-align: right; white-space: nowrap; }
.mov-row-link, .mov-line-link { font-weight: 700; color: var(--color-primary); text-decoration: none; white-space: nowrap; }
.mov-row-link:hover, .mov-line-link:hover { text-decoration: underline; }
.mov-ref-none { color: var(--color-text-muted); }

/* Tabla de líneas (resultado multi-documento): más columnas, algo más compacta.
   En pantallas estrechas se ocultan Código y Proveedor para que no desborde. */
.mov-tabla-lineas { font-size: 13px; }
.mov-tabla-lineas th, .mov-tabla-lineas td { padding: 9px 12px; }
.mov-tabla th.mov-sortable { cursor: pointer; user-select: none; white-space: nowrap; }
.mov-tabla th.mov-sortable:hover { color: var(--color-primary); }
/* Columna de ordenación activa: cabecera en negrita + color y flecha grande. */
.mov-tabla th.mov-sortable.sorted { color: var(--color-primary); font-weight: 800; }
.mov-sort-ind { display: inline-block; width: 1em; text-align: center; color: var(--color-primary); font-size: 1.3em; line-height: 0; vertical-align: middle; }
.mov-tabla-lineas .mov-col-oferta { white-space: nowrap; }
@media (max-width: 720px) {
    .mov-tabla-lineas .mov-col-cod, .mov-tabla-lineas .mov-col-prov, .mov-tabla-lineas .mov-col-oferta { display: none; }
}

/* Ficha de estadísticas del artículo: cuando TODAS las líneas del resultado son del
   mismo artículo, una tarjeta-resumen encima del listado + gráfica SVG de precio. */
.mov-stats-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.mov-stats-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; }
.mov-stats-title { font-size: 17px; font-weight: 700; color: var(--color-text); }
.mov-stats-title .mov-art-link { font: inherit; }
.mov-stats-cod { font-size: 13px; color: var(--color-text-muted); }
.mov-stats-prov { font-size: 13px; color: var(--color-text-light); }
.mov-stats-metrics { display: flex; flex-wrap: wrap; gap: 10px 28px; }
.mov-stat { display: flex; flex-direction: column; min-width: 64px; }
.mov-stat-val { font-size: 19px; font-weight: 700; color: var(--color-primary); line-height: 1.15; }
.mov-stat-lbl { font-size: 11px; text-transform: uppercase; letter-spacing: 0.4px; color: var(--color-text-muted); }
.mov-stats-chart { display: flex; flex-direction: column; gap: 6px; }
.mov-stats-chart-title { font-size: 11px; text-transform: uppercase; letter-spacing: 0.4px; color: var(--color-text-muted); }
.mov-chart { width: 100%; max-width: 460px; height: auto; display: block; }
.mov-chart-line { stroke: var(--color-primary); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.mov-chart-dot { fill: var(--color-primary); }
.mov-chart-axis { fill: var(--color-text-muted); font-size: 9px; }
.mov-chart-single { font-size: 14px; color: var(--color-text); }
.mov-chart-when { color: var(--color-text-muted); }

/* Vista de detalle de un documento */
.mov-detalle { display: flex; flex-direction: column; gap: 14px; }
.mov-detalle-back {
    align-self: flex-start;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 7px 14px;
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text);
    cursor: pointer;
}
.mov-detalle-back:hover { border-color: var(--color-primary); color: var(--color-primary); }
.mov-detalle-head {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.mov-detalle-title {
    font-size: 18px;
    font-weight: 800;
    color: var(--color-text);
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}
.mov-detalle-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 24px;
    font-size: 14px;
    color: var(--color-text-light);
}
.mov-badge {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    padding: 3px 9px;
    border-radius: 999px;
    white-space: nowrap;
    background: var(--color-border);
    color: var(--color-text-light);
}
.mov-badge.ok { background: #28a745; color: #fff; }
.mov-badge.err { background: #dc3545; color: #fff; }
/* Pedidos Dropshipping: botón de anulación (línea o pedido) y título de albaranes. */
.drop-cancel-btn {
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 6px;
    border: 1px solid #dc3545;
    background: transparent;
    color: #dc3545;
    white-space: nowrap;
}
.drop-cancel-btn:hover { background: #dc3545; color: #fff; }
.drop-albs-title {
    margin: 18px 0 8px;
    font-size: 15px;
    font-weight: 700;
    color: var(--color-text);
}
.mov-lineas {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}
.mov-lineas th, .mov-lineas td {
    padding: 8px 10px;
    border-bottom: 1px solid var(--color-border);
    text-align: left;
}
.mov-lineas th {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--color-text-muted);
}
.mov-lineas .num { text-align: right; white-space: nowrap; }
.mov-lineas tbody tr:last-child td { border-bottom: none; }

/* Grupo de albarán dentro del detalle de una factura multi-albarán. */
.mov-albaran-group { display: flex; flex-direction: column; gap: 8px; }
.mov-albaran-group + .mov-albaran-group { margin-top: 18px; }
.mov-albaran-subhead {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px 16px;
    padding: 8px 12px;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
}
.mov-albaran-ref { font-size: 14px; color: var(--color-text); }
.mov-albaran-ref b { color: var(--color-text); text-transform: uppercase; font-size: 12px; letter-spacing: 0.4px; margin-right: 4px; }
.mov-albaran-tools { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.mov-albaran-subtotal { font-size: 13px; font-weight: 700; color: var(--color-text); white-space: nowrap; }
.mov-albaran-subhead .mov-pdf { padding: 5px 11px; font-size: 12px; }

.mov-doc-pdfs { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.mov-pdf {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border: 1px solid var(--color-primary);
    border-radius: var(--radius);
    color: var(--color-primary);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
}
.mov-pdf:hover { background: var(--color-primary); color: #fff; }

@media (max-width: 640px) {
    .mov-search { flex-direction: column; align-items: stretch; }
}

/* === Modal de confirmación (genérico) === */
.confirm-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: confirm-modal-fade-in 0.12s ease-out;
}

@keyframes confirm-modal-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.confirm-modal {
    background: var(--color-header-bg);
    color: var(--color-text);
    border-radius: var(--radius);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.25);
    padding: 24px;
    max-width: 420px;
    width: 90%;
}

.confirm-modal-title {
    margin: 0 0 12px;
    font-size: 18px;
    font-weight: 700;
    color: var(--color-primary);
}

.confirm-modal-body {
    margin: 0 0 20px;
    font-size: 14px;
    color: var(--color-text);
}

.confirm-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.btn-secondary {
    padding: 8px 16px;
    border: 1px solid var(--color-border);
    background: transparent;
    color: var(--color-text);
    border-radius: var(--radius);
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    font-family: inherit;
    transition: background 0.15s;
}

.btn-secondary:hover {
    background: var(--color-border-soft);
}

.btn-danger {
    padding: 8px 16px;
    border: none;
    background: #dc3545;
    color: #fff;
    border-radius: var(--radius);
    cursor: pointer;
    font-weight: 700;
    font-size: 14px;
    font-family: inherit;
    transition: background 0.15s;
}

.btn-danger:hover {
    background: #b02a37;
}

/* === Nav badge (número de líneas en el carrito) === */
.nav-badge {
    display: inline-block;
    min-width: 18px;
    padding: 1px 6px;
    margin-left: 4px;
    background: var(--color-offer);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    border-radius: 10px;
    text-align: center;
    vertical-align: middle;
}

.nav-badge[hidden] {
    display: none;
}

/* === Vista del carrito === */
/* Como toda vista hija de #page-almacen, tiene que generar su propio scroll:
   sin flex/min-height/overflow el contenido desborda y body{overflow:hidden}
   lo recorta sin barra (mismo patrón que .brands-view). */
.cart-view {
    padding: 20px 24px;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

.cart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.cart-tabs {
    display: flex;
    gap: 4px;
}

.cart-tab {
    padding: 8px 18px;
    border: 1px solid var(--color-border);
    background: #fff;
    color: var(--color-text);
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    border-radius: 8px 8px 0 0;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    border-bottom: none;
}

.cart-tab:hover {
    background: var(--color-primary-light);
}

.cart-tab.active {
    background: var(--color-primary);
    color: #fff;
}

.cart-tab-count {
    display: inline-block;
    min-width: 20px;
    margin-left: 6px;
    padding: 1px 6px;
    background: rgba(0, 0, 0, 0.12);
    border-radius: 10px;
    font-size: 11px;
    font-weight: 700;
}

.cart-tab.active .cart-tab-count {
    background: rgba(255, 255, 255, 0.25);
}

.cart-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    overflow: hidden;
    font-size: 14px;
}

.cart-table thead {
    background: var(--color-primary);
    color: #fff;
}

.cart-table th, .cart-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--color-border);
}

.cart-table th {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 700;
}

.cart-table tbody tr:hover {
    background: var(--color-surface-2);
}

.cart-num {
    text-align: right;
    white-space: nowrap;
}

.cart-codigo {
    font-family: 'Menlo', monospace;
    font-size: 13px;
    color: var(--color-primary);
    font-weight: 600;
}

.cart-marca {
    font-weight: 700;
    color: var(--color-text);
    margin-right: 6px;
}

.cart-qty {
    width: 70px;
    padding: 4px 6px;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    font-family: inherit;
    font-size: 14px;
    text-align: right;
}

.cart-qty:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px var(--color-primary-light);
}

.cart-subtotal {
    font-weight: 700;
    color: var(--color-price);
}

.cart-del {
    background: transparent;
    border: none;
    color: var(--color-stock-no);
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    padding: 2px 8px;
    border-radius: 4px;
    transition: background 0.12s;
}

.cart-del:hover {
    background: #fdecea;
}

.cart-total-label {
    text-align: right;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 0.5px;
}

.cart-total {
    font-size: 18px;
    font-weight: 800;
    color: var(--color-price);
}

.cart-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 16px;
}

.btn-cart-secondary, .btn-cart-primary {
    padding: 10px 22px;
    border: none;
    border-radius: 8px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s;
}

.btn-cart-secondary {
    background: #e8e8e8;
    color: var(--color-text);
}

.btn-cart-secondary:hover {
    background: #d5d5d5;
}

.btn-cart-primary {
    background: var(--color-accent-green);
    color: #fff;
}

.btn-cart-primary:hover {
    background: #219a38;
}

/* Contenedor de clave socio + agencia en la cabecera del carrito.
   En la pestaña AGENCIA (clase cart-header-agencia puesta por app.js) baja
   a una línea propia bajo las pestañas. */
.cart-controls {
    display: flex;
    align-items: flex-end;
    gap: 16px;
}

.cart-header-agencia .cart-controls {
    flex-basis: 100%;
}

/* Input clave socio en la cabecera del carrito */
.cart-clave-socio {
    display: inline-flex;
    flex-direction: column;
    gap: 2px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-text-muted);
}

.cart-clave-socio input {
    font-family: inherit;
    font-size: 13px;
    font-weight: 400;
    padding: 6px 10px;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    background: #fff;
    color: var(--color-text);
    text-transform: none;
    letter-spacing: 0;
    min-width: 200px;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.cart-clave-socio input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px var(--color-primary-light);
}

/* Selector de agencia (solo tipo AGENCIA) — resaltado: es el dato clave del pedido */
.cart-agencia {
    display: inline-flex;
    flex-direction: column;
    gap: 2px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-primary);
}

.cart-agencia select {
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    padding: 8px 12px;
    border: 2px solid var(--color-primary);
    border-radius: 6px;
    background: var(--color-primary-light);
    color: var(--color-text);
    text-transform: none;
    letter-spacing: 0;
    min-width: 260px;
    cursor: pointer;
}

.cart-agencia select:focus {
    outline: none;
    border-color: var(--color-primary-dark);
    box-shadow: 0 0 0 3px var(--color-primary-hover);
}

/* Formulario de entrega (DROPSHIPPING) */
.cart-entrega {
    flex-basis: 100%;
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 14px 18px;
}

.cart-entrega h4 {
    margin: 0 0 10px 0;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-text-muted);
}

.cart-entrega-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
}

.cart-entrega-grid label {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-text-muted);
}

.cart-entrega-grid .cart-entrega-wide {
    grid-column: 1 / -1;
}

.cart-entrega-grid input {
    font-family: inherit;
    font-size: 13px;
    font-weight: 400;
    padding: 6px 10px;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    background: #fff;
    color: var(--color-text);
    text-transform: none;
    letter-spacing: 0;
}

.cart-entrega-grid input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px var(--color-primary-light);
}

/* Tipo de carrito activo dentro del link "Carrito" del nav */
.nav-cart-active {
    font-size: 11px;
    font-weight: 600;
    opacity: 0.85;
    margin-left: 2px;
    letter-spacing: 0.2px;
}

/* Icono del carrito en el nav */
#nav-carrito {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.nav-cart-icon {
    flex-shrink: 0;
    opacity: 0.9;
}

/* === Favoritos === */
/* Corazón en la ficha (esquina superior derecha; el ribbon NOVEDAD está en la
   superior izquierda con z-index 5, así que aquí 6). */
.btn-favorite {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 6;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 1px solid var(--color-border);
    background: rgba(255, 255, 255, 0.95);
    color: #999;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    padding: 0;
}
.btn-favorite:hover {
    background: #fff;
    color: #dc2626;
    box-shadow: var(--shadow-card);
}
.btn-favorite.is-favorite {
    color: #dc2626;
    border-color: #dc2626;
}

/* Nav heart (junto al carrito) */
#nav-favoritos {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.nav-heart-icon {
    flex-shrink: 0;
    opacity: 0.9;
}
.nav-fav-active {
    font-size: 11px;
    font-weight: 600;
    opacity: 0.85;
    margin-left: 2px;
    letter-spacing: 0.2px;
}

/* Vista de favoritos */
/* === Boletines (Almacén) === */
/* Vista de columna: cuerpo scrolleable + barra de totales como footer flex
   (NO position:fixed — respeta el invariante de scroll de #page-almacen). */
.boletines-view {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}
.bol-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 16px 24px 32px;
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
}
.bol-heading {
    font-size: 20px;
    margin: 0;
}
.bol-toolbar {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--color-border);
    margin-bottom: 16px;
}
.bol-toolbar .bol-heading { margin-right: auto; }
.bol-toolbar-actions { display: flex; gap: 8px; }

/* Landing: dos accesos grandes (Comerciales / Outlet) */
.bol-landing {
    max-width: 900px;
    margin: 24px auto;
    text-align: center;
}
.bol-landing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 20px;
    margin-top: 20px;
}
.bol-landing-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    padding: 36px 24px 24px;
    cursor: pointer;
    transition: box-shadow .15s, transform .15s;
}
.bol-landing-card:hover {
    box-shadow: var(--shadow-card-hover);
    transform: translateY(-2px);
}
.bol-landing-title {
    font-size: 22px;
    font-weight: 800;
    color: var(--color-primary);
}
.bol-landing-desc {
    color: var(--color-text-light);
    margin: 8px 0 16px;
}
.bol-landing-pedidos {
    font-size: 13px;
    color: var(--color-primary);
    text-decoration: underline;
}

/* Lista de boletines del tipo */
.bol-lista {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
}
.bol-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    padding: 18px;
    text-align: center;
    cursor: pointer;
    transition: box-shadow .15s;
}
.bol-card:hover { box-shadow: var(--shadow-card-hover); }
.bol-card-title {
    font-weight: 800;
    min-height: 40px;
}
.bol-card-fecha {
    color: var(--color-text-light);
    font-size: 13px;
    margin-top: 8px;
    border-top: 1px solid var(--color-border);
    padding-top: 8px;
}

/* Fichas de artículo del boletín abierto */
.bol-arts {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
}
.bol-art {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.bol-art-head {
    display: flex;
    align-items: flex-start;
    gap: 8px;
}
.bol-art-desc {
    font-weight: 700;
    flex: 1;
}
.bol-art-infobtn {
    border: none;
    background: none;
    cursor: pointer;
    font-size: 18px;
    color: var(--color-primary);
    line-height: 1;
}
.bol-art-info {
    background: var(--color-primary-light);
    border-radius: var(--radius);
    padding: 8px 10px;
    font-size: 13px;
    white-space: pre-line;
}
.bol-art-img {
    text-align: center;
    min-height: 140px;
}
.bol-art-img img {
    max-width: 100%;
    max-height: 180px;
    width: auto;
    height: auto;
}
.bol-art-precio { text-align: center; }
.bol-precio-destacado {
    display: inline-block;
    background: var(--color-offer);
    color: #fff;
    font-weight: 800;
    border-radius: var(--radius-pill);
    padding: 4px 18px;
}
.bol-art-datos,
.bol-art-cants {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    font-size: 13px;
    color: var(--color-text-light);
    border-top: 1px solid var(--color-border);
    padding-top: 8px;
}
.bol-art-datos .bol-art-prov {
    font-weight: 700;
    color: var(--color-text);
}
.bol-art-codigos { text-align: right; }
.bol-agotado { color: var(--color-stock-no); }
.bol-art-pie {
    display: flex;
    gap: 10px;
    align-items: flex-end;
    flex-wrap: wrap;
    border-top: 1px solid var(--color-border);
    padding-top: 8px;
    font-size: 13px;
    margin-top: auto;
}
.bol-art-escalados {
    flex: 1;
    min-width: 90px;
}
.bol-art-campo {
    display: flex;
    flex-direction: column;
    gap: 2px;
    color: var(--color-text-light);
}
.bol-art-campo input {
    width: 76px;
    padding: 4px 6px;
    text-align: right;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 14px;
}
.bol-art-campo input[readonly] {
    background: var(--color-bg);
    color: var(--color-text-light);
}
.bol-art-campo .bol-subtotal {
    font-size: 14px;
    color: var(--color-text);
    padding: 5px 0;
}
input.bol-qty.bol-input-error {
    border-color: var(--color-stock-no);
    background: #fdecea;
}
input.bol-qty.bol-input-ok {
    border-color: var(--color-accent-green);
    background: #eaf7ee;
}

/* Barra inferior de totales (footer del view, solo visible en el detalle) */
.bol-infobar {
    flex-shrink: 0;
    border-top: 1px solid var(--color-border);
    background: var(--color-surface);
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.06);
    padding: 10px 24px;
    display: flex;
    align-items: center;
    gap: 24px;
    flex-wrap: wrap;
}
.bol-infobar[hidden] { display: none; }
.bol-caducado {
    flex-basis: 100%;
    color: var(--color-stock-no);
    font-weight: 700;
}
.bol-infobar-stats {
    display: flex;
    gap: 28px;
    flex-wrap: wrap;
    flex: 1;
}
.bol-stat {
    text-align: center;
    font-size: 12px;
    color: var(--color-text-light);
}
.bol-stat strong {
    display: block;
    font-size: 17px;
    color: var(--color-text);
    margin-top: 2px;
}
.bol-stat-total strong { color: var(--color-primary); }
.bol-verde { color: var(--color-accent-green) !important; }
.bol-rojo { color: var(--color-stock-no) !important; }
.bol-infobar-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}
.bol-restos {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--color-text-light);
}
.btn-bol-pedido {
    border: none;
    border-radius: var(--radius);
    padding: 10px 22px;
    font-weight: 800;
    font-size: 14px;
    background: var(--color-stock-no);
    color: #fff;
    cursor: pointer;
    opacity: .65;
}
.btn-bol-pedido.ok {
    background: var(--color-accent-green);
    opacity: 1;
}
.btn-bol-pedido:disabled { cursor: not-allowed; }

/* Pedidos realizados + suministros */
.bol-filtros {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 14px;
    font-size: 13px;
    color: var(--color-text-light);
}
.bol-filtros label {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.bol-filtros select {
    min-width: 180px;
    max-width: 340px;
    padding: 6px 8px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
}
.bol-tabla-wrap { overflow-x: auto; }
.bol-ped-tabla td.num { text-align: right; }
.bol-ped-row { cursor: pointer; }
.bol-tabla-pie {
    color: var(--color-text-light);
    font-size: 13px;
    margin-top: 10px;
}

/* Resultado del pedido */
.bol-resultado {
    max-width: 1000px;
    margin: 20px auto;
    text-align: center;
}
.bol-resultado h2 { margin-bottom: 12px; }
.bol-resultado-tabla { margin: 24px auto 0; }
.bol-resultado-importes {
    margin-top: 16px;
    font-size: 15px;
}

/* Mismo invariante de scroll que .cart-view / .brands-view. */
.favorites-view {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 16px 24px 32px;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}
.fav-header {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 20px;
    align-items: flex-end;
    padding: 12px 0 16px;
    border-bottom: 1px solid var(--color-border);
    margin-bottom: 16px;
}
.fav-lista-label {
    display: flex;
    flex-direction: column;
    font-size: 12px;
    color: var(--color-text-light);
    gap: 4px;
}
.fav-lista-label select {
    min-width: 220px;
    padding: 6px 10px;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    background: var(--color-white);
    font-size: 14px;
    color: var(--color-text);
}
.fav-actions {
    display: flex;
    gap: 8px;
}
.btn-fav-secondary,
.btn-fav-danger {
    padding: 6px 14px;
    border-radius: 6px;
    border: 1px solid var(--color-border);
    background: var(--color-white);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}
.btn-fav-secondary:hover {
    background: var(--color-primary-light);
    border-color: var(--color-primary);
    color: var(--color-primary);
}
.btn-fav-danger {
    color: #dc2626;
    border-color: #dc2626;
}
.btn-fav-danger:hover {
    background: #dc2626;
    color: #fff;
}
.fav-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--color-white);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-card);
}
.fav-table thead {
    background: var(--color-primary-light);
}
.fav-table th, .fav-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--color-border);
    font-size: 14px;
}
.fav-table th {
    font-weight: 700;
    color: var(--color-primary-dark);
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.5px;
}
.fav-table tbody tr:hover {
    background: var(--color-primary-light);
}
.fav-thumb {
    width: 56px;
    height: 56px;
    object-fit: contain;
    background: #f7f7f7;
    border-radius: 4px;
}
.fav-codigo {
    font-family: monospace;
    color: var(--color-text-light);
    font-size: 12px;
}
.fav-marca {
    font-weight: 600;
    color: var(--color-primary-dark);
}
.fav-del {
    background: transparent;
    border: none;
    color: #dc2626;
    font-size: 16px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
}
.fav-del:hover {
    background: rgba(220, 38, 38, 0.1);
}

/* === Theme picker (dropdown del toolbar) === */
.theme-dropdown-wrap {
    position: relative;
    display: inline-flex;
}

.theme-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    z-index: 50;
    min-width: 180px;
    padding: 6px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: 0 6px 20px rgba(0,0,0,0.15);
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.theme-dropdown[hidden] {
    display: none;
}

.theme-swatch {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    border: 1px solid transparent;
    background: transparent;
    border-radius: var(--radius);
    cursor: pointer;
    color: var(--color-text);
    font-family: var(--font-family);
    font-size: 13px;
    text-align: left;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.theme-swatch:hover {
    background: var(--color-primary-hover);
}

.theme-swatch.active {
    background: var(--color-primary);
    color: var(--color-on-primary);
    border-color: var(--color-primary);
}

.theme-swatch svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

