/* The auth host is a normal scrolling document: the app shell's body { height:100%; overflow:hidden }
   must not clip a tall consent card, so the body scrolls and the shell only sets a minimum height. */
html:has(.auth-shell),
body:has(.auth-shell) {
    height: auto;
    min-height: 100%;
    margin: 0;
    overflow: auto;
    background: #090909;
}

.auth-shell {
    --auth-bg: #090909;
    --auth-text: #f4f4f5;
    --auth-muted: #8c8c90;
    --auth-button-bg: #1f1f20;
    --auth-button-hover-bg: #28282a;
    --auth-button-primary-bg: #626bdc;
    --auth-button-primary-hover-bg: #7179e2;
    --auth-border: #2b2c2f;
    --auth-input-bg: #111112;
    display: flex;
    flex-direction: column;
    align-items: center;
    /* Centre short content; when the card is taller than the viewport, start at the top and scroll. */
    justify-content: safe center;
    box-sizing: border-box;
    min-height: 100vh;
    min-height: 100dvh;
    padding: 24px;
    overflow: visible;
    background:
        radial-gradient(circle at 50% 42%, rgba(255, 255, 255, 0.018), transparent 290px),
        var(--auth-bg);
    color: var(--auth-text);
    font-family: var(--font-regular, Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif);
}

.auth-panel {
    display: flex;
    align-items: center;
    flex-direction: column;
    width: 288px;
    max-width: calc(100vw - 48px);
    margin-top: -20px;
    color: var(--auth-text);
    text-align: center;
}

.auth-panel--wide {
    width: 340px;
}

.auth-logo {
    display: grid;
    width: 48px;
    height: 48px;
    margin-bottom: 30px;
    place-items: center;
    color: #f0f0f0;
}

.auth-logo svg {
    display: block;
}

.auth-panel__copy {
    display: flex;
    align-items: center;
    flex-direction: column;
    gap: 22px;
    width: 100%;
}

.auth-panel h1 {
    margin: 0;
    color: var(--auth-text);
    font-size: 19px;
    font-weight: 450;
    letter-spacing: 0;
    line-height: 1.5rem;
}

.auth-panel__description {
    width: 100%;
    max-width: 250px;
    margin: -1px auto 14px;
    color: var(--auth-muted);
    font-size: 0.875rem;
    font-weight: 400;
    line-height: 1.25rem;
}

.auth-panel__description strong {
    color: var(--auth-text);
    font-weight: 450;
}

.auth-actions,
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 100%;
    margin-top: 24px;
}

.auth-form {
    gap: 16px;
}

.auth-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    width: 100%;
    height: 44px;
    padding: 0 18px;
    border: 0;
    border-radius: 9999px;
    background: var(--auth-button-bg);
    color: var(--auth-text);
    cursor: default;
    font: inherit;
    font-size: 0.875rem;
    font-weight: 450;
    line-height: 1.125rem;
    text-decoration: none;
    transition:
        background 120ms ease,
        color 120ms ease,
        opacity 120ms ease;
}

.auth-button:hover,
.auth-button:focus-visible {
    background: var(--auth-button-hover-bg);
    color: #fff;
    outline: none;
}

.auth-button--primary {
    background: var(--auth-button-primary-bg);
    color: #fff;
}

.auth-button--primary:hover,
.auth-button--primary:focus-visible {
    background: var(--auth-button-primary-hover-bg);
}

.auth-button[disabled],
.auth-button[aria-disabled="true"] {
    opacity: 0.55;
    pointer-events: none;
}

.auth-input {
    box-sizing: border-box;
    width: 100%;
    height: 44px;
    padding: 0 13px;
    border: 1px solid var(--auth-border);
    border-radius: 8px;
    background: var(--auth-input-bg);
    color: var(--auth-text);
    font: inherit;
    font-size: 0.875rem;
    font-weight: 400;
    line-height: 1.25rem;
    outline: none;
    transition:
        border-color 120ms ease,
        box-shadow 120ms ease;
}

.auth-input::placeholder {
    color: #65666a;
}

.auth-input:focus {
    border-color: #363941;
    box-shadow: 0 0 0 2px rgba(88, 91, 98, 0.34);
}

.auth-form__error {
    margin: -4px 0 0;
    color: #f87171;
    font-size: 0.8125rem;
    font-weight: 450;
    line-height: 1.125rem;
    text-align: left;
}

.auth-form__help {
    margin: -2px 0 0;
    color: var(--auth-muted);
    font-size: 0.875rem;
    font-weight: 400;
    line-height: 1.25rem;
    text-align: center;
}

.auth-input--code {
    font-family: var(--font-mono, "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace);
    font-size: 1rem;
    letter-spacing: 0.09em;
    text-align: center;
}

.auth-consent-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    box-sizing: border-box;
    width: 100%;
    margin: 0;
    padding: 0;
    color: var(--auth-text);
    list-style: none;
    text-align: left;
}

.auth-consent-item {
    box-sizing: border-box;
    width: 100%;
    padding: 11px 12px;
    border: 1px solid var(--auth-border);
    border-radius: 8px;
    background: var(--auth-input-bg);
    color: var(--auth-text);
    font-size: 0.875rem;
    line-height: 1.25rem;
}

.auth-panel__footer,
.auth-link-row,
.auth-legal {
    color: var(--auth-muted);
    font-size: 0.875rem;
    font-weight: 400;
    line-height: 1.25rem;
}

.auth-panel__footer {
    margin-top: 30px;
}

.auth-link-row {
    margin-top: 18px;
}

.auth-link-row--compact {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-top: 8px;
}

.auth-legal {
    max-width: 260px;
    margin: 38px auto 0;
}

.auth-link {
    border: 0;
    background: transparent;
    color: var(--auth-text);
    cursor: default;
    font: inherit;
    text-decoration: none;
}

.auth-link-button {
    padding: 0;
}

.auth-link:hover,
.auth-link:focus-visible {
    color: #fff;
    outline: none;
}

.auth-spinner {
    display: block;
    width: 20px;
    height: 20px;
    margin-top: 34px;
    border: 2px solid rgba(255, 255, 255, 0.16);
    border-top-color: rgba(255, 255, 255, 0.76);
    border-radius: 50%;
    animation: auth-spin 800ms linear infinite;
}

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

@media (max-width: 520px) {
    .auth-shell {
        padding: 20px;
    }

    .auth-panel {
        width: min(288px, 100%);
        margin-top: -8px;
    }
}

/* OAuth consent surface (Linear agent-install reference image, 2026-09-06, 1× measurements):
   625px card (padding 40, radius 14, hairline ring), 68px app/platform marks 20px apart around a
   ⇄ glyph, title 22/500, subtitle 15 muted with the workspace in text colour, section labels
   15 muted, 46px list rows (16px glyph, 15px text) on hairline dividers inside an 8px card,
   40px Cancel (secondary) / Authorize (primary, radius 6) bottom-right, and a 15px trust
   notice below the card. The team list is revealed by the checked radio via :has() — no JS. */
.oauth-consent {
    --oauth-consent-card-bg: #101012;
    --oauth-consent-list-bg: #151517;
    --oauth-consent-ring: var(--auth-border, #2b2c2f);
    --oauth-consent-text: var(--auth-text, #f4f4f5);
    --oauth-consent-muted: var(--auth-muted, #8c8c90);
    --oauth-consent-accent: var(--auth-button-primary-bg, #626bdc);
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 24px;
    width: 625px;
    max-width: calc(100vw - 48px);
    margin: 0 auto;
    color: var(--oauth-consent-text);
    font-family: var(--font-regular, Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif);
    text-align: left;
}

.oauth-consent__card {
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    padding: 40px;
    border: 1px solid var(--oauth-consent-ring);
    border-radius: 14px;
    background: var(--oauth-consent-card-bg);
}

.oauth-consent__marks {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin: 20px 0 30px;
}

.oauth-consent__mark {
    display: grid;
    width: 68px;
    height: 68px;
    overflow: hidden;
    border-radius: 14px;
    background: var(--oauth-consent-list-bg);
    place-items: center;
}

.oauth-consent__mark-image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.oauth-consent__mark-initials {
    display: grid;
    width: 100%;
    height: 100%;
    color: #fff;
    font-size: 26px;
    font-weight: 500;
    letter-spacing: 0.02em;
    place-items: center;
}

.oauth-consent__exchange {
    display: inline-flex;
    color: var(--oauth-consent-muted);
}

.oauth-consent__title {
    margin: 0;
    color: var(--oauth-consent-text);
    font-size: 22px;
    font-weight: 500;
    line-height: 28px;
    text-align: center;
}

.oauth-consent__subtitle {
    margin: 6px 0 0;
    color: var(--oauth-consent-muted);
    font-size: 15px;
    font-weight: 400;
    line-height: 22px;
    text-align: center;
}

.oauth-consent__subtitle strong {
    color: var(--oauth-consent-text);
    font-weight: 500;
}

.oauth-consent__section {
    margin: 40px 0 0;
    padding: 0;
    border: 0;
    min-width: 0;
}

.oauth-consent__section + .oauth-consent__section {
    margin-top: 32px;
}

.oauth-consent__section-label {
    display: block;
    margin: 0 0 8px;
    padding: 0;
    color: var(--oauth-consent-muted);
    font-size: 15px;
    font-weight: 400;
    line-height: 22px;
}

.oauth-consent__list {
    display: flex;
    flex-direction: column;
    margin: 0;
    padding: 0;
    overflow: hidden;
    border: 1px solid var(--oauth-consent-ring);
    border-radius: 8px;
    background: var(--oauth-consent-list-bg);
    list-style: none;
}

.oauth-consent__row {
    display: flex;
    align-items: center;
    gap: 12px;
    box-sizing: border-box;
    min-height: 46px;
    padding: 0 14px;
    color: var(--oauth-consent-text);
    font-size: 15px;
    font-weight: 400;
    line-height: 22px;
}

.oauth-consent__row + .oauth-consent__row {
    border-top: 1px solid var(--oauth-consent-ring);
}

.oauth-consent__row-icon {
    display: inline-flex;
    flex: 0 0 auto;
    color: var(--oauth-consent-muted);
}

.oauth-consent__row-text {
    flex: 1 1 auto;
    min-width: 0;
}

.oauth-consent__choice {
    cursor: pointer;
}

.oauth-consent__radio,
.oauth-consent__checkbox {
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    margin: 0;
    accent-color: var(--oauth-consent-accent);
}

.oauth-consent__team-key,
.oauth-consent__team-private {
    flex: 0 0 auto;
    color: var(--oauth-consent-muted);
    font-size: 13px;
    line-height: 18px;
}

.oauth-consent__teams {
    display: none;
    margin-top: 12px;
}

.oauth-consent__teams-label {
    display: block;
    margin: 0 0 8px;
    color: var(--oauth-consent-muted);
    font-size: 13px;
    line-height: 18px;
}

/* CSS-only reveal: the checked mode decides which teams are listed. */
.oauth-consent:has(.oauth-consent__radio[data-team-selection="all"]:checked) .oauth-consent__teams,
.oauth-consent:has(.oauth-consent__radio[data-team-selection="privateonly"]:checked) .oauth-consent__teams {
    display: block;
}

.oauth-consent:has(.oauth-consent__radio[data-team-selection="privateonly"]:checked) .oauth-consent__team[data-private="false"] {
    display: none;
}

.oauth-consent__error {
    margin: 24px 0 0;
    color: #f87171;
    font-size: 14px;
    font-weight: 450;
    line-height: 20px;
}

.oauth-consent__actions {
    display: flex;
    justify-content: flex-end;
    gap: 11px;
    margin-top: 48px;
}

.oauth-consent__button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    height: 40px;
    padding: 0 18px;
    border: 0;
    border-radius: 6px;
    background: var(--auth-button-bg, #1f1f20);
    color: var(--oauth-consent-text);
    cursor: default;
    font: inherit;
    font-size: 15px;
    font-weight: 500;
    line-height: 20px;
    transition: background 120ms ease;
}

.oauth-consent__button:hover,
.oauth-consent__button:focus-visible {
    background: var(--auth-button-hover-bg, #28282a);
    outline: none;
}

.oauth-consent__button:focus-visible {
    box-shadow: 0 0 0 2px rgba(98, 107, 220, 0.5);
}

.oauth-consent__button--primary {
    background: var(--oauth-consent-accent);
    color: #fff;
}

.oauth-consent__button--primary:hover,
.oauth-consent__button--primary:focus-visible {
    background: var(--auth-button-primary-hover-bg, #7179e2);
}

.oauth-consent__trust {
    padding: 0 40px;
    color: var(--oauth-consent-muted);
    font-size: 15px;
    line-height: 24px;
}

.oauth-consent__trust-title {
    display: block;
    color: var(--oauth-consent-text);
    font-weight: 500;
}

.oauth-consent__trust-text {
    margin: 0;
}

.oauth-consent__trust-text strong {
    color: var(--oauth-consent-text);
    font-weight: 500;
}
