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

:root {
    --bg: #0f1117;
    --surface: #1a1d27;
    --surface2: #242836;
    --border: #2e3347;
    --text: #e1e4ed;
    --text-dim: #8b8fa3;
    --accent: #6366f1;
    --accent-hover: #818cf8;
    --green: #22c55e;
    --red: #ef4444;
    --yellow: #f59e0b;
    --sidebar-w: 220px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    display: flex;
    min-height: 100vh;
}

#sidebar {
    width: var(--sidebar-w);
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: 20px 0;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    overflow-y: auto;
}

.logo {
    font-size: 1.3rem;
    font-weight: 700;
    padding: 0 20px 20px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 10px;
    color: var(--accent);
}

.nav-link {
    display: block;
    padding: 10px 20px;
    color: var(--text-dim);
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.15s;
}

.nav-link:hover { color: var(--text); background: var(--surface2); }
.nav-link.active { color: var(--accent); background: var(--surface2); border-right: 3px solid var(--accent); }

#content {
    margin-left: var(--sidebar-w);
    flex: 1;
    padding: 24px;
    max-width: 1200px;
}

h1 { font-size: 1.5rem; margin-bottom: 20px; }
h2 { font-size: 1.1rem; margin-bottom: 12px; color: var(--text-dim); }

/* Cards */
.stat-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
}

.stat-card .label { font-size: 0.8rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.5px; }
.stat-card .value { font-size: 1.8rem; font-weight: 700; margin-top: 4px; }
.stat-card .value.green { color: var(--green); }
.stat-card .value.red { color: var(--red); }
.stat-card .value.accent { color: var(--accent); }

/* Tables */
.table-wrap {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 24px;
}

table { width: 100%; border-collapse: collapse; }
th { background: var(--surface2); text-align: left; padding: 10px 12px; font-size: 0.8rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.5px; }
td { padding: 8px 12px; border-top: 1px solid var(--border); font-size: 0.85rem; }
tr:hover td { background: var(--surface2); }

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-red { background: rgba(239,68,68,0.15); color: var(--red); }
.badge-green { background: rgba(34,197,94,0.15); color: var(--green); }
.badge-yellow { background: rgba(245,158,11,0.15); color: var(--yellow); }
.badge-blue { background: rgba(99,102,241,0.15); color: var(--accent); }

/* Forms */
.form-row {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
    flex-wrap: wrap;
    align-items: flex-end;
}

input, select {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 8px 12px;
    color: var(--text);
    font-size: 0.85rem;
}

input:focus, select:focus { outline: none; border-color: var(--accent); }

label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-dim);
    margin-bottom: 4px;
}

.field { display: flex; flex-direction: column; }

button, .btn {
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 8px 16px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.15s;
}

button:hover, .btn:hover { background: var(--accent-hover); }

.btn-danger { background: var(--red); }
.btn-danger:hover { background: #dc2626; }

.btn-sm { padding: 4px 10px; font-size: 0.8rem; }
.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-dim);
}
.btn-outline:hover { background: var(--surface2); color: var(--text); }

/* Chart */
.chart-container {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 24px;
    position: relative;
    height: 280px;
}

/* Filters */
.filters {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
    flex-wrap: wrap;
    align-items: center;
}

/* Pagination */
.pagination {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-top: 16px;
}

/* Grid */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } }

/* Status dot */
.status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 6px;
}
.status-dot.on { background: var(--green); }
.status-dot.off { background: var(--red); }

.empty-state { text-align: center; padding: 40px; color: var(--text-dim); }

.mt-16 { margin-top: 16px; }
.mb-8 { margin-bottom: 8px; }
