/* Quantify identity portal. Mirrors the marketing auth mockups (marketing/auth) on top of Qui's auth.css. */

.auth-shell {
    --auth-bg: lch(8.986% 2.213 272.695);
    --auth-surface: lch(12.236% 2.213 272.695);
    --auth-surface-border: lch(19.436% 3.413 272.695);
    --auth-raised: lch(15.736% 2.713 272.695);
    --auth-raised-border: lch(22.936% 3.913 272.695);
    --auth-control: lch(22.593% 2.927 272.695);
    --auth-control-border: lch(32.536% 3.913 272.695);
    --auth-text: lch(100% 0 272.695);
    --auth-text-body: lch(91.224% 2.106 272.695);
    --auth-muted: lch(64.894% 2.106 272.695);
    --auth-faint: lch(47.356% 2.356 272.695);
    --auth-accent: lch(53% 52.26 286.91);
    --auth-accent-strong: lch(47.918% 59.303 288.421);
    --auth-danger: lch(68% 55 30);
    --auth-success: lch(70% 55 150);
    --auth-warning: lch(68% 70 55);
    --auth-button-bg: var(--auth-control);
    --auth-button-hover-bg: lch(26% 3 272);
    --auth-button-primary-bg: var(--auth-accent);
    --auth-button-primary-hover-bg: var(--auth-accent-strong);
    --auth-border: var(--auth-control-border);
    --auth-input-bg: var(--auth-raised);
    padding: 48px 20px 72px;
    background:
        radial-gradient(60% 55% at 12% 18%, lch(42% 45 25 / 0.22), transparent 62%),
        radial-gradient(55% 55% at 92% 40%, lch(40% 45 290 / 0.2), transparent 62%),
        radial-gradient(50% 45% at 45% 100%, lch(42% 38 320 / 0.16), transparent 62%),
        var(--auth-bg);
    color: var(--auth-text);
    letter-spacing: -0.005em;
}

html:has(.auth-shell),
body:has(.auth-shell) {
    background: lch(8.986% 2.213 272.695);
}

/* Panel: card plus footer links beneath it */
.auth-panel {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    width: 380px;
    max-width: calc(100vw - 40px);
    margin-top: 0;
    text-align: left;
}

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

.auth-card {
    overflow: hidden;
    border: 1px solid var(--auth-surface-border);
    border-radius: 16px;
    background: lch(12.236% 2.213 272.695 / 0.92);
    box-shadow:
        inset 0 1px 0 lch(100% 0 0 / 0.04),
        0 30px 80px lch(0 0 0 / 0.5),
        0 2px 6px lch(0 0 0 / 0.3);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
}

.auth-card__head {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 22px;
    border-bottom: 1px solid var(--auth-surface-border);
    background: lch(15% 2.7 272.695 / 0.6);
}

.auth-logo {
    flex: none;
    width: 32px;
    height: 32px;
    margin: 0;
}

.auth-logo__mark {
    display: block;
    width: 32px;
    height: 32px;
}

.auth-panel__copy {
    align-items: flex-start;
    gap: 2px;
    min-width: 0;
    text-align: left;
}

.auth-panel h1 {
    font-size: 17px;
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1.25;
}

.auth-panel__description {
    max-width: none;
    margin: 0;
    color: var(--auth-muted);
    font-size: 12.5px;
    line-height: 1.4;
}

.auth-card__body {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 22px 22px 24px;
}

.auth-actions,
.auth-form {
    gap: 14px;
    margin-top: 0;
}

.auth-actions {
    gap: 8px;
}

/* Fields */
.auth-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    color: var(--auth-muted);
    font-size: 12.5px;
}

.auth-input {
    height: 40px;
    padding: 0 12px;
    border: 1px solid lch(27.736% 3.913 272.695);
    border-radius: 9px;
    background: var(--auth-input-bg);
    color: var(--auth-text);
    font-size: 14px;
}

.auth-input::placeholder {
    color: var(--auth-faint);
}

.auth-input:focus {
    border-color: lch(40% 20 287);
    box-shadow: 0 0 0 3px lch(53% 52.26 286.91 / 0.18);
}

/* Verification code: one real input for typing, paste, autofill and tests; six cells mirror its value. */
.auth-code {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.auth-code__cells {
    display: none;
}

.auth-code--enhanced {
    position: relative;
}

.auth-code--enhanced .auth-code__cells {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
}

.auth-code__cell {
    display: grid;
    box-sizing: border-box;
    height: 52px;
    border: 1px solid lch(27.736% 3.913 272.695);
    border-radius: 10px;
    background: var(--auth-input-bg);
    color: var(--auth-text);
    font-size: 22px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    place-items: center;
    transition: border-color 120ms ease, box-shadow 120ms ease;
}

.auth-code__cell--active {
    border-color: lch(40% 20 287);
    box-shadow: 0 0 0 3px lch(53% 52.26 286.91 / 0.18);
}

.auth-input--code {
    height: 52px;
    font-size: 22px;
    font-weight: 600;
    letter-spacing: 0.3em;
    text-align: center;
}

.auth-code--enhanced .auth-input--code {
    position: absolute;
    inset: auto 0 0 0;
    height: 52px;
    border-color: transparent;
    background: transparent;
    color: transparent;
    caret-color: transparent;
    box-shadow: none;
    outline: none;
}

.auth-code--enhanced .auth-input--code::selection {
    background: transparent;
}

/* Buttons */
.auth-button {
    height: 42px;
    border: 1px solid var(--auth-control-border);
    border-radius: 9px;
    background: var(--auth-button-bg);
    color: var(--auth-text-body);
    font-size: 14px;
    font-weight: 500;
    box-shadow:
        lch(0 0 0 / 0.04) 0 4px 4px -1px,
        lch(0 0 0 / 0.08) 0 1px 1px 0;
}

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

.auth-button--primary {
    border-color: transparent;
    background: var(--auth-button-primary-bg);
    color: lch(100% 5 286.91);
}

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

/* Busy submit: the label is swapped for Qui's dot-matrix Pong loader while the post is in flight.
   Qui's auth.css dims disabled buttons; the busy button keeps full contrast so the loader reads. */
.auth-button__label[hidden],
.auth-button__busy[hidden] {
    display: none;
}

.auth-button__busy {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.auth-button[aria-busy="true"] {
    opacity: 1;
    cursor: default;
    pointer-events: none;
}

.auth-visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    border: 0;
    clip-path: inset(50%);
    white-space: nowrap;
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--auth-faint);
    font-size: 12px;
}

.auth-divider::before,
.auth-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--auth-surface-border);
}

/* Messages */
.auth-form__help {
    margin: 0;
    color: var(--auth-muted);
    font-size: 13.5px;
    line-height: 1.5;
    text-align: left;
}

.auth-form__fine {
    margin: 0;
    color: var(--auth-faint);
    font-size: 12px;
    line-height: 1.5;
}

.auth-form__fine--centered {
    text-align: center;
}

.auth-form__error {
    margin: -2px 0 0;
    color: var(--auth-danger);
    font-size: 12.5px;
}

.auth-notice {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.auth-notice__icon {
    flex: none;
    width: 20px;
    height: 20px;
    margin-top: 1px;
    color: var(--auth-muted);
    fill: currentColor;
}

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

.auth-notice--warning .auth-notice__icon {
    color: var(--auth-warning);
}

.auth-notice--passkey .auth-notice__icon {
    color: var(--auth-accent);
    filter: brightness(1.35);
}

.auth-notice__text {
    flex: 1;
    min-width: 0;
    color: var(--auth-text-body);
}

.auth-notice__spinner {
    box-sizing: border-box;
    width: 18px;
    height: 18px;
    margin-top: 2px;
    border: 2px solid lch(100% 0 0 / 0.15);
    border-top-color: var(--auth-text-body);
    border-radius: 50%;
    animation: auth-spin 900ms linear infinite;
}

.auth-form__code {
    display: block;
    padding: 8px 10px;
    overflow-wrap: anywhere;
    border: 1px solid var(--auth-raised-border);
    border-radius: 8px;
    background: var(--auth-raised);
    color: var(--auth-muted);
    font-family: var(--font-mono, "Berkeley Mono", "SFMono-Regular", Menlo, monospace);
    font-size: 11.5px;
    line-height: 1.5;
}

/* Footer links beneath the card */
.auth-card__footer {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin-top: 18px;
    color: var(--auth-muted);
    font-size: 13px;
    text-align: center;
}

.auth-link-row,
.auth-link-row--compact {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 6px 14px;
    margin: 0;
}

.auth-link-row form {
    display: contents;
}

.auth-link {
    color: var(--auth-muted);
    cursor: pointer;
}

.auth-link:hover,
.auth-link:focus-visible {
    color: var(--auth-text);
}

.auth-link--strong {
    color: var(--auth-text);
    font-weight: 500;
}

/* Consent */
.auth-card__band {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 18px 22px;
    border-bottom: 1px solid var(--auth-surface-border);
    background: lch(13.5% 2.5 272.695 / .7);
}

.auth-app {
    display: flex;
    flex: 1;
    align-items: center;
    gap: 16px;
    min-width: 0;
}

.auth-app__logo,
.auth-app__mark {
    flex: none;
    width: 56px;
    height: 56px;
    border-radius: 14px;
    box-shadow: 0 6px 18px lch(0 0 0 / .4);
}

.auth-app__logo {
    object-fit: cover;
}

.auth-app__mark {
    display: grid;
    background: linear-gradient(135deg, lch(55% 60 310), lch(45% 55 290));
    color: #fff;
    font-size: 22px;
    font-weight: 600;
    place-items: center;
}

.auth-app__text {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.auth-app__name {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.auth-app__name > strong {
    color: var(--auth-text);
    font-size: 17px;
    font-weight: 600;
    letter-spacing: -.01em;
}

.auth-app__badge {
    flex: none;
    padding: 2px 8px;
    border: 1px solid var(--auth-raised-border);
    border-radius: 999px;
    color: var(--auth-muted);
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
}

.auth-app__actor {
    color: var(--auth-muted);
    font-size: 12.5px;
}

.auth-app__actor > strong {
    color: var(--auth-text);
    font-weight: 500;
}

.auth-scope-groups {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.auth-scope-group {
    margin: 0;
    padding: 10px 12px;
    border: 1px solid var(--auth-raised-border);
    border-radius: 10px;
    background: var(--auth-raised);
}

.auth-scope-group--muted {
    opacity: .6;
}

.auth-scope-group__head {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 0;
    color: var(--auth-text);
    font-size: 13.5px;
}

.auth-scope-group__head > strong {
    font-weight: 600;
}

.auth-scope-group__icon {
    flex: none;
    width: 15px;
    height: 15px;
    color: var(--auth-text-body);
}

.auth-scope-group__list {
    display: flex;
    flex-direction: column;
    gap: 3px;
    margin: 8px 0 0;
    padding: 0 0 0 24px;
    list-style: none;
    color: var(--auth-muted);
    font-size: 12.5px;
    line-height: 1.45;
}

.auth-scope-group__list > li {
    position: relative;
}

.auth-scope-group__list > li::before {
    content: "";
    position: absolute;
    top: 7px;
    left: -13px;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--auth-faint);
}

.auth-scope-group__list > li > strong {
    color: var(--auth-text-body);
    font-weight: 500;
}

.auth-team-access {
    display: block;
    min-width: 0;
}

.auth-team-access > legend {
    float: left;
    width: 100%;
    margin: 0 0 8px;
    padding: 0;
}

.auth-team-access__modes {
    clear: both;
}

.auth-team-access__modes,
.auth-team-access__teams {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.auth-team-access__teams {
    margin-top: 2px;
    padding-top: 8px;
    border-top: 1px solid var(--auth-surface-border);
}

.auth-team-access__teams[hidden],
.auth-choice[hidden] {
    display: none;
}

.auth-choice {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 5px 6px;
    border-radius: 7px;
    color: var(--auth-text-body);
    font-size: 13px;
    cursor: pointer;
}

.auth-choice:hover {
    background: lch(100% 0 0 / .04);
}

.auth-choice__input {
    flex: none;
    width: 14px;
    height: 14px;
    margin: 0;
    accent-color: var(--auth-accent);
}

.auth-choice__key {
    margin-left: auto;
    color: var(--auth-faint);
    font-size: 11.5px;
    font-variant-numeric: tabular-nums;
}

.auth-choice__private {
    padding: 1px 6px;
    border: 1px solid var(--auth-raised-border);
    border-radius: 999px;
    color: var(--auth-faint);
    font-size: 10.5px;
}


/* Build version */
.identity-build-version {
    position: fixed;
    inset-inline: 0;
    inset-block-end: 16px;
    z-index: 1;
    max-width: none;
    overflow: hidden;
    color: lch(47.356% 2.356 272.695);
    font-size: 11px;
    line-height: 1;
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
}

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

    .auth-panel,
    .auth-panel--wide {
        width: min(440px, 100%);
        margin-top: 0;
    }
}
