/* Login and signup pages. Colors and type match the public home page. */
:root {
    --auth-bg: #f6f5f2;
    --auth-surface: #ffffff;
    --auth-surface-muted: #f1efea;
    --auth-border: #d9d4ca;
    --auth-border-soft: #e4e0d8;
    --auth-text: #1c2321;
    --auth-text-muted: #5f6b67;
    --auth-accent: #0f766e;
    --auth-accent-hover: #0b5e58;
    --auth-accent-soft: #e3f2ef;
    --auth-danger: #b42318;
    --auth-danger-soft: #fef3f2;
    --auth-warning: #92400e;
    --auth-warning-soft: #fffbeb;
    --auth-focus: 0 0 0 3px rgba(15, 118, 110, .25);
    --auth-radius: 10px;
}

html,
body {
    margin: 0;
    padding: 0;
    background: var(--auth-bg);
}

.auth,
.auth button,
.auth input {
    font-family: Poppins, system-ui, -apple-system, "Segoe UI", sans-serif;
}

.auth {
    display: grid;
    grid-template-columns: minmax(320px, 42%) minmax(0, 1fr);
    min-height: 100vh;
    min-height: 100dvh;
    color: var(--auth-text);
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

.auth .bx {
    line-height: 1;
}

/* Brand panel */
.auth-brand {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 32px;
    padding: clamp(28px, 4vw, 56px);
    overflow: hidden;
    background:
        radial-gradient(circle at 85% 12%, rgba(255, 255, 255, .12), transparent 40%),
        radial-gradient(circle at 10% 90%, rgba(245, 158, 11, .18), transparent 45%),
        linear-gradient(160deg, #0f766e, #0b4f4a);
    color: #fff;
}

.auth-logo {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: inherit;
    text-decoration: none;
}

.auth-logo-mark {
    display: inline-grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: #fff;
    color: var(--auth-accent);
    font-size: 21px;
}

.auth-logo-name {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: .02em;
}

.auth-brand-body {
    margin: auto 0;
}

.auth-brand-title {
    max-width: 16ch;
    margin: 0 0 24px;
    font-size: clamp(28px, 3vw, 40px);
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -.01em;
}

.auth-brand-points {
    display: grid;
    gap: 14px;
    max-width: 30rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

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

.auth-brand-points .bx {
    display: inline-grid;
    flex: none;
    place-items: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: rgba(255, 255, 255, .14);
    font-size: 18px;
}

.auth-brand-points span {
    padding-top: 5px;
}

.auth-brand-foot {
    margin: 0;
    color: rgba(255, 255, 255, .8);
    font-size: 14px;
}

.auth-brand-foot a {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    color: #fff;
    font-weight: 600;
    text-underline-offset: 3px;
}

/* Form side */
.auth-main {
    display: grid;
    place-items: center;
    padding: clamp(24px, 4vw, 56px) 16px;
}

.auth-card {
    width: min(100%, 420px);
}

.auth-title {
    margin: 0 0 6px;
    font-size: clamp(26px, 2.4vw, 32px);
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -.01em;
}

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

.auth-form {
    display: grid;
    gap: 18px;
}

.auth-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.auth-field {
    display: grid;
    gap: 6px;
}

.auth-label-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 6px 16px;
}

.auth-label-row .auth-check {
    white-space: nowrap;
}

.auth-label {
    font-size: 14px;
    font-weight: 600;
}

.auth-hint {
    margin: 0;
    color: var(--auth-text-muted);
    font-size: 13px;
}

.auth-control {
    position: relative;
    display: flex;
    align-items: center;
}

.auth-control > .bx {
    position: absolute;
    left: 12px;
    color: var(--auth-text-muted);
    font-size: 20px;
    pointer-events: none;
}

.auth-input {
    width: 100%;
    height: 48px;
    box-sizing: border-box;
    padding: 0 14px 0 42px;
    border: 1px solid var(--auth-border);
    border-radius: var(--auth-radius);
    background: var(--auth-surface);
    color: var(--auth-text);
    font-size: 15px;
    transition: border-color .15s, box-shadow .15s;
}

.auth-input::placeholder {
    color: #8a948f;
}

.auth-input:hover {
    border-color: #b9b2a5;
}

.auth-input:focus {
    border-color: var(--auth-accent);
    outline: none;
    box-shadow: var(--auth-focus);
}

.auth-input.input-validation-error {
    border-color: var(--auth-danger);
}

.auth-input.input-validation-error:focus {
    box-shadow: 0 0 0 3px rgba(180, 35, 24, .18);
}

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

.auth-reveal {
    position: absolute;
    right: 6px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    height: 36px;
    padding: 0 10px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--auth-text-muted);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.auth-reveal:hover {
    background: var(--auth-surface-muted);
    color: var(--auth-text);
}

.auth-reveal:focus-visible {
    outline: none;
    box-shadow: var(--auth-focus);
}

.auth-reveal .bx {
    font-size: 18px;
}

/* Inline messages */
.auth-error {
    display: flex;
    align-items: flex-start;
    gap: 4px;
    color: var(--auth-danger);
    font-size: 13px;
}

.auth-error:empty,
.auth-error.field-validation-valid {
    display: none;
}

.auth-error::before {
    content: "\eac7";
    font-family: boxicons;
    font-size: 15px;
    line-height: 1.3;
}

.auth-caps {
    display: none;
    align-items: center;
    gap: 4px;
    color: var(--auth-warning);
    font-size: 13px;
}

.auth-caps.is-visible {
    display: flex;
}

.auth-alert {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    padding: 12px 14px;
    border: 1px solid #fecdca;
    border-radius: var(--auth-radius);
    background: var(--auth-danger-soft);
    color: var(--auth-danger);
    font-size: 14px;
}

.auth-alert .bx {
    flex: none;
    font-size: 20px;
}

.auth-alert ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.auth-alert.validation-summary-valid {
    display: none;
}

/* Password rules checklist */
.auth-rules {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px 12px;
    margin: 2px 0 0;
    padding: 0;
    color: var(--auth-text-muted);
    font-size: 12.5px;
    list-style: none;
}

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

.auth-rules li::before {
    content: "\ea5c";
    font-family: boxicons;
    font-size: 15px;
}

.auth-rules li.is-met {
    color: var(--auth-accent);
}

.auth-rules li.is-met::before {
    content: "\ea46";
}

/* Checkbox */
.auth-check {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 14px;
    cursor: pointer;
}

.auth-check input[type="checkbox"] {
    flex: none;
    width: 18px;
    height: 18px;
    margin: 2px 0 0;
    accent-color: var(--auth-accent);
    cursor: pointer;
}

.auth-link-button,
.auth a.auth-link {
    padding: 0;
    border: 0;
    background: none;
    color: var(--auth-accent);
    font: inherit;
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 3px;
    cursor: pointer;
}

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

/* Buttons */
.auth-submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    min-height: 50px;
    margin-top: 4px;
    border: 0;
    border-radius: var(--auth-radius);
    background: var(--auth-accent);
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color .15s;
}

.auth-submit:hover {
    background: var(--auth-accent-hover);
}

.auth-submit:focus-visible {
    outline: none;
    box-shadow: var(--auth-focus);
}

.auth-submit .bx {
    font-size: 20px;
}

.auth-submit[aria-busy="true"] {
    cursor: progress;
    opacity: .85;
}

.auth-submit[aria-busy="true"] .bx {
    animation: auth-spin .8s linear infinite;
}

.auth-switch {
    margin: 24px 0 0;
    padding-top: 20px;
    border-top: 1px solid var(--auth-border-soft);
    color: var(--auth-text-muted);
    font-size: 14px;
    text-align: center;
}

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

/* Terms dialog */
.auth-dialog {
    width: min(640px, calc(100vw - 32px));
    max-height: min(80vh, 720px);
    padding: 0;
    border: 0;
    border-radius: 14px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, .3);
    color: var(--auth-text);
    font-family: Poppins, system-ui, sans-serif;
}

.auth-dialog[open] {
    display: flex;
    flex-direction: column;
}

.auth-dialog::backdrop {
    background: rgba(12, 20, 18, .55);
}

.auth-dialog-head,
.auth-dialog-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 20px;
}

.auth-dialog-head {
    border-bottom: 1px solid var(--auth-border-soft);
}

.auth-dialog-head h2 {
    margin: 0;
    font-size: 18px;
}

.auth-dialog-close {
    display: inline-grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--auth-text-muted);
    font-size: 22px;
    cursor: pointer;
}

.auth-dialog-close:hover {
    background: var(--auth-surface-muted);
    color: var(--auth-text);
}

.auth-dialog-body {
    overflow-y: auto;
    padding: 4px 20px 8px;
    color: var(--auth-text-muted);
    font-size: 14px;
    line-height: 1.6;
}

.auth-dialog-body li + li {
    margin-top: 12px;
}

.auth-dialog-foot {
    justify-content: flex-end;
    border-top: 1px solid var(--auth-border-soft);
}

.auth-dialog-foot .auth-submit {
    width: auto;
    min-height: 44px;
    margin: 0;
    padding: 0 20px;
    font-size: 15px;
}

.auth-button-secondary {
    min-height: 44px;
    padding: 0 18px;
    border: 1px solid var(--auth-border);
    border-radius: var(--auth-radius);
    background: var(--auth-surface);
    color: var(--auth-text);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
}

.auth-button-secondary:hover {
    background: var(--auth-surface-muted);
}

/* Tablets and phones: compact brand bar above the form */
@media (max-width: 900px) {
    .auth {
        grid-template-columns: minmax(0, 1fr);
        grid-template-rows: auto 1fr;
    }

    .auth-brand {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 16px;
        padding: 14px 16px;
    }

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

    .auth-brand-foot {
        font-size: 13px;
    }

    .auth-brand-foot-text {
        display: none;
    }

    .auth-main {
        align-items: start;
        padding-top: 32px;
    }
}

@media (max-width: 480px) {
    .auth-row {
        grid-template-columns: minmax(0, 1fr);
    }

    .auth-rules {
        grid-template-columns: minmax(0, 1fr);
    }
}

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

    .auth-submit[aria-busy="true"] .bx {
        animation: none;
    }
}
