:root {
    color-scheme: dark;
    font-family: "Segoe UI", Arial, sans-serif;
    --window: #09111f;
    --surface: #121f32;
    --surface-raised: #192a40;
    --border: #2b415e;
    --text: #f3f7fc;
    --text-secondary: #a9bad0;
    --text-muted: #758aa4;
    --accent: #4d9bff;
    --accent-soft: #1b385d;
    --danger: #ff6470;
}

* { box-sizing: border-box; }
body { margin: 0; color: var(--text); background: var(--window); }
button, input { font: inherit; }

.auth-screen {
    display: grid;
    min-width: 320px;
    min-height: 100vh;
    place-items: center;
    padding: 24px;
    background: radial-gradient(ellipse at top, #142742 0, var(--window) 55%);
}

.auth-card {
    width: min(100%, 430px);
    padding: 32px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--surface);
    box-shadow: 0 18px 55px rgb(0 0 0 / 28%);
}

.auth-brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
    display: grid;
    width: 44px;
    height: 44px;
    place-items: center;
    border-radius: 12px;
    color: #fff;
    background: linear-gradient(145deg, #58a8ff, #2475df);
    font-size: 13px;
    font-weight: 800;
}
.auth-brand strong, .auth-brand span:not(.brand-mark) { display: block; }
.auth-brand strong { font-size: 16px; }
.auth-brand div > span { margin-top: 3px; color: var(--text-secondary); font-size: 12px; }
.auth-card h1, .admin-content h1 { margin: 30px 0 6px; font-size: 25px; }
.auth-intro { margin: 0 0 24px; color: var(--text-secondary); font-size: 14px; }
.login-form { display: grid; gap: 10px; }
.login-form > label:not(.remember-option) { margin-top: 5px; color: var(--text-secondary); font-size: 13px; font-weight: 650; }
.login-form > input {
    width: 100%;
    min-height: 44px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    outline: none;
    color: var(--text);
    background: var(--surface-raised);
}
.login-form > input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgb(77 155 255 / 18%); }
.remember-option { display: flex; align-items: center; gap: 9px; margin: 8px 0; color: var(--text-secondary); font-size: 13px; cursor: pointer; }
.remember-option input { width: 16px; height: 16px; accent-color: var(--accent); }
.auth-submit, .auth-secondary {
    min-height: 42px;
    padding: 0 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    background: var(--surface-raised);
    cursor: pointer;
}
.auth-submit { margin-top: 4px; border-color: #3989ec; color: white; background: #287fe3; font-weight: 700; }
.auth-submit:hover, .auth-secondary:hover { filter: brightness(1.12); }
.auth-error { color: var(--danger); font-size: 13px; }
.auth-error:empty { display: none; }
.auth-error ul { margin: 0; padding-left: 20px; }

.admin-screen { display: block; padding: clamp(24px, 5vh, 56px) clamp(20px, 5vw, 80px); }
.admin-home { width: min(100%, 1100px); margin: 0 auto; }
.admin-header { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.admin-content { padding: clamp(36px, 10vh, 100px) 0 40px; text-align: center; }
.admin-content h1 { margin-top: 0; }
.admin-content .auth-intro { margin-bottom: 28px; }
.module-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.module-card {
    display: flex;
    min-height: 175px;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 10px;
    padding: 22px;
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text);
    background: var(--surface);
    text-align: left;
    text-decoration: none;
    transition: border-color .16s ease, transform .16s ease;
}
.module-card strong { font-size: 16px; }
.module-card > span:last-child { color: var(--text-secondary); font-size: 12px; }
.module-icon { color: var(--accent); font-size: 26px; font-weight: 700; }
.module-card-primary { border-color: #3989ec; background: linear-gradient(145deg, #163253, var(--surface)); }
.module-card:not(:disabled):hover { border-color: var(--accent); transform: translateY(-2px); }
.module-card:disabled { opacity: .55; cursor: not-allowed; }
.forget-tv-form { margin-top: 24px; }

@media (max-width: 850px) {
    .module-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 520px) {
    .auth-screen { padding: 16px; }
    .auth-card { padding: 24px; }
    .module-grid { grid-template-columns: 1fr; }
    .module-card { min-height: 130px; }
}
