/* GESTAPLAB 1.2 – identidad visual de APLABAS sobre Tabler: blanco, amarillo, naranja y negro (ERS 2.4.1).
   Botones con texto negro sobre naranja (contraste 6:1) y naranjas oscuros para texto y gráficas (AA). */

:root,
[data-bs-theme="light"] {
    --ap-negro: #141414;
    --ap-amarillo: #f5c400;
    --ap-naranja: #e87a00;
    --ap-naranja-texto: #a35200;
    --ap-grafica: #b35900;
    --ap-grafica-linea: #1a1a1a;
    --tblr-font-sans-serif: "Inter", -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --tblr-primary: #e87a00;
    --tblr-primary-rgb: 232, 122, 0;
    --tblr-primary-fg: #141414;
    --tblr-primary-darken: #c96a00;
    --tblr-primary-lt: #fdf0e0;
    --tblr-link-color: #a35200;
    --tblr-link-color-rgb: 163, 82, 0;
    --tblr-link-hover-color: #141414;
    --tblr-body-bg: #f6f6f4;
}

[data-bs-theme="dark"] {
    --ap-naranja-texto: #f5a54a;
    --ap-grafica: #f0a24a;
    --ap-grafica-linea: #f2f2f2;
    --tblr-primary: #f08c1a;
    --tblr-primary-rgb: 240, 140, 26;
    --tblr-primary-fg: #141414;
    --tblr-primary-lt: rgba(240, 140, 26, .16);
    --tblr-link-color: #f5a54a;
    --tblr-link-color-rgb: 245, 165, 74;
    --tblr-link-hover-color: #ffd166;
    --tblr-body-bg: #161616;
}

body {
    font-feature-settings: "cv03", "cv04", "cv11";
}

.btn-primary {
    --tblr-btn-color: #141414;
    --tblr-btn-hover-color: #141414;
    --tblr-btn-active-color: #141414;
    --tblr-btn-bg: var(--tblr-primary);
    --tblr-btn-border-color: var(--tblr-primary);
    --tblr-btn-hover-bg: var(--ap-amarillo);
    --tblr-btn-hover-border-color: var(--ap-amarillo);
    --tblr-btn-active-bg: var(--ap-amarillo);
    font-weight: 600;
}

:focus-visible {
    outline: 3px solid var(--ap-amarillo);
    outline-offset: 2px;
}

/* ---------------------------------------------------------------- menú lateral */
.ap-sidebar {
    background: var(--ap-negro) !important;
    border-right: 3px solid var(--ap-amarillo);
}

.ap-sidebar .nav-link-icon .ti {
    font-size: 1.15rem;
}

.ap-sidebar .nav-item.active > .nav-link,
.ap-sidebar .nav-link.active {
    color: var(--ap-amarillo) !important;
    background: rgba(245, 196, 0, .12);
    border-radius: 6px;
}

.ap-sidebar .dropdown-menu .dropdown-item {
    color: #d8d8d8;
}

.ap-sidebar .dropdown-menu .dropdown-item:hover {
    color: var(--ap-amarillo);
}

.ap-marca {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .5rem 0;
}

.ap-logo-menu {
    width: 44px;
    height: 44px;
    object-fit: contain;
    background: #fff;
    border-radius: 50%;
    padding: 2px;
}

.ap-marca-texto {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
    color: #fff;
    text-align: left;
}

.ap-marca-texto small {
    color: var(--ap-amarillo);
    font-weight: 600;
    font-size: .75rem;
}

/* ---------------------------------------------------------------- barra superior y buscador */
.ap-barra {
    min-height: 3.75rem;
}

.ap-buscador {
    display: flex;
    align-items: center;
    gap: .6rem;
    width: min(520px, 60%);
    padding: .45rem .8rem;
    border: 1px solid var(--tblr-border-color);
    border-radius: 8px;
    background: var(--tblr-bg-surface);
    color: var(--tblr-secondary);
    text-align: left;
}

.ap-buscador:hover {
    border-color: var(--tblr-primary);
}

.ap-buscador span {
    flex: 1;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.ap-buscador kbd {
    background: var(--tblr-bg-surface-secondary);
    color: var(--tblr-secondary);
    border: 1px solid var(--tblr-border-color);
    font-size: .7rem;
}

.ap-busqueda-campo:focus {
    box-shadow: none;
}

#ap-busqueda-resultados .list-group-item:focus {
    background: var(--tblr-primary-lt);
    outline: none;
}

.ap-avatar {
    background: var(--ap-amarillo);
    color: #141414;
    font-weight: 700;
}

[data-bs-theme="dark"] .ap-icono-oscuro,
[data-bs-theme="light"] .ap-icono-claro {
    display: none;
}

/* ---------------------------------------------------------------- indicadores */
.ap-kpi .ap-kpi-valor {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.2;
}

.ap-kpi .avatar {
    --tblr-avatar-size: 2.75rem;
}

.ap-icono-modal {
    font-size: 3rem;
    display: block;
}

/* ---------------------------------------------------------------- antigüedad de cartera */
.ap-antiguedad .progress {
    height: .6rem;
}

.ap-antiguedad .progress-bar {
    background: var(--ap-grafica);
}

/* ---------------------------------------------------------------- tablas */
.table thead th a {
    color: inherit;
    text-decoration: none;
}

.table thead th a.activa,
.table thead th a:hover {
    color: var(--ap-naranja-texto);
}

.ap-tarjeta-asociado {
    border-left: 4px solid var(--ap-amarillo) !important;
}

.ap-tarjeta-asociado.mora {
    border-left-color: var(--tblr-red) !important;
}

/* ---------------------------------------------------------------- avisos */
.ap-toasts {
    z-index: 1090;
}

.ap-toast-ok {
    background: var(--ap-negro);
    color: #fff;
    border-left: 6px solid var(--ap-amarillo) !important;
}

.ap-toast-ok .ti {
    color: var(--ap-amarillo);
}

/* ---------------------------------------------------------------- gráficas SVG */
.ap-grafica {
    width: 100%;
    height: auto;
    display: block;
    max-height: 300px;
}

.ap-grafica .guia {
    stroke: var(--tblr-border-color);
    stroke-width: 1;
}

.ap-grafica .base {
    stroke: var(--tblr-border-color-dark, #bdbdbd);
    stroke-width: 1;
}

.ap-grafica .eje {
    fill: var(--tblr-secondary);
    font-size: 11px;
}

.ap-grafica .valor {
    fill: var(--tblr-body-color);
    font-size: 12px;
    font-weight: 600;
}

.ap-grafica .marca {
    fill: var(--ap-grafica);
}

.ap-grafica .marca:hover,
.ap-grafica .punto:hover {
    opacity: .8;
}

.ap-grafica .linea {
    fill: none;
    stroke: var(--ap-grafica-linea);
    stroke-width: 2;
    stroke-linejoin: round;
    stroke-linecap: round;
}

.ap-grafica .punto {
    fill: var(--ap-grafica-linea);
    stroke: var(--tblr-bg-surface);
    stroke-width: 2;
}

.ap-grafica .zona {
    fill: transparent;
}

/* ---------------------------------------------------------------- mapa, QR y fotos */
.ap-mapa {
    height: 560px;
    border-radius: var(--tblr-border-radius);
}

.ap-mapa-selector {
    height: 260px;
    border-radius: var(--tblr-border-radius);
}

.ap-qr {
    width: 200px;
    height: 200px;
    image-rendering: pixelated;
    background: #fff;
    padding: 6px;
}

.ap-lista-ciiu {
    max-height: 200px;
}

.ap-foto {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    border-radius: var(--tblr-border-radius);
}

/* ---------------------------------------------------------------- páginas de acceso */
.ap-fondo-acceso {
    background: radial-gradient(circle at 20% 10%, rgba(245, 196, 0, .18), transparent 40%),
                radial-gradient(circle at 80% 90%, rgba(232, 122, 0, .2), transparent 45%),
                var(--tblr-body-bg);
}

.ap-logo-acceso {
    width: 130px;
    height: 130px;
    object-fit: contain;
    background: #fff;
    border-radius: 50%;
    padding: 4px;
    box-shadow: 0 6px 24px rgba(0, 0, 0, .12);
}

.ap-verificado {
    font-size: 4rem;
}

@media (max-width: 767.98px) {
    .ap-mapa {
        height: 400px;
    }

    .ap-kpi .ap-kpi-valor {
        font-size: 1.2rem;
    }
}

/* ---------------------------------------------------------------- títulos de los módulos en el menú lateral */
.ap-sidebar .ap-menu-seccion {
    list-style: none;
    padding: 1rem 1rem .35rem;
    font-size: .68rem;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, .45);
}

/* ---------------------------------------------------------------- valores numéricos de las tablas en una sola línea */
.table td.text-end,
.table th.text-end {
    white-space: nowrap;
}

/* ---------------------------------------------------------------- texto con saltos de línea (actas, circulares) */
.ap-pre {
    white-space: pre-line;
    overflow-wrap: anywhere;
}

/* ---------------------------------------------------------------- impresión */
@media print {
    .ap-sidebar, .ap-barra, .footer, .d-print-none, .toast-container, .modal {
        display: none !important;
    }

    .page-wrapper {
        margin: 0 !important;
    }

    .card {
        box-shadow: none !important;
        border: 1px solid #ccc !important;
    }
}
