:root {
    --brand: #1d9bf0;
    --brand-dark: #0b72bd;
    --text: #172033;
    --muted: #667085;
    --line: #dbe4ef;
    --soft: #f3f8ff;
    --bg: #f5f7fb;
    --danger: #dc2626;
    --success: #047857;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

button,
input {
    font: inherit;
}

button {
    border: 0;
    cursor: pointer;
}

a {
    color: var(--brand);
    text-decoration: none;
}

.auth-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 22px;
}

.auth-card {
    width: min(440px, 100%);
    padding: 24px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    box-shadow: 0 18px 42px rgba(15, 23, 42, .12);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--brand);
    font-weight: 700;
}

.brand img {
    width: 30px;
    height: 30px;
    border-radius: 7px;
}

h1 {
    margin: 18px 0 6px;
    color: #111827;
    font-size: 24px;
}

.lead {
    margin: 0 0 18px;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.6;
}

.auth-form {
    display: grid;
    gap: 13px;
}

.auth-form label {
    display: grid;
    gap: 6px;
    color: var(--muted);
    font-size: 13px;
}

.auth-form input {
    width: 100%;
    height: 42px;
    border: 1px solid var(--line);
    border-radius: 21px;
    padding: 0 12px;
    outline: none;
    color: var(--text);
    background: #ffffff;
}

.auth-form input:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(29, 155, 240, .12);
}

.inline-field {
    display: grid;
    grid-template-columns: 1fr 112px;
    gap: 8px;
}

.inline-field button,
.primary {
    height: 42px;
    border-radius: 999px;
    background: var(--brand);
    color: #ffffff;
    font-weight: 600;
}

.inline-field button:disabled,
.primary:disabled {
    opacity: .62;
    cursor: not-allowed;
}

.check-row {
    display: flex !important;
    grid-template-columns: none;
    align-items: center;
    gap: 8px;
    color: #344054;
}

.check-row input {
    width: 16px;
    height: 16px;
}

.check-row button {
    padding: 0;
    background: transparent;
    color: var(--brand);
}

.auth-message {
    min-height: 20px;
    color: var(--danger);
    font-size: 13px;
    text-align: center;
}

.auth-message.success {
    color: var(--success);
}

.auth-links {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-top: 16px;
    font-size: 13px;
}

.terms-modal[hidden] {
    display: none;
}

.terms-modal {
    position: fixed;
    inset: 0;
    z-index: 400;
    display: grid;
    place-items: center;
    padding: 18px;
    background: rgba(15, 23, 42, .42);
}

.terms-card {
    width: min(720px, 100%);
    max-height: min(760px, 90vh);
    display: flex;
    flex-direction: column;
    border-radius: 8px;
    background: #ffffff;
    overflow: hidden;
}

.terms-head {
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    border-bottom: 1px solid var(--line);
}

.terms-head button {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #f3f6fb;
    color: #344054;
    font-size: 20px;
}

.terms-body {
    overflow: auto;
    padding: 18px 22px;
    color: #344054;
    font-size: 14px;
    line-height: 1.75;
}

.terms-body h3 {
    color: #111827;
}

.qr-box {
    display: grid;
    gap: 12px;
    margin: 18px 0;
    text-align: center;
}

.qr-status {
    color: var(--muted);
    font-size: 14px;
}

.qr-frame {
    width: 230px;
    height: 230px;
    display: grid;
    place-items: center;
    justify-self: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
}

.qr-frame img {
    max-width: 210px;
    max-height: 210px;
}

@media (max-width: 560px) {
    .auth-shell {
        align-items: start;
        padding: 10px;
    }

    .auth-card {
        width: 100%;
        padding: 18px 16px;
        box-shadow: none;
    }

    h1 {
        font-size: 22px;
    }

    .auth-links {
        flex-wrap: wrap;
    }

    input,
    button {
        font-size: 16px;
    }

    .terms-modal {
        align-items: end;
        place-items: end center;
        padding: 10px;
    }

    .terms-card {
        max-height: calc(100vh - 20px);
        max-height: calc(100dvh - 20px);
        border-radius: 12px 12px 8px 8px;
    }

    .terms-body {
        padding: 16px;
    }
}

@media (max-width: 420px) {
    .inline-field {
        grid-template-columns: 1fr;
    }

    .qr-frame {
        width: min(230px, 78vw);
        height: min(230px, 78vw);
    }
}
