:root {
    --bg: #0f1117;
    --surface: #1a1d27;
    --border: #2a2d3d;
    --accent: #6366f1;
    --accent-hover: #4f52d3;
    --success: #22c55e;
    --danger: #ef4444;
    --warning: #f59e0b;
    --text: #e2e8f0;
    --muted: #64748b;
    --sidebar-w: 220px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { background: var(--bg); color: var(--text); font-family: 'Inter', system-ui, sans-serif; display: flex; min-height: 100vh; }

/* ── SIDEBAR ── */
.sidebar {
    width: var(--sidebar-w);
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    padding: 1.5rem 0;
}
.sidebar .logo {
    font-size: 1.3rem;
    font-weight: 700;
    padding: 0 1.5rem 1.5rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1rem;
    color: var(--accent);
}
.sidebar ul { list-style: none; }
.sidebar ul li a {
    display: block;
    padding: .65rem 1.5rem;
    color: var(--muted);
    text-decoration: none;
    font-size: .9rem;
    transition: all .15s;
}
.sidebar ul li a:hover, .sidebar ul li a.active {
    color: var(--text);
    background: rgba(99,102,241,.12);
    border-right: 3px solid var(--accent);
}

/* ── CONTENT ── */
.content {
    margin-left: var(--sidebar-w);
    padding: 2rem;
    flex: 1;
}
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}
.page-header h1 { font-size: 1.5rem; }
.actions { display: flex; gap: .5rem; }

/* ── STATS GRID ── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}
.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1.2rem;
    text-align: center;
}
.stat-card .num { font-size: 2rem; font-weight: 700; }
.stat-card .label { font-size: .8rem; color: var(--muted); margin-top: .3rem; }
.stat-card.up .num { color: var(--success); }
.stat-card.down .num { color: var(--danger); }
.stat-card.warn .num { color: var(--warning); }

/* ── PANELS ── */
.panels { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1.2rem;
}
.panel h2 { font-size: 1rem; margin-bottom: 1rem; }

/* ── TABLE ── */
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { padding: .7rem 1rem; text-align: left; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 500; font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(255,255,255,.02); }

.table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }

/* ── BADGES ── */
.badge {
    display: inline-block;
    padding: .2rem .6rem;
    border-radius: 999px;
    font-size: .75rem;
    font-weight: 600;
}
.badge-up, .badge-sent { background: rgba(34,197,94,.15); color: var(--success); }
.badge-down, .badge-failed { background: rgba(239,68,68,.15); color: var(--danger); }
.badge-unknown, .badge-pending { background: rgba(245,158,11,.15); color: var(--warning); }
.badge-processed { background: rgba(99,102,241,.15); color: var(--accent); }
.badge-ignored { background: rgba(100,116,139,.15); color: var(--muted); }
.badge-admin { background: rgba(99,102,241,.15); color: var(--accent); }
.badge-staff { background: rgba(100,116,139,.15); color: var(--muted); }

/* ── BUTTONS ── */
.btn {
    padding: .5rem 1rem;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-size: .85rem;
    font-weight: 500;
    transition: background .15s;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); }
.btn-danger { background: rgba(239,68,68,.15); color: var(--danger); border: 1px solid rgba(239,68,68,.3); }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-sm { padding: .3rem .6rem; font-size: .75rem; }

/* ── MODALS ── */
.modal {
    position: fixed; inset: 0;
    background: rgba(0,0,0,.6);
    display: flex; align-items: center; justify-content: center;
    z-index: 100;
}
.modal.hidden { display: none; }
.modal-box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 2rem;
    width: 100%;
    max-width: 420px;
    display: flex;
    flex-direction: column;
    gap: .8rem;
}
.modal-box h2 { margin-bottom: .5rem; }
.modal-actions { display: flex; gap: .5rem; justify-content: flex-end; margin-top: .5rem; }

/* ── FORMS ── */
input, select, textarea {
    width: 100%;
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text);
    padding: .6rem .9rem;
    border-radius: 6px;
    font-size: .9rem;
    outline: none;
    transition: border .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
textarea { min-height: 100px; resize: vertical; }

/* ── LOGIN ── */
body.login-page { align-items: center; justify-content: center; }
.login-box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 2.5rem;
    width: 100%;
    max-width: 380px;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.login-box .logo { font-size: 1.8rem; font-weight: 700; color: var(--accent); text-align: center; }
.login-box h2 { text-align: center; font-size: 1rem; color: var(--muted); margin-top: -.5rem; }
.login-box button { width: 100%; padding: .75rem; }
.error { background: rgba(239,68,68,.1); color: var(--danger); border: 1px solid rgba(239,68,68,.3); padding: .6rem 1rem; border-radius: 6px; font-size: .85rem; }

/* ── SEND FORM ── */
.send-form { display: flex; flex-direction: column; gap: .8rem; max-width: 520px; margin-top: 1rem; }
#send-result { font-size: .85rem; }

/* ── MISC ── */
h1 { margin-bottom: 1.5rem; }
.muted { color: var(--muted); font-size: .85rem; }
.mt { margin-top: 1rem; }
pre { background: var(--bg); border: 1px solid var(--border); border-radius: 6px; padding: 1rem; font-size: .8rem; overflow-x: auto; white-space: pre-wrap; max-height: 200px; overflow-y: auto; }
