:root {
    color-scheme: light;
    --page: #edf1f4;
    --brand-surface: #e2e8ec;
    --auth-surface: #f7f9fa;
    --surface: #fbfcfd;
    --surface-muted: #eef2f4;
    --text: #19232d;
    --muted: #5a6874;
    --border: #c8d0d6;
    --accent: #8b5a3f;
    --accent-strong: #70442e;
    --accent-soft: #eadbd1;
    --button-text: #faf8f6;
    --danger: #a63e3e;
    --danger-surface: #f8eaea;
    --success: #2f6b51;
    --success-surface: #e6f1eb;
    --shadow: rgba(56, 73, 84, 0.14);
    --radius: 18px;
}

[v-cloak] {
    display: none;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    min-width: 320px;
    background: var(--page);
}

body {
    margin: 0;
    min-width: 320px;
    min-height: 100dvh;
    background: var(--page);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", sans-serif;
    -webkit-font-smoothing: antialiased;
}

button,
input {
    font: inherit;
}

button {
    color: inherit;
}

.login-shell {
    display: grid;
    grid-template-columns: minmax(0, 1.08fr) minmax(440px, 0.92fr);
    min-height: 100dvh;
    overflow: hidden;
}

.brand-panel,
.auth-panel {
    min-width: 0;
}

.brand-panel {
    position: relative;
    isolation: isolate;
    display: flex;
    padding: clamp(32px, 5vw, 76px);
    overflow: hidden;
    background: var(--brand-surface);
}

.brand-panel::before {
    position: absolute;
    inset: auto auto -28vw -14vw;
    width: min(62vw, 860px);
    aspect-ratio: 1;
    border: 1px solid color-mix(in srgb, var(--accent) 24%, transparent);
    border-radius: 50%;
    content: "";
}

.brand-panel__shape {
    position: absolute;
    top: -9vw;
    right: -12vw;
    width: min(44vw, 650px);
    aspect-ratio: 1;
    border-radius: 50%;
    background: var(--accent-soft);
    opacity: 0.7;
    z-index: -1;
}

.brand-panel__inner {
    display: flex;
    flex: 1;
    flex-direction: column;
    justify-content: space-between;
    width: 100%;
    max-width: 760px;
    min-height: 0;
    animation: enter-brand 650ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.brand-logo {
    align-self: flex-start;
    width: clamp(210px, 23vw, 320px);
    padding: 20px 24px;
    border: 1px solid color-mix(in srgb, var(--border) 72%, transparent);
    border-radius: var(--radius);
    background: #f4f5f5;
    box-shadow: 0 18px 50px var(--shadow);
}

.brand-logo img {
    display: block;
    width: 100%;
    height: auto;
}

.brand-message {
    max-width: 620px;
    padding-top: 48px;
}

.eyebrow {
    margin: 0 0 20px;
    color: var(--accent-strong);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.14em;
}

.brand-message h1 {
    margin: 0;
    max-width: 10em;
    font-size: clamp(42px, 5.4vw, 78px);
    font-weight: 650;
    letter-spacing: -0.055em;
    line-height: 1.08;
}

.brand-message > p:last-child {
    max-width: 31em;
    margin: 28px 0 0;
    color: var(--muted);
    font-size: clamp(16px, 1.3vw, 19px);
    line-height: 1.8;
}

.auth-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(32px, 6vw, 88px);
    background: var(--auth-surface);
}

.auth-frame {
    width: min(100%, 460px);
    animation: enter-auth 650ms 80ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.auth-header {
    margin-bottom: 38px;
}

.auth-header h2 {
    margin: 0;
    font-size: clamp(34px, 4vw, 48px);
    font-weight: 650;
    letter-spacing: -0.04em;
    line-height: 1.12;
}

.auth-header p {
    margin: 14px 0 0;
    color: var(--muted);
    font-size: 16px;
    line-height: 1.7;
}

.form-notice {
    margin: 0 0 22px;
    padding: 14px 16px;
    border: 1px solid currentColor;
    border-radius: var(--radius);
    font-size: 14px;
    line-height: 1.55;
}

.form-notice--error {
    background: var(--danger-surface);
    color: var(--danger);
}

.form-notice--success {
    background: var(--success-surface);
    color: var(--success);
}

.form-group {
    margin-bottom: 24px;
}

.form-group label,
.label-row {
    font-size: 14px;
    font-weight: 700;
}

.form-group > label,
.label-row {
    display: flex;
    margin-bottom: 10px;
}

.label-row {
    align-items: center;
    justify-content: space-between;
}

.label-row label {
    margin: 0;
}

.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="text"] {
    width: 100%;
    height: 56px;
    padding: 0 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    outline: none;
    background: var(--surface);
    color: var(--text);
    caret-color: var(--accent);
    transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.form-group input::placeholder {
    color: var(--muted);
    opacity: 1;
}

.form-group input:hover {
    border-color: color-mix(in srgb, var(--accent) 55%, var(--border));
}

.form-group input:focus-visible {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 22%, transparent);
}

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

.field-error {
    margin: 8px 2px 0;
    color: var(--danger);
    font-size: 13px;
    line-height: 1.5;
}

.password-toggle,
.text-action {
    padding: 2px 0;
    border: 0;
    border-bottom: 1px solid currentColor;
    background: transparent;
    color: var(--accent-strong);
    font-size: 13px;
    font-weight: 700;
    line-height: 1.3;
    cursor: pointer;
}

.password-toggle:hover,
.text-action:hover {
    color: var(--accent);
}

.password-toggle:focus-visible,
.text-action:focus-visible,
.remember-option input:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--accent) 30%, transparent);
    outline-offset: 4px;
}

.form-options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin: 4px 0 28px;
}

.remember-option {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    margin: 0;
    color: var(--muted);
    font-size: 14px;
    cursor: pointer;
}

.remember-option input {
    width: 17px;
    height: 17px;
    margin: 0;
    accent-color: var(--accent);
}

.primary-action,
.secondary-action {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 56px;
    padding: 0 24px;
    overflow: hidden;
    border-radius: var(--radius);
    font-weight: 750;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color 180ms ease, border-color 180ms ease, color 180ms ease, transform 180ms ease, box-shadow 180ms ease;
}

.primary-action {
    border: 1px solid var(--accent);
    background: var(--accent);
    color: var(--button-text);
    box-shadow: 0 14px 30px color-mix(in srgb, var(--accent) 22%, transparent);
}

.primary-action:hover:not(:disabled) {
    border-color: var(--accent-strong);
    background: var(--accent-strong);
}

.primary-action:active:not(:disabled),
.secondary-action:active {
    transform: translateY(1px) scale(0.99);
}

.primary-action:focus-visible,
.secondary-action:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--accent) 34%, transparent);
    outline-offset: 4px;
}

.primary-action:disabled {
    cursor: wait;
    opacity: 0.82;
}

.primary-action.is-loading::after {
    position: absolute;
    inset: auto 0 0;
    height: 3px;
    background: var(--button-text);
    content: "";
    opacity: 0.7;
    transform: translateX(-100%);
    animation: button-progress 1.1s ease-in-out infinite;
}

.secondary-action {
    margin-top: 14px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text);
}

.secondary-action:hover {
    border-color: var(--accent);
    color: var(--accent-strong);
}

.auth-footnote {
    margin: 30px 0 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.6;
    text-align: center;
}

@keyframes enter-brand {
    from {
        opacity: 0;
        transform: translateY(18px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes enter-auth {
    from {
        opacity: 0;
        transform: translateY(22px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes button-progress {
    0% {
        transform: translateX(-100%);
    }
    55%,
    100% {
        transform: translateX(100%);
    }
}

@media (max-width: 900px) {
    .login-shell {
        grid-template-columns: minmax(0, 1fr);
    }

    .brand-panel {
        min-height: 310px;
        padding: 32px clamp(24px, 8vw, 64px);
    }

    .brand-panel__inner {
        flex-direction: row;
        align-items: flex-end;
        gap: 36px;
        max-width: none;
    }

    .brand-logo {
        align-self: flex-start;
        width: min(240px, 38vw);
        flex: 0 0 auto;
    }

    .brand-message {
        max-width: 480px;
        padding: 0;
    }

    .brand-message h1 {
        font-size: clamp(34px, 6.5vw, 52px);
    }

    .auth-panel {
        align-items: flex-start;
        min-height: calc(100dvh - 310px);
        padding: 56px clamp(24px, 8vw, 64px) 72px;
    }
}

@media (max-width: 640px) {
    .brand-panel {
        min-height: 270px;
        padding: 24px;
    }

    .brand-panel__inner {
        display: block;
    }

    .brand-logo {
        width: 190px;
        padding: 14px 16px;
    }

    .brand-message {
        margin-top: 38px;
    }

    .eyebrow {
        margin-bottom: 10px;
        font-size: 11px;
    }

    .brand-message h1 {
        max-width: 12em;
        font-size: 32px;
        line-height: 1.12;
    }

    .brand-message > p:last-child {
        display: none;
    }

    .auth-panel {
        min-height: auto;
        padding: 44px 24px max(48px, env(safe-area-inset-bottom));
    }

    .auth-header {
        margin-bottom: 30px;
    }

    .auth-header h2 {
        font-size: 34px;
    }

    .form-options {
        align-items: flex-start;
    }
}

@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;
    }
}

@media (forced-colors: active) {
    .primary-action,
    .secondary-action,
    .form-notice,
    .form-group input {
        border: 1px solid ButtonText;
    }
}
