* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* Light Mode Defaults */
:root {
    color-scheme: light dark;
    --page-background: #ffffff;
    --surface-background: #f7f7f7;
    --footer-background: #f4f4f4;
    --ink: #171717;
    --text: #252525;
    --muted: #626262;
    --line: #dedede;
    --link: #424245;
    --footer-muted: #6e6e73;
    --footer-divider: #86868b;
    --header-background: #111111;
    --header-text: #ffffff;
    --header-muted: rgba(255, 255, 255, 0.72);
    --error: #b42318;
    --error-background: #fff1f0;
    --blue: #0071e3;
    --blue-hover: #0077ed;
    --body-font: 'Fira Sans', sans-serif;
    --title-font: 'League Spartan', sans-serif;
}

/* Dark Mode */
@media (prefers-color-scheme: dark) {
    :root {
        --page-background: #111111;
        --surface-background: #1a1a1a;
        --footer-background: #1a1a1a;
        --ink: #f5f5f5;
        --text: #e5e5e5;
        --muted: #b5b5b5;
        --line: #333333;
        --link: #d8d8d8;
        --footer-muted: #b5b5b5;
        --footer-divider: #666666;
        --error: #ffb4ab;
        --error-background: rgba(180, 35, 24, 0.16);
    }
}

html { scroll-behavior: smooth; }

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background-color: var(--page-background);
    color: var(--ink);
    font-family: var(--body-font);
    line-height: 1.42;
}

img {
    user-select: none;
    -webkit-user-drag: none;
}

a { color: inherit; }

.title-font {
    font-family: var(--title-font);
    font-weight: 700;
}

/* Header */
.site-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    height: 54px;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--header-background);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--header-text);
    text-decoration: none;
    line-height: 1;
    white-space: nowrap;
}

.brand img {
    width: auto;
    height: 22px;
    max-width: 52px;
    object-fit: contain;
}

.brand span {
    color: var(--header-text);
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

/* Login Page */
.login-main { flex: 1; }

.login-section {
    min-height: calc(100vh - 54px - 150px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 74px 24px;
}

.login-panel {
    width: 100%;
    max-width: 920px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 380px;
    align-items: center;
    gap: 54px;
}

.login-message { max-width: 455px; }

.login-eyebrow {
    margin-bottom: 12px;
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.login-message h1 {
    margin-bottom: 18px;
    color: var(--ink);
    font-size: clamp(3rem, 7vw, 5.4rem);
    line-height: 0.9;
    letter-spacing: -0.06em;
}

.login-message p {
    color: var(--muted);
    font-size: 1rem;
    line-height: 1.55;
}

.login-form {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding-left: 34px;
    border-left: 1px solid var(--line);
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.form-field label {
    color: var(--text);
    font-size: 0.86rem;
    font-weight: 600;
}

.form-field input {
    width: 100%;
    min-height: 48px;
    padding: 0 15px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--page-background);
    color: var(--ink);
    font: inherit;
    font-size: 0.96rem;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.form-field input:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.14);
}

.login-error {
    display: none;
    padding: 11px 13px;
    border-radius: 11px;
    background: var(--error-background);
    color: var(--error);
    font-size: 0.86rem;
    font-weight: 500;
}

.login-error.visible { display: block; }

.login-button {
    min-height: 48px;
    margin-top: 2px;
    border: 0;
    border-radius: 999px;
    background: var(--blue);
    color: #ffffff;
    font: inherit;
    font-size: 0.96rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.login-button:hover {
    background: var(--blue-hover);
    transform: translateY(-1px);
    box-shadow: 0 12px 24px rgba(0, 113, 227, 0.22);
}

/* Console Layout (New) */
.console-wrapper {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.console-sidebar {
    width: 260px;
    background-color: var(--surface-background);
    border-right: 1px solid var(--line);
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    color: var(--text);
    text-decoration: none;
    font-size: 0.96rem;
    font-weight: 500;
    border-radius: 8px;
    transition: background 0.2s ease, color 0.2s ease;
}

.sidebar-link:hover {
    background-color: rgba(0, 113, 227, 0.08);
    color: var(--blue);
}

.sidebar-link.active {
    background-color: var(--blue);
    color: #ffffff;
}

.console-content {
    flex: 1;
    padding: 40px;
    overflow-y: auto;
    background-color: var(--page-background);
}

.console-header {
    margin-bottom: 32px;
}

.console-header h2 {
    font-size: 2rem;
    color: var(--ink);
    letter-spacing: -0.02em;
}

/* Footer */
.site-footer {
    background-color: var(--footer-background);
    border-top: 1px solid var(--line);
}

.footer-bottom {
    padding: 16px 32px;
    font-size: 0.76rem;
    color: var(--footer-muted);
    text-align: left;
}

/* Mobile & Tablet Overrides */
@media (max-width: 900px) {
    .login-panel {
        max-width: 720px;
        grid-template-columns: 1fr;
        gap: 30px;
    }
    .login-form {
        max-width: 420px;
        padding-left: 0;
        padding-top: 26px;
        border-left: 0;
        border-top: 1px solid var(--line);
    }
    .console-wrapper {
        flex-direction: column;
    }
    .console-sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--line);
        flex-direction: row;
        overflow-x: auto;
    }
}