/* SICOTRAC · diseño con los colores del logo (azul #0072bc + rojo #e81c24) */
/* Letra redondeada de los paneles de referencia (local, sin internet) */
@font-face {
    font-family: "Plus Jakarta Sans";
    src: url("../vendor/fonts/plus-jakarta-sans.woff2") format("woff2");
    font-weight: 400 800;
    font-style: normal;
    font-display: swap;
}

:root {
    --azul: #0072bc;
    --azul-2: #005a94;
    --azul-oscuro: #0b2540;
    --azul-menu-activo: #144a78;
    --azul-claro: #e6f2fb;
    --rojo: #e81c24;
    --rojo-claro: #fde9ea;
    --verde: #15803d;
    --verde-claro: #e6f6ec;
    --ambar: #b45309;
    --ambar-claro: #fef3c7;
    --fondo: #f4f6f9;
    --borde: #e5e9f0;
    --texto: #111827;
    --muted: #6b7280;
    --radio: 12px;
    --radio-sm: 9px;
    --sidebar: 240px;
}

* { box-sizing: border-box; }
body {
    background: var(--fondo);
    color: var(--texto);
    font-family: "Plus Jakarta Sans", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
    font-size: .92rem;
}
a { color: var(--azul); }
/* Bootstrap pone .text-muted en #6c757d y casi no se ve sobre blanco: aquí más oscuro */
.text-muted, .form-text.text-muted { color: #4b5563 !important; }
a:hover { color: var(--azul-2); text-decoration: none; }

/* ---------- Menú lateral ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
    position: fixed; inset: 0 auto 0 0; width: var(--sidebar);
    background: var(--azul-oscuro); z-index: 1040;
    display: flex; flex-direction: column; transition: transform .25s ease;
}
.sidebar-brand { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 1.5rem 1rem 1.2rem; }
.brand-name { color: #fff; font-size: 1.65rem; font-weight: 800; letter-spacing: .04em; line-height: 1.1; }
.brand-sub { color: var(--rojo); font-size: .85rem; font-weight: 800; letter-spacing: .35em; margin-top: .3rem; padding-left: .35em; }
.sidebar-brand:hover .brand-name { color: #fff; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 0 .85rem 1rem; }
.sidebar-nav::-webkit-scrollbar { width: 6px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 3px; }
.nav-group {
    font-size: .66rem; text-transform: uppercase; letter-spacing: .14em; font-weight: 700;
    color: #c9d6e6; padding: 1rem .6rem .4rem;
}
.nav-item {
    display: flex; align-items: center; gap: .7rem;
    padding: .55rem .7rem; margin-bottom: 2px; border-radius: var(--radio-sm);
    color: #fff !important; font-weight: 500; font-size: .9rem; transition: background .15s;
}
.nav-item i { font-size: 1rem; width: 18px; text-align: center; }
.nav-item:hover { background: rgba(255,255,255,.07); }
.nav-item.active { background: var(--azul-menu-activo); font-weight: 600; }
.sidebar-user {
    display: flex; align-items: center; gap: .7rem;
    margin: .85rem; padding: .75rem; border-radius: var(--radio);
    background: rgba(255,255,255,.07);
}
.sidebar-user .avatar {
    width: 38px; height: 38px; border-radius: 50%; flex-shrink: 0;
    background: #fff; color: var(--azul-oscuro); font-weight: 800; font-size: .85rem;
    display: flex; align-items: center; justify-content: center;
}
.sidebar-user .user-info { flex: 1; min-width: 0; line-height: 1.2; }
.sidebar-user strong { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; color: #fff; font-size: .82rem; line-height: 1.2; word-break: break-word; }
.sidebar-user small { color: #c9d6e6; font-size: .75rem; }
.btn-salir {
    width: 32px; height: 32px; border-radius: 8px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    color: #fff !important; background: rgba(255,255,255,.08);
}
.btn-salir:hover { background: var(--rojo); }

/* ---------- Barra superior ---------- */
.main { flex: 1; margin-left: var(--sidebar); min-width: 0; display: flex; flex-direction: column; }
.topbar {
    position: sticky; top: 0; z-index: 1030;
    display: flex; align-items: center; gap: 1rem;
    background: #fff; border-bottom: 1px solid var(--borde);
    padding: .8rem 1.75rem; min-height: 68px;
}
.topbar-heading { flex: 1; min-width: 0; line-height: 1.2; }
.topbar-heading small { color: var(--muted); font-size: .75rem; }
.topbar-heading h1 { font-size: 1.2rem; font-weight: 700; margin: 0; color: var(--texto); }
.topbar-actions { display: flex; align-items: center; gap: .75rem; }
.pill {
    display: inline-flex; align-items: center; gap: .45rem;
    padding: .45rem .9rem; border-radius: 999px; font-size: .8rem; font-weight: 600;
    background: #f1f4f8; color: #374151;
}
.pill-info { background: var(--azul-claro); color: var(--azul-2); }
.pill .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.btn-menu {
    width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--borde);
    background: #fff; color: var(--texto); display: inline-flex; align-items: center; justify-content: center;
}
.content { padding: 1.5rem 1.75rem 2rem; flex: 1; }
.footer { padding: .75rem 1.75rem 1.25rem; color: var(--muted); font-size: .78rem; }
.sidebar-backdrop { display: none; }

@media (max-width: 991.98px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: none; }
    .sidebar.open + .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 1035; }
    .main { margin-left: 0; }
    .topbar, .content { padding-left: 1rem; padding-right: 1rem; }
}

/* ---------- Tarjetas ---------- */
.card { border: 1px solid var(--borde); border-radius: var(--radio); background: #fff; box-shadow: none; }
.card-head {
    display: flex; align-items: center; justify-content: space-between; gap: 1rem;
    padding: 1rem 1.15rem; border-bottom: 1px solid var(--borde);
}
.card-head h3 { font-size: 1rem; font-weight: 700; margin: 0; }
.card-head a { font-size: .8rem; font-weight: 600; }
.card-toolbar {
    display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; justify-content: space-between;
    padding: 1rem 1.15rem; border-bottom: 1px solid var(--borde);
}

/* Indicadores (KPI) */
.kpi { padding: 1.1rem 1.2rem; height: 100%; position: relative; }
.kpi-label { color: var(--muted); font-size: .82rem; }
.kpi-valor { font-size: 1.75rem; font-weight: 800; margin: .35rem 0 .2rem; letter-spacing: -.01em; }
.kpi-sub { font-size: .78rem; font-weight: 700; }
.kpi-icon {
    position: absolute; top: 1rem; right: 1rem; width: 40px; height: 40px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center; font-size: 1.1rem;
}
.kpi-oscuro { background: var(--azul-oscuro); border-color: var(--azul-oscuro); }
.kpi-oscuro .kpi-label { color: #c9d6e6; }
.kpi-oscuro .kpi-valor { color: #fff; font-size: 2rem; }
.kpi-oscuro .kpi-sub { color: #6cc4ff; }
.ic-azul { background: var(--azul-claro); color: var(--azul); }
.ic-verde { background: var(--verde-claro); color: var(--verde); }
.ic-ambar { background: var(--ambar-claro); color: var(--ambar); }
.ic-rojo { background: var(--rojo-claro); color: var(--rojo); }
.t-azul { color: var(--azul); } .t-verde { color: var(--verde); } .t-ambar { color: var(--ambar); } .t-rojo { color: var(--rojo); }

/* Listas de las tarjetas laterales */
.lista-item { display: flex; align-items: center; gap: .75rem; padding: .75rem 1.15rem; border-bottom: 1px solid #eff2f6; }
.lista-item:last-child { border-bottom: 0; }
.lista-item .li-texto { flex: 1; min-width: 0; line-height: 1.25; }
.lista-item strong { display: block; font-size: .87rem; font-weight: 700; }
.lista-item small { color: var(--muted); font-size: .76rem; }
.lista-item .li-valor { font-weight: 700; white-space: nowrap; }
.barra { width: 110px; height: 7px; border-radius: 4px; background: #eef1f5; overflow: hidden; flex-shrink: 0; }
.barra span { display: block; height: 100%; background: var(--azul); border-radius: 4px; }

.card-hero { padding: 1.25rem 1.4rem; }
.card-hero h2 { font-size: 1.1rem; font-weight: 700; margin: 0 0 .2rem; }
.card-hero p { margin: 0; color: var(--muted); }
.section-title { text-transform: uppercase; letter-spacing: .1em; font-size: .7rem; font-weight: 700; color: var(--muted); margin: 1.25rem 0 .6rem; }
.accesos { display: flex; flex-wrap: wrap; gap: .5rem; padding: 1rem 1.15rem; }
.acceso {
    display: inline-flex; align-items: center; gap: .45rem; padding: .5rem .85rem;
    border: 1px solid var(--borde); border-radius: 999px; color: var(--texto) !important; font-weight: 600; font-size: .83rem;
}
.acceso i { color: var(--azul); }
.acceso:hover { border-color: var(--azul); background: var(--azul-claro); }

/* ---------- Afiliados ---------- */
.card-body { padding: 1.15rem; }
.filtros { justify-content: flex-start; background: #fafbfc; }
.filtro { width: 190px; }
.filtro-ancho { width: 240px; }
.persona { display: flex; align-items: center; gap: .7rem; }
.persona-avatar {
    width: 42px; height: 42px; border-radius: 50%; flex-shrink: 0; overflow: hidden;
    background: var(--azul-claro); color: var(--azul-2); font-weight: 800; font-size: .8rem;
    display: flex; align-items: center; justify-content: center;
}
.persona-avatar img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 22%; }
.persona-avatar:has(img) { background: #fff; box-shadow: 0 0 0 2px #fff, 0 0 0 3px var(--borde); }
.persona-texto { min-width: 0; line-height: 1.25; }
.persona-texto strong { display: block; font-size: .86rem; font-weight: 700; }
.persona-texto small { color: var(--muted); font-size: .74rem; }
.select2-selection.is-invalid { border-color: var(--rojo) !important; }
.foto-item { display: flex; align-items: center; gap: .8rem; padding: .8rem 1.15rem; border-bottom: 1px solid #eff2f6; }
.foto-item.subiendo { opacity: .5; pointer-events: none; }
.foto-prev {
    width: 64px; height: 64px; border-radius: 10px; flex-shrink: 0; overflow: hidden;
    background: #f1f4f8; color: #9ca3af; font-size: 1.4rem; display: flex; align-items: center; justify-content: center;
}
.foto-prev img { width: 100%; height: 100%; object-fit: cover; cursor: pointer; }
.foto-info { flex: 1; min-width: 0; line-height: 1.25; }
.foto-info strong { display: block; font-size: .86rem; }
.foto-info small { color: var(--muted); font-size: .75rem; }
.ficha-perfil { padding: 1.5rem 1.25rem; text-align: center; }
.ficha-foto {
    width: 120px; height: 120px; border-radius: 50%; margin: 0 auto 1rem; overflow: hidden;
    background: var(--azul-claro); color: var(--azul-2); font-size: 2.6rem; font-weight: 800;
    display: flex; align-items: center; justify-content: center; border: 4px solid #fff; box-shadow: 0 6px 18px rgba(15,35,60,.12);
}
.ficha-foto img { width: 100%; height: 100%; object-fit: cover; cursor: pointer; }
.ficha-perfil h2 { font-size: 1.15rem; font-weight: 800; margin-bottom: .15rem; }
.ficha-perfil p { color: var(--muted); margin-bottom: .75rem; }
.ficha-resumen { margin-top: 1.25rem; text-align: left; border-top: 1px solid var(--borde); }
.ficha-resumen .dato { display: flex; justify-content: space-between; gap: 1rem; padding: .6rem 0; border-bottom: 1px solid #eff2f6; }
.ficha-resumen .dato:last-child { border-bottom: 0; }
.datos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem 1.25rem; padding: 1.15rem; }
.dato small { display: block; color: var(--muted); font-size: .74rem; margin-bottom: .1rem; }
.dato span { font-weight: 600; font-size: .88rem; word-break: break-word; }
.dato-ancho { grid-column: 1 / -1; }
.docs { display: flex; flex-wrap: wrap; gap: 1rem; padding: 0 1.15rem 1.15rem; }
.doc { text-align: center; }
.doc .foto-prev { width: 120px; height: 84px; }
.doc small { color: var(--muted); font-size: .75rem; }

/* Editor de fotos (Cropper.js) */
.foto-acciones { display: flex; align-items: center; gap: .35rem; }
.editor-area { height: 420px; background: #0f172a; border-radius: var(--radio); overflow: hidden; }
.editor-area img { display: block; max-width: 100%; }
.editor-barra { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: .75rem; margin-top: 1rem; }
.editor-grupo { display: flex; gap: .3rem; padding: .25rem; background: #f1f4f8; border-radius: 12px; }
.editor-btn {
    width: 38px; height: 38px; border: 0; border-radius: 9px; background: transparent; color: #374151; font-size: 1.05rem;
    display: inline-flex; align-items: center; justify-content: center;
}
.editor-btn:hover { background: #fff; color: var(--azul); box-shadow: 0 2px 6px rgba(15,35,60,.08); }
.editor-chip { border: 0; border-radius: 9px; background: transparent; color: #374151; font-weight: 600; font-size: .8rem; padding: 0 .75rem; height: 38px; }
.editor-chip:hover { background: #fff; }
.editor-chip.activo { background: var(--azul); color: #fff; }
.editor-btn:focus, .editor-chip:focus { outline: none; }
.cropper-view-box { outline: 2px solid var(--azul); outline-color: rgba(0,114,188,.9); }
.cropper-point { background-color: var(--azul); width: 8px; height: 8px; opacity: 1; }
.cropper-line { background-color: var(--azul); }
@media (max-width: 575.98px) { .editor-area { height: 300px; } }

/* Encabezado de ficha/formulario y pestañas */
.ficha-head { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; padding: 1.1rem 1.25rem; border-bottom: 1px solid var(--borde); }
.ficha-head-foto { width: 64px; height: 64px; border-radius: 50%; overflow: hidden; flex-shrink: 0; border: 3px solid #fff; box-shadow: 0 4px 14px rgba(15,35,60,.15); }
.ficha-head-foto img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 22%; cursor: pointer; }
.ficha-head-foto span {
    width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
    background: var(--azul-claro); color: var(--azul-2); font-weight: 800; font-size: 1.35rem; letter-spacing: .02em;
}
.ficha-head-cuerpo { flex: 1; min-width: 0; }
.ficha-head-linea { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .75rem; }
.ficha-head-linea .etq { color: var(--muted); font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.ficha-head-linea .numero { font-size: 1.6rem; font-weight: 800; color: var(--azul); line-height: 1.1; }
.ficha-head-linea .nombre { font-size: 1.05rem; font-weight: 700; color: var(--texto); }
.ficha-head-badges { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .45rem; }
.ficha-head-acciones { margin-left: auto; display: flex; gap: .5rem; }
.etiquetas { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; }

/* Encabezado de perfil: foto | nombre + (N.º y etiquetas) | botón */
.perfil-head { flex-wrap: nowrap; gap: 1.1rem; padding: 1.25rem 1.4rem; }
.perfil-foto { width: 72px; height: 72px; }
.perfil-texto { flex: 1; min-width: 0; }
.perfil-nombre { font-size: 1.3rem; font-weight: 800; margin: 0 0 .4rem; line-height: 1.2; color: var(--texto); }
.perfil-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .5rem; }
.perfil-num { color: var(--muted); font-size: .85rem; font-weight: 600; margin-right: .35rem; padding-right: .85rem; border-right: 2px solid #9ca3af; }
.perfil-num strong { color: var(--azul); font-weight: 800; font-size: .95rem; }
.perfil-acciones { flex-shrink: 0; align-self: center; }
.foto-vehiculo { border-radius: 50%; background: var(--azul-claro); color: var(--azul-2); display: flex; align-items: center; justify-content: center; font-size: 1.8rem; }
.foto-vehiculo img { object-position: 50% 50%; }
.texto-corto { max-width: 220px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* En el select de ruta las opciones largas se ven completas en la lista */
.select2-results__option { white-space: normal; line-height: 1.35; }
@media (max-width: 767.98px) {
    .perfil-head { flex-wrap: wrap; }
    .perfil-acciones { width: 100%; }
    .perfil-acciones .btn { width: 100%; }
}
.tabs-app { display: flex; flex-wrap: nowrap; overflow-x: auto; gap: .25rem; padding: 0 1rem; border-bottom: 1px solid var(--borde); list-style: none; margin: 0; }
.tabs-app a {
    display: block; padding: .85rem .9rem; white-space: nowrap; font-weight: 600; font-size: .87rem;
    color: var(--muted) !important; border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tabs-app a:hover { color: var(--texto) !important; }
.tabs-app a.active { color: var(--azul) !important; border-bottom-color: var(--azul); }
/* Tarjetas de foto: imagen grande arriba, título y botones abajo */
.fotos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 1rem; }
.fotos-grid .foto-item {
    flex-direction: column; align-items: stretch; gap: 0; padding: 0;
    border: 1px solid var(--borde); border-radius: var(--radio); overflow: hidden; background: #fff;
}
.fotos-grid .foto-prev {
    width: 100%; height: 190px; border-radius: 0; font-size: 2.2rem; color: #b8c0cc;
    background: #f4f6f9; position: relative;
}
.fotos-grid .foto-prev img { object-fit: contain; background: #f4f6f9; }
.fotos-grid .foto-prev:has(img)::after {
    content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity .15s;
    background: rgba(11,37,64,.35) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='28' fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' viewBox='0 0 24 24'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35M11 8v6M8 11h6'/%3E%3C/svg%3E") no-repeat center;
}
.fotos-grid .foto-prev:hover::after { opacity: 1; }
.foto-pie { display: flex; align-items: center; gap: .6rem; padding: .75rem .85rem; border-top: 1px solid var(--borde); }
.foto-pie .foto-info { flex: 1; min-width: 0; }
.foto-pie .foto-info strong { font-size: .86rem; line-height: 1.25; }
.foto-pie .foto-info small { display: block; white-space: nowrap; }
.foto-pie .foto-acciones { flex-shrink: 0; }
.foto-pie .btn-accion { margin-left: 0; width: 34px; height: 34px; cursor: pointer; }
.btn-subir-foto { color: var(--azul); }

/* ---------- Botones ---------- */
.btn { border-radius: var(--radio-sm); font-weight: 700; padding: .5rem 1rem; font-size: .88rem; }
.btn i { margin-right: .3rem; }
.btn-primary { background: var(--azul); border-color: var(--azul); }
.btn-primary:hover, .btn-primary:focus, .btn-primary:not(:disabled):active { background: var(--azul-2); border-color: var(--azul-2); }
.btn-danger { background: var(--rojo); border-color: var(--rojo); }
.btn-light { background: #f1f4f8; border-color: #f1f4f8; color: #374151; }
.btn-lg { padding: .75rem 1.2rem; font-size: 1rem; }
.btn-accion {
    width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--borde); margin-left: .25rem;
    display: inline-flex; align-items: center; justify-content: center;
    background: #fff; color: #374151; transition: all .15s;
}
.btn-accion:hover { background: var(--azul); border-color: var(--azul); color: #fff; }
.btn-accion.peligro { color: var(--rojo); }
.btn-accion.peligro:hover { background: var(--rojo); border-color: var(--rojo); color: #fff; }

/* ---------- Formularios ---------- */
label { font-weight: 600; font-size: .82rem; color: #374151; margin-bottom: .35rem; }
.req { color: var(--rojo); }
.form-control {
    border-radius: var(--radio-sm); border: 1px solid var(--borde);
    min-height: 40px; padding: .45rem .8rem; font-size: .9rem; background: #fff;
}
.form-control:focus { border-color: var(--azul); box-shadow: 0 0 0 .2rem rgba(0,114,188,.12); }
.form-control.is-invalid { border-color: var(--rojo); }
.input-icon { position: relative; }
.input-icon i { position: absolute; left: .85rem; top: 50%; transform: translateY(-50%); color: var(--muted); }
.input-icon .form-control { padding-left: 2.4rem; }
.search { position: relative; flex: 1; max-width: 360px; min-width: 200px; }
.search i { position: absolute; left: .8rem; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search .form-control { padding-left: 2.3rem; background: #f8fafc; }

/* ---------- Select2 moderno ---------- */
.select2-container--default .select2-selection--single {
    height: 40px; border-radius: var(--radio-sm); border: 1px solid var(--borde); background: #fff;
    transition: border-color .15s, box-shadow .15s;
}
.select2-container--default .select2-selection--single:hover { border-color: #c8d1dd; }
.select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: 38px; padding-left: .8rem; padding-right: 2.2rem; font-size: .9rem; color: var(--texto);
}
.select2-container--default .select2-selection--single .select2-selection__placeholder { color: #9ca3af; }
/* Flecha tipo chevron en lugar del triángulo viejo */
.select2-container--default .select2-selection--single .select2-selection__arrow { height: 38px; width: 34px; right: 2px; }
.select2-container--default .select2-selection--single .select2-selection__arrow b {
    border: 0; width: 8px; height: 8px; margin: -6px 0 0 -4px;
    border-right: 2px solid #6b7280; border-bottom: 2px solid #6b7280;
    transform: rotate(45deg); transition: transform .2s, margin .2s;
}
.select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b {
    border: 0; border-right: 2px solid var(--azul); border-bottom: 2px solid var(--azul);
    transform: rotate(-135deg); margin-top: -2px;
}
.select2-container--default.select2-container--focus .select2-selection--single,
.select2-container--default.select2-container--open .select2-selection--single {
    border-color: var(--azul); box-shadow: 0 0 0 .2rem rgba(0,114,188,.12);
}
.select2-container--open .select2-dropdown--below { margin-top: 6px; }
.select2-container--open .select2-dropdown--above { margin-top: -6px; }
.select2-dropdown {
    border: 1px solid var(--borde) !important; border-radius: var(--radio) !important;
    overflow: hidden; box-shadow: 0 14px 34px rgba(15,35,60,.14); padding: .35rem;
}
.select2-search--dropdown { padding: .25rem .25rem .45rem; }
.select2-search--dropdown .select2-search__field {
    border-radius: 8px; border: 1px solid var(--borde) !important; padding: .45rem .7rem; font-size: .88rem; outline: 0;
}
.select2-search--dropdown .select2-search__field:focus { border-color: var(--azul) !important; }
.select2-results__options { max-height: 240px !important; }
.select2-results__option { border-radius: 8px; padding: .5rem .7rem; font-size: .88rem; margin-bottom: 1px; position: relative; }
.select2-container--default .select2-results__option--highlighted[aria-selected] { background: var(--azul-claro); color: var(--azul-2); }
.select2-container--default .select2-results__option[aria-selected=true] { background: transparent; color: var(--azul); font-weight: 700; padding-right: 2rem; }
.select2-container--default .select2-results__option[aria-selected=true]::after {
    content: ""; position: absolute; right: .85rem; top: 50%; width: 6px; height: 11px; margin-top: -7px;
    border-right: 2px solid var(--azul); border-bottom: 2px solid var(--azul); transform: rotate(45deg);
}
.select2-container--default .select2-results__option--highlighted[aria-selected=true] { background: var(--azul-claro); }
.select2-results__message { color: var(--muted); }

/* ---------- Calendario (Flatpickr) ---------- */
input.fecha-alt {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' viewBox='0 0 24 24'%3E%3Crect x='3' y='4' width='18' height='18' rx='2'/%3E%3Cpath d='M16 2v4M8 2v4M3 10h18'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right .8rem center; padding-right: 2.4rem; cursor: pointer;
}
input.fecha-alt[readonly] { background-color: #fff; }
.flatpickr-calendar {
    font-family: inherit; border: 1px solid var(--borde); border-radius: var(--radio);
    box-shadow: 0 16px 40px rgba(15,35,60,.16); padding: .4rem;
}
.flatpickr-calendar.arrowTop::before, .flatpickr-calendar.arrowTop::after,
.flatpickr-calendar.arrowBottom::before, .flatpickr-calendar.arrowBottom::after { display: none; }
.flatpickr-months { padding: .2rem 0 .4rem; }
.flatpickr-months .flatpickr-month { height: 40px; }
.flatpickr-current-month { font-size: 1rem; font-weight: 700; padding-top: 8px; }
.flatpickr-current-month .flatpickr-monthDropdown-months { font-weight: 700; border-radius: 6px; }
.flatpickr-current-month .flatpickr-monthDropdown-months:hover, .flatpickr-current-month input.cur-year:hover { background: var(--azul-claro); }
.flatpickr-months .flatpickr-prev-month, .flatpickr-months .flatpickr-next-month {
    top: .55rem; height: 32px; width: 32px; padding: 9px; border-radius: 8px; margin: 0 .3rem;
}
.flatpickr-months .flatpickr-prev-month:hover, .flatpickr-months .flatpickr-next-month:hover { background: var(--azul-claro); }
.flatpickr-months .flatpickr-prev-month:hover svg, .flatpickr-months .flatpickr-next-month:hover svg { fill: var(--azul); }
span.flatpickr-weekday { color: var(--muted); font-weight: 700; font-size: .72rem; text-transform: uppercase; }
.flatpickr-day { border-radius: 10px; font-weight: 500; color: var(--texto); }
.flatpickr-day:hover, .flatpickr-day:focus { background: var(--azul-claro); border-color: var(--azul-claro); }
.flatpickr-day.today { border-color: var(--azul); color: var(--azul); font-weight: 700; }
.flatpickr-day.today:hover { background: var(--azul-claro); color: var(--azul); border-color: var(--azul); }
.flatpickr-day.selected, .flatpickr-day.selected:hover, .flatpickr-day.selected:focus {
    background: var(--azul); border-color: var(--azul); color: #fff; font-weight: 700;
}
.flatpickr-day.prevMonthDay, .flatpickr-day.nextMonthDay { color: #c4cad4; }
.flatpickr-day.flatpickr-disabled, .flatpickr-day.flatpickr-disabled:hover { color: #d6dae1; background: transparent; }

/* ---------- Tablas ---------- */
.table-app { margin: 0; }
.table-app thead th {
    border: 0; border-bottom: 1px solid var(--borde); background: #fafbfc; color: var(--muted);
    font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 700;
    padding: .75rem 1.15rem; white-space: nowrap;
}
.table-app td { border-top: 1px solid #eff2f6; padding: .85rem 1.15rem; vertical-align: middle; }
.table-app tbody tr:first-child td { border-top: 0; }
.table-app tbody tr:hover { background: #fafbfd; }
.table-app td small { display: block; color: var(--muted); font-size: .75rem; }
/* Tabla compacta (panel inicial) */
.table-compacta td { padding: .6rem 1.15rem; font-size: .84rem; }
.table-compacta .nombre { display: block; font-weight: 600; font-size: .82rem; line-height: 1.25; }
.table-compacta td small { font-size: .72rem; }
.table-compacta .hora { color: var(--muted); font-size: .76rem; margin-left: .25rem; }
.table-compacta .badge-soft { font-size: .68rem; white-space: nowrap; }
.empty { text-align: center; color: var(--muted); padding: 2.5rem 1rem; }
.badge-soft { display: inline-block; padding: .2rem .6rem; border-radius: 999px; font-weight: 700; font-size: .72rem; }
.badge-activo { background: var(--verde-claro); color: var(--verde); }
.badge-inactivo { background: var(--rojo-claro); color: var(--rojo); }
.badge-gris { background: #f1f4f8; color: #4b5563; }
.badge-azul { background: var(--azul-claro); color: var(--azul-2); }
.badge-ambar { background: var(--ambar-claro); color: var(--ambar); }
.table-permisos td:not(:first-child), .table-permisos th:not(:first-child) { text-align: center; width: 80px; }
.table-permisos .grupo td { background: #fafbfc; font-weight: 700; font-size: .72rem; text-transform: uppercase; color: var(--azul-2); letter-spacing: .06em; }
.table-permisos input[type=checkbox] { width: 17px; height: 17px; accent-color: var(--azul); cursor: pointer; }

/* ---------- Paginación propia ---------- */
.card-footer-pager {
    display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; justify-content: space-between;
    padding: .85rem 1.15rem; border-top: 1px solid var(--borde); color: var(--muted); font-size: .82rem;
}
.pager { display: flex; gap: .3rem; flex-wrap: wrap; }
.pager button {
    min-width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--borde);
    background: #fff; color: #374151; font-weight: 600;
}
.pager button:hover:not(:disabled):not(.active) { background: var(--azul-claro); border-color: var(--azul); color: var(--azul-2); }
.pager button.active, .pager button.active:hover { background: var(--azul); border-color: var(--azul); color: #fff; cursor: default; }
.pager button:disabled { opacity: .45; cursor: default; }
.pager button.flecha { font-size: 1.45rem; line-height: 1; padding-bottom: 3px; font-weight: 400; }
.pager-size { display: flex; align-items: center; gap: .5rem; }
.pager-size select { border-radius: 8px; border: 1px solid var(--borde); padding: .2rem .4rem; background: #fff; }

/* ---------- Modales ---------- */
.modal-content { border: 0; border-radius: 14px; box-shadow: 0 20px 50px rgba(0,0,0,.18); }
.modal-header { border-bottom: 1px solid var(--borde); padding: 1rem 1.4rem; }
.modal-title { font-weight: 700; font-size: 1.05rem; }
.modal-body { padding: 1.4rem; }
.modal-footer { border-top: 1px solid var(--borde); padding: .9rem 1.4rem; }
.alert-soft { background: var(--azul-claro); color: var(--azul-2); border: 0; border-radius: var(--radio-sm); font-size: .85rem; }

/* ---------- SweetAlert2 ---------- */
.swal2-popup { border-radius: 14px !important; font-family: inherit !important; }
.swal2-styled { border-radius: var(--radio-sm) !important; font-weight: 700 !important; }
/* Sin el recuadro de foco en botones ni en la X de alertas y modales */
.swal2-styled:focus, .swal2-close:focus, .swal2-popup:focus,
.modal .close:focus, .modal-content:focus, .modal:focus { outline: none !important; box-shadow: none !important; }

/* ---------- Login ---------- */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1rem; background: var(--fondo); }
.login-card {
    display: flex; width: 100%; max-width: 880px; background: #fff;
    border-radius: 22px; overflow: hidden; box-shadow: 0 20px 50px rgba(0,60,110,.18);
}
.login-side {
    flex: 1; padding: 2.5rem 2rem; color: #fff; text-align: center;
    background: linear-gradient(160deg, var(--azul), var(--azul-2));
    display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.login-logo { width: 280px; height: 280px; border-radius: 50%; background: #fff; padding: 0; object-fit: contain; box-shadow: 0 12px 34px rgba(0,0,0,.28); }
.login-side h2 { font-weight: 800; letter-spacing: .03em; margin: 1.5rem 0 .4rem; color: #fff; }
.login-form { flex: 1; padding: 3rem 2.5rem; display: flex; flex-direction: column; justify-content: center; }
.login-form h3 { font-weight: 700; color: var(--azul); }
.login-form .login-sub { margin-bottom: 1.25rem; color: #4b5563; }
@media (max-width: 767.98px) { .login-side { display: none; } .login-form { padding: 2rem 1.5rem; } }

/* ---------- Errores ---------- */
.error-page { max-width: 520px; margin: 3rem auto; padding: 3rem 2rem; text-align: center; align-items: center; }
.error-page i { font-size: 3.2rem; color: var(--rojo); margin-bottom: 1rem; }
.error-page h2 { font-weight: 700; font-size: 1.4rem; }
.error-page p { color: var(--muted); margin-bottom: 1.5rem; }

/* ---------- Cobro de servicios ---------- */
.cobro-barra { display: flex; flex-wrap: wrap; gap: 1rem; align-items: flex-end; }
.cobro-buscar { flex: 1; min-width: 280px; }
.cobro-campo { width: 190px; }
.cobro-barra label { margin-bottom: .35rem; }
.deuda-tabla { max-height: 420px; overflow-y: auto; }
.deuda-tabla thead th { position: sticky; top: 0; z-index: 1; }
.deuda-tabla input[type=checkbox], .chk-todos { width: 17px; height: 17px; accent-color: var(--azul); cursor: pointer; }
.deuda-tabla .monto-pago { max-width: 130px; margin-left: auto; }
.deuda-tabla .monto-pago[readonly] { background: #f4f6f9; }
.tab-total { display: inline-block; margin-left: .3rem; padding: .05rem .45rem; border-radius: 999px; background: var(--rojo-claro); color: var(--rojo); font-size: .72rem; font-weight: 700; }
.tab-total:empty { display: none; }
.recibo { position: sticky; top: 84px; }
.recibo-linea { display: flex; align-items: center; gap: .6rem; padding: .7rem 1.15rem; border-bottom: 1px solid #eff2f6; }
.recibo-linea .li-texto { flex: 1; min-width: 0; line-height: 1.25; }
.recibo-linea strong { display: block; font-size: .85rem; }
.recibo-linea small { color: var(--muted); font-size: .75rem; }
.recibo-linea .li-valor { font-weight: 700; white-space: nowrap; }
.recibo-linea .btn-accion { width: 28px; height: 28px; }
#reciboLineas { max-height: 360px; overflow-y: auto; }
.recibo-total { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.15rem; border-top: 1px solid var(--borde); background: #fafbfc; }
.recibo-total span { color: var(--muted); font-weight: 600; }
.recibo-total strong { font-size: 1.6rem; font-weight: 800; color: var(--azul); }
#btnFechaPago { height: 40px; font-weight: 600; }
#btnFechaPago i { color: var(--azul); }

/* Cobro: datos del encabezado y resumen de deuda */
.meta-datos { color: var(--muted); font-size: .88rem; margin-right: .35rem; }
.meta-datos strong { color: var(--texto); font-weight: 700; }
.meta-sep { margin: 0 .5rem; color: #9ca3af; font-weight: 700; }
.deuda-resumen { display: grid; grid-template-columns: repeat(5, 1fr); gap: .6rem; padding: 1rem 1.25rem; border-bottom: 1px solid var(--borde); background: #fafbfc; }
.deuda-item { text-align: left; border: 1px solid var(--borde); border-radius: 10px; background: #fff; padding: .6rem .8rem; line-height: 1.25; }
button.deuda-item { cursor: pointer; transition: border-color .15s, box-shadow .15s; }
button.deuda-item:hover { border-color: var(--azul); box-shadow: 0 2px 8px rgba(0,114,188,.12); }
.deuda-item:focus { outline: none; }
.deuda-item small { display: block; color: var(--muted); font-size: .74rem; font-weight: 600; }
.deuda-item strong { font-size: 1.02rem; font-weight: 800; white-space: nowrap; }
.deuda-item.debe strong { color: var(--rojo); }
.deuda-item.al-dia strong { color: var(--verde); }
.deuda-total { background: var(--azul-oscuro); border-color: var(--azul-oscuro); }
.deuda-total small { color: #c9d6e6; }
.deuda-total strong { color: #fff; font-size: 1.1rem; }
@media (max-width: 991.98px) { .deuda-resumen { grid-template-columns: repeat(2, 1fr); } .deuda-total { grid-column: 1 / -1; } }

/* Cobro: encabezado con separador pipe y ruta en su propia línea */
.perfil-num { font-weight: 700; }
.perfil-num.sin-sep { border-right: 0; padding-right: 0; }
.perfil-ruta { margin-top: .45rem; color: var(--muted); font-size: .86rem; line-height: 1.35; }
.perfil-ruta i { color: var(--azul); }
.perfil-ruta strong { color: var(--texto); }
.btn-agregar { white-space: nowrap; height: 40px; display: inline-flex; align-items: center; justify-content: center; gap: .35rem; }
.btn-agregar i { margin: 0; }
/* El selector de vehículo solo ocupa espacio cuando el afiliado tiene varios */
#cVehiculos { min-width: 220px; }
#cVehiculos:empty { display: none; }
.perfil-num { white-space: nowrap; }

/* Registro de daños */
.dano-dias { max-height: 300px; border: 1px solid var(--borde); border-radius: var(--radio-sm); }
.dano-doc { flex-direction: column; align-items: stretch; gap: 0; padding: 0; border: 1px solid var(--borde); border-radius: var(--radio); overflow: hidden; }
.dano-doc .foto-prev { width: 100%; height: 180px; border-radius: 0; font-size: 2rem; }
.dano-doc .foto-prev img { object-fit: contain; }
.dano-dias-lista { max-width: 260px; }

/* Pago de gastos */
.segmento { display: inline-flex; padding: .25rem; background: #f1f4f8; border-radius: 12px; gap: .25rem; }
.segmento button { border: 0; background: transparent; border-radius: 9px; padding: .5rem .9rem; font-weight: 700; font-size: .85rem; color: #4b5563; white-space: nowrap; }
.segmento button:focus { outline: none; }
.segmento button.activo { background: #fff; color: var(--azul); box-shadow: 0 2px 8px rgba(15,35,60,.1); }
.total-input[readonly] { background: var(--azul-claro); color: var(--azul-2); font-weight: 800; }
.factura-doc { max-width: 420px; }
/* Daños */
.btn-accion.aprobar { color: var(--verde); }
.btn-accion.aprobar:hover { background: var(--verde); border-color: var(--verde); color: #fff; }
.nav-contador { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--rojo); color: #fff; font-size: .7rem; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; }

.btn-dano { height: 40px; font-weight: 600; white-space: nowrap; }
.btn-dano i { color: var(--ambar); }
.btn-dano:disabled { opacity: .55; }

/* Cobro: nombre y botón de daños en la misma línea, sin avatar */
.cobro-titulo { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.cobro-titulo .perfil-nombre { flex: 1; min-width: 0; }
.cobro-titulo .btn-dano { flex-shrink: 0; }

/* Tooltip del sistema (negro, letra blanca) */
.tip-app {
    position: fixed; z-index: 2000; max-width: 280px; padding: .45rem .7rem; border-radius: 8px;
    background: #111827; color: #fff; font-size: .78rem; font-weight: 600; line-height: 1.35;
    box-shadow: 0 8px 22px rgba(0,0,0,.22); pointer-events: none;
    opacity: 0; transform: translateY(4px); transition: opacity .12s, transform .12s;
}
.tip-app.visible { opacity: 1; transform: translateY(0); }
.tip-app::after {
    content: ""; position: absolute; left: var(--flecha, 50%); top: 100%; margin-left: -5px;
    border: 5px solid transparent; border-top-color: #111827;
}
.tip-app.abajo::after { top: auto; bottom: 100%; border-top-color: transparent; border-bottom-color: #111827; }

/* Popover de días (Registro de daños) */
.dias-btn {
    border: 1px solid var(--borde); background: #fff; border-radius: 999px; padding: .15rem .65rem;
    font-weight: 700; font-size: .82rem; color: var(--azul); display: inline-flex; align-items: center; gap: .3rem;
}
.dias-btn:hover { border-color: var(--azul); }
.dias-btn:focus { outline: none; }
.dias-btn i { transition: transform .15s; }
.dias-btn.abierto { background: var(--azul); border-color: var(--azul); color: #fff; }
.dias-btn.abierto i { transform: rotate(180deg); }
.pop-app {
    position: absolute; z-index: 1900; width: 340px; max-width: calc(100vw - 16px);
    background: #111827; color: #fff; border-radius: 12px; padding: .75rem; box-shadow: 0 14px 34px rgba(0,0,0,.28);
    animation: popEntra .12s ease-out;
}
.pop-app::before {
    content: ""; position: absolute; bottom: 100%; left: var(--flecha, 24px); margin-left: -6px;
    border: 6px solid transparent; border-bottom-color: #111827;
}
.pop-titulo { font-size: .78rem; font-weight: 700; color: #c9d6e6; margin-bottom: .55rem; text-transform: uppercase; letter-spacing: .06em; }
.pop-titulo span { display: inline-block; margin-left: .3rem; padding: 0 .45rem; border-radius: 999px; background: var(--rojo); color: #fff; }
.pop-dias { display: grid; grid-template-columns: repeat(2, 1fr); gap: .35rem; max-height: 260px; overflow-y: auto; }
.pop-dias span { background: #1f2937; border-radius: 8px; padding: .35rem .55rem; font-size: .8rem; font-weight: 600; white-space: nowrap; }
.pop-dias::-webkit-scrollbar { width: 6px; }
.pop-dias::-webkit-scrollbar-thumb { background: #374151; border-radius: 3px; }
@keyframes popEntra { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

/* ---------- Reportes ---------- */
.hoja { padding: 1.5rem 1.75rem 2rem; }
.solo-impresion { display: none; }
.hoja-membrete img { max-width: 100%; height: auto; margin-bottom: 1rem; }
.hoja-titulo { text-align: center; margin-bottom: 1.25rem; }
.hoja-titulo h2 { font-size: 1.35rem; font-weight: 800; margin: 0; color: var(--texto); }
.hoja-titulo p { margin: .2rem 0 0; color: var(--muted); font-weight: 600; }
/* Widgets de totales: cuadrícula pareja (mismo ancho y alto), nombre arriba en 2 líneas fijas y monto abajo; con muchos baja a otra fila */
.hoja-resumen { display: grid; grid-template-columns: repeat(auto-fill, minmax(175px, 1fr)); gap: .75rem; margin-bottom: 1.25rem; }
.hoja-resumen > div { display: flex; flex-direction: column; justify-content: space-between; gap: .45rem; min-height: 86px; border: 1px solid var(--borde); border-radius: 10px; padding: .75rem .9rem; }
.hoja-resumen small { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.5em; line-height: 1.25; color: var(--muted); font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .02em; }
.hoja-resumen strong { font-size: 1.15rem; font-weight: 800; white-space: nowrap; }
.hoja-resumen .destacado { background: var(--azul-oscuro); border-color: var(--azul-oscuro); }
.hoja-resumen .destacado small { color: #c9d6e6; }
.hoja-resumen .destacado strong { color: #fff; }
.hoja-persona { margin-bottom: 1rem; }
.hoja-persona h3 { font-size: 1.2rem; font-weight: 800; margin: 0 0 .35rem; }
.hoja-seccion { font-size: .95rem; font-weight: 800; margin: 1.25rem 0 .5rem; color: var(--azul-2); }
.tabla-reporte { border: 1px solid var(--borde); }
.tabla-reporte tfoot td { background: #fafbfc; font-weight: 800; border-top: 2px solid var(--borde); padding: .8rem 1.15rem; }
.tabla-reporte .fila-alerta td { color: var(--rojo); font-weight: 700; }
.fechas-chips { display: flex; flex-wrap: wrap; gap: .25rem; }
.fechas-chips span { background: #f1f4f8; border-radius: 6px; padding: .1rem .4rem; font-size: .74rem; font-weight: 600; white-space: nowrap; }
.marca-vehiculo { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: #f59e0b; margin-left: .3rem; }
.hoja-nota { color: var(--muted); font-size: .78rem; margin-top: .5rem; }
.bloque-total { border: 1px solid var(--borde); border-radius: 12px; padding: 1rem 1.15rem; height: 100%; }
.bloque-total h4 { font-size: .9rem; font-weight: 800; margin-bottom: .6rem; color: var(--azul-2); }
.bloque-total > div { display: flex; justify-content: space-between; padding: .4rem 0; border-bottom: 1px solid #eff2f6; }
.bloque-total > div.total { border-bottom: 0; font-size: 1.05rem; }
.bloque-total > div.total strong { color: var(--azul); font-size: 1.2rem; }
.hoja-firmas { display: flex; justify-content: space-around; gap: 2rem; margin-top: 4rem; text-align: center; font-weight: 700; font-size: .85rem; }
.hoja-firmas div { width: 260px; }
.hoja-firmas span { display: block; border-top: 1.5px solid #374151; margin-bottom: .4rem; }
.hoja-pie { margin-top: 2rem; text-align: center; color: var(--muted); font-size: .72rem; }

@media print {
    @page { margin: 1.2cm; }
    body { background: #fff !important; font-size: 11px; }
    .sidebar, .sidebar-backdrop, .topbar, .footer, .no-print, .tip-app, .pop-app { display: none !important; }
    .main { margin-left: 0 !important; }
    .content { padding: 0 !important; }
    .card { border: 0 !important; box-shadow: none !important; }
    .hoja { padding: 0; }
    .solo-impresion { display: block !important; }
    .hoja-resumen .destacado { background: #fff !important; border: 2px solid #111827 !important; }
    .hoja-resumen .destacado small, .hoja-resumen .destacado strong { color: #111827 !important; }
    .tabla-reporte { font-size: 10px; }
    .tabla-reporte td, .tabla-reporte th { padding: .35rem .5rem !important; }
    .table-app thead th { background: #eef1f5 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    tr { page-break-inside: avoid; }
}

.detalle-recibo { font-size: .8rem; line-height: 1.35; }
.detalle-recibo strong { font-weight: 700; }
.detalle-recibo + .detalle-recibo { margin-top: .4rem; }
.detalle-recibo strong { display: block; }
.fechas-recibo { display: flex; flex-wrap: wrap; column-gap: .6rem; row-gap: .1rem; max-width: 33rem; margin-top: .1rem; }
.fechas-recibo span { flex: 0 0 5.9rem; font-size: .78rem; white-space: nowrap; color: var(--muted); font-variant-numeric: tabular-nums; }
.col-total { min-width: 135px; white-space: nowrap; }
.fila-anulada td { color: #9ca3af; text-decoration: line-through; }
.fila-anulada td .badge-soft { text-decoration: none; }
.gran-total { display: flex; justify-content: flex-end; align-items: baseline; gap: 1rem; margin-top: 1rem; padding: .9rem 1.15rem; border-radius: 10px; background: #fafbfc; border: 1px solid var(--borde); font-weight: 700; color: var(--muted); }
.gran-total strong { font-size: 1.4rem; color: var(--azul); font-weight: 800; }

/* Menú plegable */
.nav-toggle { display: flex; width: 100%; align-items: center; justify-content: space-between; background: transparent; border: 0; text-align: left; cursor: pointer; border-radius: 8px; }
.nav-toggle:hover { color: #fff; background: rgba(255,255,255,.05); }
.nav-toggle:focus { outline: none; }
.nav-toggle i { font-size: .85rem; transition: transform .2s; }
.nav-seccion.abierta .nav-toggle i { transform: rotate(180deg); }
.nav-seccion .nav-items { overflow: hidden; }
.nav-seccion .nav-items { max-height: 0; transition: max-height .25s ease; display: block; }
.nav-seccion.abierta .nav-items { max-height: 800px; }
.nav-seccion.con-activo .nav-toggle span::after { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--rojo); margin-left: .45rem; vertical-align: middle; }

/* Campanita de notificaciones */
.notif { position: relative; margin-right: .6rem; }
.notif-btn { position: relative; width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--borde); background: #fff; color: #374151; font-size: 1.15rem; display: flex; align-items: center; justify-content: center; }
.notif-btn:hover { border-color: var(--azul); color: var(--azul); }
.notif-btn:focus { outline: none; }
.notif-num { position: absolute; top: -6px; right: -6px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 999px; background: var(--rojo); color: #fff; font-size: .7rem; font-weight: 800; display: flex; align-items: center; justify-content: center; border: 2px solid #fff; }
.notif-panel { position: absolute; right: 0; top: calc(100% + 10px); width: 340px; max-width: calc(100vw - 24px); background: #fff; border: 1px solid var(--borde); border-radius: 14px; box-shadow: 0 18px 40px rgba(15,35,60,.16); display: none; z-index: 1050; overflow: hidden; }
.notif-panel.visible { display: block; animation: popEntra .12s ease-out; }
.notif-head { padding: .85rem 1rem; font-weight: 800; border-bottom: 1px solid var(--borde); display: flex; align-items: center; gap: .5rem; }
.notif-head span { background: var(--rojo); color: #fff; border-radius: 999px; padding: 0 .5rem; font-size: .72rem; }
.notif-item { display: flex; gap: .7rem; padding: .75rem 1rem; border-bottom: 1px solid #eff2f6; color: var(--texto) !important; }
.notif-item:hover { background: #fafbfc; }
.notif-icono { width: 34px; height: 34px; border-radius: 10px; flex-shrink: 0; background: var(--ambar-claro); color: var(--ambar); display: flex; align-items: center; justify-content: center; }
.notif-texto { min-width: 0; line-height: 1.3; }
.notif-texto strong { display: block; font-size: .84rem; }
.notif-texto small { display: block; color: var(--muted); font-size: .76rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 250px; }
.notif-texto .notif-meta { color: #9ca3af; font-size: .72rem; }
.notif-todos { display: block; text-align: center; padding: .7rem; font-weight: 700; font-size: .82rem; }
.notif-vacio { padding: 1.5rem 1rem; text-align: center; color: var(--muted); font-size: .85rem; }
.notif-vacio i { display: block; font-size: 1.6rem; color: var(--verde); margin-bottom: .4rem; }

/* Roles: casillas para marcar columnas completas */
.th-chk { display: inline-flex; flex-direction: column; align-items: center; gap: .3rem; margin: 0; cursor: pointer; font-size: .7rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.th-chk input { width: 17px; height: 17px; accent-color: var(--azul); cursor: pointer; }
.table-permisos .grupo td:last-child { text-align: center; }
.table-permisos .grupo input { width: 17px; height: 17px; accent-color: var(--azul); cursor: pointer; }
/* La etiqueta del encabezado de tarjeta no se parte en dos líneas */
.card-head .pill { white-space: nowrap; flex-shrink: 0; padding: .3rem .7rem; font-size: .74rem; }
.card-head h3 { min-width: 0; }

/* Panel: ingresos por categoría */
.segmento-sm button { padding: .3rem .6rem; font-size: .74rem; }
.cat-mes { padding: .6rem 1.15rem 0; color: var(--muted); font-size: .76rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.cat-icono { position: static; width: 34px; height: 34px; border-radius: 9px; font-size: .95rem; flex-shrink: 0; }
.cat-barra { width: 100%; margin-top: .35rem; height: 6px; }
.cat-total { display: flex; justify-content: space-between; align-items: baseline; padding: .8rem 1.15rem; border-top: 1px solid var(--borde); background: #fafbfc; font-weight: 700; color: var(--muted); }
.cat-total strong { font-size: 1.15rem; color: var(--azul); }

/* ===== Temas (APP_TEMA en Config.php): solo cambian el menú lateral; la barra superior es clara en los dos =====
   Cada sistema define --acento (opción marcada del menú), --nombre y --sub (nombre del sistema y letras de abajo en el tema claro). */

/* Contenido: mismos colores en todos los temas y en los dos sistemas */
.content a:not(.btn):not(.btn-accion) { color: #1e6fb8; }
.btn-primary { background: #1e6fb8; border-color: #1e6fb8; color: #fff; }
.btn-primary:hover, .btn-primary:focus { background: #185c99; border-color: #185c99; }
.btn-success { background: #15803d; border-color: #15803d; color: #fff; }
.btn-success:hover, .btn-success:focus { background: #116b33; border-color: #116b33; }
.btn-danger { background: #dc2626; border-color: #dc2626; color: #fff; }
.btn-danger:hover, .btn-danger:focus { background: #b91c1c; border-color: #b91c1c; }
.kpi-oscuro { background: #1f2937; border-color: #1f2937; }
.kpi-oscuro .kpi-label, .kpi-oscuro .kpi-sub { color: #cbd5e1; }
.kpi-oscuro .kpi-valor { color: #fff; }
.kpi-oscuro .kpi-sub .t-rojo { color: #fca5a5 !important; }
.deuda-total, .hoja-resumen .destacado { background: #1f2937; border-color: #1f2937; }
.deuda-total small, .hoja-resumen .destacado small { color: #cbd5e1; }
.pill-info { background: #e7f0fa; color: #1e5f9e; }
.pill-info .dot { background: #1e6fb8; }
.cat-barra span { background: #1e6fb8; }
.cat-total strong { color: #1e6fb8; }

/* Barra superior clara (igual en los dos temas) */
.topbar { background: #fff; border-bottom: 1px solid #e6eaf0; }

/* Tema "oscuro": menú oscuro, barra superior clara */
body.tema-oscuro .sidebar { background: #1f2937; }
body.tema-oscuro .brand-name, body.tema-oscuro .sidebar-brand:hover .brand-name { color: #fff; }
body.tema-oscuro .nav-group { color: #8d99a8; }
body.tema-oscuro .nav-item i { color: #9aa5b4; }
body.tema-oscuro .nav-item:hover { background: rgba(255,255,255,.06); }
body.tema-oscuro .nav-item.active { background: var(--acento); }
body.tema-oscuro .nav-item.active i { color: #fff; }
body.tema-oscuro .nav-seccion.con-activo .nav-toggle span::after { background: var(--acento); }
body.tema-oscuro .sidebar-user { background: rgba(255,255,255,.06); }
body.tema-oscuro .sidebar-user .avatar { background: var(--acento); color: #fff; }
body.tema-oscuro .sidebar-user small { color: #a7b1be; }

/* Tema "claro": menú claro, barra superior clara */
body.tema-claro .sidebar { background: #fff; border-right: 1px solid #e6eaf0; }
body.tema-claro .brand-name, body.tema-claro .sidebar-brand:hover .brand-name { color: var(--nombre); }
body.tema-claro .brand-sub { color: var(--sub); }
body.tema-claro .sidebar-nav::-webkit-scrollbar-thumb { background: rgba(0,0,0,.1); }
body.tema-claro .nav-group { color: #94a0b3; }
body.tema-claro .nav-toggle:hover { color: #475569; background: #f1f4f8; }
body.tema-claro .nav-item { color: #3d4a5c !important; }
body.tema-claro .nav-item i { color: #7b8ba3; }
body.tema-claro .nav-item:hover { background: #f1f4f8; }
body.tema-claro .nav-item.active { background: var(--acento); color: #fff !important; }
body.tema-claro .nav-item.active i { color: #fff; }
body.tema-claro .nav-seccion.con-activo .nav-toggle span::after { background: var(--acento); }
body.tema-claro .sidebar-user { background: #f1f4f8; }
body.tema-claro .sidebar-user .avatar { background: var(--acento); color: #fff; }
body.tema-claro .sidebar-user strong { color: #1f2937; }
body.tema-claro .sidebar-user small { color: #8a94a6; }
body.tema-claro .btn-salir { color: #64748b !important; background: #fff; }
body.tema-claro .btn-salir:hover { color: #fff !important; background: var(--acento); }
:root { --acento: #e81c24; --nombre: #e81c24; --sub: #8a94a6; }

/* Menú de acciones (tres puntos) en los listados */
.menu-acciones { position: fixed; z-index: 1060; min-width: 230px; background: #fff; border: 1px solid #e6eaf0; border-radius: 10px; box-shadow: 0 12px 30px rgba(15,23,42,.14); padding: .35rem; }
.menu-acciones a, .menu-acciones button { display: flex; align-items: center; gap: .6rem; width: 100%; padding: .55rem .75rem; border: 0; background: none; border-radius: 7px; color: #1f2937 !important; font-size: .88rem; text-align: left; text-decoration: none; cursor: pointer; }
.menu-acciones a:hover, .menu-acciones button:hover { background: #f1f4f8; }
.menu-acciones i { color: #6b7280; font-size: 1rem; }
.menu-acciones [data-accion="cuota"], .menu-acciones [data-accion="cuota"] i { color: #dc2626 !important; }
.menu-acciones .menu-vacio { display: block; padding: .55rem .75rem; color: #6b7280; font-size: .85rem; }

/* Listados de afiliados */
.num-afiliado { display: block; font-size: 1.05rem; letter-spacing: .02em; }
.badge-bajo { display: inline-block; margin-top: .3rem; padding: .2rem .55rem; line-height: 1.2; }
.table-app td small.t-natural { color: #15803d; font-weight: 600; }
.table-app td small.t-juridica { color: #b45309; font-weight: 600; }

/* Filtros de Afiliados: los cinco en una sola línea */
.filtros-linea { flex-wrap: nowrap; gap: .6rem; }
.filtros-linea .filtro { width: auto; flex: 1 1 150px; min-width: 0; }
.filtros-linea .filtro-medio { flex: 1.2 1 170px; }
.filtros-linea .filtro-corto { flex: 0 0 160px; }
.filtros-linea .filtro-ancho { flex: 1 1 170px; }
@media (max-width: 991.98px) { .filtros-linea { flex-wrap: wrap; } .filtros-linea .filtro { flex: 1 1 45%; } }

/* Estatus del cupo (colores del sistema viejo): activo verde, pendiente amarillo, inactivo morado */
.badge-pendiente { background: #fef3c7; color: #a16207; }
.badge-morado { background: #f3e8ff; color: #7e22ce; }
.badge-cancelado { background: #fee2e2; color: #b91c1c; }
.badge-compensado { background: #ffedd5; color: #c2410c; }

/* Listado de vehículos: ruta con nombre largo */
.col-ruta { max-width: 260px; }
.col-ruta .ruta-num { font-weight: 700; }
.col-ruta .ruta-tipo { display: inline-block; font-size: .68rem; font-weight: 700; letter-spacing: .03em; color: #1e5f9e; background: #e7f0fa; border-radius: 6px; padding: .1rem .4rem; margin-left: .25rem; }
.col-ruta .ruta-desc { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px; }
.menu-acciones .menu-peligro, .menu-acciones .menu-peligro i { color: #dc2626 !important; }

/* Foco solo visible al usar el teclado; con el mouse no se queda el botón marcado */
.btn:focus:not(:focus-visible), .btn-accion:focus:not(:focus-visible), .pb-btn:focus:not(:focus-visible), button:focus:not(:focus-visible) { outline: none; box-shadow: none; }

/* Totales al final de Ingresos y Gastos mensual: uno por grupo y el total */
.tabla-totales { width: 100%; max-width: 460px; margin: 1.5rem 0 0 auto; border-collapse: collapse; font-size: .9rem; }
.tabla-totales th { background: var(--azul, #1e4fa0); color: #fff; padding: .55rem .85rem; text-transform: uppercase; font-size: .75rem; letter-spacing: .04em; }
.tabla-totales td { padding: .45rem .85rem; border-bottom: 1px solid #e5e7eb; }
.tabla-totales tfoot td { border-top: 2px solid #111827; border-bottom: 0; font-weight: 800; font-size: 1.05rem; }

/* Reportes: montos (y sus totales) en una sola línea, con espacio para B/. */
.tabla-reporte th.text-right, .tabla-reporte td.text-right { white-space: nowrap; }
.tabla-reporte tfoot td.text-right:last-child, .tabla-reporte tfoot td.text-right:nth-last-child(2) { min-width: 150px; }

/* Pago de gastos · últimos registrados: concepto / tipo · código / fecha · proveedor, siempre 3 líneas alineadas */
.li-texto { min-width: 0; flex: 1; }
.li-linea { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.4; }
.lista-item .li-valor { white-space: nowrap; }

/* Tarjeta del usuario en el menú: nombre en hasta 2 líneas y sucursal completa (sin "…") */
.sidebar-user { align-items: flex-start !important; }
.sidebar-user small { display: block; margin-top: 2px; }
.sidebar-user .avatar, .sidebar-user .btn-salir { flex: none; }
