@font-face {
    font-family: "Geist";
    src: url("/fonts/geist-latin.woff2") format("woff2");
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
}

:root {
    color-scheme: light;
    --background: #f8fafc;
    --surface: #ffffff;
    --control-background: #f8fafc;
    --control-border: #e2e8f0;
    --border-strong: #cbd5e1;
    --text: #0f172a;
    --label: #334155;
    --text-soft: #94a3b8;
    --accent: #2563eb;
    --accent-hover: #1d4ed8;
    --accent-soft: #eff6ff;
    --accent-border: #bfdbfe;
    --danger: #d32f2f;
    --danger-control: #d32f2f;
    --danger-soft: #fdeded;
    --danger-border: #ef9a9a;
    --success: #2e7d32;
    --success-soft: #e8f5e9;
    --success-border: #a5d6a7;
    --shadow: 0 1px 2px rgb(15 23 42 / 0.05);
    --tap-highlight: rgb(15 23 42 / 0.1);
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--background);
    font-family: "Geist", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    -webkit-font-smoothing: antialiased;
}

body {
    min-height: 100vh;
    margin: 0;
    color: var(--text);
    background: var(--background);
}

button,
input {
    font: inherit;
}

button,
a {
    -webkit-tap-highlight-color: var(--tap-highlight);
}

button:not(:disabled),
a[href]:not([aria-disabled="true"]) {
    touch-action: manipulation;
}

button:not(:disabled):active,
a[href]:not([aria-disabled="true"]):active {
    opacity: 0.82;
}

@media (prefers-reduced-motion: no-preference) {
    button:not(:disabled):active,
    a[href]:not([aria-disabled="true"]):active {
        scale: 0.985;
    }
}

.brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    margin: 0 auto 32px;
    color: #0f172a;
    text-decoration: none;
    line-height: 1;
}

.brand-icon {
    width: 20px;
    height: 20px;
    color: #2563eb;
    flex-shrink: 0;
}

.brand-text {
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: -0.03em;
    color: #0f172a;
}

@media (min-width: 640px) {
    .brand-icon {
        width: 24px;
        height: 24px;
    }

    .brand-text {
        font-size: 1rem;
    }
}

.password-toggle {
    display: flex;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    border: 0;
    color: #94a3b8;
    background: transparent;
    transition: color 150ms ease, background 150ms ease;
}

.password-toggle svg {
    width: 18px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2;
}

.login-shell {
    display: grid;
    min-height: 100vh;
    place-items: center;
    padding: 16px;
}

.login-card {
    width: min(100%, 440px);
    padding: 24px;
    border: 1px solid rgb(226 232 240 / 0.8);
    border-radius: 16px;
    background: var(--surface);
    box-shadow: var(--shadow);
    animation: card-enter 220ms ease-out both;
}

.card-heading {
    margin-bottom: 24px;
    text-align: center;
}

h1 {
    margin: 0;
    font-size: 24px;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.025em;
}

.notification-region {
    position: fixed;
    top: 80px;
    right: 16px;
    z-index: 100;
    width: calc(100% - 32px);
    max-width: 384px;
    pointer-events: none;
}

@media (max-width: 767px) {
    .notification-region {
        right: 16px;
        left: 16px;
        width: auto;
        max-width: none;
    }
}

.notification {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px 44px 16px 16px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    color: #0f172a;
    background: #ffffff;
    box-shadow: 0 10px 15px -3px rgb(15 23 42 / 0.1), 0 4px 6px -4px rgb(15 23 42 / 0.1);
    pointer-events: auto;
}

.notification-enter {
    animation: notification-enter 180ms ease-out both;
}

.notification-icon {
    display: flex;
    width: 32px;
    height: 32px;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    color: var(--danger);
    background: var(--danger-soft);
}

.notification-success .notification-icon {
    color: var(--success);
    background: var(--success-soft);
}

.notification-icon svg,
.notification-close svg {
    width: 18px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2.4;
}

.notification-content {
    min-width: 0;
    flex: 1;
    padding-top: 2px;
}

.notification-content p {
    margin: 0;
    color: #0f172a;
    font-size: 14px;
    font-weight: 600;
    line-height: 20px;
}

.notification-close {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    width: 28px;
    height: 28px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0;
    border-radius: 8px;
    color: #94a3b8;
    background: transparent;
    transition: color 150ms ease, background 150ms ease;
}

.notification-close:hover {
    color: #334155;
    background: #f1f5f9;
}

.notification-close:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 1px;
}

.feedback {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 0 0 20px;
    padding: 12px 13px;
    border: 1px solid;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.45;
}

.feedback svg {
    width: 18px;
    flex: 0 0 auto;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.9;
}

.feedback-error {
    border-color: var(--danger-border);
    color: var(--danger);
    background: var(--danger-soft);
}

.feedback-success {
    border-color: var(--success-border);
    color: var(--success);
    background: var(--success-soft);
}

.login-form,
.field {
    display: flex;
    flex-direction: column;
}

.login-form {
    gap: 24px;
}

.account-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
}

.login-recovery-link {
    margin: 0;
    text-align: center;
    font-size: 14px;
}

.login-form .cf-turnstile {
    align-self: center;
}

.login-recovery-link a {
    color: var(--accent-hover);
    font-weight: 600;
    text-decoration: underline;
    text-decoration-color: transparent;
    text-underline-offset: 3px;
    transition: color 150ms ease, text-decoration-color 150ms ease;
}

.signup-prompt {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 5px;
    margin: 0;
    color: var(--text-soft);
    font-size: 14px;
}

.signup-prompt a {
    color: var(--text);
    font-weight: 700;
    text-decoration: none;
    text-underline-offset: 3px;
    transition: color 150ms ease, text-decoration-color 150ms ease;
}

.login-recovery-link a:hover,
.signup-prompt a:hover {
    color: var(--accent);
    text-decoration: underline;
}

.login-recovery-link a:focus-visible,
.signup-prompt a:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
    border-radius: 2px;
}

.field {
    gap: 8px;
}

.field label {
    color: var(--label);
    font-size: 14px;
    font-weight: 600;
}

.input-wrap {
    position: relative;
}

.input-wrap > svg {
    position: absolute;
    top: 50%;
    left: 12px;
    width: 18px;
    transform: translateY(-50%);
    fill: none;
    stroke: var(--text-soft);
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2;
    pointer-events: none;
}

.input-wrap input {
    width: 100%;
    height: 44px;
    padding: 0 40px;
    border: 1px solid var(--control-border);
    outline: none;
    border-radius: 12px;
    color: var(--text);
    background: var(--control-background);
    font-size: 16px;
    transition: border-color 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

.input-wrap input::placeholder {
    color: var(--text-soft);
}

.input-wrap:hover input {
    border-color: var(--border-strong);
}

.input-wrap:focus-within input {
    border-color: #64748b;
    background: var(--surface);
    box-shadow: 0 0 0 4px rgb(100 116 139 / 0.1);
}

.input-wrap.has-error input {
    border-color: var(--danger-control);
}

.input-wrap.has-error:focus-within input {
    border-color: var(--danger-control);
    box-shadow: 0 0 0 4px rgb(211 47 47 / 0.1);
}

.field-error {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin: 0;
    color: var(--danger);
    font-size: 14px;
    line-height: 1.4;
}

.field-error[hidden] {
    display: none;
}

.field-error svg {
    width: 16px;
    flex: 0 0 auto;
    margin-top: 2px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2;
}

.password-toggle {
    position: absolute;
    top: 50%;
    right: 8px;
    width: 28px;
    height: 28px;
    transform: translateY(-50%);
    border-radius: 9999px;
}

.password-toggle:hover {
    color: #0f172a;
    background: #e2e8f0;
}

.eye-icon {
    display: none;
}

.password-toggle[aria-pressed="true"] .eye-off-icon {
    display: none;
}

.password-toggle[aria-pressed="true"] .eye-icon {
    display: block;
}

.password-tooltip {
    position: fixed;
    z-index: 200;
    width: max-content;
    max-width: 256px;
    padding: 6px 10px;
    border-radius: 6px;
    color: #ffffff;
    background: #020617;
    box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.2), 0 4px 6px -4px rgb(0 0 0 / 0.2);
    font-size: 12px;
    font-weight: 500;
    line-height: 16px;
    text-align: center;
    pointer-events: none;
}

.submit-button {
    display: inline-flex;
    width: 100%;
    min-height: 44px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border: 0;
    border-radius: 12px;
    color: #ffffff;
    background: var(--accent);
    font-size: 14px;
    font-weight: 600;
    transition: background 150ms ease;
}

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

.submit-button svg {
    width: 18px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2;
}

.submit-button:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

.password-toggle:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px #94a3b8;
}

a:focus-visible {
    border-radius: 6px;
    outline: 2px solid #94a3b8;
    outline-offset: 2px;
}

@keyframes card-enter {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes notification-enter {
    from {
        opacity: 0;
        transform: translateX(10px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@media (hover: hover) and (pointer: fine) {
    .input-wrap input {
        font-size: 14px;
    }
}

@media (min-width: 768px) {
    .notification-region {
        right: 24px;
    }

    .login-shell {
        padding: 32px;
    }

    .login-card {
        padding: 32px;
    }

    h1 {
        font-size: 30px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Keep the public login aligned with the authenticated dark theme. */
@media (prefers-color-scheme: dark) {
    :root {
        color-scheme: dark;
        --background: #1a1a1a;
        --surface: #212121;
        --control-background: #2d2d2d;
        --control-border: #3c3c3c;
        --border-strong: #565656;
        --text: #d4d4d4;
        --label: #bfbfbf;
        --text-soft: #9d9d9d;
        --accent-soft: #172554;
        --accent-border: #1e40af;
        --shadow: 0 1px 2px rgb(0 0 0 / 0.3);
        --tap-highlight: rgb(212 212 212 / 0.12);
    }

    .brand,
    .brand-text,
    .notification,
    .notification-content p {
        color: #f1f5f9;
    }

    .login-card {
        border-color: #2d2d2d;
    }

    .notification {
        border-color: #3c3c3c;
        background: var(--surface);
        box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.3), 0 4px 6px -4px rgb(0 0 0 / 0.3);
    }

    .input-wrap input {
        border-color: #3c3c3c;
    }

    .input-wrap:focus-within input {
        border-color: #7a7a7a;
        background: #212121;
    }

    .login-recovery-link a {
        color: #bfbfbf;
    }

    .login-recovery-link a:hover {
        color: #f1f5f9;
    }

    .notification-close:hover,
    .password-toggle:hover {
        color: #f1f5f9;
        background: #3c3c3c;
    }
}
