:root {
    --auth-ink: #463239;
    --auth-ink-soft: #6d5960;
    --auth-primary: #9f3f60;
    --auth-primary-hover: #85334f;
    --auth-success: #44705b;
    --auth-canvas: #fff8f5;
    --auth-paper: #ffffff;
    --auth-line: #eadbd5;
    --auth-muted: #7b666b;
    --auth-peach: #f4d8ca;
    --auth-blush: #f8eaf0;
}

body.auth-page,
.auth-page *,
.auth-page *::before,
.auth-page *::after { box-sizing: border-box; }

body.auth-page {
    margin: 0;
    min-height: 100vh;
    padding: 40px 24px;
    color: var(--auth-ink);
    background: var(--auth-canvas);
    font-family: 'Nunito Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

.auth-page h1,
.auth-page h2,
.auth-page p,
.auth-page ul,
.auth-page dl,
.auth-page dd { margin: 0; }
.auth-page button,
.auth-page input,
.auth-page select { font: inherit; }
.auth-page a { color: var(--auth-primary); }
.auth-page a:hover { color: var(--auth-primary-hover); }
.auth-page :focus-visible { outline: 3px solid var(--auth-primary); outline-offset: 3px; }

.auth-shell {
    width: min(1040px, 100%);
    min-height: min(720px, calc(100vh - 80px));
    display: grid;
    grid-template-columns: minmax(290px, 0.78fr) minmax(390px, 1.22fr);
    margin: 0 auto;
    overflow: hidden;
    border: 1px solid var(--auth-line);
    border-radius: 20px;
    background: var(--auth-paper);
}

.auth-story {
    display: flex;
    flex-direction: column;
    padding: 36px;
    border-right: 1px solid var(--auth-line);
    background: var(--auth-blush);
}

.auth-brand,
.auth-mobile-brand {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    width: fit-content;
    color: var(--auth-ink) !important;
    font-size: 16px;
    font-weight: 800;
    letter-spacing: -0.04em;
    text-decoration: none;
    white-space: nowrap;
}

.auth-brand-mark {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    border-radius: 10px;
    color: var(--auth-paper);
    background: var(--auth-primary);
    font-size: 21px;
    font-weight: 800;
    letter-spacing: -0.06em;
}

.auth-brand small,
.auth-mobile-brand small {
    margin-left: -6px;
    color: var(--auth-muted);
    font-size: 12px;
}

.auth-story-copy {
    margin: auto 0 0;
    padding: 56px 0 36px;
}

.auth-story h2 {
    max-width: 12ch;
    margin-bottom: 20px;
    font-size: clamp(30px, 3.2vw, 38px);
    font-weight: 800;
    letter-spacing: -0.035em;
    line-height: 1.17;
}

.auth-story-copy > p {
    color: var(--auth-ink-soft);
    font-size: 14px;
    line-height: 1.8;
}

.auth-workflow {
    display: grid;
    padding: 0;
    border-top: 1px solid #e4cdd0;
}
.auth-workflow > div {
    padding: 15px 0;
    border-bottom: 1px solid #e4cdd0;
}
.auth-workflow dt { font-size: 15px; font-weight: 800; }
.auth-workflow dd { color: var(--auth-ink-soft); font-size: 13px; }

.auth-benefits {
    display: grid;
    gap: 20px;
    padding: 24px 0 0;
    border-top: 1px solid #e4cdd0;
    list-style: none;
}
.auth-benefits li {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    color: var(--auth-ink-soft);
    font-size: 14px;
}
.auth-benefits span {
    display: grid;
    place-items: center;
    flex: 0 0 25px;
    height: 25px;
    border: 1px solid #dabcc7;
    border-radius: 50%;
    color: var(--auth-primary);
    background: var(--auth-peach);
    font-size: 12px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}
.auth-shell-register .auth-story { justify-content: flex-start; }
.auth-shell-register .auth-story-copy { margin-top: 0; padding-top: 64px; }

.auth-page .auth-container {
    width: 100%;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 48px clamp(32px, 5vw, 64px);
    background: var(--auth-paper);
}
.auth-shell-register .auth-container { justify-content: flex-start; padding-top: 36px; padding-bottom: 36px; }
.auth-header { margin-bottom: 28px; text-align: left; }
.auth-mobile-brand { display: none; margin-bottom: 32px; }
.auth-page .auth-title {
    margin-bottom: 8px;
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -0.035em;
    line-height: 1.25;
}
.auth-subtitle { color: var(--auth-muted); font-size: 14px; line-height: 1.7; }
.auth-subtitle a,
.auth-text-link,
.back-home a,
.back-link a { font-weight: 700; text-decoration: none; }
.auth-subtitle a:hover,
.auth-text-link:hover,
.back-home a:hover,
.back-link a:hover { text-decoration: underline; }

.auth-page .form-group { margin-bottom: 20px; }
.auth-page .form-label {
    display: block;
    margin-bottom: 7px;
    color: var(--auth-ink);
    font-size: 13px;
    font-weight: 700;
}
.auth-page .form-control {
    width: 100%;
    min-width: 0;
    min-height: 48px;
    padding: 11px 13px;
    border: 1px solid #cbb6ba;
    border-radius: 10px;
    color: var(--auth-ink);
    background: var(--auth-paper);
    font-family: inherit;
    font-size: 16px;
    line-height: 1.5;
    transition: border-color 120ms ease, box-shadow 120ms ease;
}
.auth-page .form-control::placeholder { color: var(--auth-muted); opacity: 1; }
.auth-page .form-control:hover { border-color: #a7808a; }
.auth-page .form-control:focus,
.auth-page .code-input:focus {
    border-color: var(--auth-primary);
    outline: 0;
    box-shadow: 0 0 0 3px rgba(159, 63, 96, 0.14);
}
.auth-page .form-control.input-validation-error { border-color: #b42318; }
.auth-page select.form-control { cursor: pointer; }
.form-hint { margin-top: 6px; color: var(--auth-muted); font-size: 12px; line-height: 1.6; }
.form-section-label {
    margin: 26px 0 20px;
    padding-top: 22px;
    border-top: 1px solid var(--auth-line);
    color: var(--auth-ink);
    font-size: 15px;
    font-weight: 800;
}
.auth-page .text-danger { display: block; margin-top: 5px; color: #b42318; font-size: 13px; }
.auth-page .validation-summary-valid,
.auth-page .field-validation-valid { display: none; }
.validation-summary,
.msg-error {
    padding: 12px 14px;
    margin-bottom: 20px;
    border: 1px solid #e9b7b3;
    border-radius: 10px;
    color: #a1231b;
    background: #fff3f2;
    font-size: 14px;
}
.validation-summary ul { padding-left: 18px; }
.msg-success,
.auth-form + .success-message,
.auth-container > .success-message {
    padding: 12px 14px;
    margin-bottom: 20px;
    border: 1px solid #bad8cb;
    border-radius: 10px;
    color: #355846;
    background: #f0f6f1;
    font-size: 14px;
}
.msg-error,
.msg-success { display: none; }

.auth-options { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 16px; margin-bottom: 20px; font-size: 13px; }
.remember-me { display: flex; align-items: center; gap: 8px; min-height: 44px; }
.remember-me label { color: var(--auth-ink-soft); font-size: 13px; cursor: pointer; }
.auth-page input[type="checkbox"] { width: 18px; height: 18px; flex-shrink: 0; accent-color: var(--auth-primary); cursor: pointer; }
.auth-page .btn-submit,
.auth-page .btn-login-redirect,
.auth-page .btn-send-code,
.auth-page .btn-verify-code {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    min-height: 48px;
    padding: 12px 18px;
    border: 1px solid transparent;
    border-radius: 10px;
    color: var(--auth-paper);
    background: var(--auth-primary);
    font-size: 14px;
    font-weight: 700;
    line-height: 1.5;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: background 120ms ease;
}
.auth-page .btn-submit,
.auth-page .btn-login-redirect { width: 100%; }
.auth-page .btn-submit:hover,
.auth-page .btn-login-redirect:hover,
.auth-page .btn-send-code:hover { color: var(--auth-paper); background: var(--auth-primary-hover); }
.auth-page .btn-verify-code { background: var(--auth-success); }
.auth-page .btn-verify-code:hover { background: #355846; }
.auth-page button:disabled { opacity: 0.65; cursor: not-allowed; }
.verification-row { display: flex; align-items: stretch; gap: 8px; }
.verification-row .form-control { flex: 1; }
.verification-row button { flex: 0 0 auto; max-width: 52%; padding: 10px 12px; font-size: 12px; }
.verification-code { text-align: center; font-weight: 700; letter-spacing: 4px; font-variant-numeric: tabular-nums; }
.auth-page .phone-verified { border-color: var(--auth-success); background: #f0f6f1; }
.auth-register-page [hidden] { display: none !important; }
.auth-register-page .form-section-label { margin-bottom: 16px; }
.auth-register-page .registration-status { margin-top: 8px; padding: 9px 12px; border: 1px solid var(--auth-line); border-radius: 8px; font-size: 13px; line-height: 1.6; }
.auth-register-page .registration-status.is-success { color: #355846; border-color: #bad8cb; background: #f0f6f1; }
.auth-register-page .registration-status.is-error { color: #a1231b; border-color: #e9b7b3; background: #fff3f2; }
.auth-register-page .registration-password { position: relative; }
.auth-register-page .registration-password .form-control { padding-right: 76px; }
.auth-register-page .registration-password-toggle { position: absolute; right: 6px; top: 5px; min-height: 38px; padding: 4px 10px; border: 0; border-radius: 7px; color: var(--auth-primary); background: transparent; font-size: 13px; font-weight: 700; cursor: pointer; }
.auth-register-page .select2-container { max-width: 100%; font-family: inherit; }
.auth-register-page .select2-container .select2-selection--single { height: 48px; border: 1px solid #cbb6ba; border-radius: 10px; }
.auth-register-page .select2-container .select2-selection--single .select2-selection__rendered { padding: 10px 35px 10px 13px; color: var(--auth-ink); font-size: 16px; line-height: 26px; }
.auth-register-page .select2-container .select2-selection--single .select2-selection__arrow { top: 11px; right: 9px; }
.auth-register-page .select2-selection[aria-invalid="true"] { border-color: #b42318; }
.auth-register-page .select2-container--focus .select2-selection { border-color: var(--auth-primary); box-shadow: 0 0 0 3px rgba(159, 63, 96, 0.14); }
.registration-sector-dropdown { border-color: #cbb6ba; color: var(--auth-ink); font-family: 'Nunito Sans', sans-serif; }
.registration-sector-dropdown .select2-results__option--highlighted.select2-results__option--selectable { background: var(--auth-primary); }
.back-home,
.back-link,
.resend-link { margin-top: 18px; text-align: center; font-size: 13px; }
.client-login { margin-top: 30px; padding-top: 22px; border-top: 1px solid var(--auth-line); }
.client-login p { margin-bottom: 10px; color: var(--auth-muted); font-size: 13px; }
.client-login a {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    min-height: 44px;
    padding: 8px 14px;
    border: 1px solid #cbb6ba;
    border-radius: 10px;
    color: var(--auth-ink);
    background: var(--auth-paper);
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
}
.client-login a:hover { background: var(--auth-canvas); border-color: #a7808a; }

.terms-group { display: flex; align-items: flex-start; gap: 10px; margin: 4px 0 8px; }
.terms-group input[type="checkbox"] { margin-top: 3px; }
.terms-label { color: var(--auth-ink-soft); font-size: 12px; line-height: 1.8; }
.terms-link { padding: 0; border: 0; background: transparent; color: var(--auth-primary); font: inherit; font-weight: 700; text-align: left; text-decoration: underline; cursor: pointer; }
.terms-modal-overlay { display: none; position: fixed; inset: 0; z-index: 9999; justify-content: center; align-items: center; padding: 20px; background: rgba(70, 50, 57, 0.42); }
.terms-modal-overlay.show { display: flex; }
.terms-modal { width: 100%; max-width: 700px; max-height: 85vh; display: flex; flex-direction: column; background: var(--auth-paper); border: 1px solid var(--auth-line); border-radius: 12px; box-shadow: 0 18px 60px rgba(70, 50, 57, 0.16); }
.terms-modal-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 24px; border-bottom: 1px solid var(--auth-line); }
.terms-modal-header h2 { font-size: 18px; font-weight: 800; }
.terms-modal-close { display: flex; align-items: center; justify-content: center; flex-shrink: 0; width: 44px; height: 44px; border: 1px solid var(--auth-line); border-radius: 10px; color: var(--auth-ink); background: var(--auth-canvas); font-size: 24px; cursor: pointer; }
.terms-modal-body { padding: 24px; overflow-y: auto; color: var(--auth-ink-soft); font-size: 14px; line-height: 1.8; }
.terms-modal-body h2 { margin: 20px 0 8px; font-size: 16px; }
.terms-modal-body ul { padding-left: 20px; margin-bottom: 12px; }
.terms-empty { padding: 24px 0; text-align: center; color: var(--auth-muted); }
.terms-empty i { display: block; margin-bottom: 12px; font-size: 28px; }

body.auth-recovery-page { display: flex; justify-content: center; align-items: center; }
.auth-recovery-page .auth-container { max-width: 500px; min-height: auto; padding: 36px; border: 1px solid var(--auth-line); border-radius: 20px; }
.auth-recovery-page .auth-brand { margin-bottom: 32px; }
.auth-recovery-page #resetProgress { margin: 0 0 20px; padding: 8px 0; border-bottom: 1px solid var(--auth-line); color: var(--auth-primary); font-size: 12px; font-weight: 700; }
.step-panel { display: none; }
.step-panel.active { display: block; }
.code-input { width: 100%; min-width: 0; padding: 14px; border: 1px solid #cbb6ba; border-radius: 10px; color: var(--auth-ink); font-size: 26px !important; font-weight: 700; text-align: center; letter-spacing: 10px; font-variant-numeric: tabular-nums; }
.auth-link-button { min-height: 44px; padding: 8px 4px; border: 0; color: var(--auth-primary); background: transparent; font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; }
.auth-link-button:hover { text-decoration: underline; }
.success-icon { width: 56px; height: 56px; display: grid; place-items: center; margin-bottom: 20px; border-radius: 50%; color: var(--auth-success); background: #f0f6f1; font-size: 32px; }
#stepSuccess .success-message { margin-bottom: 28px; }
#stepSuccess .success-message h2 { margin-bottom: 10px; font-size: 24px; letter-spacing: -0.035em; }
#stepSuccess .success-message p { color: var(--auth-muted); font-size: 14px; }
.spinner { display: inline-block; width: 18px; height: 18px; margin-right: 8px; border: 2px solid rgba(255,255,255,0.4); border-top-color: white; border-radius: 50%; animation: auth-spin 0.7s linear infinite; vertical-align: middle; }
@keyframes auth-spin { to { transform: rotate(360deg); } }

@media (max-width: 800px) {
    body.auth-page { padding: 0; background: var(--auth-paper); }
    .auth-shell { min-height: 100vh; display: block; border: 0; border-radius: 0; }
    .auth-story { display: none; }
    .auth-page .auth-container { min-height: 100vh; padding: 36px max(24px, calc((100vw - 480px) / 2)); }
    .auth-shell-register .auth-container { justify-content: flex-start; }
    .auth-mobile-brand { display: inline-flex; }
    .auth-recovery-page .auth-container { border: 0; border-radius: 0; }
}
@media (max-width: 420px) {
    .auth-page .auth-container { justify-content: flex-start; padding: 28px 20px; }
    .auth-page .auth-title { font-size: 26px; }
    .auth-brand,
    .auth-mobile-brand { font-size: 16px; gap: 7px; }
    .auth-options { gap: 4px 12px; }
    .verification-row { flex-wrap: wrap; }
    .verification-row .form-control { flex-basis: 100%; }
    .verification-row button { max-width: 100%; width: 100%; min-height: 44px; }
    .terms-modal-overlay { padding: 12px; }
    .terms-modal-header,
    .terms-modal-body { padding: 16px; }
    .code-input { font-size: 24px !important; letter-spacing: 8px; }
}
@media (prefers-reduced-motion: reduce) {
    .auth-page *,
    .auth-page *::before,
    .auth-page *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
