/* ============================================================
   insi-layout.css  —  Reemplazo de AdminLTE 3.x
   Reimplementa SOLO las clases AdminLTE usadas en el proyecto.
   Bootstrap 4 utilities (row, col-*, d-flex, btn, etc.) se
   mantienen via bootstrap.min.css.
   ============================================================ */

/* ---------- Google Font ---------- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* ---------- Reset base ---------- */
html, body {
    font-family: 'Inter', 'Source Sans Pro', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    height: 100%;
    margin: 0;
    overflow: hidden;
    background: #f6f7fa;
    color: #333;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

/* ---------- Layout body classes ---------- */
body.layout-fixed,
body.layout-navbar-fixed { /* handled by .main-header fixed */ }
body.sidebar-collapse,
body.sidebar-closed { /* sidebar oculto por defecto; .control-modulos maneja visibilidad */ }

/* ---------- Wrapper principal ---------- */
.wrapper {
    position: relative;
    min-height: 100vh;
    overflow: hidden;
}

/* ---------- Content wrapper ---------- */
/* Ocupa desde debajo del navbar fijo hasta el fondo de la ventana.
   Es un contenedor flex vertical: content-header arriba, searchcontenido abajo. */
.content-wrapper {
    background-color: #f6f7fa;
    margin-top: 48px; /* espacio para el navbar fijo */
    height: calc(100vh - 48px);
    display: flex;
    flex-direction: column;
    overflow: hidden; /* NO scroll aquí — el scroll va en el table-responsive */
}

/* ---------- Content header (breadcrumb + toolbar) ---------- */
/* Siempre visible arriba, no hace scroll */
.content-header {
    flex: 0 0 auto;
    z-index: 1020;
    padding: 6px 3%; /* mismo padding lateral que searchcontenido */
    background: #fff;
    border-bottom: 1px solid #e9ecef;
}

.content-header h1 {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0;
}

.content-header .container-fluid {
    padding: 0;
}

/* Row de toolbar: usar flexbox para alinear items y Acciones */
.content-header .row {
    align-items: center;
}

/* Reducir margin-bottom del row dentro de content-header */
.content-header .row.mb-2 {
    margin-bottom: 0.3rem !important;
}

/* Botones del toolbar: no wrap */
.content-header .btn {
    white-space: nowrap;
}

/* input-group-prepend con breadcrumb: quitar estilos heredados */
.content-header .input-group-prepend.breadcrumb {
    background: transparent;
    padding: 0;
    margin: 0;
}

/* ---------- Main header / Navbar FIJO ---------- */
.main-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1033;
    display: flex;
    align-items: center;
    min-height: 48px;
    padding: 0 0.5rem 0 0.75rem;
    border: none;
}

.main-header.navbar {
    padding: 0 0.5rem 0 0.75rem;
}

/* Navbar */
.navbar-nav {
    display: flex;
    flex-direction: column;
    padding-left: 0;
    margin-bottom: 0;
    list-style: none;
    align-items: center;
}

.navbar-expand .navbar-nav {
    flex-direction: row;
    align-items: center;
}

.navbar-brand {
    display: inline-flex;
    align-items: center;
    padding: 0;
    margin-right: 0.75rem;
    font-size: 1.1rem;
    line-height: inherit;
    white-space: nowrap;
    text-decoration: none;
}

/* nav-link base */
.nav-link {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0.4rem 0.65rem;
    text-decoration: none;
    position: relative;
    white-space: nowrap;
}

/* Colores navbar */
.navbar-white,
.navbar-light {
    background-color: #fff;
}

.navbar-light .navbar-nav .nav-link {
    color: rgba(0,0,0,.6);
}

.navbar-light .navbar-nav .nav-link:hover,
.navbar-light .navbar-nav .nav-link:focus {
    color: rgba(0,0,0,.8);
}

/* Override: con navbar-new el fondo viene de app.css */
.navbar-new .navbar-nav .nav-link,
.navbar-new .navbar-brand,
.navbar-new .brand-text {
    color: rgba(255,255,255,.85) !important;
}
.navbar-new .navbar-nav .nav-link:hover {
    color: #fff !important;
}

/* dropdown-legacy: posiciona dropdowns bajo la barra */
.main-header.dropdown-legacy .dropdown-menu {
    top: 100%;
    margin-top: 4px;
}

/* ── Botón icono del navbar (toggle, notificaciones, mensajes) ── */
.nav-icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0 !important;
    border-radius: 8px;
    transition: background 0.2s ease;
    font-size: 0.95rem;
}

.navbar-new .nav-icon-btn:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* ── Indicador de módulo activo ──────────────────────── */
.navbar-module-indicator {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px 14px 4px 4px;
    background: rgba(255, 255, 255, 0.13);
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s ease;
    text-decoration: none;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.navbar-module-indicator:hover {
    background: rgba(255, 255, 255, 0.22);
}

.navbar-module-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    background: var(--secundario, #fe7800);
    border-radius: 6px;
    font-size: 0.7rem;
    color: #fff;
    flex-shrink: 0;
}

.navbar-module-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: #fff !important;
}

/* ── Separador entre módulo y menús ──────────────────── */
.nav-separator-item {
    display: flex;
    align-items: center;
    padding: 0 2px;
}

.navbar-module-separator {
    width: 1px;
    height: 22px;
    background: rgba(255, 255, 255, 0.2);
    flex-shrink: 0;
}

/* ── Links del menú principal (Pre Venta, Facturación...) ── */
.nav-menu-link {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px !important;
    border-radius: 6px;
    font-size: 0.835rem;
    font-weight: 500;
    transition: background 0.2s ease;
    color: rgba(255,255,255,.8) !important;
}

.navbar-new .nav-menu-link:hover {
    background: rgba(255, 255, 255, 0.13) !important;
    color: #fff !important;
}

.nav-menu-arrow {
    font-size: 0.55rem;
    opacity: 0.6;
    transition: transform 0.2s ease;
    margin-left: 2px;
}

.nav-item.dropdown.show .nav-menu-arrow {
    transform: rotate(180deg);
}

/* ── Sección derecha ─────────────────────────────────── */
.navbar-right-section {
    gap: 2px;
}

/* Pill informativa (TC, Periodo) */
.nav-info-pill {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px !important;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 500;
    background: rgba(255, 255, 255, 0.08);
    transition: background 0.2s ease;
    color: rgba(255,255,255,.8) !important;
}

.navbar-new .nav-info-pill:hover {
    background: rgba(255, 255, 255, 0.16) !important;
    color: #fff !important;
}

.nav-info-pill i {
    font-size: 0.75rem;
    opacity: 0.7;
}

/* ── Sección empresa/avatar ──────────────────────────── */
.nav-empresa-link {
    display: flex !important;
    align-items: center !important;
    gap: 8px;
    padding: 4px 8px !important;
    border-radius: 8px;
    transition: background 0.2s ease;
}

.navbar-new .nav-empresa-link:hover {
    background: rgba(255, 255, 255, 0.12) !important;
}

.nav-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    font-size: 0.8rem;
    flex-shrink: 0;
}

.nav-avatar-img {
    flex-shrink: 0;
}

.navbar-empresa-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
    line-height: 1.3;
}

.navbar-empresa-info .navbar-empresa-nombre {
    font-size: 0.78rem;
    font-weight: 600;
    color: rgba(255,255,255,.95) !important;
}

.navbar-empresa-info .navbar-empresa-sucursal {
    font-size: 0.68rem;
    font-weight: 400;
    color: rgba(255,255,255,.55) !important;
}

/* ---------- Brand ---------- */
.brand-text {
    font-size: 1rem;
    font-weight: 400;
}

.brand-image {
    max-height: 33px;
    margin-right: 0.5rem;
}

/* ---------- Navbar badge ---------- */
.navbar-badge {
    position: absolute;
    top: 2px;
    right: -2px;
    font-size: 0.55rem;
    padding: 2px 4px;
    font-weight: 700;
    min-width: 16px;
    text-align: center;
    border-radius: 10px;
    line-height: 1.2;
}

/* Badge dentro del navbar */
.navbar-new .badge-primary.navbar-badge {
    background-color: var(--secundario, #fe7800) !important;
    color: #fff !important;
    box-shadow: 0 0 0 2px var(--primario, #284A70);
}

/* ---------- Contenido principal ---------- */
/* searchcontenido: contenedor del grid en páginas de listado.
   Flex: 1 para ocupar todo el espacio restante del content-wrapper. */
.searchcontenido {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    padding: 0 3%;
    overflow: hidden;
    min-height: 0; /* necesario para que flex child pueda shrink */
}

/* El card dentro de searchcontenido ocupa todo el espacio restante */
.searchcontenido > .card {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
    margin-bottom: 0;
}

/* El table-responsive dentro del card es la zona con scroll */
.searchcontenido > .card > .table-responsive {
    flex: 1 1 auto;
    overflow-y: auto;
    overflow-x: auto;
    min-height: 0;
}

/* El card-footer (paginación) queda fijo abajo del card */
.searchcontenido > .card > .card-footer {
    flex: 0 0 auto;
    position: relative; /* override sfcardfooter absolute */
    bottom: auto;
    width: auto;
}

.searchcontenidoold {
    flex: 1 1 auto;
    padding: 0 3%;
    overflow: auto;
    min-height: 0;
}

/* contenidoform: contenedor para formularios/documentos — ocupa espacio restante y hace scroll */
.contenidoform {
    flex: 1 1 0;            /* basis 0 ⇒ no usa la altura del contenido como mínimo */
    display: flex;
    flex-direction: column;
    overflow: auto;
    padding: 0 3%;
    min-height: 0;
}

/* Propagar altura dentro de contenidoform para que el contenido llene el espacio */
    .contenidoform > .container-fluid {
        flex: 1 1 auto;
        display: flex;
        flex-direction: column;
        margin-top: 10px;
    }

.contenidoform > .container-fluid > .row {
    flex: 1 1 auto;
}

/* ---------- Nav sidebar ---------- */
.nav-sidebar {
    list-style: none;
    padding: 0;
    margin: 0;
}

.nav-sidebar .nav-item {
    margin-bottom: 0;
}

.nav-sidebar .nav-link {
    display: flex;
    align-items: center;
    padding: 0.5rem 1rem;
    color: #c2c7d0;
    border-radius: 4px;
    transition: background 0.15s;
}

.nav-sidebar .nav-link:hover {
    background: rgba(255,255,255,.1);
    color: #fff;
}

.nav-sidebar .nav-link .nav-icon {
    margin-right: 0.5rem;
    width: 1.6rem;
    text-align: center;
    font-size: 1rem;
}

/* ---------- Cards ---------- */
.card {
    position: relative;
    display: flex;
    flex-direction: column;
    min-width: 0;
    word-wrap: break-word;
    background-color: #fff;
    background-clip: border-box;
    border: 0;
    border-radius: 6px;
    box-shadow: 0 0 1px rgba(0,0,0,.125), 0 1px 3px rgba(0,0,0,.1);
    margin-bottom: 1rem;
    /*overflow: hidden;*/ /* recorta los ribbons en la esquina */
}

.card-body {
    flex: 1 1 auto;
    padding: 0.75rem 1rem;
}

.card-header {
    padding: 0.5rem 1rem;
    margin-bottom: 0;
    background-color: rgba(0,0,0,.03);
    border-bottom: 1px solid rgba(0,0,0,.08);
    border-radius: 6px 6px 0 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-header:first-child {
    border-radius: 6px 6px 0 0;
}

.card-footer {
    padding: 0.5rem 1rem;
    background-color: rgba(0,0,0,.03);
    border-top: 1px solid rgba(0,0,0,.08);
    border-radius: 0 0 6px 6px;
}

.card-title {
    font-size: 0.95rem;
    font-weight: 600;
    margin: 0;
    float: left;
}

.card-tools {
    float: right;
    margin-right: -0.5rem;
}

.card-tools .btn {
    padding: 0 0.3rem;
}

/* Card colores */
.card-primary {
    border-top: 3px solid var(--primario, #284A70);
}
.card-primary > .card-header {
    background-color: var(--primario, #284A70);
    color: #fff;
    border-bottom: none;
}

.card-secondary {
    border-top: 3px solid #6c757d;
}

.card-info {
    border-top: 3px solid #17a2b8;
}

.card-success {
    border-top: 3px solid #28a745;
}

.card-warning {
    border-top: 3px solid #ffc107;
}

.card-danger {
    border-top: 3px solid #dc3545;
}

/* card-outline: solo borde superior, fondo header normal */
.card.card-outline {
    border-top: 3px solid;
}
.card.card-outline.card-primary {
    border-top-color: var(--primario, #284A70);
}
.card.card-outline.card-secondary {
    border-top-color: #6c757d;
}
.card.card-outline.card-info {
    border-top-color: #17a2b8;
}
.card.card-outline.card-success {
    border-top-color: #28a745;
}
.card.card-outline.card-dark {
    border-top-color: #343a40;
}
.card.card-outline > .card-header {
    background: transparent;
    color: inherit;
}

/* card-fluid: estira al 100% */
.card-fluid {
    border: 0;
    box-shadow: none;
}

/* maximized-card */
.maximized-card .card {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1100;
    margin: 0;
    border-radius: 0;
    height: 100vh !important;
    width: 100vw !important;
}

/* ════════════════════════════════════════════════════════════════════
   Overlay legacy (loading spinner)
   Mantenido para compatibilidad con el patrón antiguo:
     <div class="overlay-wrapper">
       <div class="overlay"><i class="fas fa-3x fa-sync-alt fa-spin"></i> Cargando...</div>
     </div>
   El ÍCONO ORIGINAL <i class="fa-sync-alt fa-spin"></i> SE OCULTA y en su lugar
   se inyecta el triple-anillo corporativo via ::before del .overlay.
   Así todas las páginas heredan el nuevo look sin cambiar ningún razor.
   ════════════════════════════════════════════════════════════════════ */
.overlay-wrapper {
    position: relative;
}

.overlay {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    color: #1e3a5f;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.3px;
    gap: 12px;
    animation: insi-overlay-fade 0.18s ease-out;
}

@keyframes insi-overlay-fade {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* Oculta el ícono FontAwesome del patrón antiguo */
.overlay > i.fa-sync-alt,
.overlay > i.fa-spin {
    display: none !important;
}

/* Inyecta el triple-anillo corporativo */
.overlay::before {
    content: '';
    display: block;
    position: relative;
    width: 64px;
    height: 64px;
    border: 3px solid transparent;
    border-top-color: #1e3a5f;
    border-right-color: rgba(30, 58, 95, 0.18);
    border-radius: 50%;
    animation: ovl-rot 1.6s linear infinite;
    box-shadow:
        inset 0  0 0 8px transparent,
        0 0 0 8px transparent;
}

.overlay::after {
    content: '';
    position: absolute;
    width: 48px;
    height: 48px;
    border: 3px solid transparent;
    border-top-color: #d4af37;
    border-left-color: rgba(212, 175, 55, 0.22);
    border-radius: 50%;
    animation: ovl-rot 2.2s linear infinite reverse;
    transform: translateY(8px);
}

@keyframes ovl-rot {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

/* Texto pulsante */
.overlay > .text-bold {
    animation: insi-text-pulse 1.4s ease-in-out infinite;
    font-weight: 600;
    color: #1e3a5f;
}

@keyframes insi-text-pulse {
    0%, 100% { opacity: 0.7; }
    50%      { opacity: 1; }
}

/* Cuando overlay está dentro de un card, cubre el card entero */
.card > .overlay,
.card-body > .overlay-wrapper > .overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(255,255,255,.7);
    z-index: 50;
    border-radius: inherit;
}

.overlay-wrapper-modal {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 50;
    border-radius: inherit;
}

.overlay-modal {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.82);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    color: #1e3a5f;
    font-size: 0.85rem;
    font-weight: 600;
    gap: 12px;
    z-index: 80;
}

/* Idem overlay legacy: ocultar el spinner FontAwesome viejo */
.overlay-modal > i.fa-sync-alt,
.overlay-modal > i.fa-spin {
    display: none !important;
}

.overlay-modal::before {
    content: '';
    display: block;
    width: 64px;
    height: 64px;
    border: 3px solid transparent;
    border-top-color: #1e3a5f;
    border-right-color: rgba(30, 58, 95, 0.18);
    border-radius: 50%;
    animation: ovl-rot 1.6s linear infinite;
}

.overlay-modal::after {
    content: '';
    position: absolute;
    width: 48px;
    height: 48px;
    border: 3px solid transparent;
    border-top-color: #d4af37;
    border-left-color: rgba(212, 175, 55, 0.22);
    border-radius: 50%;
    animation: ovl-rot 2.2s linear infinite reverse;
    top: calc(50% - 24px);
}

/* ---------- Loading overlay genérico (cargatrans) ---------- */
/* Patrón HTML:
   div.table-responsive / .modal-body / .card-body  (padre con position:relative)
     └─ div.d-flex.justify-content-center.cargatrans  (cubre el padre)
          └─ div.overlay-wrapper.cargatrans            (centrado con margin:auto)
               └─ div.overlay.cargatrans               (spinner + texto)
*/

/* El d-flex.cargatrans cubre su contenedor padre */
.d-flex.cargatrans,
.d-flex.justify-content-center:has(> .overlay-wrapper) {
    position: absolute;
    inset: 0;
    z-index: 50;
    background-color: rgba(255, 255, 255, 0.82);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    min-height: 120px;
    align-items: center;
    animation: insi-overlay-fade 0.18s ease-out;
}

/* Centrar el spinner en el overlay */
.d-flex.cargatrans > .overlay-wrapper,
.d-flex.justify-content-center > .overlay-wrapper {
    margin: auto;
}

.d-flex.cargatrans > .overlay-wrapper > .overlay,
.d-flex.justify-content-center > .overlay-wrapper > .overlay {
    padding: 1.5rem 2rem;
}

/* Contenedores que necesitan position:relative para que el overlay se acople */
.table-responsive,
.modal-body,
.modal-content,
.card-body {
    position: relative;
}

/* cargatrans: hijos transparentes (el fondo lo pone el d-flex padre) */
.overlay.cargatrans,
.overlay-wrapper.cargatrans {
    background-color: transparent;
}

/* ---------- Auth Loading (MainLayout) ---------- */
.insi-auth-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100vh;
    gap: 12px;
    color: var(--primario, #284A70);
    font-size: 0.9rem;
    font-weight: 500;
    background: #f6f7fa;
}

.insi-auth-loading i {
    color: var(--primario, #284A70);
}

/* ---------- Insi Loading inline (reutilizable) ---------- */
.insi-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 32px 16px;
    color: #6b7280;
    font-size: 0.875rem;
}

.insi-loading i {
    color: var(--primario, #284A70);
}

/* ---------- Small box (Dashboard) ---------- */
.small-box {
    border-radius: 6px;
    box-shadow: 0 0 1px rgba(0,0,0,.125), 0 1px 3px rgba(0,0,0,.1);
    display: block;
    margin-bottom: 1rem;
    position: relative;
    color: #fff;
    overflow: hidden;
}

.small-box > .inner {
    padding: 10px;
}

.small-box > .inner h3 {
    font-size: 2rem;
    font-weight: 700;
    margin: 0 0 5px 0;
    padding: 0;
    white-space: nowrap;
}

.small-box > .inner p {
    font-size: 0.9rem;
    margin: 0;
}

.small-box > .icon {
    position: absolute;
    top: 5px;
    right: 10px;
    font-size: 70px;
    color: rgba(0,0,0,.15);
    z-index: 0;
    transition: transform 0.3s linear;
}

.small-box:hover > .icon {
    transform: scale(1.1);
}

.small-box > .small-box-footer {
    display: block;
    padding: 3px 0;
    text-align: center;
    color: rgba(255,255,255,.8);
    background: rgba(0,0,0,.1);
    text-decoration: none;
    font-size: 0.85rem;
}

.small-box > .small-box-footer:hover {
    color: #fff;
    background: rgba(0,0,0,.15);
}

/* ---------- Info box (Dashboard) ---------- */
.info-box {
    display: flex;
    min-height: 80px;
    padding: 0.5rem;
    background: #fff;
    border-radius: 6px;
    box-shadow: 0 0 1px rgba(0,0,0,.125), 0 1px 3px rgba(0,0,0,.1);
    margin-bottom: 1rem;
    align-items: center;
}

.info-box.bg-gray {
    background: #adb5bd;
    color: #fff;
}

.info-box.bg-info {
    background: #17a2b8;
    color: #fff;
}

.info-box-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 70px;
    height: 70px;
    border-radius: 6px;
    font-size: 1.8rem;
    text-align: center;
}

.info-box-content {
    flex: 1;
    padding: 5px 10px;
}

.info-box-text {
    display: block;
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-transform: uppercase;
}

.info-box-number {
    display: block;
    font-size: 0.9rem;
    font-weight: 700;
}

/* ---------- Elevation ---------- */
.elevation-1 { box-shadow: 0 1px 3px rgba(0,0,0,.12), 0 1px 2px rgba(0,0,0,.24); }
.elevation-2 { box-shadow: 0 3px 6px rgba(0,0,0,.16), 0 3px 6px rgba(0,0,0,.23); }
.elevation-3 { box-shadow: 0 10px 20px rgba(0,0,0,.19), 0 6px 6px rgba(0,0,0,.23); }
.elevation-4 { box-shadow: 0 14px 28px rgba(0,0,0,.25), 0 10px 10px rgba(0,0,0,.22); }

/* ---------- Background colors (AdminLTE) ---------- */
.bg-primary { background-color: var(--primario, #284A70) !important; color: #fff !important; }
.bg-secondary { background-color: #6c757d !important; color: #fff !important; }
.bg-success { background-color: #28a745 !important; color: #fff !important; }
.bg-info { background-color: #17a2b8 !important; color: #fff !important; }
.bg-warning { background-color: #ffc107 !important; color: #1f2d3d !important; }
.bg-danger { background-color: #dc3545 !important; color: #fff !important; }
.bg-gray { background-color: #adb5bd !important; color: #1f2d3d !important; }
.bg-gray-dark { background-color: #343a40 !important; color: #fff !important; }

/* ---------- Text helpers ---------- */
.text-bold { font-weight: 700; }
.font-weight-light { font-weight: 300 !important; }

/* ---------- Breadcrumb ---------- */
/* Base breadcrumb (Bootstrap 4 compatible) — se usa tanto como
   navegación (ol.breadcrumb) como wrapper de toolbar (div.breadcrumb) */
.breadcrumb {
    display: flex;
    flex-wrap: wrap;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    list-style: none;
    background-color: #f4f6f9;
    border-radius: 0.25rem;
    font-size: 0.875rem;
    align-items: center;
}

/* Dentro de content-header: transparente, sin padding, sin margin
   — así funciona como wrapper invisible para toolbar y breadcrumb real */
.content-header .breadcrumb {
    background-color: transparent;
    line-height: 1.8rem;
    margin-bottom: 0;
    padding: 0;
    gap: 6px; /* separación entre botones del toolbar */
    align-items: center;
}

.breadcrumb-item + .breadcrumb-item {
    padding-left: 0.5rem;
}

.breadcrumb-item + .breadcrumb-item::before {
    float: left;
    padding-right: 0.5rem;
    color: #6c757d;
    content: "/";
}

.breadcrumb-item.active {
    color: #6c757d;
}

/* ---------- Dropdown ---------- */
.dropdown-menu {
    font-size: 0.875rem;
    border: 0;
    box-shadow: 0 2px 12px rgba(0,0,0,.15);
    border-radius: 6px;
}

.dropdown-menu-lg {
    min-width: 280px;
    max-width: 300px;
    padding: 0;
}

.dropdown-menu-right {
    right: 0;
    left: auto;
}

.dropdown-item {
    padding: 0.4rem 1rem;
    font-size: 0.875rem;
}

.dropdown-header {
    font-size: 0.875rem;
    font-weight: 600;
    padding: 0.5rem 1rem;
}

.dropdown-footer {
    display: block;
    padding: 0.5rem 1rem;
    text-align: center;
    font-size: 0.85rem;
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
    border-radius: 0 0 6px 6px;
}

.dropdown-divider {
    margin: 0;
    border-top: 1px solid #e9ecef;
}

/* ---------- Badge ---------- */
.badge {
    display: inline-block;
    padding: 0.25em 0.5em;
    font-size: 75%;
    font-weight: 700;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: 4px;
}

.badge-primary { background-color: var(--primario, #284A70); color: #fff; }
.badge-secondary { background-color: #6c757d; color: #fff; }
.badge-success { background-color: #28a745; color: #fff; }
.badge-info { background-color: #17a2b8; color: #fff; }
.badge-warning { background-color: #ffc107; color: #212529; }
.badge-danger { background-color: #dc3545; color: #fff; }

/* ---------- Pagination ---------- */
.pagination {
    display: flex;
    padding-left: 0;
    list-style: none;
    border-radius: 4px;
}

.page-item .page-link {
    position: relative;
    display: block;
    padding: 0.3rem 0.6rem;
    margin-left: -1px;
    line-height: 1.25;
    color: var(--primario, #284A70);
    background-color: #fff;
    border: 1px solid #dee2e6;
    font-size: 0.85rem;
}

.page-item.active .page-link {
    z-index: 3;
    color: #fff;
    background-color: var(--primario, #284A70);
    border-color: var(--primario, #284A70);
}

.page-item.disabled .page-link {
    color: #6c757d;
    pointer-events: none;
    background-color: #fff;
    border-color: #dee2e6;
}

.page-link:hover {
    color: var(--primario, #284A70);
    text-decoration: none;
    background-color: #e9ecef;
    border-color: #dee2e6;
}

/* ---------- Table ---------- */
.table-responsive {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* ---------- SR only ---------- */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border: 0;
}

/* ---------- Toast (AdminLTE) ---------- */
.toast {
    max-width: 350px;
    overflow: hidden;
    font-size: 0.875rem;
    background: #fff;
    border: 1px solid rgba(0,0,0,.1);
    border-radius: 6px;
    box-shadow: 0 2px 12px rgba(0,0,0,.15);
}

.toast-header {
    display: flex;
    align-items: center;
    padding: 0.4rem 0.75rem;
    background: rgba(0,0,0,.03);
    border-bottom: 1px solid rgba(0,0,0,.05);
}

.toast-body {
    padding: 0.75rem;
}

/* ---------- Form control (refuerzo si bootstrap no lo cubre) ---------- */
.form-control {
    border-radius: 4px;
    border: 1px solid #ced4da;
    font-size: 0.875rem;
    padding: 0.375rem 0.75rem;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.form-control:focus {
    border-color: var(--primario, #284A70);
    box-shadow: 0 0 0 0.15rem rgba(40,74,112,.25);
    outline: 0;
}

/* ---------- Input group (refuerzo) ---------- */
.input-group {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    width: 100%;
}

.input-group > .form-control {
    position: relative;
    flex: 1 1 auto;
    width: 1%;
    min-width: 0;
}

.input-group-append {
    display: flex;
    margin-left: -1px;
}

.input-group-prepend {
    display: flex;
    margin-right: -1px;
}

.input-group-sm > .form-control {
    height: calc(1.5em + 0.5rem + 2px);
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
}

/* ---------- Scrollbar global ---------- */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

/* ---------- Nav pills (sidebar) ---------- */
.nav-pills .nav-link.active {
    background-color: var(--primario, #284A70);
    color: #fff;
}

/* ---------- Misc AdminLTE helpers ---------- */
.container-modulo {
    overflow-y: auto;
}

.container-fluid {
    width: 100%;
    padding-right: 7.5px;
    padding-left: 7.5px;
    margin-right: auto;
    margin-left: auto;
}

/* ---------- Buttons — alineados con InsiButton (insi-base.css) ---------- */
/* Base: cualquier .btn hereda el mismo lenguaje visual que .insi-btn */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 500;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    line-height: 1.5;
}

.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-xs { padding: 3px 6px; font-size: 11px; line-height: 1.4; margin-right: 3px; }
.btn-sm { padding: 4px 10px; font-size: 12px; margin-right: 3px; }
.btn-lg { padding: 8px 20px; font-size: 15px; }

/* Variantes de color — mismos valores que insi-btn-* */
.btn-primary { background: var(--primario, #284A70); color: #fff; border: none; }
.btn-primary:hover:not(:disabled) { filter: brightness(0.9); color: #fff; }
.btn-primary:focus { box-shadow: 0 0 0 2px rgba(40, 74, 112, 0.3); color: #fff; }

.btn-secondary { background: var(--secundario, #fe7800); color: #fff; border: none; }
.btn-secondary:hover:not(:disabled) { filter: brightness(0.9); color: #fff; }
.btn-secondary:focus { box-shadow: 0 0 0 2px rgba(254, 120, 0, 0.3); color: #fff; }

.btn-success { background: #28a745; color: #fff; border: none; }
.btn-success:hover:not(:disabled) { filter: brightness(0.9); color: #fff; }
.btn-success:focus { box-shadow: 0 0 0 2px rgba(40, 167, 69, 0.3); color: #fff; }

.btn-danger { background: #dc3545; color: #fff; border: none; }
.btn-danger:hover:not(:disabled) { filter: brightness(0.9); color: #fff; }
.btn-danger:focus { box-shadow: 0 0 0 2px rgba(220, 53, 69, 0.3); color: #fff; }

.btn-warning { background: #ffc107; color: #212529; border: none; }
.btn-warning:hover:not(:disabled) { filter: brightness(0.9); }
.btn-warning:focus { box-shadow: 0 0 0 2px rgba(255, 193, 7, 0.3); }

.btn-info { background: #17a2b8; color: #fff; border: none; }
.btn-info:hover:not(:disabled) { filter: brightness(0.9); color: #fff; }
.btn-info:focus { box-shadow: 0 0 0 2px rgba(23, 162, 184, 0.3); color: #fff; }

.btn-link { background: transparent; color: var(--primario, #284A70); text-decoration: underline; border: none; }
.btn-link:hover:not(:disabled) { color: var(--secundario, #fe7800); }

.btn-outline-primary { background: transparent; color: var(--primario, #284A70); border: 1px solid var(--primario, #284A70); }
.btn-outline-primary:hover:not(:disabled) { background: var(--primario, #284A70); color: #fff; }

.btn-outline-secondary { background: transparent; color: var(--secundario, #fe7800); border: 1px solid var(--secundario, #fe7800); }
.btn-outline-secondary:hover:not(:disabled) { background: var(--secundario, #fe7800); color: #fff; }

.btn-outline-danger { background: transparent; color: #dc3545; border: 1px solid #dc3545; }
.btn-outline-danger:hover:not(:disabled) { background: #dc3545; color: #fff; }

/* btn-flat: quitar border-radius */
.btn-flat {
    border-radius: 0;
}

/* btn-default: Bootstrap 3 legacy — equivale a btn-light */
.btn-default {
    color: #444;
    background-color: #f8f9fa;
    border: 1px solid #ddd !important;
}
    .btn-default:hover {
        background-color: #e9ecef;
        border: 1px solid #ccc !important;
    }

/* main-footer (por si se usa en el futuro) */
.main-footer {
    padding: 0.5rem 1rem;
    background: #fff;
    border-top: 1px solid #dee2e6;
    font-size: 0.85rem;
    color: #869099;
}

/* ---------- Label de campo (para estandarizar nombres de campos en formularios) ---------- */
/* Usar: <label class="field-label">Tipo de Documento</label> */
.field-label {
    font-weight: 600;
    font-size: 0.85rem;
    color: #495057;
    margin-bottom: 2px;
}

/* ---------- Content > content (AdminLTE inner content) ---------- */
.content-wrapper > .content {
    padding: 0 0.5rem;
}

/* ---------- Ribbon (esquina de documentos) ---------- */
.ribbon-wrapper {
    height: 70px;
    overflow: hidden;
    position: absolute;
    right: -2px;
    top: -2px;
    width: 70px;
    z-index: 10;
}

.ribbon-wrapper.ribbon-lg {
    height: 120px;
    width: 120px;
}

.ribbon-wrapper.ribbon-lg .ribbon {
    right: 0;
    top: 26px;
    width: 160px;
}

.ribbon-wrapper.ribbon-xl {
    height: 180px;
    width: 180px;
}

.ribbon-wrapper.ribbon-xl .ribbon {
    right: 4px;
    top: 47px;
    width: 240px;
}

.ribbon-wrapper .ribbon {
    box-shadow: 0 0 3px rgba(0, 0, 0, 0.3);
    font-size: 0.8rem;
    line-height: 100%;
    padding: 0.375rem 0;
    position: relative;
    right: -2px;
    text-align: center;
    text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.4);
    text-transform: uppercase;
    top: 10px;
    transform: rotate(45deg);
    width: 90px;
}

.ribbon-wrapper .ribbon::before,
.ribbon-wrapper .ribbon::after {
    border-left: 3px solid transparent;
    border-right: 3px solid transparent;
    border-top: 3px solid #9e9e9e;
    bottom: -3px;
    content: "";
    position: absolute;
}

.ribbon-wrapper .ribbon::before {
    left: 0;
}

.ribbon-wrapper .ribbon::after {
    right: 0;
}

/* ---------- Override sfcardfooter ---------- */
/* Antes usaba position:absolute, ahora queda en flow dentro del flex card */
.sfcardfooter {
    position: relative !important;
    bottom: auto !important;
}

/* ---------- Override cardnewf ---------- */
/* Ya no necesita padding-bottom porque el footer está en flex flow */
.cardnewf {
    padding-bottom: 0 !important;
}

/* ---------- Tablas de detalle (Components) sin líneas verticales ---------- */
.table.table-bordered > thead > tr > th,
.table.table-bordered > thead > tr > td,
.table.table-bordered > tbody > tr > th,
.table.table-bordered > tbody > tr > td {
    border-left: none !important;
    border-right: none !important;
}

/* ---------- Botón Adjuntar (btn-file) ---------- */
/* Oculta el input nativo y estiliza como botón limpio */
.btn-file {
    position: relative;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}
.btn-file input[type="file"] {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    opacity: 0 !important;
    cursor: pointer !important;
    z-index: 2;
    margin: 0 !important;
    padding: 0 !important;
    font-size: 0 !important;
}
