/* Use the frontend's dark palette independently of saved or system theme preferences. */
.tc-login {
    --bg-page: #0d1117;
    --bg-panel: #161b27;
    --bg-input: #1a2234;
    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --border: #253047;
    --border-strong: #3d5068;
    --accent: #6366f1;
    --accent-hover: #5753e0;
    --accent-subtle: rgb(99 102 241 / 18%);
    --danger: #fca5a5;
    --danger-bg: rgb(239 68 68 / 12%);
    --flow-color: #514ba5;
    --panel-border: rgb(140 130 255 / 76%);
    --panel-shadow:
        0 0 0 1px rgb(124 111 255 / 10%),
        0 0 14px rgb(110 95 255 / 22%),
        0 0 42px 7px rgb(99 82 230 / 12%),
        0 24px 56px rgb(0 0 0 / 32%);
    box-sizing: border-box;
    display: flex;
    min-height: 100vh;
    min-height: 100svh;
    margin: 0;
    padding: 80px 24px;
    background: var(--bg-page);
    color: var(--text-primary);
    color-scheme: dark;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.5;
}

.tc-login *,
.tc-login *::before,
.tc-login *::after {
    box-sizing: inherit;
}

.tc-login [hidden] {
    display: none !important;
}

.tc-login__flow {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    fill: none;
    color: var(--flow-color);
    pointer-events: none;
}

.tc-login__flow-line {
    stroke: currentColor;
    stroke-width: 1;
}

.tc-login__flow-junctions circle {
    fill: var(--bg-page);
    stroke: #6f65cf;
    stroke-width: 1.2;
}

.tc-login__flow-nodes circle {
    fill: #91b9ee;
}

.tc-login__flow-nodes .tc-login__flow-node--converted {
    fill: #99efda;
}

.tc-login__flow-packet,
.tc-login__flow-junction-pulses {
    display: none;
}

/* Keep the original static background unless the user allows motion. */
@media (prefers-reduced-motion: no-preference) {
    .tc-login__flow-nodes {
        display: none;
    }

    .tc-login__flow-packet,
    .tc-login__flow-junction-pulses {
        display: inline;
    }
}

.tc-login__panel {
    position: relative;
    width: 100%;
    max-width: 440px;
    margin: auto;
    padding: 36px;
    border: 1px solid var(--panel-border);
    border-radius: 12px;
    background: var(--bg-panel);
    box-shadow: var(--panel-shadow);
}

.tc-login__brand {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 28px;
    font-size: 18px;
    font-weight: 700;
}

.tc-login__brand img {
    flex: none;
    border-radius: 8px;
}

.tc-login__title {
    margin: 0;
    font-size: 28px;
    font-weight: 700;
    line-height: 1.3;
}

.tc-login__subtitle {
    margin: 6px 0 28px;
    color: var(--text-secondary);
}

.tc-login__form {
    display: grid;
    gap: 20px;
}

.tc-login__field {
    display: grid;
    gap: 8px;
    min-width: 0;
}

.tc-login__field label {
    font-size: 13px;
    font-weight: 600;
}

.tc-login__field input {
    width: 100%;
    min-width: 0;
    min-height: 50px;
    padding: 12px 14px;
    padding-inline-start: 46px;
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    background: var(--bg-input);
    color: var(--text-primary);
    font: inherit;
}

.tc-login__field input::placeholder {
    color: var(--text-secondary);
    opacity: 1;
}

.tc-login__input-wrap {
    position: relative;
}

.tc-login__input-icon {
    position: absolute;
    inset-block-start: 50%;
    inset-inline-start: 16px;
    transform: translateY(-50%);
    color: var(--text-secondary);
    pointer-events: none;
}

.tc-login__input-icon,
.tc-login__password-toggle svg,
.tc-login__submit svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.tc-login__input-wrap--password input {
    padding-inline-end: 48px;
}

.tc-login__password-toggle {
    position: absolute;
    inset-block: 4px;
    inset-inline-end: 4px;
    display: grid;
    width: 42px;
    place-items: center;
    padding: 0;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
}

.tc-login__password-toggle:hover {
    background: var(--accent-subtle);
    color: var(--accent);
}

.tc-login__eye-slash {
    display: none;
}

.tc-login__password-toggle[aria-pressed="true"] .tc-login__eye-slash {
    display: block;
}

.tc-login__field input:focus {
    border-color: var(--accent);
    outline: 3px solid var(--accent-subtle);
}

.tc-login__field--error input {
    border-color: var(--danger);
}

.tc-login__alert {
    margin: 0 0 18px;
    padding: 10px 12px;
    border: 1px solid var(--danger);
    border-radius: 8px;
    background: var(--danger-bg);
    color: var(--danger);
    overflow-wrap: anywhere;
}

.tc-login__field .errorlist {
    margin: 0;
    padding: 0;
    color: var(--danger);
    font-size: 12px;
    list-style: none;
}

.tc-login__submit {
    display: flex;
    min-height: 50px;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 4px;
    padding: 9px 16px;
    border: 1px solid var(--accent);
    border-radius: 8px;
    background: var(--accent);
    color: #ffffff;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

.tc-login__submit:hover {
    border-color: var(--accent-hover);
    background: var(--accent-hover);
}

.tc-login__submit:focus-visible,
.tc-login__password-toggle:focus-visible,
.tc-login__reset-link:focus-visible,
.tc-login__skip-link:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}

.tc-login__reset-link {
    color: var(--accent);
    text-underline-offset: 3px;
}

.tc-login__skip-link {
    z-index: 2;
    position: absolute;
    inset-block-start: 12px;
    inset-inline-start: 12px;
    padding: 8px 12px;
    transform: translateY(-200%);
    border-radius: 8px;
    background: var(--bg-panel);
    color: var(--accent);
}

.tc-login__skip-link:focus {
    transform: translateY(0);
}

@media (max-width: 480px) {
    .tc-login {
        padding: 32px 16px;
    }

    .tc-login__panel {
        padding: 24px;
    }

    .tc-login__field input {
        font-size: 16px;
    }

    .tc-login__title {
        font-size: 26px;
    }
}
