:root {
    --bg: #0a0e17;
    --card: #121826;
    --border: rgba(255,255,255,0.08);
    --text: #e2e8f0;
    --muted: #94a3b8;
    --accent: #3b82f6;
    --green: #10b981;
    --red: #ef4444;
    --amber: #f59e0b;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: 'Segoe UI', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; }
.auth-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; }
.login-container { width: 100%; max-width: 420px; }
.login-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 32px;
}
.login-header { text-align: center; margin-bottom: 24px; }
.logo-badge {
    width: 64px; height: 64px; margin: 0 auto 12px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6, #10b981);
    display: flex; align-items: center; justify-content: center;
    font-weight: 800; color: #fff;
}
.login-header h1 { font-size: 20px; margin-bottom: 6px; }
.login-header p { color: var(--muted); font-size: 14px; }
label { display: block; font-size: 12px; color: var(--muted); margin: 14px 0 6px; text-transform: uppercase; letter-spacing: .5px; }
input, select {
    width: 100%; padding: 11px 14px; border-radius: 10px;
    border: 1px solid var(--border); background: #1e293b; color: var(--text);
}
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 10px 16px; border-radius: 10px; border: none; cursor: pointer;
    font-weight: 600; font-size: 14px;
}
.btn-primary { background: linear-gradient(135deg, #3b82f6, #2563eb); color: #fff; width: 100%; margin-top: 18px; }
.btn-success { background: var(--green); color: #fff; }
.btn-danger { background: var(--red); color: #fff; }
.btn-secondary { background: #334155; color: #fff; }
.alert { padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; font-size: 13px; }
.alert-error { background: rgba(239,68,68,.15); border: 1px solid rgba(239,68,68,.3); color: #fca5a5; }
.top-nav {
    display: flex; justify-content: space-between; align-items: center;
    padding: 14px 20px; border-bottom: 1px solid var(--border); background: rgba(10,14,23,.95);
    position: sticky; top: 0; z-index: 10; flex-wrap: wrap; gap: 10px;
}
.brand { font-weight: 700; }
.brand span { color: var(--muted); font-weight: 400; font-size: 13px; margin-left: 8px; }
.nav-links { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; font-size: 14px; }
.nav-links a.active { color: #fff; font-weight: 700; }
.mode-badge { padding: 3px 10px; border-radius: 999px; font-size: 11px; text-transform: uppercase; font-weight: 700; }
.mode-demo { background: rgba(245,158,11,.2); color: #fbbf24; }
.mode-live { background: rgba(239,68,68,.2); color: #f87171; }
.user { color: var(--muted); }
.logout { color: var(--muted); }
.container { max-width: 1200px; margin: 0 auto; padding: 20px; }
.grid { display: grid; gap: 16px; }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.card {
    background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 18px;
}
.card h2, .card h3 { font-size: 15px; margin-bottom: 12px; color: #f8fafc; }
.stat-label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.stat-value { font-size: 24px; font-weight: 700; margin-top: 6px; }
.positive { color: var(--green); }
.negative { color: var(--red); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 10px 8px; border-bottom: 1px solid var(--border); text-align: left; }
th { color: var(--muted); font-size: 11px; text-transform: uppercase; }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.inline-form input, .inline-form select { width: auto; min-width: 120px; flex: 1; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 6px; }
.status-dot.on { background: var(--green); }
.status-dot.off { background: var(--muted); }
.settings-group { margin-bottom: 24px; }
.settings-group h3 { margin-bottom: 12px; font-size: 16px; }
.setting-row { margin-bottom: 14px; }
.setting-row small { display: block; color: var(--muted); margin-top: 4px; font-size: 12px; }
.toast {
    position: fixed; bottom: 20px; right: 20px; background: #1e293b; border: 1px solid var(--border);
    padding: 12px 16px; border-radius: 10px; display: none; z-index: 100;
}
@media (max-width: 640px) {
    .container { padding: 12px; }
    .stat-value { font-size: 20px; }
}
