/* Identidad visual compartida entre el portal de agencias y el sistema administrativo. */
body.system-portal-theme {
    --system-navy: #102448;
    --system-navy-deep: #0c1c38;
    --system-blue: #1769e0;
    --system-sky: #2082f3;
    --system-ink: #17233c;
    --system-muted: #6f7e95;
    --system-border: #dfe7f2;
    min-height: 100vh;
    color: var(--system-ink);
    background: radial-gradient(circle at 10% 20%, rgba(67,164,255,.11), transparent 28%), radial-gradient(circle at 92% 82%, rgba(23,105,224,.09), transparent 30%), #f4f7fb;
}

.system-portal-theme .topbar,
.system-portal-theme .topbar.bg-dark {
    color: #fff;
    background: linear-gradient(105deg, var(--system-navy-deep), #132d56) !important;
    border-bottom: 1px solid rgba(255,255,255,.08);
    box-shadow: 0 8px 25px rgba(16,36,72,.14);
}

.system-portal-theme .sidebar-wrapper {
    color: rgba(255,255,255,.84);
    background: linear-gradient(180deg, #102448 0%, #0c3150 100%);
    border-right: 1px solid rgba(255,255,255,.09);
    box-shadow: 8px 0 28px rgba(16,36,72,.12) !important;
}

.system-portal-theme .sidebar-header {
    color: #fff;
    background: var(--system-navy-deep);
    border-color: rgba(255,255,255,.09);
}

.system-portal-theme .sidebar-header .logo-text,
.system-portal-theme .sidebar-header .toggle-icon,
.system-portal-theme .topbar .nav-link,
.system-portal-theme .topbar .mobile-toggle-menu,
.system-portal-theme .topbar .user-name,
.system-portal-theme .topbar .designattion { color: #fff !important; }

.system-portal-theme .sidebar-wrapper .metismenu a { color: rgba(255,255,255,.76); border-radius: 9px; }
.system-portal-theme .sidebar-wrapper .metismenu ul { background: rgba(3,18,36,.25); border-color: rgba(255,255,255,.07); }
.system-portal-theme .sidebar-wrapper .metismenu .mm-active > a,
.system-portal-theme .sidebar-wrapper .metismenu a:hover,
.system-portal-theme .sidebar-wrapper .metismenu a:focus {
    color: #fff;
    background: rgba(32,130,243,.22);
    box-shadow: inset 3px 0 0 #43a4ff;
}

.system-portal-theme .page-wrapper { background: transparent; }
.system-portal-theme .page-content { padding: 1.6rem 1.6rem 4.5rem; }
.system-portal-theme .page-content h1,
.system-portal-theme .page-content h2,
.system-portal-theme .page-content h3,
.system-portal-theme .page-content h4,
.system-portal-theme .page-content h5,
.system-portal-theme .page-content h6,
.system-portal-theme .page-content label { color: var(--system-ink); }
.system-portal-theme .page-content .text-muted { color: var(--system-muted) !important; }

.system-portal-theme .card,
.system-portal-theme .panel {
    color: var(--system-ink);
    background: #fff !important;
    border: 1px solid var(--system-border) !important;
    border-radius: 16px;
    box-shadow: 0 16px 38px rgba(32,55,90,.08) !important;
}

.system-portal-theme .card-header,
.system-portal-theme .panel-heading {
    color: var(--system-ink) !important;
    background: #fff !important;
    border-bottom-color: #e5ebf4 !important;
}

.system-portal-theme .table {
    --bs-table-color: #34425a;
    --bs-table-bg: #fff;
    --bs-table-striped-bg: #f7faff;
    --bs-table-hover-bg: #eef5ff;
    color: #34425a !important;
    background: #fff;
}

.system-portal-theme .table > :not(caption) > * > * {
    color: #34425a;
    background-color: var(--bs-table-bg);
    border-bottom-color: #e5ebf4;
    box-shadow: none;
}

.system-portal-theme .table thead th,
.system-portal-theme .table-light > * > * {
    color: #52627b !important;
    background: #eef4fb !important;
    border-color: #dbe5f1 !important;
    font-weight: 700;
}

.system-portal-theme .table tbody tr:hover > * { background: #eef5ff !important; }
.system-portal-theme .page-content .table tbody tr > td,
.system-portal-theme .page-content .table tbody tr > td label,
.system-portal-theme .page-content .table tbody tr > td span:not(.badge),
.system-portal-theme .page-content .table tbody tr > td a:not(.btn):not(.badge) { color: #34425a !important; }
.system-portal-theme .page-content .table tbody tr > td a:not(.btn):not(.badge):hover { color: var(--system-blue) !important; }
.system-portal-theme .page-content .table tbody tr > td .badge.bg-primary,
.system-portal-theme .page-content .table tbody tr > td .badge.bg-success,
.system-portal-theme .page-content .table tbody tr > td .badge.bg-danger,
.system-portal-theme .page-content .table tbody tr > td .badge.bg-dark { color: #fff !important; }

.system-portal-theme .agency-credential-cell {
    vertical-align: middle;
}

.system-portal-theme .agency-credential-value,
.system-portal-theme .agency-pin-value {
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    color: #18345d !important;
    background: #e8f1fd !important;
    border: 1px solid #c7daf4;
    border-radius: 5px;
    padding: 2px 7px;
    font-weight: 700;
    line-height: 1.2;
}

.system-portal-theme .agency-pin-value {
    min-width: 42px;
    justify-content: center;
    letter-spacing: .08em;
}

.system-portal-theme .agency-copy-button,
.system-portal-theme .agency-copy-button i {
    color: #1769d2 !important;
}

.system-portal-theme .agency-copy-button {
    min-width: 25px;
    min-height: 25px;
    border-radius: 5px;
    text-decoration: none !important;
}

.system-portal-theme .agency-copy-button:hover,
.system-portal-theme .agency-copy-button:focus {
    color: #fff !important;
    background: #1769d2 !important;
    box-shadow: 0 0 0 3px rgba(23, 105, 210, .15);
}

.system-portal-theme .agency-copy-button:hover i,
.system-portal-theme .agency-copy-button:focus i {
    color: #fff !important;
}
.system-portal-theme .table tbody tr.system-selected-row > *,
.system-portal-theme .table tbody tr[style*="darkgoldenrod"] > * {
    color: #102448 !important;
    background: #dbeaff !important;
    border-top-color: #9fc5f8 !important;
    border-bottom-color: #9fc5f8 !important;
    box-shadow: inset 0 1px 0 rgba(23,105,224,.12), inset 0 -1px 0 rgba(23,105,224,.12);
}
.system-portal-theme .table tbody tr.system-selected-row > *:first-child,
.system-portal-theme .table tbody tr[style*="darkgoldenrod"] > *:first-child {
    box-shadow: inset 4px 0 0 var(--system-blue), inset 0 1px 0 rgba(23,105,224,.12), inset 0 -1px 0 rgba(23,105,224,.12);
}
.system-portal-theme .table tbody tr.system-selected-row label,
.system-portal-theme .table tbody tr.system-selected-row a:not(.btn),
.system-portal-theme .table tbody tr[style*="darkgoldenrod"] label,
.system-portal-theme .table tbody tr[style*="darkgoldenrod"] a:not(.btn) { color: #102448 !important; }
.system-portal-theme .dataTables_wrapper,
.system-portal-theme .table-responsive { color: #34425a; }

.system-portal-theme .form-control,
.system-portal-theme .form-select,
.system-portal-theme .select2-container--bootstrap4 .select2-selection,
.system-portal-theme .input-group-text {
    color: var(--system-ink) !important;
    background-color: #fff !important;
    border-color: #cfd9e8 !important;
    color-scheme: light;
}

.system-portal-theme select option { color: var(--system-ink); background: #fff; }
.system-portal-theme .select2-container { color: var(--system-ink); }
.system-portal-theme .select2-container .select2-selection--single,
.system-portal-theme .select2-container .select2-selection--multiple {
    min-height: 38px;
    color: var(--system-ink) !important;
    background: #fff !important;
    border-color: #cfd9e8 !important;
}
.system-portal-theme .select2-container .select2-selection--single .select2-selection__rendered,
.system-portal-theme .select2-container .select2-selection--multiple .select2-selection__rendered,
.system-portal-theme .select2-container .select2-selection__placeholder {
    color: #53627a !important;
}
.system-portal-theme .select2-dropdown {
    overflow: hidden;
    color: var(--system-ink) !important;
    background: #fff !important;
    border: 1px solid #cfd9e8 !important;
    border-radius: 0 0 10px 10px;
    box-shadow: 0 14px 32px rgba(29,57,95,.16);
}
.system-portal-theme .select2-search--dropdown { padding: 8px; background: #f7f9fc; }
.system-portal-theme .select2-search--dropdown .select2-search__field {
    min-height: 36px;
    color: var(--system-ink) !important;
    background: #fff !important;
    border: 1px solid #bfcde0 !important;
    border-radius: 7px;
    outline: 0;
}
.system-portal-theme .select2-results { color: var(--system-ink); background: #fff; }
.system-portal-theme .select2-results__options { background: #fff !important; }
.system-portal-theme .select2-results__option {
    padding: 9px 13px;
    color: #34425a !important;
    background: #fff !important;
}
.system-portal-theme .select2-results__option[aria-selected="true"],
.system-portal-theme .select2-results__option--selected {
    color: #174c91 !important;
    background: #e8f2ff !important;
}
.system-portal-theme .select2-results__option--highlighted[aria-selected],
.system-portal-theme .select2-results__option--highlighted {
    color: #fff !important;
    background: var(--system-blue) !important;
}
.system-portal-theme .select2-container--focus .select2-selection,
.system-portal-theme .select2-container--open .select2-selection {
    border-color: rgba(23,105,224,.72) !important;
    box-shadow: 0 0 0 .22rem rgba(23,105,224,.12) !important;
}
.system-portal-theme .form-control:focus,
.system-portal-theme .form-select:focus {
    border-color: rgba(23,105,224,.72) !important;
    box-shadow: 0 0 0 .22rem rgba(23,105,224,.12) !important;
}

.system-portal-theme .modal-content {
    overflow: hidden;
    color: var(--system-ink);
    background: #fff !important;
    border: 0;
    border-radius: 18px;
    box-shadow: 0 28px 70px rgba(16,36,72,.28);
}

.system-portal-theme .modal-header {
    color: #fff;
    background: linear-gradient(105deg, var(--system-navy-deep), #125cc8 72%, var(--system-sky)) !important;
    border: 0;
}
.system-portal-theme .modal-header .modal-title,
.system-portal-theme .modal-header h5 { color: #fff !important; }
.system-portal-theme .modal-header .btn-close { filter: invert(1) grayscale(100%) brightness(200%); }
.system-portal-theme .modal-body { color: var(--system-ink); background: #fff !important; }
.system-portal-theme .modal-footer { background: #f7f9fc; border-color: #e5ebf4; }

.system-portal-theme .dropdown-menu {
    color: var(--system-ink);
    background: #fff;
    border: 1px solid var(--system-border);
    border-radius: 12px;
    box-shadow: 0 18px 42px rgba(29,57,95,.15);
}
.system-portal-theme .dropdown-item { color: #34425a; }
.system-portal-theme .dropdown-item:hover,
.system-portal-theme .dropdown-item:focus { color: var(--system-blue); background: #eef5ff; }

/* Integra la flecha del menú de usuario con la tarjeta clara. */
.system-portal-theme .topbar .navbar .dropdown-menu::after {
    background: #fff !important;
    border-top-color: var(--system-border) !important;
    border-left-color: var(--system-border) !important;
}

.system-portal-theme .btn-primary {
    color: #fff;
    background: linear-gradient(105deg, #125cc8, var(--system-sky));
    border-color: transparent;
    box-shadow: 0 7px 16px rgba(23,105,224,.16);
}
.system-portal-theme .btn-primary:hover { color: #fff; background: linear-gradient(105deg, #0f54bb, #1677e5); }
.system-portal-theme .btn-light { color: #53627a; background: #fff; border-color: #d6e0ec; }
.system-portal-theme .btn-secondary { color: #fff; background: #52637c; border-color: #52637c; }

.system-portal-theme .nav-tabs { border-bottom-color: #dfe7f2; }
.system-portal-theme .nav-tabs .nav-link { color: #65738a; }
.system-portal-theme .nav-tabs .nav-link.active { color: var(--system-blue); background: #fff; border-color: #dfe7f2 #dfe7f2 #fff; }

/* Selector de forma de pago: Bootstrap dejaba las opciones inactivas blancas sobre blanco. */
.system-portal-theme .payment-method-selector {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
    gap: 10px;
    margin-top: 6px;
}

.system-portal-theme .payment-method-selector .nav-item {
    min-width: 0;
}

.system-portal-theme .payment-method-selector .nav-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100% !important;
    min-height: 58px;
    padding: 10px 12px;
    color: #34425a !important;
    background: #f7f9fc !important;
    border: 1px solid #d8e2ef;
    border-radius: 10px;
    cursor: pointer;
    text-decoration: none;
    transition: border-color .18s ease, background-color .18s ease, box-shadow .18s ease, transform .18s ease;
}

.system-portal-theme .payment-method-selector .nav-link > .d-flex {
    justify-content: center;
    gap: 5px;
    min-width: 0;
}

.system-portal-theme .payment-method-selector .nav-link i,
.system-portal-theme .payment-method-selector .nav-link .tab-title {
    color: inherit !important;
}

.system-portal-theme .payment-method-selector .nav-link:hover,
.system-portal-theme .payment-method-selector .nav-link:focus {
    color: #1769e0 !important;
    background: #edf5ff !important;
    border-color: #9fc5f8;
    box-shadow: 0 6px 16px rgba(23,105,224,.10);
    transform: translateY(-1px);
}

.system-portal-theme .payment-method-selector .nav-link.active {
    color: #fff !important;
    background: linear-gradient(105deg, #125cc8, #2082f3) !important;
    border-color: transparent;
    box-shadow: 0 8px 18px rgba(23,105,224,.20);
}

@media (max-width: 575.98px) {
    .system-portal-theme .payment-method-selector {
        grid-template-columns: 1fr;
    }
}

.system-portal-theme .page-footer {
    color: rgba(255,255,255,.94);
    background: linear-gradient(105deg, var(--system-navy-deep), #132d56 35%, #125cc8 72%, var(--system-sky));
    border-top: 1px solid rgba(255,255,255,.16);
    box-shadow: 0 -8px 24px rgba(16,36,72,.12);
}

.system-login-theme { overflow-x: hidden; }
.system-login-theme .admin-login-page { min-height: 100vh; }
.admin-login-shell { display: grid; grid-template-columns: minmax(420px, 1.08fr) minmax(420px, .92fr); min-height: 100vh; }
.admin-login-brand-panel {
    position: relative; display: flex; align-items: center; overflow: hidden; padding: clamp(48px, 8vw, 128px);
    color: #fff; background: linear-gradient(138deg, #081a35 0%, #102f5c 55%, #1769e0 130%);
}
.admin-login-brand-content { position: relative; z-index: 2; width: 100%; max-width: 650px; }
.admin-login-logo { display: block; width: auto; max-width: 190px; max-height: 65px; margin-bottom: 62px; object-fit: contain; }
.admin-login-eyebrow {
    display: inline-flex; padding: 7px 12px; margin-bottom: 22px; color: #bcd9ff; background: rgba(67,164,255,.12);
    border: 1px solid rgba(111,180,255,.24); border-radius: 999px; font-size: 12px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
}
.admin-login-brand-panel h1 { margin: 0 0 24px; color: #fff; font-size: clamp(42px, 4.4vw, 70px); font-weight: 750; line-height: 1.04; letter-spacing: -.035em; }
.admin-login-brand-panel p { max-width: 570px; margin: 0; color: rgba(255,255,255,.70); font-size: 17px; line-height: 1.7; }
.admin-login-feature-list { display: flex; flex-wrap: wrap; gap: 13px 22px; margin-top: 40px; color: rgba(255,255,255,.87); font-size: 13px; font-weight: 600; }
.admin-login-feature-list i { margin-right: 6px; color: #64b5ff; font-size: 18px; vertical-align: -3px; }
.admin-login-brand-orb { position: absolute; border-radius: 50%; border: 1px solid rgba(255,255,255,.08); }
.admin-login-orb-one { right: -160px; bottom: -190px; width: 560px; height: 560px; background: rgba(32,130,243,.09); box-shadow: 0 0 0 70px rgba(32,130,243,.04); }
.admin-login-orb-two { top: -170px; left: -210px; width: 470px; height: 470px; background: rgba(67,164,255,.05); }
.admin-login-form-panel { display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 0; padding: 48px 34px 26px; background: #f4f7fb; }
.admin-login-card {
    position: relative; width: 100%; max-width: 465px; padding: 48px 48px 32px; color: var(--system-ink); background: #fff;
    margin-top: auto; border: 1px solid var(--system-border); border-radius: 24px; box-shadow: 0 28px 70px rgba(29,57,95,.13);
}
.admin-login-card-icon {
    display: grid; place-items: center; width: 52px; height: 52px; margin-bottom: 28px; color: #fff;
    background: linear-gradient(135deg, #125cc8, #2082f3); border-radius: 15px; box-shadow: 0 10px 24px rgba(23,105,224,.22); font-size: 25px;
}
.admin-login-heading > span { color: var(--system-blue); font-size: 12px; font-weight: 750; letter-spacing: .1em; text-transform: uppercase; }
.admin-login-heading h2 { margin: 8px 0 8px; color: var(--system-ink); font-size: 32px; font-weight: 750; }
.admin-login-heading p { margin: 0 0 32px; color: var(--system-muted); font-size: 14px; }
.admin-login-field { margin-bottom: 22px; }
.admin-login-field .form-label { margin-bottom: 8px; color: #34425a; font-size: 13px; font-weight: 700; }
.admin-login-input { position: relative; }
.admin-login-input > i { position: absolute; z-index: 2; top: 50%; left: 16px; color: #8290a6; font-size: 20px; transform: translateY(-50%); pointer-events: none; }
.system-login-theme .admin-login-input .form-control { height: 52px; padding: 10px 16px 10px 48px; border-radius: 11px; font-size: 14px; }
.admin-login-validation { margin-top: 6px; color: #dc3545; font-size: 12px; }
.admin-login-submit {
    display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 52px; margin-top: 30px;
    color: #fff !important; background: linear-gradient(105deg, #125cc8, #2082f3); border: 0; border-radius: 11px; font-weight: 700;
    box-shadow: 0 10px 23px rgba(23,105,224,.22); transition: transform .18s ease, box-shadow .18s ease, opacity .18s ease;
}
.admin-login-submit:not(:disabled):hover { color: #fff; transform: translateY(-1px); box-shadow: 0 13px 28px rgba(23,105,224,.28); }
.admin-login-submit:disabled { color: rgba(255,255,255,.82) !important; background: #8c9bb0; box-shadow: none; opacity: .7; }
.admin-login-submit i { font-size: 20px; }
.admin-login-security { margin-top: 27px; padding-top: 22px; color: #75839a; border-top: 1px solid #e8edf5; text-align: center; font-size: 12px; }
.admin-login-security i { margin-right: 4px; color: #2cad7d; font-size: 16px; vertical-align: -2px; }
.admin-login-version { margin-top: 14px; color: #9aa6b8; text-align: center; font-size: 11px; }
.admin-login-footer { margin-top: auto; padding-top: 34px; color: #8491a5; text-align: center; font-size: 11px; }

/* Navegación y editor de planes de pago del módulo de grupos. */
.system-portal-theme .group-wizard > .nav { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; height: auto !important; overflow: visible; border: 0; }
.system-portal-theme .group-wizard > .nav .nav-item { min-width: 0; }
.system-portal-theme .group-wizard > .nav .nav-link { display: flex; align-items: center; gap: 8px; min-height: 46px; margin: 0; padding: 9px 13px !important; color: #65738a; background: #f4f7fb; border: 1px solid #dfe7f2 !important; border-radius: 11px; font-size: 12px; font-weight: 700; line-height: 1.2; }
.system-portal-theme .group-wizard > .nav .nav-link::before,
.system-portal-theme .group-wizard > .nav .nav-link::after { display: none; }
.system-portal-theme .group-wizard > .nav .nav-link.active { color: #fff !important; background: linear-gradient(105deg, #125cc8, #2082f3) !important; border-color: transparent !important; box-shadow: 0 7px 18px rgba(23,105,224,.18); }
.system-portal-theme .group-wizard > .nav .nav-link.done { color: #1769e0; background: #edf5ff; border-color: #bad6fb !important; }
.system-portal-theme .group-wizard-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plan-payment-editor { overflow: hidden; margin-top: 4px; background: #fff; border: 1px solid #dfe7f2; border-radius: 16px; }
.plan-payment-heading { display: flex; align-items: center; gap: 14px; padding: 22px 24px; background: linear-gradient(180deg, #fff, #f8fbff); border-bottom: 1px solid #e5ebf4; }
.plan-payment-heading-icon { display: grid; place-items: center; flex: 0 0 44px; width: 44px; height: 44px; color: #1769e0; background: #eaf3ff; border-radius: 12px; font-size: 22px; }
.plan-payment-heading h5 { color: #17233c; font-size: 18px; font-weight: 750; }
.plan-payment-heading p { color: #75839a; font-size: 13px; }
.plan-payment-fields { padding: 26px 24px 30px; }
.plan-payment-fields .form-label { margin-bottom: 8px; color: #34425a; font-size: 13px; font-weight: 700; }
.plan-payment-fields .form-label i { color: #1769e0; font-size: 17px; vertical-align: -2px; }
.plan-payment-fields .form-control, .plan-payment-fields .input-group-text { min-height: 44px; }
.plan-payment-fields .form-text { display: block; min-height: 34px; margin-top: 7px; color: #8190a6; font-size: 11px; line-height: 1.45; }
.plan-payment-error { margin-top: 5px; color: #dc3545; font-size: 11px; }
.plan-payment-actions { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 24px; background: #f8fafc; border-top: 1px solid #e5ebf4; }
.plan-payment-actions .btn { display: inline-flex; align-items: center; justify-content: center; min-width: 118px; min-height: 40px; border-radius: 9px; font-weight: 700; }

@media (max-width: 767.98px) {
    .system-portal-theme .page-content { padding: 1rem .75rem 4rem; }
    .system-portal-theme .card { border-radius: 12px; }
    .admin-login-shell { display: block; }
    .admin-login-brand-panel { min-height: 230px; padding: 34px 26px 44px; }
    .admin-login-logo { max-width: 145px; max-height: 48px; margin-bottom: 28px; }
    .admin-login-eyebrow, .admin-login-feature-list { display: none; }
    .admin-login-brand-panel h1 { margin-bottom: 12px; font-size: 34px; }
    .admin-login-brand-panel p { font-size: 14px; line-height: 1.55; }
    .admin-login-form-panel { min-height: calc(100vh - 230px); padding: 0 14px 22px; }
    .admin-login-card { max-width: 500px; padding: 32px 24px 25px; margin-top: -22px; border-radius: 18px; }
    .admin-login-card-icon { width: 46px; height: 46px; margin-bottom: 22px; }
    .admin-login-heading h2 { font-size: 27px; }
    .admin-login-footer { padding-top: 24px; }
    .plan-payment-heading { padding: 18px; }
    .plan-payment-fields { padding: 20px 18px; }
    .plan-payment-fields .form-text { min-height: 0; }
    .plan-payment-actions { padding: 14px 18px; }
    .plan-payment-actions .btn { flex: 1 1 0; min-width: 0; }
}

@media (min-width: 768px) and (max-width: 1050px) {
    .admin-login-shell { grid-template-columns: minmax(340px, .85fr) minmax(410px, 1.15fr); }
    .admin-login-brand-panel { padding: 54px 42px; }
    .admin-login-brand-panel h1 { font-size: 45px; }
    .admin-login-feature-list { display: grid; }
}
