:root {
  color-scheme: light;
  --bg: #f6f7f8;
  --ink: #17202a;
  --muted: #66717d;
  --line: #dce1e6;
  --panel: #ffffff;
  --blue: #2869d8;
  --green: #0f8f68;
  --amber: #b56a05;
  --red: #bf2f3d;
  --violet: #7251b5;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.4;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px clamp(16px, 3vw, 34px);
  border-bottom: 1px solid var(--line);
  background: rgba(246, 247, 248, 0.94);
  backdrop-filter: blur(10px);
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 24px;
  font-weight: 720;
}

h2 {
  font-size: 15px;
  font-weight: 720;
}

.topbar p,
.panel-head span,
.metric-panel small,
.label {
  color: var(--muted);
  font-size: 12px;
}

.controls {
  display: flex;
  align-items: end;
  gap: 10px;
}

label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
}

input,
select,
button {
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

input,
select {
  min-width: 86px;
  padding: 0 10px;
}

button {
  padding: 0 14px;
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
  cursor: pointer;
}

button:disabled {
  opacity: 0.58;
  cursor: default;
}

.shell {
  width: min(1480px, 100%);
  margin: 0 auto;
  padding: 22px clamp(16px, 3vw, 34px) 40px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.metric-panel,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.metric-panel {
  display: grid;
  gap: 8px;
  min-height: 108px;
  padding: 16px;
}

.metric-panel strong {
  font-size: 31px;
  line-height: 1;
  font-weight: 760;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
  gap: 14px;
}

.panel {
  min-height: 270px;
  padding: 16px;
}

.panel.wide {
  grid-column: 1 / -1;
  min-height: 280px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

canvas {
  display: block;
  width: 100%;
  height: 220px;
}

.list {
  display: grid;
  gap: 10px;
}

.row {
  display: grid;
  gap: 8px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.row:first-child {
  border-top: 0;
  padding-top: 0;
}

.row-main {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.row-title {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 14px;
  font-weight: 700;
}

.row-meta {
  color: var(--muted);
  font-size: 12px;
}

.row-value {
  flex: 0 0 auto;
  font-weight: 720;
}

/* ── Contributor rows ─────────────────────────────────────────────────────── */
.contributor-row {
  padding: 8px 0;
}

.contrib-main {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  overflow: hidden;
}

.contrib-dot {
  flex: 0 0 8px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.contrib-badge {
  flex: 0 0 auto;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--line);
  color: var(--muted);
}

.contrib-badge.contrib-process { background: #e0f7fa; color: #006064; }
.contrib-badge.contrib-docker  { background: #fce4ec; color: #880e4f; }
.contrib-badge.contrib-k8s     { background: #ede7f6; color: #4527a0; }

.contrib-name {
  flex: 1 1 0;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 600;
}

.contrib-bar-wrap {
  flex: 0 0 64px;
  height: 6px;
  background: var(--line);
  border-radius: 3px;
  overflow: hidden;
}

.contrib-bar {
  display: block;
  height: 100%;
  border-radius: 3px;
  transition: width 0.3s ease;
}

.contrib-cpu {
  flex: 0 0 44px;
  text-align: right;
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.contrib-mem {
  flex: 0 0 52px;
  text-align: right;
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* Panel legend chips */
.panel-legend {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 11px;
}

.legend-swatch {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.bars {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
}

.bar {
  display: grid;
  gap: 4px;
}

.bar span {
  color: var(--muted);
  font-size: 11px;
}

.track {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: #eef1f4;
}

.fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: var(--green);
}

.fill.warn {
  background: var(--amber);
}

.fill.critical {
  background: var(--red);
}

.severity {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  color: #fff;
  font-size: 11px;
  font-weight: 720;
}

.severity.info {
  background: var(--blue);
}

.severity.warning {
  background: var(--amber);
}

.severity.critical,
.severity.emergency {
  background: var(--red);
}

.empty,
.error {
  padding: 16px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px;
}

.error {
  border-color: rgba(191, 47, 61, 0.35);
  color: var(--red);
}

@media (max-width: 860px) {
  .topbar {
    position: static;
    align-items: stretch;
    flex-direction: column;
  }

  .controls {
    align-items: stretch;
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  button {
    grid-column: 1 / -1;
  }

  .summary-grid,
  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .metric-panel {
    min-height: 92px;
  }
}
