* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  background: #0f1419;
  color: #e0e0e0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  padding: 16px;
  min-width: 320px;
}

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: #1a2332;
  border-radius: 10px;
  margin-bottom: 16px;
}
.header h1 { font-size: 18px; font-weight: 600; color: #60a5fa; }
.gpu-name { font-size: 13px; color: #888; }
.status { display: flex; align-items: center; gap: 6px; font-size: 12px; color: #34d399; }
.status-dot { width: 8px; height: 8px; background: #34d399; border-radius: 50%; }
.status.disconnected { color: #ef4444; }
.status.disconnected .status-dot { background: #ef4444; }
.status.warning { color: #fbbf24; }
.status.warning .status-dot { background: #fbbf24; }

.error-banner {
  background: rgba(251, 191, 36, 0.15);
  border: 1px solid #fbbf24;
  color: #fbbf24;
  padding: 10px 16px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 13px;
}

.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; margin-bottom: 16px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px; }

.card { background: #1a2332; border-radius: 10px; padding: 16px; }
.card-title { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: #666; margin-bottom: 12px; }
.section-label { font-size: 13px; font-weight: 600; color: #ccc; margin-bottom: 12px; padding-bottom: 8px; border-bottom: 1px solid #2a3544; }

.gauge-container { display: flex; align-items: center; gap: 16px; }
.gauge { position: relative; width: 80px; height: 80px; }
.gauge svg { transform: rotate(-90deg); }
.gauge-bg { fill: none; stroke: #2a3544; stroke-width: 8; }
.gauge-fill { fill: none; stroke: #60a5fa; stroke-width: 8; stroke-linecap: round; transition: stroke-dashoffset 0.5s; }
.gauge-text { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 18px; font-weight: 700; color: #60a5fa; }
.gauge-details { flex: 1; }
.gauge-details .label { font-size: 11px; color: #666; margin-bottom: 2px; }
.gauge-details .value { font-size: 14px; font-weight: 600; }

.freq-display { text-align: center; }
.freq-current { font-size: 36px; font-weight: 700; color: #60a5fa; }
.freq-unit { font-size: 14px; color: #666; }
.freq-sub { display: flex; justify-content: center; gap: 24px; margin-top: 8px; }
.freq-sub .item { text-align: center; }
.freq-sub .val { font-size: 14px; font-weight: 600; }
.freq-sub .lbl { font-size: 10px; color: #666; text-transform: uppercase; }

.power-display { text-align: center; }
.power-current { font-size: 36px; font-weight: 700; color: #fbbf24; }
.power-unit { font-size: 14px; color: #666; }
.power-bar-container { margin-top: 8px; }
.power-bar-track { height: 6px; background: #2a3544; border-radius: 3px; overflow: hidden; }
.power-bar-fill { height: 100%; background: #fbbf24; border-radius: 3px; transition: width 0.5s; width: 0%; }
.power-bar-labels { display: flex; justify-content: space-between; margin-top: 4px; font-size: 10px; color: #666; }

.bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.bar-row:last-child { margin-bottom: 0; }
.bar-label { width: 90px; font-size: 12px; color: #888; text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { flex: 1; height: 20px; background: #2a3544; border-radius: 4px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 4px; transition: width 0.5s; }
.bar-value { width: 45px; font-size: 13px; font-weight: 600; text-align: right; }

.sparkline-row { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.sparkline-row:last-child { margin-bottom: 0; }
.sparkline-label { width: 60px; font-size: 11px; color: #888; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sparkline { flex: 1; height: 30px; }
.sparkline-val { width: 40px; font-size: 12px; font-weight: 600; text-align: right; }

.clients-table { width: 100%; font-size: 12px; border-collapse: collapse; }
.clients-table th { text-align: left; color: #666; font-weight: 500; text-transform: uppercase; font-size: 10px; letter-spacing: 0.5px; padding: 6px 8px; border-bottom: 1px solid #2a3544; }
.clients-table td { padding: 8px; border-bottom: 1px solid #1e2d3d; }
.clients-table tr:last-child td { border-bottom: none; }

.clients-table td.client-name { color: #60a5fa; cursor: pointer; }
.clients-table td.client-name:hover { text-decoration: underline; }

.placeholder-text { color: #555; font-size: 13px; font-style: italic; padding: 8px 0; }

.gpu-name-row { display: flex; align-items: center; gap: 8px; }
.gpu-select {
  background: #0f1419;
  color: #e0e0e0;
  border: 1px solid #2a3544;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 12px;
  cursor: pointer;
  outline: none;
}
.gpu-select:hover { border-color: #60a5fa; }

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.modal {
  background: #1a2332;
  border-radius: 12px;
  border: 1px solid #2a3544;
  width: 90%;
  max-width: 600px;
  max-height: 80vh;
  overflow-y: auto;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #2a3544;
  font-size: 16px;
  font-weight: 600;
  color: #60a5fa;
}
.modal-close {
  background: none;
  border: none;
  color: #888;
  font-size: 24px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}
.modal-close:hover { color: #e0e0e0; }
.modal-body { padding: 20px; }
.modal-body .detail-section { margin-bottom: 16px; }
.modal-body .detail-section:last-child { margin-bottom: 0; }
.modal-body .detail-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #666;
  margin-bottom: 4px;
}
.modal-body .detail-value {
  font-size: 13px;
  color: #e0e0e0;
}
.modal-body .cmdline {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 12px;
  background: #0f1419;
  padding: 10px 12px;
  border-radius: 6px;
  word-break: break-all;
  white-space: pre-wrap;
  color: #ccc;
  max-height: 120px;
  overflow-y: auto;
}
.modal-body .mem-table {
  width: 100%;
  font-size: 12px;
  border-collapse: collapse;
}
.modal-body .mem-table td {
  padding: 4px 8px;
  border-bottom: 1px solid #1e2d3d;
}
.modal-body .mem-table td:first-child { color: #888; }
.modal-body .mem-table td:last-child { text-align: right; font-weight: 500; }
.modal-body .engine-table {
  width: 100%;
  font-size: 12px;
  border-collapse: collapse;
}
.modal-body .engine-table td {
  padding: 4px 8px;
  border-bottom: 1px solid #1e2d3d;
}
.modal-body .engine-table td:first-child { color: #888; }
.modal-body .engine-table td:last-child { text-align: right; font-weight: 500; }

.footer { text-align: center; font-size: 11px; color: #444; margin-top: 12px; }

@media (max-width: 900px) {
  .grid-3 { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
}
