:root {
    /* ============================================
       COLORES PRINCIPALES (Tema Oscuro)
       ============================================ */
    
    /* Primarios - Azul */
    --primary: #4fc3f7;           /* Azul claro para iconos y realces */
    --primary-dark: #0d47a1;      /* Azul marino profundo para Sidebar */
    --primary-hover: rgba(79, 195, 247, 0.15);
    
    /* Acentos - Naranja */
    --accent: #ff9800;            /* Naranja vibrante para botones */
    --accent-hover: #f57c00;      /* Naranja oscuro para hover */
    --accent-light: rgba(255, 152, 0, 0.1);
    
    /* ============================================
       COLORES DE FONDO
       ============================================ */
    
    --bg-body: #121212;           /* Fondo general negro mate */
    --bg-card: #1e252b;           /* Gris azulado muy oscuro para tarjetas */
    --bg-card-hover: rgba(30, 37, 43, 0.85);
    --bg-card-lighter: rgba(30, 37, 43, 0.6);
    
    /* Overlays de fondo */
    --bg-overlay: rgba(0, 0, 0, 0.75);     /* Overlay principal (modales) */
    --bg-overlay-80: rgba(0, 0, 0, 0.8);
    --bg-overlay-medium: rgba(0, 0, 0, 0.6);
    --bg-overlay-50: rgba(0, 0, 0, 0.5);
    --bg-overlay-light: rgba(0, 0, 0, 0.5);
    --bg-overlay-30: rgba(0, 0, 0, 0.3);
    --bg-overlay-lighter: rgba(0, 0, 0, 0.3);
    --bg-overlay-20: rgba(0, 0, 0, 0.2);
    --bg-overlay-subtle: rgba(0, 0, 0, 0.2);
    --bg-overlay-minimal: rgba(0, 0, 0, 0.1);
    --bg-tooltip: rgba(0, 0, 0, 0.85);     /* Fondo tooltips */
    
    /* Overlays blancos */
    --bg-white-overlay-01: rgba(255, 255, 255, 0.01);
    --bg-white-overlay-05: rgba(255, 255, 255, 0.05);
    --bg-white-overlay-06: rgba(255, 255, 255, 0.06);
    --bg-white-overlay-08: rgba(255, 255, 255, 0.08);
    --bg-white-overlay-10: rgba(255, 255, 255, 0.1);
    --bg-white-overlay-12: rgba(255, 255, 255, 0.12);
    --bg-white-overlay-15: rgba(255, 255, 255, 0.15);
    --bg-white-overlay-25: rgba(255, 255, 255, 0.25);
    
    /* ============================================
       COLORES DE TEXTO
       ============================================ */
    
    --text-main: #e0e6ed;         /* Blanco azulado para lectura principal */
    --text-white: #ffffff;        /* Blanco puro */
    --text-light: #f3f4f6;        /* Blanco muy claro */
    --text-muted: #90a4ae;        /* Gris para etiquetas secundarias */
    --text-gray: #9ca3af;         /* Gris medio */
    --text-gray-dark: #4b5563;    /* Gris oscuro */
    --text-alpha-60: rgba(255, 255, 255, 0.6);  /* Texto con transparencia */
    --text-black: #000000;        /* Negro para contraste especial */
    
    /* ============================================
       COLORES DE ESTADO
       ============================================ */
    
    /* Éxito / Verde */
    --color-success: #4caf50;     /* Verde principal */
    --color-success-dark: #388e3c;
    --color-success-light: #27ae60;
    --color-success-alt: #f44336; /* Alternativo (rojo Material) */
    
    /* Error / Rojo */
    --color-error: #ef4444;       /* Rojo principal */
    --color-error-dark: #dc2626;
    --color-error-light: #e74c3c;
    
    /* Error overlays */
    --error-overlay-10: rgba(239, 68, 68, 0.1);
    --error-overlay-15: rgba(239, 68, 68, 0.15);
    --error-overlay-20: rgba(239, 68, 68, 0.2);
    --error-overlay-25: rgba(239, 68, 68, 0.25);
    --error-overlay-30: rgba(239, 68, 68, 0.3);
    --error-overlay-50: rgba(239, 68, 68, 0.5);
    
    /* Advertencia / Naranja-Amarillo */
    --color-warning: #ff9800;     /* Naranja principal (= accent) */
    --color-warning-dark: #f57c00;
    --color-warning-light: #ffa726;
    --color-warning-moderada: #f39c12;
    --color-warning-yellow: #ffc107;  /* Amarillo vibrante */
    
    /* ============================================
       COLORES ADICIONALES
       ============================================ */
    
    /* Azules */
    --color-blue: #3b82f6;        /* Azul para gradientes/badges */
    --color-blue-dark: #2563eb;
    --color-blue-light: #2196f3;
    
    /* Cianes */
    --color-cyan: #06b6d4;        /* Cyan para gradientes/badges */
    --color-cyan-dark: #0891b2;
    --color-cyan-light: #00bcd4;
    
    /* Morados */
    --color-purple: #9c27b0;      /* Morado para gradientes/badges */
    --color-purple-dark: #7b1fa2;
    
    /* Naranjas (costes) */
    --color-coste: #ea580c;       /* Naranja para costes */
    --color-coste-dark: #c2410c;
    
    /* ============================================
       COLORES CON OPACIDAD (Fondos/Overlays)
       ============================================ */
    
    /* Primary */
    --primary-overlay-05: rgba(79, 195, 247, 0.05);
    --primary-overlay-10: rgba(79, 195, 247, 0.1);
    --primary-overlay-12: rgba(79, 195, 247, 0.12);
    --primary-overlay-15: rgba(79, 195, 247, 0.15);
    --primary-overlay-20: rgba(79, 195, 247, 0.2);
    --primary-overlay-30: rgba(79, 195, 247, 0.3);
    --primary-overlay-35: rgba(79, 195, 247, 0.35);
    
    /* Accent / Warning */
    --accent-overlay-10: rgba(255, 152, 0, 0.1);
    --accent-overlay-18: rgba(255, 152, 0, 0.18);
    --accent-overlay-20: rgba(255, 152, 0, 0.2);
    --accent-overlay-25: rgba(255, 152, 0, 0.25);
    --accent-overlay-30: rgba(255, 152, 0, 0.3);
    
    /* Success / Verde */
    --success-overlay-10: rgba(76, 175, 80, 0.1);
    --success-overlay-15: rgba(76, 175, 80, 0.15);
    --success-overlay-25: rgba(76, 175, 80, 0.25);
    --success-overlay-30: rgba(76, 175, 80, 0.3);
    
    /* Error / Rojo */
    --error-overlay-10: rgba(239, 68, 68, 0.1);
    --error-overlay-15: rgba(239, 68, 68, 0.15);
    --error-overlay-20: rgba(239, 68, 68, 0.2);
    --error-overlay-25: rgba(239, 68, 68, 0.25);
    --error-overlay-30: rgba(239, 68, 68, 0.3);
    
    /* Blue */
    --blue-overlay-15: rgba(59, 130, 246, 0.15);
    --blue-overlay-25: rgba(59, 130, 246, 0.25);
    
    /* Cyan */
    --cyan-overlay-10: rgba(33, 150, 243, 0.1);
    --cyan-overlay-15: rgba(6, 182, 212, 0.15);
    --cyan-overlay-25: rgba(6, 182, 212, 0.25);
    
    /* Yellow */
    --yellow-overlay-15: rgba(255, 193, 7, 0.15);
    --yellow-overlay-25: rgba(255, 193, 7, 0.25);
    
    /* Purple */
    --purple-overlay-15: rgba(156, 39, 176, 0.15);
    --purple-overlay-25: rgba(156, 39, 176, 0.25);
    
    /* ============================================
       BORDES
       ============================================ */
    
    --border-color: #2c3e50;      /* Bordes sutiles azulados */
    --border-white-06: rgba(255, 255, 255, 0.06);
    --border-white-10: rgba(255, 255, 255, 0.1);
    --border-white-12: rgba(255, 255, 255, 0.12);
    
    /* ============================================
       TABLAS
       ============================================ */
    
    --table-row-odd: rgba(255, 255, 255, 0.02);
    --table-row-even: rgba(255, 255, 255, 0.06);
    --table-row-hover: rgba(79, 195, 247, 0.12);
    
    /* ============================================
       SOMBRAS
       ============================================ */
    
    --shadow-primary: rgba(79, 195, 247, 0.15);
    --shadow-primary-hover: rgba(79, 195, 247, 0.3);
    --shadow-accent: rgba(255, 152, 0, 0.3);
    --shadow-accent-hover: rgba(255, 152, 0, 0.4);
    --shadow-dark: rgba(0, 0, 0, 0.3);
    --shadow-dark-medium: rgba(0, 0, 0, 0.5);
    --shadow-dark-hover: rgba(0, 0, 0, 0.4);
    --shadow-warning: rgba(234, 179, 8, 0.4);
    --shadow-warning-hover: rgba(234, 179, 8, 0.6);
    --shadow-success: rgba(255, 167, 38, 0.3);
    
    /* ============================================
       CONSTANTES DE DISEÑO
       ============================================ */
    
    --sidebar-width: 280px;
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================
   ESTILOS PARA ALERTAS Y NOTIFICACIONES
   ============================================ */

.alert {
    padding: 16px 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    font-size: 0.95rem;
    line-height: 1.5;
    display: flex;
    align-items: center;
    gap: 12px;
    border: 1px solid;
    background-color: var(--bg-card);
}

.alert::before {
    content: '';
    display: inline-flex;
    font-family: 'Material Symbols Rounded';
    font-size: 1.4rem;
    flex-shrink: 0;
}

.alert-error {
    border-color: var(--color-error);
    background-color: var(--error-overlay-10);
    color: var(--color-error-light);
}

.alert-error::before {
    content: 'error';
    color: var(--color-error);
}

.alert-warning {
    border-color: var(--color-warning);
    background-color: var(--accent-overlay-10);
    color: var(--color-warning-light);
}

.alert-warning::before {
    content: 'warning';
    color: var(--color-warning);
}

.alert-success {
    border-color: var(--color-success);
    background-color: var(--success-overlay-10);
    color: var(--color-success-light);
}

.alert-success::before {
    content: 'check_circle';
    color: var(--color-success);
}

.alert-info {
    border-color: var(--primary);
    background-color: var(--primary-overlay-10);
    color: var(--primary);
}

.alert-info::before {
    content: 'info';
    color: var(--primary);
}

/* ============================================
   ESTILOS PARA MATERIAL SYMBOLS
   ============================================ */

.material-symbols-rounded {
    font-variation-settings:
    'FILL' 0,
    'wght' 400,
    'GRAD' 0,
    'opsz' 24;
    vertical-align: middle;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    user-select: none;
    width: 1em;
    height: 1em;
}

/* Iconos más grandes en títulos h1 */
h1 .material-symbols-rounded {
    font-size: 1.8rem;
    width: 1.8rem;
    height: 1.8rem;
    vertical-align: middle;
}

/* Iconos en títulos h2 */
h2 .material-symbols-rounded {
    font-size: 1.4rem;
    width: 1.4rem;
    height: 1.4rem;
    vertical-align: middle;
}

/* Iconos en botones de acción (guardar, cancelar, etc) */
.btn-save .material-symbols-rounded,
.btn-cancel .material-symbols-rounded {
    font-size: 1.1rem;
    width: 1.1rem;
    height: 1.1rem;
    vertical-align: middle;
    margin-right: 6px;
}

/* Iconos en botones de acción pequeños (editar, eliminar) */
.btn-icon .material-symbols-rounded,
.btn-edit-list .material-symbols-rounded {
    font-size: 1.1rem;
    width: 1.1rem;
    height: 1.1rem;
}

/* Iconos en resumen del día */
.resumen-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
}

.resumen-icon .material-symbols-rounded {
    font-size: 1.6rem;
    width: 1.6rem;
    height: 1.6rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary); /* Color azul para iconos de resumen */
}

/* Iconos en sidebar */
.menu-item .material-symbols-rounded,
.logout-icon .material-symbols-rounded {
    font-size: 1.2rem;
    width: 1.2rem;
    height: 1.2rem;
    vertical-align: middle;
}

/* Iconos en botones flotantes */
.btn-floating .material-symbols-rounded {
    font-size: 1.5rem;
    width: 1.5rem;
    height: 1.5rem;
}

/* Iconos en fichas KPI de plantación */
.kpi-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    margin: 0 auto;
}

.kpi-icon .material-symbols-rounded {
    font-size: 3rem;
    width: 3rem;
    height: 3rem;
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-variation-settings:
    'FILL' 0,
    'wght' 300,
    'GRAD' 0,
    'opsz' 48;
}

/* ============================================
   ANIMACIONES GLOBALES
   ============================================ */

/* Animación de resaltado para registros recién guardados/editados */
@keyframes highlight-pulse {
    0%, 100% {
        background-color: var(--bg-warning-overlay-30);
    }
    50% {
        background-color: var(--bg-warning-overlay-60);
    }
}

.highlight-row {
    animation: highlight-pulse 1s ease-in-out 3;
}

* {
    box-sizing: border-box;
}

html {
    overflow-x: hidden;
    width: 100%;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    margin: 0;
    display: flex;
    background-color: var(--bg-body);
    color: var(--text-main);
    height: 100vh;
    overflow: hidden;
    width: 100%;
    max-width: 100%;
}

.container {
    max-width: 1440px;
    margin: 0 auto;
    width: 100%;
}

/* --- CABECERA MÓVIL --- */
#mobile-header {
    display: none;
    background: var(--primary-dark);
    color: var(--text-white);
    padding: 0 15px;
    min-height: 52px;
    height: 52px;
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1001;
    box-sizing: border-box;
    align-items: center;
    gap: 15px;
    box-shadow: 0 4px 10px var(--shadow-dark);
}

.menu-toggle {
    background: none;
    border: none;
    color: var(--text-white);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* En detalle de plantación (móvil): solo icono flecha atrás, sin borde */
.menu-toggle-back {
    padding: 0;
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.menu-toggle-back .material-symbols-rounded {
    font-size: 1.5rem;
}

/* Botón desplegable plantaciones en cabecera (mismo estilo que título) */
.plantacion-trigger-header {
    flex: 1;
    min-width: 0;
    height: 100%;
    padding: 0;
    margin: 0;
    border: none;
    background: none;
    color: var(--text-white);
    font-size: 1.6rem;
    font-weight: 400;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    text-align: left;
    overflow: hidden;
}

.plantacion-trigger-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    min-width: 0;
}

.plantacion-trigger-icon {
    font-size: 1.8rem !important;
    flex-shrink: 0;
    opacity: 0.9;
}

/* Capa desplegable de plantaciones: fondo desenfocado bajo la cabecera (cabecera no se desenfoca) */
.plantacion-dropdown-overlay {
    position: fixed;
    top: 52px;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-overlay);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1100;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.plantacion-dropdown-overlay.open {
    opacity: 1;
    visibility: visible;
}

.plantacion-dropdown-panel {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    background: var(--primary-dark);
    max-height: calc(100vh - 52px);
    overflow-y: auto;
    box-shadow: 0 8px 24px var(--shadow-dark);
    transform-origin: top center;
    transform: scaleY(0);
    opacity: 0;
    transition: transform 0.25s ease, opacity 0.25s ease;
    border-top: 1px solid var(--bg-white-overlay-12);
}

.plantacion-dropdown-overlay.open .plantacion-dropdown-panel {
    transform: scaleY(1);
    opacity: 1;
}

.plantacion-dropdown-list {
    list-style: none;
    margin: 0;
    padding: 8px 0;
}

.plantacion-dropdown-item {
    display: block;
    padding: 14px 20px;
    font-size: 1.1rem;
    color: var(--text-white);
    text-decoration: none;
    transition: background 0.15s ease;
}

.plantacion-dropdown-item:hover,
.plantacion-dropdown-item:active {
    background: var(--bg-white-overlay-08);
}

.plantacion-dropdown-item.active {
    color: var(--primary);
    font-weight: 500;
    background: var(--primary-overlay-15);
}

.page-title-mobile {
    flex: 1;
    font-weight: 400;
    font-size: 1.6rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-right: 10px;
}

/* --- SIDEBAR --- */
#sidebar {
    width: var(--sidebar-width);
    background: var(--primary-dark);
    color: var(--text-white);
    display: flex;
    flex-direction: column;
    box-shadow: 5px 0 15px var(--shadow-dark-hover);
    z-index: 1002;
    transition: var(--transition);
}

.sidebar-header {
    padding: 30px 20px;
    background: var(--bg-overlay-light);
    text-align: center;
    font-weight: bold;
    font-size: 1.3em;
    letter-spacing: 1px;
    border-bottom: 1px solid var(--border-color);
}

.menu-container {
    flex: 1;
    overflow-y: auto;
    padding: 15px 0;
}

.menu-group { margin-bottom: 25px; }

.group-title {
    display: block;
    padding: 10px 25px 5px;
    font-size: 0.7rem;
    color: var(--primary); /* Azul claro */
    text-transform: uppercase;
    letter-spacing: 2px;
    font-weight: 800;
}

.group-title.collapsible {
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
    padding: 10px 25px;
}

.group-title.collapsible:hover {
    background: var(--bg-white-overlay-05);
}

.arrow {
    font-size: 0.8rem;
    transition: var(--transition);
}

.submenu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}

.submenu.open {
    max-height: 500px;
}

.menu-item {
    padding: 14px 25px;
    color: var(--text-alpha-60);
    text-decoration: none;
    display: flex;
    align-items: center;
    transition: var(--transition);
    border-left: 4px solid transparent;
}

.menu-item:hover {
    background: var(--bg-white-overlay-05);
    color: var(--text-white);
}

.menu-item.active {
    background: var(--bg-white-overlay-10);
    color: var(--text-white);
    border-left-color: var(--accent);
}

/* Botón de cerrar sesión */
.btn-logout {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: calc(100% - 50px);
    margin: 0 25px;
    padding: 12px;
    background: transparent;
    color: var(--text-white);
    border: 1px solid var(--border-white-03);
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 400;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-logout:hover {
    background: var(--bg-white-overlay-05);
    border-color: var(--border-white-05);
}

.btn-logout:active {
    background: var(--bg-white-overlay-10);
}

.logout-icon {
    font-size: 1rem;
}

/* Custom checkboxes: apariencia consistente en móvil y escritorio */
input[type="checkbox"] {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: transparent;
    display: inline-block;
    vertical-align: middle;
    transition: background 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
    position: relative;
}

/* Ocultar elementos móviles en escritorio */
.show-mobile-table-cell {
    display: none;
}
input[type="checkbox"]:focus {
    outline: none;
    box-shadow: 0 0 0 4px var(--table-row-hover);
}
input[type="checkbox"]:checked {
    background: linear-gradient(90deg, var(--accent), var(--primary));
    border-color: transparent;
    background-repeat: no-repeat;
    background-position: center;
    background-size: 12px 12px;
    background-image: url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E");
}

/* --- OVERLAY MÓVIL --- */
#sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-tooltip); /* Más oscuro para mejor contraste */
    z-index: 1001;
    backdrop-filter: blur(4px);
}

/* --- CONTENIDO PRINCIPAL --- */
main {
    flex: 1;
    min-height: 0; /* Necesario para que el scroll calcule bien el final en flex */
    overflow-y: auto;
    overflow-x: hidden;
    padding: 30px;
    box-sizing: border-box;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: auto; /* Permite scroll normal en vertical */
}


/* --- TARJETAS TIPO DASHBOARD --- */
.card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 25px;
    box-shadow: 0 8px 24px var(--shadow-dark);
    margin-bottom: 25px;
    border: 1px solid var(--border-color);
}

h1 { color: var(--text-white); margin-bottom: 25px; font-weight: 300; }
h2 { color: var(--primary); margin-top: 0; border-bottom: 1px solid var(--border-color); padding-bottom: 12px; font-weight: 400; }
h3 { margin-top:0; }
/* --- FORMULARIOS --- */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
}

/* Fecha en la misma fila que el siguiente bloque solo en escritorio (incidencias, programaciones riego) */
@media (min-width: 769px) {
    .grid-form-row-fecha-desktop {
        grid-template-columns: repeat(3, 1fr);
    }
}
@media (max-width: 768px) {
    .grid-form-row-fecha-desktop {
        grid-template-columns: 1fr;
    }
}

/* Grid específico para formularios de recolección: fecha, kilos y palets en la misma línea en escritorio */
@media (min-width: 769px) {
    #formRecoleccion .grid,
    #formRecoleccionModal .grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Combobox producto con búsqueda (tratamientos) */
.producto-combobox-wrap {
    position: relative;
    width: 100%;
}
.producto-combobox-wrap select.producto-combobox-select-hidden {
    position: absolute;
    width: 0;
    height: 0;
    opacity: 0;
    pointer-events: none;
    margin: 0;
    padding: 0;
    border: 0;
}
.combobox-producto-input {
    width: 100%;
    padding: 14px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    font-size: 1rem;
    box-sizing: border-box;
    background: var(--bg-body);
    color: var(--text-white);
    transition: var(--transition);
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}
.combobox-producto-input::placeholder {
    color: var(--text-muted);
}
.combobox-producto-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--shadow-primary);
}
.producto-combobox-wrap.has-error .combobox-producto-input {
    border-color: var(--color-error);
}
.combobox-producto-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 4px;
    max-height: 220px;
    overflow-y: auto;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 20px var(--shadow-dark);
    z-index: 100;
}
.combobox-producto-dropdown.open {
    display: block;
}
.combobox-producto-list {
    padding: 6px 0;
}
.combobox-producto-option {
    display: block;
    width: 100%;
    padding: 10px 14px;
    border: none;
    background: none;
    color: var(--text-main);
    font-size: 0.95rem;
    text-align: left;
    cursor: pointer;
}
.combobox-producto-option:hover,
.combobox-producto-option:focus {
    background: var(--bg-white-overlay-08);
}
.combobox-producto-option[data-value=""] {
    color: var(--text-muted);
    font-style: italic;
}
.combobox-producto-empty {
    padding: 12px 14px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Grid específico para productos en modal de tratamientos */
#productos-container-modal .producto-item {
    margin-bottom: 20px;
}

#productos-container-modal .producto-item:last-child {
    margin-bottom: 0;
}

#productos-container-modal .grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 15px;
}

@media (max-width: 768px) {
    #productos-container-modal .producto-item {
        margin-bottom: 15px;
    }
    
    #productos-container-modal .grid {
        grid-template-columns: 1fr 1fr !important;
        gap: 10px;
    }
    
    #productos-container-modal .form-group {
        margin-bottom: 0;
    }
}

.form-group { margin-bottom: 20px; }

label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-muted);
    text-transform: uppercase;
}

input, select, textarea {
    width: 100%;
    padding: 14px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    font-size: 1rem;
    box-sizing: border-box;
    background: var(--bg-body);
    color: var(--text-white);
    transition: var(--transition);
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--shadow-primary);
}

/* Campos fecha: mismo tamaño que el resto de inputs (iPad/iOS los dibuja más grandes por defecto) */
input[type="date"] {
    -webkit-appearance: none;
    appearance: none;
    height: 48px;
    min-height: 48px;
    padding: 0 14px;
    min-width: 0;
    width: 100%;
    box-sizing: border-box;
    font-size: 1rem;
    line-height: 46px; /* height - border */
}

/* --- BOTÓN NARANJA --- */
/* Contenedor para alinear botones en el formulario */
.form-actions {
    display: flex;
    gap: 15px;      /* Espacio entre los botones */
    margin-top: 20px;
    width: 100%;    /* Ocupa todo el ancho del formulario */
}

.btn-save {
    background: var(--accent);
    color: var(--text-white) !important;
    border: none;
    padding: 16px;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    width: 100%;
    transition: var(--transition);
    box-shadow: 0 4px 15px var(--shadow-accent);
}

.btn-save:hover {
    background: var(--accent-hover);
    color: var(--text-white) !important;
    transform: translateY(-3px);
    box-shadow: 0 8px 20px var(--shadow-accent-hover);
}

.btn-cancel {
    background-color: transparent;
    color: var(--text-gray);
    border: 1px solid var(--text-gray-dark);
    padding: 16px;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-right: 10px; /* Espacio con el botón de guardar */
}

.btn-cancel:hover {
    color: var(--text-light);
    border-color: var(--text-gray);
    background-color: var(--bg-white-overlay-05);
}

/* --- RESPONSIVE --- */
@media (max-width: 768px) {
    #mobile-header { display: flex; }

    #sidebar {
        position: fixed;
        left: 0;
        top: 0;
        height: 100%;
        width: 85%; /* Aumentado de 280px a 85% del ancho */
        max-width: 400px; /* Límite máximo para pantallas muy grandes */
        transform: translateX(-100%);
        background: var(--primary-dark); /* Mismo color que la versión de escritorio */
    }

    #sidebar.open {
        transform: translateX(0);
    }

    #sidebar-overlay.active {
        display: block;
    }

    main {
        padding: 80px 15px 100px;
        max-width: 100%;
        margin: 0;
    }

    /* Estilos mejorados para el menú móvil */
    .sidebar-header {
        font-size: 1.6rem; /* Título más grande */
        padding: 35px 20px;
    }

    .menu-item {
        font-size: 1.2rem; /* Texto de menú más grande */
        padding: 18px 25px; /* Más espacio para facilitar el toque */
        color: var(--text-white); /* Color blanco para las opciones */
    }

    .group-title {
        font-size: 0.85rem; /* Títulos de grupo más grandes */
        padding: 12px 25px 8px;
    }

    .group-title.collapsible {
        font-size: 0.85rem;
        padding: 12px 25px;
    }

    /* Botón de cerrar sesión en móvil */
    .btn-logout {
        font-size: 1rem;
        padding: 14px;
    }

    .logout-icon {
        font-size: 1.1rem;
    }

    .card { padding: 16px; border-radius: 12px; }
    
    /* Ocultar columnas de detalle en móvil */
    .hide-mobile {
        display: none !important;
    }
    
    /* Mostrar elementos solo en móvil */
    .show-mobile-table-cell {
        display: table-cell !important;
    }
    
    /* Grid de 2 columnas para productos y campos específicos en móvil */
    .grid-2-mobile,
    #productos-container .grid {
        grid-template-columns: 1fr 1fr !important;
        gap: 12px;
    }


    /* Custom checkboxes */
    input[type="checkbox"] { width: 24px; height: 24px; }

    /* Toast en la parte superior para móviles */
    #toast-container {
        top: 20px;
        bottom: auto;
        width: 95%;
    }
    
    .toast {
        padding: 14px 18px;
        font-size: 0.9rem;
        animation: slideInDown 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    }

    .toast.fade-out {
        animation: fadeOut 0.4s ease-out forwards;
    }

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

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

/* --- TABLAS --- */

table {
    width: 100%;
    color: var(--text-main);
    font-size: 0.9rem;
}

th {
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 1px;
}

/* Contenedor de acciones para centrar los botones */
.acciones-flex {
    display: flex;
    gap: 8px;
    justify-content: center;
    text-align: center;
}

/* Zebra striping: filas alternas para mejorar legibilidad */
table tbody tr:nth-child(odd) {
    background-color: var(--table-row-odd);
    transition: background-color 0.15s ease;
}
table tbody tr:nth-child(even) {
    background-color: var(--table-row-even);
}
table tbody tr:hover {
    background-color: var(--table-row-hover) !important;
}

/* Quitar bordes de celdas en todas las tablas */
table, table th, table td {
    border: none;
    padding: 2px 5px;
}

/* Opcional: separar celdas para evitar colapsado de bordes residuales */
table { border-collapse: separate; border-spacing: 0; }

/* Estilo base para botones de icono */
.btn-icon {
    background-color: var(--bg-white-overlay-05);
    border: 1px solid var(--border-white-10);
    color: var(--color-error);
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 1rem;
    /*display: flex;
    align-items: center;
    justify-content: center;*/
}

/* Efecto al pasar el ratón (Hover) */
.btn-icon:hover {
    background-color: var(--color-error);
    color: var(--text-white);
    transform: translateY(-2px);
}
.btn-icon.favorito:hover {
    background-color: var(--color-warning-light);
    color: var(--text-white);
    box-shadow: 0 4px 12px var(--shadow-success);
}

/* Toggle switch */
.switch {
    display: inline-block;
    position: relative;
    width: 52px;
    height: 30px;
}
.switch input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}
.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-white-overlay-06);
    transition: background 0.2s ease, border-color 0.2s ease;
    border-radius: 999px;
    border: 1px solid var(--border-color);
}
.slider:before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 4px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--text-white);
    border-radius: 50%;
    transition: transform 0.2s ease;
    box-shadow: none;
}
.switch input:checked + .slider {
    /* Fondo azul liso sin sombras ni degradados */
    background: var(--primary);
    border-color: transparent;
}
.switch input:checked + .slider:before {
    transform: translateY(-50%) translateX(22px);
}

/* Small helper to align switch with labels */
.switch-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Botón flotante genérico para móvil (añadir registro) */
.btn-floating {
    display: none;
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background: linear-gradient(to bottom, var(--color-warning-light), var(--color-warning-dark));
    color: var(--text-white);
    border: none;
    border-radius: 12px;
    font-size: 2rem;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 4px 12px var(--shadow-warning);
    z-index: 1000;
    transition: all 0.3s ease;
}

.btn-floating:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px var(--shadow-warning-hover);
}

@media (max-width: 768px) {
    .btn-floating {
        display: block;
    }
    .btn-add-desktop {
        display: none !important;
    }
}

@media (min-width: 769px) {
    .btn-floating {
        display: none;
    }
}

/* Overlay para desenfocar cuando FAB está abierto */
.fab-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-overlay);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.fab-overlay.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* FAB con menú desplegable para Home */
.fab-container {
    display: none;
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 1001;
    flex-direction: column;
    align-items: flex-end;
    pointer-events: none;
}

.fab-container.open {
    pointer-events: auto;
}

.fab-container:not(.open) .fab-menu {
    pointer-events: none;
}

.fab-container .btn-floating-home {
    pointer-events: auto !important;
}

.fab-container .fab-menu-item {
    pointer-events: auto;
}

.btn-floating-home {
    display: flex !important;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.fab-container.open .btn-floating-home {
    transform: rotate(45deg);
}

.fab-menu {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 12px;
    margin-bottom: 75px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.3s ease;
}

.fab-container.open .fab-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.fab-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 18px;
    border-radius: 999px;
    width: fit-content;
    text-decoration: none;
    color: var(--text-white);
    font-weight: 600;
    font-size: 0.95rem;
    box-shadow: 0 4px 12px var(--shadow-dark);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    white-space: nowrap;
}

.fab-menu-item:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 16px var(--shadow-dark-hover);
}

.fab-menu-item .material-symbols-rounded {
    font-size: 1.55rem;
}

.fab-trabajo {
    background: linear-gradient(90deg, var(--accent), var(--accent-hover));
}

.fab-recoleccion {
    background: linear-gradient(90deg, var(--color-success), var(--color-success-dark));
}

.fab-incidencias {
    background: var(--color-error);
}

@media (max-width: 768px) {
    .fab-container {
        display: flex;
    }
}

/* FAB para plantación - botón gráficos a la izquierda, "+" a la derecha */
.fab-plantacion {
    bottom: 30px;
    right: 30px;
    z-index: 1000;
}

.fab-plantacion .fab-menu {
    margin-bottom: 75px;
}

.btn-floating-stats {
    display: none;
    position: fixed;
    bottom: 30px;
    right: 110px; /* A la izquierda del botón "+", con más separación */
    width: 60px;
    height: 60px;
    background: linear-gradient(to bottom, var(--primary), var(--primary-dark));
    color: var(--text-white);
    border: none;
    border-radius: 12px; /* Cuadrado con bordes redondeados */
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 4px 12px var(--shadow-primary-hover);
    z-index: 1000;
    transition: all 0.3s ease;
    align-items: center;
    justify-content: center;
}

.btn-floating-stats:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px var(--shadow-primary-hover);
}

.btn-floating-stats .material-symbols-rounded {
    font-size: 1.5rem;
}

@media (max-width: 768px) {
    .btn-floating-stats {
        display: flex;
    }
    
    .fab-plantacion {
        display: flex;
    }
}

/* Colores adicionales para FAB de plantación */
.fab-tratamiento {
    background: linear-gradient(90deg, var(--color-blue), var(--color-blue-dark));
}

.fab-riego {
    background: linear-gradient(90deg, var(--color-cyan), var(--color-cyan-dark));
}

.fab-evento {
    background: linear-gradient(90deg, var(--color-purple), var(--color-purple-dark));
}

.fab-coste {
    background: linear-gradient(90deg, var(--color-coste), var(--color-coste-dark));
}

/* Slider resumen días en home */
.resumen-card {
    margin-bottom: 12px;
    padding: 12px;
    box-shadow: 0 6px 24px var(--accent-overlay-18), 0 2px 8px var(--table-row-hover);
    border: 2px solid var(--accent);
}

.resumen-title {
    margin-bottom: 10px;
    text-align: center;
    letter-spacing: 1px;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--primary);
}

.resumen-title .material-symbols-rounded {
    font-size: 1.3rem;
    width: 1.3rem;
    height: 1.3rem;
    vertical-align: middle;
    margin-right: 6px;
}

.resumen-slider {
    position: relative;
}

.resumen-track {
    display: flex;
    gap: 0;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain; /* Evita que el scroll horizontal afecte al scroll vertical */
    padding-bottom: 8px;
    scrollbar-width: none;          /* Firefox: ocultar barra */
    -ms-overflow-style: none;       /* IE/Edge antiguo */
}

.resumen-track::-webkit-scrollbar {
    display: none;                  /* Chrome/Safari: ocultar barra */
}

.resumen-slide {
    flex: 0 0 100%;
    max-width: 100%;
    scroll-snap-align: start;
    background: var(--bg-white-overlay-01);
    border-radius: 10px;
    border: 1px solid var(--bg-white-overlay-06);
    padding: 6px 8px 8px;
    box-sizing: border-box;
}

.resumen-fecha {
    display: flex;
    justify-content: center;
    align-items: baseline;
    gap: 5px;
    margin-bottom: 6px;
}

.resumen-fecha-dia {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--accent);
}

.resumen-fecha-anyo {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.resumen-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

.resumen-item {
    background: var(--bg-white-overlay-03);
    border-radius: 8px;
    padding: 6px 4px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 0;
}

.resumen-icon {
    font-size: 1.3rem;
    margin-bottom: 2px;
}

/* PROVISIONAL: Labels ocultos temporalmente para compactar más la ficha */
.resumen-label {
    display: none;
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-bottom: 1px;
}

.resumen-value {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--accent); /* Color amarillo/naranja para valores */
}

/* Texto de tareas - mismo estilo que el resto pero adaptado al contenido */
.resumen-value-small {
    font-size: 0.95rem;
    color: var(--accent);
    font-weight: 700;
    white-space: pre-line;
    word-break: break-word;
}

.resumen-dots {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-top: 6px;
}

.resumen-dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    border: none;
    background: var(--bg-white-overlay-18);
    padding: 0;
    cursor: pointer;
    transition: all 0.15s ease;
}

.resumen-dot.active {
    width: 18px;
    background: var(--accent);
}


/* === NOTIFICACIONES TOAST ESTILO ANDROID === */
#toast-container {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9998;
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 90%;
    max-width: 500px;
    pointer-events: none;
}

/* En móvil, mantener más abajo para no bloquear el menú */
@media (max-width: 768px) {
    #toast-container {
        top: 80px;
        bottom: auto;
        flex-direction: column;
    }
}

.toast {
    background: var(--bg-card);
    color: var(--text-main);
    padding: 16px 24px;
    border-radius: 8px;
    box-shadow: 0 6px 20px var(--shadow-dark-medium), 0 0 0 1px var(--bg-white-overlay-10);
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.95rem;
    font-weight: 500;
    pointer-events: all;
    animation: slideInDown 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    transform-origin: top center;
}

/* Animación desde arriba en móvil */
@media (max-width: 768px) {
    .toast {
        animation: slideInDown 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
        transform-origin: top center;
    }
}

.toast.success {
    border-left: 4px solid var(--color-success);
}

.toast.error {
    border-left: 4px solid var(--color-success-alt);
}

.toast.info {
    border-left: 4px solid var(--primary);
}

.toast-icon {
    font-size: 1.4rem;
    line-height: 1;
    flex-shrink: 0;
}

.toast-message {
    flex: 1;
}

.toast.fade-out {
    animation: fadeOut 0.4s ease-out forwards;
}

@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

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

/* --- LISTA DE PLANTACIONES (página /plantaciones) --- */
.plantacion-list-item {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 0;
    transition: all 0.3s ease;
    display: flex;
    overflow: hidden;
}

.plantacion-list-item:hover {
    background: var(--primary-overlay-05);
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--bg-overlay-subtle);
}

/* Plantaciones pasadas: mismo layout, color más apagado */
.plantacion-list-item.plantacion-pasada {
    background: var(--bg-card-lighter);
    border-color: var(--border-color);
    opacity: 0.92;
}

.plantacion-list-item.plantacion-pasada:hover {
    background: var(--bg-card-hover);
    border-color: var(--text-muted);
    opacity: 1;
}

.plantacion-list-item.plantacion-pasada .plantacion-list-finca {
    color: var(--text-muted);
}

.plantacion-list-item.plantacion-pasada .plantacion-list-cultivo {
    color: var(--text-muted);
}

.plantacion-pasada-icon .plantacion-icono {
    color: var(--text-muted) !important;
}

.card-plantaciones-pasadas h2 {
    color: var(--text-muted);
    font-size: 1.1rem;
}

.plantacion-list-content {
    flex: 1;
    padding: 14px 16px;
}

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

.plantacion-list-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.plantacion-list-icon {
    font-size: 2rem;
    flex-shrink: 0;
    align-self: flex-start;
}

.plantacion-list-nombres {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.plantacion-list-finca {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-main);
}

.plantacion-list-cultivo {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--primary);
}

.plantacion-list-variedad {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-style: italic;
}

/* Badges de días e incidencias */
.plantacion-list-badges {
    display: flex;
    flex-shrink: 0;
    border-left: 1px solid var(--border-color);
}

.plantacion-badge {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 12px 16px;
    min-width: 60px;
}

.plantacion-badge .material-symbols-rounded {
    font-size: 1.6rem;
}

.plantacion-badge-count {
    font-size: 1.2rem;
    font-weight: 700;
    margin-top: 2px;
}

/* Badge de días - color azul */
.plantacion-badge-dias .material-symbols-rounded {
    color: var(--primary);
}

.plantacion-badge-dias .plantacion-badge-count {
    color: var(--primary);
}

/* Badge de incidencias - neutro por defecto */
.plantacion-badge-incidencias {
    border-left: 1px solid var(--border-color);
}

.plantacion-badge-incidencias .material-symbols-rounded {
    color: var(--text-muted);
}

.plantacion-badge-incidencias .plantacion-badge-count {
    color: var(--text-muted);
}

/* Badge de incidencias - rojo si tiene incidencias activas */
.plantacion-badge-incidencias.tiene-incidencias .material-symbols-rounded {
    color: var(--color-error);
}

.plantacion-badge-incidencias.tiene-incidencias .plantacion-badge-count {
    color: var(--color-error);
}

.btn-edit-list {
    background: transparent;
    border: none;
    border-left: 1px solid var(--border-color);
    color: var(--primary);
    padding: 14px 20px;
    font-size: 1.3rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.btn-edit-list:hover {
    background: var(--primary);
    color: var(--text-black);
}

.btn-edit-list:active {
    transform: scale(0.95);
}

/* Responsive para móvil */
@media (max-width: 768px) {
    /* Ocultar títulos H1 en móvil ya que aparecen en el mobile-header */
    main h1 {
        display: none;
    }
    
    .plantacion-list-content {
        padding: 12px 14px;
    }
    
    .plantacion-list-icon {
        font-size: 1.6rem;
    }
    
    .plantacion-list-finca {
        font-size: 0.95rem;
    }
    
    .plantacion-list-cultivo {
        font-size: 0.85rem;
    }
    
    .plantacion-list-variedad {
        font-size: 0.75rem;
    }
    
    .plantacion-badge {
        padding: 10px 12px;
        min-width: 50px;
    }
    
    .plantacion-badge .material-symbols-rounded {
        font-size: 1.4rem;
    }
    
    .plantacion-badge-count {
        font-size: 1.05rem;
    }
    
    .btn-edit-list {
        padding: 12px 16px;
        font-size: 1.2rem;
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    to {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
}

/* ============================================
   ESTILOS PARA TIMELINE
   ============================================ */

/* Contenedor principal del timeline */
.timeline-container {
    position: relative;
    padding: 20px 0;
}

/* Línea vertical del timeline */
.timeline-line {
    position: absolute;
    left: 71px;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--border-color);
}

/* Contenedor de eventos */
.timeline-events {
    position: relative;
}

/* Evento individual del timeline */
.timeline-event {
    position: relative;
    margin-bottom: 30px;
    padding-left: 100px;
}

/* Marcador circular del timeline */
.timeline-marker {
    position: absolute;
    left: 47px;
    top: 15px;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 4px solid;
    background: var(--bg-card);
    z-index: 2;
}

.timeline-marker .material-symbols-rounded {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.3rem;
    width: 1.3rem;
    height: 1.3rem;
}

/* Etiqueta de día */
.timeline-day-label {
    position: absolute;
    left: 0;
    top: 12px;
    font-size: 0.9rem;
    font-weight: bold;
    color: var(--text-muted);
    width: 40px;
    text-align: center;
    line-height: 1.3;
}

.timeline-day-label > div {
    display: block;
}

/* Card del evento */
.timeline-card {
    border: 2px solid;
    border-radius: 12px;
    padding: 15px;
    display: flex;
    align-items: flex-start;
    gap: 15px;
    min-height: 100px;
    transition: background-color 0.2s ease, opacity 0.2s ease;
    overflow: hidden;
    max-width: 100%;
}

.timeline-card-clickable:hover {
    opacity: 0.85;
}

.timeline-card-clickable:active {
    opacity: 0.75;
}

.timeline-card-content {
    flex: 1;
}

.timeline-card-date {
    font-size: 0.85rem;
    opacity: 0.9;
    margin-bottom: 8px;
    font-weight: 500;
}

.timeline-card-title {
    font-size: 1.2rem;
    font-weight: bold;
    margin-bottom: 12px;
}

.timeline-details {
    font-size: 0.95rem;
    opacity: 0.9;
    margin-bottom: 8px;
}

.timeline-detail-item {
    margin-bottom: 6px;
}

.timeline-detail-label {
    font-weight: 600;
}

.timeline-observaciones {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border-white-20);
}

/* Badges de incidencias */
.timeline-badges-container {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border-white-20);
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.timeline-badge {
    font-size: 0.85rem;
    padding: 4px 10px;
    border-radius: 4px;
    font-weight: 600;
}

.timeline-badge--foco {
    background: var(--bg-warning-overlay-30);
    color: var(--color-warning);
}

.timeline-badge--solucionada {
    background: var(--success-overlay-30);
    color: var(--color-success);
}

.timeline-badge--activa {
    background: var(--error-overlay-30);
    color: var(--color-error);
}

/* Grid de productos de tratamiento */
.timeline-productos {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border-white-20);
}

.timeline-productos-title {
    font-weight: 600;
    margin-bottom: 8px;
}

.timeline-productos-grid {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px 15px;
    font-size: 0.9rem;
}

.timeline-productos-dosis {
    font-weight: 600;
}

/* Foto del timeline */
.timeline-photo {
    width: 120px;
    min-width: 80px;
    max-width: 120px;
    height: 120px;
    flex-shrink: 1;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid;
    background: var(--bg-overlay-minimal);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
    aspect-ratio: 1 / 1;
}

.timeline-photo:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px var(--shadow-dark);
}

.timeline-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
}

/* En móviles, hacer la foto más pequeña para que quepa */
@media (max-width: 480px) {
    .timeline-photo {
        width: 80px;
        height: 80px;
        min-width: 60px;
        max-width: 80px;
    }
}

.timeline-photo-overlay {
    position: absolute;
    top: 5px;
    right: 5px;
    background: var(--bg-overlay);
    border-radius: 4px;
    padding: 4px 6px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.timeline-photo-overlay .material-symbols-rounded {
    font-size: 0.9rem;
    color: var(--text-white);
}

/* Colores específicos por tipo de evento */
.timeline-card--recoleccion {
    border-color: var(--color-success);
    background: var(--success-overlay-15);
}

.timeline-card-clickable.timeline-card--recoleccion:hover {
    background: var(--success-overlay-25);
}

.timeline-card--recoleccion .timeline-card-date,
.timeline-card--recoleccion .timeline-card-title,
.timeline-card--recoleccion .timeline-details {
    color: var(--text-white);
}

.timeline-card--recoleccion .timeline-marker {
    border-color: var(--color-success);
}

.timeline-card--recoleccion .timeline-marker .material-symbols-rounded {
    color: var(--color-success);
}

.timeline-card--recoleccion .timeline-photo {
    border-color: var(--color-success);
}

.timeline-card--incidencia {
    border-color: var(--color-error);
    background: var(--error-overlay-15);
}

.timeline-card-clickable.timeline-card--incidencia:hover {
    background: var(--error-overlay-25);
}

.timeline-card--incidencia .timeline-card-date,
.timeline-card--incidencia .timeline-card-title,
.timeline-card--incidencia .timeline-details {
    color: var(--text-white);
}

.timeline-card--incidencia .timeline-marker {
    border-color: var(--color-error);
}

.timeline-card--incidencia .timeline-marker .material-symbols-rounded {
    color: var(--color-error);
}

.timeline-card--incidencia .timeline-photo {
    border-color: var(--color-error);
}

.timeline-card--tratamiento {
    border-color: var(--color-blue);
    background: var(--blue-overlay-15);
}

.timeline-card-clickable.timeline-card--tratamiento:hover {
    background: var(--blue-overlay-25);
}

.timeline-card--tratamiento .timeline-card-date,
.timeline-card--tratamiento .timeline-card-title,
.timeline-card--tratamiento .timeline-details {
    color: var(--text-white);
}

.timeline-card--tratamiento .timeline-marker {
    border-color: var(--color-blue);
}

.timeline-card--tratamiento .timeline-marker .material-symbols-rounded {
    color: var(--color-blue);
}

.timeline-card--riego {
    border-color: var(--color-cyan);
    background: var(--cyan-overlay-15);
}

.timeline-card-clickable.timeline-card--riego:hover {
    background: var(--cyan-overlay-25);
}

.timeline-card--riego .timeline-card-date,
.timeline-card--riego .timeline-card-title,
.timeline-card--riego .timeline-details {
    color: var(--text-white);
}

.timeline-card--riego .timeline-marker {
    border-color: var(--color-cyan);
}

.timeline-card--riego .timeline-marker .material-symbols-rounded {
    color: var(--color-cyan);
}

/* Estilos para partes de trabajo */
.timeline-card--trabajo {
    border-color: var(--color-warning-yellow);
    background: var(--yellow-overlay-15);
}

.timeline-card-clickable.timeline-card--trabajo:hover {
    background: var(--yellow-overlay-25);
}

.timeline-card--trabajo .timeline-card-date,
.timeline-card--trabajo .timeline-card-title,
.timeline-card--trabajo .timeline-details {
    color: var(--text-white);
}

.timeline-card--trabajo .timeline-marker {
    border-color: var(--color-warning-yellow);
}

.timeline-card--trabajo .timeline-marker .material-symbols-rounded {
    color: var(--color-warning-yellow);
}

/* Estilos para eventos */
.timeline-card--evento {
    border-color: var(--color-purple);
    background: var(--purple-overlay-15);
}

.timeline-card-clickable.timeline-card--evento:hover {
    background: var(--purple-overlay-25);
}

.timeline-card--evento .timeline-card-date,
.timeline-card--evento .timeline-card-title,
.timeline-card--evento .timeline-details {
    color: var(--text-white);
}

.timeline-card--evento .timeline-marker {
    border-color: var(--color-purple);
    background: var(--bg-card);
}

.timeline-card--evento .timeline-marker .material-symbols-rounded {
    color: var(--color-purple);
}

.timeline-marker--evento {
    border-color: var(--color-purple);
    background: var(--bg-card);
}

.timeline-marker--evento .material-symbols-rounded {
    color: var(--color-purple);
}

/* Gravedad de incidencias */
.timeline-gravedad--leve {
    color: var(--color-success);
    font-weight: 600;
}

.timeline-gravedad--moderada {
    color: var(--color-warning);
    font-weight: 600;
}

.timeline-gravedad--grave {
    color: var(--color-error);
    font-weight: 600;
}

/* Título del timeline */
.timeline-section-title {
    margin-bottom: 25px;
}

.timeline-empty {
    text-align: center;
    color: var(--text-muted);
    padding: 40px;
}

/* Botón de editar en timeline */
.timeline-edit-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    background: var(--bg-white-overlay-15);
    color: var(--text-white);
    text-decoration: none;
    transition: all 0.2s ease;
    flex-shrink: 0;
    margin-left: 10px;
}

.timeline-edit-btn:hover {
    background: var(--bg-white-overlay-25);
    transform: scale(1.05);
}

.timeline-edit-btn .material-symbols-rounded {
    font-size: 1.1rem;
    width: 1.1rem;
    height: 1.1rem;
}

/* Marcadores específicos por tipo */
.timeline-marker--recoleccion {
    border-color: var(--color-success);
}

.timeline-marker--recoleccion .material-symbols-rounded {
    color: var(--color-success);
}

.timeline-marker--incidencia {
    border-color: var(--color-error);
}

.timeline-marker--incidencia .material-symbols-rounded {
    color: var(--color-error);
}

.timeline-marker--tratamiento {
    border-color: var(--color-blue);
}

.timeline-marker--tratamiento .material-symbols-rounded {
    color: var(--color-blue);
}

.timeline-marker--riego {
    border-color: var(--color-cyan);
}

.timeline-marker--riego .material-symbols-rounded {
    color: var(--color-cyan);
}

.timeline-marker--trabajo {
    border-color: var(--color-warning-yellow);
}

.timeline-marker--trabajo .material-symbols-rounded {
    color: var(--color-warning-yellow);
}

/* Fotos específicas por tipo */
.timeline-photo--recoleccion {
    border-color: var(--color-success);
}

.timeline-photo--incidencia {
    border-color: var(--color-error);
}

/* ============================================
   INDICADOR DE CARGA EN BOTONES
   ============================================ */

.btn-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.7;
}

.btn-loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid var(--text-white);
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 0.6s linear infinite;
}

.btn-loading .btn-loading-text {
    opacity: 0;
}

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

/* ============================================
   ESTILOS PARA MODALES FLOTANTES
   ============================================ */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-overlay);
    backdrop-filter: blur(4px);
    z-index: 2000;
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding: 40px 20px;
    box-sizing: border-box;
    overflow: hidden;
}

.modal-overlay.active {
    display: flex;
}

.modal-container {
    background: var(--bg-card);
    border-radius: 16px;
    box-shadow: 0 20px 60px var(--shadow-dark-medium);
    width: 100%;
    max-width: 800px;
    max-height: 90vh;
    margin: 0 auto;
    min-height: 200px;
    overflow: hidden;
    position: relative;
    border: 1px solid var(--border-color);
    animation: modalSlideIn 0.3s ease-out;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    padding: 10px 24px 16px 24px;
    border-bottom: none;
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    position: sticky;
    top: 0;
    background: var(--bg-card);
    z-index: 2010;
    border-radius: 16px 16px 0 0;
    box-shadow: 0 2px 8px var(--bg-overlay-30);
    flex-shrink: 0;
    min-height: 60px;
}

.modal-header-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 12px;
}

.modal-header-title-row h2 {
    margin: 0;
    flex: 1;
    min-width: 0;
}

.modal-header-chips-row {
    width: 100%;
    margin-top: 10px;
}

.modal-header > div:not(.modal-header-title-row):not(.plantacion-chips-container) {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.plantacion-info-modal-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--primary-overlay-10);
    border: 1px solid var(--primary);
    border-radius: 6px;
    color: var(--text-main);
    font-size: 0.85rem;
    width: fit-content;
}

.plantacion-info-modal-header .material-symbols-rounded {
    color: var(--primary);
    font-size: 1rem;
    flex-shrink: 0;
}

.plantacion-info-modal-header strong {
    color: var(--primary);
    font-weight: 600;
}

.modal-header-plantacion-wrap {
    position: relative;
    flex: 1;
}

.plantacion-chips-container {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    position: relative;
}

.modal-header-chips-row.plantacion-chips-container {
    margin-top: 10px;
}

.plantacion-chips-container .plantacion-chip {
    cursor: default;
}

.plantacion-chips-container .plantacion-chip[data-current="1"] {
    cursor: default;
    background: var(--bg-overlay-lighter);
    border-color: var(--primary);
}

.plantacion-chips-container .plantacion-chip:not([data-current="1"]) {
    cursor: pointer;
}

.plantacion-chips-container .plantacion-chip:not([data-current="1"]):hover {
    background: var(--primary-overlay-20);
    border-color: var(--primary);
}

.plantacion-chips-container .plantacion-chip .plantacion-chip-remove-icon {
    margin-left: 4px;
    font-size: 1rem;
    opacity: 0.85;
}

.plantacion-chips-container .plantacion-chip-add {
    cursor: pointer;
    border-style: dashed;
}

.plantacion-chips-container .plantacion-chip-add:hover {
    background: var(--primary-overlay-20);
}

/* Parpadeo para señalar que hay que añadir plantación (costes) */
@keyframes coste-add-plantacion-blink {
    0%, 100% { box-shadow: 0 0 0 0 transparent; background: var(--primary-overlay-10); }
    50% { box-shadow: 0 0 0 3px var(--primary); background: var(--primary-overlay-35); }
}
.plantacion-chips-container .plantacion-chip-add.parpadeo-plantacion {
    animation: coste-add-plantacion-blink 1s ease-in-out 4;
}

/* Desplegable de chips en modales (Tratamiento/Riego/Evento) - no confundir con .plantacion-dropdown-list de la cabecera */
.plantacion-chips-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 4px;
    margin-left: 0;
    min-width: 220px;
    max-height: 240px;
    overflow-y: auto;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 16px var(--bg-overlay-subtle);
    z-index: 100;
}

.plantacion-chips-dropdown.active {
    display: block;
}

.plantacion-chips-dropdown .plantacion-dropdown-item {
    padding: 10px 14px;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-main);
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 8px;
}

.plantacion-chips-dropdown .plantacion-dropdown-item:hover {
    background: var(--primary-overlay-15);
}

.plantacion-chips-dropdown .plantacion-dropdown-item .material-symbols-rounded {
    color: var(--primary);
    font-size: 1.1rem;
}

.modal-header h2 {
    margin: 0;
    color: var(--text-main);
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    gap: 10px;
    border:none;
    padding-bottom: 0;
}

.modal-close {
    background: var(--bg-white-overlay-05);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    font-size: 1.4rem;
    cursor: pointer;
    padding: 0;
    border-radius: 8px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    flex-shrink: 0;
}

.modal-close:hover {
    background: var(--bg-white-overlay-15);
    color: var(--text-main);
    border-color: var(--primary);
    transform: scale(1.05);
}

.modal-close:active {
    transform: scale(0.95);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1;
    min-height: 0;
    -webkit-overflow-scrolling: touch;
    display: flex;
    flex-direction: column;
}

.modal-body form {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.modal-body form > *:not(.form-actions) {
    flex-shrink: 0;
}

.modal-body .form-actions {
    margin-top: auto;
    padding-top: 20px;
    padding-bottom: 24px;
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
    background: var(--bg-card);
}

.modal-body::-webkit-scrollbar {
    width: 8px;
}

.modal-body::-webkit-scrollbar-track {
    background: var(--bg-white-overlay-05);
    border-radius: 4px;
}

.modal-body::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.modal-body::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

.modal-body .card {
    margin: 0;
    box-shadow: none;
    border: none;
}

@media (max-width: 768px) {
    .modal-overlay {
        padding: 10px;
        align-items: flex-start;
        overflow: hidden;
    }
    
    .modal-container {
        max-width: 100%;
        max-height: 95dvh;
        margin: 1dvh auto 2dvh auto;
        border-radius: 12px;
    }
    
    .modal-header {
        padding: 10px 20px;
        border-radius: 12px 12px 0 0;
        min-height: 56px;
    }
    
    .modal-header h2 {
        font-size: 1.3rem;
    }
    
    .modal-close {
        width: 36px;
        height: 36px;
        font-size: 1.4rem;
    }
    
    .modal-body {
        padding: 20px;
    }
}

/* ============================================
   INFORMACIÓN DE PLANTACIÓN EN MODALES
   ============================================ */

.plantacion-info-modal {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: var(--primary-overlay-10);
    border: 1px solid var(--primary);
    border-radius: 8px;
    margin-bottom: 20px;
    color: var(--text-main);
    font-size: 0.95rem;
}

/* Plantación info fija en el header del modal */
.modal-header-container {
    position: relative;
    padding-bottom: 50px;
}

.plantacion-info-modal .material-symbols-rounded {
    color: var(--primary);
    font-size: 1.2rem;
    flex-shrink: 0;
}

.plantacion-info-modal strong {
    color: var(--primary);
    font-weight: 600;
}

/* ============================================
   ESTILOS GENÉRICOS PARA FICHAS
   ============================================ */

/* Contenedor de fichas */
#fichas-partes-container,
.fichas-items-container {
    margin-top: 20px;
}

.fichas-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: transparent;
    border: none;
    border-radius: 0;
    overflow: visible;
}

/* Grupo de fichas (opcional, para agrupar por día u otro criterio) */
.fichas-dia-grupo,
.fichas-grupo {
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    background: var(--bg-card);
    margin-bottom: 16px;
}

.fichas-dia-header,
.fichas-grupo-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--primary-overlay-10);
    border-bottom: 1px solid var(--border-color);
}

.fichas-dia-label,
.fichas-grupo-label {
    font-size: 1rem;
    font-weight: 600;
    color: var(--primary);
}

.fichas-dia-total,
.fichas-grupo-total {
    font-size: 1rem;
    font-weight: bold;
    color: var(--accent);
}

.fichas-dia-content,
.fichas-grupo-content {
    display: flex;
    flex-direction: column;
}

/* Ficha individual genérica */
.ficha-item {
    position: relative;
    background: var(--bg-card);
    display: flex;
    flex-direction: row;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s ease;
    overflow: hidden;
    user-select: none;
    min-height: 60px;
    padding: 0;
    border-bottom: 1px solid var(--border-color);
    border-radius: 0;
    margin: 0;
}

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

.ficha-item:hover {
    background: var(--primary-overlay-05);
    border-color: var(--primary);
}

.ficha-item-content {
    flex: 1;
    padding: 12px 16px;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 20px;
    transition: transform 0.3s ease;
    min-height: 0;
    flex-wrap: wrap;
}

.ficha-header {
    display: none;
}

.ficha-fecha {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
    min-width: 80px;
    flex-shrink: 0;
}

.ficha-horas {
    font-size: 0.9rem;
    font-weight: bold;
    color: var(--accent);
    min-width: 70px;
    text-align: right;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
}

.ficha-plantacion {
    flex: 1;
    min-width: 150px;
}

.ficha-plantacion strong {
    display: block;
    font-size: 0.95rem;
    color: var(--text-main);
    margin-bottom: 2px;
}

.ficha-cultivo {
    font-size: 0.85rem;
    color: var(--primary);
}

.ficha-tarea,
.ficha-tipo {
    font-size: 0.9rem;
    color: var(--text-main);
    min-width: 120px;
    flex-shrink: 0;
}

.ficha-empresa,
.ficha-detalle {
    font-size: 0.85rem;
    color: var(--text-muted);
    min-width: 120px;
    flex-shrink: 0;
}

/* En detalle de plantación: bloque horas más pequeño, más espacio para tarea y empresa */
.vista-columna-derecha .ficha-horas {
    min-width: 42px;
    font-size: 0.8rem;
}
.vista-columna-derecha .ficha-tarea {
    min-width: 0;
    flex: 1;
}
.vista-columna-derecha .ficha-empresa {
    min-width: 0;
    flex: 1;
    max-width: 45%;
}

.ficha-label-desktop {
    display: none;
}

/* Fichas detalladas genéricas (para incidencias, tratamientos, etc.) */
.fichas-incidencias-detalladas,
.fichas-detalladas {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.ficha-incidencia-detallada,
.ficha-detallada {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px var(--bg-overlay-minimal);
}

.ficha-incidencia-detallada:hover,
.ficha-detallada:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--bg-overlay-minimal);
    border-color: var(--primary);
}

.ficha-incidencia-pendiente,
.ficha-detallada-pendiente {
    background: var(--bg-warning-overlay-05);
    border-left: 4px solid var(--color-warning);
}

.ficha-incidencia-header,
.ficha-detallada-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.ficha-incidencia-fecha,
.ficha-detallada-fecha {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-main);
    display: flex;
    align-items: center;
}

.ficha-incidencia-gravedad,
.ficha-detallada-badge {
    display: flex;
    align-items: center;
    font-weight: 600;
    font-size: 1rem;
}

.ficha-incidencia-body,
.ficha-detallada-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
}

.ficha-incidencia-tipo,
.ficha-detallada-tipo {
    font-size: 1.3rem;
    color: var(--color-error-light);
    display: flex;
    align-items: center;
    margin-bottom: 4px;
}

.ficha-incidencia-tipo strong,
.ficha-detallada-tipo strong {
    color: var(--color-error-light);
    font-size: 1.3rem;
}

.ficha-incidencia-plantacion,
.ficha-detallada-plantacion {
    font-size: 0.95rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
}

.ficha-incidencia-zona,
.ficha-detallada-zona {
    font-size: 0.9rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
}

.ficha-incidencia-observaciones,
.ficha-detallada-observaciones {
    font-size: 0.9rem;
    color: var(--text-muted);
    display: flex;
    align-items: flex-start;
    line-height: 1.5;
    margin-top: 4px;
}

.ficha-incidencia-footer,
.ficha-detallada-footer {
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

.ficha-incidencia-estados,
.ficha-detallada-estados {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.ficha-incidencia-estado,
.ficha-detallada-estado {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
}

/* Estilos específicos para productos en fichas detalladas */
.ficha-detallada-productos {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
    font-size: 0.95rem;
    display: flex;
    align-items: flex-start;
    line-height: 1.5;
}

.ficha-estado-activo {
    background: var(--success-overlay-10);
    color: var(--color-success-light);
}

.ficha-estado-inactivo {
    background: var(--error-overlay-10);
    color: var(--color-error-light);
}

.ficha-estado-pendiente {
    background: var(--accent-overlay-10);
    color: var(--color-warning);
}

.ficha-estado-foto {
    background: var(--cyan-overlay-10);
    color: var(--primary);
}

.ficha-incidencia-foto {
    display: inline-block;
    margin-left: 8px;
}

.ficha-incidencia-foto img {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.ficha-incidencia-foto img:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 8px var(--bg-overlay-subtle);
}

@media (max-width: 768px) {
    .ficha-incidencia-detallada,
    .ficha-detallada {
        padding: 16px;
    }
    
    .ficha-incidencia-header,
    .ficha-detallada-header {
        flex-direction: row;
        align-items: center;
        gap: 12px;
    }
    
    .ficha-incidencia-fecha,
    .ficha-detallada-fecha {
        flex: 1;
    }
    
    .ficha-incidencia-gravedad,
    .ficha-detallada-badge {
        flex-shrink: 0;
    }
    
    .ficha-incidencia-estados,
    .ficha-detallada-estados {
        gap: 8px;
    }
    
    .ficha-incidencia-estado,
    .ficha-detallada-estado {
        font-size: 0.8rem;
        padding: 5px 10px;
    }
    
    .ficha-incidencia-foto img {
        width: 50px !important;
        height: 50px !important;
    }
    
    .ficha-detallada-productos {
        font-size: 0.9rem;
    }
}

.ficha-value {
    color: inherit;
}

/* Botón de eliminación genérico */
.btn-delete {
    display: none;
    background-color: var(--color-error);
    color: var(--text-white);
    border: 1px solid var(--color-error);
    padding: 16px 24px;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    width: auto;
    margin-right: auto;
    box-shadow: 0 2px 8px var(--error-overlay-20);
}

.btn-delete:hover {
    background-color: var(--color-error-dark) !important;
    border-color: var(--color-error-dark) !important;
    box-shadow: 0 4px 12px var(--error-overlay-50) !important;
    transform: translateY(-1px);
}

.ficha-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
}

.ficha-empty-filtro {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
    display: none;
}

/* Estilos de paginación */
.btn-pagination {
    transition: all 0.2s ease;
}

.btn-pagination:hover:not(:disabled) {
    background: var(--bg-secondary) !important;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px var(--bg-overlay-subtle);
}

.btn-pagination:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.btn-pagination:active:not(:disabled) {
    transform: translateY(0);
}

#pagination-controls-coste,
#pagination-controls-beneficio {
    user-select: none;
}

@media (max-width: 640px) {
    #pagination-controls-coste,
    #pagination-controls-beneficio {
        gap: 4px;
    }
    
    .btn-pagination {
        padding: 6px 10px !important;
        min-width: 36px !important;
    }
    
    .btn-pagination .material-symbols-rounded {
        font-size: 1rem !important;
    }
    
    #page-numbers-coste button,
    #page-numbers-beneficio button {
        font-size: 0.9rem;
        padding: 6px 10px !important;
        min-width: 32px !important;
    }
}

.highlight-ficha {
    animation: highlight-pulse 1s ease-in-out 3;
}

@media (max-width: 768px) {
    .ficha-item {
        min-height: 60px;
    }
    
    .ficha-item-content {
        padding: 10px 12px;
        gap: 0;
        flex-wrap: nowrap;
        display: grid;
        grid-template-columns: 1fr 1fr 1fr 1fr;
        width: 100%;
    }
    
    .ficha-plantacion {
        min-width: 0;
        flex: 0 0 25%;
        padding-right: 8px;
    }
    
    .ficha-plantacion strong {
        font-size: 0.8rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    .ficha-cultivo {
        font-size: 0.7rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    .ficha-tarea,
    .ficha-tipo {
        font-size: 0.8rem;
        min-width: 0;
        flex: 0 0 25%;
        padding: 0 4px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    .ficha-empresa,
    .ficha-detalle {
        font-size: 0.75rem;
        min-width: 0;
        flex: 0 0 25%;
        padding: 0 4px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    .ficha-horas {
        font-size: 0.8rem;
        min-width: 0;
        flex: 0 0 25%;
        text-align: right;
        padding-left: 8px;
    }
    
    /* En detalle de plantación (solo tarea, empresa, horas): 3 columnas y empresa que pueda envolver */
    .vista-columna-derecha .ficha-item-content {
        grid-template-columns: 1fr 1fr auto;
    }
    .vista-columna-derecha .ficha-tarea {
        flex: none;
        min-width: 0;
        white-space: normal;
        overflow: visible;
        word-wrap: break-word;
    }
    .vista-columna-derecha .ficha-empresa {
        flex: none;
        min-width: 0;
        white-space: normal;
        overflow: visible;
        text-overflow: clip;
        word-wrap: break-word;
    }
    .vista-columna-derecha .ficha-horas {
        flex: none;
        min-width: 42px;
    }
}