:root {
    --ruga-brown: #4a3728;
    --ruga-light-brown: #6b5447;
    --ruga-beige: #f5f1ed;
    --ruga-accent: #8b7355;
}

/* ============================================================================
   PROTECCIÓN DE DATOS - Sistema Anti-Copia SpotterAg
   ============================================================================ */

/* Marca de agua global - OCULTA normalmente, VISIBLE solo en capturas */
.global-watermark {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.1s, visibility 0.1s;
}

.global-watermark.active {
    opacity: 1;
    visibility: visible;
}

.global-watermark::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 200%;
    height: 200%;
    background-image: url('/static/logo-transparent.png');
    background-size: 200px auto;
    background-repeat: repeat;
    opacity: 0.35;
    transform: rotate(-25deg) translate(-25%, -25%);
}

.global-watermark::after {
    content: 'SPOTTERAG © CONFIDENCIAL';
    position: fixed;
    bottom: 50%;
    right: 30%;
    font-size: 3rem;
    font-weight: 700;
    color: rgba(74, 55, 40, 0.6);
    letter-spacing: 0.3rem;
    pointer-events: none;
    z-index: 10000;
    text-shadow: 0 0 10px rgba(255,255,255,0.9);
    transform: rotate(-25deg);
}

/* Bloquear selección en TODA la app */
body.copy-protected {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* Permitir selección solo en campos de búsqueda */
body.copy-protected input[type="text"],
body.copy-protected input[type="search"],
body.copy-protected textarea {
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

/* Bloquear arrastre de imágenes */
body.copy-protected img {
    -webkit-user-drag: none;
    -khtml-user-drag: none;
    -moz-user-drag: none;
    -o-user-drag: none;
    user-drag: none;
    pointer-events: none;
}

/* Tablas con protección extra */
.protected-table {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

.protected-table td,
.protected-table th {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

.protected-table::selection,
.protected-table *::selection {
    background: transparent;
}

/* ============================================================================
   STICKY TABLE HEADERS - Headers que acompañan el scroll
   ============================================================================ */
.table-responsive,
.table-container {
    max-height: 500px;
    overflow-y: auto;
    position: relative;
}

table thead th,
.table thead th {
    position: sticky;
    top: 0;
    background-color: #fff;
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0,0,0,0.08);
    border-bottom: 2px solid #e0e0e0;
}

table thead th::after,
.table thead th::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: -2px;
    height: 2px;
    background: linear-gradient(to bottom, rgba(0,0,0,0.05), transparent);
}

/* Overlay de advertencia para Print Screen */
.print-screen-warning {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(74, 55, 40, 0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
}

.print-screen-warning.active {
    opacity: 1;
    visibility: visible;
}

.print-screen-warning .warning-icon {
    font-size: 5rem;
    color: #fff;
    margin-bottom: 1.5rem;
}

.print-screen-warning .warning-text {
    color: #fff;
    font-size: 1.5rem;
    font-weight: 600;
    text-align: center;
    max-width: 500px;
    line-height: 1.5;
}

.print-screen-warning .warning-subtext {
    color: rgba(255,255,255,0.7);
    font-size: 1rem;
    margin-top: 1rem;
}

/* Marca de agua diagonal en contenedores protegidos */
.watermark-container {
    position: relative;
    overflow: hidden;
}

.watermark-container::before {
    content: 'CONFIDENCIAL - SPOTTERAG';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-35deg);
    font-size: 4rem;
    font-weight: 700;
    color: rgba(74, 55, 40, 0.06);
    white-space: nowrap;
    pointer-events: none;
    z-index: 5;
    letter-spacing: 0.5rem;
}

/* Múltiples marcas de agua para tablas grandes */
.watermark-repeat {
    position: relative;
}

.watermark-repeat::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        repeating-linear-gradient(
            -35deg,
            transparent,
            transparent 100px,
            rgba(74, 55, 40, 0.03) 100px,
            rgba(74, 55, 40, 0.03) 102px
        );
    pointer-events: none;
    z-index: 4;
}

:root {
    --compras-primary: #2e7d32;
    --compras-light: #4caf50;
    --compras-lighter: #81c784;
    --compras-bg: #e8f5e9;
    
    --ventas-primary: #c62828;
    --ventas-light: #e53935;
    --ventas-lighter: #ef5350;
    --ventas-bg: #ffebee;
    
    --balance-primary: #f57c00;
    --balance-bg: #fff3e0;
    
    --white: #ffffff;
    --text-dark: #2c2c2c;
    --text-muted: #6c757d;
    --border-light: #e5e5e5;
    --shadow-soft: rgba(74, 55, 40, 0.08);
    
    /* Apple-style Border Radius System */
    --radius-xs: 8px;   /* Pills, small tags */
    --radius-sm: 12px;  /* Small buttons, chips */
    --radius-md: 16px;  /* Inputs, medium buttons */
    --radius-lg: 20px;  /* Cards, large containers */
    --radius-xl: 24px;  /* App icons, avatars */
    --radius-apple-icon: 22%;  /* App Store style - super rounded logos */
    
    /* Apple-style Easing Curve */
    --ease-apple: cubic-bezier(0.4, 0, 0.2, 1);
    
    /* Apple-style Shadows (subtle, multilayer) */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(74, 55, 40, 0.04);
    --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.05), 0 4px 12px rgba(74, 55, 40, 0.06);
    --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.06), 0 8px 24px rgba(74, 55, 40, 0.08);
    --shadow-xl: 0 8px 32px rgba(0, 0, 0, 0.08), 0 12px 48px rgba(74, 55, 40, 0.10);
}

* {
    box-sizing: border-box;
}

body {
    background-color: var(--white);
    font-family: 'Inter', 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
    margin: 0;
    padding: 0;
    color: var(--text-dark);
    min-height: 100vh;
    min-height: 100svh;
    display: flex;
    flex-direction: column;
    font-size: 16px;
}

/* DESKTOP OPTIMIZATIONS - Tamaños base más grandes */
@media (min-width: 1024px) {
    body {
        font-size: 17px;
    }
}

body.landing {
    overflow-y: auto;
    overflow-x: hidden;
}

body.landing #mainContent {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
}

body.landing footer {
    margin-top: 1rem;
}

.hero-section {
    background: linear-gradient(135deg, #ffffff 0%, #fafafa 100%);
    padding: 1.5rem 0 1rem 0;
    border-bottom: 2px solid var(--border-light);
}

.hero-section-search {
    background: linear-gradient(135deg, #ffffff 0%, #fafafa 100%);
    padding: 2rem 0 1.5rem 0;
    border-bottom: 2px solid var(--border-light);
}

.logo-container {
    text-align: center;
    margin-bottom: 1rem;
    animation: logoEntrance 0.8s ease-out;
}

.logo-container-search {
    text-align: center;
    margin-bottom: 2rem;
    animation: logoEntrance 0.8s ease-out;
}

@keyframes logoEntrance {
    from { 
        opacity: 0; 
        transform: translateY(-40px) scale(0.85);
    }
    to { 
        opacity: 1; 
        transform: translateY(0) scale(1);
    }
}

/* Logo responsive - se ajusta automáticamente según viewport */
.logo-container img {
    height: clamp(140px, 20vh, 480px); /* Escala entre 140px y 480px según altura de viewport */
    max-width: 90%;
    width: auto;
    margin-bottom: 0.5rem;
    transition: all 0.3s var(--ease-apple);
    filter: drop-shadow(0 4px 12px rgba(74, 55, 40, 0.12));
    background: transparent;
    mix-blend-mode: multiply;
    border-radius: var(--radius-apple-icon);
}

.logo-container-search img {
    height: clamp(180px, 25vh, 500px); /* Escala entre 180px y 500px según altura de viewport */
    max-width: 95%;
    width: auto;
    margin-bottom: 1rem;
    transition: all 0.3s var(--ease-apple);
    filter: drop-shadow(0 6px 16px rgba(74, 55, 40, 0.14));
    background: transparent;
    mix-blend-mode: multiply;
    border-radius: var(--radius-apple-icon);
}

/* Ajustes específicos para pantallas muy pequeñas */
@media (max-height: 600px) or (max-width: 480px) {
    .logo-container img {
        height: clamp(100px, 15vh, 180px);
    }
    .logo-container-search img {
        height: clamp(120px, 18vh, 220px);
    }
}

/* Ajustes para tablets */
@media (min-width: 768px) and (min-height: 800px) {
    .logo-container img {
        height: clamp(200px, 22vh, 480px);
    }
    .logo-container-search img {
        height: clamp(250px, 28vh, 500px);
    }
}

/* Ajustes para desktop grandes */
@media (min-width: 1440px) and (min-height: 900px) {
    .logo-container img {
        height: clamp(280px, 25vh, 480px);
    }
    .logo-container-search img {
        height: clamp(350px, 30vh, 500px);
    }
}

.logo-container img:hover,
.logo-container-search img:hover {
    transform: scale(1.05);
    filter: drop-shadow(0 8px 20px rgba(74, 55, 40, 0.18));
}

/* Header compacto del dashboard */
.dashboard-compact-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    padding: 0.75rem 1rem;
    margin-bottom: 1.5rem;
    background: #ffffff;
    border-bottom: 1px solid rgba(74, 55, 40, 0.1);
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.logo-compact {
    flex-shrink: 0;
}

.logo-compact img {
    height: 42px;
    max-width: 120px;
    filter: drop-shadow(0 1px 3px rgba(74, 55, 40, 0.08));
    transition: all 0.2s var(--ease-apple);
    border-radius: var(--radius-apple-icon); /* App Store style - super rounded */
}

.logo-compact img:hover {
    transform: scale(1.02);
}

.btn-menu-header,
.btn-logout-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    background: transparent;
    border: 1px solid rgba(74, 55, 40, 0.15);
    border-radius: var(--radius-sm);
    color: var(--ruga-brown);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s var(--ease-apple);
    white-space: nowrap;
    min-height: 44px; /* Apple hit target */
}

/* DESKTOP: Botones de header más grandes */
@media (min-width: 1024px) {
    .btn-menu-header,
    .btn-logout-header {
        padding: 0.95rem 1.75rem;
        font-size: 1.05rem;
        min-height: 52px;
    }
    
    .dashboard-compact-header {
        padding: 1rem 1.5rem;
        margin-bottom: 2rem;
    }
    
    .logo-compact img {
        height: 56px;
        max-width: 160px;
    }
}

.btn-menu-header {
    flex-shrink: 0;
    justify-content: center;
    white-space: normal;
    max-width: 180px;
    text-align: center;
    line-height: 1.3;
}

.btn-logout-header {
    flex-shrink: 0;
    min-width: fit-content; /* Evitar que se corte "Cerrar Sesión" */
}

.btn-menu-header:hover,
.btn-logout-header:hover {
    background: rgba(74, 55, 40, 0.05);
    border-color: rgba(74, 55, 40, 0.25);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-menu-header svg,
.btn-logout-header svg {
    flex-shrink: 0;
}

@media (max-width: 768px) {
    .dashboard-compact-header {
        gap: 0.5rem;
        padding: 0.5rem 0.75rem;
        flex-wrap: wrap; /* Permitir wrap si es necesario */
    }
    
    .logo-compact img {
        height: 36px;
    }
    
    .btn-menu-header span,
    .btn-logout-header span {
        font-size: 0.8rem;
    }
    
    .btn-menu-header,
    .btn-logout-header {
        padding: 0.65rem 1rem; /* Aumentado padding horizontal */
        min-height: 44px; /* Mantener Apple hit target en mobile */
        font-size: 0.85rem;
    }
    
    .btn-menu-header {
        max-width: none; /* Sin límite en mobile para que se vea completo */
        flex: 1 1 auto;
    }
    
    .btn-logout-header {
        flex: 0 0 auto;
        white-space: nowrap;
    }
}

/* Header simplificado para Vista Productor (2 columnas, sin logo) */
.productor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 1rem 0;
    margin-bottom: 0.5rem;
}

/* DESKTOP: Headers de productor más espaciosos */
@media (min-width: 1024px) {
    .productor-header {
        padding: 1.5rem 0;
        margin-bottom: 1rem;
        gap: 1.5rem;
    }
}

/* Logo grande en Vista Productor con estilos Apple - aparece junto con el texto */
.logo-productor-grande {
    height: 220px;
    max-width: 100%;
    border-radius: var(--radius-apple-icon);
    box-shadow: var(--shadow-md);
    filter: drop-shadow(0 4px 8px rgba(74, 55, 40, 0.15));
    transition: all 0.3s var(--ease-apple);
    animation: fadeInLogo 0.6s ease-out 0s backwards;
}

.logo-productor-grande:hover {
    transform: scale(1.02);
    box-shadow: var(--shadow-lg);
}

/* DESKTOP: Logo más grande y prominente */
@media (min-width: 1024px) {
    .logo-productor-grande {
        height: 320px;
    }
}

/* Nuevo header Buscar Hacienda - Diseño profesional (3 columnas, con logo) */
.hacienda-header {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 1rem;
    padding: 1rem 0;
    margin-bottom: 1.5rem;
}

.logo-center {
    display: flex;
    justify-content: center;
    align-items: center;
}

.logo-center img {
    height: 48px;
    max-width: 180px;
    filter: drop-shadow(0 2px 4px rgba(74, 55, 40, 0.12));
    border-radius: var(--radius-apple-icon);
    transition: all 0.2s var(--ease-apple);
}

.logo-center img:hover {
    transform: scale(1.03);
}

/* DESKTOP: Logo en header de hacienda más grande */
@media (min-width: 1024px) {
    .hacienda-header {
        padding: 1.5rem 0;
        margin-bottom: 2rem;
    }
    
    .logo-center img {
        height: 64px;
        max-width: 240px;
    }
    
    .btn-back-simple,
    .btn-logout-simple {
        height: 52px;
        font-size: 16px;
        padding: 0 28px;
    }
}

.btn-back-simple {
    min-width: 44px;
    width: auto;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 14px;
    background: transparent;
    border: 1px solid rgba(74, 55, 40, 0.2);
    border-radius: var(--radius-md);
    color: var(--ruga-brown);
    cursor: pointer;
    transition: all 0.2s var(--ease-apple);
    flex-shrink: 0;
    font-size: 14px;
    font-weight: 500;
}

.btn-back-simple svg {
    flex-shrink: 0;
}

.btn-back-simple span {
    line-height: 1;
}

.btn-logout-simple {
    min-width: 170px;
    width: auto;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 24px;
    background: transparent;
    border: 1px solid rgba(74, 55, 40, 0.2);
    border-radius: var(--radius-md);
    color: var(--ruga-brown);
    cursor: pointer;
    transition: all 0.2s var(--ease-apple);
    flex-shrink: 0;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    line-height: 1.2;
}

.btn-logout-simple svg {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
}

.btn-logout-simple span {
    line-height: 1.2;
    display: inline-block;
    vertical-align: middle;
}

/* Botones outline con colores RUGA */
.btn-outline-ruga {
    color: var(--ruga-brown);
    border-color: var(--ruga-brown);
    background: transparent;
}

.btn-outline-ruga:hover,
.btn-outline-ruga:focus {
    color: white;
    background-color: var(--ruga-brown);
    border-color: var(--ruga-brown);
}

.btn-check:checked + .btn-outline-ruga {
    color: white;
    background-color: var(--ruga-brown);
    border-color: var(--ruga-brown);
}

/* Controles de Leaflet - Zoom y Capa Base a la misma altura */
.leaflet-top.leaflet-left {
    top: 10px !important;
    left: 10px !important;
}

.leaflet-top.leaflet-right {
    top: 10px !important;
    right: 10px !important;
}

/* Estilos Apple para controles de Leaflet */
.leaflet-control-zoom,
.leaflet-control-layers,
.leaflet-control-fullscreen {
    background: rgba(255, 255, 255, 0.95) !important;
    backdrop-filter: blur(20px) !important;
    -webkit-backdrop-filter: blur(20px) !important;
    border: 0.5px solid rgba(0,0,0,0.15) !important;
    border-radius: 10px !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.12), 0 0 1px rgba(0,0,0,0.05) !important;
    overflow: hidden !important;
}

.leaflet-control-zoom a,
.leaflet-control-fullscreen a {
    background-color: transparent !important;
    border-bottom: 0.5px solid rgba(0,0,0,0.08) !important;
    color: #1d1d1f !important;
    font-weight: 500 !important;
    font-size: 18px !important;
    line-height: 32px !important;
    width: 32px !important;
    height: 32px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: background-color 0.2s ease !important;
}

.leaflet-control-zoom a:hover,
.leaflet-control-fullscreen a:hover {
    background-color: rgba(0,0,0,0.06) !important;
    color: #000 !important;
}

.leaflet-control-zoom a:active,
.leaflet-control-fullscreen a:active {
    background-color: rgba(0,0,0,0.12) !important;
    transition: background-color 0.05s ease !important;
}

.leaflet-control-zoom a:last-child,
.leaflet-control-fullscreen a:last-child {
    border-bottom: none !important;
}

.leaflet-control-layers {
    background: rgba(255, 255, 255, 0.95) !important;
    backdrop-filter: blur(20px) !important;
    -webkit-backdrop-filter: blur(20px) !important;
    border: 0.5px solid rgba(0,0,0,0.15) !important;
    border-radius: 10px !important;
}

.leaflet-control-layers-toggle {
    background-color: transparent !important;
    background-image: none !important;
    width: 36px !important;
    height: 36px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.2s ease !important;
    font-family: "Font Awesome 6 Free" !important;
    font-weight: 900 !important;
    border-radius: 10px !important;
}

.leaflet-control-layers-toggle:hover {
    background-color: rgba(74, 55, 40, 0.1) !important;
}

.leaflet-control-layers-toggle:active {
    background-color: rgba(74, 55, 40, 0.18) !important;
    transition: background-color 0.05s ease !important;
}

.leaflet-control-layers-toggle::before {
    content: "\f5fd" !important;
    font-family: "Font Awesome 6 Free" !important;
    font-weight: 900 !important;
    font-size: 16px !important;
    color: #4a3728 !important;
}

/* Estilos específicos para el botón de fullscreen */
.leaflet-control-fullscreen a.leaflet-control-fullscreen-button {
    background-color: transparent !important;
    background-image: none !important;
    border-bottom: 0.5px solid rgba(0,0,0,0.08) !important;
    color: #1d1d1f !important;
    font-weight: 500 !important;
    font-size: 18px !important;
    line-height: 32px !important;
    width: 32px !important;
    height: 32px !important;
}

.leaflet-control-fullscreen a.leaflet-control-fullscreen-button:hover {
    background-color: rgba(0,0,0,0.06) !important;
}

.leaflet-control-fullscreen a.fullscreen-icon {
    background-color: transparent !important;
}

/* Arreglar el ícono del botón fullscreen que aparece blanco */
.leaflet-control-fullscreen a {
    background-color: transparent !important;
    background-image: none !important;
}

.leaflet-control-fullscreen a::before {
    content: '⛶' !important;
    font-size: 20px !important;
    line-height: 32px !important;
    display: block !important;
    color: #1d1d1f !important;
}

.leaflet-control-fullscreen.fullscreen-on a::before {
    content: '⛶' !important;
}

/* FULLSCREEN del mapa Leaflet - funciona en PC Y MÓVIL */
.leaflet-fullscreen-on {
    width: 100% !important;
    height: 100% !important;
}

/* FULLSCREEN del mapa Leaflet - funciona en TODOS los navegadores */
.leaflet-fullscreen-on {
    width: 100% !important;
    height: 100% !important;
}

/* Pseudo-fullscreen: cuando HTML5 fullscreen no funciona (Safari, móviles) */
.leaflet-pseudo-fullscreen {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 2147483647 !important;
    margin: 0 !important;
    background: white !important;
}

/* Fullscreen REAL (HTML5 API) para desktop */
#stockMap:-webkit-full-screen,
#stockMap:-moz-full-screen,
#stockMap:-ms-fullscreen,
#stockMap:fullscreen,
#comercializarMap:-webkit-full-screen,
#comercializarMap:-moz-full-screen,
#comercializarMap:-ms-fullscreen,
#comercializarMap:fullscreen {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    margin: 0 !important;
    z-index: 2147483647 !important;
}

/* Bloquear scroll del body cuando está en fullscreen */
.leaflet-fullscreen-on body {
    overflow: hidden !important;
}

/* Ocultar filtros cuando está en fullscreen */
.leaflet-container:-webkit-full-screen ~ #stockMapFilters,
.leaflet-container:-moz-full-screen ~ #stockMapFilters,
.leaflet-container:fullscreen ~ #stockMapFilters,
.leaflet-pseudo-fullscreen ~ #stockMapFilters {
    display: none !important;
}

/* ALTERNATIVA: Ocultar botón fullscreen SOLO EN MÓVIL (descomentar si querés) */
/*
@media (max-width: 768px) {
    .leaflet-control-fullscreen {
        display: none !important;
    }
}
*/

/* Contenedor botón fullscreen móvil - Igual que zoom */
.leaflet-control-fullscreen-mobile {
    background: rgba(255, 255, 255, 0.95) !important;
    backdrop-filter: blur(20px) !important;
    -webkit-backdrop-filter: blur(20px) !important;
    border-radius: 8px !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15) !important;
    border: none !important;
}

.leaflet-control-fullscreen-mobile a {
    background-color: transparent !important;
    border: none !important;
    color: #1d1d1f !important;
    font-weight: 500 !important;
    width: 34px !important;
    height: 34px !important;
    line-height: 34px !important;
    font-size: 20px !important;
    text-align: center !important;
    text-decoration: none !important;
    display: block !important;
    cursor: pointer !important;
}

.leaflet-control-fullscreen-mobile a:hover {
    background-color: rgba(0,0,0,0.06) !important;
    color: #000 !important;
}

.leaflet-control-fullscreen-mobile a:active {
    background-color: rgba(0,0,0,0.12) !important;
    transition: background-color 0.05s ease !important;
}

/* Overlay del layer control */
.leaflet-control-layers-expanded {
    background: rgba(255, 255, 255, 0.98) !important;
    backdrop-filter: blur(20px) !important;
    -webkit-backdrop-filter: blur(20px) !important;
    padding: 10px 14px !important;
    border-radius: 12px !important;
    box-shadow: 0 4px 16px rgba(0,0,0,0.15), 0 0 1px rgba(0,0,0,0.08) !important;
    min-width: 120px !important;
}

.leaflet-control-layers-expanded .leaflet-control-layers-base {
    padding: 0 !important;
}

.leaflet-control-layers-expanded .leaflet-control-layers-base label {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    padding: 8px 10px !important;
    margin: 2px 0 !important;
    border-radius: 8px !important;
    cursor: pointer !important;
    transition: background-color 0.15s ease !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    color: #1d1d1f !important;
}

.leaflet-control-layers-expanded .leaflet-control-layers-base label:hover {
    background-color: rgba(74, 55, 40, 0.08) !important;
}

.leaflet-control-layers-expanded .leaflet-control-layers-separator {
    display: none !important;
}

.leaflet-control-layers-expanded input[type="radio"] {
    width: 16px !important;
    height: 16px !important;
    accent-color: #4a3728 !important;
    margin: 0 !important;
}

/* ============================================================================
   LEYENDAS PROFESIONALES - Sistema unificado de leyendas
   ============================================================================ */

/* Leyenda para mapas Leaflet */
.leaflet-legend {
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 12px 16px;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12), 0 0 1px rgba(0,0,0,0.08);
    max-width: 260px;
    min-width: 180px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 12px;
    color: #1d1d1f;
    transition: all 0.2s ease;
}

.leaflet-legend:hover {
    box-shadow: 0 6px 20px rgba(0,0,0,0.16);
}

.leaflet-legend .legend-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 8px;
    margin-bottom: 8px;
    border-bottom: 1px solid rgba(0,0,0,0.06);
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    color: var(--ruga-brown);
}

.leaflet-legend .legend-toggle {
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: background 0.15s ease;
}

.leaflet-legend .legend-toggle:hover {
    background: rgba(0,0,0,0.06);
}

.leaflet-legend .legend-items {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.leaflet-legend .legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 6px;
    border-radius: 6px;
    transition: background 0.15s ease;
}

.leaflet-legend .legend-item:hover {
    background: rgba(0,0,0,0.04);
}

.leaflet-legend .legend-color {
    width: 14px;
    height: 14px;
    border-radius: 4px;
    flex-shrink: 0;
    box-shadow: inset 0 0 0 1px rgba(0,0,0,0.08);
}

.leaflet-legend .legend-line {
    width: 20px;
    height: 3px;
    border-radius: 2px;
    flex-shrink: 0;
}

.leaflet-legend .legend-label {
    flex: 1;
    font-size: 12px;
    color: #333;
    white-space: nowrap;
}

.leaflet-legend .legend-count {
    font-size: 11px;
    font-weight: 500;
    color: #666;
    background: rgba(0,0,0,0.04);
    padding: 2px 6px;
    border-radius: 10px;
}

/* Leyenda para gráficos Chart.js - Estilo inline */
.chart-legend-inline {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px 20px;
    padding: 10px 16px;
    background: #f8f9fa;
    border-radius: 10px;
    margin-top: 12px;
    font-size: 12px;
}

.chart-legend-inline .legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.chart-legend-inline .legend-item:hover {
    background: rgba(0,0,0,0.06);
}

.chart-legend-inline .legend-item.inactive {
    opacity: 0.4;
}

.chart-legend-inline .legend-color {
    width: 10px;
    height: 10px;
    border-radius: 3px;
}

.chart-legend-inline .legend-label {
    font-weight: 500;
    color: #333;
}

/* Leyenda del mapa de flujos */
.flujos-legend {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 12px 16px;
    border: 1px solid #e0e0e0;
    text-align: center;
}

.flujos-legend-items {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px 16px;
}

.flujos-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #333;
}

.flujos-legend-line {
    display: inline-block;
    width: 24px;
    height: 3px;
    border-radius: 2px;
}

/* Responsive para leyendas */
@media (max-width: 768px) {
    .leaflet-legend {
        max-width: 180px;
        padding: 10px 12px;
        font-size: 11px;
    }
    
    .leaflet-legend .legend-header {
        font-size: 10px;
    }
    
    .chart-legend-inline {
        gap: 8px 12px;
        padding: 8px 12px;
        font-size: 11px;
    }
    
    .chart-legend-inline .legend-item {
        padding: 3px 6px;
    }
    
    .flujos-legend {
        padding: 10px 12px;
    }
    
    .flujos-legend-items {
        gap: 8px 12px;
    }
    
    .flujos-legend-item {
        font-size: 12px;
    }
}

/* ============================================================================ */

.btn-back-simple:hover,
.btn-logout-simple:hover {
    background: rgba(74, 55, 40, 0.06);
    border-color: rgba(74, 55, 40, 0.35);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.btn-back-simple:active,
.btn-logout-simple:active {
    transform: translateY(0);
}

@media (max-width: 768px) {
    .hacienda-header {
        grid-template-columns: auto 1fr auto;
        gap: 0.5rem;
        padding: 0.75rem 0;
    }
    
    .logo-center img {
        height: 40px;
        max-width: 140px;
    }
    
    .btn-back-simple {
        min-width: 40px;
        height: 40px;
        padding: 0 10px;
        font-size: 13px;
    }
    
    .btn-logout-simple {
        min-width: 100px;
        height: 40px;
        padding: 0 12px;
        font-size: 12px;
    }
    
    .quota-counter-centered {
        font-size: 0.7rem;
        padding: 0.35rem 0.6rem;
        max-width: calc(100vw - 280px);
        overflow: hidden;
        white-space: nowrap;
    }
    
    .quota-item {
        display: inline-block;
        margin: 0 0.3rem;
        font-size: 0.7rem;
    }
    
    .quota-item:last-child {
        margin-right: 0;
    }
}

/* Extra pequeño (iPhone SE, etc) */
@media (max-width: 480px) {
    .dashboard-compact-header {
        gap: 0.4rem;
        padding: 0.4rem 0.5rem;
    }
    
    .btn-menu-header,
    .btn-logout-header {
        padding: 0.6rem 0.8rem;
        font-size: 0.8rem;
        gap: 0.35rem;
    }
    
    .logo-compact img {
        height: 32px;
    }
}

.back-button-compact {
    background: transparent;
    border: 1px solid var(--ruga-brown);
    color: var(--ruga-brown);
    padding: 0.65rem 1.25rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s var(--ease-apple);
    white-space: nowrap;
    min-height: 44px;
}

.back-button-compact:hover {
    background: var(--ruga-brown);
    color: white;
    transform: translateX(-3px);
}


/* Tabs más compactos para Compras/Ventas/Geografía */
.nav-tabs.card-header-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: rgba(74, 55, 40, 0.3) transparent;
}

.nav-tabs.card-header-tabs::-webkit-scrollbar {
    height: 6px;
}

.nav-tabs.card-header-tabs::-webkit-scrollbar-track {
    background: transparent;
}

.nav-tabs.card-header-tabs::-webkit-scrollbar-thumb {
    background-color: rgba(74, 55, 40, 0.3);
    border-radius: var(--radius-xs);
}

.nav-tabs.card-header-tabs .nav-link {
    padding: 0.65rem 0.85rem;
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
    min-height: 44px; /* Apple hit target */
}

/* DESKTOP: Card header tabs más legibles */
@media (min-width: 1024px) {
    .nav-tabs.card-header-tabs .nav-link {
        padding: 0.85rem 1.25rem;
        font-size: 1rem;
        min-height: 52px;
    }
}

.search-container {
    max-width: 850px;
    margin: 0 auto;
    position: relative;
    animation: searchSlideIn 0.6s ease-out 0.2s backwards;
    padding-bottom: 0;
}

/* DESKTOP: Container de búsqueda más ancho */
@media (min-width: 1024px) {
    .search-container {
        max-width: 1100px;
    }
}

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

.search-box {
    display: flex;
    gap: 1rem;
    background: white;
    padding: 0.75rem;
    border-radius: var(--radius-md);
    border: 2px solid var(--border-light);
    box-shadow: var(--shadow-md);
    transition: all 0.3s var(--ease-apple);
}

.search-box:focus-within {
    border-color: var(--ruga-brown);
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

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

.search-box input {
    border: none !important;
    box-shadow: none !important;
    border-radius: var(--radius-sm);
    padding: 1rem 3rem 1rem 1.5rem;
    font-size: 1.1rem;
    color: var(--text-dark);
    flex: 1;
    min-height: 44px; /* Apple hit target */
}

/* DESKTOP: Input de búsqueda más grande y espacioso */
@media (min-width: 1024px) {
    .search-box {
        padding: 1rem;
    }
    
    .search-box input {
        padding: 1.25rem 3.5rem 1.25rem 2rem;
        font-size: 1.25rem;
        min-height: 56px;
    }
    
    .search-box button {
        padding: 1.25rem 2.5rem;
        font-size: 1.15rem;
    }
}

.search-clear-btn {
    position: absolute;
    right: 14px;
    top: 0;
    bottom: 0;
    margin: auto 0;
    background: none !important;
    border: none !important;
    box-shadow: none !important;
    color: var(--ruga-brown);
    font-size: 1.5rem;
    font-weight: 300;
    line-height: 1;
    text-align: center;
    cursor: pointer;
    padding: 0 !important;
    width: 32px !important;
    height: 32px !important;
    box-sizing: border-box !important;
    display: none;
    transition: opacity 0.2s ease, color 0.2s ease;
    opacity: 0.6;
    border-radius: var(--radius-xs);
}

@media (max-width: 768px) {
    .search-clear-btn {
        font-size: 1.6rem;
        right: 10px;
        width: 36px !important;
        height: 36px !important;
        opacity: 0.7;
    }
}

.search-clear-btn:hover {
    opacity: 1;
    background: none !important;
}

.search-clear-btn:active {
    opacity: 0.8;
    background: none !important;
}

.search-clear-btn:focus {
    outline: none !important;
    box-shadow: none !important;
    background: none !important;
}

.search-input-wrapper:has(input:not(:placeholder-shown)) .search-clear-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.15s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 0.7;
    }
}

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

.search-box input:focus {
    outline: none;
}

.search-box button {
    background: linear-gradient(135deg, var(--ruga-brown) 0%, var(--ruga-light-brown) 100%);
    border: none;
    border-radius: var(--radius-sm);
    padding: 1rem 3rem;
    font-weight: 700;
    font-size: 1.1rem;
    transition: all 0.3s var(--ease-apple);
    white-space: nowrap;
    box-shadow: var(--shadow-md);
    min-height: 44px; /* Apple hit target */
}

.search-box button:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

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

.suggestions-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border-radius: var(--radius-md);
    border: 2px solid var(--border-light);
    box-shadow: var(--shadow-xl);
    max-height: 450px;
    overflow-y: auto;
    z-index: 1000;
    margin-top: 0.75rem;
    display: none !important;
}

.suggestions-dropdown.show {
    display: block !important;
    animation: dropdownSlide 0.3s ease-out;
}

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

.suggestion-item {
    padding: 1.25rem 1.75rem;
    border-bottom: 1px solid var(--border-light);
    cursor: pointer;
    transition: all 0.2s var(--ease-apple);
    min-height: 44px; /* Apple hit target */
}

.suggestion-item:hover {
    background: linear-gradient(90deg, var(--ruga-beige) 0%, transparent 100%);
    padding-left: 2rem;
}

.suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-name {
    font-weight: 700;
    color: var(--ruga-brown);
    margin-bottom: 0.25rem;
    font-size: 1.05rem;
}

.suggestion-cuit {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.dashboard-section {
    animation: dashboardFadeIn 0.6s ease-out;
    padding-top: 2.5rem;
}

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

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.98) 0%, rgba(250, 250, 250, 0.98) 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
}

.loading-icon {
    width: 120px;
    height: 120px;
    animation: loadingPulse 2s ease-in-out infinite;
}

.hoof-main {
    fill: var(--ruga-brown);
    opacity: 0.9;
}

.hoof-toe {
    fill: var(--ruga-brown);
    opacity: 0.8;
}

.hoof-group {
    animation: hoofStep 1.5s ease-in-out infinite;
}

.hoof-group:nth-child(2) {
    animation-delay: 0.75s;
}

@keyframes loadingPulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.05); opacity: 0.85; }
}

@keyframes hoofStep {
    0%, 100% { 
        opacity: 0.4;
        transform: translateY(0);
    }
    50% { 
        opacity: 1;
        transform: translateY(-5px);
    }
}

.loading-message {
    font-size: 1.25rem;
    color: var(--ruga-brown);
    font-weight: 600;
    text-align: center;
    letter-spacing: 0.5px;
}

/* DESKTOP: Loading más grande y visible */
@media (min-width: 1024px) {
    .loading-icon {
        width: 160px;
        height: 160px;
    }
    
    .loading-message {
        font-size: 1.5rem;
    }
    
    .loading-bar {
        width: 280px;
        height: 4px;
    }
}

.loading-bar {
    width: 200px;
    height: 3px;
    background: rgba(74, 55, 40, 0.15);
    border-radius: var(--radius-xs);
    overflow: hidden;
}

.loading-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, 
        var(--ruga-brown) 0%, 
        var(--ruga-light-brown) 50%, 
        var(--ruga-brown) 100%
    );
    background-size: 200% 100%;
    animation: loadingBarMove 1.5s ease-in-out infinite;
}

@keyframes loadingBarMove {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.card {
    border: 2px solid var(--border-light);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    transition: all 0.3s var(--ease-apple);
    animation: cardSlideUp 0.5s var(--ease-apple) backwards;
}

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

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

.card-header {
    background: linear-gradient(135deg, var(--ruga-brown) 0%, var(--ruga-light-brown) 100%);
    color: white;
    border: none;
    padding: 1.25rem 1.5rem;
    min-height: 70px;
    display: flex;
    align-items: center;
}

.actor-header-info {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    width: 100%;
}

.card-header h4 {
    color: white;
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.2;
}

.actor-cuit {
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.95rem;
    font-weight: 400;
    white-space: nowrap;
}

/* DESKTOP: Headers más grandes y prominentes */
@media (min-width: 1024px) {
    .card-header {
        padding: 1.75rem 2rem;
        min-height: 90px;
    }
    
    .card-header h4 {
        font-size: 2rem;
    }
    
    .actor-cuit {
        font-size: 1.1rem;
    }
    
    .card-header h6 {
        font-size: 1.35rem;
    }
}

/* Stock filter buttons - NO wrap en mobile */
.stock-filter-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.stock-filter-buttons::-webkit-scrollbar {
    height: 4px;
}

.stock-filter-buttons::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 2px;
}

.stock-mode-btn {
    white-space: nowrap;
    flex-shrink: 0;
    font-size: 0.8rem !important;
    padding: 0.4rem 0.75rem !important;
}

/* DESKTOP: Botones de filtro de stock más grandes */
@media (min-width: 1024px) {
    .stock-mode-btn {
        font-size: 1rem !important;
        padding: 0.65rem 1.25rem !important;
    }
}

@media (max-width: 768px) {
    .card-header {
        padding: 1rem 1.25rem;
        min-height: auto;
    }
    
    .actor-header-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.35rem;
    }
    
    .card-header h4 {
        font-size: 1.15rem;
        line-height: 1.3;
    }
    
    .actor-cuit {
        font-size: 0.85rem;
    }
}

.card-header h6 {
    color: white;
    margin: 0;
    font-size: 1.15rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ruga-tabs {
    border-bottom: 2px solid #e0e0e0;
    margin-bottom: 2rem !important;
    flex-wrap: nowrap !important;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
}

.ruga-tabs .nav-item {
    flex-shrink: 0;
}

.ruga-tabs .nav-link {
    color: var(--ruga-brown) !important;
    font-weight: 600;
    font-size: 1rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-bottom: 3px solid transparent;
    transition: all 0.2s var(--ease-apple);
    background-color: transparent !important;
    white-space: nowrap;
    min-height: 44px; /* Apple hit target */
}

/* DESKTOP: Tabs más espaciosos y legibles */
@media (min-width: 1024px) {
    .ruga-tabs .nav-link {
        font-size: 1.2rem;
        padding: 1rem 2.5rem;
        min-height: 56px;
    }
}

.nav.nav-tabs.ruga-tabs .nav-link {
    color: var(--ruga-brown) !important;
}

.ruga-tabs .nav-link:hover {
    color: var(--ruga-brown) !important;
    background-color: rgba(74, 55, 40, 0.05) !important;
    border-bottom-color: rgba(74, 55, 40, 0.3);
}

.ruga-tabs .nav-link.active {
    color: var(--ruga-brown) !important;
    background-color: transparent !important;
    border-bottom-color: var(--ruga-brown);
    font-weight: 700;
}

@media (max-width: 768px) {
    .ruga-tabs .nav-link {
        font-size: 0.85rem;
        padding: 0.6rem 0.8rem;
    }
}

/* Pills estilo RUGA para Análisis de Concentración */
.ruga-pills .nav-link {
    color: var(--ruga-brown) !important;
    font-weight: 600;
    font-size: 0.95rem;
    padding: 0.65rem 1.25rem;
    border: 2px solid rgba(74, 55, 40, 0.2);
    border-radius: var(--radius-md);
    transition: all 0.2s var(--ease-apple);
    background-color: transparent !important;
    margin-right: 0.5rem;
}

/* DESKTOP: Pills más grandes */
@media (min-width: 1024px) {
    .ruga-pills .nav-link {
        font-size: 1.1rem;
        padding: 0.85rem 1.75rem;
        margin-right: 0.75rem;
    }
}

.ruga-pills .nav-link:hover {
    color: var(--ruga-brown) !important;
    background-color: rgba(74, 55, 40, 0.08) !important;
    border-color: rgba(74, 55, 40, 0.4);
}

.ruga-pills .nav-link.active {
    color: white !important;
    background-color: var(--ruga-brown) !important;
    border-color: var(--ruga-brown);
    font-weight: 700;
}

.metric-card {
    background: linear-gradient(135deg, #ffffff 0%, #fafafa 100%);
    border-radius: var(--radius-lg);
    border: 2px solid var(--border-light);
    padding: 2.5rem 2rem;
    text-align: center;
    transition: all 0.3s var(--ease-apple);
    height: 100%;
    min-height: 180px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    box-shadow: var(--shadow-sm);
}

.metric-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-lg);
}

.metric-label {
    color: var(--text-muted);
    font-size: 0.95rem;
    font-weight: 800;
    margin-bottom: 1.25rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

.metric-value {
    font-size: 2.5rem;
    font-weight: 900;
    line-height: 1.1;
    margin: 0.75rem 0;
    word-break: break-word;
}

.metric-value-small {
    font-size: 1.5rem;
    font-weight: 800;
    word-break: break-word;
}

/* DESKTOP: Métricas más grandes y visibles */
@media (min-width: 1024px) {
    .metric-card {
        padding: 3rem 2.5rem;
        min-height: 220px;
    }
    
    .metric-value {
        font-size: 3.5rem;
    }
    
    .metric-value-small {
        font-size: 2rem;
    }
    
    .metric-label {
        font-size: 1.1rem;
    }
}

.metric-compras {
    background: linear-gradient(135deg, var(--compras-bg) 0%, #f1f8f4 100%);
    border-color: var(--compras-lighter);
}

.metric-compras:hover {
    border-color: var(--compras-primary);
}

.metric-compras .metric-value {
    color: var(--compras-primary);
}

.metric-ventas {
    background: linear-gradient(135deg, var(--ventas-bg) 0%, #fff5f7 100%);
    border-color: var(--ventas-lighter);
}

.metric-ventas:hover {
    border-color: var(--ventas-primary);
}

.metric-ventas .metric-value {
    color: var(--ventas-primary);
}

.metric-balance {
    background: linear-gradient(135deg, var(--balance-bg) 0%, #fffaf5 100%);
    border-color: #ffcc80;
}

.metric-balance:hover {
    border-color: var(--balance-primary);
}

.metric-balance .metric-value {
    color: var(--balance-primary);
}

.metric-card:nth-child(4) {
    background: linear-gradient(135deg, #fafafa 0%, #f5f5f5 100%);
}

.metric-card:nth-child(4) .metric-value-small {
    color: var(--ruga-brown);
}

.chart-container {
    position: relative;
    height: 300px;
    padding: 1rem;
}

/* Aumentar altura del gráfico temporal para barras menos achatadas */
#temporalChartCard .chart-container {
    height: 450px;
}

/* DESKTOP: Gráficos más grandes para mejor visualización */
@media (min-width: 1024px) {
    .chart-container {
        height: 400px;
        padding: 1.5rem;
    }
    
    #temporalChartCard .chart-container {
        height: 550px;
    }
}

.table {
    font-size: 0.95rem;
    margin: 0;
}

.table thead {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    color: var(--text-dark);
    font-weight: 700;
}

.table thead th {
    border-bottom: 2px solid var(--ruga-brown);
    padding: 1rem;
}

/* DESKTOP: Tablas más legibles y espaciosas */
@media (min-width: 1024px) {
    .table {
        font-size: 1.05rem;
    }
    
    .table thead th {
        padding: 1.25rem 1.5rem;
        font-size: 1.1rem;
    }
    
    .table tbody td {
        padding: 1.25rem 1.5rem;
    }
}

.table-hover tbody tr {
    transition: all 0.2s var(--ease-apple);
}

.table-hover tbody tr:hover {
    background: linear-gradient(90deg, var(--ruga-beige) 0%, transparent 100%);
    transform: translateX(4px);
}

.nav-tabs {
    border-bottom: 3px solid var(--border-light);
}

.nav-tabs .nav-link {
    color: #ffffff !important;
    border: none;
    font-weight: 600;
    padding: 1rem 2rem;
    font-size: 1.05rem;
    transition: all 0.3s var(--ease-apple);
    min-height: 44px;
}

.nav-tabs .nav-link.active {
    background-color: transparent;
    color: #ffffff !important;
    border-bottom: 4px solid var(--ruga-brown);
    font-weight: 700;
}

.nav-tabs .nav-link:hover:not(.active) {
    color: #ffffff !important;
    background: rgba(255, 255, 255, 0.1);
}

.badge-tipo {
    font-size: 0.8rem;
    padding: 0.5rem 1rem;
    font-weight: 700;
    border-radius: var(--radius-xs);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* DESKTOP: Badges más grandes y legibles */
@media (min-width: 1024px) {
    .badge-tipo {
        font-size: 0.95rem;
        padding: 0.65rem 1.25rem;
    }
}

.tipo-EST_EST {
    background: linear-gradient(135deg, #6c757d 0%, #495057 100%);
    color: white;
}

.tipo-EST_FRI {
    background: linear-gradient(135deg, var(--ventas-primary) 0%, #d32f2f 100%);
    color: white;
}

.tipo-EST_REF {
    background: linear-gradient(135deg, #ff9800 0%, #f57c00 100%);
    color: white;
}

.tipo-REF_EST {
    background: linear-gradient(135deg, var(--compras-primary) 0%, #388e3c 100%);
    color: white;
}

.contraparte-card {
    background: white;
    border: 2px solid var(--border-light);
    border-radius: var(--radius-sm);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1rem;
    transition: all 0.3s var(--ease-apple);
    box-shadow: var(--shadow-sm);
}

.contraparte-card:hover {
    border-color: var(--ruga-brown);
    box-shadow: var(--shadow-md);
    transform: translateX(8px);
}

.contraparte-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.contraparte-number {
    background: linear-gradient(135deg, var(--ruga-brown) 0%, var(--ruga-light-brown) 100%);
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.9rem;
}

.contraparte-name {
    font-weight: 700;
    color: var(--ruga-brown);
    font-size: 1rem;
    line-height: 1.3;
    margin-bottom: 0.5rem;
}

.contraparte-stats {
    display: flex;
    gap: 1.5rem;
    font-size: 0.9rem;
}

/* DESKTOP: Cards de contrapartes más espaciosas */
@media (min-width: 1024px) {
    .contraparte-card {
        padding: 1.75rem 2rem;
        margin-bottom: 1.25rem;
    }
    
    .contraparte-name {
        font-size: 1.2rem;
        margin-bottom: 0.75rem;
    }
    
    .contraparte-stats {
        font-size: 1.05rem;
        gap: 2rem;
    }
    
    .contraparte-number {
        width: 42px;
        height: 42px;
        font-size: 1.1rem;
    }
}

.contraparte-stat {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-muted);
}

.contraparte-stat strong {
    color: var(--text-dark);
    font-weight: 700;
}

.geografia-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    margin-bottom: 0.75rem;
    background: white;
    border-radius: var(--radius-sm);
    border: 2px solid var(--border-light);
    transition: all 0.3s var(--ease-apple);
}

.geografia-item:hover {
    border-color: var(--ruga-accent);
    box-shadow: 0 4px 16px rgba(139, 115, 85, 0.2);
    transform: translateX(4px);
}

.provincia-name {
    font-weight: 700;
    color: var(--text-dark);
    font-size: 1.05rem;
}

.provincia-total {
    font-weight: 800;
    color: var(--ruga-accent);
    font-size: 1.15rem;
}

/* DESKTOP: Items de geografía más grandes */
@media (min-width: 1024px) {
    .geografia-item {
        padding: 1.5rem 2rem;
        margin-bottom: 1rem;
    }
    
    .provincia-name {
        font-size: 1.25rem;
    }
    
    .provincia-total {
        font-size: 1.4rem;
    }
}

footer {
    margin-top: 2rem;
    border-top: 2px solid var(--border-light);
    background: linear-gradient(135deg, #fafafa 0%, #f5f5f5 100%);
    padding: 1.5rem 0;
}

footer .text-muted {
    color: var(--text-muted) !important;
    font-size: 0.95rem;
}

.spinner-border-sm {
    width: 1rem;
    height: 1rem;
    border-width: 0.15em;
}

.loading-simple {
    text-align: center;
    padding: 2.5rem;
    background: white;
    border-radius: var(--radius-sm);
    border: 2px solid var(--border-light);
    max-width: 400px;
    margin: 0 auto;
}

.loading-text {
    font-size: 1.1rem;
    color: var(--ruga-brown);
    font-weight: 600;
    margin-bottom: 1.5rem;
}

.progress-bar-container {
    width: 100%;
    height: 8px;
    background: #e0e0e0;
    border-radius: var(--radius-sm);
    overflow: hidden;
    position: relative;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--ruga-brown) 0%, #6b5444 50%, var(--ruga-brown) 100%);
    background-size: 200% 100%;
    border-radius: var(--radius-sm);
    animation: progressMove 1.5s linear infinite;
}

@keyframes progressMove {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

.subtitle-text {
    color: #c9b8a8 !important;
    font-weight: 500;
}

.nav-tabs {
    border-bottom: 3px solid var(--border-light);
    margin-bottom: 0;
}

.nav-tabs .nav-link {
    color: #ffffff !important;
    font-weight: 600;
    font-size: 1.1rem;
    padding: 1rem 1.5rem;
    border: none;
    border-bottom: 3px solid transparent;
    background: none;
    transition: all 0.3s var(--ease-apple);
    min-height: 44px; /* Apple hit target */
}

/* DESKTOP: Nav tabs más espaciosos */
@media (min-width: 1024px) {
    .nav-tabs .nav-link {
        font-size: 1.25rem;
        padding: 1.25rem 2rem;
        min-height: 56px;
    }
}

.nav-tabs .nav-link:hover {
    color: #ffffff !important;
    border-bottom-color: var(--ruga-accent);
    background: rgba(255, 255, 255, 0.1);
}

.nav-tabs .nav-link.active {
    color: #ffffff !important;
    font-weight: 800;
    background: var(--ruga-brown);
    border-bottom-color: var(--ruga-brown);
    box-shadow: 0 2px 8px rgba(74, 55, 40, 0.3);
}

/* Hacienda Tabs (Buscar Hacienda / Cotizador) - sobre fondo blanco */
#haciendaTabs {
    border-bottom: 2px solid var(--ruga-brown);
    background: transparent;
}

#haciendaTabs .nav-link {
    color: var(--ruga-brown) !important;
    background: #e8e0d8;
    border: 1px solid #c9b8a8;
    border-bottom: none;
    border-radius: 8px 8px 0 0;
    margin-right: 4px;
    font-weight: 600;
    transition: all 0.2s ease;
}

#haciendaTabs .nav-link:hover:not(.active) {
    background: #f0ebe7;
    color: var(--ruga-brown) !important;
}

#haciendaTabs .nav-link.active {
    color: #fff !important;
    background: var(--ruga-brown);
    border-color: var(--ruga-brown);
    font-weight: 700;
}

@media (max-width: 768px) {
    .hero-section {
        padding: 0.75rem 0 0.5rem 0;
        min-height: auto;
    }
    
    .logo-container {
        margin-bottom: 0.5rem;
        position: relative;
        padding-bottom: 50px;
    }
    
    .logo-container img {
        height: 90px;
    }
    
    .logout-btn {
        position: fixed !important;
        top: 10px !important;
        right: 10px !important;
        z-index: 2000 !important;
        font-size: 0.75rem;
        padding: 0.4rem 0.8rem !important;
        margin: 0 !important;
    }
    
    .back-button {
        font-size: 0.85rem;
        padding: 0.4rem 0.8rem;
    }
    
    .search-container {
        padding: 0 1rem;
        margin-bottom: 0;
    }
    
    .search-box {
        flex-direction: column;
        padding: 0.75rem;
        margin-bottom: 0;
    }
    
    .search-box input {
        font-size: 1rem;
        padding: 0.875rem 1.25rem;
        margin-bottom: 0.75rem;
    }
    
    .search-box button {
        width: 100%;
        padding: 0.875rem 2rem;
    }
    
    body.landing footer {
        margin-top: 0.5rem;
        padding: 0.75rem 0;
    }
    
    footer {
        margin-top: 1.5rem;
        padding: 1rem 0;
    }
    
    .dashboard-section {
        padding-top: 1.5rem;
    }
    
    .metric-card {
        min-height: 150px;
        padding: 2rem 1.5rem;
    }
    
    .metric-value {
        font-size: 2rem;
    }
    
    .chart-container {
        height: 250px;
    }
}

.logout-btn {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2000;
    background-color: var(--ruga-brown) !important;
    border: 2px solid var(--ruga-brown) !important;
    color: white !important;
    font-weight: 600;
    padding: 0.6rem 1.2rem;
    border-radius: var(--radius-xs);
    transition: all 0.3s var(--ease-apple);
    box-shadow: 0 2px 8px rgba(74, 55, 40, 0.3);
}

.logout-btn:hover {
    background-color: var(--ruga-light-brown) !important;
    border-color: var(--ruga-light-brown) !important;
    color: white !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(74, 55, 40, 0.4);
}

/* ============================================================================
   MENU INICIAL - Diseño Minimalista
   ============================================================================ */

#menuInicial {
    display: none;
    min-height: 100vh;
    height: auto;
    background: var(--ruga-beige);
    overflow-y: auto;
    overflow-x: hidden;
}

#menuInicial.active {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 0;
    min-height: 100vh;
    height: auto;
}

.menu-inicial-content {
    text-align: center;
    max-width: 500px;
    padding: 2rem;
    position: relative;
}

.logo-container-central {
    margin-top: 1rem;
    margin-bottom: 1.5rem;
}

.logo-central {
    max-width: 200px;
    width: 100%;
    height: auto;
    border-radius: var(--radius-apple-icon);
}

/* BASE: Layout compacto por defecto para que 3 botones sean visibles */
.menu-inicial-content {
    padding: 1rem 1.5rem;
}

.menu-title-minimal {
    font-size: 1rem;
    margin-bottom: 1rem;
}

.btn-menu-minimal {
    padding: 0.9rem 1.5rem;
    font-size: 0.95rem;
    margin: 0.35rem 0;
}

#menuInicial.active {
    padding: 0.5rem 0 1rem 0;
}

/* PANTALLAS MUY PEQUEÑAS (altura crítica): Máxima compactación */
@media (max-height: 650px) {
    .logo-container-central {
        margin-top: 0.5rem;
        margin-bottom: 0.75rem;
    }
    
    .logo-central {
        max-width: 140px !important;
    }
    
    .menu-title-minimal {
        font-size: 0.85rem;
        margin-bottom: 0.75rem;
    }
    
    .btn-menu-minimal {
        padding: 0.6rem 1rem;
        font-size: 0.85rem;
        margin: 0.25rem 0;
    }
}

/* DESKTOP GRANDE: Logo y layout más amplios solo en pantallas altas */
@media (min-width: 1024px) and (min-height: 900px) {
    .logo-container-central {
        margin-top: 2rem;
        margin-bottom: 2rem;
    }
    
    .logo-central {
        max-width: 320px;
    }
    
    .menu-inicial-content {
        max-width: 600px;
        padding: 2rem;
    }
    
    .menu-title-minimal {
        font-size: 1.2rem;
        margin-bottom: 1.5rem;
    }
    
    .btn-menu-minimal {
        padding: 1rem 2rem;
        font-size: 1.05rem;
        min-height: 52px;
    }
}

.btn-logout-minimal {
    position: fixed;
    top: env(safe-area-inset-top, 1rem);
    right: 1rem;
    background: rgba(74, 55, 40, 0.08);
    border: 1px solid rgba(74, 55, 40, 0.15);
    border-radius: var(--radius-xs);
    color: var(--ruga-brown);
    font-size: 0.85rem;
    font-weight: 500;
    padding: 0.65rem 1.25rem;
    cursor: pointer;
    transition: all 0.2s var(--ease-apple);
    z-index: 2000;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    min-height: 44px; /* Apple hit target */
    margin-top: 0.5rem;
}

.btn-logout-minimal:hover {
    background: rgba(74, 55, 40, 0.12);
    border-color: rgba(74, 55, 40, 0.25);
    transform: translateY(-1px);
    box-shadow: 0 3px 12px rgba(0,0,0,0.12);
}

.quota-counter-minimal {
    margin-top: 1rem;
    padding: 0.75rem 1.25rem;
    background: rgba(74, 55, 40, 0.06);
    border-radius: var(--radius-sm);
    border: 1px solid rgba(74, 55, 40, 0.1);
    font-size: 0.9rem;
    color: var(--text-muted);
    text-align: center;
}

.quota-counter-simple {
    margin-left: auto;
    padding: 0.5rem 1rem;
    background: rgba(74, 55, 40, 0.06);
    border-radius: var(--radius-xs);
    border: 1px solid rgba(74, 55, 40, 0.1);
    font-size: 0.85rem;
    color: var(--text-muted);
}

.quota-counter-centered {
    margin: 0 auto;
    padding: 0.5rem 1rem;
    background: rgba(74, 55, 40, 0.06);
    border-radius: var(--radius-xs);
    border: 1px solid rgba(74, 55, 40, 0.1);
    font-size: 0.85rem;
    color: var(--text-muted);
    text-align: center;
    white-space: nowrap;
    max-width: fit-content;
}

.quota-counter-bottom {
    margin: 0.75rem 0 0.5rem 0;
    padding: 0.6rem 1rem;
    background: rgba(74, 55, 40, 0.05);
    border-radius: var(--radius-sm);
    border: 1px solid rgba(74, 55, 40, 0.08);
    font-size: 0.85rem;
    color: var(--text-muted);
    text-align: center;
    width: 100%;
}

.quota-item {
    display: inline-block;
    margin: 0 0.75rem;
}

.quota-label {
    font-weight: 500;
    color: var(--ruga-brown);
}

.quota-warning {
    color: #d97706;
    font-weight: 600;
}

.quota-critical {
    color: #dc2626;
    font-weight: 700;
}

.menu-title-minimal {
    font-size: 1.1rem;
    font-weight: 400;
    color: var(--text-muted);
    margin-bottom: 2rem;
}

.menu-buttons-minimal {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.btn-menu-minimal {
    background: var(--ruga-brown);
    color: white;
    border: none;
    border-radius: var(--radius-xs);
    padding: 0.9rem 2rem;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s var(--ease-apple);
    box-shadow: 0 2px 8px rgba(74, 55, 40, 0.15);
    min-height: 44px; /* Apple hit target */
}

.btn-menu-minimal:hover {
    background: #3a2b1f;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(74, 55, 40, 0.25);
}

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

/* Mobile responsive */
@media (max-width: 576px) {
    .logo-central {
        max-width: 200px;
    }
    
    .menu-title-minimal {
        font-size: 0.95rem;
        margin-bottom: 1rem;
    }
    
    .btn-menu-minimal {
        font-size: 0.9rem;
        padding: 0.8rem 1.5rem;
        min-height: 44px; /* Mantener Apple hit target en mobile */
    }
    
    .btn-logout-minimal {
        position: fixed;
        top: max(env(safe-area-inset-top), 0.75rem);
        right: 0.75rem;
        font-size: 0.75rem;
        padding: 0.5rem 0.85rem;
        min-height: 40px;
        z-index: 9999;
    }
    
    #menuInicial.active {
        justify-content: center;
        padding: 1rem 0;
        padding-top: 3.5rem; /* Espacio para el botón logout */
    }
    
    .menu-inicial-content {
        padding: 1rem;
    }
    
    .logo-container-central {
        margin-top: 0;
        margin-bottom: 1rem;
    }
    
    /* Footer pegado abajo sin espacio */
    .ruga-footer {
        margin-top: auto;
    }
    
    /* Prevenir zoom automático en iOS al tocar inputs y selects */
    select,
    input[type="text"],
    input[type="search"],
    input[type="number"],
    input[type="email"],
    input[type="tel"],
    textarea,
    .form-select,
    .form-control {
        font-size: 16px !important;
    }
}

/* ============================================================================
   VISTAS - Productor y Hacienda
   ============================================================================ */

#vistaProductor,
#vistaHacienda {
    display: none;
}

#vistaProductor.active,
#vistaHacienda.active {
    display: block;
}

.back-button {
    margin-bottom: 1.5rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 1.25rem;
    background: white;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-xs);
    color: var(--ruga-brown);
    font-weight: 600;
    transition: all 0.2s var(--ease-apple);
    cursor: pointer;
    text-decoration: none;
    min-height: 44px; /* Apple hit target */
}

.back-button:hover {
    background: var(--ruga-beige);
    border-color: var(--ruga-brown);
    color: var(--ruga-brown);
}

/* ============================================================================
   SUB-TABS (Análisis Individual / Relaciones) - Gris/Marrón
   ============================================================================ */

.ruga-subtabs {
    border-bottom: 1px solid #dee2e6;
    background: #f8f9fa;
    padding: 0.5rem 1rem;
    border-radius: 8px 8px 0 0;
}

.ruga-subtabs .nav-link {
    color: #6c757d;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-xs);
    padding: 0.65rem 1.25rem;
    font-weight: 500;
    transition: all 0.2s var(--ease-apple);
    min-height: 44px; /* Apple hit target */
}

/* DESKTOP: Subtabs más espaciosos */
@media (min-width: 1024px) {
    .ruga-subtabs {
        padding: 0.75rem 1.5rem;
    }
    
    .ruga-subtabs .nav-link {
        padding: 0.85rem 1.75rem;
        font-size: 1.05rem;
        min-height: 52px;
    }
}

.ruga-subtabs .nav-link:hover {
    color: var(--ruga-brown);
    background: rgba(74, 55, 40, 0.1);
}

.ruga-subtabs .nav-link.active {
    color: #ffffff !important;
    background: var(--ruga-brown) !important;
    border-color: var(--ruga-brown) !important;
}

/* ============================================================================
   BACK TO TOP BUTTON
   ============================================================================ */

#backToTop {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background: var(--ruga-brown);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(74, 55, 40, 0.3);
    transition: all 0.3s var(--ease-apple);
    z-index: 1000;
}

#backToTop:hover {
    background: #3a2b1f;
    transform: translateY(-5px);
    box-shadow: 0 6px 16px rgba(74, 55, 40, 0.4);
}

#backToTop.show {
    display: flex;
}

/* ============================================================================
   METRIC CARDS COMPACT (Horizontal Layout)
   ============================================================================ */

.metric-card-compact {
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(74, 55, 40, 0.1);
    border-radius: var(--radius-sm);
    padding: 1rem;
    transition: all 0.3s var(--ease-apple);
    height: 100%;
}

.metric-card-compact:hover {
    background: rgba(255, 255, 255, 0.9);
    border-color: rgba(74, 55, 40, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(74, 55, 40, 0.1);
}

/* DESKTOP: Metric cards compact más espaciosas */
@media (min-width: 1024px) {
    .metric-card-compact {
        padding: 1.5rem;
    }
}

/* ============================================================================
   PILLS DE CONCENTRACIÓN - Colores dinámicos según operación
   ============================================================================ */

.nav-pills .nav-link {
    color: #666;
    border: 2px solid transparent;
    border-radius: var(--radius-xs);
    padding: 0.6rem 1.2rem;
    font-weight: 500;
    transition: all 0.2s var(--ease-apple);
    background: #f5f5f5;
}

.nav-pills .nav-link:hover:not(.active) {
    background: #e8e8e8;
}

/* Compras - Verde */
.nav-pills.tipo-compras .nav-link.active {
    background: var(--compras-primary);
    color: white;
    border-color: var(--compras-primary);
}

/* Ventas - Rojo */
.nav-pills.tipo-ventas .nav-link.active {
    background: var(--ventas-primary);
    color: white;
    border-color: var(--ventas-primary);
}

/* Cotizador Selects estilo RUGA */
.ruga-select {
    border: 2px solid #4a3728 !important;
    border-radius: 8px !important;
    padding: 0.5rem 2rem 0.5rem 0.75rem;
    font-weight: 500;
    color: #4a3728;
    background-color: #fff;
    transition: all 0.2s ease;
}

.ruga-select:focus {
    border-color: #6b5344 !important;
    box-shadow: 0 0 0 3px rgba(74, 55, 40, 0.15) !important;
    outline: none;
}

.ruga-select option {
    padding: 8px;
    font-weight: normal;
}

/* Cotizador Período Tabs */
#cotizadorPeriodoTabs .nav-link {
    padding: 0.4rem 1rem;
    font-size: 0.85rem;
}

#cotizadorPeriodoTabs .nav-link.active {
    background: #4a3728;
    color: white;
    border-color: #4a3728;
}

/* Cotizador Search Box - similar al principal */
.cotizador-search-box {
    display: flex;
    gap: 0;
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border: 2px solid #e0e0e0;
    transition: border-color 0.2s ease;
}

.cotizador-search-box:focus-within {
    border-color: #4a3728;
}

.cotizador-search-box .search-input-wrapper {
    flex: 1;
}

.cotizador-search-box + .suggestions-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 99999;
    background: white;
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    max-height: 300px;
    overflow-y: auto;
    scroll-behavior: smooth;
    overscroll-behavior: contain;
}

.cotizador-search-box + .suggestions-dropdown::-webkit-scrollbar {
    width: 6px;
}

.cotizador-search-box + .suggestions-dropdown::-webkit-scrollbar-track {
    background: transparent;
}

.cotizador-search-box + .suggestions-dropdown::-webkit-scrollbar-thumb {
    background: rgba(74, 55, 40, 0.3);
    border-radius: 3px;
}

.cotizador-search-box + .suggestions-dropdown::-webkit-scrollbar-thumb:hover {
    background: rgba(74, 55, 40, 0.5);
}

/* Cotizador Chart Container - Responsive */
.cotizador-chart-container {
    height: 220px;
    min-height: 200px;
}

@media (min-width: 992px) {
    .cotizador-chart-container {
        height: 280px;
    }
}

@media (min-width: 1200px) {
    .cotizador-chart-container {
        height: 340px;
    }
}

@media (min-width: 1400px) {
    .cotizador-chart-container {
        height: 380px;
    }
}

/* Cotizador Productor Dropdown fix */
#cotizadorProductorSuggestions {
    position: absolute !important;
    z-index: 999999 !important;
    background: white;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    max-height: 300px;
    overflow-y: auto;
    top: 100%;
    left: 0;
    width: 100%;
    min-width: 350px;
}

/* Fix para que el dropdown no se corte por overflow del contenedor */
#cotizadorPane .card-body {
    overflow: visible !important;
}

#cotizadorPane .card {
    overflow: visible !important;
}

#cotizadorPane .row {
    overflow: visible !important;
}

/* Fix: Primera card del cotizador necesita stacking context más alto */
#cotizadorPane > .card:first-child {
    position: relative;
    z-index: 100;
}

/* ============================================================================
   TABLA FRIGORÍFICOS - ESTILO RUGA
   ============================================================================ */

#frigorificosContainer .table-responsive {
    scrollbar-width: thin;
    scrollbar-color: rgba(74, 55, 40, 0.4) rgba(74, 55, 40, 0.1);
}

#frigorificosContainer .table-responsive::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

#frigorificosContainer .table-responsive::-webkit-scrollbar-track {
    background: rgba(74, 55, 40, 0.08);
    border-radius: 4px;
}

#frigorificosContainer .table-responsive::-webkit-scrollbar-thumb {
    background: rgba(74, 55, 40, 0.35);
    border-radius: 4px;
}

#frigorificosContainer .table-responsive::-webkit-scrollbar-thumb:hover {
    background: rgba(74, 55, 40, 0.5);
}

#frigorificosContainer .table-responsive::-webkit-scrollbar-corner {
    background: transparent;
}

/* Filtros de categoría - chips */
.frigo-cat-filter {
    transition: all 0.2s ease;
    border: 1px solid #e0e0e0 !important;
    background: #fff !important;
    color: #666 !important;
}

.frigo-cat-filter:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(74, 55, 40, 0.15);
}

.frigo-cat-filter.active {
    background: #4a3728 !important;
    color: #fff !important;
    border-color: #4a3728 !important;
    font-weight: 600;
    box-shadow: 0 2px 6px rgba(74, 55, 40, 0.3);
}

/* Filas clickeables */
#frigorificosContainer tbody tr {
    transition: background 0.15s ease;
}

#frigorificosContainer tbody tr:hover {
    background: rgba(74, 55, 40, 0.06) !important;
}

#cotizadorProductorSuggestions .suggestion-item {
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

#cotizadorProductorSuggestions .suggestion-item:hover {
    background: #f8f5f2;
}

#cotizadorProductorSuggestions .suggestion-item strong {
    color: #333;
    font-size: 0.95rem;
}

#cotizadorProductorSuggestions .suggestion-item .text-muted {
    font-size: 0.8rem;
}

/* ============================================================================
   ANIMACIÓN DE LOGO EN LOADING
   ============================================================================ */

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.7;
        transform: scale(0.95);
    }
}

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

/* ============================================================================
   LOADING INDICATORS PARA GRÁFICOS Y MAPAS
   ============================================================================ */

.chart-loading,
.map-loading {
    position: relative;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
    border-radius: var(--radius-md);
}

.loading-spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 4px solid rgba(74, 55, 40, 0.1);
    border-left-color: var(--ruga-brown);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-text {
    margin-top: 12px;
    color: #666;
    font-size: 14px;
    text-align: center;
}

@keyframes fadeInText {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* ============================================================================
   TABLAS DE MOVIMIENTOS - STICKY HEADERS
   ============================================================================ */

/* Contenedor con altura máxima y scroll */
#comprasTab .table-responsive,
#ventasTab .table-responsive {
    max-height: 600px;
    overflow-y: auto;
    overflow-x: auto;
    position: relative;
}

/* DESKTOP: Tablas con más altura para mejor visualización */
@media (min-width: 1024px) {
    #comprasTab .table-responsive,
    #ventasTab .table-responsive {
        max-height: 750px;
    }
}

/* Headers sticky */
#comprasTab .table thead th,
#ventasTab .table thead th {
    position: sticky;
    top: 0;
    background-color: white;
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    border-bottom: 2px solid var(--border-light);
}

/* Asegurar que el sticky funcione en móvil también */
@supports (position: sticky) {
    #comprasTab .table thead th,
    #ventasTab .table thead th {
        position: -webkit-sticky;
        position: sticky;
    }
}


/* iPhone SE fix - Botón logout no se superpone al logo */
@media (max-width: 400px) {
    .btn-logout-minimal {
        top: 12px;
        right: 12px;
        padding: 0.55rem 1rem;
        font-size: 0.75rem;
        z-index: 9999;
    }
    
    .menu-inicial-content {
        padding: 2rem 1rem;
    }
    
    .logo-central {
        max-width: 280px;
    }
}
.arrow-icon { background: transparent !important; border: none !important; }
.invisible-marker { background: transparent !important; border: none !important; width: 0 !important; height: 0 !important; }

/* ============================================================================
   COTIZADOR - Scrollable sections
   ============================================================================ */
#cotizadorHistorial {
    max-height: 350px;
    overflow-y: auto;
}

#ofertasTableContainer {
    max-height: 400px;
    overflow-y: auto;
}

.cotizador-scroll-section {
    max-height: 300px;
    overflow-y: auto;
}


/* ============================================================================
   COTIZADOR - Subcategory Chips
   ============================================================================ */
.subcategoria-chip {
    display: inline-block;
    user-select: none;
}

.subcategoria-chip:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    filter: brightness(0.95);
}

.subcategoria-chip.active:hover {
    filter: brightness(1.1);
}

#subcategoriaChipsContainer {
    max-height: 120px;
    overflow-y: auto;
}

/* Cotizador Category Checkboxes */
.cotizador-cat-check {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
}

.cotizador-cat-check:hover {
    background: #e9ecef;
}

.cotizador-cat-check:has(input:checked) {
    background: #d4c8be;
    border-color: #4a3728;
    color: #4a3728;
    font-weight: 500;
}

.cotizador-cat-check input {
    margin: 0;
}

/* ============================================================================
   MOBILE/TOUCH IMPROVEMENTS - iOS & Android Compatibility
   ============================================================================ */

/* Prevent iOS double-tap zoom on buttons and interactive elements */
button, a, .btn, .nav-link, .subcategoria-chip, .card {
    touch-action: manipulation;
}

/* Ensure proper tap targets on mobile (Apple HIG: 44px minimum) */
@media (max-width: 768px) {
    .btn, button, .nav-link {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* Better touch scrolling */
    .overflow-auto, .overflow-scroll {
        -webkit-overflow-scrolling: touch;
    }
    
    /* Prevent font size adjustment in landscape */
    html {
        -webkit-text-size-adjust: 100%;
        -moz-text-size-adjust: 100%;
        -ms-text-size-adjust: 100%;
        text-size-adjust: 100%;
    }
    
    /* Fix for iOS Safari input zoom - prevent zoom when focusing inputs */
    input, select, textarea {
        font-size: 16px !important;
    }
    
    /* Better touch feedback */
    .btn:active, button:active, .subcategoria-chip:active {
        transform: scale(0.97);
    }
    
    /* Improve map touch on mobile - allow pinch zoom */
    .leaflet-container {
        touch-action: manipulation;
    }
    
    /* Ensure popups are fully visible */
    .leaflet-popup-content {
        max-width: 280px;
        max-height: 70vh;
        overflow-y: auto;
    }
    
    /* Better spacing for mobile cards */
    .card-body {
        padding: 0.75rem;
    }
    
    /* Smaller chips on mobile */
    .subcategoria-chip {
        padding: 6px 10px !important;
        font-size: 11px !important;
    }
}

/* =============================================================================
   BUSCADOR DE TABLAS DE RANKING
   ============================================================================= */
.results-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 0.75rem;
}

.table-search-box {
    flex: 0 1 auto;
}

.table-search-input {
    padding: 0.5rem 1rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 0.9rem;
    width: 280px;
    max-width: 100%;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.table-search-input:focus {
    outline: none;
    border-color: var(--ruga-brown);
    box-shadow: 0 0 0 3px rgba(74, 55, 40, 0.15);
}

.table-search-input::placeholder {
    color: #999;
}

@media (max-width: 768px) {
    .results-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .table-search-box {
        width: 100%;
        margin-left: 0 !important;
    }
    
    .table-search-input {
        width: 100%;
    }
}

/* Toggle Canal/Motivo estilizado */
.toggle-composicion {
    display: inline-flex;
    background: #f0f0f0;
    border-radius: 8px;
    padding: 3px;
    gap: 2px;
}

.toggle-composicion .btn {
    border: none;
    background: transparent;
    color: #666;
    padding: 6px 14px;
    font-size: 0.8rem;
    font-weight: 500;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.toggle-composicion .btn:hover:not(.active) {
    background: rgba(74, 55, 40, 0.1);
    color: var(--ruga-brown);
}

.toggle-composicion .btn.active {
    background: var(--ruga-brown);
    color: white;
    box-shadow: 0 2px 4px rgba(74, 55, 40, 0.25);
}

/* Badges de motivos premium */
.motivo-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 600;
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
    white-space: nowrap;
}

.motivo-badge.cuota-481 {
    background: linear-gradient(135deg, #7b1fa2, #9c27b0);
    color: white;
}

.motivo-badge.mercado-ue {
    background: linear-gradient(135deg, #1565c0, #1976d2);
    color: white;
}

/* ============================================================================
   RUGA WATERMARK - Marca de agua para gráficos y tablas
   ============================================================================ */
.ruga-watermark-container {
    position: relative;
}

.ruga-watermark-container::after {
    content: 'RUGA';
    position: absolute;
    bottom: 5px;
    right: 8px;
    font-size: 10px;
    font-weight: 500;
    color: rgba(74, 55, 40, 0.25);
    pointer-events: none;
    z-index: 1;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.table-responsive.ruga-watermark-container::after,
.card-body.ruga-watermark-container::after {
    bottom: 8px;
    right: 12px;
}

/* ============================================================================
   SISTEMA UNIFICADO DE TABLAS RUGA
   Estilos consistentes para TODAS las tablas de la aplicación
   ============================================================================ */

/* Clase base para tablas RUGA */
.ruga-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
    background: #fff;
}

.ruga-table thead {
    position: sticky;
    top: 0;
    z-index: 10;
    background: #4a3728;
}

.ruga-table thead th {
    background: #4a3728;
    color: #fff;
    font-weight: 600;
    padding: 0.75rem 0.75rem;
    text-align: left;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    border: none;
    white-space: nowrap;
}

.ruga-table thead th:first-child {
    border-top-left-radius: 8px;
}

.ruga-table thead th:last-child {
    border-top-right-radius: 8px;
}

.ruga-table tbody tr {
    border-bottom: 1px solid #f0ebe7;
    transition: background-color 0.15s ease;
}

.ruga-table tbody tr:hover {
    background-color: rgba(74, 55, 40, 0.04);
}

.ruga-table tbody td {
    padding: 0.65rem 0.75rem;
    color: #333;
    vertical-align: middle;
}

.ruga-table tbody tr:last-child td:first-child {
    border-bottom-left-radius: 8px;
}

.ruga-table tbody tr:last-child td:last-child {
    border-bottom-right-radius: 8px;
}

/* Contenedor con scroll estilo RUGA */
.ruga-table-container {
    max-height: 400px;
    overflow: auto;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    position: relative;
}

/* Scrollbar estilo RUGA para todos los contenedores de tablas */
.ruga-table-container::-webkit-scrollbar,
.table-responsive::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.ruga-table-container::-webkit-scrollbar-track,
.table-responsive::-webkit-scrollbar-track {
    background: rgba(74, 55, 40, 0.08);
    border-radius: 4px;
}

.ruga-table-container::-webkit-scrollbar-thumb,
.table-responsive::-webkit-scrollbar-thumb {
    background: rgba(74, 55, 40, 0.35);
    border-radius: 4px;
}

.ruga-table-container::-webkit-scrollbar-thumb:hover,
.table-responsive::-webkit-scrollbar-thumb:hover {
    background: rgba(74, 55, 40, 0.5);
}

/* Firefox scrollbar */
.ruga-table-container,
.table-responsive {
    scrollbar-width: thin;
    scrollbar-color: rgba(74, 55, 40, 0.35) rgba(74, 55, 40, 0.08);
}

/* Watermark con logo para tablas */
.ruga-logo-watermark {
    position: relative;
}

.ruga-logo-watermark::before {
    content: '';
    position: absolute;
    bottom: 10px;
    right: 10px;
    width: 35px;
    height: 35px;
    background-image: url('/static/logo-transparent.png');
    background-size: contain;
    background-repeat: no-repeat;
    opacity: 0.15;
    pointer-events: none;
    z-index: 5;
}

/* Variante compacta de tabla RUGA */
.ruga-table-sm thead th {
    padding: 0.5rem 0.5rem;
    font-size: 0.75rem;
}

.ruga-table-sm tbody td {
    padding: 0.4rem 0.5rem;
    font-size: 0.8rem;
}

/* Fila clickeable */
.ruga-table tbody tr.clickable-row {
    cursor: pointer;
}

.ruga-table tbody tr.clickable-row:hover {
    background-color: rgba(74, 55, 40, 0.08);
}

/* Celdas numéricas alineadas a la derecha */
.ruga-table td.text-end,
.ruga-table th.text-end {
    text-align: right;
}

/* Aplicar estilos unificados a tablas existentes Bootstrap */
.table.table-hover.table-sm thead {
    position: sticky;
    top: 0;
    z-index: 5;
}

.table.table-hover.table-sm thead th {
    background: #4a3728;
    color: #fff;
    font-weight: 600;
    border: none;
}

/* ============================================================================
   FOOTER UNIFICADO RUGA
   ============================================================================ */
/* Input con botón X (clear) */
.input-with-clear {
    position: relative;
    display: flex;
    align-items: center;
}

.input-with-clear input {
    padding-right: 2rem;
}

.input-clear-btn {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #999;
    font-size: 1.1rem;
    font-weight: 300;
    cursor: pointer;
    padding: 0.25rem;
    line-height: 1;
    width: 24px;
    height: 24px;
    min-width: 24px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, color 0.2s ease;
}

.input-with-clear input:not(:placeholder-shown) + .input-clear-btn {
    opacity: 1;
    visibility: visible;
}

.input-clear-btn:hover {
    color: #4a3728;
    transform: translateY(-50%);
}

.ruga-footer {
    background: linear-gradient(135deg, #f8f7f4 0%, #efe9e0 100%);
    border-top: 1px solid rgba(74, 55, 40, 0.12);
    padding: 0.75rem 0;
    margin-top: 0;
    flex-shrink: 0;
}

.ruga-footer-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    flex-wrap: wrap;
    font-size: 0.8rem;
    color: #666;
}

.ruga-footer-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.ruga-footer-brand strong {
    color: #4a3728;
    font-weight: 600;
}

.ruga-footer-divider {
    width: 1px;
    height: 16px;
    background: rgba(74, 55, 40, 0.2);
}

.ruga-footer-support {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.ruga-footer-support a {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: #128C7E;
    text-decoration: none;
    font-weight: 500;
    padding: 0.35rem 0.75rem;
    border-radius: 16px;
    background: rgba(18, 140, 126, 0.08);
    transition: all 0.2s ease;
}

.ruga-footer-support a:hover {
    background: rgba(18, 140, 126, 0.15);
    transform: translateY(-1px);
}

.ruga-footer-support a i {
    font-size: 1rem;
}

/* Botón flotante de WhatsApp */
.whatsapp-fab {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
    border: none;
    border-radius: 50%;
    box-shadow: 0 4px 16px rgba(37, 211, 102, 0.4);
    cursor: pointer;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.whatsapp-fab:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 24px rgba(37, 211, 102, 0.5);
}

.whatsapp-fab i {
    color: #fff;
    font-size: 1.75rem;
}

/* Modal de soporte */
.support-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.support-modal-backdrop.active {
    opacity: 1;
    visibility: visible;
}

.support-modal {
    background: #fff;
    border-radius: 16px;
    width: 90%;
    max-width: 420px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.support-modal-backdrop.active .support-modal {
    transform: translateY(0);
}

.support-modal-header {
    padding: 1.25rem;
    background: linear-gradient(135deg, #4a3728 0%, #6b5344 100%);
    border-radius: 16px 16px 0 0;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.support-modal-header h5 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.support-modal-close {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.support-modal-close:hover {
    background: rgba(255, 255, 255, 0.25);
}

.support-modal-body {
    padding: 1.5rem;
}

.support-confirm-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 1.5rem;
    background: linear-gradient(135deg, #4a3728, #6b5344);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.support-confirm-icon i {
    font-size: 2rem;
    color: white;
}

.support-confirm-text {
    color: #555;
    font-size: 1rem;
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

.support-confirm-text strong {
    color: #4a3728;
}

.support-context-info {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 0.75rem;
    margin-bottom: 1rem;
    font-size: 0.8rem;
    color: #666;
}

.support-context-info strong {
    color: #4a3728;
}

.support-textarea {
    width: 100%;
    min-height: 100px;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 0.75rem;
    font-size: 0.9rem;
    resize: vertical;
    font-family: inherit;
    margin-bottom: 1rem;
}

.support-textarea:focus {
    outline: none;
    border-color: #4a3728;
}

.support-actions {
    display: flex;
    gap: 0.75rem;
}

.support-btn {
    flex: 1;
    padding: 0.75rem 1rem;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
}

.support-btn-primary {
    background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
    color: #fff;
}

.support-btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.3);
}

.support-btn-secondary {
    background: #f0f0f0;
    color: #333;
}

.support-btn-secondary:hover {
    background: #e0e0e0;
}

@media (max-width: 480px) {
    .whatsapp-fab {
        bottom: 1rem;
        right: 1rem;
        width: 50px;
        height: 50px;
    }
    
    .whatsapp-fab i {
        font-size: 1.5rem;
    }
    
    .ruga-footer-content {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .ruga-footer-divider {
        display: none;
    }
}

/* ============================================================================
   LEALTAD METRICS - Panel de métricas del cotizador
   ============================================================================ */

.lealtad-metrics {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    margin-bottom: 12px;
}

.lealtad-metric-card {
    text-align: center;
    padding: 10px 8px;
    border-radius: 10px;
    background: rgba(74, 55, 40, 0.05);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.lealtad-metric-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.lealtad-metric-faena {
    background: rgba(39, 174, 96, 0.08);
}

.lealtad-metric-share {
    background: rgba(52, 152, 219, 0.06);
    cursor: help;
}

.metric-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.03rem;
    color: #6c757d;
    font-weight: 600;
}

.metric-label i {
    font-size: 7px;
    opacity: 0.5;
    margin-left: 2px;
}

.metric-value {
    font-size: 1.15rem;
    font-weight: 700;
    color: #4a3728;
    line-height: 1.2;
}

.metric-t1 {
    color: #f39c12;
}

.metric-t3 {
    color: #3498db;
}

.metric-sublabel {
    font-size: 0.55rem;
    color: #999;
    text-transform: lowercase;
}

.lealtad-metric-card .metric-label {
    min-height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.lealtad-metric-card .metric-value {
    min-height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.concentracion-values {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.concentracion-values .metric-value {
    font-size: 1rem;
}

.concentracion-sep {
    font-size: 0.9rem;
    color: #ccc;
    font-weight: 300;
}

/* Loading state */
.lealtad-loading {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

#lealtadLoadingState {
    justify-content: center;
    align-items: center;
    background: rgba(248, 249, 250, 0.95);
    border-radius: 8px;
    padding: 12px 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

/* Z-index para que el panel no quede tapado */
#cotizadorLealtadPanel {
    position: relative;
    z-index: 10;
}

.lealtad-podio-section {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(0,0,0,0.08);
}

.lealtad-podio-container {
    display: flex;
    justify-content: flex-start;
    align-items: flex-end;
    gap: 12px;
    margin-top: 8px;
    min-height: 55px;
    flex-wrap: wrap;
}

.podio-item {
    text-align: center;
    min-width: 95px;
    max-width: 130px;
    cursor: help;
    transition: transform 0.15s ease;
}

.podio-item:hover {
    transform: scale(1.03);
}

.podio-medal {
    font-size: 1.3rem;
    line-height: 1;
}

.podio-box {
    border-radius: 6px;
    padding: 6px 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
}

.podio-name {
    font-size: 10px;
    line-height: 1.15;
    word-break: break-word;
    font-weight: 500;
}

.podio-share {
    font-size: 12px;
    font-weight: 700;
    margin-top: 3px;
}

.podio-vos {
    font-size: 7px;
    margin-top: 2px;
}

/* Blur anti-captura */
.blur-protection {
    filter: blur(20px) !important;
    pointer-events: none !important;
    transition: filter 0.15s ease;
}

@media (max-width: 576px) {
    .lealtad-metrics {
        grid-template-columns: repeat(3, 1fr);
        gap: 6px;
    }
    
    .lealtad-metric-card {
        padding: 8px 4px;
    }
    
    .metric-value {
        font-size: 1rem;
    }
    
    .metric-label {
        font-size: 0.6rem;
    }
}
