* {
    box-sizing: border-box;
}

:root {
    font-family:
        Inter,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;

    color: #171717;
    background: #f5f5f5;
}

body {
    margin: 0;
    min-height: 100vh;
    background: #f5f5f5;
}

.auth-theme-toggle {
    position: fixed;
    z-index: 2;
    top: 22px;
    right: 24px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 13px;
    border: 1px solid #e3e3e3;
    border-radius: 999px;
    background: rgba(255, 255, 255, .88);
    color: #555;
    box-shadow: 0 4px 16px rgba(0, 0, 0, .05);
    cursor: pointer;
    transition: background 160ms ease, border-color 160ms ease, transform 160ms ease;
}
.auth-theme-toggle:hover { transform: translateY(-1px); background: #fff; border-color: #cfcfcf; }
.auth-theme-icon { font-size: 16px; line-height: 1; }
.auth-theme-label { font-size: 12px; font-weight: 550; }

button,
input {
    font: inherit;
}

.auth-page {
    min-height: 100vh;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 24px;
}

.auth-card {
    width: 100%;
    max-width: 420px;

    padding: 36px;

    background: #ffffff;

    border: 1px solid #e5e5e5;
    border-radius: 24px;

    box-shadow:
        0 20px 60px rgba(0, 0, 0, 0.08);
}

.brand {
    display: flex;
    align-items: center;
    gap: 14px;

    margin-bottom: 30px;
}

.brand-logo {
    width: 48px;
    height: 48px;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 14px;

    background: #111111;
    color: #ffffff;

    font-size: 24px;
    font-weight: 700;
}

.brand h1 {
    margin: 0;

    font-size: 24px;
    line-height: 1.2;
}

.brand p {
    margin: 4px 0 0;

    color: #737373;
    font-size: 14px;
}

.tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;

    padding: 4px;
    margin-bottom: 24px;

    background: #f3f3f3;
    border-radius: 12px;
}

.tab {
    border: 0;
    background: transparent;

    padding: 10px;

    border-radius: 9px;

    color: #737373;

    cursor: pointer;
}

.tab.active {
    background: #ffffff;
    color: #111111;

    box-shadow:
        0 1px 4px rgba(0, 0, 0, 0.08);
}

.field {
    margin-bottom: 18px;
}

.field label {
    display: block;

    margin-bottom: 7px;

    font-size: 14px;
    font-weight: 500;
}

.field input {
    width: 100%;

    padding: 13px 14px;

    border: 1px solid #d6d6d6;
    border-radius: 12px;

    outline: none;

    background: #ffffff;

    transition:
        border-color 0.15s,
        box-shadow 0.15s;
}

.field input:focus {
    border-color: #888888;

    box-shadow:
        0 0 0 3px rgba(0, 0, 0, 0.06);
}

.submit-button {
    width: 100%;

    padding: 13px 16px;

    border: 0;
    border-radius: 12px;

    background: #111111;
    color: #ffffff;

    font-weight: 600;

    cursor: pointer;

    transition:
        opacity 0.15s,
        transform 0.1s;
}

.submit-button:hover {
    opacity: 0.9;
}

.submit-button:active {
    transform: translateY(1px);
}

.submit-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.error {
    margin-bottom: 16px;
    padding: 11px 12px;

    border-radius: 10px;

    background: #fff0f0;
    color: #b42318;

    font-size: 14px;
}

.hidden {
    display: none !important;
}

body.dark-theme { background: #171717; color: #eee; color-scheme: dark; }
body.dark-theme .auth-page { background: radial-gradient(ellipse at top, #262626 0, #171717 65%); }
body.dark-theme .auth-card { background: #222; border-color: #383838; box-shadow: 0 20px 60px rgba(0, 0, 0, .35); }
body.dark-theme .brand h1,
body.dark-theme .field label { color: #eee; }
body.dark-theme .brand p { color: #aaa; }
body.dark-theme .tabs { background: #2b2b2b; }
body.dark-theme .tab { color: #aaa; }
body.dark-theme .tab.active { background: #3a3a3a; color: #fff; box-shadow: 0 1px 5px rgba(0,0,0,.25); }
body.dark-theme .field input { border-color: #484848; background: #303030; color: #f1f1f1; }
body.dark-theme .field input:focus { border-color: #8a9eb4; box-shadow: 0 0 0 3px rgba(138,158,180,.15); }
body.dark-theme .password-hint { color: #aaa; }
body.dark-theme .submit-button { background: #eee; color: #181818; }
body.dark-theme .submit-button:hover { background: #fff; }
body.dark-theme .error { background: #3a2424; color: #ffaaaa; }
body.dark-theme .auth-theme-toggle { border-color: #454545; background: #252525; color: #ddd; box-shadow: 0 4px 18px rgba(0,0,0,.2); }
body.dark-theme .auth-theme-toggle:hover { border-color: #666; background: #303030; }

@media (prefers-reduced-motion: no-preference) {
    body.theme-transition,
    body.theme-transition * {
        transition: background .18s ease-in-out,
            color .18s ease-in-out,
            border-color .18s ease-in-out !important;
    }
}

@media (max-width: 480px) {
    .auth-theme-toggle { top: 12px; right: 12px; padding: 8px 10px; }
    .auth-theme-label { font-size: 11px; }
    .auth-page {
        padding: 16px;
    }

    .auth-card {
        padding: 26px 20px;

        border-radius: 20px;
    }
}
