:root {
    --primary-color: #0d6efd;
    --primary-dark: #0043a8;
    --secondary-color: #f8f9fa;
    --background-color: #f1f5f9;
    --text-dark: #1e293b;
    --card-shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
    --card-hover-shadow: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
}

body {
    background-color: var(--background-color);
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: var(--text-dark);
}

/* Tarjetas del menú principal */
.menu-card {
    background: #ffffff;
    border: none;
    border-radius: 12px;
    box-shadow: var(--card-shadow);
    transition: all 0.3s ease;
    cursor: pointer;
    text-decoration: none;
    color: var(--text-dark);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1.75rem 1.25rem;
    height: 100%;
}
.menu-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--card-hover-shadow);
    color: var(--primary-color);
}
.menu-card .icon {
    font-size: 2.6rem;
    color: var(--primary-color);
    margin-bottom: 0.8rem;
}
.menu-card h4 {
    font-weight: 600;
    font-size: 1.15rem;
    margin: 0;
}
.menu-card p {
    font-size: 0.85rem;
}

/* Indicadores del tablero */
.kpi {
    background: #fff;
    border-radius: 12px;
    box-shadow: var(--card-shadow);
    padding: 1rem 1.25rem;
    height: 100%;
}
.kpi .valor {
    font-size: 1.6rem;
    font-weight: 700;
    line-height: 1.2;
}
.kpi .etiqueta {
    font-size: 0.8rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: .03em;
}
.kpi.alerta .valor { color: #dc3545; }
.kpi.aviso .valor { color: #b45309; }
.kpi.bien .valor { color: #198754; }

/* Ingreso */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0d6efd 0%, #0043a8 100%);
    padding: 1rem;
}
.login-card {
    width: 100%;
    max-width: 400px;
    background: #ffffff;
    padding: 2.5rem;
    border-radius: 15px;
    box-shadow: 0 20px 25px -5px rgba(0,0,0,0.2);
}
.login-logo {
    max-height: 80px;
}

.btn-primary-custom {
    background-color: var(--primary-color);
    border: none;
    border-radius: 8px;
    padding: 0.6rem 1.5rem;
    font-weight: 500;
    transition: background 0.2s;
}
.btn-primary-custom:hover {
    background-color: #0b5ed7;
}
/* Deshabilitado: Bootstrap deja el fondo transparente y el texto blanco no se ve */
.btn-primary-custom:disabled, .btn-primary-custom.disabled {
    background-color: var(--primary-color);
    color: #fff;
    opacity: 0.5;
}

/* Secciones de cada módulo (igual que config.html de opsencuestas) */
.settings-section .card {
    border: none;
    border-radius: 10px;
    box-shadow: var(--card-shadow);
    margin-bottom: 1.5rem;
}
.settings-section .card-header {
    background-color: #ffffff;
    border-bottom: 2px solid var(--background-color);
    font-weight: 600;
    color: var(--primary-color);
    border-top-left-radius: 10px;
    border-top-right-radius: 10px;
}
.sub-card {
    cursor: pointer;
    border-radius: 10px !important;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.sub-card h6 { font-size: 0.85rem; }
.sub-card.active {
    background-color: var(--primary-color);
    color: #fff;
}
.navbar-logo {
    object-fit: contain;
}

/* Tablas */
table.dataTable td, table.dataTable th { font-size: 0.85rem; }
.table-sm td, .table-sm th { vertical-align: middle; }
.matriz-permisos th, .matriz-permisos td { text-align: center; }
.matriz-permisos td:first-child, .matriz-permisos th:first-child { text-align: left; }

/* Hoja de vida */
.hv-seccion { margin-bottom: 1.25rem; }
.hv-seccion h6 {
    color: var(--primary-color);
    font-weight: 600;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: .3rem;
    margin-bottom: .6rem;
}
.hv-dato small { color: #64748b; display: block; font-size: .72rem; text-transform: uppercase; }
.hv-dato span { font-weight: 600; }

/* Portal del conductor (celular) */
.portal .card { border: none; border-radius: 12px; box-shadow: var(--card-shadow); }
.portal .btn-lg { border-radius: 10px; }
.item-chequeo { border-bottom: 1px solid #eef2f7; padding: .6rem 0; }
.item-chequeo:last-child { border-bottom: none; }

#tiposSoporte label { font-size: .74rem; padding: .45rem .15rem; line-height: 1.15; }

/* Gráficas */
.grafica { position: relative; height: 320px; }

/* SweetAlert más compacto (como en opsencuestas) */
.swal2-popup {
    font-size: 0.85em !important;
    width: 24em !important;
    padding: 1.25em !important;
}
.swal2-popup.swal-formulario { width: 32em !important; }
.swal2-popup.swal-ancho { width: min(1000px, 96vw) !important; }
.swal2-title { font-size: 1.5em !important; }
.swal2-icon {
    transform: scale(0.75);
    margin: 1em auto .5em !important;
}

/* Buscador de las listas desplegables (Buscador en app.js) */
.buscador-original { display: none !important; }
.buscador { position: relative; }
.buscador-boton { text-align: left; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.buscador-boton.buscador-vacio { color: var(--bs-secondary-color, #6c757d); }
.buscador-boton:disabled { background-color: var(--bs-secondary-bg, #e9ecef); }
.buscador-panel { position: fixed; z-index: 2100; background: var(--bs-body-bg, #fff); border: 1px solid var(--bs-border-color, #dee2e6); border-radius: .375rem; padding: .5rem; text-align: left; }
.buscador-lista { max-height: 10.5rem; overflow-y: auto; margin-top: .4rem; }   /* unas 5 opciones a la vista */
.buscador-item { padding: .35rem .5rem; border-radius: .25rem; cursor: pointer; font-size: .9rem; display: flex; align-items: center; }
.buscador-item.activo { background: #e7f1ff; }
.buscador-item.elegido { font-weight: 600; }
.buscador-item.deshabilitado { color: #adb5bd; cursor: not-allowed; }
.buscador-nada, .buscador-pie { font-size: .8rem; color: var(--bs-secondary-color, #6c757d); padding: .25rem .5rem 0; }

@media print {
    .navbar, .no-print, .sub-card, .dataTables_filter, .dataTables_length, .dataTables_paginate { display: none !important; }
    body { background: #fff; }
}

/* Ventana modal amplia para formularios con pestañas (TablaCrud ancho: 'modal-xxl') */
@media (min-width: 1200px) {
    .modal-xxl { max-width: min(1400px, 94vw); }
}
.modal-body > .nav-tabs { position: sticky; top: -1rem; z-index: 2; background: #fff; margin-top: -1rem; padding-top: 1rem; }
.modal-body > .nav-tabs .nav-link { font-weight: 500; }
.modal-body > .nav-tabs .nav-link:not(.active) { color: var(--text-dark); }
.modal-body .tab-pane { min-height: 33rem; }   /* misma altura en todas las pestañas: la ventana no salta */

/* Mensajes internos (Fase 12) */
.chat-lista { max-height: calc(100vh - 300px); min-height: 200px; overflow-y: auto; }
.chat-mensajes { height: calc(100vh - 330px); min-height: 320px; overflow-y: auto; background: #f4f6fa; }
.chat-vacio { min-height: 320px; }
.burbuja { max-width: 80%; width: fit-content; padding: .45rem .75rem; border-radius: .8rem; margin-bottom: .45rem; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.burbuja.propia { margin-left: auto; background: #dbeafe; }
.chat-autor { font-size: .75rem; font-weight: 600; color: var(--bs-primary, #0d6efd); }
.chat-texto { white-space: pre-wrap; word-break: break-word; }
.chat-meta { font-size: .7rem; color: #6c757d; text-align: right; }
.chat-imagen { max-width: 220px; max-height: 220px; border-radius: .5rem; cursor: pointer; background: #e9ecef; min-width: 60px; min-height: 40px; }
#txtMensaje { resize: none; }
.swal2-popup.swal-amplio { width: 40em !important; }
@media (max-width: 767px) {
    .chat-mensajes { height: calc(100vh - 280px); }
    .burbuja { max-width: 92%; }
}

/* Atajos de la pantalla de inicio (Fase 13) */
.atajo { min-height: 64px; border-radius: .75rem; box-shadow: 0 2px 6px rgba(0,0,0,.08); }

/* Celular (Fase 13): íconos en la barra, sub-tarjetas e indicadores compactos */
.iconos-movil > li { margin: 0 !important; }
.iconos-movil .nav-link { padding: .35rem .45rem !important; }
.iconos-movil .badge { font-size: .62rem; }
@media (max-width: 991.98px) {
    .iconos-movil .dropdown-menu { position: fixed !important; top: 3.6rem !important; left: .5rem !important; right: .5rem !important;
        min-width: 0 !important; max-width: none !important; transform: none !important; }
}
@media (max-width: 575.98px) {
    .sub-card { flex-direction: row; justify-content: flex-start; gap: .5rem; padding: .55rem .65rem !important; text-align: left !important; min-height: 3.1rem; }
    .sub-card > i { font-size: 1.2rem !important; margin-bottom: 0 !important; }
    .sub-card h6 { font-size: .8rem; line-height: 1.15; }
    .kpi { padding: .65rem .8rem; }
    .kpi .valor { font-size: 1.2rem; }
    .kpi .etiqueta { font-size: .66rem; }
    .kpi .bi.fs-3 { font-size: 1.15rem !important; }
    .menu-card { padding: 1rem !important; }
    div.dataTables_wrapper div.dataTables_length, div.dataTables_wrapper div.dataTables_filter,
    div.dt-container div.dt-length, div.dt-container div.dt-search { text-align: left !important; }
    div.dataTables_wrapper div.dataTables_filter input, div.dt-container div.dt-search input { width: 100% !important; margin-left: 0 !important; }
}
