/* The public sign-in pages (register today; login and password reset can adopt it) - see CLAUDE.md
   "Admin frontend". Deliberately its own file rather than more of admin.css: these pages are the first
   thing a new customer sees, so they follow the public website's look (indigo + emerald, Poppins /
   Open Sans - same tokens as site/landing.css), not the admin panel's neutral one. */
:root {
    --auth-ink: #1e1b4b;
    --auth-text: #1f2937;
    --auth-muted: #475569;
    --auth-primary: #4338ca;
    --auth-primary-hover: #3730a3;
    --auth-accent: #047857;
    --auth-accent-hover: #065f46;
    --auth-soft: #f5f3ff;
    --auth-border: #94a3b8;
    --auth-danger: #b91c1c;
    --auth-danger-soft: #fef2f2;
    --auth-heading: 'Poppins', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --auth-body: 'Open Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

body.auth-page {
    display: block;
    margin: 0;
    background: #fff;
    color: var(--auth-text);
    font-family: var(--auth-body);
    font-size: 16px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

.auth-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
}

/* ------------------------------------------------------------------ brand panel */
.auth-panel {
    position: relative;
    overflow: hidden;
    color: #fff;
    background: linear-gradient(155deg, #312e81 0%, #4338ca 55%, #6366f1 100%);
    padding: 18px 16px 20px;
}

/* Soft light blobs: decoration only, nothing reads from them. */
.auth-panel::before,
.auth-panel::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
}

.auth-panel::before {
    width: 420px;
    height: 420px;
    right: -160px;
    top: -170px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0) 70%);
}

.auth-panel::after {
    width: 360px;
    height: 360px;
    left: -140px;
    bottom: -150px;
    background: radial-gradient(circle, rgba(16, 185, 129, 0.28), rgba(16, 185, 129, 0) 70%);
}

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

.auth-brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: #fff;
    text-decoration: none;
    font-family: var(--auth-heading);
    font-weight: 700;
    font-size: 1.25rem;
}

.auth-brand-mark {
    width: 38px;
    height: 38px;
    border-radius: 11px;
    display: grid;
    place-items: center;
    background: rgba(255, 255, 255, 0.16);
    border: 1px solid rgba(255, 255, 255, 0.28);
}

.auth-brand-mark svg {
    width: 22px;
    height: 22px;
}

.auth-panel-body {
    display: none;
}

.auth-title {
    font-family: var(--auth-heading);
    font-weight: 700;
    font-size: clamp(1.7rem, 2.6vw, 2.35rem);
    line-height: 1.18;
    margin: 0 0 14px;
    color: #fff;
}

.auth-lead {
    margin: 0 0 24px;
    font-size: 1.05rem;
    color: rgba(255, 255, 255, 0.86);
    max-width: 30em;
}

.auth-benefits {
    list-style: none;
    margin: 0 0 28px;
    padding: 0;
    display: grid;
    gap: 12px;
}

.auth-benefits li {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    color: rgba(255, 255, 255, 0.94);
}

.auth-benefits svg {
    flex: 0 0 auto;
    width: 22px;
    height: 22px;
    margin-top: 1px;
    color: #6ee7b7;
}

.auth-trust {
    list-style: none;
    margin: 12px 0 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 6px 14px;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.92);
}

.auth-trust li {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.auth-trust svg {
    width: 16px;
    height: 16px;
    color: #6ee7b7;
}

/* A small, honest picture of the product: what the client's chat looks like. */
.auth-mock {
    max-width: 340px;
    border-radius: 18px;
    background: #fff;
    color: var(--auth-text);
    box-shadow: 0 24px 50px rgba(15, 12, 60, 0.35);
    overflow: hidden;
}

.auth-mock-top {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 14px;
    background: var(--auth-primary);
    color: #fff;
    font-family: var(--auth-heading);
    font-weight: 600;
    font-size: 0.9rem;
}

.auth-mock-top i {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.22);
}

.auth-mock-log {
    padding: 12px;
    background: #eef1f7;
    display: grid;
    gap: 8px;
}

.auth-bubble {
    max-width: 88%;
    padding: 8px 11px;
    border-radius: 12px;
    background: #fff;
    font-size: 0.84rem;
    line-height: 1.4;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

.auth-bubble.me {
    justify-self: end;
    background: #dcfce7;
}

.auth-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.auth-chips span {
    padding: 5px 10px;
    border-radius: 999px;
    border: 1px solid #c7d2fe;
    background: #fff;
    color: var(--auth-primary);
    font-size: 0.78rem;
    font-weight: 600;
}

.auth-chips span.picked {
    background: var(--auth-primary);
    border-color: var(--auth-primary);
    color: #fff;
}

/* ------------------------------------------------------------------ form side */
.auth-main {
    display: flex;
    flex-direction: column;
    padding: 24px 16px calc(32px + env(safe-area-inset-bottom));
    background: #fff;
}

.auth-topbar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 6px;
    width: 100%;
    max-width: 440px; /* same column as the form, so "log in" sits above its right edge */
    margin: 0 auto 18px;
    font-size: 0.92rem;
    color: var(--auth-muted);
}

.auth-topbar a,
.auth-form-wrap a,
.auth-card a:not(.auth-submit),
.auth-foot a {
    color: var(--auth-primary);
    font-weight: 600;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
}

.auth-topbar a:hover,
.auth-form-wrap a:hover,
.auth-card a:not(.auth-submit):hover,
.auth-foot a:hover {
    color: var(--auth-primary-hover);
}

.auth-form-wrap {
    width: 100%;
    max-width: 440px;
    margin: 0 auto;
    animation: auth-rise 0.35s ease-out both;
}

.auth-heading {
    font-family: var(--auth-heading);
    font-weight: 700;
    font-size: 1.75rem;
    line-height: 1.2;
    color: var(--auth-ink);
    margin: 0 0 6px;
    outline: none;
}

.auth-sub {
    margin: 0 0 18px;
    color: var(--auth-muted);
    font-size: 0.95rem;
}

.auth-case {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 16px;
    padding: 6px 12px;
    border-radius: 999px;
    background: var(--auth-soft);
    border: 1px solid #ddd6fe;
    color: var(--auth-primary);
    font-weight: 600;
    font-size: 0.85rem;
}

.auth-case svg {
    width: 16px;
    height: 16px;
}

.auth-section {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 22px 0 10px;
    font-family: var(--auth-heading);
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--auth-ink);
}

.auth-section:first-of-type {
    margin-top: 6px;
}

.auth-section b {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--auth-primary);
    color: #fff;
    font-size: 0.8rem;
}

.auth-rule {
    flex: 1;
    height: 1px;
    background: #e2e8f0;
}

.auth-field {
    margin-bottom: 14px;
}

.auth-field label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--auth-ink);
}

.auth-input,
.auth-select {
    width: 100%;
    min-height: 48px;
    padding: 11px 14px;
    border: 1.5px solid var(--auth-border);
    border-radius: 10px;
    background: #fff;
    color: var(--auth-text);
    font: inherit;
    font-size: 16px; /* under 16px iOS zooms into the field */
    transition: border-color 0.15s, box-shadow 0.15s;
}

.auth-input::placeholder {
    color: #8793a6;
}

.auth-input:hover,
.auth-select:hover {
    border-color: #64748b;
}

.auth-input:focus,
.auth-select:focus {
    outline: none;
    border-color: var(--auth-primary);
    box-shadow: 0 0 0 4px rgba(67, 56, 202, 0.18);
}

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

.auth-input[aria-invalid='true']:focus {
    box-shadow: 0 0 0 4px rgba(185, 28, 28, 0.16);
}

.auth-select {
    appearance: none;
    -webkit-appearance: none;
    padding-right: 42px;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23475569' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
}

.auth-password {
    position: relative;
}

.auth-password .auth-input {
    padding-right: 52px;
}

.auth-eye {
    position: absolute;
    top: 50%;
    right: 4px;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--auth-muted);
    cursor: pointer;
}

.auth-eye:hover {
    color: var(--auth-primary);
    background: var(--auth-soft);
}

.auth-eye:focus-visible {
    outline: 3px solid rgba(67, 56, 202, 0.5);
    outline-offset: 0;
}

.auth-eye svg {
    width: 22px;
    height: 22px;
}

.auth-hint {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
    font-size: 0.82rem;
    color: var(--auth-muted);
}

.auth-hint.ok {
    color: var(--auth-accent);
}

.auth-hint svg {
    width: 15px;
    height: 15px;
    flex: 0 0 auto;
}

.auth-error-field {
    margin-top: 6px;
    font-size: 0.84rem;
    font-weight: 600;
    color: var(--auth-danger);
}

.auth-error {
    margin: 0 0 16px;
    padding: 12px 14px;
    border-radius: 10px;
    background: var(--auth-danger-soft);
    border: 1px solid #fecaca;
    color: var(--auth-danger);
    font-weight: 600;
    font-size: 0.92rem;
    outline: none;
}

.auth-consent {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    margin: 18px 0 18px;
    font-size: 0.88rem;
    color: var(--auth-muted);
    cursor: pointer;
}

.auth-consent input {
    flex: 0 0 auto;
    width: 22px;
    height: 22px;
    margin: 0;
    accent-color: var(--auth-primary);
    cursor: pointer;
}

.auth-consent input:focus-visible {
    outline: 3px solid rgba(67, 56, 202, 0.5);
    outline-offset: 2px;
}

.auth-submit {
    width: 100%;
    min-height: 52px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    border: none;
    border-radius: 12px;
    background: var(--auth-accent);
    color: #fff;
    font-family: var(--auth-heading);
    font-weight: 600;
    font-size: 1.02rem;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(4, 120, 87, 0.28);
    transition: background 0.15s, transform 0.15s, box-shadow 0.15s;
}

.auth-submit:hover:not(:disabled) {
    background: var(--auth-accent-hover);
    transform: translateY(-1px);
}

.auth-submit:focus-visible {
    outline: 3px solid rgba(4, 120, 87, 0.5);
    outline-offset: 3px;
}

.auth-submit:disabled {
    opacity: 0.75;
    cursor: progress;
    transform: none;
}

.auth-spin {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2.5px solid rgba(255, 255, 255, 0.4);
    border-top-color: #fff;
    animation: auth-turn 0.7s linear infinite;
}

.auth-note {
    margin: 14px 0 0;
    text-align: center;
    font-size: 0.85rem;
    color: var(--auth-muted);
}

@keyframes auth-rise {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: none; }
}

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

/* ------------------------------------------------------------------ desktop: the split card */
@media (min-width: 960px) {
    .auth-shell {
        grid-template-columns: minmax(380px, 5fr) minmax(0, 6fr);
    }

    .auth-panel {
        display: flex;
        flex-direction: column;
        padding: 40px 48px;
        min-height: 100vh;
    }

    .auth-panel-body {
        display: block;
        margin: auto 0;
        padding: 36px 0;
    }

    .auth-panel .auth-trust {
        margin-top: 0;
        padding-top: 20px;
        border-top: 1px solid rgba(255, 255, 255, 0.2);
    }

    .auth-main {
        padding: 32px 48px 48px;
        justify-content: center;
    }

    .auth-heading {
        font-size: 2rem;
    }
}

@media (max-width: 380px) {
    .auth-heading {
        font-size: 1.5rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .auth-form-wrap { animation: none; }
    .auth-submit, .auth-input, .auth-select { transition: none; }
    .auth-spin { animation-duration: 1.6s; }
}

/* ------------------------------------------------------------------ the centred card
   Log in, forgot password, new password, accept invite: short forms with one thing to do, so no brand
   panel - the logo, a card, and the same fields, buttons and messages as the register page. */
body.auth-page.auth-centered {
    background: linear-gradient(180deg, #f5f3ff 0%, #eef2ff 100%);
}

.auth-center {
    position: relative;
    overflow: hidden;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 28px 16px calc(28px + env(safe-area-inset-bottom));
}

/* The same two light blobs as the register panel, tinted for a light page. */
.auth-center::before,
.auth-center::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
}

.auth-center::before {
    width: 520px;
    height: 520px;
    right: -200px;
    top: -220px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.2), rgba(99, 102, 241, 0) 70%);
}

.auth-center::after {
    width: 460px;
    height: 460px;
    left: -190px;
    bottom: -200px;
    background: radial-gradient(circle, rgba(16, 185, 129, 0.16), rgba(16, 185, 129, 0) 70%);
}

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

/* The brand link on a light page: ink text and the indigo mark instead of the glass one. */
.auth-brand--ink {
    color: var(--auth-ink);
    margin-bottom: 22px;
}

.auth-brand--ink .auth-brand-mark {
    background: var(--auth-primary);
    border-color: transparent;
    color: #fff;
}

.auth-card {
    width: 100%;
    max-width: 440px;
    padding: 30px 28px 28px;
    background: #fff;
    border: 1px solid #e0e7ff;
    border-radius: 18px;
    box-shadow: 0 20px 50px rgba(30, 27, 75, 0.1);
    animation: auth-rise 0.35s ease-out both;
}

.auth-card .auth-heading {
    font-size: 1.6rem;
}

.auth-text {
    margin: 0 0 18px;
    color: var(--auth-muted);
}

.auth-foot {
    margin-top: 18px;
    text-align: center;
    font-size: 0.92rem;
    color: var(--auth-muted);
}

/* "Forgot your password?", right-aligned under the field it is about. */
.auth-aside {
    margin: -4px 0 16px;
    text-align: right;
    font-size: 0.88rem;
}

.auth-success {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 14px 16px;
    border-radius: 12px;
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    color: #065f46;
    font-size: 0.95rem;
}

.auth-heading + .auth-success {
    margin-top: 14px;
}

.auth-success svg {
    flex: 0 0 auto;
    width: 22px;
    height: 22px;
    margin-top: 1px;
}

/* Who is being invited, so the form does not open with a stranger's request for a password. */
.auth-invitee {
    display: flex;
    gap: 12px;
    align-items: center;
    margin: 0 0 18px;
    padding: 12px 14px;
    border-radius: 12px;
    background: var(--auth-soft);
    border: 1px solid #ddd6fe;
}

.auth-invitee-avatar {
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--auth-primary);
    color: #fff;
    font-family: var(--auth-heading);
    font-weight: 700;
}

.auth-invitee strong {
    display: block;
    color: var(--auth-ink);
    line-height: 1.25;
}

.auth-invitee > div > span {
    display: block;
    font-size: 0.85rem;
    color: var(--auth-muted);
    overflow-wrap: anywhere;
}

.auth-loading {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 0;
    color: var(--auth-muted);
}

.auth-spin--dark {
    border-color: rgba(67, 56, 202, 0.25);
    border-top-color: var(--auth-primary);
}

@media (max-width: 480px) {
    .auth-card {
        padding: 24px 18px 22px;
        border-radius: 16px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .auth-card { animation: none; }
}
