@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&display=swap');

:root {
    --auth-primary: #3955a2;
    --auth-primary-hover: #30498c;
    --auth-sidebar: #1f2933;
    --auth-border: #e2e8f0;
    --auth-muted: #64748b;
    --auth-ink: #0f172a;
    --auth-illustration: url('../img/auth-apartment-illustration.png');
    --auth-logo-height: 28px;
    --auth-mobile-logo-height: 26px;
    --auth-logo-caption-size: 14px;
    --auth-mobile-caption-size: 13px;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--auth-sidebar); }
body { margin: 0; color: var(--auth-ink); background: #fff; font: 13px/1.6 Poppins, system-ui, sans-serif; }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; }
button { cursor: pointer; }
svg { display: block; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.auth { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; background: #fff; }
.auth-brand { position: relative; isolation: isolate; overflow: hidden; min-width: 0; padding: 70px; display: flex; flex-direction: column; justify-content: space-between; color: #fff; background: var(--auth-sidebar); }
.auth-brand--illustrated::before,
.auth-brand--illustrated::after { content: ''; position: absolute; z-index: 0; pointer-events: none; background-image: radial-gradient(circle, rgba(113, 136, 197, .92) 0 3px, rgba(255, 255, 255, .18) 3.1px, transparent 3.7px); background-size: 20px 20px; }
.auth-brand--illustrated::before { width: 220px; height: 140px; top: -8px; right: -10px; }
.auth-brand--illustrated::after { width: 180px; height: 120px; bottom: -10px; left: -10px; }
.auth-logo-block,
.auth-brand-copy { position: relative; z-index: 2; }
.auth-logo-block { display: flex; flex-direction: column; align-items: flex-start; gap: 5px; padding: 0; background: transparent; border: 0; border-radius: 0; box-shadow: none; }
.auth-logo { width: auto; height: var(--auth-logo-height); max-width: 100%; max-height: 140px; object-fit: contain; object-position: left center; background: transparent; }
.auth-logo-caption { max-width: 100%; overflow-wrap: anywhere; color: #fff; font-size: var(--auth-logo-caption-size); font-weight: 400; line-height: 1.3; }
.auth-brand-copy { margin: auto 0; transform: translateY(-68px); }
.auth-brand-copy h1 { margin: 0 0 14px; font-size: 36px; font-weight: 600; line-height: 1.25; }
.auth-brand-copy h1 span { color: var(--auth-primary); }
.auth-brand-copy p { max-width: 440px; margin: 0 0 22px; color: #bfcbd5; font-size: 14px; line-height: 1.6; }
.auth-feature-grid { max-width: 560px; display: grid; grid-template-columns: 1fr 1fr; gap: 14px 20px; }
.auth-feature { display: flex; align-items: center; gap: 9px; color: #e1e7ec; font-size: 13.5px; font-weight: 400; white-space: nowrap; }
.auth-feature > span { flex-shrink: 0; color: var(--auth-primary); font-size: 16px; font-weight: 700; line-height: 1; }
.auth-brand-illustration { position: absolute; z-index: 1; left: 50%; bottom: 24px; width: min(calc(100% - 90px), 620px); height: 285px; margin: 0; transform: translateX(-50%); display: flex; align-items: flex-end; justify-content: center; pointer-events: none; }
.auth-brand-illustration img { display: block; width: 100%; height: 100%; max-width: none; max-height: none; object-fit: contain; object-position: center bottom; opacity: .42; filter: saturate(.78) drop-shadow(0 16px 20px rgba(5, 12, 22, .16)); }

.auth-form { min-width: 0; min-height: 100vh; padding: 40px; display: flex; align-items: center; justify-content: center; background: #fff; }
.auth-mobile-brand { display: none; background: transparent; }
.auth-inner { width: 100%; max-width: 440px; }
.auth-header { text-align: center; }
.auth-header--login { margin-bottom: 20px; }
.auth-header h1 { margin: 0 0 4px; color: var(--auth-ink); font-size: 16px; font-weight: 500; letter-spacing: -.2px; text-align: center; }
.auth-subtitle { margin: 0 0 20px; color: var(--auth-muted); font-size: 13px; line-height: 1.4; text-align: center; }
.auth-inner form { margin-top: 25px; }
.auth-header + form { margin-top: 0; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.auth-login-form .form-grid,
.auth-register-form .form-grid { display: flex; flex-direction: column; gap: 15px; }
.field { display: flex; flex-direction: column; gap: 7px; }
.field.full { grid-column: 1 / -1; }
.field label { color: #334155; font-size: 12px; font-weight: 400; }
.field small { color: var(--auth-muted); font-size: 11px; }
.auth-input-wrap { position: relative; width: 100%; }
.auth-input-icon { position: absolute; z-index: 2; left: 14px; top: 50%; width: 18px; height: 18px; transform: translateY(-50%); color: #94a3b8; pointer-events: none; }
.auth-input-wrap input { width: 100%; min-width: 0; min-height: 44px; padding: 10px 46px 10px 42px; border: 1px solid #dce2e8; border-radius: 2px; color: var(--auth-ink); background: #fff; }
.auth-input-wrap input:focus { outline: none; border-color: var(--auth-primary); background: #fff; box-shadow: 0 0 0 3px rgba(57, 85, 162, .16); }
.auth-input-wrap:focus-within .auth-input-icon { color: var(--auth-primary); }
.password-field { position: relative; }
.password-toggle { position: absolute; z-index: 3; right: 1px; top: 1px; bottom: 1px; width: 42px; padding: 0; border: 0; border-radius: 2px; display: inline-flex; align-items: center; justify-content: center; color: #536171; background: transparent; }
.password-toggle:hover { background: #eef3f8; }
.password-toggle:focus-visible { outline: 2px solid var(--auth-primary); outline-offset: 1px; }
.password-toggle svg { width: 19px; height: 19px; pointer-events: none; }
.password-toggle .eye-open { display: none; }
.password-toggle[aria-pressed='true'] .eye-open { display: block; }
.password-toggle[aria-pressed='true'] .eye-closed { display: none; }

.auth-options { margin: 10px 0 20px; display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: nowrap; }
.auth-check { margin: 0; display: inline-flex; align-items: center; gap: 8px; color: #475569; font-size: 13px; font-weight: 400; line-height: 1; cursor: pointer; }
.auth-check input { width: 15px; height: 15px; margin: 0; accent-color: var(--auth-primary); cursor: pointer; }
.auth-options a { display: inline-flex; align-items: center; gap: 5px; color: var(--auth-primary); font-size: 13px; font-weight: 400; line-height: 1; }
.auth-options a svg { width: 13px; height: 13px; }
.auth-primary { width: 100%; min-height: 46px; padding: 9px 14px; border: 1px solid var(--auth-primary); border-radius: 2px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; color: #fff; background: var(--auth-primary); font-size: 13px; font-weight: 400; }
.auth-primary:hover { border-color: var(--auth-primary-hover); background: var(--auth-primary-hover); }
.auth-primary:focus-visible,
.auth-register-btn:focus-visible,
.auth-back-btn:focus-visible,
.auth-options a:focus-visible { outline: 2px solid var(--auth-primary); outline-offset: 3px; }
.button-icon { width: 16px; height: 16px; }
.auth-register-card { margin-top: 10px; padding: 12px 16px; border: 1px solid var(--auth-border); border-radius: 4px; display: flex; align-items: center; justify-content: center; gap: 8px; color: var(--auth-muted); background: #f8fafc; font-size: 13px; }
.auth-register-btn { display: inline-flex; align-items: center; gap: 4px; color: var(--auth-primary); font-size: 13px; font-weight: 500; }
.auth-submit { margin-top: 16px; }
.auth-inline-link { margin-top: 16px; color: var(--auth-muted); font-size: 13px; text-align: center; }
.auth-inline-link a { color: var(--auth-primary); font-weight: 500; }
.auth-back-wrap { margin-top: 20px; text-align: center; }
.auth-back-btn { min-width: 140px; padding: 9px 22px; border: 1px solid var(--auth-primary); border-radius: 2px; display: inline-flex; align-items: center; justify-content: center; color: var(--auth-primary); background: #fff; font-size: 13px; font-weight: 400; }
.auth-back-btn:hover { background: #f8fafc; }
.auth-alert { margin-bottom: 18px; padding: 12px 14px; border: 1px solid #d8e1ef; border-radius: 4px; color: #44546a; background: #f4f7fb; }
.auth-alert.error { border-color: #ffd8d2; color: #a32418; background: #fff1ef; }
.auth-footer-block { margin-top: 24px; padding-top: 0; text-align: center; }
.auth-trust-row { margin-bottom: 8px; display: flex; align-items: center; justify-content: center; gap: 12px; color: #94a3b8; font-size: 11px; }
.auth-trust-row span { display: inline-flex; align-items: center; gap: 4px; }
.auth-trust-row svg { width: 12px; height: 12px; }
.auth-trust-row i { font-style: normal; }
.auth-powered { color: var(--auth-muted); font-size: 12px; }
.auth-powered a { color: var(--auth-primary); font-weight: 500; }

.custom-modal-overlay { position: fixed; inset: 0; z-index: 9999; padding: 20px; display: flex; align-items: center; justify-content: center; opacity: 0; pointer-events: none; background: rgba(15, 23, 42, .55); backdrop-filter: blur(4px); transition: opacity .2s ease; }
.custom-modal-overlay.active { opacity: 1; pointer-events: auto; }
.custom-modal { position: relative; width: 100%; max-width: 400px; padding: 26px 24px 22px; border-radius: 6px; transform: scale(.94); color: var(--auth-ink); background: #fff; box-shadow: 0 20px 40px -10px rgba(0, 0, 0, .25); text-align: center; transition: transform .2s cubic-bezier(.34, 1.56, .64, 1); }
.custom-modal-overlay.active .custom-modal { transform: scale(1); }
.custom-modal-close { position: absolute; top: 12px; right: 12px; width: 30px; height: 30px; padding: 0; border: 1px solid #dce2e8; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: var(--auth-muted); background: #fff; font-size: 20px; line-height: 1; transition: transform .3s ease, background .2s ease, color .2s ease; }
.custom-modal-close:hover { transform: rotate(90deg); color: var(--auth-ink); background: #f1f5f9; }
.custom-modal-icon { width: 48px; height: 48px; margin: 0 auto 14px; border-radius: 50%; display: grid; place-items: center; color: var(--auth-primary); background: #eef3ff; }
.custom-modal-icon svg { width: 24px; height: 24px; stroke-width: 2.2; }
.custom-modal-title { margin: 0 0 8px; color: var(--auth-ink); font-size: 15px; font-weight: 600; }
.custom-modal-body { margin: 0 0 20px; color: var(--auth-muted); font-size: 13px; line-height: 1.5; }
.custom-modal-actions { display: flex; align-items: center; justify-content: center; gap: 10px; }
.custom-modal-actions button { flex: 1; min-height: 38px; padding: 8px 14px; border-radius: 2px; display: inline-flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 400; }
.custom-modal-cancel { border: 1px solid var(--auth-sidebar); color: #fff; background: var(--auth-sidebar); }
.custom-modal-cancel:hover { border-color: #111827; background: #111827; }
.custom-modal-confirm { border: 1px solid var(--auth-primary); color: #fff; background: var(--auth-primary); }
.custom-modal-confirm:hover { border-color: var(--auth-primary-hover); background: var(--auth-primary-hover); }
body.modal-open { overflow: hidden; }

@media (min-width: 769px) and (max-width: 1279px) {
    .auth-brand { padding: 48px; }
    .auth-brand-copy { transform: none; }
    .auth-brand-illustration { display: none; }
    .auth-brand--illustrated::before { width: 170px; height: 110px; }
    .auth-brand--illustrated::after { width: 140px; height: 90px; }
}

@media (min-width: 1280px) and (max-height: 820px) {
    .auth-brand-copy { transform: translateY(-52px); }
    .auth-brand-illustration { height: 205px; bottom: 18px; }
}

@media (min-width: 1280px) and (max-height: 740px) {
    .auth-brand-copy { transform: translateY(-45px); }
    .auth-brand-illustration { height: 160px; bottom: 12px; }
}

@media (max-width: 768px) {
    body { padding: 0; background: var(--auth-sidebar); }
    .auth { width: 100%; min-height: 100dvh; display: flex; flex-direction: column; overflow-x: hidden; background: var(--auth-sidebar); }
    .auth-brand { display: none; }
    .auth-form { width: 100%; min-height: 100dvh; padding: 0; display: flex; flex: 1 0 auto; flex-direction: column; background: var(--auth-sidebar); }
    .auth-mobile-brand { width: 100%; min-width: 300px; padding: calc(28px + env(safe-area-inset-top)) 20px 24px; display: flex; flex-direction: column; align-items: center; justify-content: center; color: #fff; background: transparent; text-align: center; }
    .auth-mobile-brand img { display: block; width: auto; height: var(--auth-mobile-logo-height); max-width: 100%; margin: 0 auto; object-fit: contain; background: transparent; }
    .auth-mobile-brand-caption { margin-top: 6px; color: #fff; font-size: var(--auth-mobile-caption-size); font-weight: 400; letter-spacing: .2px; text-align: center; }
    .auth-inner { position: relative; isolation: isolate; width: 100%; max-width: none; min-height: 0; margin: 0; padding: 32px 22px calc(36px + env(safe-area-inset-bottom)); border: 0; border-radius: 0; display: flex; flex: 1 0 auto; flex-direction: column; overflow: hidden; background: #fff; box-shadow: 0 -6px 25px rgba(0, 0, 0, .15); }
    .auth-inner form { margin-top: 0; }
    .auth-inner .form-grid { display: flex; flex-direction: column; gap: 15px; }
    .auth-inner .field { gap: 6px; margin: 0; }
    .auth-input-wrap input { height: 44px; min-height: 44px; border: 1.5px solid var(--auth-border); background: #f8fafc; }
    .auth-options { margin: 12px 0 20px; }
    .auth-check,
    .auth-options a { white-space: nowrap; }
    .auth-login-button { box-shadow: 0 4px 14px rgba(57, 85, 162, .28); }
    .auth-footer-block { margin-top: auto; padding-top: 28px; }
}

@media (max-width: 430px) {
    .auth-options { gap: 8px; flex-wrap: nowrap; }
    .auth-check, .auth-options a { font-size: 12px; white-space: nowrap; }
    .auth-trust-row { gap: 8px; font-size: 10.5px; white-space: nowrap; flex-wrap: nowrap; }
    .auth-register-card { flex-wrap: wrap; }
}

@media (max-width: 374px) {
    .auth-options { flex-direction: row !important; align-items: center !important; justify-content: space-between !important; gap: 4px !important; flex-wrap: nowrap !important; }
    .auth-check, .auth-options a { font-size: 11px !important; white-space: nowrap !important; }
    .auth-check { gap: 4px !important; }
    .auth-check input { width: 13px !important; height: 13px !important; }
    .auth-trust-row { flex-direction: row !important; align-items: center !important; justify-content: center !important; gap: 5px !important; font-size: 9.5px !important; white-space: nowrap !important; flex-wrap: nowrap !important; }
    .auth-trust-row i { display: inline-block !important; }
    .auth-trust-row svg { width: 11px !important; height: 11px !important; }
}

@media (max-width: 768px) and (min-height: 780px) {
    .auth--login .auth-inner::before { content: ''; position: absolute; z-index: 0; left: 50%; bottom: 90px; width: min(86vw, 360px); height: 210px; transform: translateX(-50%); background: var(--auth-illustration) center bottom / contain no-repeat; opacity: .08; filter: saturate(.72); pointer-events: none; }
    .auth--login .auth-inner > * { position: relative; z-index: 1; }
}

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