:root {
    color-scheme: dark;

    --background: #0f172a;
    --surface: #1e293b;
    --input: #0f172a;
    --border: #334155;
    --text: #f1f5f9;
    --muted: #94a3b8;
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --error-bg: #450a0a;
    --error-text: #fca5a5;
}

html[data-theme="light"] {
    color-scheme: light;

    --background: #f1f5f9;
    --surface: #ffffff;
    --input: #ffffff;
    --border: #cbd5e1;
    --text: #0f172a;
    --muted: #64748b;
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --error-bg: #fef2f2;
    --error-text: #b91c1c;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100dvh;

    display: flex;
    flex-direction: column;

    background: var(--background);
    color: var(--text);

    font-family: system-ui, -apple-system,
                 BlinkMacSystemFont, "Segoe UI",
                 sans-serif;
}

button, input {
    font: inherit;
}

button {
    cursor: pointer;
}

.login-header {
    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 18px 24px;
    border-bottom: 1px solid var(--border);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.theme-button {
    background: var(--surface);
    color: var(--text);

    border: 1px solid var(--border);
    border-radius: 8px;

    padding: 9px 14px;
}

.login-container {
    flex: 1;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 32px 20px;
}

.login-card {
    width: 100%;
    max-width: 400px;

    padding: 32px;

    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;

    box-shadow: 0 12px 32px rgba(0,0,0,.12);
}

.brand-icon {
    display: grid;
    place-items: center;

    width: 58px;
    height: 58px;

    margin: 0 auto 18px;

    background: var(--primary);
    color: white;

    border-radius: 14px;
}

h1 {
    margin: 0;
    text-align: center;
    font-size: 28px;
}

h2 {
    font-size: 18px;
    margin: 0 0 20px;
}

.subtitle {
    color: var(--muted);
    text-align: center;
    margin: 8px 0 24px;
}

hr {
    border: 0;
    border-top: 1px solid var(--border);
    margin: 24px 0;
}

label {
    display: block;
    margin: 18px 0 8px;
    font-size: 14px;
    font-weight: 500;
}

input {
    width: 100%;
    padding: 12px;

    background: var(--input);
    color: var(--text);

    border: 1px solid var(--border);
    border-radius: 8px;

    outline: none;
}

input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,.18);
}

.password-container {
    position: relative;
}

.password-container input {
    padding-right: 70px;
}

.password-toggle {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);

    background: transparent;
    color: var(--muted);

    border: none;
    font-size: 13px;
}

.primary-button {
    width: 100%;
    padding: 13px;
    margin-top: 24px;

    background: var(--primary);
    color: white;

    border: none;
    border-radius: 8px;

    font-weight: 600;
}

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

.error-message {
    padding: 12px;
    border-radius: 8px;

    background: var(--error-bg);
    color: var(--error-text);

    font-size: 14px;
}

.security-note {
    margin-top: 24px;
    color: var(--muted);
    font-size: 13px;
    text-align: center;
    overflow-wrap: anywhere;
}

.login-footer {
    text-align: center;
    color: var(--muted);
    padding: 20px;
    font-size: 12px;
}

@media (max-width: 480px) {
    .login-card {
        padding: 24px;
    }

    .login-header {
        padding: 14px;
    }
}
