/* The sign-in pages (auth_base.html): log in, forgot and reset password, the message screens, the AI app consent and the
   external sign-in screens. A moving colour background with faint contour lines behind one white card. Fields, buttons,
   notices and the busy strip are the shared .wfc-* classes; only the layout lives here.
   docs/webform_design.md, "Console sign-in" and "External sign-in" */

.aut-page {
    position: fixed;
    inset: 0;
    overflow-y: auto;
    font-family: Manrope, sans-serif;
    color: var(--wf-text);
}

/* ---------- The background: it must stay subtle and never pull attention from the card ---------- */
.aut-bg {
    position: fixed;
    inset: 0;
    overflow: hidden;
    background-color: #0f2138;
    background-image:
        radial-gradient(1200px 800px at 10% -20%, #ef4523 0%, rgba(239, 69, 35, 0) 60%),
        radial-gradient(900px 700px at 110% 120%, #123a5e 0%, rgba(0, 0, 0, 0) 60%);
    background-repeat: no-repeat;
}

.aut-bg::before {
    content: "";
    position: absolute;
    inset: -15%;
    background-image:
        radial-gradient(circle, rgba(0, 145, 255, 0.35) 0%, rgba(0, 0, 0, 0) 60%),
        radial-gradient(circle, rgba(0, 230, 255, 0.28) 0%, rgba(0, 0, 0, 0) 60%),
        radial-gradient(circle, rgba(0, 185, 255, 0.28) 0%, rgba(0, 0, 0, 0) 60%),
        radial-gradient(circle, rgba(40, 255, 220, 0.22) 0%, rgba(0, 0, 0, 0) 60%);
    background-size: 55% 55%, 60% 60%, 50% 50%, 70% 70%;
    background-position: 8% 18%, 82% 22%, 28% 82%, 72% 78%;
    background-repeat: no-repeat;
    filter: blur(40px);
    mix-blend-mode: screen;
    transform-origin: 50% 50%;
    animation: aut-mesh 3s ease-in-out infinite alternate, aut-drift 5s ease-in-out infinite alternate;
    pointer-events: none;
}

@keyframes aut-mesh {
    0% { background-position: 8% 18%, 82% 22%, 28% 82%, 72% 78%; }
    50% { background-position: 18% 28%, 72% 18%, 20% 70%, 82% 68%; }
    100% { background-position: 12% 32%, 68% 26%, 22% 88%, 84% 74%; }
}

@keyframes aut-drift {
    0% { transform: translate3d(0, 0, 0) scale(1); }
    50% { transform: translate3d(-2.5%, -1.5%, 0) scale(1.025); }
    100% { transform: translate3d(2%, 2.5%, 0) scale(1.04); }
}

@media (prefers-reduced-motion: reduce) {
    .aut-bg::before { animation: none; }
}

.aut-contours {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

/* ---------- The card ---------- */
.aut-main {
    position: relative;
    box-sizing: border-box;
    min-height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 40px 16px;
}

/* The React root of the external screens: their card and page foot are the items of .aut-main */
.aut-main #content { display: contents; }

.aut-card {
    box-sizing: border-box;
    width: 400px;
    max-width: 100%;
    margin: auto 0;
    display: flex;
    flex-direction: column;
    gap: 18px;
    padding: 28px;
    background: var(--wf-card-bg);
    border-radius: 10px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
}
.aut-card-wide { width: 440px; }
.aut-card [hidden] { display: none !important; }
/* Step 2 of self-signup: the app's details form (NiceGUI) framed in the card */
.aut-card-form { width: 760px; padding: 0; gap: 0; overflow: hidden; }
.aut-form-head { display: flex; flex-direction: column; gap: 10px; padding: 24px 28px 8px; }
.aut-card-form iframe { display: block; width: 100%; height: min(520px, calc(100vh - 290px)); min-height: 320px; border: 0; }

.aut-logo {
    align-self: flex-start;
    height: 32px;
    width: auto;
    margin: -2px 0 2px -2px;
}

.aut-title {
    margin: 0;
    font-size: 24px;
    font-weight: 800;
    line-height: 32px;
    color: var(--wf-heading);
}

.aut-text {
    margin: 0;
    font-size: 14px;
    line-height: 21px;
}

.aut-help {
    margin: 0;
    font-size: 13px;
    line-height: 19px;
    color: var(--wf-label);
}

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

.aut-error {
    font-size: 12px;
    font-weight: 600;
    color: var(--wf-error);
}

.aut-password { position: relative; }
.aut-password .wfc-input { padding-right: 40px; }
.aut-eye.wfc-icon-action {
    position: absolute;
    top: 4px;
    right: 4px;
    color: var(--wf-icon-muted);
}

.aut-link {
    font-size: 13px;
    font-weight: 600;
    color: var(--wf-primary-text);
    text-decoration: none;
}
.aut-link:hover { text-decoration: underline; }

.aut-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}
.aut-actions-split { justify-content: space-between; }
.aut-card .wfc-btn { height: 40px; min-height: 40px; min-width: 84px; padding: 0 16px; font-size: 14px; }
.aut-card .wfc-btn-sm { height: 32px; min-height: 32px; min-width: 0; padding: 0 10px; font-size: 12.5px; }
.aut-card a.wfc-btn { text-decoration: none; }

/* ---------- Message screens ---------- */
.aut-message {
    display: flex;
    align-items: center;
    gap: 12px;
}

.aut-message-icon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
}
.aut-message-icon svg { width: 22px; height: 22px; fill: currentColor; }
.aut-message-info { background: var(--wf-primary); }
.aut-message-success { background: var(--wf-save); }
.aut-message-warning { background: var(--wf-edit); }
.aut-message-error { background: var(--wf-danger); }

/* ---------- AI app consent ---------- */
.aut-person {
    display: flex;
    align-items: center;
    gap: 10px;
}

.aut-avatar {
    flex-shrink: 0;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--wf-kind-scoped-bg);
    color: var(--wf-kind-scoped-fg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 800;
}

.aut-person-name {
    min-width: 0;
    font-size: 14px;
    font-weight: 700;
}

.aut-id-tag {
    margin-left: 6px;
    padding: 1px 6px;
    border: 1px solid var(--wf-field-border);
    border-radius: 3px;
    font: 11px ui-monospace, Consolas, monospace;
    color: var(--wf-tag-text);
}

.aut-access {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 14px;
    background: var(--wf-readonly-bg);
    border: 1px solid var(--wf-card-border);
    border-radius: 6px;
}

.aut-access-row {
    display: flex;
    gap: 10px;
    font-size: 14px;
    line-height: 21px;
}
.aut-access-row svg { flex-shrink: 0; width: 18px; height: 18px; margin-top: 1px; }
.aut-access-yes svg { fill: var(--wf-save-border); }
.aut-access-no svg { fill: var(--wf-danger); }

.aut-return {
    font-size: 12.5px;
    color: var(--wf-label);
}
.aut-return b { font-weight: 700; color: var(--wf-text); }

/* ---------- Phone: the card sits near the top, buttons share the width ---------- */
@media (max-width: 600px) {
    .aut-main { padding: 72px 16px 16px; }
    .aut-card, .aut-card-wide { width: 100%; margin: 0 0 auto; padding: 22px 20px; gap: 16px; }
    .aut-card-form { width: 100%; padding: 0; gap: 0; }
    .aut-form-head { padding: 22px 20px 8px; }
    .aut-title { font-size: 20px; line-height: 28px; }
    .aut-actions, .aut-actions-split { flex-direction: column; align-items: stretch; gap: 14px; }
    .aut-actions-pair { flex-direction: row; gap: 8px; }
    .aut-actions-pair .wfc-btn { flex: 1 1 0; }
}
