:root {
  --bg: #0f1419; --bg2: #161c24; --bg3: #1d2530; --bg4: #243040;
  --border: #2a3441; --border2: #344254;
  --text: #e6edf3; --text2: #9fb0c3; --text3: #6b7d91;
  --accent: #3b82f6; --accent2: #60a5fa; --accent-bg: rgba(59,130,246,.14);
  --ok: #22c55e; --ok-bg: rgba(34,197,94,.14); --warn: #f59e0b; --warn-bg: rgba(245,158,11,.14); --crit: #ef4444; --crit-bg: rgba(239,68,68,.14); --info: #38bdf8; --info-bg: rgba(56,189,248,.14);
  --radius: 8px; --sidebar: 224px; --font: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif; --mono: "Cascadia Code", "JetBrains Mono", Consolas, "SF Mono", monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 13.5px/1.45 var(--font); }
a { color: var(--accent2); text-decoration: none; } a:hover { text-decoration: underline; }
h1 { font-size: 20px; font-weight: 650; margin: 0; letter-spacing: -.01em; } h2 { font-size: 15px; font-weight: 600; margin: 0 0 10px; } h3 { font-size: 13px; font-weight: 600; margin: 0 0 8px; color: var(--text2); text-transform: uppercase; letter-spacing: .04em; }
code, pre, .mono { font-family: var(--mono); font-size: 12.5px; }
pre { background: var(--bg); border: 1px solid var(--border); border-radius: 6px; padding: 10px 12px; overflow: auto; margin: 0; white-space: pre-wrap; word-break: break-word; max-height: 480px; }
button, .btn { font: inherit; color: var(--text); background: var(--bg3); border: 1px solid var(--border2); border-radius: 6px; padding: 6px 12px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; line-height: 1.2; white-space: nowrap; }
button:hover, .btn:hover { background: var(--bg4); text-decoration: none; } button:disabled { opacity: .5; cursor: default; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; } button.primary:hover { background: #2f6fe0; }
button.danger { background: var(--crit-bg); border-color: rgba(239,68,68,.4); color: #fca5a5; } button.danger:hover { background: rgba(239,68,68,.25); }
button.ghost { background: transparent; border-color: transparent; color: var(--text2); } button.ghost:hover { background: var(--bg3); color: var(--text); }
button.sm, .btn.sm { padding: 3px 8px; font-size: 12px; } button.xs { padding: 1px 6px; font-size: 11.5px; }
input, select, textarea { font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--border2); border-radius: 6px; padding: 6px 9px; outline: none; width: 100%; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-bg); }
input[type=checkbox] { width: auto; accent-color: var(--accent); } textarea { min-height: 90px; resize: vertical; font-family: var(--mono); font-size: 12.5px; }
label { display: block; font-size: 12px; color: var(--text2); margin-bottom: 4px; font-weight: 500; }
.field { margin-bottom: 12px; } .field .hint { font-size: 11.5px; color: var(--text3); margin-top: 3px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; } .row > select { width: auto; } .row.between { justify-content: space-between; } .grow { flex: 1; } .right { margin-left: auto; }
.grid { display: grid; gap: 14px; } .grid.c2 { grid-template-columns: repeat(2, 1fr); } .grid.c3 { grid-template-columns: repeat(3, 1fr); } .grid.c4 { grid-template-columns: repeat(4, 1fr); } .grid.c6 { grid-template-columns: repeat(6, 1fr); }
@media (max-width: 1100px) { .grid.c4, .grid.c6 { grid-template-columns: repeat(2, 1fr); } .grid.c3 { grid-template-columns: 1fr; } }
.muted { color: var(--text2); } .dim { color: var(--text3); } .small { font-size: 12px; } .tiny { font-size: 11px; } .nowrap { white-space: nowrap; } .truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .center { text-align: center; } .r { text-align: right; }
.ok { color: var(--ok); } .warn { color: var(--warn); } .crit { color: var(--crit); } .info { color: var(--info); }
.mt { margin-top: 14px; } .mb { margin-bottom: 14px; } .ml { margin-left: 8px; }

/* layout */
.app { display: flex; min-height: 100vh; }
.sidebar { width: var(--sidebar); background: var(--bg2); border-right: 1px solid var(--border); padding: 14px 10px; position: sticky; top: 0; height: 100vh; overflow-y: auto; flex-shrink: 0; display: flex; flex-direction: column; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 16px; font-weight: 700; font-size: 15px; letter-spacing: -.01em; }
.brand .logo { width: 28px; height: 28px; border-radius: 8px; background: var(--accent); display: grid; place-items: center; color: #fff; font-size: 14px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 6px; color: var(--text2); font-weight: 500; margin-bottom: 1px; }
.nav a:hover { background: var(--bg3); color: var(--text); text-decoration: none; } .nav a.active { background: var(--accent-bg); color: var(--accent2); }
.nav a .ico { width: 18px; text-align: center; opacity: .85; font-size: 14px; } .nav .sect { font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--text3); padding: 12px 10px 4px; font-weight: 600; }
.nav .count { margin-left: auto; font-size: 11px; background: var(--bg4); padding: 1px 7px; border-radius: 10px; color: var(--text2); } .nav .count.crit { background: var(--crit-bg); color: #fca5a5; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 10px 22px; border-bottom: 1px solid var(--border); background: var(--bg2); position: sticky; top: 0; z-index: 5; min-height: 52px; }
.topbar .search { width: 360px; } .topbar .conn { width: 8px; height: 8px; border-radius: 50%; background: var(--crit); } .topbar .conn.on { background: var(--ok); }
.content { padding: 20px 22px 40px; }
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; } .page-head .sub { color: var(--text2); font-size: 12.5px; }
.crumbs { font-size: 12.5px; color: var(--text3); margin-bottom: 6px; } .crumbs a { color: var(--text2); }

/* cards & tables */
.card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.card.pad0 { padding: 0; } .card .card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; } .card .card-head h2 { margin: 0; }
.stat { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; } .stat .v { font-size: 26px; font-weight: 650; letter-spacing: -.02em; line-height: 1.1; } .stat .l { font-size: 12px; color: var(--text2); margin-top: 4px; } .stat .s { font-size: 11.5px; color: var(--text3); margin-top: 2px; }
.stat.clickable { cursor: pointer; } .stat.clickable:hover { border-color: var(--border2); }
table { width: 100%; border-collapse: collapse; } th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; } th { font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--text3); font-weight: 600; background: var(--bg2); position: sticky; top: 0; }
tbody tr:hover { background: var(--bg3); } tr.clickable { cursor: pointer; } td.actions { text-align: right; white-space: nowrap; } .table-wrap { overflow: auto; } .card.pad0 table th { border-radius: 0; }
th.sortable { cursor: pointer; user-select: none; } th.sortable:hover { color: var(--text); }
.empty { padding: 40px; text-align: center; color: var(--text3); }
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 10px; background: var(--bg4); color: var(--text2); white-space: nowrap; line-height: 1.5; }
.badge.ok { background: var(--ok-bg); color: #86efac; } .badge.warn, .badge.warning { background: var(--warn-bg); color: #fcd34d; } .badge.crit, .badge.critical { background: var(--crit-bg); color: #fca5a5; } .badge.info { background: var(--info-bg); color: #7dd3fc; } .badge.accent { background: var(--accent-bg); color: var(--accent2); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--text3); margin-right: 6px; } .dot.on { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-bg); } .dot.off { background: var(--crit); }
.bar { height: 6px; background: var(--bg4); border-radius: 3px; overflow: hidden; width: 100%; } .bar i { display: block; height: 100%; background: var(--accent); border-radius: 3px; } .bar.warn i { background: var(--warn); } .bar.crit i { background: var(--crit); } .bar.ok i { background: var(--ok); }
.meter { display: flex; align-items: center; gap: 8px; min-width: 120px; } .meter .bar { width: 70px; } .meter span { font-size: 12px; min-width: 34px; text-align: right; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; } .tabs a, .tabs button { padding: 8px 14px; color: var(--text2); border: none; background: none; border-bottom: 2px solid transparent; margin-bottom: -1px; border-radius: 0; font-weight: 500; } .tabs a.active, .tabs button.active { color: var(--text); border-bottom-color: var(--accent); } .tabs a:hover { text-decoration: none; color: var(--text); }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 6px 14px; font-size: 13px; } .kv dt { color: var(--text3); } .kv dd { margin: 0; word-break: break-word; }
.toolbar { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; } .toolbar input, .toolbar select { width: auto; } .toolbar input[type=search] { width: 260px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; } .chip { font-size: 11.5px; padding: 2px 8px; border-radius: 10px; background: var(--bg4); color: var(--text2); }
.list { display: flex; flex-direction: column; gap: 6px; } .list .item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; background: var(--bg); border: 1px solid var(--border); border-radius: 6px; } .list .item:hover { border-color: var(--border2); }

/* modal & toast */
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 50; display: flex; align-items: flex-start; justify-content: center; padding: 60px 20px; overflow: auto; }
.modal { background: var(--bg2); border: 1px solid var(--border2); border-radius: 10px; width: 100%; max-width: 620px; box-shadow: 0 20px 60px rgba(0,0,0,.5); } .modal.wide { max-width: 960px; } .modal.xl { max-width: 1200px; }
.modal .m-head { display: flex; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--border); font-weight: 600; font-size: 15px; } .modal .m-body { padding: 18px; } .modal .m-foot { display: flex; gap: 8px; justify-content: flex-end; padding: 12px 18px; border-top: 1px solid var(--border); }
.toasts { position: fixed; right: 18px; bottom: 18px; z-index: 100; display: flex; flex-direction: column; gap: 8px; } .toast { background: var(--bg3); border: 1px solid var(--border2); border-left: 4px solid var(--accent); padding: 10px 14px; border-radius: 6px; min-width: 260px; max-width: 420px; box-shadow: 0 8px 24px rgba(0,0,0,.4); font-size: 13px; } .toast.ok { border-left-color: var(--ok); } .toast.err { border-left-color: var(--crit); } .toast.warn { border-left-color: var(--warn); }
.spinner { width: 16px; height: 16px; border: 2px solid var(--border2); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; } @keyframes spin { to { transform: rotate(360deg); } }
.loading { padding: 40px; text-align: center; color: var(--text3); }

/* terminal */
.term { background: #0b0f14; color: #d1d9e0; font-family: var(--mono); font-size: 12.5px; padding: 10px 12px; border-radius: 6px; height: 460px; overflow: auto; white-space: pre-wrap; word-break: break-all; border: 1px solid var(--border); }
.term-input { display: flex; gap: 8px; margin-top: 8px; } .term-input input { font-family: var(--mono); }
.log { background: #0b0f14; font-family: var(--mono); font-size: 12px; padding: 10px; border-radius: 6px; max-height: 420px; overflow: auto; white-space: pre-wrap; border: 1px solid var(--border); } .log .err { color: #fca5a5; }

/* charts */
.chart { width: 100%; height: 160px; } .chart svg { width: 100%; height: 100%; display: block; } .spark { width: 90px; height: 24px; vertical-align: middle; }
.legend { display: flex; gap: 14px; font-size: 11.5px; color: var(--text2); } .legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: middle; }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; background: radial-gradient(1200px 600px at 20% -10%, rgba(59,130,246,.18), transparent), var(--bg); } .login .card { width: 400px; padding: 28px; }
.login .brand { justify-content: center; font-size: 20px; padding-bottom: 20px; }

/* file browser */
.files td { padding: 5px 10px; } .files .dir { color: var(--accent2); font-weight: 500; }
.drop { border: 2px dashed var(--border2); border-radius: 8px; padding: 14px; text-align: center; color: var(--text3); } .drop.over { border-color: var(--accent); color: var(--accent2); }

/* misc */
.sev-row.critical td:first-child { box-shadow: inset 3px 0 0 var(--crit); } .sev-row.warning td:first-child { box-shadow: inset 3px 0 0 var(--warn); } .sev-row.info td:first-child { box-shadow: inset 3px 0 0 var(--info); }
.timeline { display: flex; gap: 2px; align-items: flex-end; height: 60px; } .timeline .b { flex: 1; background: var(--bg4); border-radius: 2px 2px 0 0; min-height: 2px; position: relative; } .timeline .b i { display: block; width: 100%; } .timeline .b i.critical { background: var(--crit); } .timeline .b i.warning { background: var(--warn); } .timeline .b i.info { background: var(--info); }
.uptime-strip { display: flex; gap: 1px; height: 18px; } .uptime-strip i { flex: 1; background: var(--ok); border-radius: 1px; } .uptime-strip i.down { background: var(--crit); } .uptime-strip i.none { background: var(--bg4); }
.code-editor { font-family: var(--mono); font-size: 12.5px; min-height: 320px; tab-size: 2; line-height: 1.5; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; } @media (max-width: 1100px) { .split { grid-template-columns: 1fr; } }
.side-panel { position: fixed; top: 0; right: 0; height: 100vh; width: 520px; background: var(--bg2); border-left: 1px solid var(--border2); z-index: 40; overflow: auto; padding: 18px; box-shadow: -10px 0 40px rgba(0,0,0,.4); }
kbd { font-family: var(--mono); font-size: 11px; background: var(--bg4); border: 1px solid var(--border2); border-radius: 4px; padding: 0 5px; }
@media (max-width: 800px) { .sidebar { display: none; } .content { padding: 14px; } .topbar .search { width: 100%; } .kv { grid-template-columns: 1fr; } }
::-webkit-scrollbar { width: 10px; height: 10px; } ::-webkit-scrollbar-thumb { background: var(--bg4); border-radius: 5px; border: 2px solid var(--bg); } ::-webkit-scrollbar-track { background: transparent; }
