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

:root {
    --tms-blue: #0d6386;
    --tms-blue-dark: #094a66;
    --tms-blue-soft: rgba(13, 99, 134, 0.12);
    --tms-blue-muted: rgba(13, 99, 134, 0.5);
    --login-bg: #f4f7f9;
    --login-surface: #ffffff;
    --login-border: #d8e1e7;
    --login-text: #17212b;
    --login-muted: #667786;
    --login-input: #ffffff;
    --login-focus: rgba(13, 99, 134, .16);
}

html, body {
    height: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

body {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    font-family: 'Open Sans', system-ui, 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Arial, sans-serif;
    color: var(--login-text);
    background: var(--login-bg);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

button, input { font: inherit; }
button { cursor: pointer; border: none; background: none; }
a { color: inherit; text-decoration: none; }
.is-hidden { display: none !important; }

:is(button, a, input):focus-visible {
    outline: 2px solid var(--tms-blue);
    outline-offset: 2px;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ── Announcement ticker ──────────────────────────────── */
.login-ticker-wrap {
    flex-shrink: 0;
    height: 32px;
    display: flex;
    align-items: center;
    padding: 0 12px;
    background: var(--login-surface);
    border-bottom: 1px solid var(--login-border);
    overflow: hidden;
    z-index: 2;
}

.login-ticker-label {
    flex-shrink: 0;
    margin-right: 10px;
    padding: 2px 8px;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #fff;
    background: var(--tms-blue);
    border-radius: 999px;
}

.login-ticker-track { flex: 1; overflow: hidden; }
.login-ticker-inner {
    display: flex;
    gap: 40px;
    white-space: nowrap;
    animation: loginTickerScroll 35s linear infinite;
}

.login-ticker-item {
    font-size: 11px;
    color: var(--login-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

.login-ticker-dot { color: var(--tms-blue); font-size: 7px; }
.login-ticker-author { color: #a1a1a6; font-size: 10px; }

@keyframes loginTickerScroll { to { transform: translateX(-50%); } }

/* ── 60 / 40 split shell ──────────────────────────────── */
.login-shell {
    flex: 1 1 auto;
    display: flex;
    min-height: 0;
    min-width: 0;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

.login-hero {
    flex: 0 0 60%;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 0 5rem;
    color: #fff;
    background: var(--tms-blue-dark);
    overflow: hidden;
    contain: paint;
    min-width: 0;
    max-width: 100%;
}

.login-hero::before,
.login-hero::after {
    display: none;
}

.login-hero::before { width: 520px; height: 520px; right: -160px; bottom: -180px; }
.login-hero::after  { width: 320px; height: 320px; right: -60px;  bottom: -80px; }

.login-hero-brand {
    position: absolute;
    top: 1.4rem;
    left: 2rem;
    right: 1.5rem;
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.018em;
}

.login-hero-title {
    margin: 0 0 1rem;
    max-width: 100%;
    min-width: 0;
    font-size: clamp(2rem, 3.6vw, 2.8rem);
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.15;
    overflow-wrap: break-word;
}

.login-hero-copy {
    margin: 0;
    width: auto;
    max-width: min(420px, 100%);
    min-width: 0;
    font-size: 1rem;
    line-height: 1.6;
    opacity: 0.85;
    overflow-wrap: break-word;
}

.login-panel {
    flex: 0 0 40%;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    padding: 2rem 1.5rem;
    background: var(--login-surface);
    overflow-y: auto;
}

.login-card {
    width: 100%;
    max-width: 400px;
    min-width: 0;
    text-align: center;
}

.login-mark {
    position: relative;
    width: 140px;
    height: 140px;
    margin: 0 auto 1.25rem;
}

.login-mark-ring {
    width: 100%;
    height: 100%;
    display: block;
}

.login-mark-logo,
.login-mark-fallback {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.login-mark-logo {
    width: 42%;
    height: auto;
    object-fit: contain;
}

.login-mark-fallback {
    font-size: 2rem;
    font-weight: 600;
    letter-spacing: -0.04em;
    color: #111;
}

.login-employee-link {
    display: inline-block;
    margin-top: 1.15rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--tms-blue);
}

.login-employee-link:hover {
    color: var(--tms-blue-dark);
    text-decoration: underline;
}

.employee-login-page .login-shell {
    flex-direction: column;
}

.employee-login-page .login-hero,
.employee-login-page .login-panel {
    flex: none;
    width: 100%;
    max-width: none;
}

.employee-login-page .login-hero {
    min-height: 0;
    padding: 4.5rem 1.5rem 2rem;
}

.employee-login-page .login-hero-brand {
    left: 1.5rem;
}

.employee-login-page .login-panel {
    padding: 1.75rem 1.25rem 2.5rem;
}

.employee-login-page .login-field input {
    font-size: 16px;
}

.login-welcome {
    margin-top: 0;
    margin-bottom: 1.5rem;
    font-size: clamp(1.5rem, 2.4vw, 1.85rem);
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.22;
    color: var(--login-text);
    overflow-wrap: break-word;
    transition: opacity 0.32s ease, transform 0.32s ease;
}

.login-welcome.is-fading {
    opacity: 0;
    transform: translateY(8px);
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 0.95rem;
    text-align: left;
}

.login-step {
    display: flex;
    flex-direction: column;
    gap: 0.95rem;
    transition: opacity 0.32s ease, transform 0.32s ease;
}

.login-step.is-fading {
    opacity: 0;
    transform: translateY(10px);
}

.login-field input {
    width: 100%;
    height: 48px;
    padding: 0 1.1rem;
    border: 1px solid var(--login-border);
    border-radius: 7px;
    font-size: 0.95rem;
    color: var(--login-text);
    background: var(--login-input);
    outline: none;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.login-field input::placeholder { color: var(--login-muted); }
.login-field input:focus {
    border-color: var(--tms-blue);
    box-shadow: 0 0 0 3px var(--login-focus);
}
.login-label {
    display: block;
    margin: 0 0 .4rem;
    color: var(--login-text);
    font-size: .8rem;
    font-weight: 700;
}
.login-field input.uppercase { text-transform: uppercase; }
.login-field input.uppercase::placeholder { text-transform: none; }

.login-meta-row {
    font-size: 0.78rem;
    line-height: 1.45;
    color: var(--login-muted);
}

.login-card a {
    color: var(--tms-blue);
    font-weight: 500;
}

.login-card a:hover {
    color: var(--tms-blue-dark);
    text-decoration: underline;
}

.login-privacy {
    display: flex;
    gap: 0.7rem;
    align-items: flex-start;
    color: var(--login-muted);
}

.login-privacy-icon {
    flex-shrink: 0;
    margin-top: 0.1rem;
    color: var(--tms-blue-muted);
}

.login-privacy p {
    margin: 0;
    min-width: 0;
    flex: 1;
    font-size: 0.78rem;
    line-height: 1.5;
}

.login-switch {
    display: inline-block;
    margin-top: 0.45rem;
    padding: 0;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--tms-blue);
}

.login-switch:hover {
    color: var(--tms-blue-dark);
    text-decoration: underline;
}

.login-switch--back {
    align-self: flex-start;
    color: #86868b;
}

.login-switch--back:hover { color: var(--tms-blue-dark); }

.login-actions-row {
    display: flex;
    justify-content: center;
    margin-top: 0.5rem;
}

.login-submit {
    min-width: 156px;
    height: 44px;
    padding: 0 1.7rem;
    border-radius: 7px;
    background: var(--tms-blue-soft);
    color: var(--tms-blue-muted);
    font-size: 0.95rem;
    font-weight: 600;
    transition: background 0.2s ease, color 0.2s ease, transform 0.18s ease;
}

.login-submit.is-ready {
    background: var(--tms-blue);
    color: #fff;
}

.login-submit.is-ready:hover { background: var(--tms-blue-dark); }
.login-submit.is-ready:active { transform: scale(0.985); }
.login-submit:disabled { cursor: wait; }

.login-alert {
    margin-top: 0;
    margin-bottom: 0.85rem;
    padding: 0.7rem 0.9rem;
    border-radius: 14px;
    font-size: 0.84rem;
    text-align: left;
    border: 1px solid;
}

.login-alert--error { background: #fff5f5; border-color: #fecaca; color: #b91c1c; }
.login-alert--warn  { background: #fff7ed; border-color: #fed7aa; color: #c2410c; }

@media (min-width: 821px) {
    body {
        height: 100vh;
        height: 100dvh;
        overflow: hidden;
    }
}

@media (max-width: 820px) {
    html, body { height: auto; }

    .login-shell {
        flex-direction: column;
        flex: 1 0 auto;
    }

    .login-hero,
    .login-panel {
        flex: none;
        width: 100%;
        max-width: 100%;
        min-width: 0;
    }

    .login-hero {
        padding: 4.25rem 1.5rem 2.25rem;
        min-height: 220px;
        min-width: 0;
    }

    .login-hero-title,
    .login-hero-copy {
        min-width: 0;
    }

    .login-hero-brand {
        left: 1.5rem;
        font-size: 0.98rem;
    }

    .login-hero-title {
        font-size: 1.7rem;
    }

    .login-hero-copy {
        font-size: 0.92rem;
    }

    .login-welcome {
        font-size: 1.35rem;
    }

    .login-field input {
        font-size: 16px;
    }

    .login-panel {
        padding: 2rem 1.25rem 3rem;
        align-items: flex-start;
    }

    .login-mark {
        width: 120px;
        height: 120px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .login-ticker-inner { animation: none; }
    .login-welcome,
    .login-step { transition: none; }
    .login-submit.is-ready:active { transform: none; }
}

html[data-theme="dark"] {
    --login-bg: #0b1120;
    --login-surface: #111827;
    --login-border: #334155;
    --login-text: #e5edf8;
    --login-muted: #9cabc0;
    --login-input: #0e1729;
    --login-focus: rgba(79, 179, 209, .24);
    --tms-blue: #4fb3d1;
    --tms-blue-dark: #075875;
    --tms-blue-soft: rgba(79, 179, 209, .16);
    --tms-blue-muted: #9bd9ea;
}

html[data-theme="dark"] .login-hero {
    background: #073e52;
}

html[data-theme="dark"] .login-alert--error {
    background: #32181d;
    border-color: #7f2936;
    color: #fda4af;
}

html[data-theme="dark"] .login-alert--warn {
    background: #34270f;
    border-color: #785b1b;
    color: #f6cf72;
}

html[data-theme="dark"] input:-webkit-autofill {
    -webkit-text-fill-color: var(--login-text);
    box-shadow: 0 0 0 1000px var(--login-input) inset;
    caret-color: var(--login-text);
}
