body.nx-portal {
    --text: #233745;
    --muted: #4c6475;
    --heading: #17324d;
    --brand: #096d76;
    --brand-hover: #075861;
    --line: #d8e3e9;
    --surface: #fff;
    --background: #f3f7f9;
    --focus: #0a7983;
    --error: #a3211b;
    min-height: 100vh;
    margin: 0;
    background: var(--background);
    color: var(--text);
    font: 14px/1.45 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.nx-portal *,
.nx-portal *::before,
.nx-portal *::after {
    box-sizing: border-box;
}

.nx-portal [hidden] {
    display: none !important;
}

.nx-portal h1,
.nx-portal p {
    margin: 0;
}

.nx-portal h1 {
    color: var(--heading);
    font-size: 23px;
    font-weight: 670;
    letter-spacing: -.02em;
    line-height: 1.22;
}

.nx-portal a {
    color: var(--brand);
    font-weight: 590;
    text-underline-offset: .18em;
}

.nx-portal button,
.nx-portal input {
    font: inherit;
}

.nx-portal :focus-visible {
    outline: 2px solid var(--focus);
    outline-offset: 3px;
}

.nx-portal .nx-topbar {
    border-bottom: 1px solid var(--line);
    background: var(--surface);
}

.nx-portal .nx-topbar-content {
    display: flex;
    min-height: 62px;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-inline: auto;
    padding: 8px 20px;
    max-width: 1120px;
}

.nx-portal .nx-logo {
    display: block;
    width: 116px;
    height: auto;
}

.nx-portal .nx-main {
    max-width: 1120px;
    margin-inline: auto;
    padding: 28px 20px;
}

.nx-portal .nx-main-small {
    max-width: 560px;
}

.nx-portal .nx-panel {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
}

.nx-portal .nx-auth-panel {
    padding: 20px;
    border-top: 3px solid var(--brand);
}

.nx-portal .nx-subtitle {
    margin-top: 6px;
    color: var(--muted);
    font-size: 13px;
}

.nx-portal .nx-auth-form {
    display: grid;
    gap: 13px;
    margin-top: 16px;
}

.nx-portal .nx-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px 12px;
}

.nx-portal .nx-field-wide {
    grid-column: 1 / -1;
}

.nx-portal .nx-label {
    display: block;
    margin-bottom: 4px;
    color: var(--heading);
    font-size: 13px;
    font-weight: 630;
}

.nx-portal .nx-input {
    display: block;
    width: 100%;
    min-width: 0;
    min-height: 39px;
    padding: 8px 10px;
    border: 1px solid #a8bfcb;
    border-radius: 6px;
    background: var(--surface);
    color: var(--text);
    line-height: 1.35;
}

.nx-portal .nx-input::placeholder {
    color: var(--muted);
}

.nx-portal .nx-password {
    display: flex;
    align-items: stretch;
    gap: 6px;
}

.nx-portal .nx-password .nx-input {
    flex: 1;
}

.nx-portal .nx-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    min-height: 37px;
    padding: 6px 12px;
    border: 1px solid transparent;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 640;
    line-height: 1.2;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
}

.nx-portal .nx-primary {
    background: var(--brand);
    color: #fff;
}

.nx-portal .nx-primary:hover {
    background: var(--brand-hover);
}

.nx-portal .nx-secondary {
    border-color: #b8cbd6;
    background: var(--surface);
    color: var(--heading);
}

.nx-portal .nx-secondary:hover {
    background: #edf5f7;
}

.nx-portal .nx-button:disabled {
    border-color: var(--line);
    background: #ecf1f4;
    color: var(--muted);
    cursor: not-allowed;
}

.nx-portal .nx-inline-actions,
.nx-portal .nx-form-options {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 14px;
}

.nx-portal .nx-form-options {
    justify-content: space-between;
}

.nx-portal .nx-check {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 37px;
    cursor: pointer;
}

.nx-portal .nx-check input {
    width: 16px;
    height: 16px;
    margin: 0;
    accent-color: var(--brand);
}

.nx-portal .nx-alert {
    margin-top: 12px;
    padding: 8px 10px;
    border-radius: 6px;
    background: #e9f4f4;
    color: #174e55;
    overflow-wrap: anywhere;
}

.nx-portal .nx-alert-error {
    background: #fcefee;
    color: var(--error);
}

.nx-portal .nx-headingbar {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.nx-portal .nx-search {
    width: min(100%, 270px);
}

.nx-portal .nx-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 13px;
}

.nx-portal .nx-table th,
.nx-portal .nx-table td {
    padding: 9px 12px;
    overflow-wrap: anywhere;
    vertical-align: middle;
}

.nx-portal .nx-table th {
    border-bottom: 1px solid var(--line);
    background: #eaf1f5;
    color: var(--heading);
    font-weight: 650;
}

.nx-portal .nx-table tbody tr + tr {
    border-top: 1px solid var(--line);
}

.nx-portal .nx-table tbody tr:hover {
    background: #f5f9fa;
}

.nx-portal .nx-table td:last-child,
.nx-portal .nx-table th:last-child {
    text-align: right;
}

.nx-portal .nx-company {
    display: flex;
    align-items: center;
    gap: 10px;
}

.nx-portal .nx-company-logo,
.nx-portal .nx-company-mark {
    display: inline-flex;
    flex: 0 0 36px;
    width: 36px;
    height: 36px;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #f0f6f8;
    color: var(--heading);
    font-weight: 720;
    object-fit: contain;
}

.nx-portal .nx-company-name {
    display: block;
    color: var(--heading);
    font-size: 14px;
    line-height: 1.3;
}

.nx-portal .nx-detail {
    display: block;
    margin-top: 2px;
    color: var(--muted);
    font-size: 12px;
}

.nx-portal .nx-status {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 4px;
    background: #edf2f5;
    color: var(--heading);
    font-size: 12px;
    font-weight: 650;
}

.nx-portal .nx-status-active {
    background: #e7f4ed;
    color: #16663e;
}

.nx-portal .nx-status-warning {
    background: #fbefdc;
    color: #805200;
}

.nx-portal .nx-empty {
    padding: 12px;
    color: var(--muted);
}

.nx-portal .nx-mobile-label {
    display: none;
}

.nx-portal .nx-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
}

@media (max-width: 680px) {
    .nx-portal .nx-topbar-content,
    .nx-portal .nx-main {
        padding-inline: 12px;
    }

    .nx-portal .nx-main {
        padding-block: 16px;
    }

    .nx-portal .nx-auth-panel {
        padding: 15px;
    }

    .nx-portal .nx-fields {
        grid-template-columns: 1fr;
    }

    .nx-portal .nx-input,
    .nx-portal .nx-button,
    .nx-portal .nx-check {
        min-height: 44px;
    }

    .nx-portal .nx-input {
        font-size: 16px;
    }

    .nx-portal .nx-headingbar {
        align-items: stretch;
        flex-direction: column;
    }

    .nx-portal .nx-search {
        width: 100%;
    }

    .nx-portal .nx-table,
    .nx-portal .nx-table tbody {
        display: block;
    }

    .nx-portal .nx-table thead {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
    }

    .nx-portal .nx-table tbody tr {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        gap: 7px 10px;
        padding: 10px 12px;
    }

    .nx-portal .nx-table td {
        display: block;
        padding: 0;
    }

    .nx-portal .nx-table tbody td:first-child,
    .nx-portal .nx-table tbody td:last-child {
        grid-column: 1 / -1;
        text-align: left;
    }

    .nx-portal .nx-mobile-label {
        display: block;
        color: var(--muted);
        font-size: 12px;
    }
}

.nx-portal .nx-system-list {
    margin-top: 9px;
}

.nx-portal .nx-account-actions {
    margin-top: 12px;
}

.nx-portal .nx-row-actions {
    justify-content: flex-end;
}

.nx-portal .nx-row-actions + .nx-row-actions {
    margin-top: 6px;
}

@media (max-width: 680px) {
    .nx-portal .nx-row-actions {
        display: inline-flex;
        justify-content: flex-start;
    }

    .nx-portal .nx-row-actions + .nx-row-actions {
        margin: 0 0 0 6px;
    }
}

/* Pantallas de acceso (sin sesión): foto de fondo con velo azul y tarjeta de ingreso. */
.nx-portal.nx-scene {
    --brand: #185adb;
    --brand-hover: #0e43ad;
    --focus: #185adb;
    display: flex;
    align-items: center;
    background: #0b1a3a center / cover no-repeat fixed;
}

.nx-portal.nx-scene-1 {
    background-image: linear-gradient(120deg, rgba(5, 10, 24, .88), rgba(12, 30, 70, .66) 55%, rgba(18, 58, 110, .58)), url("fondo-1.jpg");
}

.nx-portal.nx-scene-2 {
    background-image: linear-gradient(120deg, rgba(5, 10, 24, .88), rgba(12, 30, 70, .66) 55%, rgba(18, 58, 110, .58)), url("fondo-2.jpg");
}

.nx-portal.nx-scene-3 {
    background-image: linear-gradient(120deg, rgba(5, 10, 24, .88), rgba(12, 30, 70, .66) 55%, rgba(18, 58, 110, .58)), url("fondo-3.jpg");
}

.nx-portal.nx-scene-4 {
    background-image: linear-gradient(120deg, rgba(5, 10, 24, .88), rgba(12, 30, 70, .66) 55%, rgba(18, 58, 110, .58)), url("fondo-4.jpg");
}

.nx-portal.nx-scene-5 {
    background-image: linear-gradient(120deg, rgba(5, 10, 24, .88), rgba(12, 30, 70, .66) 55%, rgba(18, 58, 110, .58)), url("fondo-5.jpg");
}

.nx-portal.nx-scene-6 {
    background-image: linear-gradient(120deg, rgba(5, 10, 24, .88), rgba(12, 30, 70, .66) 55%, rgba(18, 58, 110, .58)), url("fondo-6.jpg");
}

.nx-portal.nx-scene h1 {
    color: #10213f;
}

.nx-portal .nx-access {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 400px);
    align-items: center;
    gap: 48px;
    width: 100%;
}

.nx-portal .nx-brand {
    color: #fff;
}

.nx-portal .nx-brand-chip {
    display: inline-block;
    padding: 4px 12px;
    border: 1px solid rgba(255, 255, 255, .28);
    border-radius: 999px;
    background: rgba(255, 255, 255, .1);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.nx-portal .nx-brand-title {
    max-width: 15em;
    margin-top: 16px;
    font-size: 36px;
    font-weight: 760;
    letter-spacing: -.02em;
    line-height: 1.15;
}

.nx-portal .nx-brand-text {
    max-width: 34em;
    margin-top: 12px;
    color: #d9e6f7;
    font-size: 15px;
}

.nx-portal .nx-access .nx-auth-panel {
    padding: 26px;
    border: 0;
    border-top: 4px solid #f59f0b;
    border-radius: 16px;
    box-shadow: 0 30px 70px rgba(2, 8, 22, .45);
}

.nx-portal .nx-card-logo {
    display: block;
    width: 172px;
    height: auto;
    margin: 0 auto 16px;
}

.nx-portal .nx-access .nx-primary {
    flex: 1;
    min-height: 42px;
}

.nx-portal .nx-access .nx-secondary {
    min-height: 42px;
}

@media (max-width: 800px) {
    .nx-portal.nx-scene {
        background-attachment: scroll;
    }

    .nx-portal .nx-access {
        display: block;
        max-width: 460px;
    }

    .nx-portal .nx-brand {
        display: none;
    }
}

/* Dentro del portal (con sesión): barra de cuenta y lista de empresas sobre la misma foto. */
.nx-portal.nx-inside {
    display: block;
}

.nx-portal.nx-inside .nx-topbar {
    border: 0;
    box-shadow: 0 8px 26px rgba(2, 8, 22, .3);
}

.nx-portal .nx-account {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 8px 18px;
}

.nx-portal.nx-inside .nx-headingbar h1 {
    color: #fff;
    font-size: 26px;
}

.nx-portal .nx-lead {
    margin-top: 2px;
    color: #d9e6f7;
}

.nx-portal.nx-inside .nx-headingbar .nx-label {
    color: #fff;
}

.nx-portal.nx-inside .nx-panel {
    border: 0;
    border-radius: 14px;
    box-shadow: 0 26px 60px rgba(2, 8, 22, .42);
}

.nx-portal.nx-inside .nx-system-list {
    margin-top: 14px;
    border-top: 4px solid #f59f0b;
}

.nx-portal.nx-inside .nx-table th {
    padding-block: 11px;
    background: #eef3fc;
    color: #10213f;
}

.nx-portal.nx-inside .nx-table td {
    padding-block: 14px;
}

.nx-portal.nx-inside .nx-company {
    gap: 14px;
}

.nx-portal.nx-inside .nx-company-logo,
.nx-portal.nx-inside .nx-company-mark {
    flex: 0 0 56px;
    width: 56px;
    height: 56px;
    border-radius: 12px;
}

.nx-portal.nx-inside .nx-company-logo {
    padding: 4px;
    background: #fff;
}

.nx-portal.nx-inside .nx-company-mark {
    border: 0;
    background: linear-gradient(145deg, #185adb, #0c2d6c);
    color: #fff;
    font-size: 22px;
}

.nx-portal.nx-inside .nx-company-name {
    font-size: 15px;
}

.nx-portal.nx-inside .nx-row-actions .nx-primary {
    min-width: 110px;
    min-height: 40px;
}

@media (max-width: 680px) {
    .nx-portal.nx-inside .nx-topbar-content {
        flex-wrap: wrap;
    }

    .nx-portal .nx-account a {
        display: inline-flex;
        align-items: center;
        min-height: 44px;
    }
}

.nx-portal.nx-inside .nx-table a.nx-primary {
    min-width: 110px;
    min-height: 40px;
    color: #fff;
}
