/* ==========================================================================
   DATABIDE - HOJA DE ESTILOS PRINCIPAL
   ========================================================================== 
   ÍNDICE:
   1. Variables Globales
   2. Base y Layout (Body, Scrollbar, Navbar)
   3. Sidebar
   4. Landing Page e Index
   5. UI Base: Botones Soft, Badges y Modales
   6. Formularios y Selectores
   7. Subida de Archivos y Dropzones
   8. Módulo: Tramos
   9. Módulo: Filter Bars
   10. Módulo: Autenticación (Login)
   11. Módulo: Admin y Logs
   12. Módulo: RRHH
   13. Módulo: Reportes Diarios y Calendarios
   14. Módulo: Roles y Matriz de Permisos
   15. Módulo: Tareas e Incidencias
   16. Media Queries (Responsive)
   ========================================================================== */

/* =========================================
   1. VARIABLES GLOBALES
   ========================================= */
:root {
    --bs-body-bg: #212529;
    --bs-body-color: #f8f9fa;
    --sidebar-width: 250px;
    --sidebar-min-width: 80px;
    --app-card-height: 165px;
    
    /* Variables para tramos */
    --tramo-primary: #0d6efd;
    --tramo-success: #198754;
    --tramo-warning: #ffc107;
    --tramo-danger: #dc3545;
    --tramo-bg-light: #495057;
    --tramo-bg-dark: #343a40;
    --tramo-border: #6c757d;
}

/* =========================================
   2. BASE Y LAYOUT
   ========================================= */
body {
    background-color: var(--bs-body-bg);
    color: var(--bs-body-color);
    padding-top: 75px;
    margin-right: 0;
    overflow-x: hidden;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Layouts especiales sin Navbar superior (Index y Login) */
.landing-body { padding-top: 0 !important; display: block !important; }
.login-body { padding-top: 0 !important; display: flex !important; flex-direction: column !important; justify-content: center !important; align-items: center !important; min-height: 100vh !important; }

/* Ocultar barras de desplazamiento */
*, .scroll-container { scrollbar-width: none; -ms-overflow-style: none; }
*::-webkit-scrollbar { display: none; }
.scroll-container { overflow-y: auto; }

/* NAVBAR */
.navbar { height: 75px; }
.navbar-brand { margin-left: 60px; }
.app-title { position: absolute; left: 50%; transform: translateX(-50%); font-size: 2rem; font-weight: bold; border: 2px solid #0d6efd; border-radius: 8px; padding: 5px 15px; white-space: nowrap; }

/* MAIN CONTENT */
.main-content { transition: margin-left 0.3s; margin-left: var(--sidebar-width); width: calc(100% - var(--sidebar-width)); padding: 0 15px; }
.main-content.sidebar-minimized { margin-left: var(--sidebar-min-width); width: calc(100% - var(--sidebar-min-width)); }

/* =========================================
   3. SIDEBAR
   ========================================= */
#sidebar { width: var(--sidebar-width); transition: all 0.3s; position: fixed; height: calc(100vh - 75px); overflow-y: auto; z-index: 1020; background-color: var(--bs-body-bg); }
#sidebar::after { content: ''; position: absolute; top: 0; right: 0; width: 1px; height: 100%; background-color: #495057; z-index: 1; }

#sidebar.minimized { width: var(--sidebar-min-width); overflow-y: auto !important; overflow-x: hidden !important; }
#sidebar.minimized .text-item, #sidebar.minimized .sidebar-section-title { display: none; }
#sidebar.minimized .icon-only, #sidebar.minimized .sidebar-divider { display: flex; justify-content: center; align-items: center; margin-left: 5px; margin-right: 9px; }

#sidebar.minimized .version-number { display: none !important; }

/* SIDEBAR ITEMS Y ESTADOS */
.sidebar-section-title { font-size: 0.75rem; font-weight: 600; letter-spacing: 0.5px; text-transform: uppercase; padding-left: 5px; }
#sidebar .list-group-item {
    padding-top: 0.5rem; padding-bottom: 0.5rem; margin-bottom: 2px; border-radius: 4px; margin-left: 8px; margin-right: 9px;
    position: relative; z-index: 0; font-size: 0.95rem; background-color: transparent; border: none; color: rgba(255, 255, 255, 0.8); transition: all 0.3s ease;
}
#sidebar .list-group-item:hover { background-color: rgba(255, 255, 255, 0.1); color: #ffffff !important; padding-left: 0.5rem; cursor: pointer; }
#sidebar .list-group-item:hover i { transform: scale(1.1); transition: transform 0.3s ease; }
.sidebar-divider { margin-top: 0.5rem !important; margin-bottom: 0.5rem !important; height: 1px; margin: 15px 8px; background-color: #495057; display: block !important; }
.sidebar-overlay { display: none; position: fixed; top: 75px; left: 0; right: 0; bottom: 0; background-color: rgba(0,0,0,0.5); z-index: 1025; }
.sidebar-overlay.active { display: block; }

/* INFO USUARIO SIDEBAR */
.user-info { 
    padding: 0 10px; /* Padding solo a los lados */
    margin-bottom: 8px; 
    height: 42px; /* ALTURA FIJA: No variará nunca */
    display: flex; 
    align-items: center; 
}

/* Botón unificado del perfil en la sidebar */
.user-profile-btn { 
    background-color: rgba(25, 135, 84, 0.15); /* Verde transparente muy sutil */
    color: #ffffff !important; 
    border: 1px solid rgba(25, 135, 84, 0.3); /* Un borde fino para delimitarlo */
    transition: all 0.2s ease-in-out; 
    cursor: pointer; 
    width: 100%;
}

.user-profile-btn:hover { 
    background-color: rgba(25, 135, 84, 0.25); /* Se vuelve un poco más opaco al pasar el ratón */
    color: #ffffff !important; 
}

.user-profile-btn i.icon-profile { 
    color: rgba(255, 255, 255, 0.9); 
    margin: 0 !important;
    display: flex;
}

/* Ajustes del botón de perfil cuando la sidebar está MINIMIZADA */
#sidebar.minimized .user-profile-btn .text-item {
    display: none !important; /* Oculta nombre y rol */
}

#sidebar.minimized .user-btn-container {
    margin-left: 12px !important;
    margin-right: 16px !important;
}

#sidebar.minimized .user-profile-btn {
    padding: 0 !important; /* Quita el padding lateral */
    justify-content: center !important; /* Centra el icono en el cuadrado */
}

#sidebar.minimized .mx-3.mt-2.mb-3 {
    margin-left: 12px !important;
    margin-right: 16px !important;
}

.role-badge { font-size: 0.8rem; padding: 2px 5px; border-radius: 3px; margin-left: 5px; background-color: rgba(13, 110, 253, 0.2); border: 1px solid #0d6efd; display: inline-block; }
.version-info { border-bottom: 1px solid rgba(255, 255, 255, 0.1); padding-bottom: 0.5rem; }
.version-info:hover { cursor: help; }
.version-info:hover small { opacity: 1 !important; }
.version-info .badge-dev { background-color: #dc3545; color: white; }
.version-info .badge-prod { background-color: #198754; color: white; }
.version-info .version-number { font-family: 'Courier New', monospace; letter-spacing: 0.5px; }

/* COLORES POR ESTADO (Sidebar Fix - Agrupados) */
#sidebar .list-group-item.status-operativo i, #sidebar .list-group-item.status-operativo .text-item { color: #28a745 !important; }
#sidebar .list-group-item.status-beta i, #sidebar .list-group-item.status-beta .text-item { color: #0dcaf0 !important; }
#sidebar .list-group-item.status-testing i, #sidebar .list-group-item.status-testing .text-item { color: #ffc107 !important; }
#sidebar .list-group-item.status-desarrollo i, #sidebar .list-group-item.status-desarrollo .text-item { color: #dc3545 !important; }

/* Mantener el color blanco en texto e iconos al pasar el ratón */
#sidebar .list-group-item:hover i, #sidebar .list-group-item:hover .text-item { color: #ffffff !important; }

/* Agrupación de bordes base transparentes */
#sidebar .list-group-item.status-operativo, #sidebar .list-group-item.status-beta, #sidebar .list-group-item.status-testing, #sidebar .list-group-item.status-desarrollo { border-left: 3px solid transparent; }

/* Bordes en Hover */
#sidebar .list-group-item.status-operativo:hover { border-left: 3px solid #28a745; }
#sidebar .list-group-item.status-beta:hover { border-left: 3px solid #0dcaf0; }
#sidebar .list-group-item.status-testing:hover { border-left: 3px solid #ffc107; }
#sidebar .list-group-item.status-desarrollo:hover { border-left: 3px solid #dc3545; }

.logout-btn { background-color: rgba(220, 53, 69, 0.15) !important; border: 1px solid #dc3545 !important; color: #ff8787 !important; transition: all 0.3s ease; }
.logout-btn:hover { background-color: rgba(220, 53, 69, 0.3) !important; color: #ffb3b3 !important; }
.logout-btn i { color: inherit; }

/* =========================================
   4. LANDING PAGE E INDEX
   ========================================= */
.logo-left { height: 70px; width: auto; object-fit: contain; }
.logo-right { height: 160px; width: auto; object-fit: contain; }
.logo-spacer { height: 66px; }

.hero-section { padding: 100px 0; text-align: center; min-height: 80vh; display: flex; flex-direction: column; justify-content: center; align-items: center; background: linear-gradient(135deg, #2c3034 0%, #16191c 100%); }
.hero-section h1 { font-size: 3.5rem; margin-bottom: 2rem; }
.btn-hero { padding: 0.75rem 2rem; font-size: 1.1rem; border-radius: 30px; margin: 0.5rem; transition: all 0.3s ease; }
.btn-hero:hover { transform: translateY(-3px); box-shadow: 0 10px 20px rgba(0,0,0,0.2); }

.features-section { padding: 80px 0; background-color: #2c3034; }
.feature-card { padding: 2rem; margin-bottom: 30px; border-radius: 10px; background-color: #343a40; border: 1px solid #495057; height: 100%; transition: transform 0.3s ease; }
.feature-card:hover { transform: translateY(-10px); }
.feature-icon { font-size: 2.5rem; margin-bottom: 1.5rem; color: #0d6efd; }
.footer { background-color: #16191c; padding: 30px 0; margin-top: auto; }

.landing-container { min-height: 85vh; position: relative; overflow: hidden; }
.landing-container::before { content: ''; position: absolute; top: -10%; right: -10%; width: 400px; height: 400px; background: radial-gradient(circle, rgba(13, 110, 253, 0.1) 0%, rgba(13, 110, 253, 0) 70%); z-index: -1; border-radius: 50%; }
.landing-container::after { content: absolute; bottom: -10%; left: -10%; width: 300px; height: 300px; background: radial-gradient(circle, rgba(220, 53, 69, 0.07) 0%, rgba(220, 53, 69, 0) 70%); z-index: -1; border-radius: 50%; }

/* Tarjetas de Apps en Dashboard */
.row-app-cards { margin: 0 -0.5rem; }
.row-app-cards .col-md-3, .row-app-cards .col-sm-6 { padding: 0 0.5rem; }
.app-card, .app-card-inactive { display: block; height: 100%; }
.app-card-inner { height: var(--app-card-height); transition: all 0.3s ease; border-width: 2px; }
.app-card-body { height: 100%; display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 1rem; }
.app-title-text { margin: 0; line-height: 1.2; font-size: 1rem; max-height: 2.4em; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; text-align: center; }
.app-card-body i.fs-1, .app-card-inactive .app-card-body i.fs-1 { margin-bottom: 0.75rem; transition: all 0.3s ease; }

@keyframes card-hover { 0% { transform: translateY(0); } 50% { transform: translateY(-7px); } 100% { transform: translateY(-5px); } }
.app-card:hover .app-card-inner { animation: card-hover 0.3s ease forwards; box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3); }
.app-card:hover .app-card-inner .bi { transform: scale(1.1); }
.app-card-inactive .app-card-inner { cursor: not-allowed; }
.app-card-inactive:hover .app-card-inner { box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1); opacity: 0.6 !important; }

/* =========================================
   5. UI BASE: BOTONES SOFT, BADGES Y MODALES
   ========================================= */
.btn-soft-primary { background-color: rgba(13, 110, 253, 0.15); color: #0d6efd; border: 1px solid rgba(13, 110, 253, 0.25); transition: all 0.2s ease; }
.btn-soft-primary:hover { background-color: rgba(13, 110, 253, 0.3); color: #0a58ca; transform: translateY(-1px); }

.btn-soft-secondary { background-color: rgba(108, 117, 125, 0.15); color: #adb5bd; border: 1px solid rgba(108, 117, 125, 0.25); transition: all 0.2s ease; }
.btn-soft-secondary:hover { background-color: rgba(108, 117, 125, 0.3); color: #d1d5db; transform: translateY(-1px); }

.btn-soft-success { background-color: rgba(25, 135, 84, 0.15); color: #198754; border: 1px solid rgba(25, 135, 84, 0.25); transition: all 0.2s ease; }
.btn-soft-success:hover { background-color: rgba(25, 135, 84, 0.3); color: #146c43; transform: translateY(-1px); }

.btn-soft-info { background-color: rgba(13, 202, 240, 0.15); color: #0dcaf0; border: 1px solid rgba(13, 202, 240, 0.25); transition: all 0.2s ease; }
.btn-soft-info:hover { background-color: rgba(13, 202, 240, 0.3); color: #3dd5f3; transform: translateY(-1px); }

.btn-soft-warning { background-color: rgba(255, 193, 7, 0.15); color: #ffc107; border: 1px solid rgba(255, 193, 7, 0.25); transition: all 0.2s ease; }
.btn-soft-warning:hover { background-color: rgba(255, 193, 7, 0.3); color: #ffd54f; transform: translateY(-1px); }

.btn-soft-danger { background-color: rgba(220, 53, 69, 0.15); color: #dc3545; border: 1px solid rgba(220, 53, 69, 0.25); transition: all 0.2s ease; }
.btn-soft-danger:hover { background-color: rgba(220, 53, 69, 0.3); color: #ff6b6b; transform: translateY(-1px); }

.btn-soft-orange { background-color: rgba(253, 126, 20, 0.15); color: #fd7e14; border: 1px solid rgba(253, 126, 20, 0.25); transition: all 0.2s ease; }
.btn-soft-orange:hover { background-color: rgba(253, 126, 20, 0.3); color: #e56b00; transform: translateY(-1px); }

.btn-soft-primary i, .btn-soft-secondary i, .btn-soft-success i, .btn-soft-info i, .btn-soft-warning i, .btn-soft-danger i, .btn-soft-orange i { opacity: 0.9; }

/* Badges Soft Globales */
.badge-soft-primary { background-color: rgba(13, 110, 253, 0.15); color: #0d6efd; border: 1px solid rgba(13, 110, 253, 0.25); }
.badge-soft-secondary { background-color: rgba(108, 117, 125, 0.15); color: #adb5bd; border: 1px solid rgba(108, 117, 125, 0.25); }
.badge-soft-success { background-color: rgba(25, 135, 84, 0.15); color: #198754; border: 1px solid rgba(25, 135, 84, 0.25); }
.badge-soft-info { background-color: rgba(13, 202, 240, 0.15); color: #0dcaf0; border: 1px solid rgba(13, 202, 240, 0.25); }
.badge-soft-warning { background-color: rgba(255, 193, 7, 0.15); color: #ffc107; border: 1px solid rgba(255, 193, 7, 0.25); }
.badge-soft-danger { background-color: rgba(220, 53, 69, 0.15); color: #dc3545; border: 1px solid rgba(220, 53, 69, 0.25); }

.actions-cell { white-space: nowrap; }

/* Perfil y Modales */
.profile-container { max-width: 800px; margin: 0 auto; }
.profile-header { background: linear-gradient(135deg, #212529 0%, #343a40 100%); border-radius: 10px; padding: 2rem; margin-bottom: 2rem; box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); }
.profile-avatar { width: 120px; height: 120px; background-color: #495057; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 3rem; color: #adb5bd; margin-bottom: 1rem; }
.profile-info-card { background-color: #2c3034; border: 1px solid #373b3e; border-radius: 8px; padding: 1.5rem; margin-bottom: 1rem; }
.profile-info-card h5 { color: #e9ecef; margin-bottom: 1rem; padding-bottom: 0.5rem; border-bottom: 1px solid #495057; }
.profile-info-item { display: flex; align-items: center; margin-bottom: 1rem; }
.profile-info-label { font-weight: 600; color: #adb5bd; min-width: 120px; margin-right: 1rem; }

.pdf-modal-body { padding: 0; height: 80vh; overflow: hidden; }
.pdf-viewer-iframe { width: 100%; height: 100%; border: none; background-color: #525659; }

#progressModal .modal-content { background-color: #1a1a1a !important; color: #ffffff !important; border: 1px solid #444; box-shadow: 0 0 20px rgba(0,0,0,0.7); }
#progressLog { background-color: #000000 !important; color: #00ff00 !important; border: 1px solid #333; font-family: 'Consolas', monospace; padding: 15px; border-radius: 4px; }

/* =========================================
   6. FORMULARIOS Y SELECTORES
   ========================================= */
select.form-control, select.form-select, input.form-control, textarea.form-control {
    background-color: var(--tramo-bg-dark) !important; border: 1px solid var(--tramo-border) !important; color: #ffffff !important; font-weight: 500;
}
select.form-control:focus, select.form-select:focus, input.form-control:focus, textarea.form-control:focus {
    border-color: var(--tramo-primary) !important; box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25) !important; background-color: var(--tramo-bg-dark) !important;
}

/* Campos en modo Vista */
.form-control-view { background-color: #f8f9fa; border: 1px solid #dee2e6; color: #212529; cursor: default; }
.view-field-content { background-color: rgba(255, 255, 255, 0.05); border: 1px solid #495057; color: #f8f9fa; padding: 0.7rem 1rem; border-radius: 6px; min-height: 40px; }
[data-bs-theme="light"] .view-field-content { background-color: #eaecf0; border-color: #ced4da; color: #1a1e21; }

/* Toggles interactivos */
.status-toggle-group, .priority-toggle-group, .elementos-toggle-group { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.elemento-toggle-btn { min-width: 120px; }
.btn-check:checked + .elemento-toggle-btn { background-color: #ff9800 !important; border-color: #ff9800 !important; color: white !important; }
.elementos-invalid { border: 1px solid #dc3545; padding: 5px; border-radius: 4px; }
.elementos-error-msg { color: #dc3545; font-size: 0.875em; display: none; margin-top: 0.25rem; }

/* Select2 Global */
.select2-container .select2-selection--single { height: 38px !important; }
.select2-container--bootstrap-5 .select2-selection { border-color: #dee2e6; }
.select2-container--bootstrap-5 .select2-selection--single { background-color: #1a1e23 !important; border-color: #495057 !important; color: #ffffff !important; }
.select2-container--bootstrap-5 .select2-selection--single .select2-selection__rendered { color: #ffffff !important; }
.select2-dropdown { background-color: #0d1117 !important; border-color: #495057 !important; }
.select2-container--bootstrap-5 .select2-results__option { background-color: #0d1117 !important; color: #f0f6fc !important; }
.select2-container--bootstrap-5 .select2-results__option--highlighted { background-color: #0969da !important; color: #ffffff !important; }

.tramo-item:focus-visible, #add-tramo-btn:focus-visible, .remove-btn:focus-visible { outline: 3px solid var(--tramo-primary); outline-offset: 2px; }

/* =========================================
   7. SUBIDA DE ARCHIVOS Y DROPZONES
   ========================================= */
.upload-group-container { background-color: #dee2e6; border-radius: 8px; padding: 20px; margin-bottom: 20px; border: 1px solid #adb5bd; box-shadow: 0 4px 6px rgba(0,0,0,0.1); }
.upload-group-label { color: #212529; font-weight: 800; text-transform: uppercase; font-size: 0.85rem; margin-bottom: 10px; display: block; letter-spacing: 0.5px; }

.drop-zone { border: 2px dashed #6c757d; border-radius: 6px; padding: 25px; text-align: center; cursor: pointer; transition: all 0.2s ease; background: #e9ecef; color: #333; }
.drop-zone:hover, .drop-zone.highlight { border-color: #0d6efd; background-color: rgba(13, 110, 253, 0.1); color: #0d6efd; box-shadow: inset 0 0 10px rgba(13, 110, 253, 0.1); }
.drop-zone i { transition: transform 0.3s ease; }
.drop-zone:hover i { transform: scale(1.1); color: #0d6efd !important; }

.drop-zone-view { border: 2px dashed #6c757d; border-radius: 6px; padding: 20px; text-align: center; background-color: #e9ecef; cursor: pointer; transition: all 0.2s ease; position: relative; }
.drop-zone-view:hover, .drop-zone-view.dragover { border-color: #0d6efd; background-color: #f8f9fa; }

/* Listas de archivos */
.file-list-item { font-size: 0.95em; background: #fff; border: 1px solid #ced4da; border-left: 4px solid #0d6efd; margin-top: 8px; padding: 10px 14px; border-radius: 4px; display: flex; justify-content: space-between; align-items: center; box-shadow: 0 2px 4px rgba(0,0,0,0.08); }
.existing-file-item { font-size: 0.95em; background: #f8f9fa; border: 1px solid #dee2e6; border-left: 4px solid #6c757d; margin-bottom: 8px; padding: 10px 14px; border-radius: 4px; display: flex; justify-content: space-between; align-items: center; }
.file-view-item { background: #fff; border: 1px solid #ced4da; border-left: 4px solid #198754; margin-bottom: 8px; padding: 8px 12px; border-radius: 4px; display: flex; justify-content: space-between; align-items: center; }

.remove-file, .delete-existing { color: #dc3545; cursor: pointer; font-size: 1.2em; font-weight: bold; padding: 5px; transition: all 0.2s; }
.remove-file:hover, .delete-existing:hover { transform: scale(1.1); }
.existing-file-item.to-delete { background-color: rgba(220, 53, 69, 0.1); border-color: #dc3545; text-decoration: line-through; opacity: 0.7; }

.upload-spinner { display: none; position: absolute; top: 0; left: 0; right: 0; bottom: 0; background: rgba(255,255,255,0.9); align-items: center; justify-content: center; border-radius: 6px; z-index: 10; flex-direction: column; }

/* Modo Oscuro Subidas */
[data-bs-theme="dark"] .upload-group-container { background-color: rgba(255, 255, 255, 0.02); border-color: #495057; }
[data-bs-theme="dark"] .drop-zone { background-color: #2b3035; border-color: #6c757d; color: #fff; }

/* =========================================
   8. MÓDULO: TRAMOS
   ========================================= */
.multiple-tramos-container { border: 2px solid var(--tramo-border); border-radius: 8px; padding: 1.25rem; background: linear-gradient(135deg, var(--tramo-bg-dark) 0%, var(--bs-body-bg) 100%); margin-bottom: 1.5rem; box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3); }
.selected-tramos { min-height: 80px; max-height: 250px; overflow-y: auto; border: 2px dashed var(--tramo-border); border-radius: 8px; padding: 1rem; background: var(--bs-body-bg); margin-top: 1rem; position: relative; transition: all 0.3s ease; }
.selected-tramos:hover { border-color: var(--tramo-primary); background: var(--tramo-bg-dark); }
.selected-tramos:empty::before { content: "No hay tramos seleccionados"; color: var(--tramo-border); font-style: italic; text-align: center; display: block; padding: 1.5rem; font-size: 0.95rem; }

.tramo-item { background: linear-gradient(135deg, rgba(13, 110, 253, 0.8) 0%, rgba(13, 110, 253, 0.6) 100%); border: 2px solid var(--tramo-primary); border-radius: 8px; padding: 0.75rem 1rem; margin: 0.5rem 0; display: flex; align-items: center; justify-content: space-between; font-size: 0.9rem; color: white; font-weight: 500; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4); transition: all 0.3s ease; animation: fadeInUp 0.4s ease; }
.tramo-item:hover { transform: translateY(-2px); box-shadow: 0 4px 16px rgba(13, 110, 253, 0.4); }

.tramo-info { font-weight: 600; color: white; display: flex; align-items: flex-start; flex-grow: 1; gap: 0.5rem; }
.tramo-info i { margin-top: 0.25rem; flex-shrink: 0; }
.tramo-info::before { content: "🛣️"; font-size: 1rem; }
.tramo-punto { font-size: 0.9rem; line-height: 1.4; }
.tramo-punto strong { font-weight: 600; margin-right: 0.25rem; }

.remove-btn { background: var(--tramo-danger); color: white; border: none; border-radius: 50%; width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: all 0.2s ease; font-size: 1.1rem; font-weight: bold; flex-shrink: 0; margin-left: 1rem; }
.remove-btn:hover { background: #b02a37; transform: scale(1.1); box-shadow: 0 2px 8px rgba(220, 53, 69, 0.5); }

.tramo-item.new-tramo { border-color: var(--tramo-success); background: linear-gradient(135deg, rgba(25, 135, 84, 0.8) 0%, rgba(25, 135, 84, 0.6) 100%); }
.tramo-item.new-tramo .tramo-info::before { content: "✨"; }
.tramo-item.duplicate { border-color: var(--tramo-warning); background: linear-gradient(135deg, rgba(255, 193, 7, 0.8) 0%, rgba(255, 193, 7, 0.6) 100%); color: #000; }
.tramo-item.duplicate .tramo-info { color: #000; }
.tramo-item.duplicate .tramo-info::before { content: "⚠️"; }

.tramos-list { background: var(--tramo-bg-light); border: 1px solid var(--tramo-border); border-radius: 8px; padding: 1rem; margin-top: 0.75rem; }
.tramos-list-header { font-weight: 600; color: var(--bs-body-color); margin-bottom: 0.75rem; border-bottom: 2px solid var(--tramo-border); padding-bottom: 0.5rem; font-size: 1rem; }

.tramos-list-compact .badge { font-size: 0.8rem; max-width: 280px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-right: 0.5rem; margin-bottom: 0.5rem; padding: 0.5rem 0.75rem; transition: all 0.3s ease; background: var(--tramo-primary) !important; border: 1px solid rgba(13, 110, 253, 0.5); cursor: help; }
.tramos-list-compact .badge:hover { max-width: none; white-space: normal; z-index: 1000; position: relative; transform: scale(1.05); }

.tramos-visual { background: linear-gradient(135deg, var(--tramo-bg-light) 0%, var(--tramo-bg-dark) 100%); border-radius: 12px; padding: 1.5rem; border: 2px solid var(--tramo-border); box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3); }

#add-tramo-btn, #load-current-tramos-btn { background: linear-gradient(135deg, var(--tramo-primary) 0%, #0a58ca 100%); border: 2px solid var(--tramo-primary); font-weight: 600; transition: all 0.3s ease; color: white; }
#add-tramo-btn:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(13, 110, 253, 0.4); }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(13, 110, 253, 0.7); } 70% { box-shadow: 0 0 0 15px rgba(13, 110, 253, 0); } 100% { box-shadow: 0 0 0 0 rgba(13, 110, 253, 0); } }

/* Selectores Custom Tramos */
#carretera, #pk_ini, #pk_fin, #municipio, select[name="carretera"], select[name="pk_ini"], select[name="pk_fin"], select[name="municipio"], .tramo-search-carretera {
    background-color: #1a1e23 !important; color: #ffffff !important; border: 2px solid var(--tramo-border) !important;
    font-size: 0.95rem !important; font-weight: 600 !important; padding: 0.5rem 0.75rem !important; padding-right: 40px !important;
    -webkit-appearance: none !important; appearance: none !important;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e") !important;
    background-repeat: no-repeat !important; background-position: right 12px center !important; background-size: 16px !important;
}

/* =========================================
   9. MÓDULO: FILTER BARS
   ========================================= */
.filter-bar { background: linear-gradient(135deg, rgba(15, 23, 42, 0.95) 0%, rgba(30, 41, 59, 0.95) 100%) !important; padding: 0.6rem 0.8rem !important; border-radius: 8px !important; border: 1px solid rgba(255, 255, 255, 0.08) !important; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3) !important; margin-bottom: 0.8rem !important; min-height: 52px !important; }
.filter-bar-title { min-width: 120px; flex-shrink: 0; }
.filter-bar-title h6 { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.5px; white-space: nowrap; color: rgba(255, 255, 255, 0.9); margin-bottom: 0; }

.filter-buttons-group { gap: 0.4rem !important; }
.filter-btn-compact { min-width: 110px; height: 32px !important; padding: 0.4rem 0.7rem !important; border: 2px solid !important; border-radius: 6px !important; text-decoration: none; transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); display: inline-flex; align-items: center; justify-content: center; white-space: nowrap; font-weight: 600; font-size: 0.75rem; }
.filter-btn-inner { display: flex; align-items: center; justify-content: center; gap: 0.4rem; width: 100%; }
.filter-icon { font-size: 0.85rem; flex-shrink: 0; }
.filter-text { flex-grow: 1; text-align: center; font-size: 0.7rem; }
.filter-count { font-size: 0.65rem; font-weight: 700; padding: 0.15rem 0.4rem; border-radius: 8px; min-width: 22px; text-align: center; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; line-height: 1; }

.filter-btn-compact.filter-active { opacity: 1 !important; box-shadow: 0 3px 10px rgba(0,0,0,0.4); transform: translateY(-1px); }
.filter-btn-primary.filter-active { background: linear-gradient(135deg, #0d6efd 0%, #0a58ca 100%) !important; color: white !important; border-color: #0d6efd !important; }
.filter-btn-danger.filter-active { background: linear-gradient(135deg, #dc3545 0%, #b02a37 100%) !important; color: white !important; border-color: #dc3545 !important; }
.filter-btn-warning.filter-active { background: linear-gradient(135deg, #ffc107 0%, #d39e00 100%) !important; color: #000 !important; border-color: #ffc107 !important; }
.filter-btn-success.filter-active { background: linear-gradient(135deg, #198754 0%, #13653f 100%) !important; color: white !important; border-color: #198754 !important; }
.filter-btn-compact.filter-active .filter-count { background: rgba(255, 255, 255, 0.95) !important; color: #000 !important; box-shadow: 0 1px 3px rgba(0,0,0,0.2); }

.filter-btn-compact.filter-inactive { opacity: 0.6 !important; background: rgba(71, 85, 105, 0.3) !important; color: rgba(255, 255, 255, 0.7) !important; border-color: rgba(108, 117, 125, 0.4) !important; }
.filter-btn-compact.filter-inactive .filter-count { background: rgba(148, 163, 184, 0.2) !important; color: rgba(255, 255, 255, 0.6) !important; }
.filter-btn-compact.filter-inactive:hover { opacity: 0.8 !important; transform: translateY(-1px); background: rgba(100, 116, 139, 0.4) !important; }

/* Ajuste Select2 en Filter Bar */
.filter-bar .select2-container .select2-selection--single { height: 31px !important; padding-top: 0; padding-bottom: 0; display: flex; align-items: center; font-size: 0.875rem; }
[data-bs-theme="dark"] .filter-bar .select2-container--bootstrap-5 .select2-selection { border-color: #495057; background-color: #1a1e23; color: #fff; }

/* =========================================
   10. MÓDULO: AUTENTICACIÓN (LOGIN)
   ========================================= */
.form-signin { width: 100%; max-width: 400px; padding: 15px; margin: auto; }
.form-signin .card { background-color: #2c3034; border: 1px solid #373b3e; border-radius: 10px; box-shadow: 0 10px 20px rgba(0,0,0,0.3); }
.form-signin .card-header { text-align: center; border-bottom: 1px solid #373b3e; padding: 20px; }
.form-signin .card-body { padding: 30px; }

/* Espaciado para que los campos no estén pegados */
.form-signin .form-floating { margin-bottom: 1.25rem; }
.form-signin .btn-primary { margin-top: 15px; width: 100%; padding: 12px; font-weight: 600; font-size: 1.1rem; }

.login-app-title { display: flex; align-items: center; justify-content: center; gap: 10px; font-size: 24px; margin-bottom: 0; }
.login-app-logo { height: 32px; width: auto; }

/* =========================================
   11. MÓDULO: ADMIN Y LOGS
   ========================================= */
.table thead.sticky-top { position: sticky; top: 0; z-index: 10; }
.activity-table-container { overflow-x: auto; }
.activity-table { font-size: 0.9rem; min-width: 1100px; }
.activity-table thead th { background-color: #212529; border-bottom: 2px solid #495057; font-weight: 600; padding: 0.75rem 0.5rem; vertical-align: middle; }
.activity-row { transition: background-color 0.2s ease; }
.activity-row:hover { background-color: rgba(255, 255, 255, 0.05); }
.activity-row td { padding: 0.75rem 0.5rem; vertical-align: middle; border-bottom: 1px solid #495057; }

.description-col { max-width: 400px; word-wrap: break-word; }
.details-row pre { font-size: 0.75rem; line-height: 1.4; max-height: 200px; overflow-y: auto; }
.table-hover-pointer tbody tr:hover { background-color: rgba(255, 255, 255, 0.05); cursor: pointer; }

@keyframes fadeInRow { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.new-row { animation: fadeInRow 0.3s ease-in-out; }

/* Tablas Generales (Soporte dark custom si no se usa bootstrap nativo bien) */
.table-dark { --bs-table-bg: var(--tramo-bg-dark); --bs-table-striped-bg: var(--tramo-bg-light); }
.table th { background-color: var(--tramo-bg-light) !important; font-weight: 600; border-top: none; color: var(--bs-body-color) !important; font-size: 0.9rem; border-bottom: 2px solid var(--tramo-primary); }
.table td { vertical-align: middle; font-size: 0.9rem; color: var(--bs-body-color) !important; background-color: var(--tramo-bg-dark) !important; }

/* =========================================
   12. MÓDULO: RRHH (RECURSOS HUMANOS)
   ========================================= */
.table-vacations { table-layout: fixed; width: 100%; }
.table-vacations .col-name { width: 220px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; }
.table-vacations .col-actions { width: 60px; text-align: center; vertical-align: middle; }
.table-vacations .col-num { text-align: center; vertical-align: middle; }
.table-vacations .header-multiline { vertical-align: middle !important; line-height: 1.2; font-size: 0.8rem; }

/* =========================================
   13. MÓDULO: REPORTES DIARIOS Y CALENDARIOS
   ========================================= */
.drop-zone-daily {
    min-height: 60px !important; padding: 5px 5px !important; border: 2px dashed #6c757d; border-radius: 0.5rem;
    transition: all 0.3s ease; cursor: pointer; background-color: rgba(0, 0, 0, 0.02); position: relative; overflow: hidden;
}
.drop-zone-daily:hover { border-color: #0d6efd; background-color: rgba(13, 110, 253, 0.05); }
.drop-zone-daily i { transition: transform 0.3s ease; }
.drop-zone-daily:hover i { transform: scale(1.1); color: #0d6efd !important; }

.file-item-success { background-color: rgba(25, 135, 84, 0.1) !important; border: 1px solid rgba(25, 135, 84, 0.2) !important; border-radius: 4px; }

/* Calendario Flatpickr Customizaciones */
.flatpickr-calendar { font-family: inherit; border: 1px solid #dee2e6; box-shadow: 0 4px 12px rgba(0,0,0,0.1); }
.flatpickr-calendar.inline { margin: 0 auto; box-shadow: none; background: #f8f9fa; width: 100%; max-width: 350px; }
.flatpickr-current-month { color: #000000 !important; font-weight: 700; padding-top: 10px; }
.flatpickr-current-month .flatpickr-monthDropdown-months, .flatpickr-current-month input.cur-year { color: #000000 !important; font-weight: 800; }
span.flatpickr-weekday { color: #212529 !important; font-weight: 600; }
.flatpickr-day { color: #212529; }
.flatpickr-day.today { border-color: #0d6efd !important; font-weight: 800; color: #0d6efd; }
.flatpickr-day.selected { background: #0d6efd !important; border-color: #0d6efd !important; color: #fff !important; }

/* Modo Oscuro Reportes Diarios */
[data-bs-theme="dark"] .drop-zone-daily { background-color: rgba(255, 255, 255, 0.05); border-color: #495057; }
[data-bs-theme="dark"] .flatpickr-calendar { background: #2b3035; border-color: #495057; }
[data-bs-theme="dark"] .flatpickr-calendar.inline { background: #2b3035; }
[data-bs-theme="dark"] .flatpickr-day { color: #e9ecef; }
[data-bs-theme="dark"] .flatpickr-day:hover { background: #373b3e; }
[data-bs-theme="dark"] .flatpickr-current-month, [data-bs-theme="dark"] .flatpickr-current-month .flatpickr-monthDropdown-months, [data-bs-theme="dark"] .flatpickr-current-month input.cur-year, [data-bs-theme="dark"] span.flatpickr-weekday { color: #e9ecef !important; }

/* Tabla Destinatarios */
.recipient-list { background-color: #fff !important; border: 1px solid #dee2e6; color: #212529 !important; border-radius: 6px; overflow: hidden; }
.recipient-row { display: flex; align-items: center; padding: 8px 15px; border-bottom: 1px solid #f0f0f0; cursor: pointer; transition: background 0.2s; }
.recipient-row .check-wrapper {
    margin-right: 15px; /* Ajusta este valor según el espacio que desees */
    display: flex;
    align-items: center;
}
.recipient-row:hover { background-color: rgba(0,0,0,0.02); }
.recipient-grid-label { display: grid; grid-template-columns: 260px 220px 1fr; gap: 15px; align-items: center; width: 100%; margin-bottom: 0; cursor: pointer; }
.col-cargo { font-weight: 700; color: #212529; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 0.95rem; }
.col-nombre { color: #495057; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 0.95rem; }
.col-email { font-family: 'Consolas', 'Monaco', monospace; color: #6c757d; font-size: 0.9em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

[data-bs-theme="dark"] .recipient-list { background-color: #2b3035 !important; border-color: #495057 !important; color: #e9ecef !important; }
[data-bs-theme="dark"] .recipient-row { border-bottom-color: #495057; }
[data-bs-theme="dark"] .recipient-row:hover { background-color: rgba(255,255,255,0.05); }
[data-bs-theme="dark"] .col-cargo { color: #e9ecef; }
[data-bs-theme="dark"] .col-nombre { color: #adb5bd; }
[data-bs-theme="dark"] .col-email { color: #6c757d; }

/* =========================================
   14. MÓDULO: ROLES Y MATRIZ DE PERMISOS
   ========================================= */
.matrix-container { max-height: 75vh; overflow-y: auto; overflow-x: hidden !important; position: relative; border-radius: 6px; background: #212529; border: 1px solid #495057; }
.matrix-table { table-layout: fixed; width: 100%; border-collapse: separate; border-spacing: 0; }
.matrix-table td.matrix-bg, .matrix-table .sticky-col.matrix-bg { background-color: #212529 !important; color: #f8f9fa !important; border-color: #343a40 !important; }
.matrix-table td.matrix-group-header, .matrix-table .sticky-col.matrix-group-header { background-color: #1a1e23 !important; border-color: #495057 !important; }

.matrix-container .sticky-col { position: sticky; left: 0; z-index: 10; width: 250px !important; min-width: 250px !important; max-width: 250px !important; box-shadow: 2px 0 5px rgba(0,0,0,0.2); }
.matrix-table thead th { position: sticky; top: 0; z-index: 20; background-color: #1a1e23 !important; color: white; border-bottom: 2px solid #495057 !important; }
.matrix-table thead th.first-col { z-index: 30; left: 0; }
.matrix-table .section-divider td { position: sticky; top: 86px; z-index: 15; }
.matrix-table .compact-role-col { width: 85px !important; min-width: 85px !important; padding: 0.5rem 0.2rem !important; }

.matrix-text-muted { color: #adb5bd !important; }
.matrix-code { color: #6ea8fe !important; background-color: rgba(110, 168, 254, 0.1) !important; padding: 2px 5px; border-radius: 4px; border: 1px solid rgba(110, 168, 254, 0.2); }

.matrix-table tbody tr:hover td.matrix-bg, .matrix-table tbody tr:hover td.matrix-group-header, .matrix-table tbody tr:hover .sticky-col { background-color: #343a40 !important; transition: background-color 0.15s ease-in-out; }
.matrix-table tbody tr:hover .matrix-text-muted { color: #e9ecef !important; }

.matrix-table .form-check-input { background-color: #495057; border-color: #6c757d; }
.matrix-table .soft-switch:checked { background-color: #6ea8fe !important; border-color: #6ea8fe !important; }
.matrix-table .soft-check:checked { background-color: #5cb85c !important; border-color: #5cb85c !important; transform: scale(1.15); transition: transform 0.1s; }

.btn-matrix-toggle { background-color: rgba(255, 255, 255, 0.1); color: #e9ecef; border: 1px solid rgba(255, 255, 255, 0.2); font-size: 0.65rem; padding: 2px 5px; transition: all 0.2s; margin-top: 4px; }
.btn-matrix-toggle:hover { background-color: rgba(255, 255, 255, 0.2); border-color: #ffffff; color: #ffffff; }

/* =========================================
   15. MÓDULO: TAREAS E INCIDENCIAS
   ========================================= */
.task-card-compact { transition: all 0.2s ease; border-left: 4px solid transparent; }
.task-card-compact:hover { transform: translateY(-2px); box-shadow: 0 4px 15px rgba(0,0,0,0.1); background-color: #f8f9fa; }
.task-card-compact .card-body { padding: 0.5rem 0.75rem !important; }
[data-bs-theme="dark"] .task-card-compact:hover { background-color: #373b3e; }

.btn-action-vertical {
    width: 34px; height: 34px; padding: 0; display: inline-flex; align-items: center; justify-content: center;
    border-radius: 6px; transition: all 0.2s ease; border: none; font-size: 1.1rem;
}
.btn-action-vertical:hover { transform: scale(1.15); box-shadow: 0 2px 5px rgba(0,0,0,0.15); }

.elemento-badge {
    display: inline-flex; align-items: center; gap: 0.25rem; padding: 0.35rem 0.65rem;
    background: linear-gradient(135deg, rgba(255, 152, 0, 0.15) 0%, rgba(255, 152, 0, 0.08) 100%);
    border: 1px solid rgba(255, 152, 0, 0.4); border-radius: 0.25rem; font-size: 0.75rem; font-weight: 600; color: #ff9800; white-space: nowrap; text-transform: uppercase;
}
.tramo-detail-badge {
    display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.35rem 0.65rem;
    background: linear-gradient(135deg, rgba(13, 110, 253, 0.1) 0%, rgba(13, 110, 253, 0.05) 100%);
    border: 1px solid rgba(13, 110, 253, 0.3); border-radius: 0.375rem; font-size: 0.8rem; color: #adb5bd; white-space: nowrap;
}
.status-badge { display: inline-block; padding: 0.5rem 1rem; border-radius: 4px; font-weight: 600; text-align: center; min-width: 120px; border: 1px solid transparent; }

.tramos-card { background-color: #2b3035 !important; border: 1px solid #495057 !important; color: #fff; }
.tramos-card .card-header { background-color: #1f2327 !important; border-bottom: 1px solid #495057 !important; }
.tramos-card .tramo-item { background: linear-gradient(135deg, #4a5568 0%, #2d3748 100%); border-radius: 6px; padding: 0.5rem 0.75rem; margin-bottom: 0.5rem; border-color: transparent; }

.comment-bubble { background-color: rgba(255, 255, 255, 0.03); border: 1px solid #495057; border-radius: 8px; padding: 12px; margin-bottom: 12px; }
[data-bs-theme="light"] .comment-bubble { background-color: #f1f3f5; border-color: #dee2e6; }

.attachment-wrapper-mini { transition: transform 0.2s ease; }
.attachment-wrapper-mini:hover { transform: scale(1.9); z-index: 10; }

.email-status-card { border-radius: 8px; border-left: 5px solid #6c757d; }
.status-pending { border-left-color: #ffc107; background-color: #fff9db; color: #000000; }
.status-sent { border-left-color: #198754; background-color: #d1e7dd; color: #0f5132; }
.status-error { border-left-color: #dc3545; background-color: #f8d7da; color: #842029; }

.card-header-soft { background-color: rgba(0, 0, 0, 0.03); border-bottom: 1px solid rgba(0, 0, 0, 0.125); }
[data-bs-theme="dark"] .card-header-soft { background-color: rgba(255, 255, 255, 0.03); border-bottom: 1px solid rgba(255, 255, 255, 0.1); }

/* Contenedor de miniaturas para adjuntos universal */
.thumbnail-container {
    height: 120px !important;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background-color: #f8f9fa;
    border-bottom: 1px solid rgba(0,0,0,0.1);
}

.thumbnail-icon {
    font-size: 3.5rem; /* Tamaño uniforme para los iconos de PDF, Word, etc. */
}

/* Modo oscuro para miniaturas */
[data-bs-theme="dark"] .thumbnail-container {
    background-color: #212529;
    border-bottom: 1px solid #495057;
}

/* =========================================
   16. MEDIA QUERIES (RESPONSIVE)
   ========================================= */
@media (max-width: 1200px) {
    .table-vacations .col-name { width: 180px; }
    .activity-table { font-size: 0.85rem; }
    .description-col { max-width: 300px; }
}

@media (max-width: 991.98px) {
    :root { --sidebar-width: 100%; --sidebar-min-width: 0; --app-card-height: 110px; }
    
    .app-title { font-size: 1.5rem; padding: 3px 10px; }
    .navbar-brand { margin-left: 45px; }
    .navbar-brand img { height: 30px; }
    
    #sidebar {
        transform: translateX(-100%); width: 80%; max-width: 300px;
        position: fixed; top: 75px; left: 0; height: calc(100vh - 75px); z-index: 1030; box-shadow: 0 0 10px rgba(0,0,0,0.2);
    }
    #sidebar.active { transform: translateX(0); }
    
    .main-content { margin-left: 0 !important; width: 100% !important; padding: 0 10px; }
    
    .app-card-body { padding: 0.75rem; }
    .app-title-text { font-size: 0.85rem; }
    .app-card-body i.fs-1 { font-size: 1.5rem !important; margin-bottom: 0.5rem; }
    .row-app-cards .col-md-3, .row-app-cards .col-sm-6 { margin-bottom: 0.8rem; }
    
    .multiple-tramos-container { padding: 1rem; margin-bottom: 1rem; }
    .selected-tramos { min-height: 100px; padding: 0.75rem; }
    .tramos-visual { padding: 1rem; }
    
    #carretera, #pk_ini, #pk_fin, #municipio, select[name="carretera"], select[name="pk_ini"], select[name="pk_fin"], select[name="municipio"], .tramo-search-carretera { 
        font-size: 1rem !important; padding: 0.75rem !important; min-height: 48px !important; 
    }
    
    .profile-header { padding: 1.5rem; text-align: center; }
    .profile-avatar { margin: 0 auto 1rem; }
    .profile-info-item { flex-direction: column; align-items: flex-start; }
    .profile-info-label { margin-bottom: 0.25rem; }
    
    .table-vacations .col-name { width: 140px; }
    .table-vacations .header-multiline { font-size: 0.7rem; }
    
    .filter-bar-title { min-width: 110px; }
    .filter-btn-compact { min-width: 100px; height: 30px !important; font-size: 0.72rem; }
}

@media (max-width: 768px) {
    .tramo-item { flex-direction: column; align-items: flex-start; gap: 0.5rem; padding: 1rem; }
    .tramo-info { width: 100%; }
    .remove-btn { align-self: flex-end; margin-top: 0.5rem; margin-left: 0; }
    .tramo-punto { font-size: 0.85rem; }
    
    .tramos-list-compact .badge { font-size: 0.7rem; max-width: 180px; display: block; margin-bottom: 0.5rem; padding: 0.4rem 0.6rem; }
    
    .filter-bar { padding: 0.5rem 0.7rem !important; margin-bottom: 0.7rem !important; }
    .filter-bar > .d-flex { flex-direction: column !important; align-items: flex-start !important; }
    .filter-bar-title { width: 100%; text-align: center; margin-bottom: 0.4rem; border-bottom: 1px solid #dee2e6; padding-bottom: 0.5rem; }
    .filter-buttons-group { width: 100%; justify-content: center; flex-direction: column !important; align-items: stretch !important; }
    .filter-btn-compact { min-width: 90px; height: 28px !important; font-size: 0.7rem; padding: 0.35rem 0.6rem !important; }
    
    .activity-table { font-size: 0.8rem; }
    .activity-table thead th, .activity-row td { padding: 0.5rem 0.3rem; }
    .description-col { max-width: 200px; }
    
    .recipient-grid-label { grid-template-columns: 1fr; gap: 2px; }
    .col-nombre { font-size: 0.9em; color: #6c757d; }
    .col-email { font-size: 0.85em; }
    
    .task-card-compact .row { flex-direction: column; }
    .task-card-compact .col-5, .task-card-compact .col, .task-card-compact .col-auto { width: 100%; border: none !important; padding-bottom: 10px; }
    .task-card-compact .col-auto { flex-direction: row !important; justify-content: flex-end !important; }
    .task-card-compact .col-auto .d-flex { flex-direction: row !important; width: auto !important; }
}

@media (max-width: 576px) {
    .logo-left { height: 40px !important; max-width: 45% !important; }
    .logo-right { height: 80px !important; max-width: 45% !important; }
    .logo-spacer { height: 63px !important; }
    
    .tramo-item { padding: 0.75rem; font-size: 0.75rem; }
    .tramos-list-compact .badge { font-size: 0.65rem; max-width: 140px; }
    .multiple-tramos-container { padding: 0.75rem; }
    #add-tramo-btn, #load-current-tramos-btn { font-size: 0.85rem; padding: 0.5rem 1rem; }
    
    .filter-btn-compact { flex: 1 1 calc(50% - 0.2rem); min-width: 0; }
    
    /* NUEVA REGLA: Ocultar las barras de filtros en smartphones */
    .filter-bar { display: none !important; }
}

@media (prefers-contrast: high) {
    #carretera, select { background-color: #000000 !important; border: 3px solid #ffffff !important; }
}

@media (prefers-color-scheme: dark) {
    select, option { background-color: #0d1117 !important; color: #f0f6fc !important; }
}

@media print {
    .multiple-tramos-container, .tramos-visual, .tramos-list, .tramo-item, .tramos-card { background: white !important; border: 2px solid #333 !important; color: #333 !important; }
    .remove-btn, #add-tramo-btn, #load-current-tramos-btn { display: none !important; }
    .table { color: #333 !important; }
}

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; animation: none !important; }
}

/* Hacer que los textos del sidebar se pongan en negrita solo al pasar el ratón */
#sidebar .list-group-item .text-item {
    font-weight: normal;
    transition: font-weight 0.2s ease-in-out; /* Suaviza la transición */
}

#sidebar .list-group-item:hover .text-item {
    font-weight: bold;
}