/*
 * Login (UX-AUTH-1A). Loaded only by home.html; builds on the app.css tokens and never on the product's name.
 * Desktop: an identity panel (product, statement, abstract process flow) beside the access column.
 * Below 1024px: one column, a compact identity header and the form right away.
 */

.cq-auth-body {
    --cq-auth-ink: #0f1b33;
    --cq-auth-muted: #5b6678;
    --cq-auth-line: #d3dbe6;
    --cq-auth-line-hover: #9aa8bb;
    --cq-auth-accent: #1e4f91;
    --cq-auth-ring: rgba(30, 79, 145, .22);
    --cq-auth-danger: #b42318;
    --cq-auth-danger-ink: #8a1c12;
    --cq-auth-danger-bg: #fef3f2;
    --cq-auth-danger-line: #fbd0cb;
    --cq-auth-panel: #0e1f45;
    --cq-auth-radius: 10px;
    background: #fff;
    color: var(--cq-auth-ink);
}

.cq-auth-body .cq-main {
    padding: 0;
}

.cq-auth {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto 1fr; /* the spare height stays below the form, never between brand and form */
    min-height: 100vh;
    min-height: 100dvh;
}

/* ---------- Identity ---------- */

.cq-auth-visual {
    width: 100%;
    max-width: 27rem; /* the form's width plus its gutters: brand and form share the left edge */
    margin: 0 auto;
    padding: 1.5rem 1rem 0;
}

.cq-auth-brand h1 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -.01em;
    line-height: 1.2;
    color: var(--cq-brand);
}

.cq-auth-brand p {
    margin: .125rem 0 0;
    font-size: .8125rem;
    line-height: 1.4;
    color: var(--cq-auth-muted);
}

.cq-auth-brand__by {
    margin: .5rem 0 0;
    font-size: .75rem;
    letter-spacing: .04em;
    line-height: 1.3;
    color: var(--cq-auth-muted);
}

.cq-auth-brand__by span {
    font-weight: 600;
    letter-spacing: .02em;
    color: var(--cq-neutral); /* secondary to the product's name, which keeps the strongest tone */
}

.cq-auth-visual__body,
.cq-auth-visual__scope {
    display: none;
}

/* ---------- Access column ---------- */

.cq-auth-panel {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 2rem 1rem 2.5rem;
}

.cq-auth-panel__inner {
    width: 100%;
    max-width: 25rem;
}

.cq-auth-panel__header h2 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 650;
    letter-spacing: -.015em;
    line-height: 1.25;
    color: var(--cq-auth-ink);
}

.cq-auth-panel__header p {
    margin: .5rem 0 0;
    font-size: .9375rem;
    line-height: 1.5;
    color: var(--cq-auth-muted);
}

.cq-auth-form {
    margin-top: 1.75rem;
}

.cq-auth-field + .cq-auth-field {
    margin-top: 1.125rem;
}

.cq-auth-field label {
    display: block;
    margin-bottom: .4rem;
    font-size: .875rem;
    font-weight: 600;
    line-height: 1.3;
    color: var(--cq-auth-ink);
}

.cq-auth-input {
    display: block;
    width: 100%;
    height: 3rem;
    padding: 0 .875rem;
    border: 1px solid var(--cq-auth-line);
    border-radius: var(--cq-auth-radius);
    background: #fff;
    color: var(--cq-auth-ink);
    font: inherit;
    font-size: 1rem; /* 16px: no zoom on focus in mobile Safari */
    line-height: 1.5;
    transition: border-color .12s ease, box-shadow .12s ease;
}

.cq-auth-input:hover {
    border-color: var(--cq-auth-line-hover);
}

.cq-auth-input:focus,
.cq-auth-input:focus-visible {
    outline: none;
    border-color: var(--cq-auth-accent);
    box-shadow: 0 0 0 4px var(--cq-auth-ring);
}

.cq-auth-input[aria-invalid="true"] {
    border-color: var(--cq-auth-danger);
}

.cq-auth-input[aria-invalid="true"]:focus {
    box-shadow: 0 0 0 4px rgba(180, 35, 24, .16);
}

.cq-auth-password {
    position: relative;
}

.cq-auth-password .cq-auth-input {
    padding-right: 3.25rem;
}

.cq-auth-reveal {
    position: absolute;
    top: .25rem;
    right: .25rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--cq-auth-muted);
    cursor: pointer;
}

.cq-auth-reveal[hidden] {
    display: none;
}

.cq-auth-reveal:hover {
    background: #f1f4f8;
    color: var(--cq-auth-ink);
}

.cq-auth-reveal svg {
    width: 1.25rem;
    height: 1.25rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.6;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.cq-auth-reveal .cq-auth-reveal__hide,
.cq-auth-reveal[aria-pressed="true"] .cq-auth-reveal__show {
    display: none;
}

.cq-auth-reveal[aria-pressed="true"] .cq-auth-reveal__hide {
    display: block;
}

.cq-auth-hint {
    margin: .4rem 0 0;
    font-size: .8125rem;
    color: var(--cq-warning);
}

.cq-auth-submit {
    display: block;
    width: 100%;
    height: 3rem;
    margin-top: 1.75rem;
    border: 0;
    border-radius: var(--cq-auth-radius);
    background: var(--cq-brand);
    color: #fff;
    font: inherit;
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: .005em;
    cursor: pointer;
    transition: background-color .12s ease;
}

.cq-auth-submit:hover {
    background: #0c1c40;
}

.cq-auth-submit:active {
    background: #08142f;
}

.cq-auth-submit:disabled,
.cq-auth-submit[aria-busy="true"] {
    background: #56657f;
    cursor: progress;
}

.cq-auth-reveal:focus-visible,
.cq-auth-submit:focus-visible {
    outline: 3px solid var(--cq-focus);
    outline-offset: 2px;
}

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

.cq-auth-error {
    display: flex;
    gap: .625rem;
    align-items: flex-start;
    margin-bottom: 1.25rem;
    padding: .75rem .875rem;
    border: 1px solid var(--cq-auth-danger-line);
    border-radius: var(--cq-auth-radius);
    background: var(--cq-auth-danger-bg);
    color: var(--cq-auth-danger-ink);
}

.cq-auth-error svg {
    flex: none;
    width: 1.125rem;
    height: 1.125rem;
    margin-top: .125rem;
    fill: var(--cq-auth-danger);
}

.cq-auth-error p {
    margin: 0;
    font-size: .9375rem;
    font-weight: 500;
    line-height: 1.45;
}

/* Messages of other pages come from the global include (base.html), above the layout: kept to the form's width. */
.cq-auth-body .cq-messages {
    max-width: 27rem;
    margin: 0 auto;
    padding: 1rem 1rem 0;
}

/* ---------- Footer ---------- */

.cq-auth-panel__footer {
    margin-top: 2rem;
    padding-top: 1.25rem;
    border-top: 1px solid #e8edf3;
}

.cq-auth-panel__footer p {
    margin: 0;
    font-size: .8125rem;
    line-height: 1.5;
    color: var(--cq-auth-muted);
}

.cq-auth-panel__footer p + p {
    margin-top: .375rem;
}

.cq-auth-secure {
    display: flex;
    gap: .4rem;
    align-items: center;
}

.cq-auth-secure svg {
    flex: none;
    width: .95rem;
    height: .95rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.6;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* ---------- Tablet: brand and form as one block, centred in the viewport ---------- */

@media (min-width: 640px) {
    .cq-auth {
        grid-template-rows: auto auto;
        align-content: center;
        padding: 3rem 0;
    }

    .cq-auth-visual {
        padding-top: 0;
    }

    .cq-auth-panel {
        padding: 2.5rem 1rem 0;
    }
}

/* ---------- Desktop: identity panel + access column ---------- */

@media (min-width: 1024px) {
    .cq-auth {
        grid-template-columns: minmax(0, 1.2fr) minmax(26rem, 1fr);
        grid-template-rows: none;
        align-content: stretch;
        padding: 0;
    }

    .cq-auth-visual {
        max-width: none;
        margin: 0;
        position: relative;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        gap: 3rem;
        padding: 3rem clamp(2.5rem, 5vw, 5rem);
        overflow: hidden;
        background-color: var(--cq-auth-panel);
        /* A fine measurement grid, fading toward the bottom right. */
        background-image:
            linear-gradient(rgba(255, 255, 255, .045) 1px, transparent 1px),
            linear-gradient(90deg, rgba(255, 255, 255, .045) 1px, transparent 1px);
        background-size: 40px 40px;
        color: #fff;
    }

    .cq-auth-visual::after {
        content: "";
        position: absolute;
        inset: 0;
        background: linear-gradient(135deg, rgba(14, 31, 69, 0) 35%, var(--cq-auth-panel) 92%);
        pointer-events: none;
    }

    .cq-auth-visual > * {
        position: relative;
        z-index: 1;
    }

    .cq-auth-brand h1 {
        font-size: 1.375rem;
        color: #fff;
    }

    .cq-auth-brand p {
        margin-top: .25rem;
        font-size: .875rem;
        color: rgba(255, 255, 255, .66);
    }

    .cq-auth-brand .cq-auth-brand__by {
        margin-top: .875rem;
        font-size: .75rem;
        color: rgba(255, 255, 255, .5);
    }

    .cq-auth-brand__by span {
        color: rgba(255, 255, 255, .86);
    }

    .cq-auth-visual__body {
        display: block;
        max-width: 34rem;
    }

    .cq-auth-visual__statement {
        margin: 0;
        font-size: clamp(2rem, 2.9vw, 2.75rem);
        font-weight: 600;
        line-height: 1.15;
        letter-spacing: -.02em;
        color: #fff;
    }

    .cq-auth-flow {
        margin: 3rem 0 0;
        max-width: 32rem;
    }

    .cq-auth-flow svg {
        display: block;
        width: 100%;
        height: auto;
        overflow: visible;
        fill: none;
        stroke-linecap: round;
        stroke-linejoin: round;
    }

    .cq-auth-flow__links line,
    .cq-auth-flow__chevrons path {
        stroke: rgba(255, 255, 255, .34);
        stroke-width: 1.25;
    }

    .cq-auth-flow__loop {
        stroke: rgba(143, 180, 232, .55);
        stroke-width: 1.25;
        stroke-dasharray: 3 6;
    }

    .cq-auth-flow__loop-head {
        stroke: rgba(143, 180, 232, .75);
        stroke-width: 1.25;
    }

    .cq-auth-flow__trace line {
        stroke: rgba(255, 255, 255, .28);
        stroke-width: 1;
        stroke-dasharray: 2 4;
    }

    .cq-auth-flow__records rect {
        stroke: rgba(255, 255, 255, .22);
        stroke-width: 1;
        fill: rgba(255, 255, 255, .03);
    }

    .cq-auth-flow__records line {
        stroke: rgba(255, 255, 255, .3);
        stroke-width: 2;
    }

    .cq-auth-flow__nodes rect {
        stroke: rgba(255, 255, 255, .7);
        stroke-width: 1.25;
        fill: var(--cq-auth-panel);
    }

    .cq-auth-flow__mark {
        fill: #8fb4e8;
    }

    .cq-auth-flow__ring {
        stroke: rgba(255, 255, 255, .2);
        stroke-width: 1.25;
        fill: var(--cq-auth-panel);
    }

    .cq-auth-flow__arc {
        stroke: #8fb4e8;
        stroke-width: 1.75;
    }

    .cq-auth-visual__scope {
        display: flex;
        flex-wrap: wrap;
        gap: .5rem 1.75rem;
        margin: 0;
        padding: 0;
        list-style: none;
        font-size: .8125rem;
        color: rgba(255, 255, 255, .7);
    }

    .cq-auth-visual__scope li {
        display: flex;
        gap: .5rem;
        align-items: center;
    }

    .cq-auth-visual__scope li::before {
        content: "";
        width: 6px;
        height: 6px;
        border-radius: 1px;
        background: #8fb4e8;
    }

    .cq-auth-panel {
        align-items: center;
        padding: 3rem clamp(2rem, 4vw, 4.5rem);
    }

    .cq-auth-panel__header h2 {
        font-size: 1.75rem;
    }

    /* Over the access column, so the split layout keeps the full height. */
    .cq-auth-body .cq-messages {
        position: absolute;
        top: 0;
        right: 0;
        z-index: 2;
        width: min(45%, 30rem);
        max-width: none;
        padding: 1.5rem 1.5rem 0;
    }
}

/* Short desktop windows: the flow gives way first, the form never scrolls out of reach. */
@media (min-width: 1024px) and (max-height: 720px) {
    .cq-auth-flow {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .cq-auth-input,
    .cq-auth-submit {
        transition: none;
    }
}

/* C4: neutral notices (session expired, password defined) and the single-panel pages (forgotten password, link). */
.cq-auth-notice {
    margin: 0 0 1.25rem;
    padding: .75rem .875rem;
    border: 1px solid #b9c7e4;
    border-radius: var(--cq-auth-radius);
    background: #eef3fb;
    color: #1d2f55;
    font-size: .9375rem;
    line-height: 1.45;
}

.cq-auth-single {
    display: flex;
    justify-content: center;
    min-height: 100vh;
    padding: 2.5rem 1rem;
}

.cq-auth-single .cq-auth-panel__inner {
    width: 100%;
    max-width: 27rem;
}
