* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
    background: #0f172a;
    color: #e2e8f0;
}
.wrap { max-width: 1680px; margin: 0 auto; padding: 24px; }
.header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
h1, h2 { margin: 0; }
h1 { font-size: 26px; }
h2 { font-size: 18px; }
.meta, .hint { color: #94a3b8; font-size: 13px; margin-top: 6px; }
.actions, .server-form, .panel-head {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
input, select {
    background: #111827;
    color: #e2e8f0;
    border: 1px solid #334155;
    border-radius: 8px;
    padding: 9px 11px;
}
input:focus, select:focus { outline: 1px solid #38bdf8; }
.server-form input { min-width: 220px; }
.server-form #serverUrl { min-width: 320px; }
.server-form #serverKey { min-width: 280px; }
.check { color: #cbd5e1; font-size: 14px; }
.btn {
    border: 0;
    border-radius: 8px;
    padding: 9px 14px;
    color: #fff;
    cursor: pointer;
    font-weight: 600;
}
.btn-primary { background: #2563eb; }
.btn-secondary { background: #475569; }
.btn-danger { background: #dc2626; }
.btn-small { padding: 6px 9px; font-size: 12px; }
.btn:hover { filter: brightness(1.08); }
.panel {
    background: #111827;
    border: 1px solid #1f2937;
    border-radius: 14px;
    padding: 16px;
    margin-bottom: 18px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
}
.panel-head { justify-content: space-between; margin-bottom: 14px; }
.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}
.card {
    background: linear-gradient(135deg, #1e293b, #111827);
    border: 1px solid #334155;
    border-radius: 14px;
    padding: 16px;
}
.card h3 {
    margin: 0 0 8px;
    font-size: 12px;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: .5px;
}
.card .value { font-size: 24px; font-weight: 800; }
.pos { color: #4ade80; }
.neg { color: #f87171; }
.warn { color: #facc15; }
.table-wrap { overflow-x: auto; border-radius: 10px; border: 1px solid #253044; }
.table {
    width: 100%;
    border-collapse: collapse;
    color: #e2e8f0;
    font-size: 14px;
}
.table th, .table td {
    padding: 10px 12px;
    border-bottom: 1px solid #253044;
    vertical-align: middle;
}
.table th {
    text-align: left;
    background: #1e293b;
    color: #94a3b8;
    font-size: 12px;
    text-transform: uppercase;
    white-space: nowrap;
}
.table th[data-sort] { cursor: pointer; user-select: none; }
.table th.sorted { color: #38bdf8; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.badge {
    display: inline-block;
    border-radius: 999px;
    padding: 3px 8px;
    font-size: 12px;
    font-weight: 700;
}
.badge-ok { background: #064e3b; color: #86efac; }
.badge-err { background: #7f1d1d; color: #fecaca; }
.badge-off { background: #334155; color: #cbd5e1; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.error-text { color: #fca5a5; min-height: 18px; font-size: 13px; margin: 8px 0; }
.login-modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(2, 6, 23, 0.9);
}
.login-card {
    width: min(420px, calc(100% - 32px));
    background: #111827;
    border: 1px solid #334155;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.4);
}
.login-card input { width: 100%; margin-top: 14px; }
.login-card .btn { width: 100%; margin-top: 8px; }
.empty {
    color: #94a3b8;
    text-align: center;
    padding: 24px;
}
@media (max-width: 900px) {
    .server-form input, .server-form #serverUrl, .server-form #serverKey { min-width: 100%; }
}
