:root {
    color-scheme: dark;
    --auth-bg: #071012;
    --auth-surface: #111c1f;
    --auth-surface-raised: #172529;
    --auth-border: rgba(151, 184, 174, 0.22);
    --auth-border-strong: rgba(53, 208, 160, 0.5);
    --auth-text: #f4f7f6;
    --auth-muted: #8fa29c;
    --auth-accent: #35d0a0;
    --auth-accent-hover: #55dfb5;
    --auth-warm: #f0bd58;
    --auth-danger: #ff8993;
}

* {
    box-sizing: border-box;
}

html {
    min-width: 320px;
    min-height: 100%;
    background: var(--auth-bg);
}

body {
    min-height: 100vh;
    margin: 0;
    color: var(--auth-text);
    background:
        linear-gradient(rgba(53, 208, 160, 0.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(53, 208, 160, 0.035) 1px, transparent 1px),
        var(--auth-bg);
    background-size: 48px 48px;
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    letter-spacing: 0;
}

button,
input {
    font: inherit;
    letter-spacing: 0;
}

button {
    border: 0;
}

.auth-header {
    display: flex;
    align-items: center;
    width: min(1180px, calc(100% - 48px));
    height: 88px;
    margin: 0 auto;
}

.auth-header img {
    display: block;
    width: 154px;
    height: auto;
    object-fit: contain;
}

.auth-main {
    display: grid;
    place-items: center;
    min-height: calc(100vh - 136px);
    padding: 28px 24px 64px;
}

.auth-card {
    position: relative;
    width: min(100%, 480px);
    overflow: hidden;
    padding: 30px 34px 26px;
    background: var(--auth-surface);
    border: 1px solid var(--auth-border);
    border-radius: 8px;
    box-shadow: 0 28px 80px rgba(0, 0, 0, 0.46);
}

.auth-card::before {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    height: 3px;
    background: linear-gradient(90deg, var(--auth-accent), var(--auth-warm));
}

.auth-watermark {
    position: absolute;
    top: 62px;
    right: -42px;
    width: 156px;
    height: 156px;
    object-fit: contain;
    opacity: 0.035;
    pointer-events: none;
}

.auth-tabs {
    position: relative;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    width: 100%;
    height: 48px;
    padding: 4px;
    background: #0a1417;
    border: 1px solid rgba(151, 184, 174, 0.16);
    border-radius: 7px;
}

.auth-tab {
    min-width: 0;
    color: var(--auth-muted);
    background: transparent;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: color 160ms ease, background-color 160ms ease;
}

.auth-tab:hover {
    color: var(--auth-text);
}

.auth-tab.is-active {
    color: #06130f;
    background: var(--auth-accent);
}

.auth-tab:focus-visible,
.primary-button:focus-visible,
.secondary-button:focus-visible,
.text-button:focus-visible,
.password-toggle:focus-visible {
    outline: 2px solid var(--auth-warm);
    outline-offset: 2px;
}

.auth-form {
    position: relative;
    margin-top: 28px;
}

.auth-form[hidden] {
    display: none;
}

.auth-heading {
    margin-bottom: 26px;
}

.auth-heading h1 {
    margin: 0;
    color: var(--auth-text);
    font-size: 26px;
    line-height: 1.2;
    font-weight: 700;
}

.auth-heading p {
    margin: 8px 0 0;
    color: var(--auth-muted);
    font-size: 14px;
    line-height: 1.5;
}

.field {
    display: block;
    margin-top: 18px;
}

.field > span:first-child,
.field-label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
    color: #cbd8d4;
    font-size: 13px;
    font-weight: 500;
}

.field input {
    display: block;
    width: 100%;
    height: 50px;
    min-width: 0;
    padding: 0 14px;
    color: var(--auth-text);
    background: #0a1417;
    border: 1px solid rgba(151, 184, 174, 0.27);
    border-radius: 7px;
    outline: none;
    transition: border-color 160ms ease, background-color 160ms ease, box-shadow 160ms ease;
}

.field input::placeholder {
    color: #647872;
}

.field input:hover {
    border-color: rgba(53, 208, 160, 0.46);
}

.field input:focus {
    background: #0d181b;
    border-color: var(--auth-accent);
    box-shadow: 0 0 0 3px rgba(53, 208, 160, 0.13);
}

.password-field {
    position: relative;
    display: block;
}

.password-field input {
    padding-right: 50px;
}

.password-toggle {
    position: absolute;
    top: 5px;
    right: 5px;
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    padding: 0;
    color: #7f938d;
    background: transparent;
    border-radius: 5px;
    cursor: pointer;
}

.password-toggle:hover,
.password-toggle.is-visible {
    color: var(--auth-accent-hover);
}

.password-toggle svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
}

.text-button {
    padding: 0;
    color: var(--auth-accent-hover);
    background: transparent;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
}

.text-button:hover {
    color: var(--auth-warm);
}

.primary-button,
.secondary-button {
    width: 100%;
    height: 50px;
    border-radius: 7px;
    cursor: pointer;
    font-weight: 700;
    transition: background-color 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.primary-button {
    margin-top: 26px;
    color: #06130f;
    background: var(--auth-accent);
    box-shadow: 0 12px 28px rgba(53, 208, 160, 0.17);
}

.primary-button:hover {
    background: var(--auth-accent-hover);
    transform: translateY(-1px);
}

.secondary-button {
    margin-top: 10px;
    color: #cbd8d4;
    background: transparent;
    border: 1px solid var(--auth-border);
}

.secondary-button:hover {
    color: var(--auth-text);
    border-color: var(--auth-border-strong);
}

.form-error {
    margin: 0 0 20px;
    padding: 12px 14px;
    color: var(--auth-danger);
    background: rgba(255, 82, 99, 0.09);
    border: 1px solid rgba(255, 82, 99, 0.28);
    border-radius: 7px;
    font-size: 13px;
    line-height: 1.45;
}

.form-error div + div {
    margin-top: 5px;
}

.reset-error:empty {
    display: none;
}

.auth-legal {
    margin: 24px 0 0;
    padding-top: 20px;
    color: #71847e;
    border-top: 1px solid rgba(151, 184, 174, 0.13);
    font-size: 11px;
    line-height: 1.55;
    text-align: center;
}

.processing-overlay {
    position: fixed;
    z-index: 1000;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(4, 10, 12, 0.76);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

.processing-overlay[hidden] {
    display: none;
}

.processing-status {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 54px;
    padding: 0 20px;
    color: var(--auth-text);
    background: var(--auth-surface-raised);
    border: 1px solid var(--auth-border);
    border-radius: 7px;
    box-shadow: 0 18px 46px rgba(0, 0, 0, 0.4);
    font-size: 14px;
    font-weight: 600;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(244, 247, 246, 0.22);
    border-top-color: var(--auth-accent);
    border-radius: 50%;
    animation: auth-spin 700ms linear infinite;
}

@keyframes auth-spin {
    to { transform: rotate(360deg); }
}

@media (max-width: 600px) {
    .auth-header {
        width: calc(100% - 32px);
        height: 72px;
    }

    .auth-header img {
        width: 136px;
    }

    .auth-main {
        align-items: start;
        min-height: calc(100vh - 72px);
        padding: 12px 16px 32px;
    }

    .auth-card {
        padding: 24px 20px 22px;
    }

    .auth-form {
        margin-top: 24px;
    }

    .auth-heading {
        margin-bottom: 22px;
    }

    .auth-heading h1 {
        font-size: 23px;
    }
}

@media (max-height: 720px) and (min-width: 601px) {
    .auth-header {
        height: 68px;
    }

    .auth-main {
        min-height: calc(100vh - 68px);
        padding-top: 12px;
        padding-bottom: 28px;
    }
}

@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;
    }
}
