* {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
}

body.auth-shell {
    margin: 0;
    color: var(--hm-auth-ink);
    background:
        radial-gradient(circle at 12% 12%, rgba(111, 170, 224, 0.22), transparent 32rem),
        linear-gradient(135deg, #eaf3fc 0%, #f8fafc 48%, #e3edf8 100%);
    font-family: "Open Sans", Arial, sans-serif;
}

.auth-shell::before,
.auth-shell::after {
    position: fixed;
    z-index: 0;
    border-radius: 50%;
    content: "";
    pointer-events: none;
}

/* Auth is also rendered inside the shared dark theme. Keep every light
 * surface explicit so theme changes never create mixed-mode forms. */
html[data-hm-theme="dark"] body.auth-shell {
    color: var(--foreground);
    background: var(--hm-canvas);
}

html[data-hm-theme="dark"] .hm-auth {
    border-color: var(--hm-border);
    background: var(--hm-surface);
    box-shadow: var(--hm-shadow);
}

html[data-hm-theme="dark"] .hm-auth__form-panel,
html[data-hm-theme="dark"] .hm-auth__form,
html[data-hm-theme="dark"] .hm-auth .form-control {
    color: var(--hm-ink);
    background-color: var(--hm-surface);
}

html[data-hm-theme="dark"] .hm-auth label,
html[data-hm-theme="dark"] .hm-auth__form-header p,
html[data-hm-theme="dark"] .hm-auth .help-block {
    color: var(--hm-muted);
}

html[data-hm-theme="dark"] .hm-auth .form-control {
    border-color: var(--hm-border-strong);
}

html[data-hm-theme="dark"] .hm-auth .form-control::placeholder {
    color: var(--hm-muted);
}

.auth-shell::before {
    width: 28rem;
    height: 28rem;
    right: -12rem;
    top: -12rem;
    background: rgba(47, 128, 201, 0.1);
}

.auth-shell::after {
    width: 22rem;
    height: 22rem;
    left: -11rem;
    bottom: -12rem;
    background: rgba(31, 45, 66, 0.08);
}

.hm-auth {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(24rem, 0.95fr);
    width: min(1120px, calc(100% - 40px));
    min-height: min(700px, calc(100vh - 64px));
    margin: 32px auto;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.84);
    border-radius: 28px;
    background: rgba(255, 255, 255, 0.86);
    box-shadow: var(--hm-auth-shadow);
    backdrop-filter: blur(18px);
}

.hm-auth__story {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: clamp(40px, 5vw, 60px);
    color: #fff;
    background:
        linear-gradient(145deg, rgba(31, 45, 66, 0.98), rgba(24, 67, 110, 0.94)),
        url("../images/login_cover.jpg") center/cover;
}

.hm-auth__brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    color: #fff;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.hm-auth a.hm-auth__brand {
    color: #fff;
}

.hm-auth__brand:hover,
.hm-auth__brand:focus {
    color: #fff;
    text-decoration: none;
}

.hm-auth__brand-mark {
    display: grid;
    width: 42px;
    height: 42px;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 13px;
    background: rgba(255, 255, 255, 0.12);
    font-size: 12px;
    letter-spacing: 0.04em;
}

.hm-auth__brand-logo {
    display: block;
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    object-fit: contain;
}

.hm-auth__wordmark {
    display: block;
    width: min(100%, 390px);
    height: auto;
    margin: 0 auto 28px;
    object-fit: contain;
}

.hm-auth__story-copy {
    max-width: 34rem;
}

.hm-auth__eyebrow {
    margin: 0 0 14px;
    color: #b9dcff;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.15em;
    text-transform: uppercase;
}

.hm-auth__story h1 {
    margin: 0;
    color: #fff;
    font-size: clamp(34px, 4.4vw, 52px);
    font-weight: 700;
    line-height: 1.08;
    letter-spacing: -0.04em;
}

.hm-auth__story .hm-auth__register-title {
    font-size: clamp(30px, 3.7vw, 44px);
}

.hm-auth__story-copy > p:last-of-type {
    margin: 18px 0 0;
    color: rgba(255, 255, 255, 0.78);
    font-size: 17px;
    line-height: 1.7;
}

.hm-auth__trust {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 24px 0 0;
    padding: 0;
    list-style: none;
}

.hm-auth__trust li {
    padding: 8px 12px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.88);
    font-size: 12px;
    font-weight: 600;
}

.hm-auth__story > .hm-auth__eyebrow:last-child {
    margin-top: 18px;
}

.hm-auth__form-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(34px, 6vw, 76px);
    background: var(--hm-auth-surface);
}

.hm-auth__form {
    width: 100%;
    max-width: 390px;
}

.hm-auth__form-header {
    margin-bottom: 32px;
}

.hm-auth__form-header h2 {
    margin: 0 0 10px;
    color: var(--hm-auth-ink);
    font-size: 30px;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.03em;
}

.hm-auth__form-header p {
    margin: 0;
    color: var(--hm-auth-muted);
    font-size: 15px;
    line-height: 1.6;
}

.hm-auth .form-group {
    margin-bottom: 20px;
}

.hm-auth label {
    display: block;
    margin-bottom: 8px;
    color: var(--hm-auth-ink);
    font-size: 13px;
    font-weight: 700;
}

.hm-auth .form-control {
    width: 100%;
    height: 50px;
    padding: 0 15px;
    border: 1px solid var(--hm-auth-line);
    border-radius: 12px;
    background: #fbfcff;
    color: var(--hm-auth-ink);
    box-shadow: none;
    font-size: 15px;
    transition: border-color 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
}

.hm-auth .form-control:focus {
    border-color: var(--hm-auth-teal);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(11, 116, 242, 0.14);
    outline: 0;
}

.hm-auth__password {
    position: relative;
}

.hm-auth__password .form-control {
    padding-right: 54px;
}

.hm-auth__password-toggle {
    position: absolute;
    right: 8px;
    top: 7px;
    display: grid;
    width: 36px;
    height: 36px;
    padding: 0;
    place-items: center;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--hm-auth-muted);
}

.hm-auth__password-toggle:hover,
.hm-auth__password-toggle:focus {
    background: var(--hm-auth-mint);
    color: var(--hm-auth-teal-dark);
    outline: 0;
}

.hm-auth__options {
    display: flex;
    justify-content: flex-end;
    margin: -4px 0 22px;
}

.hm-auth a {
    color: var(--hm-auth-teal-dark);
    font-weight: 600;
}

.hm-auth__submit {
    width: 100%;
    min-height: 50px;
    border: 0;
    border-radius: 12px;
    background: var(--hm-auth-teal);
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    box-shadow: 0 12px 24px rgba(11, 116, 242, 0.24);
    transition: transform 160ms ease, background-color 160ms ease, box-shadow 160ms ease;
}

.hm-auth__submit:hover,
.hm-auth__submit:focus {
    color: #fff;
    background: var(--hm-auth-teal-dark);
    box-shadow: 0 15px 28px rgba(11, 116, 242, 0.3);
    outline: 0;
    transform: translateY(-1px);
}

.hm-auth__footer {
    margin: 28px 0 0;
    padding-top: 24px;
    border-top: 1px solid var(--hm-auth-line);
    color: var(--hm-auth-muted);
    text-align: center;
}

.hm-auth__text-action {
    appearance: none;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--hm-auth-teal-dark);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.hm-auth__text-action:hover,
.hm-auth__text-action:focus {
    color: var(--hm-auth-teal-dark);
}

.hm-auth__text-action:focus-visible {
    border-radius: 2px;
    outline: 3px solid var(--hm-auth-teal);
    outline-offset: 3px;
}

.hm-auth .alert {
    margin: 0 0 20px;
    padding: 12px 14px;
    border: 0;
    border-radius: 10px;
}

.hm-auth .alert-danger {
    color: var(--hm-auth-danger);
    background: #fef3f2;
}

.hm-auth .invalid-feedback {
    display: block;
    margin-top: 7px;
    color: var(--hm-auth-danger) !important;
    font-size: 12px;
}

.auth-shell .registration-form,
.auth-shell .login-form {
    border: 0;
    border-radius: 18px;
    box-shadow: var(--hm-auth-shadow);
}

.hm-auth--wide {
    grid-template-columns: minmax(17rem, 0.65fr) minmax(0, 1.35fr);
    max-width: 1240px;
}

.hm-auth--wide .hm-auth__form-panel {
    align-items: flex-start;
    overflow: auto;
}

.hm-auth__form--wide {
    max-width: 760px;
}

.hm-auth__form--wide .hm-auth__form-header {
    margin-bottom: 26px;
}

.hm-auth__field-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 16px;
}

.hm-auth__field-grid .form-group {
    min-width: 0;
}

.hm-auth__field-grid .form-group--full {
    grid-column: 1 / -1;
}

.hm-auth__form .form-group {
    position: relative;
}

.hm-auth__form .form-control::placeholder {
    color: #8b9da1;
}

.hm-auth__form select.form-control {
    padding-right: 34px;
}

.hm-auth__required {
    color: var(--hm-auth-danger);
}

.hm-auth__hint {
    margin: 6px 0 0;
    color: var(--hm-auth-muted);
    font-size: 12px;
    line-height: 1.5;
}

.hm-auth__error-summary {
    margin: 0 0 24px;
    padding: 14px 16px;
    border: 1px solid var(--hm-danger);
    border-radius: 12px;
    background: var(--hm-danger-soft);
    color: var(--hm-auth-danger);
}

.hm-auth__error-summary p {
    margin: 0 0 6px;
    font-weight: 700;
}

.hm-auth__error-summary ul {
    margin: 0;
    padding-left: 20px;
}

.hm-auth__error-summary a {
    color: var(--hm-auth-danger);
}

.hm-auth__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 26px;
}

.hm-auth__actions .hm-auth__submit {
    width: auto;
    min-width: 170px;
}

.hm-auth__secondary {
    display: inline-flex;
    min-height: 50px;
    align-items: center;
    justify-content: center;
    padding: 0 18px;
    border: 1px solid var(--hm-auth-line);
    border-radius: 12px;
    color: var(--hm-auth-teal-dark);
    background: #fff;
    font-size: 14px;
    font-weight: 700;
}

.hm-auth__secondary:hover,
.hm-auth__secondary:focus {
    border-color: var(--hm-auth-teal);
    color: var(--hm-auth-teal-dark);
    background: var(--hm-auth-mint);
    text-decoration: none;
}

.hm-auth__status {
    min-width: 0;
    max-width: 100%;
    margin: 0 0 20px;
    padding: 12px 14px;
    border-radius: 10px;
    font-size: 13px;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.hm-auth__status--success {
    color: #0759c7;
    background: #eaf3ff;
}

.hm-auth__status--error {
    color: var(--hm-auth-danger);
    background: #fef3f2;
}

.hm-auth__step {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin: 0 0 26px;
    padding: 16px;
    border: 1px solid var(--hm-auth-line);
    border-radius: 14px;
    background: #f7f9fc;
}

.hm-auth__step-number {
    display: grid;
    flex: 0 0 32px;
    width: 32px;
    height: 32px;
    place-items: center;
    border-radius: 50%;
    background: var(--hm-auth-mint);
    color: var(--hm-auth-teal-dark);
    font-weight: 700;
}

.hm-auth__step p {
    margin: 0;
    color: var(--hm-auth-muted);
    font-size: 13px;
    line-height: 1.55;
}

.hm-auth__otp {
    max-width: 280px;
}

.hm-auth__otp .form-control {
    letter-spacing: 0.18em;
    text-align: center;
}

.hm-auth__readonly {
    background: #f1f5fa !important;
    color: var(--hm-auth-muted) !important;
}

.hm-auth__setup {
    max-width: 840px;
}

.hm-auth__setup-panel {
    max-height: 360px;
    overflow: auto;
    margin: 0 0 22px;
    padding: 18px;
    border: 1px solid var(--hm-auth-line);
    border-radius: 12px;
    background: #f8faff;
    color: var(--hm-auth-ink);
    font-size: 13px;
    line-height: 1.65;
}

.hm-auth__setup-panel ol {
    padding-left: 22px;
}

.hm-auth__setup-panel li + li {
    margin-top: 12px;
}

.hm-auth__check {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 0;
    color: var(--hm-auth-ink);
    font-size: 13px;
    line-height: 1.5;
}

.hm-auth__check input {
    flex: 0 0 auto;
    margin-top: 3px;
}

.hm-state-page {
    position: relative;
    z-index: 1;
    display: grid;
    min-height: min(720px, calc(100vh - 64px));
    width: min(680px, calc(100% - 40px));
    margin: 32px auto;
    place-items: center;
}

.hm-state {
    width: 100%;
    padding: clamp(34px, 7vw, 72px);
    border: 1px solid rgba(255, 255, 255, 0.84);
    border-radius: 28px;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: var(--hm-auth-shadow);
    text-align: center;
}

.hm-state__mark {
    display: grid;
    width: 92px;
    height: 92px;
    margin: 0 auto 28px;
    place-items: center;
    border: 1px solid rgba(11, 116, 242, 0.28);
    border-radius: 26px;
    background: var(--hm-auth-mint);
    color: var(--hm-auth-teal-dark);
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.04em;
}

.hm-state .hm-auth__eyebrow {
    color: var(--hm-auth-teal-dark);
}

.hm-state h1 {
    margin: 0 0 14px;
    color: var(--hm-auth-ink);
    font-size: clamp(28px, 5vw, 42px);
    line-height: 1.12;
    letter-spacing: -0.04em;
}

.hm-state__message {
    max-width: 460px;
    margin: 0 auto;
    color: var(--hm-auth-muted);
    font-size: 15px;
    line-height: 1.7;
}

.hm-state__actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
    margin-top: 30px;
}

.hm-state__actions form {
    margin: 0;
}

.hm-state__actions .btn {
    min-height: 48px;
    padding: 13px 18px;
    border-radius: 11px;
    font-weight: 700;
}

.hm-state__primary {
    border: 0;
    background: var(--hm-auth-teal);
    color: #fff;
}

.hm-state__primary:hover,
.hm-state__primary:focus {
    background: var(--hm-auth-teal-dark);
    color: #fff;
}

.hm-state__secondary {
    border: 1px solid var(--hm-auth-line);
    background: #fff;
    color: var(--hm-auth-teal-dark);
}

.hm-state__secondary:hover,
.hm-state__secondary:focus {
    border-color: var(--hm-auth-teal);
    background: var(--hm-auth-mint);
    color: var(--hm-auth-teal-dark);
}

.hm-state__note {
    margin: 32px 0 0;
    color: var(--hm-auth-muted);
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

@media (max-width: 860px) {
    .hm-auth {
        grid-template-columns: 1fr;
        width: min(640px, calc(100% - 28px));
        margin: 14px auto;
    }

    .hm-auth__story {
        min-height: 300px;
        padding: 34px;
    }

    .hm-auth__story-copy {
        margin-top: 54px;
    }

    .hm-auth__form-panel {
        padding: 42px 34px;
    }

    .hm-auth--wide {
        grid-template-columns: 1fr;
    }

    .hm-auth--wide .hm-auth__story {
        min-height: 260px;
    }

    .hm-auth__field-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 480px) {
    .hm-auth {
        width: 100%;
        min-height: 100vh;
        margin: 0;
        border: 0;
        border-radius: 0;
    }

    .hm-auth__story {
        min-height: 260px;
        padding: 28px 22px;
    }

    .hm-auth__story h1 {
        font-size: 34px;
    }

    .hm-auth__story-copy {
        margin-top: 40px;
    }

    .hm-auth__trust {
        display: none;
    }

    .hm-auth__form-panel {
        padding: 36px 22px 44px;
    }

    .hm-auth__field-grid {
        grid-template-columns: 1fr;
    }

    .hm-auth__field-grid .form-group--full {
        grid-column: auto;
    }

    .hm-auth__actions {
        align-items: stretch;
        flex-direction: column-reverse;
    }

    .hm-auth__actions .hm-auth__submit,
    .hm-auth__secondary {
        width: 100%;
    }

    .hm-state-page {
        width: 100%;
        min-height: 100vh;
        margin: 0;
    }

    .hm-state {
        min-height: 100vh;
        border: 0;
        border-radius: 0;
        padding: 52px 22px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}