/* ==========================================================================
   RUTAS DE LECHE - CLEAN LIGHT EXECUTIVE SAAS THEME
   Aesthetic: Bright, Clean White & Slate, Friendly Modern SaaS UI
   ========================================================================== */

:root {
    /* Superficies y Fondos Base (Clean White & Slate) */
    --bg-main: #f8fafc;
    --bg-surface: #ffffff;
    --bg-surface-elevated: #ffffff;
    --bg-card: #ffffff;
    --bg-card-hover: #f8fafc;
    --bg-input: #ffffff;
    --bg-hover: #f1f5f9;

    /* Bordes y Resplandores */
    --border-color: #e2e8f0;
    --border-subtle: #f1f5f9;
    --border-focus: #4f46e5;
    --border-glow: rgba(79, 70, 229, 0.25);

    /* Acentos Principales (Vibrantes y Amigables) */
    --primary: #4f46e5;
    --primary-gradient: linear-gradient(135deg, #4f46e5 0%, #3b82f6 50%, #06b6d4 100%);
    --primary-hover: #4338ca;
    --primary-soft: #eef2ff;

    --success: #059669;
    --success-gradient: linear-gradient(135deg, #059669 0%, #10b981 100%);
    --success-soft: #ecfdf5;

    --warning: #d97706;
    --warning-gradient: linear-gradient(135deg, #d97706 0%, #f59e0b 100%);
    --warning-soft: #fffbeb;

    --danger: #e11d48;
    --danger-gradient: linear-gradient(135deg, #e11d48 0%, #f43f5e 100%);
    --danger-soft: #fff1f2;

    --purple: #7c3aed;
    --purple-gradient: linear-gradient(135deg, #7c3aed 0%, #8b5cf6 100%);
    --purple-soft: #f5f3ff;

    --cyan: #0284c7;
    --cyan-gradient: linear-gradient(135deg, #0284c7 0%, #0ea5e9 100%);
    --cyan-soft: #f0f9ff;

    /* Tipografía Nítida y Ultra-Legible */
    --text-main: #0f172a;
    --text-body: #334155;
    --text-muted: #64748b;
    --text-dim: #94a3b8;
    --font-heading: 'Outfit', 'Plus Jakarta Sans', sans-serif;
    --font-body: 'Inter', sans-serif;

    /* Bordes y Sombras */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-pill: 9999px;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.03);
    --shadow-card: 0 4px 20px -2px rgba(15, 23, 42, 0.06), 0 2px 6px -1px rgba(15, 23, 42, 0.04);
    --shadow-elevated: 0 12px 30px -4px rgba(15, 23, 42, 0.1), 0 4px 10px -2px rgba(15, 23, 42, 0.05);
}

/* RESET GLOBAL */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-body);
    background-color: var(--bg-main);
    background-image: 
        radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.06) 0px, transparent 50%),
        radial-gradient(at 100% 0%, rgba(14, 165, 233, 0.05) 0px, transparent 50%),
        radial-gradient(at 50% 100%, rgba(16, 185, 129, 0.04) 0px, transparent 50%);
    background-attachment: fixed;
    color: var(--text-body);
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ==========================================================================
   TOPBAR SUPERIOR CLARA Y ELEGANTE
   ========================================================================== */
.top-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 28px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
}

.brand-logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-icon {
    font-size: 22px;
    color: #4f46e5;
    background: #eef2ff;
    padding: 10px;
    border-radius: var(--radius-md);
    border: 1px solid #c7d2fe;
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.12);
}

.brand-title {
    font-family: var(--font-heading);
    font-size: 19px;
    font-weight: 800;
    letter-spacing: 0.5px;
    color: #0f172a;
    display: block;
}

.nav-center {
    display: flex;
    align-items: center;
    gap: 16px;
}

.bcv-widget, .ciclo-widget {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #f8fafc;
    padding: 7px 16px;
    border-radius: var(--radius-pill);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.bcv-widget:hover, .ciclo-widget:hover {
    border-color: #c7d2fe;
    box-shadow: 0 2px 12px rgba(79, 70, 229, 0.12);
    transform: translateY(-1px);
}

.bcv-icon {
    color: #d97706;
    font-size: 16px;
    display: flex;
    align-items: center;
}

.bcv-info, .ciclo-widget > div {
    display: flex;
    flex-direction: column;
}

.bcv-label, .ciclo-label {
    font-size: 9.5px;
    color: #64748b;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.bcv-value {
    font-size: 14.5px;
    font-weight: 800;
    color: #b45309;
}

.ciclo-icon {
    color: #0284c7;
    font-size: 16px;
}

.ciclo-value {
    font-size: 13px;
    font-weight: 700;
    color: #2563eb;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--primary-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 14px;
    color: #ffffff;
    box-shadow: 0 2px 10px rgba(79, 70, 229, 0.3);
}

.user-details {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-size: 13.5px;
    font-weight: 700;
    color: #0f172a;
}

.user-role {
    font-size: 10px;
    padding: 2px 7px;
    border-radius: var(--radius-pill);
    background: #eef2ff;
    color: #4338ca;
    font-weight: 700;
    letter-spacing: 0.04em;
    display: inline-block;
    width: fit-content;
    border: 1px solid #c7d2fe;
}

/* ==========================================================================
   LAYOUT PRINCIPAL Y SIDEBAR LATERAL CLARO
   ========================================================================== */
.main-layout {
    display: flex;
    flex-direction: row;
    height: calc(100vh - 65px);
    overflow: hidden;
    width: 100%;
}

.sidebar {
    width: 260px;
    min-width: 260px;
    max-width: 260px;
    flex-shrink: 0;
    background: #ffffff;
    border-right: 1px solid var(--border-color);
    padding: 16px 12px 12px 12px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.02);
    height: 100%;
    overflow-y: auto;
    z-index: 90;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}

.sidebar::-webkit-scrollbar {
    width: 5px;
}

.sidebar::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 6px;
}

/* GRUPOS ACORDEÓN POR HOVER */
.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.nav-accordion-group {
    border-radius: 8px;
    transition: all 0.35s cubic-bezier(0.25, 1, 0.5, 1);
}

/* Cabecera de la Sección (Siempre Visible) */
.nav-accordion-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 12px;
    border-radius: 8px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    cursor: pointer;
    user-select: none;
    transition: background 0.35s ease, border-color 0.35s ease, box-shadow 0.35s ease, color 0.35s ease;
}

.nav-accordion-header .header-main {
    display: flex;
    align-items: center;
    gap: 9px;
}

.nav-accordion-header .group-title {
    font-size: 11.5px;
    font-weight: 700;
    color: #475569;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    transition: color 0.35s ease;
}

.nav-accordion-header .group-icon {
    font-size: 13px;
    width: 16px;
    text-align: center;
    transition: transform 0.35s ease;
}

.nav-accordion-header .group-chevron {
    font-size: 10px;
    color: #94a3b8;
    transition: transform 0.42s cubic-bezier(0.25, 1, 0.5, 1), color 0.35s ease;
}

/* Colores de iconos temáticos */
.icon-op  { color: #4f46e5; }
.icon-cat { color: #16a34a; }
.icon-fin { color: #9333ea; }
.icon-ade { color: #ea580c; }
.icon-rep { color: #0284c7; }
.icon-sis { color: #475569; }

/* HOVER Y ESTADO ACTIVO EN CABECERA */
.nav-accordion-group:hover .nav-accordion-header {
    background: #eef2ff;
    border-color: #c7d2fe;
}

.nav-accordion-group:hover .group-title {
    color: #312e81;
}

.nav-accordion-group.has-active .nav-accordion-header {
    background: #f1f5f9;
    border-left: 3.5px solid #4f46e5;
    border-color: #cbd5e1 #cbd5e1 #cbd5e1 #4f46e5;
}

.nav-accordion-group.has-active .group-title {
    color: #0f172a;
    font-weight: 800;
}

/* DESPLIEGUE DEL ACORDEÓN POR HOVER O CLIC ACTIVO (MÁS SUAVE Y ELEGANTE) */
.nav-accordion-body {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows 0.42s cubic-bezier(0.25, 1, 0.5, 1);
}

.nav-accordion-group:hover .nav-accordion-body,
.nav-accordion-group.has-active .nav-accordion-body,
.nav-accordion-group.open .nav-accordion-body {
    grid-template-rows: 1fr;
}

.nav-accordion-group:hover .group-chevron,
.nav-accordion-group.has-active .group-chevron,
.nav-accordion-group.open .group-chevron {
    transform: rotate(90deg);
    color: #4f46e5;
}

.accordion-subitems {
    overflow: hidden;
    padding: 6px 4px 6px 12px;
    margin-left: 10px;
    border-left: 2px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    gap: 3px;
    opacity: 0;
    transform: translateY(-6px);
    transition: opacity 0.38s ease 0.05s, transform 0.42s cubic-bezier(0.25, 1, 0.5, 1);
}

.nav-accordion-group:hover .accordion-subitems,
.nav-accordion-group.has-active .accordion-subitems,
.nav-accordion-group.open .accordion-subitems {
    opacity: 1;
    transform: translateY(0);
}

/* SUB-ITEMS DE NAVEGACIÓN */
.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    color: #64748b;
    text-decoration: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.28s cubic-bezier(0.25, 1, 0.5, 1);
    border-left: 3px solid transparent;
}

.nav-item i {
    font-size: 14px;
    width: 18px;
    text-align: center;
    color: #94a3b8;
    transition: transform 0.28s ease, color 0.28s ease;
}

.nav-item span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nav-item:hover {
    background: #f8fafc;
    color: #0f172a;
    transform: translateX(4px);
}

.nav-item:hover i {
    color: #4f46e5;
}

/* SUB-ITEM ACTIVO: INDICA DÓNDE ESTÁ EL USUARIO */
.nav-item.active {
    background: #eef2ff !important;
    color: #4338ca !important;
    border-left: 3px solid #4f46e5 !important;
    font-weight: 700 !important;
    box-shadow: 0 1px 3px rgba(79, 70, 229, 0.08);
}

.nav-item.active i {
    color: #4f46e5 !important;
    transform: scale(1.08);
}

.sidebar-footer {
    padding: 12px 6px 0;
    border-top: 1px solid var(--border-color);
}

.connection-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #64748b;
    font-weight: 500;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.status-dot.online {
    background: #10b981;
    box-shadow: 0 0 6px #10b981;
}

.status-dot.offline {
    background: #ef4444;
}

/* ==========================================================================
   ÁREA DE CONTENIDO PRINCIPAL
   ========================================================================== */
.content-area {
    flex: 1;
    min-width: 0;
    height: 100%;
    overflow-y: auto;
    padding: 24px 32px;
    background: transparent;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

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

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

.view-title {
    font-family: var(--font-heading);
    font-size: 24px;
    font-weight: 800;
    color: #0f172a;
    letter-spacing: -0.3px;
}

.view-subtitle {
    font-size: 13.5px;
    color: #64748b;
    margin-top: 4px;
}

/* ==========================================================================
   KPI CARDS MODERNAS, BRILLANTES Y AMIGABLES
   ========================================================================== */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 18px;
    margin-bottom: 24px;
}

.kpi-card {
    padding: 20px 22px;
    border-radius: var(--radius-lg);
    background: #ffffff;
    border: 1px solid var(--border-color);
    display: flex;
    align-items: flex-start;
    gap: 16px;
    box-shadow: var(--shadow-card);
    transition: all 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

.kpi-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-elevated);
}

.kpi-icon-wrap {
    font-size: 22px;
    padding: 14px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
}

.glass-blue { border-color: #c7d2fe; }
.glass-blue .kpi-icon-wrap { color: #4338ca; background: #eef2ff; border: 1px solid #c7d2fe; }

.glass-emerald { border-color: #a7f3d0; }
.glass-emerald .kpi-icon-wrap { color: #059669; background: #ecfdf5; border: 1px solid #a7f3d0; }

.glass-amber { border-color: #fde68a; }
.glass-amber .kpi-icon-wrap { color: #d97706; background: #fffbeb; border: 1px solid #fde68a; }

.glass-purple { border-color: #ddd6fe; }
.glass-purple .kpi-icon-wrap { color: #7c3aed; background: #f5f3ff; border: 1px solid #ddd6fe; }

.kpi-title {
    font-size: 11.5px;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.kpi-value {
    font-family: var(--font-heading);
    font-size: 26px;
    font-weight: 800;
    color: #0f172a;
    margin: 4px 0;
    letter-spacing: -0.5px;
}

.kpi-value small {
    font-size: 14px;
    font-weight: 600;
    color: #64748b;
}

.kpi-foot {
    font-size: 12px;
    color: #64748b;
    display: inline-block;
    margin-top: 2px;
    font-weight: 500;
}

/* ==========================================================================
   BARRA DE CONTROLES DASHBOARD Y TARJETAS
   ========================================================================== */
.dashboard-filter-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 14px;
    background: #ffffff;
    padding: 12px 18px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.content-card {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-card);
}

.card-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
    flex-wrap: wrap;
    gap: 12px;
}

.card-title {
    font-family: var(--font-heading);
    font-size: 16px;
    font-weight: 700;
    color: #0f172a;
    display: flex;
    align-items: center;
    gap: 8px;
}

.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.modern-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 13.5px;
    background: #ffffff;
}

.modern-table th {
    padding: 12px 16px;
    background: #f1f5f9;
    color: #1e293b;
    font-weight: 800;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 2px solid #cbd5e1;
}

.modern-table td {
    padding: 13px 16px;
    border-bottom: 1px solid #e2e8f0;
    color: #0f172a;
    font-size: 13.5px;
    vertical-align: middle;
}

.modern-table strong,
.modern-table b {
    color: #0f172a;
    font-weight: 700;
}

.modern-table tbody tr {
    transition: background 0.15s ease;
}

.modern-table tbody tr:hover td {
    background: #f8fafc;
}

/* ENCABEZADOS DE FORMULARIOS */
.card-header-styled {
    background: #f8fafc;
    border-bottom: 1px solid var(--border-color);
    padding: 14px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top-left-radius: var(--radius-lg);
    border-top-right-radius: var(--radius-lg);
}

.card-header-primary {
    background: linear-gradient(135deg, #4338ca 0%, #4f46e5 50%, #3b82f6 100%) !important;
    color: #ffffff !important;
    padding: 14px 20px;
    font-weight: 800;
    font-size: 14.5px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top-left-radius: var(--radius-lg);
    border-top-right-radius: var(--radius-lg);
    box-shadow: 0 4px 15px rgba(79, 70, 229, 0.2);
    letter-spacing: 0.03em;
}

.card-header-cyan {
    background: linear-gradient(135deg, #0369a1 0%, #0284c7 50%, #0ea5e9 100%) !important;
    color: #ffffff !important;
    padding: 14px 20px;
    font-weight: 800;
    font-size: 14.5px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top-left-radius: var(--radius-lg);
    border-top-right-radius: var(--radius-lg);
    box-shadow: 0 4px 15px rgba(2, 132, 199, 0.2);
    letter-spacing: 0.03em;
}

/* ==========================================================================
   BOTONES Y CONTROLES
   ========================================================================== */
.btn {
    padding: 9px 18px;
    border-radius: var(--radius-md);
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-primary {
    background: var(--primary-gradient);
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(79, 70, 229, 0.25);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(79, 70, 229, 0.4);
}

.btn-success {
    background: var(--success-gradient);
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.25);
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

.btn-outline {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    color: #334155;
}

.btn-outline:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
    transform: translateY(-1px);
}

.btn-icon {
    background: transparent;
    border: none;
    color: #64748b;
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
}

.btn-icon:hover {
    color: #0f172a;
    background: #f1f5f9;
}

.btn-logout {
    background: #fff1f2 !important;
    border: 1px solid #fecdd3 !important;
    color: #e11d48 !important;
    padding: 6px 14px !important;
    border-radius: var(--radius-pill) !important;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-logout:hover {
    background: var(--danger-gradient) !important;
    color: #ffffff !important;
    border-color: transparent !important;
    box-shadow: 0 0 14px rgba(244, 63, 94, 0.35);
    transform: translateY(-1px);
}

.btn-block { width: 100%; justify-content: center; }
.btn-lg { padding: 14px 22px; font-size: 15px; border-radius: var(--radius-lg); }

/* ==========================================================================
   FORMULARIOS E INPUTS CLAROS
   ========================================================================== */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #475569;
    margin-bottom: 6px;
}

.form-input {
    width: 100%;
    padding: 9px 14px;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: var(--radius-sm);
    color: #0f172a;
    font-size: 13.5px;
    outline: none;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.form-input:focus {
    border-color: #4f46e5;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

.form-input-lg { font-size: 18px; font-weight: 700; padding: 12px 16px; }
.form-input-sm { padding: 6px 10px; font-size: 12px; }

/* BADGES MODERNOS EN TEMA CLARO */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 9px;
    border-radius: var(--radius-pill);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.badge-primary { background: #eef2ff; color: #4338ca; border: 1px solid #c7d2fe; }
.badge-success { background: #ecfdf5; color: #047857; border: 1px solid #a7f3d0; }
.badge-info { background: #f0f9ff; color: #0369a1; border: 1px solid #bae6fd; }
.badge-warning { background: #fffbeb; color: #b45309; border: 1px solid #fde68a; }
.badge-danger { background: #fff1f2; color: #be123c; border: 1px solid #fecdd3; }
.badge-purple { background: #f5f3ff; color: #6d28d9; border: 1px solid #ddd6fe; }

/* ==========================================================================
   COMBOBOXES Y SELECTORES BUSCABLES EN TEMA CLARO
   ========================================================================== */
.searchable-select {
    position: relative;
    width: 100%;
}

.combobox-input-wrapper {
    position: relative;
    width: 100%;
    display: flex;
    align-items: center;
}

.combobox-search {
    width: 100%;
    height: 38px;
    padding-right: 32px !important;
    cursor: text;
    background: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    color: #0f172a !important;
    border-radius: var(--radius-sm);
    font-size: 13px;
    transition: all 0.2s ease;
}

.combobox-search:focus {
    border-color: #4f46e5 !important;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15) !important;
}

.combobox-chevron {
    position: absolute;
    right: 12px;
    color: #64748b;
    pointer-events: none;
    font-size: 11px;
    transition: transform 0.2s ease;
}

.searchable-select.open .combobox-chevron {
    transform: rotate(180deg);
    color: #4f46e5;
}

.combobox-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    z-index: 1050;
    max-height: 290px;
    overflow-y: auto;
    background: #ffffff;
    border: 1.5px solid #94a3b8;
    border-radius: var(--radius-md);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.15), 0 4px 10px rgba(0, 0, 0, 0.06);
}

.combobox-item {
    padding: 12px 16px;
    cursor: pointer;
    font-size: 15px;
    color: #0f172a;
    border-bottom: 1px solid #e2e8f0;
    transition: background 0.15s ease, color 0.15s ease;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

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

.combobox-item:hover, .combobox-item.highlighted {
    background: #f1f5f9;
    color: #1d4ed8;
}

.combobox-item.selected {
    background: #e0e7ff;
    color: #1e40af;
    font-weight: 700;
}

.combobox-no-results {
    padding: 16px;
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    color: #64748b;
}

/* ==========================================================================
   DATATABLE CONTROLS, PILLS Y BOTONES DE ACCIÓN
   ========================================================================== */
.filter-pills-bar {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #f1f5f9;
    padding: 3px 5px;
    border-radius: var(--radius-md);
    border: 1px solid #cbd5e1;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.filter-pill {
    background: transparent;
    border: 1px solid transparent;
    color: #334155;
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    font-size: 12.5px;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    transition: all 0.2s ease;
    user-select: none;
}

.filter-pill:hover {
    color: #0f172a;
    background: #e2e8f0;
}

.filter-pill.active {
    background: #ffffff;
    color: #0f172a;
    border: 1px solid #94a3b8;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.08);
}

/* Filtros específicos de Servicios (Alto Contraste) */
#btnFiltroServicioRuta {
    color: #0369a1;
}
#btnFiltroServicioRuta:hover {
    background: #e0f2fe;
    color: #0284c7;
}
#btnFiltroServicioRuta.active {
    background: #ffffff;
    color: #0284c7;
    border-color: #38bdf8;
    box-shadow: 0 2px 6px rgba(2, 132, 199, 0.2);
}

#btnFiltroServicioTransporte {
    color: #6d28d9;
}
#btnFiltroServicioTransporte:hover {
    background: #f5f3ff;
    color: #7c3aed;
}
#btnFiltroServicioTransporte.active {
    background: #ffffff;
    color: #7c3aed;
    border-color: #c084fc;
    box-shadow: 0 2px 6px rgba(124, 58, 237, 0.2);
}

.btn-page {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    color: #475569;
    padding: 4px 10px;
    min-width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-page:hover:not(:disabled) {
    background: #eef2ff;
    color: #4338ca;
    border-color: #c7d2fe;
}

.btn-page.active {
    background: var(--primary-gradient);
    color: #ffffff;
    border-color: transparent;
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.3);
}

.btn-page:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.btn-action-icon {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    border: 1px solid #cbd5e1;
    background: #ffffff;
    color: #64748b;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    transition: all 0.2s ease;
}

.btn-action-icon:hover {
    color: #4f46e5;
    background: #eef2ff;
    border-color: #c7d2fe;
    transform: scale(1.06);
}

.btn-action-icon.btn-action-edit:hover {
    color: #2563eb;
    background: #eff6ff;
    border-color: #93c5fd;
}

.btn-action-icon.btn-action-delete:hover {
    color: #e11d48;
    background: #fff1f2;
    border-color: #fecdd3;
}

/* ==========================================================================
   MÓDULO DE REPORTES INTEGRAL
   ========================================================================== */
.report-header-banner {
    background: linear-gradient(135deg, #1e1b4b 0%, #312e81 50%, #1e3a8a 100%);
    color: #ffffff;
    padding: 16px 22px;
    border-radius: var(--radius-lg);
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 20px rgba(49, 46, 129, 0.25);
    flex-wrap: wrap;
    gap: 14px;
}

.banner-icon-badge {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: #e0e7ff;
}

.report-grid-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 22px;
    margin-bottom: 24px;
}

@media (max-width: 900px) {
    .report-grid-cards {
        grid-template-columns: 1fr;
    }
}

.report-card-subhead {
    background: #5b7a9c;
    border-bottom: 1px solid #4a6685;
    color: #ffffff;
    font-weight: 800;
    padding: 10px 16px;
    font-size: 14.5px;
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    letter-spacing: 0.04em;
}

/* TABLA DEMARCADA CON COLORES Y BORDES EXACTOS (IMAGEN 2 Y 4) */
.report-card-demarcada {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 16px 20px;
    margin-bottom: 0;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    display: flex;
    flex-direction: column;
}

.report-card-title {
    font-size: 14.5px;
    font-weight: 800;
    color: #0f172a;
    margin: 0 0 12px 0;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.btn-exportar-card {
    background: #10b981;
    color: #ffffff !important;
    border: none;
    padding: 6px 14px;
    font-size: 12px;
    font-weight: 700;
    border-radius: 6px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 2px 4px rgba(16, 185, 129, 0.2);
    transition: all 0.15s ease;
    white-space: nowrap;
}

.btn-exportar-card:hover {
    background: #059669;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(5, 150, 105, 0.3);
}

.table-reporte-demarcada {
    width: 100%;
    border-collapse: collapse !important;
    font-size: 12.5px;
    background: #ffffff;
    border: 2px solid #000000 !important;
    border-radius: 8px;
    overflow: hidden;
    margin: 0;
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.03);
}

.table-reporte-demarcada thead th {
    background: #e2e8f0;
    color: #000000 !important;
    font-weight: 900 !important;
    font-size: 12px !important;
    text-align: center !important;
    padding: 10px 12px !important;
    border: 1.5px solid #000000 !important;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    white-space: nowrap;
    vertical-align: middle;
}

.table-reporte-demarcada thead tr:first-child th:only-child,
.table-reporte-demarcada thead tr:first-child th[colspan] {
    background: linear-gradient(135deg, #0369a1 0%, #1d4ed8 100%) !important;
    color: #ffffff !important;
    font-size: 15px !important;
    font-weight: 900 !important;
    text-align: center !important;
    padding: 12px 14px !important;
    letter-spacing: 0.04em;
    border: 2px solid #000000 !important;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.45);
}

.table-reporte-demarcada thead tr:first-child th[colspan].th-header-vaca {
    background: linear-gradient(135deg, #0284c7 0%, #1d4ed8 100%) !important;
}

.table-reporte-demarcada thead tr:first-child th[colspan] .titulo-nombre-finca {
    color: #ffffff !important;
    font-weight: 900 !important;
}

.badge-tipo-leche-card {
    background: #ffffff !important;
    color: #000000 !important;
    border: 2px solid #000000 !important;
    font-size: 12px !important;
    font-weight: 900 !important;
    padding: 3px 10px !important;
    border-radius: 6px !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3) !important;
    text-shadow: none !important;
}

.badge-tipo-leche-card,
.badge-tipo-leche-card span,
.badge-tipo-leche-card strong,
.badge-tipo-leche-card b {
    color: #000000 !important;
    text-shadow: none !important;
}

.badge-tipo-leche-card.badge-bufala,
.badge-tipo-leche-card.badge-bufala span,
.badge-tipo-leche-card.badge-bufala strong {
    color: #064e3b !important;
    border-color: #064e3b !important;
}

.table-reporte-demarcada th:last-child {
    border-right: 1.5px solid #000000 !important;
}

.table-reporte-demarcada td {
    padding: 10px 12px !important;
    border: 1.5px solid #000000 !important;
    color: #000000;
    text-align: center !important;
    vertical-align: middle;
    font-size: 13px;
    font-weight: 700;
    transition: background 0.15s ease;
}

.table-reporte-demarcada td:last-child {
    border-right: 1.5px solid #000000 !important;
}

.table-reporte-demarcada td.text-left {
    text-align: left !important;
    padding-left: 14px !important;
}

.table-reporte-demarcada tbody tr:nth-child(even) td {
    background: #f8fafc;
}

.table-reporte-demarcada tbody tr:hover td {
    background: #f0f9ff;
}

/* FILAS DE TOTALES Y PIE DE TABLA */
.table-reporte-demarcada tfoot {
    background: linear-gradient(135deg, #065f46 0%, #047857 100%) !important;
    color: #ffffff !important;
    font-weight: 800;
}

.table-reporte-demarcada tfoot tr td {
    font-weight: 800;
    font-size: 13px;
    text-align: center;
    padding: 10px 12px;
    letter-spacing: 0.01em;
    border: 1px solid #064e3b !important;
    vertical-align: middle;
    background: #047857 !important;
    color: #ffffff !important;
}

.table-reporte-demarcada tfoot tr td:last-child {
    border-right: 1px solid #064e3b !important;
}

.table-reporte-banco-header td {
    background: linear-gradient(135deg, #0284c7, #0369a1) !important;
    color: #ffffff !important;
    font-weight: 800 !important;
    font-size: 13.5px !important;
    border: 1px solid #0284c7 !important;
    text-align: left !important;
    padding: 10px 16px !important;
}

/* PANTALLA DE LOGIN Y BLOQUEO FULLSCREEN (SEGURIDAD TOTAL) */
.modal-overlay {
    display: none;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background: #0f172a !important;
    z-index: 999999 !important;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.2s ease-out;
}

.custom-modal-backdrop,
.modal-custom-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 16px;
    animation: fadeIn 0.2s ease-out;
}

/* ==========================================================================
   MODALES PERSONALIZADOS CLAROS Y MODERNOS (ESTILO PREMIUM)
   ========================================================================== */
.custom-modal-backdrop,
.modal-custom-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 16px;
    animation: fadeIn 0.2s ease-out;
}

.swal2-container {
    z-index: 9999999 !important;
}

.custom-modal-backdrop.open,
.modal-custom-overlay.open {
    display: flex !important;
}

.custom-modal-dialog,
.modal-custom-card {
    background: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    box-shadow: 0 25px 60px -12px rgba(15, 23, 42, 0.35) !important;
    border-radius: 16px !important;
    width: 100% !important;
    max-width: 560px;
    max-height: 90vh !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    animation: slideUpModal 0.28s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

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

.custom-modal-header,
.modal-custom-header {
    background: linear-gradient(135deg, #1e1b4b 0%, #312e81 40%, #1e40af 100%) !important;
    color: #ffffff !important;
    padding: 18px 24px !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
}

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

.modal-icon-badge {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.15) !important;
    color: #ffffff !important;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    flex-shrink: 0;
}

.custom-modal-header h2,
.custom-modal-header h3,
.modal-custom-header h2,
.modal-custom-header h3 {
    font-size: 17.5px !important;
    font-weight: 800 !important;
    margin: 0 !important;
    color: #ffffff !important;
    letter-spacing: -0.01em;
}

.modal-custom-header p {
    font-size: 12.5px !important;
    color: #cbd5e1 !important;
    margin: 2px 0 0 0 !important;
    font-weight: 400 !important;
}

.btn-close-modal,
.btn-modal-close {
    width: 32px !important;
    height: 32px !important;
    border-radius: 50% !important;
    background: rgba(255, 255, 255, 0.15) !important;
    border: none !important;
    color: #ffffff !important;
    font-size: 20px !important;
    line-height: 1 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    padding: 0 !important;
}

.btn-close-modal:hover,
.btn-modal-close:hover {
    background: #e11d48 !important;
    color: #ffffff !important;
    transform: rotate(90deg) scale(1.05);
}

.modal-custom-card > form,
.custom-modal-dialog > form {
    display: flex !important;
    flex-direction: column !important;
    flex: 1 !important;
    min-height: 0 !important;
    overflow: hidden !important;
}

.modal-custom-body,
.modal-body {
    padding: 22px 26px !important;
    overflow-y: auto !important;
    flex: 1 !important;
    min-height: 0 !important;
    background: #ffffff !important;
}

.modal-custom-body label,
.modal-body label {
    font-size: 13px !important;
    font-weight: 700 !important;
    color: #1e293b !important;
    margin-bottom: 6px !important;
    display: block !important;
}

.modal-custom-body .form-input,
.modal-body .form-input {
    height: 42px !important;
    border-radius: 8px !important;
    border: 1.5px solid #cbd5e1 !important;
    padding: 0 14px !important;
    font-size: 13.5px !important;
    color: #0f172a !important;
    font-weight: 600 !important;
    background: #ffffff !important;
    transition: all 0.2s ease !important;
}

.modal-custom-body .form-input:focus,
.modal-body .form-input:focus {
    border-color: #3b82f6 !important;
    box-shadow: 0 0 0 3.5px rgba(59, 130, 246, 0.15) !important;
}

.modal-custom-footer,
.custom-modal-footer {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-end !important;
    gap: 12px !important;
    padding: 16px 26px !important;
    border-top: 1px solid #e2e8f0 !important;
    background: #f8fafc !important;
    flex-shrink: 0 !important;
}

.btn-modal-cancel {
    height: 40px !important;
    padding: 0 18px !important;
    border-radius: 8px !important;
    border: 1.5px solid #cbd5e1 !important;
    background: #ffffff !important;
    color: #475569 !important;
    font-weight: 700 !important;
    font-size: 13.5px !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    cursor: pointer !important;
    transition: all 0.15s ease !important;
}

.btn-modal-cancel:hover {
    background: #f1f5f9 !important;
    color: #0f172a !important;
    border-color: #94a3b8 !important;
}

.btn-modal-save {
    height: 40px !important;
    padding: 0 22px !important;
    border-radius: 8px !important;
    background: linear-gradient(135deg, #4f46e5 0%, #2563eb 100%) !important;
    color: #ffffff !important;
    font-weight: 700 !important;
    font-size: 13.5px !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 8px !important;
    border: none !important;
    cursor: pointer !important;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35) !important;
    transition: all 0.2s ease !important;
}

.btn-modal-save:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(37, 99, 235, 0.45) !important;
}

/* ==========================================================================
   RESPONSIVIDAD Y DOCK MÓVIL CLARO
   ========================================================================== */
.mobile-menu-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    border-radius: var(--radius-sm);
    color: #0f172a;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.mobile-menu-toggle:hover {
    background: #eef2ff;
    border-color: #c7d2fe;
    color: #4f46e5;
}

.sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(4px);
    z-index: 998;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.42s ease;
}

.sidebar-backdrop.active {
    opacity: 1;
    pointer-events: auto;
}

.mobile-bottom-nav {
    display: none !important;
}

@media (max-width: 768px) {
    .mobile-menu-toggle {
        display: inline-flex;
    }

    .main-layout {
        display: block;
        min-height: auto;
    }

    .sidebar {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        bottom: 0 !important;
        width: 260px !important;
        max-width: 85vw !important;
        height: 100vh !important;
        z-index: 99999 !important;
        transform: translateX(-100%) !important;
        transition: transform 0.42s cubic-bezier(0.25, 1, 0.5, 1) !important;
        box-shadow: 12px 0 35px rgba(0, 0, 0, 0.15) !important;
        background: #ffffff !important;
    }

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

    .content-area {
        width: 100% !important;
        padding: 16px 14px !important;
    }

    .mobile-bottom-nav {
        display: none !important;
    }
}

@media (max-width: 768px) {
    .top-nav {
        padding: 8px 12px;
        flex-wrap: wrap;
        gap: 8px;
    }

    .brand-title {
        font-size: 15px;
    }

    .nav-center {
        order: 3;
        width: 100%;
        justify-content: space-between;
        gap: 6px;
        margin-top: 2px;
    }

    .bcv-widget, .ciclo-widget {
        flex: 1;
        padding: 5px 8px;
        gap: 6px;
    }

    .kpi-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px !important;
    }

    .kpi-card {
        padding: 12px 14px !important;
    }

    .kpi-value {
        font-size: 18px !important;
    }
}

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

/* ==========================================================================
   ESTILOS DE IMPRESIÓN LIMPIA (PDF / IMPRESORA)
   ========================================================================== */
@media print {
    body {
        background: #ffffff !important;
        color: #000000 !important;
        font-family: Arial, sans-serif !important;
    }

    .top-nav, .sidebar, .sidebar-backdrop, .mobile-bottom-nav, .mobile-menu-toggle, #btnImprimirReporte, #btnExportarExcelReporte, #btnEjecutarReporte, .view-actions, #contenedorSubFiltrosReporte {
        display: none !important;
    }

    .main-layout {
        display: block !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    .content-area {
        padding: 0 !important;
        margin: 0 !important;
        max-width: 100% !important;
    }

    .tab-content {
        display: none !important;
    }

    #tab-reportes {
        display: block !important;
    }

    .content-card {
        border: 1px solid #cbd5e1 !important;
        box-shadow: none !important;
        background: #ffffff !important;
        color: #000000 !important;
        break-inside: avoid;
    }

    .report-card-subhead {
        background: #1e3a8a !important;
        color: #ffffff !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .modern-table {
        color: #000000 !important;
        border-collapse: collapse !important;
        width: 100% !important;
    }

    .modern-table th {
        background: #f1f5f9 !important;
        color: #0f172a !important;
        border: 1px solid #cbd5e1 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .modern-table td {
        color: #000000 !important;
        border: 1px solid #cbd5e1 !important;
    }

    .table-reporte-total-row td,
    .table-reporte-dolar-row td,
    .table-reporte-bs-row td {
        background: #059669 !important;
        color: #ffffff !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}

/* ==========================================================================
   MODAL DE CARGA MASIVA Y OCR EN RUTAS (DISEÑO MODERNO Y LIMPIO)
   ========================================================================== */
#modalRutasMasivo .modal-custom-content,
#modalRutasMasivo .modal-custom-card,
#modalRutasMasivo .custom-modal-dialog {
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    box-shadow: 0 25px 60px -12px rgba(15, 23, 42, 0.25) !important;
    border-radius: 16px !important;
    max-width: 1040px !important;
    width: 95% !important;
}

#modalRutasMasivo .modal-custom-header {
    background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 100%) !important;
    border-bottom: 1px solid #1d4ed8 !important;
    padding: 12px 20px !important;
}

#modalRutasMasivo .modal-custom-body {
    background: #f8fafc !important;
    color: #1e293b !important;
    padding: 14px 18px !important;
}

#modalRutasMasivo .modal-custom-body label {
    color: #475569 !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    letter-spacing: 0.5px !important;
    text-transform: uppercase !important;
}

#modalRutasMasivo .form-input,
#modalRutasMasivo select.form-input,
#modalRutasMasivo input.form-input {
    background: #ffffff !important;
    color: #0f172a !important;
    border: 1.5px solid #cbd5e1 !important;
    border-radius: 7px !important;
    font-size: 13px !important;
    font-weight: 600 !important;
}

#modalRutasMasivo select.form-input option {
    background: #ffffff !important;
    color: #0f172a !important;
    padding: 6px !important;
}

#modalRutasMasivo .form-input:focus {
    border-color: #2563eb !important;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15) !important;
    background: #ffffff !important;
    color: #0f172a !important;
}

#modalRutasMasivo .modal-custom-footer {
    background: #ffffff !important;
    border-top: 1.5px solid #e2e8f0 !important;
    padding: 10px 20px !important;
}

#modalRutasMasivo .searchable-select {
    position: relative;
}

#modalRutasMasivo .combobox-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: #ffffff !important;
    border: 1.5px solid #cbd5e1 !important;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.12) !important;
    z-index: 99999 !important;
    max-height: 220px !important;
    overflow-y: auto !important;
    border-radius: 8px !important;
}

#modalRutasMasivo .combobox-item {
    border-bottom: 1px solid #f1f5f9 !important;
    padding: 10px 14px !important;
    display: flex !important;
    flex-direction: column !important;
    cursor: pointer !important;
    transition: background 0.15s ease !important;
    background: #ffffff !important;
}

#modalRutasMasivo .combobox-item:hover,
#modalRutasMasivo .combobox-item.selected,
#modalRutasMasivo .combobox-item.highlighted {
    background: #eff6ff !important;
}

#modalRutasMasivo .combobox-item strong {
    color: #1e293b !important;
    font-size: 13.5px !important;
    font-weight: 700 !important;
}

#modalRutasMasivo .combobox-item.highlighted strong,
#modalRutasMasivo .combobox-item:hover strong {
    color: #1d4ed8 !important;
}

#modalRutasMasivo .combobox-item small {
    color: #64748b !important;
    font-size: 11.5px !important;
    margin-top: 2px !important;
}

#modalRutasMasivo .table th {
    background: #f1f5f9 !important;
    color: #475569 !important;
    font-size: 11.5px !important;
    font-weight: 800 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    border-bottom: 2px solid #cbd5e1 !important;
    padding: 12px 10px !important;
}

#modalRutasMasivo .table td {
    background: #ffffff !important;
    border-bottom: 1px solid #e2e8f0 !important;
    vertical-align: middle !important;
}

/* ==========================================================================
   CHATBOT ASISTENTE VIRTUAL ANALISTA DE DATOS (ESTILOS MODERNOS GLASSMORRHISM)
   ========================================================================== */
.chatbot-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
}

.chatbot-trigger-btn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6 0%, #6366f1 100%);
    color: #ffffff;
    border: 1.5px solid rgba(255, 255, 255, 0.25);
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.4);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.chatbot-trigger-btn:hover {
    transform: translateY(-2px) scale(1.08);
    box-shadow: 0 6px 22px rgba(99, 102, 241, 0.6);
}

.chatbot-trigger-icon {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 19px;
    color: #ffffff;
}

.chatbot-online-indicator {
    position: absolute;
    top: 1px;
    right: 1px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #10b981;
    border: 2px solid #0f172a;
    box-shadow: 0 0 6px #10b981;
}

.chatbot-trigger-label,
.chatbot-trigger-badge {
    display: none !important;
}

/* VENTANA DEL CHAT */
.chatbot-window {
    position: fixed;
    bottom: 74px;
    right: 20px;
    width: 420px;
    max-width: calc(100vw - 32px);
    height: 580px;
    max-height: calc(100vh - 100px);
    background: #0f172a;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 20px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 10000;
}

.chatbot-window.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateY(20px) scale(0.95);
}

.chatbot-header {
    background: linear-gradient(135deg, #1e1b4b 0%, #312e81 100%);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.chatbot-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chatbot-avatar {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: linear-gradient(135deg, #6366f1, #a855f7);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 18px;
    box-shadow: 0 4px 12px rgba(168, 85, 247, 0.4);
}

.chatbot-title {
    color: #ffffff;
    font-weight: 800;
    font-size: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.chatbot-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #10b981;
    box-shadow: 0 0 8px #10b981;
}

.chatbot-subtitle {
    color: #a5b4fc;
    font-size: 11.5px;
    font-weight: 500;
}

.chatbot-header-actions {
    display: flex;
    gap: 6px;
}

.chatbot-action-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #cbd5e1;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.chatbot-action-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
}

/* HISTORIAL DE MENSAJES */
.chatbot-messages {
    flex: 1;
    padding: 18px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 14px;
    background: #0f172a;
}

.chat-message {
    display: flex;
    gap: 10px;
    max-width: 92%;
}

.chat-message.bot {
    align-self: flex-start;
}

.chat-message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.chat-avatar-mini {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: #312e81;
    color: #818cf8;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    flex-shrink: 0;
}

.chat-bubble {
    padding: 14px 16px;
    border-radius: 14px;
    font-size: 13px;
    line-height: 1.5;
    color: #f1f5f9;
}

.chat-message.bot .chat-bubble {
    background: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-top-left-radius: 4px;
}

.chat-message.user .chat-bubble {
    background: linear-gradient(135deg, #2563eb, #4f46e5);
    color: #ffffff;
    border-top-right-radius: 4px;
}

.chat-sender {
    font-size: 11px;
    font-weight: 700;
    color: #818cf8;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.chat-content {
    word-break: break-word;
}

.chat-content h3, .chat-content h4 {
    color: #38bdf8;
    margin: 10px 0 6px 0;
    font-size: 14px;
    font-weight: 800;
}

.chat-content ul {
    margin: 6px 0;
    padding-left: 18px;
}

.chat-content li {
    margin-bottom: 4px;
}

.chat-content code {
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    color: #38bdf8;
    font-family: monospace;
    font-size: 12px;
}

.chat-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 10px 0;
    font-size: 11.5px;
}

.chat-content th, .chat-content td {
    padding: 6px 8px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    text-align: left;
}

.chat-content th {
    background: rgba(255, 255, 255, 0.08);
    color: #a5b4fc;
}

/* SUGERENCIAS RÁPIDAS PILLS */
.chatbot-quick-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 12px;
}

.quick-pill {
    background: rgba(99, 102, 241, 0.15);
    border: 1px solid rgba(99, 102, 241, 0.35);
    color: #a5b4fc;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 11.5px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.quick-pill:hover {
    background: #4f46e5;
    color: #ffffff;
    border-color: #6366f1;
}

/* CAJA DE SECCIONES (PROBLEMAS / SUGERENCIAS) */
.chatbot-alert-box {
    background: rgba(239, 68, 68, 0.12);
    border-left: 4px solid #ef4444;
    padding: 10px 12px;
    border-radius: 6px;
    margin-top: 10px;
    font-size: 12px;
}

.chatbot-tip-box {
    background: rgba(16, 185, 129, 0.12);
    border-left: 4px solid #10b981;
    padding: 10px 12px;
    border-radius: 6px;
    margin-top: 10px;
    font-size: 12px;
}

/* FOOTER INPUT */
.chatbot-footer {
    padding: 12px 16px;
    background: #1e293b;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.chatbot-input-form {
    display: flex;
    gap: 8px;
}

.chatbot-input {
    flex: 1;
    background: #0f172a;
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #ffffff;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 13px;
    outline: none;
    transition: border 0.2s;
}

.chatbot-input:focus {
    border-color: #6366f1;
}

.chatbot-send-btn {
    background: linear-gradient(135deg, #3b82f6, #6366f1);
    color: #ffffff;
    border: none;
    padding: 0 16px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s;
}

.chatbot-send-btn:hover {
    background: #4f46e5;
}

@media (max-width: 768px) {
    .chatbot-container {
        bottom: 72px;
        right: 14px;
    }
    .chatbot-trigger-btn {
        width: 38px;
        height: 38px;
    }
    .chatbot-trigger-icon {
        font-size: 16px;
    }
    .chatbot-window {
        bottom: 120px;
        right: 10px;
        width: calc(100vw - 20px);
        height: calc(100vh - 140px);
    }
}

/* ==========================================================================
   NUEVO FLUJO LOGÍSTICO: VIAJES, TICKETS Y TRAZABILIDAD (AGENTS_2)
   ========================================================================== */

.ticket-banner-hero {
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.96), rgba(15, 23, 42, 0.98));
    border: 1.5px solid rgba(99, 102, 241, 0.35);
    border-radius: 16px;
    padding: 18px 22px;
    margin-bottom: 22px;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.25), 0 0 20px rgba(99, 102, 241, 0.12);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    position: relative;
    overflow: hidden;
}

.ticket-banner-hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 6px;
    height: 100%;
    background: linear-gradient(to bottom, #6366f1, #3b82f6, #06b6d4);
}

.ticket-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 5px 13px;
    border-radius: 9999px;
    font-size: 11.5px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ticket-pulse-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    animation: ticketPulse 1.8s infinite;
}

@keyframes ticketPulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
    70% { transform: scale(1.1); box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.ticket-stat-box {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 10px 16px;
    text-align: center;
    min-width: 120px;
}

.ticket-stat-val {
    font-size: 20px;
    font-weight: 900;
    color: #38bdf8;
    line-height: 1.1;
}

.ticket-stat-lbl {
    font-size: 11px;
    font-weight: 600;
    color: #94a3b8;
    text-transform: uppercase;
    margin-top: 4px;
}

/* Timeline vertical para modal de trazabilidad */
.timeline-track {
    position: relative;
    padding-left: 52px;
    padding-right: 14px;
    padding-top: 8px;
    padding-bottom: 8px;
}
.timeline-track::before {
    content: '';
    position: absolute;
    left: 26px;
    top: 14px;
    bottom: 14px;
    width: 2px;
    background: #cbd5e1;
}
.timeline-item {
    position: relative;
    margin-bottom: 22px;
}
.timeline-item:last-child {
    margin-bottom: 0;
}
.timeline-marker {
    position: absolute;
    left: -40px;
    top: 4px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    color: #ffffff;
    box-shadow: 0 0 0 4px #ffffff, 0 2px 6px rgba(0, 0, 0, 0.12);
    z-index: 2;
}
.timeline-content {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 12px 16px;
}
.timeline-title {
    font-size: 13.5px;
    font-weight: 700;
    color: #0f172a;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}
.timeline-meta {
    font-size: 11.5px;
    color: #64748b;
    margin-top: 4px;
}
.timeline-note {
    font-size: 12.5px;
    color: #334155;
    margin-top: 6px;
    background: #ffffff;
    padding: 6px 10px;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
    border-left: 3px solid #6366f1;
}

/* ==========================================================================
   DATATABLE Y CONTROL LOGÍSTICO ULTRA-MODERNO
   ========================================================================== */
.dt-container {
    background: #ffffff;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

.dt-header-banner {
    background: linear-gradient(135deg, #1e1b4b 0%, #312e81 40%, #1e293b 100%);
    color: #ffffff;
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.dt-controls-bar {
    background: #f8fafc;
    border-bottom: 1px solid var(--border-color);
    padding: 14px 20px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.dt-search-wrap {
    position: relative;
    min-width: 260px;
    flex: 1;
    max-width: 380px;
}

.dt-search-wrap i.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: 13px;
    pointer-events: none;
}

.dt-search-input {
    width: 100%;
    padding: 9px 36px 9px 34px;
    border-radius: 8px;
    border: 1.5px solid #cbd5e1;
    font-size: 13px;
    background: #ffffff;
    color: #0f172a;
    transition: all 0.2s ease;
}

.dt-search-input:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.dt-search-clear {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    font-size: 13px;
    padding: 4px;
}

.dt-search-clear:hover {
    color: #ef4444;
}

/* Tabla de datos profesional */
.dt-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 12.5px;
    background: #ffffff;
}

.dt-table thead th {
    background: #f1f5f9;
    color: #334155;
    font-weight: 700;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 12px 10px;
    border-bottom: 2px solid #cbd5e1;
    white-space: nowrap;
    user-select: none;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.dt-table thead th:hover {
    background: #e2e8f0;
    color: #0f172a;
}

.dt-table thead th.no-sort {
    cursor: default;
}
.dt-table thead th.no-sort:hover {
    background: #f1f5f9;
}

.dt-table thead th .sort-icon {
    margin-left: 4px;
    font-size: 11px;
    color: #94a3b8;
}

.dt-table thead th.sorted-asc .sort-icon,
.dt-table thead th.sorted-desc .sort-icon {
    color: #4f46e5;
}

.dt-table tbody tr.dt-row-main {
    transition: background 0.15s ease;
    border-bottom: 1px solid #f1f5f9;
}

.dt-table tbody tr.dt-row-main:hover {
    background: #f8fafc;
}

.dt-table tbody tr.dt-row-main.expanded {
    background: #eff6ff !important;
}

.dt-table td {
    padding: 10px 10px;
    vertical-align: middle;
    border-bottom: 1px solid #f1f5f9;
    color: #1e293b;
}

/* Fila de acordeón expandida */
.dt-child-row {
    background: #f8fafc;
    border-bottom: 2px solid #cbd5e1;
}

.dt-child-content {
    padding: 16px 20px;
    animation: fadeIn 0.25s ease;
}

/* Botón expandir fila */
.btn-expand-row {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    color: #4f46e5;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 11px;
    transition: all 0.2s ease;
}

.btn-expand-row:hover {
    background: #4f46e5;
    color: #ffffff;
    border-color: #4f46e5;
    transform: scale(1.08);
}

.btn-expand-row.open {
    background: #6366f1;
    color: #ffffff;
    border-color: #6366f1;
}

/* Paginador */
.dt-pagination-bar {
    padding: 12px 20px;
    background: #f8fafc;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.dt-page-btn {
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    border-radius: 6px;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    color: #334155;
    font-weight: 600;
    font-size: 12px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.dt-page-btn:hover:not(:disabled) {
    background: #f1f5f9;
    border-color: #94a3b8;
    color: #0f172a;
}

.dt-page-btn.active {
    background: linear-gradient(135deg, #4f46e5, #3b82f6);
    color: #ffffff;
    border-color: #4f46e5;
    box-shadow: 0 2px 6px rgba(79, 70, 229, 0.35);
}

.dt-page-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

/* Footer de totales */
.dt-footer-summary {
    background: #f1f5f9;
    font-weight: 800;
    font-size: 12px;
    border-top: 2px solid #cbd5e1;
}
.dt-footer-summary td {
    padding: 11px 10px;
    color: #0f172a;
}

/* ==========================================================================
   MODAL INICIAR NUEVO VIAJE - DISEÑO MODERNO Y ELEGANTE
   ========================================================================== */
#modalIniciarViaje .modal-custom-card {
    max-width: 520px !important;
    border-radius: 20px !important;
    overflow: visible !important;
    background: #ffffff !important;
    box-shadow: 0 25px 70px -12px rgba(15, 23, 42, 0.45), 0 0 0 1px rgba(226, 232, 240, 0.8) !important;
    border: none !important;
}

#modalIniciarViaje form {
    overflow: visible !important;
    display: flex !important;
    flex-direction: column !important;
}

#modalIniciarViaje .modal-custom-header {
    background: linear-gradient(135deg, #1e1b4b 0%, #312e81 45%, #2563eb 100%) !important;
    padding: 22px 28px !important;
    border-radius: 20px 20px 0 0 !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12) !important;
}

#modalIniciarViaje .modal-icon-badge {
    background: rgba(255, 255, 255, 0.18) !important;
    color: #ffffff !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
    border: 1px solid rgba(255, 255, 255, 0.25) !important;
    width: 44px !important;
    height: 44px !important;
    border-radius: 12px !important;
    font-size: 18px !important;
}

#modalIniciarViaje .modal-header-title h2 {
    color: #ffffff !important;
    font-size: 17px !important;
    font-weight: 900 !important;
    letter-spacing: -0.01em !important;
    margin: 0 !important;
}

#modalIniciarViaje .modal-header-title p {
    color: #cbd5e1 !important;
    font-size: 12.5px !important;
    margin-top: 3px !important;
}

#modalIniciarViaje .btn-modal-close {
    color: rgba(255, 255, 255, 0.7) !important;
    background: rgba(255, 255, 255, 0.1) !important;
    border-radius: 10px !important;
    width: 34px !important;
    height: 34px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.2s ease !important;
}

#modalIniciarViaje .btn-modal-close:hover {
    color: #ffffff !important;
    background: rgba(239, 68, 68, 0.7) !important;
    transform: rotate(90deg) !important;
}

#modalIniciarViaje .modal-custom-body {
    padding: 24px 28px !important;
    overflow: visible !important;
    background: #ffffff !important;
}

#modalIniciarViaje .iniciar-viaje-field {
    margin-bottom: 18px;
    position: relative;
}

#modalIniciarViaje .iniciar-viaje-label {
    font-size: 13px;
    font-weight: 800;
    color: #1e293b;
    margin-bottom: 7px;
    display: flex;
    align-items: center;
    gap: 7px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

#modalIniciarViaje .iniciar-viaje-input {
    width: 100%;
    height: 44px !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    border-radius: 10px !important;
    border: 1.5px solid #cbd5e1 !important;
    background: #f8fafc !important;
    color: #0f172a !important;
    padding: 0 14px !important;
    transition: all 0.2s ease !important;
}

#modalIniciarViaje .iniciar-viaje-input:focus {
    background: #ffffff !important;
    border-color: #4f46e5 !important;
    box-shadow: 0 0 0 3.5px rgba(79, 70, 229, 0.15) !important;
    outline: none !important;
}

#modalIniciarViaje #dropdownIniciarViajeConductorList {
    position: absolute !important;
    top: calc(100% + 6px) !important;
    left: 0 !important;
    right: 0 !important;
    background: #ffffff !important;
    border: 1.5px solid #94a3b8 !important;
    box-shadow: 0 18px 45px rgba(15, 23, 42, 0.25), 0 0 0 1px rgba(0, 0, 0, 0.04) !important;
    border-radius: 12px !important;
    max-height: 240px !important;
    overflow-y: auto !important;
    z-index: 999999 !important;
}

#modalIniciarViaje #dropdownIniciarViajeConductorList .combobox-item {
    padding: 11px 16px !important;
    border-bottom: 1px solid #f1f5f9 !important;
    cursor: pointer !important;
    transition: background 0.15s ease !important;
}

#modalIniciarViaje #dropdownIniciarViajeConductorList .combobox-item:hover,
#modalIniciarViaje #dropdownIniciarViajeConductorList .combobox-item.active {
    background: #eef2ff !important;
}

#modalIniciarViaje #dropdownIniciarViajeConductorList .combobox-item-title {
    font-weight: 800 !important;
    color: #1e1b4b !important;
    font-size: 13.5px !important;
}

#modalIniciarViaje #dropdownIniciarViajeConductorList .combobox-item-sub {
    font-size: 11.5px !important;
    color: #6366f1 !important;
    font-weight: 600 !important;
    margin-top: 2px !important;
}

#modalIniciarViaje .modal-custom-footer {
    display: flex !important;
    justify-content: flex-end !important;
    align-items: center !important;
    gap: 12px !important;
    padding: 16px 28px !important;
    background: #f8fafc !important;
    border-top: 1px solid #e2e8f0 !important;
    border-radius: 0 0 20px 20px !important;
}

#modalIniciarViaje .btn-cancelar-modal {
    background: #ffffff !important;
    border: 1.5px solid #cbd5e1 !important;
    color: #475569 !important;
    font-weight: 700 !important;
    padding: 0 20px !important;
    height: 42px !important;
    border-radius: 10px !important;
    font-size: 13.5px !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
}

#modalIniciarViaje .btn-cancelar-modal:hover {
    background: #f1f5f9 !important;
    border-color: #94a3b8 !important;
    color: #0f172a !important;
}

#modalIniciarViaje .btn-iniciar-viaje-submit {
    background: linear-gradient(135deg, #4f46e5 0%, #2563eb 100%) !important;
    border: none !important;
    color: #ffffff !important;
    font-weight: 800 !important;
    padding: 0 24px !important;
    height: 42px !important;
    border-radius: 10px !important;
    font-size: 14px !important;
    cursor: pointer !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 8px !important;
    box-shadow: 0 4px 14px rgba(79, 70, 229, 0.4) !important;
    transition: all 0.2s ease !important;
}

#modalIniciarViaje .btn-iniciar-viaje-submit:hover {
    transform: translateY(-1px) !important;
    box-shadow: 0 6px 20px rgba(79, 70, 229, 0.5) !important;
}

/* ==========================================================================
   MODERN TOAST NOTIFICATIONS (TOP-RIGHT PREMIUM TOASTS)
   ========================================================================== */
.custom-portal-toast-card:hover {
    transform: translateY(-2px) scale(1.01) !important;
}

.custom-portal-toast-card .btn-cerrar-portal-toast:hover {
    background: rgba(255, 255, 255, 0.22) !important;
    color: #ffffff !important;
    transform: scale(1.1);
}

/* ==========================================================================
   DATATABLES MODERN THEME INTEGRATION
   ========================================================================== */
.dataTables_wrapper {
    font-family: inherit;
    color: #334155;
    padding: 6px 0;
}

.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter {
    margin-bottom: 14px;
}

.dataTables_wrapper .dataTables_length select {
    border: 1.5px solid #cbd5e1;
    border-radius: 8px;
    padding: 6px 12px;
    font-weight: 700;
    color: #0f172a;
    background-color: #f8fafc;
    outline: none;
    transition: all 0.2s;
    font-size: 13px;
    margin: 0 4px;
}

.dataTables_wrapper .dataTables_length select:focus {
    border-color: #4f46e5;
    background-color: #ffffff;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

.dataTables_wrapper .dataTables_filter input {
    border: 1.5px solid #cbd5e1;
    border-radius: 8px;
    padding: 7px 14px;
    font-weight: 600;
    color: #0f172a;
    background-color: #ffffff;
    outline: none;
    transition: all 0.2s;
    font-size: 13px;
    margin-left: 6px;
    min-width: 200px;
}

.dataTables_wrapper .dataTables_filter input:focus {
    border-color: #059669;
    box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.15);
}

.dataTables_wrapper .dataTables_info {
    font-size: 12.5px;
    font-weight: 700;
    color: #64748b;
    padding-top: 14px;
}

.dataTables_wrapper .dataTables_paginate {
    padding-top: 10px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
    border-radius: 8px !important;
    border: 1px solid #e2e8f0 !important;
    background: #ffffff !important;
    color: #334155 !important;
    font-weight: 800 !important;
    font-size: 12.5px !important;
    padding: 5px 12px !important;
    transition: all 0.15s ease !important;
    cursor: pointer !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background: #f1f5f9 !important;
    border-color: #cbd5e1 !important;
    color: #0f172a !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current,
.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%) !important;
    color: #ffffff !important;
    border-color: #047857 !important;
    box-shadow: 0 2px 8px rgba(5, 150, 105, 0.3) !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.disabled,
.dataTables_wrapper .dataTables_paginate .paginate_button.disabled:hover {
    opacity: 0.45 !important;
    cursor: not-allowed !important;
    background: #f8fafc !important;
    border-color: #e2e8f0 !important;
    color: #94a3b8 !important;
}

table.dataTable {
    border-collapse: collapse !important;
    margin: 0 !important;
    width: 100% !important;
}

table.dataTable thead th {
    border-bottom: 2px solid #0f172a !important;
    padding: 11px 14px !important;
    font-weight: 800 !important;
    font-size: 11.5px !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
}

table.dataTable tbody td {
    padding: 10px 14px !important;
    border-bottom: 1px solid #e2e8f0 !important;
}

/* ==========================================================================
   ANIMACIONES GLOBALES Y MODALES
   ========================================================================== */
@keyframes modalPopIn {
    0% { transform: scale(0.92); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.mobile-menu-toggle {
    display: none;
    background: #ffffff;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    width: 38px;
    height: 38px;
    color: #0f172a;
    font-size: 17px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.mobile-menu-toggle:hover, .mobile-menu-toggle:active {
    background: #eef2ff;
    border-color: #c7d2fe;
    color: #4f46e5;
    transform: scale(1.05);
}

.sidebar-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1040;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-backdrop.active {
    display: block;
    opacity: 1;
}

/* SOPORTE PARA COLAPSAR ACORDEONES INCLUSO CON HOVER O HAS-ACTIVE */
.nav-accordion-group.collapsed .nav-accordion-body {
    grid-template-rows: 0fr !important;
}
.nav-accordion-group.collapsed .accordion-subitems {
    opacity: 0 !important;
    transform: translateY(-6px) !important;
    pointer-events: none !important;
}
.nav-accordion-group.collapsed .group-chevron {
    transform: rotate(0deg) !important;
    color: #94a3b8 !important;
}
.nav-accordion-group.collapsed .nav-accordion-header {
    background: transparent !important;
    border-left: 3.5px solid transparent !important;
    border-color: #f1f5f9 !important;
}
.nav-accordion-group.collapsed .group-title {
    color: #64748b !important;
    font-weight: 600 !important;
}

/* ==========================================================================
   SISTEMA DE DISEÑO RESPONSIVE Y REESTRUCTURACIÓN MÓVIL
   ========================================================================== */

/* TABLETS Y PANTALLAS MEDIANAS (<= 1024px) */
@media screen and (max-width: 1024px) {
    .mobile-menu-toggle {
        display: flex;
    }

    .main-layout {
        height: auto;
        min-height: calc(100vh - 65px);
        overflow-x: hidden;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: -300px;
        width: 280px;
        min-width: 280px;
        max-width: 280px;
        height: 100vh;
        z-index: 1050;
        box-shadow: 6px 0 25px rgba(0, 0, 0, 0.25);
        transition: left 0.35s cubic-bezier(0.25, 1, 0.5, 1);
    }

    .sidebar.open {
        left: 0;
    }

    .content-area {
        padding: 18px 20px;
        width: 100%;
        max-width: 100vw;
        height: auto;
        overflow-y: visible;
    }

    .stats-grid, .grid-4 {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px !important;
    }

    .report-grid-cards {
        grid-template-columns: 1fr !important;
        gap: 16px !important;
    }
}

/* MÓVILES EN GENERAL (<= 768px) */
@media screen and (max-width: 768px) {
    /* Barra Superior Compacta */
    .top-nav {
        padding: 6px 10px;
        flex-wrap: wrap;
        gap: 6px;
        background: rgba(255, 255, 255, 0.98);
        border-bottom: 1px solid #e2e8f0;
        box-shadow: 0 1px 4px rgba(0,0,0,0.05);
    }

    .brand-title {
        font-size: 13.5px;
        font-weight: 800;
    }

    .brand-icon {
        font-size: 14px;
        padding: 5px;
        border-radius: 6px;
    }

    .env-badge-header {
        font-size: 9px;
        padding: 1px 5px;
    }

    .nav-center {
        order: 3;
        width: 100%;
        display: flex;
        justify-content: space-between;
        gap: 6px;
        padding-top: 4px;
        border-top: 1px dashed #e2e8f0;
    }

    .bcv-widget, .ciclo-widget {
        padding: 4px 8px;
        flex: 1;
        min-width: 0;
        border-radius: 8px;
        display: flex;
        align-items: center;
        gap: 5px;
        justify-content: center;
    }

    .bcv-label, .ciclo-label {
        font-size: 7.5px;
        line-height: 1;
    }

    .bcv-value, .ciclo-value {
        font-size: 11px;
        font-weight: 800;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .user-name, .user-role {
        display: none;
    }

    .user-avatar {
        width: 30px;
        height: 30px;
        font-size: 11.5px;
    }

    .btn-logout span {
        display: none;
    }

    .btn-logout {
        padding: 5px 8px;
    }

    /* Área de Contenido */
    .content-area {
        padding: 10px 6px;
        width: 100%;
        max-width: 100vw;
        overflow-x: hidden;
    }

    /* Tarjetas y Contenedores */
    .card, .glass-card, .stat-card, .data-card {
        padding: 12px 10px !important;
        border-radius: 12px !important;
        margin-bottom: 12px !important;
    }

    .card-header, .panel-header {
        padding: 10px 12px !important;
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 10px !important;
    }

    .card-header .header-actions, .panel-header .header-actions {
        width: 100% !important;
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 6px !important;
        justify-content: flex-start !important;
    }

    /* Grids y Formularios */
    .stats-grid, .grid-4, .grid-3, .grid-2, .form-grid, .filtros-grid {
        grid-template-columns: 1fr !important;
        gap: 10px !important;
    }

    .filtros-bar, .actions-bar, .table-controls {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 8px !important;
    }

    .filtros-bar input, .filtros-bar select, .filtros-bar button,
    .table-controls input, .table-controls select, .table-controls button {
        width: 100% !important;
        min-height: 38px !important;
    }

    /* Tablas con scroll horizontal suave y táctil */
    .table-responsive {
        width: 100% !important;
        max-width: 100% !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        border-radius: 8px !important;
        margin-bottom: 10px !important;
    }

    .table, .data-table, .table-reporte-demarcada, table.dataTable {
        min-width: 520px;
        font-size: 11.5px !important;
    }

    .table th, .table td,
    .table-reporte-demarcada th, .table-reporte-demarcada td {
        padding: 6px 4px !important;
    }

    /* Reportes por Finca Móvil */
    .report-grid-cards {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
        padding: 0 !important;
    }

    .report-card-demarcada {
        padding: 8px !important;
        border-radius: 10px !important;
        margin-bottom: 10px !important;
    }

    .report-card-demarcada .titulo-nombre-finca {
        font-size: 13px !important;
    }

    .card-actions-footer {
        flex-direction: column !important;
        gap: 8px !important;
    }

    .card-actions-footer button {
        width: 100% !important;
        justify-content: center !important;
        padding: 9px 12px !important;
        font-size: 13px !important;
    }

    /* Cuadros de resumen consolidado de reportes (Ajuste Perfecto en Móvil) */
    #cardConsolidadoAmbasFincas {
        padding: 12px 10px !important;
        margin-top: 14px !important;
        border-radius: 10px !important;
    }

    #cardConsolidadoAmbasFincas > div:first-child {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 6px !important;
        padding-bottom: 8px !important;
    }

    #cardConsolidadoAmbasFincas h3 {
        font-size: 13px !important;
    }

    #cardConsolidadoAmbasFincas .badge {
        font-size: 10.5px !important;
        padding: 3px 8px !important;
    }

    #cardConsolidadoAmbasFincas > div:last-child,
    .consolidado-summary-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px !important;
    }

    #cardConsolidadoAmbasFincas > div:last-child > div,
    .consolidado-summary-grid > div {
        padding: 8px 6px !important;
        border-radius: 6px !important;
    }

    #cardConsolidadoAmbasFincas small {
        font-size: 9px !important;
    }

    #cardConsolidadoAmbasFincas div[style*="font-size: 19px"],
    #cardConsolidadoAmbasFincas div[style*="font-size: 18px"],
    #cardConsolidadoAmbasFincas div[style*="font-size: 17px"] {
        font-size: 14px !important;
    }

    #cardConsolidadoAmbasFincas div[style*="font-size: 21px"] {
        font-size: 16px !important;
    }

    /* Banner de resumen financiero en liquidación */
    #panelResumenFinanciero {
        padding: 10px 12px !important;
        border-radius: 10px !important;
    }

    #panelResumenFinanciero > div {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 10px !important;
    }

    #panelResumenFinanciero > div > div:last-child {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px !important;
        width: 100% !important;
    }

    #panelResumenFinanciero > div > div:last-child > div {
        min-width: 0 !important;
        width: 100% !important;
        padding: 8px 10px !important;
    }

    #panelResumenFinanciero div[style*="font-size: 14px"],
    #panelResumenFinanciero div[style*="font-size: 16px"],
    #panelResumenFinanciero div[style*="font-size: 18px"] {
        font-size: 13.5px !important;
    }

    /* Modales en Móvil */
    .modal-custom, .modal {
        padding: 6px !important;
    }

    .modal-custom-content, .modal-content, .modal-dialog {
        width: 100% !important;
        max-width: 100% !important;
        max-height: 94vh !important;
        margin: 0 !important;
        border-radius: 12px !important;
    }

    .modal-custom-header, .modal-header {
        padding: 10px 12px !important;
    }

    .modal-custom-body, .modal-body {
        padding: 10px 12px !important;
    }

    .modal-custom-footer, .modal-footer {
        padding: 10px 12px !important;
        flex-direction: column !important;
        gap: 8px !important;
    }

    .modal-custom-footer button, .modal-footer button {
        width: 100% !important;
        margin: 0 !important;
    }

    /* SweetAlert2 en móvil */
    .swal2-popup {
        width: 92% !important;
        padding: 14px !important;
        font-size: 13px !important;
    }

    /* Watermark DEV discreto en móvil */
    .env-watermark-dev {
        bottom: 8px;
        right: 8px;
        font-size: 9.5px;
        padding: 3px 8px;
    }
}

/* SMARTPHONES PEQUEÑOS (<= 480px) */
@media screen and (max-width: 480px) {
    .brand-title {
        font-size: 12.5px;
    }

    .btn, button.btn-primary, button.btn-secondary, button.btn-danger {
        font-size: 12px !important;
        padding: 7px 10px !important;
    }

    .table th, .table td {
        font-size: 10.5px !important;
        padding: 5px 3px !important;
    }

    #cardConsolidadoAmbasFincas > div:last-child,
    .consolidado-summary-grid {
        grid-template-columns: 1fr !important;
    }
}
