/*
 * Account screens of the Enduo authorization server (sign in, sign up, password reset,
 * OAuth consent). Implements the "Enduo Auth" design on the HeroUI token set:
 * the custom properties below are the design tokens, in their light and dark values.
 */
/*
 * Inter, served from here: a font fetched from Google tells Google who opens the sign-in page.
 * The variable font covers weights 400–700; two files, as Google splits them (Polish needs "latin-ext").
 * Licence: assets/fonts/OFL.txt.
 */
@font-face {
    font-family: "Inter";
    font-style: normal;
    font-weight: 400 700;
    font-display: swap;
    src: url("../fonts/inter-latin-ext-9fzmmZy.woff2") format("woff2");
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
    font-family: "Inter";
    font-style: normal;
    font-weight: 400 700;
    font-display: swap;
    src: url("../fonts/inter-latin-joy4ri1.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
    color-scheme: light dark;

    --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --font-mono: ui-monospace, Menlo, monospace;

    --background: rgb(245, 245, 245);
    --surface: rgb(255, 255, 255);
    --default: rgb(235, 235, 236);
    --default-hover: rgb(225, 225, 226);
    --border: rgb(212, 212, 216);

    --foreground: rgb(24, 24, 27);
    --foreground-muted: rgb(113, 113, 122);

    --accent: rgb(4, 133, 247);
    --accent-hover: rgb(53, 146, 249);
    --accent-foreground: rgb(252, 252, 252);
    --accent-soft: rgba(4, 133, 247, 0.15);
    --accent-soft-foreground: rgb(29, 99, 174);

    --danger: rgb(255, 56, 60);
    --danger-soft: rgba(255, 56, 60, 0.15);
    --danger-soft-foreground: rgb(227, 38, 22);
    --warning: rgb(245, 165, 36);
    --warning-soft: rgba(245, 165, 36, 0.15);
    --warning-soft-foreground: rgb(203, 134, 5);
    --success: rgb(23, 201, 100);
    --success-soft: rgba(23, 201, 100, 0.15);
    --success-soft-foreground: rgb(38, 135, 79);

    --shadow-surface: 0 2px 4px 0 rgba(0, 0, 0, 0.04), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --ring-focus: 0 0 0 2px var(--accent);
    --ring-error: 0 0 0 1.5px var(--danger);
}

@media (prefers-color-scheme: dark) {
    :root {
        --background: rgb(6, 6, 7);
        --surface: rgb(24, 24, 27);
        --default: rgb(39, 39, 42);
        --default-hover: rgb(46, 46, 49);
        --border: rgb(63, 63, 70);

        --foreground: rgb(252, 252, 252);
        --foreground-muted: rgb(161, 161, 170);

        --accent-soft: rgba(4, 133, 247, 0.12);
        --accent-soft-foreground: rgb(97, 168, 252);

        --danger: rgb(219, 59, 62);
        --danger-soft: rgba(219, 59, 62, 0.15);
        --danger-soft-foreground: rgb(245, 100, 91);
        --warning: rgb(247, 183, 80);
        --warning-soft: rgba(247, 183, 80, 0.12);
        --warning-soft-foreground: rgb(255, 192, 85);
        --success-soft: rgba(23, 201, 100, 0.12);
        --success-soft-foreground: rgb(93, 218, 142);
    }
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
}

body {
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.5;
    letter-spacing: -0.01em;
    color: var(--foreground);
    background: var(--background);
    -webkit-font-smoothing: antialiased;
}

p,
h1,
h2,
ul {
    margin: 0;
}

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

.field__label-row a,
.footnote a {
    font-weight: 600;
}

a:hover {
    color: var(--accent-hover);
}

svg {
    display: block;
    flex: none;
}

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* ---- Page frame: brand column on wide screens, one column on phones ------------- */

.auth {
    display: flex;
    min-height: 100dvh;
}

.auth__aside {
    display: none;
}

.auth__main {
    flex: 1;
    min-width: 0;
    display: flex;
    justify-content: center;
}

.auth__panel {
    width: 100%;
    max-width: 460px;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    padding: max(12px, env(safe-area-inset-top)) 0 max(24px, env(safe-area-inset-bottom));
}

@media (min-width: 960px) {
    .auth__aside {
        position: sticky;
        top: 0;
        width: 42%;
        height: 100dvh;
        flex: none;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        padding: 48px;
        background: var(--surface);
        box-shadow: inset -1px 0 0 var(--default);
    }

    .auth__panel {
        min-height: 0;
        margin: auto 0;
        padding: 40px 0;
    }
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.03em;
}

.aside__pitch {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 380px;
}

.aside__title {
    font-size: 36px;
    font-weight: 700;
    line-height: 42px;
    letter-spacing: -0.035em;
    text-wrap: pretty;
}

.aside__body {
    font-size: 16px;
    line-height: 24px;
    color: var(--foreground-muted);
    text-wrap: pretty;
}

.aside__note {
    font-size: 12px;
    line-height: 17px;
    color: var(--foreground-muted);
}

.aside__note a {
    color: inherit;
}

.aside__note a:hover {
    color: var(--foreground);
}

/* ---- Screen scaffolding ---------------------------------------------------------- */

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 16px 0;
}

.topbar__back {
    width: 40px;
    height: 40px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--foreground);
    background: var(--surface);
    box-shadow: var(--shadow-surface);
}

.topbar__back:hover {
    color: var(--foreground);
}

.topbar__label {
    font-size: 13px;
    font-weight: 500;
    color: var(--foreground-muted);
}

.topbar__spacer {
    width: 40px;
}

.screen {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding: 16px 24px 8px;
}

.screen--login {
    gap: 28px;
    padding-top: 28px;
}

.screen--consent {
    gap: 16px;
    padding: 12px 16px 8px;
}

/* Pushes what follows to the bottom edge of a phone screen. */
.screen__spacer {
    flex: 1;
}

.screen form {
    display: contents;
}

@media (min-width: 960px) {
    .screen {
        flex: 0 0 auto;
    }

    .screen__spacer {
        flex: 0 0 auto;
    }
}

.stack {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.stack--tight {
    gap: 12px;
}

.intro {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 20px;
}

.heading {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.heading__title {
    font-size: 30px;
    font-weight: 700;
    line-height: 36px;
    letter-spacing: -0.035em;
}

.heading__text {
    font-size: 15px;
    line-height: 21px;
    color: var(--foreground-muted);
    text-wrap: pretty;
}

.heading__text strong {
    color: var(--foreground);
    font-weight: 600;
}

/* ---- Brand mark and icon tiles ---------------------------------------------------- */

.logo-tile {
    width: 52px;
    height: 52px;
    flex: none;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-foreground);
    background: var(--accent);
}

.logo-tile--small {
    width: 32px;
    height: 32px;
    border-radius: 10px;
}

.icon-tile {
    width: 52px;
    height: 52px;
    flex: none;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 700;
    color: var(--accent-soft-foreground);
    background: var(--accent-soft);
}

.icon-tile--app {
    color: var(--warning-soft-foreground);
    background: var(--warning-soft);
}

.icon-tile--small {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    font-size: 14px;
}

.icon-tile--scope {
    width: 32px;
    height: 32px;
    border-radius: 10px;
}

/* ---- Form fields ------------------------------------------------------------------ */

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.field__label {
    padding: 0 2px;
    font-size: 13px;
    font-weight: 600;
}

.field__label-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 0 2px;
    font-size: 13px;
}

.field__label-row .field__label {
    padding: 0;
}

.input {
    height: 48px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 14px;
    border-radius: 12px;
    color: var(--foreground-muted);
    background: var(--surface);
    box-shadow: var(--shadow-surface);
}

.input--action {
    padding-right: 6px;
}

.input:focus-within {
    box-shadow: var(--ring-focus);
}

.field--error .input {
    box-shadow: var(--ring-error);
}

.input input {
    flex: 1;
    min-width: 0;
    height: 100%;
    border: 0;
    outline: 0;
    padding: 0;
    font: inherit;
    letter-spacing: -0.01em;
    color: var(--foreground);
    background: transparent;
}

.input select {
    flex: 1;
    min-width: 0;
    height: 100%;
    border: 0;
    outline: 0;
    padding: 0;
    font: inherit;
    letter-spacing: -0.01em;
    color: var(--foreground);
    background: transparent;
    cursor: pointer;
}

.input select option {
    color: var(--foreground);
    background: var(--surface);
}

.input input::placeholder {
    color: var(--foreground-muted);
}

.input__toggle {
    width: 36px;
    height: 36px;
    flex: none;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0;
    border-radius: 18px;
    color: inherit;
    background: transparent;
    cursor: pointer;
}

.input__toggle .icon-hide,
.input__toggle[aria-pressed="true"] .icon-show {
    display: none;
}

.input__toggle[aria-pressed="true"] .icon-hide {
    display: block;
}

.field-error {
    padding: 0 2px;
    font-size: 12px;
    font-weight: 500;
    color: var(--danger);
}

/* Password strength: four bars, a verdict and the rules it is made of. */
.strength {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.strength__meter {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 2px 0;
}

.strength__bars {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 4px;
}

.strength__bars span {
    height: 4px;
    border-radius: 2px;
    background: var(--default);
}

.strength__label {
    min-width: 44px;
    font-size: 12px;
    font-weight: 600;
    text-align: right;
    color: var(--foreground-muted);
}

.strength[data-level="1"] .strength__bars span:nth-child(-n + 1),
.strength[data-level="2"] .strength__bars span:nth-child(-n + 2),
.strength[data-level="3"] .strength__bars span:nth-child(-n + 3),
.strength[data-level="4"] .strength__bars span:nth-child(-n + 4) {
    background: var(--strength-color);
}

.strength[data-level="1"] {
    --strength-color: var(--danger);
}

.strength[data-level="2"] {
    --strength-color: var(--warning);
}

.strength[data-level="3"],
.strength[data-level="4"] {
    --strength-color: var(--success);
}

.strength[data-level] .strength__label {
    color: var(--strength-color, var(--foreground-muted));
}

.strength__rules {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 14px;
    padding: 2px;
    list-style: none;
    font-size: 12px;
    font-weight: 500;
    color: var(--foreground-muted);
}

.strength__rules li {
    display: flex;
    align-items: center;
    gap: 5px;
}

.strength__rules .icon-met,
.strength__rules .is-met .icon-unmet {
    display: none;
}

.strength__rules .is-met {
    color: var(--success-soft-foreground);
}

.strength__rules .is-met .icon-met {
    display: block;
}

/* ---- Checkbox --------------------------------------------------------------------- */

.check {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 2px;
    font-size: 14px;
    line-height: 20px;
    cursor: pointer;
}

.check input {
    position: absolute;
    width: 20px;
    height: 20px;
    margin: 0;
    opacity: 0;
    cursor: pointer;
}

.check__box {
    width: 20px;
    height: 20px;
    flex: none;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    color: transparent;
    background: var(--surface);
    box-shadow: inset 0 0 0 1.5px var(--border);
}

.check input:checked + .check__box {
    color: var(--accent-foreground);
    background: var(--accent);
    box-shadow: none;
}

.check input:focus-visible + .check__box {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.check__text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    text-wrap: pretty;
}

.check__text--strong {
    font-weight: 500;
}

.check__help {
    font-size: 12px;
    line-height: 17px;
    color: var(--foreground-muted);
}

/* ---- Buttons ---------------------------------------------------------------------- */

.btn {
    width: 100%;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 16px;
    border: 0;
    border-radius: 24px;
    font: inherit;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: -0.02em;
    cursor: pointer;
}

.btn--primary,
.btn--primary:hover {
    color: var(--accent-foreground);
}

.btn--primary {
    background: var(--accent);
}

.btn--primary:hover {
    background: var(--accent-hover);
}

.btn--default,
.btn--default:hover {
    color: var(--foreground);
}

.btn--default {
    background: var(--default);
}

.btn--default:hover {
    background: var(--default-hover);
}

/* An action that cannot be undone, such as deleting the account. */
.btn--danger,
.btn--danger:hover {
    color: var(--danger-soft-foreground);
}

.btn--danger {
    background: var(--danger-soft);
}

.btn--danger:hover {
    box-shadow: var(--ring-error);
}

.btn--surface {
    font-size: 15px;
    letter-spacing: -0.01em;
    color: var(--foreground);
    background: var(--surface);
    box-shadow: var(--shadow-surface);
}

.btn[disabled] {
    cursor: not-allowed;
}

/* Set by the script while a form still misses something it needs. */
.btn.is-incomplete {
    opacity: 0.5;
}

.link-button {
    padding: 0;
    border: 0;
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    color: var(--accent);
    background: transparent;
    cursor: pointer;
}

.link-button:hover {
    color: var(--accent-hover);
}

.link-button--danger,
.link-button--danger:hover {
    align-self: center;
    color: var(--danger);
}

/* What an irreversible action takes away, one line each. */
.consequences {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 0;
    padding-left: 20px;
    font-size: 14px;
    line-height: 20px;
    color: var(--foreground-muted);
}

.pair {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 10px;
}

.divider {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 4px 0;
    font-size: 12px;
    font-weight: 500;
    color: var(--foreground-muted);
}

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

.footnote {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 4px;
    padding-bottom: 4px;
    font-size: 14px;
    color: var(--foreground-muted);
}

.footnote--spread {
    justify-content: space-between;
}

/* ---- Messages --------------------------------------------------------------------- */

.alert {
    margin: 12px 24px 0;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 13px;
    line-height: 18px;
    font-weight: 500;
    color: var(--danger-soft-foreground);
    background: var(--danger-soft);
}

.alert.success {
    color: var(--success-soft-foreground);
    background: var(--success-soft);
}

.screen .alert {
    margin: 0;
}

/* ---- "Continue to <app>" chip on the sign-in screen ------------------------------- */

.app-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px 8px 8px;
    border-radius: 14px;
    font-size: 13px;
    line-height: 18px;
    color: var(--foreground-muted);
    background: var(--surface);
    box-shadow: var(--shadow-surface);
}

.app-chip strong {
    color: var(--foreground);
    font-weight: 600;
}

/* ---- OAuth consent ---------------------------------------------------------------- */

.consent__head {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 8px 8px 0;
    text-align: center;
}

.consent__parties {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--foreground-muted);
}

.consent__title {
    font-size: 22px;
    font-weight: 700;
    line-height: 28px;
    letter-spacing: -0.03em;
    text-wrap: pretty;
}

.consent__summary {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.pill {
    height: 22px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 0 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    color: var(--foreground-muted);
    background: var(--default);
}

.card {
    border-radius: 24px;
    background: var(--surface);
    box-shadow: var(--shadow-surface);
}

.account {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 20px;
}

.account__avatar {
    width: 36px;
    height: 36px;
    flex: none;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 18px;
    font-size: 14px;
    font-weight: 600;
    color: var(--accent-soft-foreground);
    background: var(--accent-soft);
}

.account__who {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.account__name {
    font-size: 14px;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.account__email {
    overflow: hidden;
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--foreground-muted);
}

.section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.section__label {
    padding: 0 4px;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--foreground-muted);
}

.scopes {
    padding: 0 16px;
    list-style: none;
}

.scopes li {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 13px 0;
}

.scopes li + li {
    border-top: 1px solid var(--default);
}

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

.scopes__title {
    font-size: 14px;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.scopes__desc {
    font-size: 12px;
    line-height: 17px;
    color: var(--foreground-muted);
    text-wrap: pretty;
}

.scopes__code {
    flex: none;
    margin-top: 6px;
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--foreground-muted);
}

.hint {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 0 4px;
    font-size: 12px;
    line-height: 17px;
    color: var(--foreground-muted);
    text-wrap: pretty;
}

.hint svg {
    margin-top: 2px;
}

.hint strong {
    font-family: var(--font-mono);
    font-weight: 400;
    color: var(--foreground);
}

/* ---- Result screens --------------------------------------------------------------- */

.result {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 18px;
    text-align: center;
}

.result__icon {
    width: 72px;
    height: 72px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 36px;
    color: var(--success-soft-foreground);
    background: var(--success-soft);
}

.result__text {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 310px;
}

.result__title {
    font-size: 26px;
    font-weight: 700;
    line-height: 32px;
    letter-spacing: -0.035em;
}

.result__body {
    font-size: 15px;
    line-height: 21px;
    color: var(--foreground-muted);
    text-wrap: pretty;
}

.result__body strong {
    color: var(--foreground);
    font-weight: 600;
}

@media (min-width: 960px) {
    .result {
        flex: 0 0 auto;
        padding: 24px 0 8px;
    }
}

.check-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* Marks a checkbox that has to be ticked. */
.required-mark {
    font-weight: 600;
    color: var(--danger);
}
