:root {
  --bg: #080d1a;
  --bg-2: #0b1324;
  --panel: #0f1a2e;
  --panel-2: #152238;
  --border: #22304a;
  --border-strong: #32425f;
  --text: #dde6f3;
  --muted: #7488a6;
  --accent: #4fd1c5;
  --accent-2: #2fb3a6;
  --orange: #ef8a43;
  --danger: #f0616f;
  --warn: #e3b341;
  --radius: 12px;
  --nav-w: 232px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--text); overflow: hidden; }
code, pre, .mono-sm { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; }
button { font: inherit; color: inherit; cursor: pointer; }
input, select { font: inherit; color: var(--text); }
a { color: inherit; text-decoration: none; }
h1 { font-size: 22px; margin: 0; }
h2 { font-size: 15px; margin: 0; font-weight: 600; }

/* Buttons */
.btn { background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px; padding: 7px 13px; white-space: nowrap; transition: border-color .15s, background .15s; }
.btn:hover { border-color: var(--border-strong); }
.btn.primary { background: var(--accent-2); border-color: var(--accent-2); color: #042720; font-weight: 600; }
.btn.primary:hover { background: var(--accent); }
.btn.danger { color: var(--danger); }
.btn.small { padding: 4px 10px; font-size: 12.5px; }
.btn.icon { padding: 7px 10px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.icon-btn { background: none; border: none; color: var(--muted); padding: 4px 7px; border-radius: 6px; }
.icon-btn:hover { color: var(--text); background: var(--panel-2); }

/* App layout */
#app { display: grid; grid-template-columns: var(--nav-w) 1fr; height: 100vh; }
.nav { background: var(--bg-2); border-right: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; }
.nav-brand { display: flex; align-items: center; gap: 11px; padding: 18px 18px; font-weight: 650; font-size: 17px; }
.nav-brand img { filter: drop-shadow(0 0 7px rgba(79,209,197,.4)); }
.nav-links { flex: 1; overflow-y: auto; padding: 6px 10px; display: flex; flex-direction: column; gap: 2px; }
.nav-link { display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 9px; color: var(--muted); font-weight: 500; }
.nav-link:hover { background: var(--panel); color: var(--text); }
.nav-link.active { background: linear-gradient(90deg, rgba(79,209,197,.14), transparent); color: var(--text); box-shadow: inset 2px 0 0 var(--accent); }
.nav-ico { width: 18px; height: 18px; display: inline-flex; }
.nav-ico svg { width: 18px; height: 18px; }
.nav-foot { border-top: 1px solid var(--border); padding: 12px; }
.nav-user { display: flex; align-items: center; gap: 10px; }
.nav-avatar { width: 32px; height: 32px; border-radius: 9px; background: #1b3350; color: var(--accent); display: grid; place-items: center; font-weight: 700; }
.nav-user-meta { flex: 1; min-width: 0; }
.nav-user-name { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-user-role { font-size: 11px; color: var(--muted); }

.main { min-width: 0; overflow-y: auto; height: 100vh; }
.view { padding: 22px 28px 48px; max-width: 1240px; margin: 0 auto; display: flex; flex-direction: column; gap: 18px; }

/* Topbar + profile dropdown */
.topbar { position: sticky; top: 0; z-index: 15; height: 54px; display: flex; align-items: center; justify-content: space-between; padding: 0 28px; background: rgba(8,13,26,.82); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
.topbar-title { font-size: 13px; color: var(--muted); font-weight: 500; letter-spacing: .02em; }
.demo-badge { margin-left: auto; margin-right: 16px; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--orange); color: var(--orange); font-size: 11px; font-weight: 600; letter-spacing: .06em; }
.demo-badge[hidden] { display: none; }
.profile { position: relative; }
.profile-btn { display: flex; align-items: center; gap: 9px; background: var(--panel); border: 1px solid var(--border); border-radius: 22px; padding: 5px 12px 5px 5px; }
.profile-btn:hover { border-color: var(--border-strong); }
.profile-avatar { width: 28px; height: 28px; border-radius: 50%; background: #1b3350; color: var(--accent); display: grid; place-items: center; font-weight: 700; font-size: 13px; }
.profile-avatar.lg { width: 40px; height: 40px; font-size: 16px; }
.profile-uname { font-size: 13px; font-weight: 600; }
.caret { width: 14px; height: 14px; color: var(--muted); display: inline-flex; }
.caret svg { width: 14px; height: 14px; }
.profile-menu { position: absolute; right: 0; top: calc(100% + 8px); width: 234px; background: var(--panel); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 16px 44px rgba(0,0,0,.55); padding: 8px; z-index: 20; }
.profile-menu[hidden] { display: none; }
.profile-head { display: flex; align-items: center; gap: 11px; padding: 8px 8px 10px; }
.profile-name { font-weight: 600; font-size: 14px; }
.profile-role { font-size: 12px; color: var(--muted); }
.menu-sep { height: 1px; background: var(--border); margin: 4px 0; }
.menu-item { width: 100%; display: flex; align-items: center; gap: 10px; background: none; border: none; color: var(--text); padding: 9px 10px; border-radius: 8px; font-size: 13.5px; text-align: left; }
.menu-item:hover:not(:disabled) { background: var(--panel-2); }
.menu-item:disabled { opacity: .5; cursor: not-allowed; }
.menu-ico { width: 18px; text-align: center; }
.menu-note { margin-left: auto; font-size: 11px; color: var(--muted); }
.nav-foot-note { font-size: 11.5px; color: var(--muted); text-align: center; }
.view-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.view-sub { color: var(--muted); font-size: 12.5px; }
.back { color: var(--muted); font-size: 13px; }
.back:hover { color: var(--text); }

/* Cards */
.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--border); }

/* KPIs */
.kpi-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; }
.kpi { padding: 16px; display: flex; flex-direction: column; gap: 4px; position: relative; }
.kpi-value { font-size: 30px; font-weight: 700; letter-spacing: -.02em; }
.kpi-label { color: var(--muted); font-size: 12.5px; }
.kpi::before { content: ''; position: absolute; left: 0; top: 14px; bottom: 14px; width: 3px; border-radius: 2px; background: var(--muted); }
.kpi-ok::before { background: var(--accent); }
.kpi-warn::before { background: var(--warn); }
.kpi-bad::before { background: var(--danger); }
.kpi-all::before { background: var(--orange); }

/* Gauges */
.gauge-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.gauge-card { padding: 18px; display: flex; justify-content: center; }
.donut { display: block; }

/* Usage ring (server detail) */
.usage-card { padding: 18px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.usage-ring { width: 104px; height: 104px; border-radius: 50%; display: grid; place-items: center; font-size: 20px; font-weight: 700;
  background: conic-gradient(var(--c) calc(var(--pct) * 1%), var(--border) 0); }
.usage-ring span { width: 78px; height: 78px; border-radius: 50%; background: var(--panel); display: grid; place-items: center; }
.usage-label { font-weight: 600; }
.usage-detail { color: var(--muted); font-size: 12px; }

/* Charts */
.charts-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.chart-box { padding: 10px 12px 12px; }
.chart-svg { width: 100%; height: 140px; display: block; }

/* Tables */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { text-align: left; color: var(--muted); font-weight: 500; font-size: 12px; padding: 10px 16px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--panel); }
.data-table td { padding: 11px 16px; border-bottom: 1px solid #141f33; }
.data-table tr:last-child td { border-bottom: none; }
.row-link { cursor: pointer; }
.row-link:hover td { background: var(--panel-2); }
.num { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); }
.ops { text-align: right; white-space: nowrap; }
.ops .icon-btn { visibility: hidden; }
tr:hover .ops .icon-btn { visibility: visible; }
.srv-name { font-weight: 600; }
.srv-sub { font-size: 12px; color: var(--muted); }
.mono-sm { font-size: 12px; color: var(--muted); }
.empty { color: var(--muted); padding: 28px 16px; text-align: center; font-size: 13.5px; }

/* Chips + dots */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 20px; font-size: 12px; background: var(--panel-2); border: 1px solid var(--border); }
.chip .dot { width: 7px; height: 7px; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.dot.ok, .chip.ok .dot { background: var(--accent); box-shadow: 0 0 6px var(--accent); }
.dot.warn, .chip.warn .dot { background: var(--warn); }
.dot.bad, .chip.bad .dot { background: var(--danger); }
.chip.ok { color: var(--accent); } .chip.warn { color: var(--warn); } .chip.bad { color: var(--danger); }

/* Mini bars (dashboard table) */
.minibar { display: flex; align-items: center; gap: 8px; }
.minibar-track { width: 70px; height: 6px; border-radius: 4px; background: var(--border); overflow: hidden; }
.minibar-fill { height: 100%; }
.minibar-val { font-size: 12px; color: var(--muted); min-width: 34px; }
.mini { width: 120px; }

/* Usage bars */
.ubar { padding: 10px 16px; border-bottom: 1px solid #141f33; }
.ubar:last-child { border-bottom: none; }
.ubar-head { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 6px; }
.ubar-val { color: var(--muted); }
.ubar-track { height: 8px; border-radius: 5px; background: var(--border); overflow: hidden; }
.ubar-fill { height: 100%; border-radius: 5px; }

/* Detail */
.detail-info { padding: 16px; }
.detail-title { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.detail-facts { display: flex; flex-wrap: wrap; gap: 20px; }
.fact { display: flex; flex-direction: column; gap: 2px; }
.fact-k { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.fact-v { font-size: 14px; font-weight: 500; }
.notes { margin: 0; padding: 4px 16px 16px 34px; color: var(--muted); line-height: 1.7; font-size: 13px; }

/* Tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); }
.tab { background: none; border: none; color: var(--muted); padding: 10px 16px; border-bottom: 2px solid transparent; font-weight: 500; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); border-bottom-color: var(--accent); }
.detail-panel { display: flex; flex-direction: column; gap: 18px; min-height: 420px; }
.ws-pane { height: 62vh; min-height: 420px; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; background: var(--panel); position: relative; }
.ws-pane.fm { background: var(--panel); }

/* Topology */
.topo-view { max-width: none; }
.topo-controls { display: flex; gap: 8px; align-items: center; }
.topo-canvas { position: relative; height: calc(100vh - 150px); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; cursor: grab;
  background-color: #070c17; background-image: radial-gradient(circle, #1a2944 1.2px, transparent 1.2px); background-size: 24px 24px; }
.topo-canvas.grabbing { cursor: grabbing; }
.topo-wrap { position: absolute; transform-origin: 0 0; }
.topo-links { position: absolute; left: 0; top: 0; overflow: visible; }
.topo-node { position: absolute; display: flex; align-items: center; gap: 10px; background: var(--panel); border: 1px solid var(--border-strong); border-radius: 11px; padding: 10px 13px; min-width: 150px; box-shadow: 0 6px 18px rgba(0,0,0,.35); }
.topo-root { background: linear-gradient(135deg, #123, var(--panel)); border-color: var(--accent-2); }
.topo-logo { font-size: 20px; }
.topo-group { border-color: var(--orange); }
.topo-badge { font-size: 9px; font-weight: 700; letter-spacing: .08em; color: #0a0a0a; background: var(--orange); padding: 2px 6px; border-radius: 5px; }
.topo-srv { cursor: pointer; min-width: 170px; transition: border-color .15s, transform .1s; }
.topo-srv:hover { border-color: var(--accent); transform: translateY(-1px); }
.topo-title { font-weight: 600; font-size: 13.5px; }
.topo-meta { font-size: 11.5px; color: var(--muted); }

/* Terminal + files panes */
.term-wrap { flex: 1; min-height: 0; padding: 8px 0 0 10px; background: #060b16; }
.term-wrap .xterm { height: 100%; }
.overlay { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(6,11,22,.88); }
.overlay .box { text-align: center; max-width: 440px; padding: 20px; }
.overlay .box p { color: var(--muted); }
.spinner { width: 26px; height: 26px; border: 3px solid var(--border); border-top-color: var(--accent); border-radius: 50%; margin: 0 auto 12px; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.fm-toolbar { display: flex; gap: 6px; padding: 10px 12px; border-bottom: 1px solid var(--border); background: var(--panel-2); align-items: center; }
.tb-label { color: var(--muted); font-size: 12px; }
.path-input, .sel { background: var(--bg); border: 1px solid var(--border); border-radius: 7px; padding: 6px 10px; font-size: 13px; }
.path-input { flex: 1; min-width: 0; font-family: ui-monospace, Consolas, monospace; }
.sel { cursor: pointer; }
.fm-body { flex: 1; overflow: auto; }
.fm-body.dragover { outline: 2px dashed var(--accent); outline-offset: -8px; }
.files { width: 100%; border-collapse: collapse; }
.files th { position: sticky; top: 0; background: var(--panel-2); text-align: left; font-weight: 500; color: var(--muted); font-size: 12px; padding: 8px 12px; border-bottom: 1px solid var(--border); }
.files td { padding: 6px 12px; border-bottom: 1px solid #141f33; white-space: nowrap; }
.files tr:hover td { background: var(--panel-2); }
.files td.name { width: 100%; max-width: 0; overflow: hidden; text-overflow: ellipsis; }
.files .entry { cursor: pointer; display: inline-flex; align-items: center; gap: 8px; }
.files .entry:hover { color: #fff; }
.files .ico { width: 18px; text-align: center; }
.fm-status { padding: 7px 12px; font-size: 12px; color: var(--muted); border-top: 1px solid var(--border); background: var(--panel-2); min-height: 30px; }
.progress { height: 3px; background: var(--border); border-radius: 2px; margin-top: 5px; overflow: hidden; }
.progress > div { height: 100%; background: var(--accent); width: 0; transition: width .15s; }

/* Logs */
.logs-card { display: flex; flex-direction: column; height: calc(100vh - 150px); }
.log-out { flex: 1; overflow: auto; padding: 8px 12px; font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; line-height: 1.55; background: #060b16; }
.log-line { white-space: pre-wrap; word-break: break-word; color: #c7d2e0; padding: 1px 0; border-bottom: 1px solid #0d1626; }
.live-toggle { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }

/* Dialogs + forms */
.dlg { background: var(--panel); color: var(--text); border: 1px solid var(--border); border-radius: 14px; padding: 0; width: min(560px, calc(100vw - 32px)); }
.dlg::backdrop { background: rgba(0,0,0,.6); }
.dlg form { padding: 22px; display: flex; flex-direction: column; gap: 13px; }
.dlg h2 { font-size: 18px; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--muted); }
.field input { background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 9px 11px; font-size: 14px; }
.field input:focus { outline: none; border-color: var(--accent); }
.dlg-actions { display: flex; gap: 8px; align-items: center; margin-top: 4px; }
.grow { flex: 1; }
.hint { font-size: 12.5px; color: var(--muted); margin: 0; line-height: 1.55; }
.hint.warn { color: var(--warn); }
.enroll-cmd { background: #060b16; border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; margin: 0; overflow-x: auto; font-size: 12.5px; line-height: 1.55; color: var(--accent); white-space: pre-wrap; word-break: break-all; }

/* Login */
.login-gate { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; background: radial-gradient(circle at 50% 28%, #10203a, var(--bg)); }
.login-gate[hidden] { display: none; }
.login-card { background: var(--panel); border: 1px solid var(--border); border-radius: 16px; padding: 32px; width: min(360px, calc(100vw - 32px)); display: flex; flex-direction: column; gap: 12px; text-align: center; box-shadow: 0 24px 60px rgba(0,0,0,.5); }
.login-card img { margin: 0 auto; filter: drop-shadow(0 0 14px rgba(79,209,197,.4)); }
.login-card h2 { font-size: 22px; }
.login-card input { background: var(--bg); border: 1px solid var(--border); border-radius: 9px; padding: 11px 12px; font-size: 15px; text-align: center; }
.login-card input:focus { outline: none; border-color: var(--accent); }
.login-card .btn { padding: 11px; }
.login-error { color: var(--danger); min-height: 16px; }

/* Toasts */
.toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 40; }
.toast { background: var(--panel-2); border: 1px solid var(--border); border-left: 3px solid var(--accent); padding: 10px 14px; border-radius: 8px; max-width: 380px; box-shadow: 0 6px 20px rgba(0,0,0,.45); }
.toast.error { border-left-color: var(--danger); }

@media (max-width: 920px) {
  :root { --nav-w: 68px; }
  .nav-brand span, .nav-link span:last-child, .nav-user-meta { display: none; }
  .nav-link { justify-content: center; }
  .kpi-row { grid-template-columns: repeat(2, 1fr); }
  .gauge-row, .charts-grid { grid-template-columns: 1fr; }
  .hide-sm { display: none; }
}

/* ---------- Settings / access management ---------- */
.stack { display: flex; flex-direction: column; gap: 16px; }
.settings-body { display: flex; flex-direction: column; gap: 16px; }
a.tab { display: inline-block; }
.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.toolbar .hint { max-width: 640px; }
.card-body { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.muted { color: var(--muted); }
.link { color: var(--accent); text-decoration: underline; }
.chips { display: flex; flex-wrap: wrap; gap: 5px; }
.chip.role { border-color: #2a4d59; color: #bfe9e4; }
.chip.role.admin { border-color: rgba(239,138,67,.55); color: var(--orange); background: rgba(239,138,67,.08); }
.chip.group { border-style: dashed; }
.chip-scope { color: var(--muted); font-size: 11px; }
.chip-via { color: var(--muted); font-size: 11px; }
.mini-chip { font-size: 10.5px; padding: 1px 7px; margin-left: 6px; vertical-align: 1px; }
.mini-chip.lock { color: var(--muted); }
code.perm { font-size: 11.5px; background: var(--bg); border: 1px solid var(--border); border-radius: 5px; padding: 1px 6px; color: #9fb4d1; }
.scope { display: inline-flex; align-items: center; gap: 6px; }
.scope-kind { font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); border: 1px solid var(--border); border-radius: 4px; padding: 0 5px; }
.scope.global { color: var(--orange); }
tr.inherited td { color: var(--muted); }
.bind-add { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 12px 16px; border-top: 1px solid var(--border); background: var(--panel-2); }
.bind-rows { display: flex; flex-direction: column; gap: 6px; margin-bottom: 6px; }
.bind-row { display: flex; align-items: center; gap: 8px; }
.bind-row .sel { flex: 1; min-width: 0; }
.check-wrap { display: flex; flex-direction: column; gap: 6px; }
.check-list { max-height: 210px; overflow: auto; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); padding: 4px; }
.check-row { display: flex; align-items: center; gap: 9px; padding: 6px 8px; border-radius: 6px; color: var(--text); font-size: 13.5px; cursor: pointer; }
.check-row:hover { background: var(--panel-2); }
.check-row input { accent-color: var(--accent); width: 15px; height: 15px; flex: none; }
.check-sub { color: var(--muted); font-size: 12px; }
.check-sub.block { display: block; margin-top: 2px; }
.perm-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px 18px; max-height: 46vh; overflow: auto; padding-right: 4px; }
.perm-area-title { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--orange); margin: 6px 0 2px 8px; }
.perm-row { align-items: flex-start; }
.perm-row input { margin-top: 2px; }
.dlg.wide { width: min(760px, calc(100vw - 32px)); }
.dlg form { max-height: calc(100vh - 48px); overflow: auto; }
.field select, .field-sel { background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 9px 11px; font-size: 14px; }
.field input:disabled { opacity: .6; }
.btn.danger-solid { background: var(--danger); border-color: var(--danger); color: #2a0509; font-weight: 600; }
.secret-box { display: flex; align-items: center; gap: 10px; background: #060b16; border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; }
.secret-box code { flex: 1; color: var(--accent); font-size: 15px; word-break: break-all; }
.danger-zone { border-color: rgba(240,97,111,.35); }
.danger-zone .card-head h2 { color: var(--danger); }
.row-actions { flex-direction: row; flex-wrap: wrap; gap: 8px; }
@media (max-width: 900px) {
  .grid-2, .form-grid, .perm-grid { grid-template-columns: 1fr; }
  .tabs { overflow-x: auto; }
}
.chip { white-space: nowrap; }

/* ---------- Processes, CPU and memory insight ---------- */
.insight-row { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 16px; }
.insight-row.equal { grid-template-columns: 1fr 1fr; }
.seg { display: inline-flex; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 2px; }
.seg-btn { background: none; border: none; color: var(--muted); padding: 5px 12px; border-radius: 6px; font-size: 12.5px; }
.seg-btn.active { background: var(--panel-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--border-strong); }
.proc-toolbar { display: flex; gap: 10px; align-items: center; padding: 10px 16px; border-bottom: 1px solid var(--border); }
.proc-filter { max-width: 300px; }
.proc-body { max-height: 460px; overflow: auto; }
.proc-table td { padding: 7px 14px; font-size: 13px; }
.proc-table th { padding: 8px 14px; }
.proc-table th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
.proc-table th.sortable:hover, .proc-table th.sorted { color: var(--text); }
.proc-name { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-weight: 500; }
.proc-cmd { max-width: 420px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #9fb4d1; }
.proc-note { padding: 6px 16px 10px; }
.proc-note:empty { display: none; }
.tag { font-size: 10.5px; font-weight: 500; padding: 1px 6px; border-radius: 4px; border: 1px solid var(--border); color: var(--muted); }
.tag-pm2 { color: #b9a5ff; border-color: #4a3f7a; }
.tag-ctr { color: #7cc7ff; border-color: #2c4f70; }
.tag-run { color: var(--accent); border-color: #1f5a54; }
.pbar { display: inline-flex; flex-direction: column; align-items: flex-end; gap: 3px; min-width: 86px; }
.pbar-val { font-variant-numeric: tabular-nums; color: var(--text); font-size: 12.5px; }
.pbar-track { width: 86px; height: 4px; border-radius: 3px; background: var(--border); overflow: hidden; }
.pbar-fill { height: 100%; border-radius: 3px; }
.link-quiet { color: var(--text); text-decoration: none; border-bottom: 1px dotted var(--border-strong); }
.link-quiet:hover { color: var(--accent); }
.busiest { padding: 12px 16px 16px; }
.busy-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.busy-title { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--orange); margin-bottom: 8px; }
.busy-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 7px 8px; border-radius: 8px; color: var(--text); text-decoration: none; }
.busy-row:hover { background: var(--panel-2); }
.busy-name { display: flex; flex-direction: column; min-width: 0; font-weight: 500; font-size: 13px; }
.busy-sub { color: var(--muted); font-size: 11.5px; font-weight: 400; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.detail-facts.small .fact-v { font-size: 13px; }
.core-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px 14px; }
.core { display: grid; grid-template-columns: 42px 1fr 38px; align-items: center; gap: 8px; font-size: 12px; }
.core-label { color: var(--muted); font-family: ui-monospace, Consolas, monospace; }
.core-track { height: 6px; border-radius: 4px; background: var(--border); overflow: hidden; }
.core-fill { height: 100%; border-radius: 4px; transition: width .4s; }
.core-val { text-align: right; font-variant-numeric: tabular-nums; }
.mem-bar { display: flex; height: 14px; border-radius: 7px; overflow: hidden; background: var(--border); }
.mem-seg { height: 100%; transition: width .4s; }
.mem-seg.used, .mem-dot.used { background: var(--accent-2); }
.mem-seg.cache, .mem-dot.cache { background: #5b6fd6; }
.mem-seg.free, .mem-dot.free { background: #2a3a55; }
.mem-legends { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12.5px; color: var(--muted); }
.mem-legend { display: inline-flex; align-items: center; gap: 6px; }
.mem-dot { display: inline-block; width: 9px; height: 9px; border-radius: 2px; }
@media (max-width: 1100px) { .insight-row, .insight-row.equal { grid-template-columns: 1fr; } }
.busy-cols { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.busy-name { flex: 1; }
.busy-row .minibar { flex: none; }
.busy-row .minibar-track { width: 48px; }

/* ---------- Terminal workspace ---------- */
.term-host[hidden], .detail-panel[hidden] { display: none !important; }
.term-ws { display: flex; flex-direction: column; height: calc(100vh - 210px); min-height: 360px; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: #060b16; }
.term-ws.fullscreen { position: fixed; inset: 0; z-index: 60; height: auto; min-height: 0; border-radius: 0; border: none; }
.term-bar { display: flex; align-items: center; gap: 6px; padding: 6px 8px; background: var(--panel-2); border-bottom: 1px solid var(--border); min-height: 42px; }
.term-tabs { display: flex; gap: 4px; overflow-x: auto; min-width: 0; scrollbar-width: thin; }
.term-tab { display: inline-flex; align-items: center; gap: 7px; padding: 5px 6px 5px 10px; border-radius: 7px; color: var(--muted); cursor: pointer; white-space: nowrap; border: 1px solid transparent; font-size: 13px; }
.term-tab:hover { color: var(--text); background: rgba(255,255,255,.03); }
.term-tab.active { color: var(--text); background: #060b16; border-color: var(--border-strong); }
.term-tab-title { max-width: 160px; overflow: hidden; text-overflow: ellipsis; }
.term-tab-x { background: none; border: none; color: var(--muted); width: 20px; height: 20px; border-radius: 5px; line-height: 1; font-size: 15px; padding: 0; }
.term-tab-x:hover { background: var(--border); color: var(--text); }
.term-tab-add { background: none; border: 1px dashed var(--border-strong); color: var(--muted); width: 28px; height: 28px; border-radius: 7px; font-size: 16px; flex: none; }
.term-tab-add:hover:not(:disabled) { color: var(--accent); border-color: var(--accent); }
.term-tab-add:disabled { opacity: .4; cursor: not-allowed; }
.term-rename { width: 120px; background: var(--bg); border: 1px solid var(--accent); border-radius: 5px; color: var(--text); font-size: 13px; padding: 1px 6px; }
.term-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); flex: none; }
.term-dot.connected { background: var(--accent); box-shadow: 0 0 6px var(--accent); }
.term-dot.connecting { background: var(--warn); animation: term-pulse 1s infinite alternate; }
.term-dot.down { background: var(--danger); }
@keyframes term-pulse { from { opacity: .35; } to { opacity: 1; } }
.term-tools { display: flex; align-items: center; gap: 2px; flex: none; }
.term-tool { background: none; border: none; color: var(--muted); padding: 5px 9px; border-radius: 6px; font-size: 12.5px; }
.term-tool:hover { color: var(--text); background: var(--border); }
.term-sep { width: 1px; height: 18px; background: var(--border); margin: 0 4px; }
.term-stage { position: relative; flex: 1; min-height: 0; }
.term-session { position: absolute; inset: 0; display: none; }
.term-session.active { display: flex; flex-direction: column; }
.term-session .term-wrap { flex: 1; min-height: 0; padding: 8px 0 0 10px; background: #060b16; }
.term-session .term-wrap .xterm { height: 100%; }
.term-session .overlay { z-index: 2; }
.term-session .overlay .row-actions { display: flex; gap: 8px; justify-content: center; margin-top: 10px; }
.term-empty { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; color: var(--muted); gap: 8px; }
@media (max-width: 900px) { .term-tools .term-tool:not(:last-child) { display: none; } .term-tools .term-sep { display: none; } }
.stack-sm { display: flex; flex-direction: column; gap: 6px; }
.enroll-more summary { cursor: pointer; color: var(--muted); font-size: 12.5px; }
.enroll-more[open] summary { margin-bottom: 6px; }
.form-grid > * { min-width: 0; }
.field-sel { width: 100%; min-width: 0; max-width: 100%; }
.dlg form > .btn.small { align-self: flex-start; }
