﻿* { box-sizing: border-box; }
body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: #0f172a;
  color: #e2e8f0;
  margin: 0;
}
.bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  background: #111827;
  border-bottom: 1px solid #1f2937;
}
.wrap { padding: 24px; }
.card {
  max-width: 1400px;
  margin: 24px auto;
  background: #111827;
  padding: 24px;
  border-radius: 12px;
  border: 1px solid #1f2937;
  box-shadow: 0 10px 30px rgba(0,0,0,0.35);
}
.agents-table th, .agents-table td {
  vertical-align: middle;
}
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: #0f172a;
  border: 1px solid #334155;
  font-size: 12px;
  letter-spacing: 0.4px;
  text-transform: uppercase;
}
.worker-badge {
  color: #e2e8f0;
}
.host-label {
  margin-left: 10px;
  color: #94a3b8;
  font-size: 13px;
}
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.status-pill::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}
.status-pill.online {
  background: #052e1a;
  color: #86efac;
  border: 1px solid #14532d;
}
.status-pill.online::before {
  background: #22c55e;
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.8);
}
.status-pill.offline {
  background: #2b0b0b;
  color: #fca5a5;
  border: 1px solid #7f1d1d;
}
.status-pill.offline::before {
  background: #ef4444;
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.8);
}
.metric-icon {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  width: 96px;
  height: 72px;
  border-radius: 10px;
  background: #0b1220;
  border: 1px solid #1f2937;
  font-size: 12px;
  color: #e2e8f0;
  gap: 4px;
}
.metric-icon img {
  max-width: 72px;
  max-height: 48px;
}
.metric-icon.cpu {
  background: transparent;
  border: none;
  width: 88px;
  height: 88px;
}
.metric-icon.ram {
  background: transparent;
  border: none;
  width: 96px;
  height: 88px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.metric-icon.disk {
  background: transparent;
  border: none;
  width: 96px;
  height: 88px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.cpu-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 110px;
}
.ram-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 110px;
}
.disk-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 110px;
}
.metric-top {
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 2px;
}
.cpu-top {
  margin-bottom: var(--cpu-title-offset, 0px);
}
.gpu-top {
  margin-bottom: var(--gpu-title-offset, 0px);
}
.metric-sub {
  margin-top: 2px;
  font-size: var(--cpu-sub-size, 12px);
  color: #facc15;
  text-align: center;
}
.cpu-sub {
  margin-top: 0;
}
.cpu-model {
  margin: 0;
  font-size: 10px;
  color: #f8fafc;
  max-width: 140px;
  line-height: 1.1;
  text-align: center;
  max-height: 22px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.cpu-model-top {
  margin: 0;
}
.cpu-threads {
  font-size: var(--cpu-threads-size, 11px);
  color: #facc15;
  margin-top: 0;
}
.metric-icon::before, .metric-icon::after {
  content: "";
  position: absolute;
}
.metric-icon.cpu::before,
.metric-icon.cpu::after {
  display: none;
}
.cpu-text {
  position: absolute;
  top: 42%;
  left: 50%;
  transform: translate(-50%, -42%);
  color: #facc15;
  font-weight: 700;
  font-size: var(--cpu-temp-size, 12px);
  line-height: 1;
  white-space: nowrap;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
  text-align: center;
  width: 100%;
  pointer-events: none;
}
.cpu-icon {
  width: var(--icon-size, 64px);
  height: var(--icon-size, 64px);
  object-fit: contain;
}
.ram-img {
  width: var(--icon-size, 64px);
  height: var(--icon-size, 64px);
  object-fit: contain;
}
.ram-text {
  position: absolute;
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%);
  font-weight: 700;
  font-size: var(--metric-text-size, 12px);
  color: #fde047;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
  white-space: nowrap;
}
.disk-img {
  width: var(--icon-size, 64px);
  height: var(--icon-size, 64px);
  object-fit: contain;
}
.disk-text {
  position: absolute;
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%);
  font-weight: 700;
  font-size: var(--metric-text-size, 12px);
  color: #fde047;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
  white-space: nowrap;
}
.metric-icon.ram {
  background: transparent;
  border: none;
  box-shadow: none;
}
.metric-icon.disk {
  background: transparent;
  border: none;
  box-shadow: none;
}
.metric-text {
  font-weight: 600;
  font-size: 11px;
  text-align: center;
}
.agent-block {
  padding: 12px 0 18px;
  border-top: 1px solid #1f2937;
}
.agent-block:first-of-type {
  border-top: none;
  padding-top: 0;
}
.agent-title {
  font-weight: 600;
  margin-bottom: 10px;
}
.gpu-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
}
.gpu-inline {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  min-height: 110px;
}
.gpu-cell {
  vertical-align: middle;
}
.agents-table tbody td.gpu-cell {
  padding-top: var(--gpu-cell-pad, 8px);
}
.gpu-inline .gpu-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  justify-content: flex-start;
  width: 92px;
  margin-top: var(--gpu-item-offset, 6px);
}
.gpu-model {
  font-size: 10px;
  color: #f8fafc;
  text-align: center;
  max-width: 140px;
  line-height: 1.1;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 2;
  top: -18px;
}
.gpu-model-empty {
  opacity: 0;
}
.gpu-square {
  position: relative;
  background: #0b1220;
  border: 1px solid #1f2937;
  border-radius: 10px;
  padding: 10px;
  width: 64px;
  height: 64px;
  min-height: 64px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 1;
  margin-top: 6px;
}
.gpu-square.ok {
  background: #2a2304;
  border-color: #a16207;
  box-shadow: inset 0 0 18px rgba(250, 204, 21, 0.15);
}
.gpu-square.missing {
  background: #050505;
  border-color: #2b2b2b;
}
.gpu-util {
  font-size: 13px;
  font-weight: 700;
  color: #fde047;
}
.gpu-temp {
  font-size: 18px;
  font-weight: 800;
  color: #fef08a;
}
.gpu-mini {
  display: flex;
  gap: 6px;
  margin-top: 4px;
  font-size: 10px;
  color: #e2e8f0;
  opacity: 0.9;
}
.gpu-x {
  font-size: 28px;
  font-weight: 900;
  color: #ef4444;
  text-align: center;
}
.muted {
  color: #94a3b8;
  font-size: 13px;
}
input {
  width: 100%;
  padding: 10px;
  margin: 6px 0 12px;
  border-radius: 8px;
  border: 1px solid #334155;
  background: #0f172a;
  color: #e2e8f0;
}
button {
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid #334155;
  background: #2563eb;
  color: #fff;
  cursor: pointer;
}
button.danger {
  background: #b91c1c;
  border-color: #7f1d1d;
  margin-top: 6px;
}
button.danger-outline {
  background: transparent;
  color: #fca5a5;
  border-color: #7f1d1d;
  margin-top: 6px;
}
button.link {
  background: transparent;
  color: #93c5fd;
  border: none;
}
.error { color: #f87171; }

.bulk-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.bulk-title {
  font-weight: 600;
}
.bulk-top {
  margin: 10px 0 16px;
}

table {
  width: 100%;
  border-collapse: collapse;
}
th, td {
  border-bottom: 1px solid #1f2937;
  padding: 10px;
  text-align: left;
}
.agents-table th.gpu-header {
  vertical-align: middle;
  padding-top: 10px;
  padding-bottom: 10px;
  line-height: normal;
}
.agents-table tbody td {
  padding-top: var(--row-pad, 4px);
  padding-bottom: var(--row-pad, 4px);
}
