:root {
    --bg-primary: #f5f5f7;
    --bg-secondary: #ffffff;
    --border-color: rgba(0, 0, 0, 0.1);
    --text-primary: #1a1a2e;
    --text-secondary: rgba(0, 0, 0, 0.68);
    --text-muted: rgba(0, 0, 0, 0.5);
    --accent-purple: #7c3aed;
    --accent-purple-light: #a78bfa;
    --accent-green: #16a34a;
    --accent-red: #dc2626;
}

html { filter: invert(1) hue-rotate(180deg); }
html img, html .no-invert { filter: invert(1) hue-rotate(180deg); }
html.light-mode, html.light-mode img, html.light-mode .no-invert { filter: none; }
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: linear-gradient(135deg, #0f0f1a 0%, #1a1a2e 50%, #16213e 100%);
    color: var(--text-primary);
    font-family: Inter, -apple-system, BlinkMacSystemFont, sans-serif;
}
.auth-container { width: 100%; max-width: 440px; }
.auth-card {
    padding: 48px 40px;
    border: 1px solid var(--border-color);
    border-radius: 24px;
    background: var(--bg-secondary);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3);
}
.brand-logo {
    width: 200px;
    height: 45px;
    margin: 0 auto 16px;
    background: url('/images/tv_app_builder_logo.png') center / contain no-repeat;
}
.reseller-badge {
    display: flex;
    width: max-content;
    align-items: center;
    gap: 8px;
    margin: 0 auto;
    padding: 6px 14px;
    border-radius: 8px;
    background: linear-gradient(135deg, #7c3aed, #9333ea);
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .5px;
    text-transform: uppercase;
}
.reseller-badge i { color: #fbbf24; }
.auth-header { margin-bottom: 30px; text-align: center; }
.auth-header h1 { margin: 30px 0 8px; font-size: 1.5rem; }
.auth-header p { color: var(--text-muted); font-size: 14px; line-height: 1.55; }
.message {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 10px;
    margin-bottom: 22px;
    padding: 14px 16px;
    border: 1px solid;
    border-radius: 10px;
    font-size: 14px;
    line-height: 1.5;
}
.message.error { border-color: rgba(220,38,38,.25); background: rgba(220,38,38,.1); color: var(--accent-red); }
.message.success { border-color: rgba(22,163,74,.25); background: rgba(22,163,74,.1); color: var(--accent-green); }
.form-group { margin-bottom: 20px; }
.form-group label { display: block; margin-bottom: 8px; color: var(--text-secondary); font-size: 13px; font-weight: 500; }
.input-wrapper { position: relative; }
.input-wrapper > i { position: absolute; top: 50%; left: 16px; transform: translateY(-50%); color: var(--text-muted); }
.form-group input {
    width: 100%;
    padding: 16px 46px 16px 48px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: rgba(255,255,255,.05);
    color: var(--text-primary);
    font: inherit;
}
.form-group input:focus { outline: none; border-color: var(--accent-purple); background: rgba(124,58,237,.08); }
.password-toggle {
    position: absolute;
    top: 50%;
    right: 12px;
    padding: 6px;
    transform: translateY(-50%);
    border: 0;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
}
.btn-primary {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 8px;
    padding: 16px 24px;
    border: 0;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--accent-purple), #9333ea);
    color: #fff;
    font: inherit;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 8px 24px rgba(124,58,237,.35); }
.back-link { margin-top: 26px; text-align: center; }
.back-link a { color: var(--accent-purple); font-size: 14px; font-weight: 600; text-decoration: none; }
.back-link a:hover { text-decoration: underline; }
.hint { display: block; margin-top: 7px; color: var(--text-muted); font-size: 12px; }
.theme-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    cursor: pointer;
}
@media (max-width: 480px) { .auth-card { padding: 36px 24px; } }
