:root {
    --krosfy-navy: #0f172a;
    --krosfy-blue: #2563eb;
    --krosfy-blue-dark: #1d4ed8;
    --krosfy-cyan: #38bdf8;
    --text: #111827;
    --muted: #64748b;
    --line: #e2e8f0;
    --surface: #ffffff;
    --surface-soft: #f8fafc;
    --danger: #b91c1c;
    --focus: #60a5fa;
    --shadow: 0 24px 70px rgba(15, 23, 42, 0.18);
    --auth-accent: var(--krosfy-blue);
    --auth-button: var(--krosfy-blue);
    --auth-panel-start: var(--krosfy-navy);
    --auth-panel-end: #1e40af;
    --auth-panel-text: #ffffff;
    --auth-feature: #3b5bb5;
    --auth-panel-image: none;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    min-width: 320px;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-width: 320px;
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
    color: var(--text);
    background:
        radial-gradient(circle at 15% 15%, rgba(56, 189, 248, 0.20), transparent 28rem),
        radial-gradient(circle at 85% 5%, rgba(37, 99, 235, 0.18), transparent 24rem),
        linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.5;
    text-rendering: optimizeLegibility;
}

button,
input {
    font: inherit;
}

button,
a,
input {
    -webkit-tap-highlight-color: transparent;
}

button {
    cursor: pointer;
}

:focus-visible {
    outline: 3px solid var(--focus);
    outline-offset: 3px;
}

.skip-link {
    position: fixed;
    top: 0.75rem;
    left: 0.75rem;
    z-index: 1000;
    transform: translateY(-180%);
    padding: 0.75rem 1rem;
    border-radius: 0.75rem;
    color: #fff;
    background: var(--krosfy-navy);
    font-weight: 800;
    text-decoration: none;
    transition: transform 0.15s ease;
}

.skip-link:focus {
    transform: translateY(0);
}

.auth-shell {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    min-height: 100vh;
    min-height: 100dvh;
}

/* Language selection */
.auth-language-bar {
    position: relative;
    z-index: 10;
    display: flex;
    justify-content: flex-end;
    width: min(1120px, calc(100% - 2rem));
    margin: 0 auto;
    padding-top: max(0.75rem, env(safe-area-inset-top));
}

.language-selector {
    display: grid;
    gap: 0.4rem;
    width: min(100%, 300px);
    min-width: 0;
    padding: 0.55rem;
    border: 1px solid var(--line);
    border-radius: 15px;
    color: var(--text);
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.08);
}

.language-selector-label {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    color: #475569;
    font-size: 0.72rem;
    font-weight: 800;
    line-height: 1.2;
}

.language-selector-controls {
    display: block;
    min-width: 0;
}

.language-selector-select {
    width: 100%;
    min-width: 0;
    min-height: 42px;
    padding: 0.55rem 2.25rem 0.55rem 0.7rem;
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: 10px;
    color: #334155;
    background-color: rgba(255, 255, 255, 0.96);
    font: inherit;
    font-size: 0.8rem;
    font-weight: 800;
    cursor: pointer;
}

/* Authentication page */
.auth-page {
    display: grid;
    place-items: center;
    align-content: center;
    gap: 1rem;
    width: 100%;
    min-width: 0;
    min-height: 0;
    padding: 1rem 2rem max(2rem, env(safe-area-inset-bottom));
}

.auth-card {
    display: grid;
    grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr);
    width: min(1120px, 100%);
    min-width: 0;
    min-height: min(690px, calc(100dvh - 7rem));
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.7);
    border-radius: 32px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
}

.auth-panel,
.auth-logo-row > div:last-child,
.visual-content,
.input-shell,
.input-shell input {
    min-width: 0;
}

.auth-panel {
    padding: clamp(2rem, 4vw, 4rem);
}

.auth-form-panel {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 1.5rem;
}

.auth-logo-row {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    min-width: 0;
}

.auth-logo {
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    border-radius: 16px;
    color: #fff;
    background: linear-gradient(135deg, var(--krosfy-blue), var(--krosfy-navy));
    box-shadow: 0 16px 30px rgba(37, 99, 235, 0.28);
    font-weight: 800;
    letter-spacing: -0.04em;
}

img.auth-logo {
    object-fit: contain;
    padding: .35rem;
    background: #fff;
}

.auth-logo-row strong {
    display: block;
    line-height: 1.2;
    overflow-wrap: anywhere;
}

.auth-logo-row span {
    display: block;
    margin-top: 0.15rem;
    color: var(--muted);
    font-size: 0.88rem;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.eyebrow,
.demo-title {
    color: var(--krosfy-blue);
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.auth-heading h1,
.visual-content h2,
.auth-logo-row strong {
    letter-spacing: -0.04em;
}

.auth-heading h1 {
    margin: 0.35rem 0 0.75rem;
    font-size: clamp(2rem, 4vw, 3rem);
    line-height: 1.05;
    overflow-wrap: anywhere;
}

.auth-heading p,
.visual-content p {
    margin: 0;
    color: var(--muted);
    line-height: 1.7;
    overflow-wrap: anywhere;
}

.auth-form-panel form:not(.language-selector),
.auth-secondary-form {
    display: grid;
    gap: 0.7rem;
    min-width: 0;
}

.auth-form-panel label {
    color: #334155;
    font-size: 0.86rem;
    font-weight: 700;
}

.input-shell {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--surface-soft);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.input-shell:focus-within {
    border-color: var(--krosfy-blue);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.input-shell:has(.input-validation-error) {
    border-color: #ef4444;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

.input-shell i {
    flex: 0 0 auto;
    color: var(--muted);
}

.input-shell input {
    width: 100%;
    min-height: 26px;
    border: 0;
    outline: 0;
    color: var(--text);
    background: transparent;
}

.password-hold-toggle {
    display: inline-grid;
    place-items: center;
    flex: 0 0 auto;
    width: 2rem;
    height: 2rem;
    padding: 0;
    border: 0;
    border-radius: 0.55rem;
    color: var(--muted);
    background: transparent;
    cursor: pointer;
    touch-action: none;
}

.password-hold-toggle:hover,
.password-hold-toggle:focus-visible,
.password-hold-toggle.is-revealing {
    color: var(--krosfy-blue);
    background: rgba(37, 99, 235, 0.1);
    outline: none;
}

.input-shell input[readonly] {
    color: #475569;
}

.field-validation,
.auth-error {
    color: var(--danger);
    font-size: 0.82rem;
    font-weight: 600;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.field-validation:empty,
.auth-error.validation-summary-valid {
    display: none;
}

.auth-error ul {
    margin: 0;
    padding-left: 1.1rem;
}

.form-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin: 0.25rem 0 0.45rem;
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 44px;
    color: var(--muted);
    font-weight: 600;
}

.checkbox-row input {
    width: 1.05rem;
    height: 1.05rem;
    accent-color: var(--krosfy-blue);
}

.auth-submit,
.demo-credentials button,
.auth-text-button {
    min-height: 44px;
    border: 0;
    font: inherit;
}

.auth-submit {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.8rem;
    min-height: 52px;
    padding: 0.8rem 1rem;
    border-radius: 16px;
    color: #fff;
    background: linear-gradient(135deg, var(--krosfy-blue), var(--krosfy-blue-dark));
    box-shadow: 0 16px 32px rgba(37, 99, 235, 0.26);
    font-weight: 800;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.auth-submit:hover {
    transform: translateY(-1px);
    box-shadow: 0 20px 42px rgba(37, 99, 235, 0.34);
}

.auth-secondary-form {
    margin-top: -0.4rem;
}

.auth-text-button {
    width: 100%;
    padding: 0.55rem 0.75rem;
    border-radius: 12px;
    color: var(--krosfy-blue);
    background: transparent;
    font-weight: 800;
    text-align: center;
}

.auth-text-button:hover {
    background: #eff6ff;
}

.auth-success {
    display: flex;
    align-items: flex-start;
    gap: 0.55rem;
    padding: 0.85rem 1rem;
    border: 1px solid #bbf7d0;
    border-radius: 14px;
    color: #166534;
    background: #dcfce7;
    font-weight: 700;
    overflow-wrap: anywhere;
}

.auth-success i {
    margin-top: 0.2rem;
}

.auth-register-link {
    margin: 0;
    color: var(--muted);
    text-align: center;
    overflow-wrap: anywhere;
}

.auth-register-link a {
    color: var(--krosfy-blue);
    font-weight: 800;
    text-decoration: none;
}

.auth-register-link a:hover {
    text-decoration: underline;
    text-underline-offset: 0.18em;
}

/* Visual panel */
.auth-visual-panel {
    position: relative;
    display: flex;
    align-items: flex-end;
    overflow: hidden;
    color: #fff;
    background:
        linear-gradient(135deg, rgba(15, 23, 42, 0.98), rgba(30, 64, 175, 0.9)),
        radial-gradient(circle at 20% 20%, rgba(56, 189, 248, 0.45), transparent 22rem);
}

.auth-visual-panel::before,
.auth-visual-panel::after {
    content: "";
    position: absolute;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 999px;
    pointer-events: none;
}

.auth-visual-panel::before {
    top: -120px;
    right: -120px;
    width: 430px;
    height: 430px;
}

.auth-visual-panel::after {
    bottom: 18%;
    left: -90px;
    width: 260px;
    height: 260px;
}

.visual-content {
    position: relative;
    z-index: 1;
    max-width: 590px;
}

.visual-content h2 {
    margin: 0 0 1rem;
    font-size: clamp(2.1rem, 4.5vw, 4.5rem);
    line-height: 0.98;
    overflow-wrap: anywhere;
}

.visual-content p {
    max-width: 52ch;
    color: #cbd5e1;
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    margin-top: 2.5rem;
}

.feature-grid div {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
    padding: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(12px);
    font-weight: 700;
}

.feature-grid i {
    flex: 0 0 auto;
    color: #93c5fd;
}

.feature-grid span {
    min-width: 0;
    overflow-wrap: anywhere;
}

/* Credenciales disponibles únicamente en Development. */
.demo-credentials {
    display: grid;
    gap: 0.9rem;
    width: min(1320px, 100%);
    padding: 1rem;
    border: 1px dashed #bfdbfe;
    border-radius: 20px;
    background: #eff6ff;
}

.demo-title {
    line-height: 1.3;
}

.demo-credentials-group {
    display: grid;
    grid-template-columns: minmax(140px, 180px) minmax(0, 1fr);
    gap: 0.8rem;
    align-items: start;
    padding-top: 0.8rem;
    border-top: 1px solid rgba(59, 130, 246, 0.16);
}

.demo-credentials-group:first-of-type {
    padding-top: 0;
    border-top: 0;
}

.demo-context-label {
    padding: 0.75rem 0.25rem;
    color: #1e3a8a;
    font-size: 0.78rem;
    font-weight: 900;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.demo-credential-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 0.7rem;
    min-width: 0;
}

.demo-credentials button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    min-width: 0;
    padding: 0.8rem;
    border: 1px solid #dbeafe;
    border-radius: 14px;
    color: #1e3a8a;
    background: #fff;
    font-weight: 800;
    overflow-wrap: anywhere;
}

.demo-credentials button:hover {
    background: #dbeafe;
}

@media (max-width: 900px) {
    .auth-page {
        place-items: start center;
    }

    .auth-card {
        grid-template-columns: minmax(0, 1fr);
        min-height: auto;
    }

    .auth-form-panel {
        order: 1;
    }

    .auth-visual-panel {
        order: 2;
        min-height: 320px;
    }

    .visual-content h2 {
        font-size: clamp(2rem, 8vw, 3.5rem);
    }

    .demo-credentials-group {
        grid-template-columns: minmax(0, 1fr);
        gap: 0.35rem;
    }

    .demo-context-label {
        padding-bottom: 0.25rem;
    }
}

@media (max-width: 640px) {
    .language-option {
        min-height: 44px;
    }

    .auth-language-bar {
        justify-content: stretch;
        width: calc(100% - 1.5rem);
    }

    .language-selector {
        width: 100%;
    }

    .auth-page {
        padding: 0.75rem;
        padding-bottom: max(1.25rem, env(safe-area-inset-bottom));
    }

    .auth-card {
        border-radius: 22px;
    }

    .auth-panel {
        padding: 1.35rem;
    }

    .auth-form-panel {
        gap: 1.25rem;
    }

    .auth-heading h1 {
        font-size: clamp(1.9rem, 11vw, 2.55rem);
    }

    .form-row {
        align-items: flex-start;
        flex-direction: column;
    }

    .feature-grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 0.7rem;
        margin-top: 1.5rem;
    }

    .feature-grid div {
        padding: 0.85rem;
    }

    .auth-visual-panel {
        min-height: 280px;
    }

    .demo-credentials {
        border-radius: 18px;
    }

    .demo-credential-buttons {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 380px) {
    .auth-language-bar {
        width: calc(100% - 1rem);
    }

    .auth-page {
        padding-inline: 0.5rem;
    }

    .auth-panel {
        padding: 1.1rem;
    }

    .language-option {
        font-size: 0.72rem;
    }

    .auth-logo {
        width: 44px;
        height: 44px;
        border-radius: 14px;
    }
}

@media (max-height: 700px) and (min-width: 901px) {
    .auth-page {
        place-items: start center;
    }

    .auth-card {
        min-height: 620px;
    }

    .auth-panel {
        padding-block: 2rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}


/* Focused authentication flows (password recovery / reset). */
.auth-card.auth-card-single {
    grid-template-columns: minmax(0, 1fr);
    width: min(640px, 100%);
    min-height: 0;
}

.auth-form-options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.auth-inline-link,
.development-reset-link a {
    color: var(--krosfy-blue);
    font-weight: 800;
    text-decoration: none;
}

.auth-inline-link:hover,
.development-reset-link a:hover {
    text-decoration: underline;
}

.development-reset-link span {
    display: grid;
    gap: 0.35rem;
}


/* Feedback del submit de login: mantiene informado al usuario mientras el servidor autentica y carga el portal. */
.auth-submit.is-loading {
    cursor: wait;
    opacity: 0.88;
    transform: none;
    box-shadow: 0 12px 26px rgba(37, 99, 235, 0.2);
}

.auth-submit.is-loading::before {
    content: "";
    width: 1rem;
    height: 1rem;
    flex: 0 0 1rem;
    border: 2px solid rgba(255, 255, 255, 0.45);
    border-top-color: #fff;
    border-radius: 50%;
    animation: auth-submit-spin 0.7s linear infinite;
}

.auth-submit.is-loading > i {
    display: none;
}

@keyframes auth-submit-spin {
    to {
        transform: rotate(360deg);
    }
}

.auth-footer {
    padding: 0.8rem 1rem 1.2rem;
    color: #64748b;
    font-size: 0.78rem;
    font-weight: 700;
    text-align: center;
}

/* El registro público reutiliza los mismos partials de perfil y contraseña que la creación ADMIN de clientes. */
.auth-register-button {
    padding: 0;
    border: 0;
    color: var(--krosfy-blue);
    background: transparent;
    font: inherit;
    font-weight: 800;
}

.auth-register-button:hover {
    text-decoration: underline;
    text-underline-offset: 0.18em;
}

.auth-registration-dialog {
    width: min(980px, calc(100vw - 2rem));
    max-width: 100%;
    max-height: 92vh;
    padding: 0;
    border: 0;
    border-radius: 24px;
    background: transparent;
    box-shadow: 0 30px 90px rgba(15, 23, 42, 0.32);
}

.auth-registration-dialog::backdrop {
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(5px);
}

.auth-maintenance-dialog {
    width: min(520px, calc(100vw - 2rem));
    max-width: 100%;
    padding: 0;
    border: 0;
    border-radius: 24px;
    color: var(--text);
    background: transparent;
    box-shadow: 0 30px 90px rgba(15, 23, 42, 0.35);
}

.auth-maintenance-dialog::backdrop {
    background: rgba(15, 23, 42, 0.72);
    backdrop-filter: blur(7px);
}

.auth-maintenance-card {
    display: grid;
    justify-items: center;
    gap: .8rem;
    padding: clamp(1.5rem, 5vw, 2.25rem);
    border: 1px solid rgba(226, 232, 240, .95);
    border-radius: 24px;
    text-align: center;
    background: #fff;
}

.auth-maintenance-card h2,
.auth-maintenance-card p {
    margin: 0;
}

.auth-maintenance-card p {
    color: var(--muted);
    line-height: 1.65;
    white-space: pre-line;
}

.auth-maintenance-icon {
    display: grid;
    place-items: center;
    width: 64px;
    height: 64px;
    border-radius: 20px;
    color: #fff;
    background: linear-gradient(145deg, #2563eb, #0ea5e9);
    box-shadow: 0 16px 30px rgba(37, 99, 235, .28);
    font-size: 1.4rem;
}

.auth-maintenance-close {
    min-height: 48px;
    padding: .75rem 1.25rem;
    border: 0;
    border-radius: 14px;
    color: #fff;
    background: linear-gradient(135deg, #2563eb, #0ea5e9);
    box-shadow: 0 12px 24px rgba(37, 99, 235, .24);
    font: inherit;
    font-weight: 800;
    cursor: pointer;
}

.auth-registration-card {
    max-height: 92vh;
    overflow: hidden;
    border: 1px solid rgba(226, 232, 240, 0.95);
    border-radius: 24px;
    background: #fff;
}

.auth-registration-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.25rem 1.4rem 1rem;
    border-bottom: 1px solid var(--line);
}

.auth-registration-header h2 {
    margin: 0.3rem 0 0.2rem;
}

.auth-registration-header p {
    margin: 0;
    color: var(--muted);
}

.auth-modal-close {
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    width: 42px;
    height: 42px;
    border: 1px solid var(--line);
    border-radius: 13px;
    color: #475569;
    background: #fff;
}

.auth-registration-content {
    max-height: calc(92vh - 120px);
    overflow-y: auto;
    overscroll-behavior: contain;
}

.auth-registration-form {
    display: grid;
    gap: 1rem;
    padding: 1.25rem 1.4rem;
}

.auth-registration-form .form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.auth-registration-form .form-field {
    display: grid;
    gap: 0.4rem;
    min-width: 0;
}

.auth-registration-form .span-full {
    grid-column: 1 / -1;
}

.auth-registration-form input,
.auth-registration-form select {
    width: 100%;
    min-height: 46px;
    padding: 0.7rem 0.8rem;
    border: 1px solid var(--line);
    border-radius: 12px;
    color: var(--text);
    background: #fff;
    font: inherit;
}

.auth-registration-form input:focus,
.auth-registration-form select:focus {
    border-color: var(--krosfy-blue);
    outline: 0;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.auth-registration-actions {
    position: sticky;
    bottom: -1.25rem;
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin: 0 -1.4rem -1.25rem;
    padding: 1rem 1.4rem 1.25rem;
    border-top: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.98);
}

.auth-registration-submit {
    width: auto;
    min-width: 190px;
}

.auth-modal-secondary {
    min-height: 48px;
    padding: 0.75rem 1rem;
    border: 1px solid var(--line);
    border-radius: 14px;
    color: #334155;
    background: #fff;
    font-weight: 800;
}

.auth-registration-loading {
    padding: 2rem;
    color: var(--muted);
    text-align: center;
}

@media (max-width: 720px) {
    .auth-registration-form .form-grid {
        grid-template-columns: 1fr;
    }

    .auth-registration-form .span-full {
        grid-column: auto;
    }

    .auth-registration-actions {
        flex-direction: column-reverse;
    }

    .auth-registration-submit,
    .auth-modal-secondary {
        width: 100%;
    }
}

/* El modal de registro público reutiliza los mismos partials de registro y contraseña que la creación ADMIN de clientes. */
.auth-register-button {
    padding: 0;
    border: 0;
    color: var(--krosfy-blue);
    background: transparent;
    font: inherit;
    font-weight: 800;
}
.auth-register-button:hover { text-decoration: underline; text-underline-offset: 0.18em; }
.auth-registration-dialog {
    width: min(980px, calc(100vw - 2rem)); max-width: 100%; max-height: 92vh;
    padding: 0; border: 0; border-radius: 24px; background: transparent;
    box-shadow: 0 30px 90px rgba(15, 23, 42, 0.32);
}
.auth-registration-dialog::backdrop { background: rgba(15, 23, 42, 0.7); backdrop-filter: blur(5px); }
.auth-registration-card { max-height: 92vh; overflow: hidden; border: 1px solid rgba(226,232,240,.95); border-radius: 24px; background: #fff; }
.auth-registration-header { display:flex; align-items:flex-start; justify-content:space-between; gap:1rem; padding:1.25rem 1.4rem 1rem; border-bottom:1px solid var(--line); }
.auth-registration-header h2 { margin:.3rem 0 .2rem; }
.auth-registration-header p { margin:0; color:var(--muted); }
.auth-modal-close { display:grid; place-items:center; flex:0 0 auto; width:42px; height:42px; border:1px solid var(--line); border-radius:13px; color:#475569; background:#fff; }
.auth-registration-content { max-height:calc(92vh - 120px); overflow-y:auto; overscroll-behavior:contain; }
.auth-registration-form { display:grid; gap:1rem; padding:1.25rem 1.4rem; }
.auth-registration-form .form-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:1rem; }
.auth-registration-form .form-field { display:grid; gap:.4rem; min-width:0; }
.auth-registration-form .span-full { grid-column:1 / -1; }
.auth-registration-form input, .auth-registration-form select { width:100%; min-height:46px; padding:.7rem .8rem; border:1px solid var(--line); border-radius:12px; color:var(--text); background:#fff; font:inherit; }
.auth-registration-form input:focus, .auth-registration-form select:focus { border-color:var(--krosfy-blue); outline:0; box-shadow:0 0 0 4px rgba(37,99,235,.12); }
.auth-registration-actions { position:sticky; bottom:-1.25rem; display:flex; justify-content:flex-end; gap:.75rem; margin:0 -1.4rem -1.25rem; padding:1rem 1.4rem 1.25rem; border-top:1px solid var(--line); background:rgba(255,255,255,.98); }
.auth-registration-submit { width:auto; min-width:190px; }
.auth-modal-secondary { min-height:48px; padding:.75rem 1rem; border:1px solid var(--line); border-radius:14px; color:#334155; background:#fff; font-weight:800; }
.auth-registration-loading { padding:2rem; color:var(--muted); text-align:center; }
.validation-summary ul { margin:0; padding-left:1.1rem; }
@media (max-width:720px) {
    .auth-registration-form .form-grid { grid-template-columns:1fr; }
    .auth-registration-form .span-full { grid-column:auto; }
    .auth-registration-actions { flex-direction:column-reverse; }
    .auth-registration-submit, .auth-modal-secondary { width:100%; }
}

/* Closing iteration modal polish. */
.auth-modal-secondary {
    color: #fff;
    border-color: var(--danger);
    background: var(--danger);
}

.auth-modal-secondary:hover {
    color: #fff;
    border-color: #991b1b;
    background: #991b1b;
}

.auth-registration-content {
    margin: 0.35rem 0.35rem 0.35rem 0;
    padding-right: 0.1rem;
    scrollbar-gutter: stable;
}

.auth-registration-content::-webkit-scrollbar {
    width: 10px;
}

.auth-registration-content::-webkit-scrollbar-thumb {
    border: 2px solid transparent;
    border-radius: 999px;
    background: #94a3b8;
    background-clip: padding-box;
}


/* Secciones comunes de registro: misma jerarquía en los flujos público y de creación ADMIN. */
.client-form-section {
    display: grid;
    gap: 1rem;
    padding: 1rem;
    border: 1px solid #dbe4f0;
    border-radius: 16px;
    background: #f8fafc;
}

.client-form-section + .client-form-section {
    margin-top: 1rem;
}

.client-form-section-credentials {
    border-color: #bfdbfe;
    background: #eff6ff;
}

.client-form-section-header {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding-bottom: 0.8rem;
    border-bottom: 1px solid #dbe4f0;
}

.client-form-section-icon {
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    width: 36px;
    height: 36px;
    border-radius: 11px;
    color: #1d4ed8;
    background: #dbeafe;
}

.client-form-section-header h3 {
    margin: 0;
    color: #0f172a;
    font-size: 1rem;
    line-height: 1.3;
}

.client-form-section-header p {
    margin: 0.2rem 0 0;
    color: #64748b;
    font-size: 0.8rem;
    line-height: 1.45;
}

.registration-credentials-notice {
    display: flex;
    align-items: flex-start;
    gap: 0.55rem;
    padding: 0.7rem 0.8rem;
    border-radius: 12px;
    color: #1e3a8a;
    background: rgba(219, 234, 254, 0.8);
    font-size: 0.82rem;
    line-height: 1.45;
}

.registration-action-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    min-width: 180px;
    min-height: 48px;
}

@media (max-width: 720px) {
    .client-form-section {
        padding: 0.85rem;
    }

    .registration-action-button {
        width: 100%;
        min-width: 0;
    }
}


/* Paridad de registro: el modal público replica la estructura del formulario ADMIN de creación de clientes. */
.auth-registration-dialog {
    width: min(1040px, calc(100vw - 2rem));
}

.auth-registration-card {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
}

.auth-registration-header {
    padding: 1.2rem 1.5rem;
}

.auth-registration-content {
    max-height: calc(92vh - 92px);
    margin: 0;
    padding: 0;
    overflow-y: auto;
    scrollbar-gutter: stable;
}

.auth-registration-form {
    gap: 1.1rem;
    padding: 1.25rem 1.5rem 0;
}

.auth-registration-form .form-grid {
    gap: 0.9rem;
}

.auth-registration-form .form-field {
    gap: 0.42rem;
}

.auth-registration-form .form-field label {
    color: #334155;
    font-size: 0.82rem;
    font-weight: 800;
}

.auth-registration-form input,
.auth-registration-form select {
    min-height: 44px;
    padding: 0.72rem 0.8rem;
    border-color: #cbd5e1;
}

.auth-registration-actions {
    position: sticky;
    z-index: 2;
    bottom: 0;
    margin: 0 -1.5rem;
    padding: 1rem 1.5rem 1.2rem;
    border-top: 1px solid #dbe4f0;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 -12px 24px rgba(15, 23, 42, 0.05);
}

.auth-registration-actions .button {
    min-width: 180px;
    min-height: 48px;
}

@media (max-width: 720px) {
    .auth-registration-dialog {
        width: min(100% - 1rem, 1040px);
    }

    .auth-registration-header,
    .auth-registration-form {
        padding-inline: 1rem;
    }

    .auth-registration-actions {
        flex-direction: column-reverse;
        margin-inline: -1rem;
        padding-inline: 1rem;
    }

    .auth-registration-actions .button {
        width: 100%;
    }
}


/* ============================================================
   Login visual-language placement and public registration parity
   ============================================================ */

/* El login usa su propio selector de idioma dentro del panel visual azul. */
.auth-shell-login {
    grid-template-rows: minmax(0, 1fr) auto;
}

.auth-shell-login .auth-page {
    padding-top: max(1rem, env(safe-area-inset-top));
}

.auth-visual-language {
    position: absolute;
    top: 1.35rem;
    right: 1.35rem;
    z-index: 3;
    width: min(250px, calc(100% - 2.7rem));
}

.auth-visual-language .language-selector {
    width: 100%;
    border-color: rgba(255, 255, 255, 0.24);
    color: #fff;
    background: rgba(15, 23, 42, 0.34);
    box-shadow: 0 14px 34px rgba(15, 23, 42, 0.22);
    backdrop-filter: blur(14px);
}

.auth-visual-language .language-selector-label {
    color: #e2e8f0;
}

.auth-visual-language .language-selector-select {
    border-color: rgba(255, 255, 255, 0.25);
    color: #0f172a;
    background-color: rgba(255, 255, 255, 0.96);
}

.auth-mobile-language {
    display: none;
}

/* styleLogin.css no carga portal.css; reproducir aquí el contrato visual compartido de botones. */
.auth-registration-dialog .button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-width: 180px;
    min-height: 48px;
    max-width: 100%;
    padding: 0.72rem 0.95rem;
    border: 1px solid transparent;
    border-radius: 13px;
    font: inherit;
    font-weight: 850;
    line-height: 1.2;
    text-align: center;
    text-decoration: none;
    white-space: normal;
    cursor: pointer;
}

.auth-registration-dialog .button.primary {
    color: #fff;
    border-color: transparent;
    background: linear-gradient(135deg, var(--krosfy-blue), var(--krosfy-blue-dark));
    box-shadow: 0 12px 24px rgba(37, 99, 235, 0.2);
}

.auth-registration-dialog .button.primary:hover {
    background: linear-gradient(135deg, var(--krosfy-blue-dark), #1e40af);
}

.auth-registration-dialog .button.danger {
    color: #fff;
    border-color: #991b1b;
    background: #b91c1c;
}

.auth-registration-dialog .button.danger:hover {
    background: #991b1b;
}

/* Mantiene exactamente el tamaño de campos y la tipografía del modal ADMIN. */
.auth-registration-dialog .management-form {
    display: grid;
    gap: 1.1rem;
}

.auth-registration-dialog .form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.9rem;
}

.auth-registration-dialog .form-field {
    display: grid;
    align-content: start;
    gap: 0.42rem;
    min-width: 0;
}

.auth-registration-dialog .form-field.span-full,
.auth-registration-dialog .span-full {
    grid-column: 1 / -1;
}

.auth-registration-dialog .form-field label {
    color: #334155;
    font-size: 0.82rem;
    font-weight: 800;
}

.auth-registration-dialog .form-field input,
.auth-registration-dialog .form-field select,
.auth-registration-dialog .form-field textarea {
    width: 100%;
    min-width: 0;
    min-height: 44px;
    height: 48px;
    padding: 0.72rem 0.8rem;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    color: var(--text);
    background: #fff;
    outline: none;
    font: inherit;
    line-height: 1.2;
}

.auth-registration-dialog .form-field textarea {
    min-height: 7rem;
    height: auto;
    resize: vertical;
}

.auth-registration-dialog .field-help {
    color: var(--muted);
    font-size: 0.76rem;
    line-height: 1.45;
}

.auth-registration-dialog .auth-registration-actions {
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
}

@media (max-width: 860px) {
    .auth-visual-language {
        top: 1rem;
        right: 1rem;
        width: min(230px, calc(100% - 2rem));
    }

    .auth-visual-panel {
        padding-top: 6.5rem;
    }
}

@media (max-width: 720px) {
    .auth-registration-dialog .form-grid {
        grid-template-columns: 1fr;
    }

    .auth-registration-dialog .form-field.span-full,
    .auth-registration-dialog .span-full {
        grid-column: auto;
    }

    .auth-registration-dialog .auth-registration-actions {
        flex-direction: column-reverse;
    }

    .auth-registration-dialog .button {
        width: 100%;
        min-width: 0;
    }
}

/* Los atributos booleanos hidden deben prevalecer sobre las reglas de display de la grilla de registro. */
.auth-registration-dialog [hidden],
.auth-registration-form [hidden] {
    display: none !important;
}

/* La autenticación pública sigue por defecto la preferencia de color del sistema/navegador.
   Las páginas Auth no reutilizan deliberadamente la preferencia almacenada de un usuario autenticado. */
@media (prefers-color-scheme: dark) {
    :root {
        --text: #f8fafc;
        --muted: #a8b4c7;
        --line: #334155;
        --surface: #111827;
        --surface-soft: #172033;
        --danger: #fca5a5;
        --focus: #60a5fa;
        --shadow: 0 24px 70px rgba(2, 6, 23, 0.48);
    }

    html {
        color-scheme: dark;
    }

    body {
        background:
            radial-gradient(circle at 15% 15%, rgba(56, 189, 248, 0.12), transparent 28rem),
            radial-gradient(circle at 85% 5%, rgba(37, 99, 235, 0.16), transparent 24rem),
            linear-gradient(135deg, #0b1120 0%, #111827 100%);
    }

    .auth-card,
    .language-selector,
    .auth-registration-card,
    .auth-maintenance-card {
        border-color: rgba(71, 85, 105, 0.72);
        background: rgba(15, 23, 42, 0.96);
    }

    .language-selector-label,
    .auth-form-panel label,
    .auth-registration-form .form-field label,
    .auth-registration-dialog .form-field label,
    .input-shell input[readonly],
    .auth-modal-close {
        color: #cbd5e1;
    }

    .language-selector-select,
    .auth-registration-form input,
    .auth-registration-form select,
    .auth-registration-dialog .form-field input,
    .auth-registration-dialog .form-field select,
    .auth-registration-dialog .form-field textarea,
    .auth-modal-close {
        border-color: #475569;
        color: var(--text);
        background: #111827;
    }

    .input-shell {
        border-color: #334155;
        background: #172033;
    }

    .input-shell:focus-within {
        border-color: var(--krosfy-blue);
        background: #111827;
        box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.18);
    }

    .auth-footer {
        color: #94a3b8;
    }

    .auth-registration-header,
    .auth-registration-actions,
    .client-form-section-header {
        border-color: #334155;
    }

    .auth-registration-actions,
    .auth-registration-dialog .auth-registration-actions {
        background: rgba(15, 23, 42, 0.98);
        box-shadow: 0 -12px 24px rgba(2, 6, 23, 0.22);
    }

    .client-form-section {
        border-color: #334155;
        background: #172033;
    }

    .client-form-section-credentials {
        border-color: #1e40af;
        background: #0f1d3a;
    }

    .client-form-section-header h3 {
        color: #f8fafc;
    }

    .client-form-section-header p {
        color: #a8b4c7;
    }

    .client-form-section-icon {
        color: #93c5fd;
        background: rgba(30, 64, 175, 0.45);
    }

    .registration-credentials-notice {
        color: #bfdbfe;
        background: rgba(30, 64, 175, 0.28);
    }

    .auth-registration-dialog::backdrop {
        background: rgba(2, 6, 23, 0.82);
    }

    select {
        color-scheme: dark;
    }
}

@media (prefers-color-scheme: dark) {
    .demo-credentials {
        border-color: rgba(96, 165, 250, .34);
        background: #111c31;
    }

    .demo-title,
    .demo-context-label { color: #93c5fd; }

    .demo-credentials button {
        border-color: #334155;
        color: #dbeafe;
        background: #18243a;
    }

    .demo-credentials button:hover {
        border-color: #3b82f6;
        background: #1e3a5f;
    }
}

/* Authenticated identity context selection: one login, multiple tenant/client workspaces. */
.context-picker-card{width:min(720px,calc(100vw - 32px));margin:auto;padding:28px;border:1px solid var(--border-color,#d8e0ec);border-radius:20px;background:var(--surface,#fff)}
.context-picker-list{display:grid;gap:12px;margin-top:24px}.context-picker-option{margin:0}.context-picker-button{width:100%;display:grid;grid-template-columns:44px 1fr auto;align-items:center;gap:14px;padding:16px 18px;text-align:left;border:1px solid #cdd8e8;border-radius:14px;background:transparent;cursor:pointer}.context-picker-button:hover,.context-picker-button:focus-visible{border-color:#2f6df6;box-shadow:0 0 0 3px rgb(47 109 246 / 12%)}.context-picker-icon{display:grid;place-items:center;width:44px;height:44px;border-radius:12px;background:rgb(47 109 246 / 10%);color:#2f6df6}.context-picker-copy{display:grid;gap:3px}.context-picker-copy small{opacity:.72}

/* Platform/authenticated utility controls. */
.auth-utility-bar { align-items:flex-start; gap:.75rem; }
.auth-logout-form { margin:0; }
.auth-logout-button {
    display:inline-flex; align-items:center; justify-content:center; gap:.45rem; min-height:46px;
    padding:.7rem .9rem; border:1px solid var(--line); border-radius:14px; color:var(--text);
    background:var(--surface); font:inherit; font-weight:800; cursor:pointer;
}
.auth-logout-button:hover,.auth-logout-button:focus-visible { border-color:#ef4444; color:#ef4444; box-shadow:0 0 0 3px rgb(239 68 68 / 10%); }
.auth-logout-button-danger {
    border-color: #fecaca;
    color: #fff;
    background: linear-gradient(180deg, #ef4444 0%, #dc2626 100%);
    box-shadow: 0 14px 28px rgba(220, 38, 38, .22);
}
.auth-logout-button-danger:hover,
.auth-logout-button-danger:focus-visible {
    border-color: #dc2626;
    color: #fff;
    background: linear-gradient(180deg, #dc2626 0%, #b91c1c 100%);
    box-shadow: 0 0 0 3px rgb(248 113 113 / 18%), 0 16px 30px rgba(185, 28, 28, .25);
}
@media (max-width:760px) {
    .auth-utility-bar { flex-wrap:wrap; }
    .auth-utility-bar .language-selector { flex:1 1 220px; }
}

/* Multi-workspace selection: richer shell, bounded scroll area and client-side filtering. */
.context-picker-shell {
    width: min(1040px, calc(100vw - 32px));
    display: grid;
    grid-template-columns: minmax(0, .82fr) minmax(360px, 1.18fr);
    gap: 0;
    padding: 0;
    overflow: hidden;
}
.context-picker-intro {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
    padding: 38px;
    background:
        radial-gradient(circle at 10% 10%, rgba(47,109,246,.14), transparent 38%),
        linear-gradient(150deg, rgba(47,109,246,.07), rgba(255,255,255,0));
    border-right: 1px solid var(--border-color,#d8e0ec);
}
.context-picker-intro-mark {
    display: grid; place-items: center; width: 54px; height: 54px; margin-bottom: 22px;
    border-radius: 16px; background: #2f6df6; color: #fff; font-size: 1.2rem;
    box-shadow: 0 14px 32px rgba(47,109,246,.24);
}
.context-picker-intro h1 { margin: 7px 0 12px; font-size: clamp(2rem,4vw,3.1rem); line-height: 1.02; }
.context-picker-intro > p { margin: 0; max-width: 34rem; color: var(--muted,#64748b); line-height: 1.65; }
.context-picker-summary { display: grid; gap: 12px; margin-top: 28px; }
.context-picker-summary > div { display: flex; gap: 10px; align-items: flex-start; color: var(--muted,#64748b); font-size: .9rem; line-height: 1.45; }
.context-picker-summary i { color: #2f6df6; margin-top: .15rem; }
.context-picker-workspaces { display: flex; flex-direction: column; min-width: 0; padding: 30px; background: var(--surface,#fff); }
.context-picker-panel-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 18px; }
.context-picker-panel-header h2 { margin: 4px 0 0; font-size: 1.35rem; }
.context-picker-total { display: inline-grid; place-items: center; min-width: 2.2rem; height: 2.2rem; padding: 0 .65rem; border-radius: 999px; background: rgba(47,109,246,.10); color: #2f6df6; font-weight: 800; }
.context-picker-search { display: flex; align-items: center; gap: .7rem; margin-bottom: 14px; padding: 0 13px; min-height: 46px; border: 1px solid #cdd8e8; border-radius: 12px; background: var(--surface,#fff); }
.context-picker-search:focus-within { border-color: #2f6df6; box-shadow: 0 0 0 3px rgb(47 109 246 / 12%); }
.context-picker-search i { color: #64748b; }
.context-picker-search input { width: 100%; min-width: 0; border: 0; outline: 0; background: transparent; color: inherit; font: inherit; }
.context-picker-list { display: grid; gap: 10px; max-height: min(54vh, 520px); padding-right: 5px; overflow-y: auto; scrollbar-gutter: stable; }
.context-picker-option[hidden] { display: none; }
.context-picker-button { grid-template-columns: 46px minmax(0,1fr) 38px; min-height: 82px; padding: 13px 14px; border-radius: 14px; background: var(--surface,#fff); transition: border-color .18s ease, transform .18s ease, box-shadow .18s ease; }
.context-picker-button:hover,.context-picker-button:focus-visible { transform: translateY(-1px); box-shadow: 0 10px 24px rgb(15 23 42 / 8%); }
.context-picker-icon { width: 46px; height: 46px; }
.context-picker-copy { gap: 2px; }
.context-picker-role { color: #2f6df6; font-size: .68rem; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; }
.context-picker-copy strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.context-picker-copy small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.context-picker-open { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; color: #2f6df6; background: rgb(47 109 246 / 8%); }
.context-picker-option.is-pending .context-picker-button { cursor: not-allowed; border-style: dashed; opacity: .82; }
.context-picker-option.is-pending .context-picker-button:hover,
.context-picker-option.is-pending .context-picker-button:focus-visible { transform: none; border-color: #cdd8e8; box-shadow: none; }
.context-picker-option.is-pending .context-picker-icon { background: rgb(245 158 11 / 12%); color: #b45309; }
.context-picker-option.is-pending .context-picker-open { background: rgb(245 158 11 / 10%); color: #b45309; }
.context-picker-pending-badge { width: max-content; max-width: 100%; margin-top: 5px; padding: 3px 8px; border-radius: 999px; background: rgb(245 158 11 / 12%); color: #92400e; font-size: .68rem; font-weight: 800; letter-spacing: .03em; text-transform: uppercase; }
.context-picker-pending-hint { margin-top: 2px; white-space: normal !important; line-height: 1.35; }
.context-picker-empty { display: grid; justify-items: center; gap: 7px; padding: 40px 16px; color: var(--muted,#64748b); text-align: center; }
.context-picker-empty[hidden] { display: none; }
.context-picker-empty i { font-size: 1.35rem; color: #2f6df6; }
@media (max-width: 820px) {
    .context-picker-shell { grid-template-columns: 1fr; width: min(680px, calc(100vw - 24px)); }
    .context-picker-intro { padding: 26px; border-right: 0; border-bottom: 1px solid var(--border-color,#d8e0ec); }
    .context-picker-intro-mark { width: 46px; height: 46px; margin-bottom: 16px; }
    .context-picker-intro h1 { font-size: 2rem; }
    .context-picker-summary { display: none; }
    .context-picker-workspaces { padding: 22px; }
    .context-picker-list { max-height: 48vh; }
    .context-picker-shell-utility { padding: 16px 22px 22px; }
}
@media (max-width: 520px) {
    .context-picker-shell { width: calc(100vw - 16px); border-radius: 16px; }
    .context-picker-intro,.context-picker-workspaces { padding: 18px; }
    .context-picker-button { grid-template-columns: 42px minmax(0,1fr) 32px; min-height: 74px; padding: 10px; }
    .context-picker-icon { width: 42px; height: 42px; }
    .context-picker-shell-utility { padding: 14px 18px 18px; }
    .context-picker-shell-utility-inner { flex-direction: column; align-items: stretch; }
    .context-picker-shell-utility .language-selector { width: 100%; }
    .context-picker-shell-utility .auth-logout-form { width: 100%; }
    .context-picker-shell-utility .auth-logout-button { width: 100%; }
}

/* Las credenciales de Development se mantienen deliberadamente compactas: un selector por workspace de prueba. */
.demo-credential-select-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: .8rem;
}

.demo-credentials-select-group {
    display: grid;
    gap: .45rem;
    min-width: 0;
}

.demo-credentials-select-group .demo-context-label {
    padding: 0 .15rem;
}

.demo-credential-select {
    width: 100%;
    min-width: 0;
    min-height: 44px;
    padding: .7rem 2.4rem .7rem .8rem;
    border: 1px solid #bfdbfe;
    border-radius: 12px;
    color: #1e3a8a;
    background: #fff;
    font: inherit;
    font-size: .82rem;
    font-weight: 700;
    cursor: pointer;
}

.demo-credential-select:hover,
.demo-credential-select:focus-visible {
    border-color: #60a5fa;
    box-shadow: 0 0 0 3px rgb(37 99 235 / 10%);
}

/* El selector de workspace es una pantalla de transición autenticada. Usar la paleta navy/azul
   del portal para que la tarjeta blanca mantenga contraste frente al fondo genérico de Auth. */
.auth-shell-contexts {
    background:
        radial-gradient(circle at 12% 18%, rgba(56, 189, 248, .20), transparent 30rem),
        radial-gradient(circle at 88% 8%, rgba(37, 99, 235, .32), transparent 28rem),
        linear-gradient(145deg, #0f172a 0%, #172554 48%, #1e3a8a 100%);
}

.auth-shell-contexts .context-picker-shell {
    border-color: rgba(191, 219, 254, .38);
    box-shadow: 0 28px 80px rgba(2, 6, 23, .34);
}

.context-picker-shell-utility {
    grid-column: 1 / -1;
    display: flex;
    justify-content: flex-end;
    padding: 18px 30px 26px;
    border-top: 1px solid rgba(203, 213, 225, .9);
    background: linear-gradient(180deg, rgba(248, 250, 252, .86), rgba(241, 245, 249, .96));
}

.context-picker-shell-utility-inner {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: .8rem;
    width: 100%;
}

.context-picker-shell-utility .language-selector {
    width: min(100%, 280px);
    border-color: rgba(191, 219, 254, .6);
    background: #fff;
    box-shadow: 0 12px 26px rgba(15, 23, 42, .08);
}

.context-picker-shell-utility .auth-logout-button {
    min-height: 48px;
}

.auth-shell-contexts .auth-footer {
    color: #bfdbfe;
}

@media (max-width: 900px) {
    .demo-credential-select-grid {
        grid-template-columns: 1fr;
    }
}

@media (prefers-color-scheme: dark) {
    .demo-credential-select {
        border-color: #334155;
        color: #dbeafe;
        background: #18243a;
    }

    .demo-credential-select:hover,
    .demo-credential-select:focus-visible {
        border-color: #3b82f6;
        background: #1e3a5f;
    }
}

/* Selector de workspace: mantener la tarjeta centrada verticalmente conservando el footer en la parte inferior. */
.auth-shell-contexts .auth-main {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 0;
    padding: 1.5rem 1rem;
}

.auth-shell-contexts .auth-page {
    width: 100%;
}

.auth-footer-link {
    color: inherit;
    text-decoration: none;
}

.auth-footer-link:hover,
.auth-footer-link:focus-visible {
    color: inherit;
    text-decoration: underline;
}

.auth-footer-contact { display: block; margin-top: .35rem; }

/* El selector de contexto no tiene fila superior de utilidades; centrar la tarjeta en el viewport y mantener el footer al fondo. */
.auth-shell-contexts {
    grid-template-rows: minmax(0, 1fr) auto;
}

.auth-shell-contexts .auth-page {
    display: grid;
    place-items: center;
    align-content: center;
    min-height: 0;
    padding-block: max(1.5rem, env(safe-area-inset-top)) max(1.5rem, env(safe-area-inset-bottom));
}


.public-registration-honeypot {
    position: absolute !important;
    left: -10000px !important;
    width: 1px !important;
    height: 1px !important;
    overflow: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
}
.public-registration-bot-protection {
    margin-top: 1rem;
}
.public-registration-challenge {
    min-height: 65px;
}


.context-picker-activity {
    display: inline-flex;
    flex-wrap: wrap;
    gap: .4rem;
    margin-top: .35rem;
}
.context-picker-activity-item {
    display: inline-flex;
    align-items: center;
    gap: .25rem;
    padding: .15rem .45rem;
    border-radius: 999px;
    background: rgba(127, 127, 127, .12);
    font-size: .78rem;
    font-weight: 700;
}


/* TEMA OSCURO: el bloque utilitario del selector de workspace se declara al final del archivo;
   estos overrides deben quedar después para que no reaparezca el fondo claro. */
@media (prefers-color-scheme: dark) {
    .context-picker-shell-utility {
        border-top-color: rgba(71, 85, 105, .72);
        background: linear-gradient(180deg, rgba(15, 23, 42, .96), rgba(17, 24, 39, .98));
    }

    .context-picker-shell-utility .language-selector {
        border-color: rgba(71, 85, 105, .82);
        background: #0f172a;
        box-shadow: 0 12px 26px rgba(2, 6, 23, .28);
    }

    .context-picker-shell-utility .language-selector-select {
        border-color: #475569;
        color: #f8fafc;
        background: #111827;
    }
}

/* UX: mostrar la naturaleza del contador evita confundir una Task pendiente con una notificación. */
.context-picker-activity-item > span {
    font-size: .75rem;
    font-weight: 600;
}
/* El teléfono se conserva como un único valor en el servidor, aunque el prefijo se edita por separado. */
.phone-composite-input {
    display: grid;
    grid-template-columns: minmax(88px, .32fr) minmax(0, 1fr);
    gap: .55rem;
}

@media (max-width: 640px) {
    .auth-shell-login .auth-visual-panel {
        display: none;
    }

    .auth-mobile-language {
        display: block;
    }

    .auth-mobile-language .language-selector {
        grid-template-columns: auto minmax(0, 1fr);
        align-items: center;
        gap: .65rem;
        width: 100%;
        padding: .5rem .6rem;
        border-radius: 12px;
        background: var(--surface-soft, rgba(248, 250, 252, .92));
        box-shadow: none;
    }

    .auth-mobile-language .language-selector-label {
        white-space: nowrap;
    }

    .auth-mobile-language .language-selector-select {
        min-height: 40px;
    }

    .auth-shell-login .auth-page {
        align-content: start;
    }

    /* Patrón móvil compartido: el idioma se muestra junto a la identidad de la pantalla,
       mientras la copia de escritorio permanece en su ubicación original. */
    .auth-shell-contexts .context-picker-shell-utility .language-selector {
        display: none;
    }

    .context-picker-mobile-language {
        width: 100%;
        margin: 0 0 1rem;
    }

    .context-picker-mobile-language .language-selector {
        border-color: rgba(96, 165, 250, .24);
        background: rgba(15, 23, 42, .28);
    }
}

/* Branding público del acceso y del selector de espacios. Los valores por defecto
   conservan exactamente la presentación original cuando el workspace no personaliza nada. */
.auth-form-panel .eyebrow,
.auth-inline-link,
.auth-register-link a,
.auth-register-button,
.auth-text-button {
    color: var(--auth-accent);
}

.input-shell:focus-within {
    border-color: var(--auth-accent);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--auth-accent) 14%, transparent);
}

.password-hold-toggle:hover,
.password-hold-toggle:focus-visible,
.password-hold-toggle.is-revealing {
    color: var(--auth-accent);
    background: color-mix(in srgb, var(--auth-accent) 10%, transparent);
}

.checkbox-row input { accent-color: var(--auth-accent); }

.auth-submit {
    background: linear-gradient(135deg, var(--auth-button), color-mix(in srgb, var(--auth-button) 78%, #000));
    box-shadow: 0 16px 32px color-mix(in srgb, var(--auth-button) 28%, transparent);
}

.auth-submit:hover {
    box-shadow: 0 20px 42px color-mix(in srgb, var(--auth-button) 36%, transparent);
}

.auth-logo:not(img) {
    background: linear-gradient(135deg, var(--auth-button), var(--auth-panel-start));
    box-shadow: 0 16px 30px color-mix(in srgb, var(--auth-button) 28%, transparent);
}

.auth-visual-panel {
    color: var(--auth-panel-text);
    background-color: var(--auth-panel-start);
    background-image: linear-gradient(135deg, var(--auth-panel-start), var(--auth-panel-end));
    background-position: center;
    background-size: cover;
}

.auth-shell-login.auth-has-panel-image .auth-visual-panel {
    background-image: var(--auth-panel-image);
}

.auth-visual-panel::before,
.auth-visual-panel::after {
    border-color: color-mix(in srgb, var(--auth-panel-text) 16%, transparent);
}

.visual-content p {
    color: color-mix(in srgb, var(--auth-panel-text) 78%, transparent);
}

.feature-grid div {
    border-color: color-mix(in srgb, var(--auth-panel-text) 18%, transparent);
    background: color-mix(in srgb, var(--auth-feature) 72%, transparent);
}

.feature-grid i { color: color-mix(in srgb, var(--auth-panel-text) 72%, var(--auth-accent)); }

.auth-visual-language .language-selector {
    border-color: color-mix(in srgb, var(--auth-panel-text) 28%, transparent);
    color: var(--auth-panel-text);
    background: color-mix(in srgb, var(--auth-panel-start) 72%, transparent);
}

.auth-visual-language .language-selector-label { color: var(--auth-panel-text); }

.auth-shell-contexts {
    background:
        radial-gradient(circle at 12% 18%, color-mix(in srgb, var(--auth-accent) 30%, transparent), transparent 30rem),
        radial-gradient(circle at 88% 8%, color-mix(in srgb, var(--auth-panel-end) 38%, transparent), transparent 28rem),
        linear-gradient(145deg, var(--auth-panel-start) 0%, color-mix(in srgb, var(--auth-panel-start) 70%, var(--auth-panel-end)) 48%, var(--auth-panel-end) 100%);
}

.context-picker-intro-mark {
    background: var(--auth-accent);
    box-shadow: 0 14px 32px color-mix(in srgb, var(--auth-accent) 26%, transparent);
}

.context-picker-intro-logo {
    object-fit: contain;
    padding: .4rem;
    background: #fff;
}

.context-picker-intro .eyebrow,
.context-picker-workspaces .eyebrow,
.context-picker-summary i,
.context-picker-role,
.context-picker-open,
.context-picker-empty i,
.context-picker-total {
    color: var(--auth-accent);
}

.context-picker-total,
.context-picker-icon,
.context-picker-open {
    background: color-mix(in srgb, var(--auth-accent) 10%, transparent);
}

.context-picker-search:focus-within,
.context-picker-button:hover,
.context-picker-button:focus-visible {
    border-color: var(--auth-accent);
}

.auth-shell-contexts .auth-footer { color: color-mix(in srgb, var(--auth-panel-text) 78%, transparent); }


.phone-composite-input select,
.phone-composite-input input { min-width: 0; width: 100%; }

.existing-identity-match {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: .8rem;
    width: 100%;
    margin: .9rem 0 1rem;
    padding: .9rem 1rem;
    border: 1px solid rgba(37, 99, 235, .3);
    border-radius: 14px;
    background: rgba(37, 99, 235, .06);
    box-shadow: 0 12px 28px rgba(37, 99, 235, .12);
}
.existing-identity-match[hidden],
.existing-identity-proof[hidden] { display: none; }
.existing-identity-match-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; color: #2563eb; background: rgba(37, 99, 235, .12); }
.existing-identity-match-copy { display: grid; gap: .2rem; min-width: 0; }
.existing-identity-match-copy span,
.existing-identity-match-copy small { color: var(--muted, #64748b); overflow-wrap: anywhere; }
.existing-identity-match-actions { display: flex; gap: .45rem; flex-wrap: wrap; justify-content: flex-end; }
.existing-identity-proof { grid-column: 2 / -1; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .65rem; align-items: end; }

@media (max-width: 700px) {
    .existing-identity-match { grid-template-columns: auto minmax(0, 1fr); }
    .existing-identity-match-actions,
    .existing-identity-proof { grid-column: 1 / -1; }
    .existing-identity-proof { grid-template-columns: 1fr; }
}
