:root {
    color-scheme: dark;
    --auth-bg: #191b20;
    --auth-panel: #202228;
    --auth-panel-strong: #282b32;
    --auth-input: #1b1d22;
    --auth-border: rgba(255, 255, 255, 0.1);
    --auth-border-strong: rgba(255, 255, 255, 0.17);
    --auth-text: #f1f3f5;
    --auth-muted: #9aa0aa;
    --auth-muted-2: #717782;
    --auth-green: #5dd39e;
    --auth-green-hover: #70dcae;
    --auth-red: #f06a6a;
    font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
    font-synthesis: none;
}

* { box-sizing: border-box; }
html { min-width: 320px; min-height: 100%; background: var(--auth-bg); }
body {
    min-width: 320px;
    min-height: 100vh;
    margin: 0;
    background: var(--auth-bg);
    color: var(--auth-text);
    letter-spacing: 0;
}
button, input { font: inherit; letter-spacing: 0; }
button, a { -webkit-tap-highlight-color: transparent; }
.auth-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
}
.auth-panel {
    width: 100%;
    max-width: 440px;
    min-width: 0;
    padding: 30px 32px 28px;
    background: var(--auth-panel);
    border: 1px solid var(--auth-border);
    border-radius: 8px;
    box-shadow: 0 18px 54px rgba(0, 0, 0, 0.28);
}
.auth-brand {
    width: fit-content;
    display: flex;
    align-items: center;
    gap: 11px;
    margin: 0 auto 28px;
    color: inherit;
    text-decoration: none;
}
.auth-brand-mark { display: block; width: 42px; height: 42px; object-fit: contain; }
.auth-brand-text { display: block; width: 138px; height: 32px; object-fit: contain; }
.auth-header { margin-bottom: 20px; text-align: center; }
.auth-header h1 {
    margin: 0;
    font-size: 21px;
    line-height: 1.3;
    font-weight: 650;
    letter-spacing: 0;
}
.auth-header p {
    margin: 7px 0 0;
    color: var(--auth-muted);
    font-size: 13px;
    line-height: 1.5;
}
.tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 3px;
    padding: 3px;
    margin-bottom: 24px;
    background: #191b20;
    border: 1px solid var(--auth-border);
    border-radius: 6px;
}
.tab-btn {
    min-width: 0;
    min-height: 36px;
    padding: 7px 12px;
    border: 0;
    border-radius: 4px;
    background: transparent;
    color: var(--auth-muted);
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: background-color 140ms ease, color 140ms ease;
}
.tab-btn:hover { color: var(--auth-text); }
.tab-btn.active {
    background: var(--auth-panel-strong);
    color: var(--auth-text);
    box-shadow: inset 0 0 0 1px var(--auth-border);
}
.tab-btn-hidden { display: none; }
body[data-active-tab="verify"] .tab-btn[data-auth-tab="verify"] { display: block; }
body[data-active-tab="verify"] .tabs { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.auth-forms { min-height: 250px; }
.auth-form { display: none; width: 100%; flex-direction: column; gap: 15px; }
.auth-form.active { display: flex; }
.field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.field label, .field-label-row {
    color: #d9dce1;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.35;
}
.field-label-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
}
.field-link, .text-btn { color: var(--auth-green); text-decoration: none; }
.field-link { flex: 0 0 auto; font-size: 12px; font-weight: 500; }
.field-link:hover, .text-btn:hover { color: var(--auth-green-hover); text-decoration: underline; }
.field input {
    width: 100%;
    min-width: 0;
    height: 42px;
    padding: 0 12px;
    border: 1px solid var(--auth-border);
    border-radius: 5px;
    outline: 0;
    background: var(--auth-input);
    color: var(--auth-text);
    font-size: 14px;
    transition: border-color 140ms ease, background-color 140ms ease, box-shadow 140ms ease;
}
.field input::placeholder { color: var(--auth-muted-2); }
.field input:hover { border-color: var(--auth-border-strong); }
.field input:focus {
    border-color: rgba(93, 211, 158, 0.72);
    background: #1e2126;
    box-shadow: 0 0 0 3px rgba(93, 211, 158, 0.1);
}
.field input:-webkit-autofill,
.field input:-webkit-autofill:hover,
.field input:-webkit-autofill:focus {
    -webkit-text-fill-color: var(--auth-text);
    -webkit-box-shadow: 0 0 0 1000px var(--auth-input) inset;
    caret-color: var(--auth-text);
}
.field-hint { color: var(--auth-muted-2); font-size: 11px; line-height: 1.45; }
.code-input {
    text-align: center;
    font-size: 18px !important;
    font-weight: 650;
    letter-spacing: 5px !important;
}
.primary-btn, .secondary-btn, .text-btn { width: 100%; border: 0; cursor: pointer; }
.primary-btn, .secondary-btn {
    min-height: 42px;
    padding: 9px 14px;
    border-radius: 5px;
    font-size: 13px;
    font-weight: 650;
    transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease;
}
.primary-btn { margin-top: 3px; background: var(--auth-green); color: #101713; }
.primary-btn:hover { background: var(--auth-green-hover); }
.primary-btn:focus-visible,
.secondary-btn:focus-visible,
.tab-btn:focus-visible,
.text-btn:focus-visible,
.field-link:focus-visible { outline: 2px solid var(--auth-green); outline-offset: 2px; }
.secondary-btn {
    background: var(--auth-panel-strong);
    border: 1px solid var(--auth-border-strong);
    color: var(--auth-text);
}
.secondary-btn:hover { border-color: rgba(93, 211, 158, 0.55); color: var(--auth-green-hover); }
.secondary-btn:disabled, .primary-btn:disabled { cursor: wait; opacity: 0.62; }
.text-btn {
    min-height: 28px;
    padding: 2px 0;
    background: transparent;
    font-size: 12px;
    font-weight: 550;
}
.verification-area {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 13px;
    border: 1px solid var(--auth-border);
    border-radius: 5px;
    background: rgba(25, 27, 32, 0.7);
}
.verification-area[hidden] { display: none; }
.message {
    padding: 10px 11px;
    border: 1px solid var(--auth-border);
    border-radius: 5px;
    font-size: 12px;
    line-height: 1.5;
    overflow-wrap: anywhere;
}
.message-error {
    border-color: rgba(240, 106, 106, 0.32);
    background: rgba(240, 106, 106, 0.08);
    color: #f49a9a;
}
.message-info {
    border-color: rgba(93, 211, 158, 0.28);
    background: rgba(93, 211, 158, 0.08);
    color: #8de2ba;
}
.message-inline {
    display: none;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--auth-muted);
}
.message-inline:not(:empty) { display: block; }
.message-inline.is-success { color: #8de2ba; }
.message-inline.is-error { color: #f49a9a; }
@media (max-width: 520px) {
    .auth-shell { align-items: start; padding: 16px; }
    .auth-panel { padding: 24px 20px 26px; box-shadow: none; }
    .auth-brand { margin-bottom: 24px; }
    .auth-brand-mark { width: 38px; height: 38px; }
    .auth-brand-text { width: 126px; height: 29px; }
    .auth-header h1 { font-size: 19px; }
    .tabs { margin-bottom: 20px; }
    .auth-forms { min-height: 0; }
    .field input, .primary-btn, .secondary-btn { min-height: 44px; }
}
@media (max-width: 360px) {
    .auth-shell { padding: 0; }
    .auth-panel {
        min-height: 100vh;
        padding: 22px 16px 28px;
        border-width: 0;
        border-radius: 0;
    }
    .field-label-row { align-items: flex-start; flex-direction: column; gap: 4px; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
    }
}
