/**
 * Tema visual del sistema STA — moderno, sobrio y accesible.
 *
 * Autor: Juan Morel (jcmorelm@mvisual.cl)
 */

:root {
    --sta-primario: #006983;
    --sta-primario-hover: #004d61;
    --sta-acento: #5ab7d4;
    --sta-acento-suave: rgba(90, 183, 212, 0.16);
    --sta-secundario: #495057;
    --sta-info: #087990;
    --sta-info-hover: #055160;
    --sta-exito: #157347;
    --sta-exito-hover: #0f5132;
    --sta-advertencia: #b45309;
    --sta-advertencia-hover: #92400e;
    --sta-peligro: #b10000;
    --sta-peligro-hover: #8b0000;
    --sta-texto-oscuro: #212529;
    --sta-texto-suave: #495057;
    --sta-superficie: #ffffff;
    --sta-radius-sm: 8px;
    --sta-radius: 12px;
    --sta-radius-lg: 16px;
    --sta-radius-xl: 20px;
    --sta-transicion: 0.18s ease;
    --sta-footer-height: 2.75rem;
    --bs-border-radius: 12px;
    --bs-border-radius-sm: 8px;
    --bs-border-radius-lg: 16px;
    --bs-border-radius-xl: 20px;
    --bs-border-radius-pill: 999px;
}

:root,
[data-sta-tema="oscuro"] {
    color-scheme: dark;
    --sta-texto-sobre-fondo: #e2e8f0;
    --sta-texto-suave-sobre-fondo: #cbd5e1;
    --sta-enlace-sobre-fondo: #7dd3fc;
    --sta-fondo-1: #000000;
    --sta-fondo-2: #1b1719;
    --sta-fondo-3: #2d272e;
    --sta-fondo-4: #3b3946;
    --sta-fondo-5: #454d60;
    --sta-superficie-borde: rgba(255, 255, 255, 0.08);
    --sta-cromo-fondo: #000000;
    --sta-cromo-texto: #ffffff;
    --sta-cromo-texto-hover: #ffffff;
    --sta-cromo-superficie: rgba(255, 255, 255, 0.08);
    --sta-cromo-superficie-hover: rgba(255, 255, 255, 0.06);
    --sta-cromo-borde: rgba(255, 255, 255, 0.08);
    --sta-cromo-icono-fondo: rgba(255, 255, 255, 0.08);
    --sta-nav-hover-fondo: rgba(255, 255, 255, 0.06);
    --sta-nav-activo-fondo: rgba(0, 105, 131, 0.55);
    --sta-sombra-header: 0 4px 20px rgba(0, 0, 0, 0.28);
    --sta-footer-fondo: linear-gradient(to top, var(--sta-fondo-1), rgba(27, 23, 25, 0.96));
    --sta-shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.12);
    --sta-shadow-md: 0 8px 24px rgba(0, 0, 0, 0.18);
    --sta-shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.24);
    --sta-toggler-icon: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255, 255, 255, 0.9%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
    --sta-badge-mvisual-fondo: rgba(90, 183, 212, 0.16);
    --sta-badge-mvisual-borde: rgba(90, 183, 212, 0.35);
    --sta-badge-mvisual-texto: var(--sta-acento);
    --sta-badge-mvisual-hover-fondo: rgba(90, 183, 212, 0.28);
    --sta-badge-mvisual-hover-texto: #ffffff;
    --sta-badge-mvisual-hover-borde: rgba(90, 183, 212, 0.55);
}

[data-sta-tema="claro"] {
    color-scheme: light;
    --sta-texto-sobre-fondo: #1e293b;
    --sta-texto-suave-sobre-fondo: #475569;
    --sta-enlace-sobre-fondo: #006983;
    --sta-fondo-1: #f8fafc;
    --sta-fondo-2: #f1f5f9;
    --sta-fondo-3: #e8eef4;
    --sta-fondo-4: #dfe7ef;
    --sta-fondo-5: #d5e0ea;
    --sta-superficie-borde: rgba(15, 23, 42, 0.08);
    --sta-cromo-fondo: #ffffff;
    --sta-cromo-texto: #0f172a;
    --sta-cromo-texto-hover: #006983;
    --sta-cromo-superficie: rgba(0, 105, 131, 0.06);
    --sta-cromo-superficie-hover: rgba(0, 105, 131, 0.1);
    --sta-cromo-borde: rgba(15, 23, 42, 0.1);
    --sta-cromo-icono-fondo: rgba(0, 105, 131, 0.08);
    --sta-nav-hover-fondo: rgba(0, 105, 131, 0.06);
    --sta-nav-activo-fondo: rgba(0, 105, 131, 0.12);
    --sta-sombra-header: 0 4px 18px rgba(15, 23, 42, 0.08);
    --sta-footer-fondo: linear-gradient(to top, #ffffff, rgba(248, 250, 252, 0.98));
    --sta-shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.06);
    --sta-shadow-md: 0 8px 24px rgba(15, 23, 42, 0.08);
    --sta-shadow-lg: 0 16px 40px rgba(15, 23, 42, 0.1);
    --sta-toggler-icon: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%2815, 23, 42, 0.82%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
    --sta-badge-mvisual-fondo: rgba(0, 105, 131, 0.08);
    --sta-badge-mvisual-borde: rgba(0, 105, 131, 0.18);
    --sta-badge-mvisual-texto: var(--sta-primario);
    --sta-badge-mvisual-hover-fondo: rgba(0, 105, 131, 0.14);
    --sta-badge-mvisual-hover-texto: #004d61;
    --sta-badge-mvisual-hover-borde: rgba(0, 105, 131, 0.28);
}

/* ------------------------------------------------------------------ */
/* Base y layout                                                       */
/* ------------------------------------------------------------------ */

html {
    scroll-behavior: smooth;
}

body.sta-app,
body.sta-auth {
    --tblr-body-bg: var(--sta-fondo-1);
    --bs-body-bg: var(--sta-fondo-1);
    background-color: var(--sta-fondo-1);
    background-image: linear-gradient(to bottom, var(--sta-fondo-1), var(--sta-fondo-2), var(--sta-fondo-3), var(--sta-fondo-4), var(--sta-fondo-5));
    background-attachment: fixed;
    background-size: cover;
    background-repeat: no-repeat;
    min-height: 100vh;
    color: var(--sta-texto-sobre-fondo);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body.sta-auth {
    display: flex;
    align-items: center;
    justify-content: center;
}

.sta-shell {
    width: 90%;
    max-width: none;
    margin-left: auto;
    margin-right: auto;
    padding-left: 0.75rem;
    padding-right: 0.75rem;
}

.sta-site-header {
    position: sticky;
    top: 0;
    z-index: 1030;
    width: 100%;
    background-color: var(--sta-cromo-fondo);
    background-image: none;
    box-shadow: var(--sta-sombra-header);
}

.sta-header-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-height: 4rem;
    padding: 0.35rem 0;
    background: transparent;
}

@media (min-width: 1200px) {
    .sta-header-bar {
        flex-wrap: nowrap;
    }

    .sta-header-nav.collapse {
        display: flex !important;
        height: auto !important;
        visibility: visible !important;
    }
}

body.sta-app .navbar,
body.sta-app .sta-header-bar.navbar {
    background-color: transparent !important;
    --bs-navbar-bg: transparent;
    box-shadow: none;
}

.sta-main {
    padding-top: 1.25rem;
    padding-bottom: var(--sta-footer-height);
    min-height: calc(100vh - var(--sta-footer-height));
    background: transparent;
}

.bg-gradient-dark {
    background-image: linear-gradient(to right, var(--sta-fondo-1), var(--sta-fondo-2), var(--sta-fondo-3), var(--sta-fondo-4), var(--sta-fondo-5));
}

.money {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* ------------------------------------------------------------------ */
/* Cabecera de marca                                                   */
/* ------------------------------------------------------------------ */

.sta-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    flex: 0 0 auto;
    min-width: 0;
    text-decoration: none;
    color: inherit;
}

.sta-brand:hover {
    color: var(--sta-cromo-texto-hover);
    text-decoration: none;
}

.sta-brand-name {
    display: block;
    color: var(--sta-cromo-texto);
    font-size: clamp(0.9rem, 1.4vw, 1.15rem);
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: -0.02em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 16rem;
}

.sta-header-toggler {
    display: none;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    margin-left: auto;
    padding: 0;
    border: 1px solid var(--sta-cromo-borde);
    border-radius: 10px;
    background: var(--sta-cromo-superficie);
    color: var(--sta-cromo-texto);
}

.sta-header-toggler-icon {
    display: block;
    width: 1.25rem;
    height: 1.25rem;
    background-image: var(--sta-toggler-icon);
    background-repeat: no-repeat;
    background-position: center;
    background-size: 100%;
}

.sta-header-nav {
    flex: 1 1 auto;
    min-width: 0;
}

.sta-header-menu {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: center;
    gap: 0.15rem;
    margin: 0;
    padding: 0;
}

.sta-header-user {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    flex: 0 0 auto;
    margin-left: auto;
}

.sta-user-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.7rem;
    border-radius: var(--sta-radius-pill);
    background: var(--sta-cromo-superficie);
    border: 1px solid var(--sta-cromo-borde);
    color: var(--sta-cromo-texto);
    font-size: 0.8125rem;
    max-width: 14rem;
}

.sta-user-chip .ti {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.45rem;
    height: 1.45rem;
    border-radius: 999px;
    background: rgba(90, 183, 212, 0.18);
    font-size: 0.9rem;
    flex-shrink: 0;
}

.sta-user-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sta-logout-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 10px;
    background: var(--sta-cromo-superficie);
    border: 1px solid var(--sta-cromo-borde);
    color: var(--sta-cromo-texto);
    text-decoration: none;
    transition: background-color var(--sta-transicion), color var(--sta-transicion);
}

.sta-logout-btn:hover {
    background: rgba(177, 0, 0, 0.85);
    border-color: rgba(177, 0, 0, 0.85);
    color: #fff;
}

.sta-logout-btn .ti {
    font-size: 1rem;
}

h1.text-white,
h2.text-white,
h3.text-white,
.sta-page-title {
    color: var(--sta-texto-sobre-fondo) !important;
    font-size: 1.2rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    margin-bottom: 0.75rem;
}

.login-container h1.text-white,
.sta-install-wrap h1.text-white {
    color: var(--sta-texto-sobre-fondo) !important;
}

h2.text-white .ti,
h3.text-white .ti,
.sta-page-title .ti {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    margin-right: 0.45rem;
    border-radius: 10px;
    background: var(--sta-acento-suave);
    color: var(--sta-acento);
    vertical-align: middle;
}

/* ------------------------------------------------------------------ */
/* Navegación del header (una sola línea)                              */
/* ------------------------------------------------------------------ */

.sta-header-nav .nav-link {
    display: inline-flex;
    align-items: center;
    gap: 0.15rem;
    padding: 0.4rem 0.6rem;
    border-radius: var(--sta-radius-sm);
    font-size: 0.8125rem;
    font-weight: 500;
    white-space: nowrap;
    color: var(--sta-cromo-texto);
    transition: background-color var(--sta-transicion), color var(--sta-transicion);
}

.sta-header-nav .nav-link .ti {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 8px;
    background: var(--sta-cromo-icono-fondo);
    margin-right: 0.25rem;
    font-size: 0.9rem;
    transition: background-color var(--sta-transicion), color var(--sta-transicion);
}

.sta-header-nav .nav-link:hover {
    background: var(--sta-nav-hover-fondo);
    color: var(--sta-cromo-texto-hover);
}

.sta-header-nav .nav-link:hover .ti {
    background: rgba(90, 183, 212, 0.22);
}

.sta-header-nav .nav-item.active .nav-link {
    background: var(--sta-nav-activo-fondo);
    color: var(--sta-cromo-texto);
    font-weight: 600;
}

.sta-header-nav .nav-item.active .nav-link .ti {
    background: var(--sta-acento);
    color: #fff;
}

.navbar-nav .nav-link,
.navbar-nav .nav-link .ti,
.navbar-nav .nav-link .ti::before {
    color: var(--sta-cromo-texto);
}

.user-info,
.user-info .ti {
    color: var(--sta-cromo-texto);
}

/* ------------------------------------------------------------------ */
/* Botones                                                             */
/* ------------------------------------------------------------------ */

.btn {
    border-radius: var(--sta-radius);
    font-weight: 500;
    transition: transform var(--sta-transicion), box-shadow var(--sta-transicion), background-color var(--sta-transicion), border-color var(--sta-transicion);
}

.btn:active {
    transform: translateY(1px);
}

.btn-primary {
    --bs-btn-bg: var(--sta-primario);
    --bs-btn-border-color: var(--sta-primario);
    --bs-btn-color: #fff;
    --bs-btn-hover-bg: var(--sta-primario-hover);
    --bs-btn-hover-border-color: var(--sta-primario-hover);
    --bs-btn-hover-color: #fff;
    --bs-btn-active-bg: var(--sta-primario-hover);
    --bs-btn-active-border-color: var(--sta-primario-hover);
    --bs-btn-active-color: #fff;
    --bs-btn-disabled-bg: var(--sta-primario);
    --bs-btn-disabled-border-color: var(--sta-primario);
    --bs-btn-disabled-color: #fff;
}

.btn-info {
    --bs-btn-bg: var(--sta-info);
    --bs-btn-border-color: var(--sta-info);
    --bs-btn-color: #fff;
    --bs-btn-hover-bg: var(--sta-info-hover);
    --bs-btn-hover-border-color: var(--sta-info-hover);
    --bs-btn-hover-color: #fff;
    --bs-btn-active-bg: var(--sta-info-hover);
    --bs-btn-active-border-color: var(--sta-info-hover);
    --bs-btn-active-color: #fff;
}

.btn-success {
    --bs-btn-bg: var(--sta-exito);
    --bs-btn-border-color: var(--sta-exito);
    --bs-btn-color: #fff;
    --bs-btn-hover-bg: var(--sta-exito-hover);
    --bs-btn-hover-border-color: var(--sta-exito-hover);
    --bs-btn-hover-color: #fff;
}

.btn-warning {
    --bs-btn-bg: var(--sta-advertencia);
    --bs-btn-border-color: var(--sta-advertencia);
    --bs-btn-color: #fff;
    --bs-btn-hover-bg: var(--sta-advertencia-hover);
    --bs-btn-hover-border-color: var(--sta-advertencia-hover);
    --bs-btn-hover-color: #fff;
}

.btn-danger {
    --bs-btn-bg: var(--sta-peligro);
    --bs-btn-border-color: var(--sta-peligro);
    --bs-btn-color: #fff;
    --bs-btn-hover-bg: var(--sta-peligro-hover);
    --bs-btn-hover-border-color: var(--sta-peligro-hover);
    --bs-btn-hover-color: #fff;
}

.btn-secondary {
    --bs-btn-bg: var(--sta-secundario);
    --bs-btn-border-color: var(--sta-secundario);
    --bs-btn-color: #fff;
    --bs-btn-hover-bg: #343a40;
    --bs-btn-hover-border-color: #343a40;
    --bs-btn-hover-color: #fff;
}

.btn-outline-primary {
    --bs-btn-color: var(--sta-primario);
    --bs-btn-border-color: var(--sta-primario);
    --bs-btn-hover-bg: var(--sta-primario);
    --bs-btn-hover-border-color: var(--sta-primario);
    --bs-btn-hover-color: #fff;
}

.btn-outline-info {
    --bs-btn-color: var(--sta-info);
    --bs-btn-border-color: var(--sta-info);
    --bs-btn-hover-bg: var(--sta-info);
    --bs-btn-hover-border-color: var(--sta-info);
    --bs-btn-hover-color: #fff;
}

.btn-outline-success {
    --bs-btn-color: var(--sta-exito);
    --bs-btn-border-color: var(--sta-exito);
    --bs-btn-hover-bg: var(--sta-exito);
    --bs-btn-hover-border-color: var(--sta-exito);
    --bs-btn-hover-color: #fff;
}

.btn-outline-warning {
    --bs-btn-color: var(--sta-advertencia);
    --bs-btn-border-color: var(--sta-advertencia);
    --bs-btn-hover-bg: var(--sta-advertencia);
    --bs-btn-hover-border-color: var(--sta-advertencia);
    --bs-btn-hover-color: #fff;
}

.btn-outline-danger {
    --bs-btn-color: var(--sta-peligro);
    --bs-btn-border-color: var(--sta-peligro);
    --bs-btn-hover-bg: var(--sta-peligro);
    --bs-btn-hover-border-color: var(--sta-peligro);
    --bs-btn-hover-color: #fff;
}

.btn-outline-secondary {
    --bs-btn-color: #495057;
    --bs-btn-border-color: #6c757d;
    --bs-btn-hover-bg: #6c757d;
    --bs-btn-hover-border-color: #6c757d;
    --bs-btn-hover-color: #fff;
}

.btn .ti,
.btn .ti::before {
    color: inherit;
    opacity: 1;
}

.btn-lg.py-4,
.sta-cta-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding-top: 1.25rem !important;
    padding-bottom: 1.25rem !important;
    border-radius: var(--sta-radius-lg);
    box-shadow: var(--sta-shadow-sm);
}

.btn-lg.py-4:hover,
.sta-cta-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--sta-shadow-md);
}

.btn-lg.py-4 .ti,
.sta-cta-btn .ti {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.18);
    margin-right: 0 !important;
}

/* Solo iconos de acción en tablas (no toolbar con texto) */
.table .btn-sm,
.table .btn-group .btn-sm {
    width: 2.1rem;
    height: 2.1rem;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
}

.table .btn-sm .ti,
.table .btn-group .btn-sm .ti {
    margin: 0;
    font-size: 1rem;
}

/* Botones con texto en cabeceras de tarjeta y barras de acción */
.card-header .btn-group,
.text-end > .btn-group,
.card-header .sta-toolbar,
.sta-toolbar {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.card-header .btn-group > .btn,
.text-end > .btn-group > .btn,
.card-header .sta-toolbar > .btn,
.card-header > .btn.btn-sm,
.sta-toolbar > .btn {
    width: auto !important;
    height: auto !important;
    min-height: 2rem;
    padding: 0.4rem 0.9rem !important;
    white-space: nowrap;
    font-weight: 600;
    border-radius: var(--sta-radius-sm) !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
}

.card-header .btn-group > .btn .ti,
.text-end > .btn-group > .btn .ti,
.card-header .sta-toolbar > .btn .ti,
.card-header > .btn .ti,
.sta-toolbar > .btn .ti {
    margin-right: 0.25rem;
    font-size: 1rem;
    width: auto;
    height: auto;
    background: transparent;
    color: inherit;
}

/* Contraste garantizado sobre card-header oscuro */
.card-header .btn-light,
.card-header .sta-toolbar .btn-light {
    color: var(--sta-primario) !important;
    background-color: #fff !important;
    border-color: #fff !important;
}

.card-header .btn-light:hover,
.card-header .btn-light:focus,
.card-header .sta-toolbar .btn-light:hover,
.card-header .sta-toolbar .btn-light:focus {
    color: var(--sta-primario-hover) !important;
    background-color: #f1f5f9 !important;
    border-color: #f1f5f9 !important;
}

.card-header .btn-primary,
.card-header .sta-toolbar .btn-primary,
.card-header > .btn-primary {
    color: #fff !important;
    background-color: var(--sta-acento) !important;
    border-color: #4aa3bc !important;
}

.card-header .btn-primary:hover,
.card-header .btn-primary:focus,
.card-header .sta-toolbar .btn-primary:hover,
.card-header .sta-toolbar .btn-primary:focus,
.card-header > .btn-primary:hover,
.card-header > .btn-primary:focus {
    color: #fff !important;
    background-color: #48a9c4 !important;
    border-color: #48a9c4 !important;
}

.card-header .btn-outline-primary,
.card-header .btn-outline-info,
.card-header .btn-outline-success,
.card-header .btn-outline-warning,
.card-header .btn-outline-danger,
.card-header .btn-outline-secondary {
    color: #fff !important;
    border-color: rgba(255, 255, 255, 0.85) !important;
    background-color: rgba(255, 255, 255, 0.12) !important;
}

.card-header .btn-outline-primary:hover,
.card-header .btn-outline-info:hover,
.card-header .btn-outline-success:hover,
.card-header .btn-outline-warning:hover,
.card-header .btn-outline-danger:hover,
.card-header .btn-outline-secondary:hover {
    color: var(--sta-primario) !important;
    background-color: #fff !important;
    border-color: #fff !important;
}

.card-header .btn-success,
.card-header .btn-danger,
.card-header .btn-warning,
.card-header .btn-info,
.card-header .btn-secondary {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
}

/* ------------------------------------------------------------------ */
/* Tarjetas y superficies                                              */
/* ------------------------------------------------------------------ */

.card {
    border: none;
    margin-bottom: 1rem;
    border-radius: var(--sta-radius-lg);
    box-shadow: var(--sta-shadow-sm);
    overflow: hidden;
    background: var(--sta-superficie);
    transition: box-shadow var(--sta-transicion), transform var(--sta-transicion);
}

.card:hover {
    box-shadow: var(--sta-shadow-md);
}

.card-header {
    background: linear-gradient(135deg, var(--sta-primario), #005a72);
    color: #fff;
    font-weight: 600;
    border-bottom: 0;
    padding: 1rem 1.25rem;
}

.card-header .form-label {
    color: rgba(255, 255, 255, 0.92);
    font-size: 0.8125rem;
    font-weight: 500;
    margin-bottom: 0.35rem;
}

.card-header .form-control,
.card-header .form-select {
    border: 0;
    border-radius: var(--sta-radius-sm);
    box-shadow: none;
}

.card-body,
.card-footer {
    color: var(--sta-texto-oscuro);
}

.card.bg-primary .card-body,
.card.bg-success .card-body,
.card.bg-info .card-body,
.card.bg-warning .card-body,
.card.bg-danger .card-body,
.card.bg-secondary .card-body,
.card.bg-primary .card-footer,
.card.bg-success .card-footer,
.card.bg-info .card-footer,
.card.bg-warning .card-footer,
.card.bg-danger .card-footer,
.card.bg-secondary .card-footer {
    color: #fff;
}

.card.bg-primary .display-4,
.card.bg-success .display-4,
.card.bg-info .display-4,
.card.bg-warning .display-4,
.card.bg-danger .display-4,
.card.bg-primary .card-body p,
.card.bg-success .card-body p,
.card.bg-info .card-body p,
.card.bg-warning .card-body p,
.card.bg-danger .card-body p,
.card.bg-primary .card-body h1,
.card.bg-primary .card-body h2,
.card.bg-primary .card-body h3,
.card.bg-primary .card-body h4,
.card.bg-primary .card-body h5,
.card.bg-success .card-body h1,
.card.bg-success .card-body h2,
.card.bg-success .card-body h3,
.card.bg-success .card-body h4,
.card.bg-success .card-body h5,
.card.bg-info .card-body h1,
.card.bg-info .card-body h2,
.card.bg-info .card-body h3,
.card.bg-info .card-body h4,
.card.bg-info .card-body h5,
.card.bg-warning .card-body h1,
.card.bg-warning .card-body h2,
.card.bg-warning .card-body h3,
.card.bg-warning .card-body h4,
.card.bg-warning .card-body h5,
.card.bg-danger .card-body h1,
.card.bg-danger .card-body h2,
.card.bg-danger .card-body h3,
.card.bg-danger .card-body h4,
.card.bg-danger .card-body h5 {
    color: #fff;
}

.card.bg-primary .text-muted,
.card.bg-success .text-muted,
.card.bg-info .text-muted,
.card.bg-warning .text-muted,
.card.bg-danger .text-muted,
.card.bg-secondary .text-muted {
    color: rgba(255, 255, 255, 0.82) !important;
}

.card > .card-body > a.text-decoration-none,
.card > .card-body > a.text-decoration-none h5 {
    color: var(--sta-texto-oscuro);
}

.card > .card-body > a.text-decoration-none:hover,
.card > .card-body > a.text-decoration-none:hover h5 {
    color: var(--sta-primario);
}

.card > .card-body > a.text-decoration-none .text-muted {
    color: var(--sta-texto-suave) !important;
}

.card > .card-body > a.text-decoration-none:hover .text-muted {
    color: var(--sta-primario-hover) !important;
}

.card .text-muted,
.card .form-text.text-muted,
.card small.text-muted {
    color: var(--sta-texto-suave) !important;
}

.card .ti.fs-1,
.card .ti.fs-2 {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 3rem;
    height: 3rem;
    border-radius: 14px;
    background: var(--sta-acento-suave);
    color: var(--sta-primario) !important;
}

.card a.text-decoration-none:hover .ti.fs-1 {
    background: rgba(0, 105, 131, 0.18);
}

.login-container {
    max-width: 420px;
    margin: 1.5rem auto;
    width: 100%;
}

.sta-install-wrap {
    max-width: 600px;
    margin: 1.5rem auto;
    width: 100%;
}

.sta-auth-card {
    border-radius: var(--sta-radius-lg);
    box-shadow: var(--sta-shadow-lg);
}

.sta-auth-card > .card-header {
    border-radius: var(--sta-radius-lg) var(--sta-radius-lg) 0 0;
}

/* ------------------------------------------------------------------ */
/* Formularios                                                         */
/* ------------------------------------------------------------------ */

.form-control,
.form-select,
.input-group-text {
    border-radius: var(--sta-radius-sm);
    border-color: #d7dee5;
    transition: border-color var(--sta-transicion), box-shadow var(--sta-transicion);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--sta-acento);
    box-shadow: 0 0 0 0.2rem rgba(90, 183, 212, 0.22);
}

.input-group-text {
    background: #f1f5f9;
    color: var(--sta-primario);
}

.input-group-text .ti {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.25rem;
    height: 1.25rem;
}

.input-group > :not(:first-child) {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

.input-group > :not(:last-child) {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

.input-group > .input-group-text:first-child {
    border-top-left-radius: var(--sta-radius-sm);
    border-bottom-left-radius: var(--sta-radius-sm);
}

.input-group > .form-control:last-child {
    border-top-right-radius: var(--sta-radius-sm);
    border-bottom-right-radius: var(--sta-radius-sm);
}

/* ------------------------------------------------------------------ */
/* Tablas                                                              */
/* ------------------------------------------------------------------ */

.table {
    margin-bottom: 0;
}

.table th {
    background: linear-gradient(135deg, var(--sta-primario), #005a72);
    color: #fff;
    font-weight: 600;
    font-size: 0.8125rem;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    border: 0;
}

.table td,
.table th {
    vertical-align: middle;
    padding: 0.65rem 0.85rem;
}

.table-hover tbody tr {
    transition: background-color var(--sta-transicion);
}

.table-striped > tbody > tr:nth-of-type(odd) > * {
    background-color: rgba(0, 105, 131, 0.03);
}

.table-compact td,
.table-compact th {
    padding: 0.5rem 0.65rem;
}

.table a:not(.btn) {
    color: var(--sta-primario);
    font-weight: 600;
    text-decoration: none;
}

.table a:not(.btn):hover {
    color: var(--sta-primario-hover);
    text-decoration: underline;
}

.card > .card-body.p-0 .table-responsive {
    border-radius: 0 0 var(--sta-radius-lg) var(--sta-radius-lg);
}

/* ------------------------------------------------------------------ */
/* Badges y estados                                                    */
/* ------------------------------------------------------------------ */

.badge {
    border-radius: var(--sta-radius-pill);
    font-weight: 600;
    padding: 0.4em 0.75em;
}

.badge.bg-warning,
.badge.bg-warning.text-white {
    background-color: #ffc107 !important;
    color: #452a00 !important;
}

.badge.bg-success,
.badge.bg-success.text-white {
    background-color: var(--sta-exito) !important;
    color: #fff !important;
}

.badge.bg-danger,
.badge.bg-danger.text-white {
    background-color: var(--sta-peligro) !important;
    color: #fff !important;
}

.badge.bg-primary,
.badge.bg-primary.text-white {
    background-color: var(--sta-primario) !important;
    color: #fff !important;
}

.badge.bg-info,
.badge.bg-info.text-white {
    background-color: var(--sta-info) !important;
    color: #fff !important;
}

.badge.bg-secondary,
.badge.bg-secondary.text-white {
    background-color: var(--sta-secundario) !important;
    color: #fff !important;
}

.card.bg-warning,
.card-header.bg-warning {
    background: linear-gradient(135deg, var(--sta-advertencia), var(--sta-advertencia-hover)) !important;
    border-color: var(--sta-advertencia-hover) !important;
    color: #fff !important;
}

.card.bg-info,
.card-header.bg-info {
    background: linear-gradient(135deg, var(--sta-info), var(--sta-info-hover)) !important;
    border-color: var(--sta-info-hover) !important;
    color: #fff !important;
}

.card.bg-success,
.card-header.bg-success {
    background: linear-gradient(135deg, var(--sta-exito), var(--sta-exito-hover)) !important;
    border-color: var(--sta-exito-hover) !important;
    color: #fff !important;
}

.card.bg-danger,
.card-header.bg-danger {
    background: linear-gradient(135deg, var(--sta-peligro), var(--sta-peligro-hover)) !important;
    border-color: var(--sta-peligro-hover) !important;
    color: #fff !important;
}

.card.bg-primary,
.card-header.bg-primary {
    background: linear-gradient(135deg, var(--sta-primario), var(--sta-primario-hover)) !important;
    border-color: var(--sta-primario-hover) !important;
    color: #fff !important;
}

.card.bg-warning .display-4,
.card.bg-info .display-4,
.card.bg-success .display-4,
.card.bg-danger .display-4,
.card.bg-primary .display-4 {
    color: #fff;
}

.estado-pendiente {
    background-color: #fff3cd;
    color: #664d03;
}

.estado-aprobado,
.estado-finalizada,
.estado-entregada {
    background-color: #d1e7dd;
    color: #0a3622;
}

.estado-rechazado,
.estado-cancelada,
.estado-vencido {
    background-color: #f8d7da;
    color: #58151c;
}

.estado-en-progreso {
    background-color: #cfe2ff;
    color: #052c65;
}

/* ------------------------------------------------------------------ */
/* Modales, alertas y paginación                                       */
/* ------------------------------------------------------------------ */

.modal-content {
    border: 0;
    border-radius: var(--sta-radius-lg);
    box-shadow: var(--sta-shadow-lg);
    overflow: hidden;
}

.modal-header {
    background: linear-gradient(135deg, var(--sta-primario), #005a72);
    color: #fff;
    border-bottom: 0;
}

.modal-header .btn-close {
    filter: invert(1);
    opacity: 0.85;
}

.dropdown-menu {
    border: 0;
    border-radius: var(--sta-radius);
    box-shadow: var(--sta-shadow-md);
    padding: 0.35rem;
}

.dropdown-item {
    border-radius: var(--sta-radius-sm);
}

.pagination .page-link {
    border-radius: var(--sta-radius-sm);
    margin: 0 0.1rem;
}

.alert {
    border-radius: var(--sta-radius);
}

.list-group-item {
    border-color: #e9ecef;
}

.list-group-item:first-child {
    border-top-left-radius: var(--sta-radius);
    border-top-right-radius: var(--sta-radius);
}

.list-group-item:last-child {
    border-bottom-left-radius: var(--sta-radius);
    border-bottom-right-radius: var(--sta-radius);
}

/* ------------------------------------------------------------------ */
/* Textos sobre fondo oscuro                                           */
/* ------------------------------------------------------------------ */

.texto-sobre-oscuro,
.login-container > .text-muted,
.login-container > p.text-muted {
    color: var(--sta-texto-suave-sobre-fondo) !important;
}

.texto-sobre-oscuro a:not(.sta-badge-mvisual),
.login-container > .text-muted a,
.login-container > p.text-muted a {
    color: var(--sta-enlace-sobre-fondo);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.texto-sobre-oscuro a:not(.sta-badge-mvisual):hover,
.login-container > .text-muted a:hover,
.login-container > p.text-muted a:hover {
    color: var(--sta-cromo-texto-hover);
}

.login-container .card-body a:not(.btn) {
    color: var(--sta-primario);
    font-weight: 600;
}

.login-container .card-body a:not(.btn):hover {
    color: var(--sta-primario-hover);
}

.sta-credito-mvisual {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.sta-badge-mvisual {
    background: var(--sta-badge-mvisual-fondo);
    color: var(--sta-badge-mvisual-texto);
    border: 1px solid var(--sta-badge-mvisual-borde);
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.45em 0.7em;
    border-radius: var(--sta-radius-pill);
    text-decoration: none !important;
}

.sta-badge-mvisual:hover,
.sta-badge-mvisual:focus,
.sta-badge-mvisual:active {
    background: var(--sta-badge-mvisual-hover-fondo);
    color: var(--sta-badge-mvisual-hover-texto);
    border-color: var(--sta-badge-mvisual-hover-borde);
    text-decoration: none !important;
}

.sta-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1020;
    margin-top: 0;
    padding: 0.5rem 0;
    color: var(--sta-texto-suave-sobre-fondo);
    font-size: 0.875rem;
    background-image: var(--sta-footer-fondo);
    border-top: 1px solid var(--sta-superficie-borde);
    backdrop-filter: blur(8px);
}

.sta-footer-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.65rem;
}

.sta-footer-fecha,
.sta-footer-uf {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    flex: 0 0 auto;
    font-size: 0.75rem;
    color: var(--sta-texto-sobre-fondo);
    white-space: nowrap;
}

.sta-footer-fecha .ti,
.sta-footer-uf .ti {
    font-size: 0.9rem;
    color: var(--sta-acento);
}

.sta-footer-uf {
    font-weight: 600;
}

.sta-footer-copy {
    flex: 1 1 auto;
    min-width: 0;
    text-align: center;
    font-size: 0.7rem;
    color: var(--sta-texto-suave-sobre-fondo);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn-sm.btn-info,
.btn-sm.btn-primary,
.btn-sm.btn-success,
.btn-sm.btn-danger,
.btn-sm.btn-warning {
    color: #fff;
}

.btn-sm.btn-outline-primary,
.btn-sm.btn-outline-info,
.btn-sm.btn-outline-danger,
.btn-sm.btn-outline-success {
    font-weight: 600;
}

/* ------------------------------------------------------------------ */
/* Responsive y accesibilidad                                          */
/* ------------------------------------------------------------------ */

@media (max-width: 1199.98px) {
    .sta-header-bar {
        flex-wrap: wrap;
    }

    .sta-header-toggler {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .sta-header-nav {
        flex: 1 1 100%;
        order: 3;
    }

    .sta-header-nav:not(.show) {
        display: none !important;
    }

    .sta-header-nav.show {
        display: block !important;
        width: 100%;
        padding-top: 0.35rem;
    }

    .sta-header-menu {
        flex-direction: column;
        align-items: stretch;
        padding: 0.35rem 0 0.5rem;
    }

    .sta-header-nav .nav-link {
        width: 100%;
    }

    .sta-header-user {
        margin-left: 0;
    }

    .sta-user-text {
        max-width: 8rem;
    }
}

@media (max-width: 575.98px) {
    .sta-shell {
        width: 94%;
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }

    .sta-brand-name {
        max-width: 9rem;
    }
}

@media (max-width: 767.98px) {
    .sta-footer-fecha span,
    .sta-footer-copy {
        font-size: 0.65rem;
    }

    .sta-footer-uf {
        font-size: 0.7rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    .btn-lg.py-4:hover,
    .sta-cta-btn:hover {
        transform: none;
    }
}

/* ------------------------------------------------------------------ */
/* Selector de tema                                                    */
/* ------------------------------------------------------------------ */

.sta-auth-header {
    position: fixed;
    top: 0.75rem;
    right: 0.75rem;
    z-index: 1040;
}

.sta-tema-switch {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: var(--sta-texto-suave-sobre-fondo);
    font-size: 0.68rem;
    white-space: nowrap;
}

.sta-tema-switch-header {
    flex-shrink: 0;
}

.sta-header-user .sta-tema-switch .form-check-input {
    width: 1.85rem;
    height: 0.95rem;
}

.sta-tema-switch-auth {
    padding: 0.2rem 0.35rem;
    border-radius: var(--sta-radius-pill);
    background: var(--sta-cromo-superficie);
    border: 1px solid var(--sta-cromo-borde);
}

.sta-tema-switch-label {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin: 0;
    cursor: pointer;
    user-select: none;
}

.sta-tema-switch .ti {
    font-size: 0.85rem;
    color: var(--sta-acento);
    line-height: 1;
}

.sta-tema-switch .form-check-input {
    width: 2rem;
    height: 1rem;
    margin: 0;
    cursor: pointer;
    border-color: var(--sta-cromo-borde);
    background-color: var(--sta-cromo-superficie);
}

.sta-tema-switch .form-check-input:checked {
    background-color: var(--sta-primario);
    border-color: var(--sta-primario);
}

.sta-tema-switch .form-check-input:focus {
    border-color: var(--sta-acento);
    box-shadow: 0 0 0 0.15rem rgba(90, 183, 212, 0.25);
}

@media (max-width: 1199.98px) {
    .sta-header-user .sta-tema-switch .ti {
        font-size: 0.78rem;
    }
}

@media (max-width: 575.98px) {
    .sta-header-user .sta-user-text {
        display: none;
    }

    .sta-auth-header {
        top: 0.5rem;
        right: 0.5rem;
    }
}

[data-sta-tema="claro"] .sta-header-nav .nav-item.active .nav-link {
    color: var(--sta-primario);
}

[data-sta-tema="claro"] .card {
    border: 1px solid rgba(15, 23, 42, 0.06);
}

[data-sta-tema="claro"] .table-striped > tbody > tr:nth-of-type(odd) > * {
    background-color: rgba(0, 105, 131, 0.04);
}

[data-sta-tema="claro"] .dropdown-menu,
[data-sta-tema="claro"] .modal-content {
    border: 1px solid rgba(15, 23, 42, 0.08);
}
