:root {
    --app-primary: #174c78;
    --app-primary-dark: #103854;
    --app-accent: #2c7fbe;
    --app-background: #f4f7fa;
    --app-surface: #ffffff;
    --app-border: #dfe7ee;
    --app-text: #1d2a35;
    --app-muted: #687785;
    --app-success: #198754;
    --app-warning: #d88900;
    --app-danger: #c93a45;
    --app-sidebar-width: 270px;
    --app-radius: 14px;
    --app-shadow: 0 8px 28px rgba(25, 55, 78, 0.08);
}

html {
    font-size: 15px;
    min-height: 100%;
}

body {
    min-height: 100vh;
    margin: 0;
    color: var(--app-text);
    background: var(--app-background);
    font-family: Inter, "Segoe UI", Arial, sans-serif;
}

a {
    text-decoration: none;
}

.app-shell {
    display: flex;
    min-height: 100vh;
}

.app-sidebar {
    width: var(--app-sidebar-width) !important;
    min-width: var(--app-sidebar-width);
    color: #fff;
    background: linear-gradient( 180deg, var(--app-primary-dark) 0%, #0b2a40 100%);
    border: 0;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 82px;
    padding: 18px 22px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.brand-symbol {
    display: grid;
    width: 42px;
    height: 42px;
    place-items: center;
    flex-shrink: 0;
    color: var(--app-primary-dark);
    background: #fff;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    box-shadow: 0 5px 18px rgba(0, 0, 0, 0.16);
}

.brand-content {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

    .brand-content strong {
        font-size: 1.05rem;
    }

    .brand-content span {
        color: rgba(255, 255, 255, 0.7);
        font-size: 0.82rem;
    }

.sidebar-title {
    color: #fff;
    font-weight: 700;
}

.sidebar-navigation {
    padding: 18px 14px;
}

.sidebar-section-label {
    padding: 17px 13px 7px;
    color: rgba(255, 255, 255, 0.46);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 44px;
    margin: 3px 0;
    padding: 10px 13px;
    color: rgba(255, 255, 255, 0.78);
    border-radius: 10px;
    font-size: 0.93rem;
    transition: background-color 150ms ease, color 150ms ease;
}

    .sidebar-link:hover,
    .sidebar-link.active {
        color: #fff;
        background: rgba(255, 255, 255, 0.12);
    }

    .sidebar-link.active {
        box-shadow: inset 3px 0 0 #5db7ee;
    }

    .sidebar-link.disabled {
        cursor: default;
        opacity: 0.5;
    }

.sidebar-icon {
    display: inline-flex;
    width: 21px;
    height: 21px;
}

    .sidebar-icon svg {
        width: 100%;
        height: 100%;
        fill: none;
        stroke: currentColor;
        stroke-width: 1.8;
        stroke-linecap: round;
        stroke-linejoin: round;
    }

.sidebar-footer {
    position: absolute;
    right: 18px;
    bottom: 18px;
    left: 18px;
    display: flex;
    flex-direction: column;
    padding: 13px;
    color: rgba(255, 255, 255, 0.74);
    background: rgba(255, 255, 255, 0.07);
    border-radius: 10px;
    font-size: 0.78rem;
}

    .sidebar-footer small {
        color: rgba(255, 255, 255, 0.45);
    }

.app-content {
    display: flex;
    min-width: 0;
    flex: 1;
    flex-direction: column;
}

.app-header {
    display: flex;
    align-items: center;
    min-height: 76px;
    padding: 12px 28px;
    gap: 16px;
    background: var(--app-surface);
    border-bottom: 1px solid var(--app-border);
}

.header-title {
    display: flex;
    min-width: 0;
    flex: 1;
    flex-direction: column;
}

    .header-title span {
        font-weight: 700;
    }

    .header-title small {
        color: var(--app-muted);
        font-size: 0.78rem;
    }

.app-header .navbar-nav {
    flex-direction: row;
    align-items: center;
}

.app-header .nav-link {
    color: var(--app-text) !important;
    font-size: 0.88rem;
}

.sidebar-toggle {
    display: flex;
    width: 42px;
    height: 42px;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    padding: 9px;
    border: 1px solid var(--app-border);
    border-radius: 10px;
}

    .sidebar-toggle span {
        display: block;
        width: 100%;
        height: 2px;
        background: var(--app-primary-dark);
        border-radius: 5px;
    }

.app-main {
    width: 100%;
    max-width: 1600px;
    min-height: calc(100vh - 128px);
    margin: 0 auto;
    padding: 30px;
}

.app-footer {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 30px;
    color: var(--app-muted);
    background: var(--app-surface);
    border-top: 1px solid var(--app-border);
    font-size: 0.78rem;
}

.page-heading {
    margin-bottom: 24px;
}

    .page-heading h1 {
        margin-bottom: 5px;
        font-size: clamp(1.5rem, 2vw, 2rem);
        font-weight: 750;
        letter-spacing: -0.025em;
    }

    .page-heading p {
        margin: 0;
        color: var(--app-muted);
    }

.app-card {
    height: auto;
    padding: 22px;
    background: var(--app-surface);
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius);
    box-shadow: var(--app-shadow);
}
/*
 * Igualar altura únicamente cuando la tarjeta es el único
 * elemento dentro de la columna Bootstrap.
 */
.row > [class*="col-"] > .app-card:only-child {
    height: 100%;
}

.metric-label {
    color: var(--app-muted);
    font-size: 0.8rem;
    font-weight: 650;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.metric-value {
    margin: 8px 0 4px;
    font-size: 2rem;
    font-weight: 750;
    letter-spacing: -0.04em;
}

.metric-description {
    color: var(--app-muted);
    font-size: 0.82rem;
}

.status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    margin-right: 6px;
    background: var(--app-success);
    border-radius: 50%;
}

.auth-shell {
    display: grid;
    min-height: 100vh;
    place-items: center;
    padding: 32px 18px;
    background: radial-gradient(circle at top right, #d9ebf7 0, transparent 35%), linear-gradient(135deg, #eef5f9 0%, #f8fafc 100%);
}

.auth-brand {
    position: fixed;
    top: 28px;
    left: 32px;
    display: flex;
    align-items: center;
    gap: 12px;
}

    .auth-brand > div:last-child {
        display: flex;
        flex-direction: column;
    }

    .auth-brand span {
        color: var(--app-muted);
        font-size: 0.78rem;
    }

    .auth-brand .brand-symbol {
        color: #fff;
        background: var(--app-primary-dark);
    }

.auth-content {
    width: min(100%, 1080px);
}

.form-control,
.form-select {
    min-height: 44px;
    border-color: #ccd8e1;
    border-radius: 9px;
}

    .form-control:focus,
    .form-select:focus,
    .form-check-input:focus,
    .btn:focus-visible {
        border-color: var(--app-accent);
        box-shadow: 0 0 0 0.2rem rgba(44, 127, 190, 0.18);
    }

.btn {
    min-height: 42px;
    border-radius: 9px;
    font-weight: 600;
}

.btn-primary {
    background: var(--app-primary);
    border-color: var(--app-primary);
}

    .btn-primary:hover {
        background: var(--app-primary-dark);
        border-color: var(--app-primary-dark);
    }

@media (min-width: 992px) {
    .app-sidebar {
        position: sticky;
        top: 0;
        height: 100vh;
    }
}

@media (max-width: 991.98px) {
    .app-header {
        padding: 11px 18px;
    }

    .app-main {
        padding: 22px 18px;
    }

    .sidebar-footer {
        position: static;
        margin: 18px;
    }
}

@media (max-width: 575.98px) {
    .header-title small {
        display: none;
    }

    .app-header .nav-link {
        max-width: 145px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .auth-brand {
        position: static;
        margin-bottom: 30px;
    }

    .auth-shell {
        display: block;
        padding-top: 24px;
    }
}

.login-card {
    display: grid;
    width: min(100%, 940px);
    min-height: 570px;
    margin: 60px auto 0;
    grid-template-columns: minmax(0, 1.05fr) minmax(360px, 0.95fr);
    overflow: hidden;
    background: var(--app-surface);
    border: 1px solid rgba(20, 58, 84, 0.08);
    border-radius: 22px;
    box-shadow: 0 24px 70px rgba(25, 55, 78, 0.16);
}

.login-presentation {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 58px 52px;
    color: #fff;
    background: radial-gradient( circle at top right, rgba(93, 183, 238, 0.35), transparent 35%), linear-gradient( 150deg, var(--app-primary) 0%, #0b2a40 78%);
}

.login-eyebrow {
    display: inline-block;
    margin-bottom: 22px;
    padding: 7px 11px;
    color: #d7effd;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 100px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.login-presentation h1 {
    max-width: 430px;
    margin-bottom: 18px;
    font-size: clamp(2rem, 3.2vw, 3rem);
    font-weight: 750;
    line-height: 1.08;
    letter-spacing: -0.045em;
}

.login-presentation > div > p {
    max-width: 440px;
    margin: 0;
    color: rgba(255, 255, 255, 0.72);
    font-size: 0.97rem;
    line-height: 1.7;
}

.login-security {
    display: flex;
    align-items: center;
    gap: 14px;
    padding-top: 30px;
}

.security-shield {
    display: grid;
    width: 45px;
    height: 45px;
    place-items: center;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 13px;
}

    .security-shield svg {
        width: 24px;
        height: 24px;
        fill: none;
        stroke: #fff;
        stroke-width: 1.8;
        stroke-linecap: round;
        stroke-linejoin: round;
    }

.login-security div:last-child {
    display: flex;
    flex-direction: column;
}

.login-security strong {
    font-size: 0.85rem;
}

.login-security span {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.73rem;
}

.login-form-panel {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 55px 48px;
}

.login-form-header {
    margin-bottom: 30px;
}

    .login-form-header h2 {
        margin-bottom: 7px;
        font-size: 1.65rem;
        font-weight: 750;
        letter-spacing: -0.025em;
    }

    .login-form-header p {
        margin: 0;
        color: var(--app-muted);
        font-size: 0.9rem;
    }

.login-form .form-label {
    margin-bottom: 7px;
    color: #334451;
    font-size: 0.82rem;
    font-weight: 650;
}

.login-form .form-control {
    min-height: 48px;
    padding-right: 14px;
    padding-left: 14px;
    background: #fbfcfd;
}

.login-form .alert:empty {
    display: none;
}

.login-submit {
    width: 100%;
    min-height: 48px;
}

.login-help-link {
    color: var(--app-primary);
    font-size: 0.78rem;
    font-weight: 600;
}

.login-support {
    display: flex;
    justify-content: center;
    gap: 5px;
    margin-top: 27px;
    color: var(--app-muted);
    font-size: 0.78rem;
}

    .login-support strong {
        color: var(--app-text);
    }

@media (max-width: 767.98px) {
    .login-card {
        display: block;
        min-height: auto;
        margin-top: 30px;
        border-radius: 17px;
    }

    .login-presentation {
        padding: 34px 28px;
    }

        .login-presentation h1 {
            font-size: 1.75rem;
        }

        .login-presentation > div > p {
            font-size: 0.88rem;
        }

    .login-security {
        display: none;
    }

    .login-form-panel {
        padding: 34px 28px;
    }
}

@media (max-width: 420px) {
    .login-presentation {
        display: none;
    }

    .login-form-panel {
        padding: 32px 22px;
    }

    .login-card {
        margin-top: 70px;
    }
}

.page-heading-actions {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
}

.data-card,
.form-card {
    overflow: hidden;
    background: var(--app-surface);
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius);
    box-shadow: var(--app-shadow);
}

.data-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 18px 20px;
    border-bottom: 1px solid var(--app-border);
}

.search-form {
    display: flex;
    width: min(100%, 680px);
    gap: 9px;
}

    .search-form .form-control {
        flex: 1;
    }

.data-count {
    color: var(--app-muted);
    font-size: 0.8rem;
    white-space: nowrap;
}

.app-table thead th {
    padding: 13px 18px;
    color: var(--app-muted);
    background: #f7f9fb;
    border-bottom: 1px solid var(--app-border);
    font-size: 0.72rem;
    font-weight: 750;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    white-space: nowrap;
}

.app-table tbody td {
    padding: 15px 18px;
    border-color: #edf1f4;
    font-size: 0.87rem;
}

.provider-cell {
    display: flex;
    align-items: center;
    min-width: 250px;
    gap: 12px;
}

    .provider-cell > div:last-child {
        display: flex;
        flex-direction: column;
    }

    .provider-cell small {
        color: var(--app-muted);
        font-size: 0.72rem;
    }

.provider-avatar {
    display: grid;
    width: 38px;
    height: 38px;
    place-items: center;
    flex-shrink: 0;
    color: var(--app-primary);
    background: #e7f1f8;
    border-radius: 10px;
    font-weight: 750;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 5px 9px;
    border-radius: 100px;
    font-size: 0.72rem;
    font-weight: 700;
}

    .status-badge.active {
        color: #12643b;
        background: #e3f5eb;
    }

    .status-badge.inactive {
        color: #7b4650;
        background: #f5e8eb;
    }

.empty-state {
    display: flex;
    min-height: 390px;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    padding: 45px 20px;
    text-align: center;
}

.empty-state-icon {
    display: grid;
    width: 64px;
    height: 64px;
    margin-bottom: 17px;
    place-items: center;
    color: var(--app-primary);
    background: #e7f1f8;
    border-radius: 18px;
}

    .empty-state-icon svg {
        width: 31px;
        fill: none;
        stroke: currentColor;
        stroke-width: 1.7;
        stroke-linecap: round;
    }

.empty-state h2 {
    font-size: 1.05rem;
    font-weight: 700;
}

.empty-state p {
    margin-bottom: 20px;
    color: var(--app-muted);
    font-size: 0.86rem;
}

.form-card {
    max-width: 920px;
}

.form-section {
    padding: 28px;
}

.form-section-heading {
    margin-bottom: 25px;
}

    .form-section-heading h2 {
        margin-bottom: 5px;
        font-size: 1.1rem;
        font-weight: 700;
    }

    .form-section-heading p {
        margin: 0;
        color: var(--app-muted);
        font-size: 0.83rem;
    }

.form-card .form-label {
    font-size: 0.82rem;
    font-weight: 650;
}

.form-label.required::after {
    content: " *";
    color: var(--app-danger);
}

.form-card .alert:empty {
    display: none;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 18px 28px;
    background: #f8fafb;
    border-top: 1px solid var(--app-border);
}

.back-link {
    display: inline-block;
    margin-bottom: 16px;
    color: var(--app-primary);
    font-size: 0.82rem;
    font-weight: 650;
}

@media (max-width: 767.98px) {
    .page-heading-actions,
    .data-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

        .page-heading-actions .btn {
            width: 100%;
        }

    .search-form {
        flex-wrap: wrap;
    }

        .search-form .form-control {
            width: 100%;
            flex-basis: 100%;
        }

    .form-section {
        padding: 22px 18px;
    }

    .form-actions {
        padding: 16px 18px;
    }
}

.source-information {
    display: flex;
    max-width: 920px;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
    padding: 16px 18px;
    color: #28516d;
    background: #eaf4fa;
    border: 1px solid #cee4f1;
    border-radius: 12px;
}

.source-information-icon {
    display: grid;
    width: 43px;
    height: 43px;
    place-items: center;
    flex-shrink: 0;
    color: var(--app-primary);
    background: #fff;
    border-radius: 11px;
}

    .source-information-icon svg {
        width: 24px;
        fill: none;
        stroke: currentColor;
        stroke-width: 1.7;
        stroke-linecap: round;
        stroke-linejoin: round;
    }

.source-information strong {
    display: block;
    margin-bottom: 3px;
    font-size: 0.86rem;
}

.source-information p {
    margin: 0;
    font-size: 0.78rem;
}

.import-search {
    padding: 24px;
    border-bottom: 1px solid var(--app-border);
}

    .import-search .search-form {
        display: block;
        width: min(100%, 720px);
    }

    .import-search .form-label {
        margin-bottom: 8px;
        font-size: 0.82rem;
        font-weight: 650;
    }

.search-control {
    display: flex;
    gap: 9px;
}

    .search-control .form-control {
        flex: 1;
    }

.results-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    background: #f8fafb;
    border-top: 1px solid var(--app-border);
    border-bottom: 1px solid var(--app-border);
}

    .results-heading > div {
        display: flex;
        gap: 8px;
    }

    .results-heading strong {
        font-size: 0.82rem;
    }

    .results-heading span {
        color: var(--app-muted);
        font-size: 0.8rem;
    }

.status-badge.imported {
    color: #315f7d;
    background: #e4eff6;
}

@media (max-width: 575.98px) {
    .search-control {
        flex-direction: column;
    }

        .search-control .btn {
            width: 100%;
        }
}

.detail-section-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
}

    .detail-section-heading h2 {
        margin-bottom: 4px;
        font-size: 1.05rem;
        font-weight: 750;
    }

    .detail-section-heading p {
        margin: 0;
        color: var(--app-muted);
        font-size: 0.8rem;
    }

.source-label {
    padding: 6px 9px;
    color: var(--app-primary);
    background: #e7f1f8;
    border-radius: 100px;
    font-size: 0.7rem;
    font-weight: 700;
    white-space: nowrap;
}

.detail-grid {
    display: grid;
    margin: 0;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 22px 28px;
}

    .detail-grid > div {
        padding-bottom: 15px;
        border-bottom: 1px solid var(--app-border);
    }

    .detail-grid dt {
        margin-bottom: 6px;
        color: var(--app-muted);
        font-size: 0.72rem;
        font-weight: 650;
        text-transform: uppercase;
    }

    .detail-grid dd {
        margin: 0;
        font-size: 0.92rem;
        font-weight: 650;
    }

.state-summary {
    display: flex;
    flex-direction: column;
    gap: 13px;
}

.state-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding-bottom: 13px;
    border-bottom: 1px solid var(--app-border);
    font-size: 0.82rem;
}

.access-information {
    margin-top: 20px;
}

    .access-information p {
        color: var(--app-muted);
        font-size: 0.8rem;
        line-height: 1.6;
    }

.detail-metadata {
    margin-top: 20px;
    padding-top: 15px;
    color: var(--app-muted);
    border-top: 1px solid var(--app-border);
    font-size: 0.72rem;
}

.empty-state.compact {
    min-height: 190px;
    padding: 25px;
}

    .empty-state.compact h3 {
        font-size: 0.95rem;
        font-weight: 700;
    }

.app-modal {
    border: 0;
    border-radius: 14px;
    box-shadow: 0 25px 80px rgba(16, 56, 84, 0.22);
}

    .app-modal .modal-header,
    .app-modal .modal-footer {
        border-color: var(--app-border);
    }

@media (max-width: 767.98px) {
    .detail-grid {
        grid-template-columns: 1fr;
    }

    .detail-section-heading {
        flex-direction: column;
    }
}

.activation-card {
    min-height: 535px;
}

.password-requirements {
    margin-bottom: 22px;
    padding: 13px 15px;
    color: var(--app-muted);
    background: #f5f8fa;
    border: 1px solid var(--app-border);
    border-radius: 9px;
    font-size: 0.76rem;
}

    .password-requirements strong {
        display: block;
        margin-bottom: 5px;
        color: var(--app-text);
    }

    .password-requirements ul {
        margin: 0;
        padding-left: 18px;
    }

/* Detalle del proveedor: permite apilar varias tarjetas sin desbordamiento. */
.provider-detail-layout .app-card {
    height: auto;
}

.provider-detail-layout > [class*="col-"] {
    min-width: 0;
}

.request-processing {
    cursor: wait !important;
}

    .request-processing * {
        cursor: wait !important;
    }

.processing-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(15, 35, 50, 0.42);
    backdrop-filter: blur(2px);
}

    .processing-overlay[hidden] {
        display: none !important;
    }

.processing-overlay-content {
    display: flex;
    width: min(360px, 100%);
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 28px;
    color: var(--app-text);
    background: var(--app-surface);
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius);
    box-shadow: 0 18px 50px rgba(10, 32, 49, 0.22);
    text-align: center;
}

    .processing-overlay-content strong {
        font-size: 1rem;
    }

    .processing-overlay-content span {
        color: var(--app-muted);
        font-size: 0.86rem;
        line-height: 1.5;
    }

.provider-summary-card {
    padding: 16px 20px;
}

    .provider-summary-card h2 {
        font-size: 1.15rem;
    }

@media (max-width: 575.98px) {
    .provider-summary-card {
        padding: 15px;
    }
}

.document-viewer-card {
    height: auto;
}

.document-pdf-viewer {
    display: block;
    width: 100%;
    height: 72vh;
    min-height: 620px;
    background: #eef2f5;
    border: 1px solid var(--app-border);
    border-radius: 8px;
}

.document-xml-viewer {
    width: 100%;
    height: 72vh;
    min-height: 620px;
    margin: 0;
    padding: 18px;
    overflow: auto;
    color: #d9e7f2;
    background: #102b3d;
    border-radius: 8px;
    font-family: Consolas, "Courier New", monospace;
    font-size: 0.82rem;
    line-height: 1.5;
    white-space: pre;
}

@media (max-width: 991.98px) {
    .document-pdf-viewer,
    .document-xml-viewer {
        height: 65vh;
        min-height: 480px;
    }
}

@media (max-width: 575.98px) {
    .document-pdf-viewer,
    .document-xml-viewer {
        height: 60vh;
        min-height: 400px;
    }
}

.document-review-layout > [class*="col-"] {
    min-width: 0;
}

    .document-review-layout > [class*="col-"] > .app-card {
        height: auto;
    }

        .document-review-layout > [class*="col-"] > .app-card:last-child {
            margin-bottom: 0;
        }