* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: #0f1419;
  color: #e7ecf3;
  min-height: 100vh;
}
a { color: #60a5fa; }
.wrap { max-width: 1200px; margin: 0 auto; padding: 24px 16px; }
.card {
  background: #1a2332;
  border: 1px solid #2a3548;
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 16px;
}
h1 { font-size: 1.5rem; margin-bottom: 8px; }
h2 { font-size: 1.15rem; margin-bottom: 14px; color: #e2e8f0; }
h3 { font-size: 1rem; margin: 0; }
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 10px;
}
.btn {
  display: inline-block;
  padding: 8px 14px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  font-size: 14px;
  text-decoration: none;
  background: #3b82f6;
  color: #fff;
}
.btn:hover { background: #2563eb; }
.btn-gray { background: #475569; }
.btn-red { background: #dc2626; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
label { display: block; font-size: 13px; color: #94a3b8; margin-bottom: 4px; }
input[type=text], input[type=password], input[type=number], select, textarea {
  width: 100%;
  padding: 8px 10px;
  margin-bottom: 12px;
  border-radius: 6px;
  border: 1px solid #334155;
  background: #0f172a;
  color: #f1f5f9;
}
select { width: auto; min-width: 200px; margin-bottom: 0; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid #2a3548; }
th { color: #94a3b8; font-weight: 500; }
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
}
.badge-off { background: #3f3f46; color: #d4d4d8; }
.badge-live { background: #14532d; color: #86efac; }
.badge-panel { background: #312e81; color: #c4b5fd; }
.badge-warn { background: #78350f; color: #fcd34d; }
.err { color: #fca5a5; margin-bottom: 10px; }
.ok { color: #86efac; margin-bottom: 10px; }
.hint { font-size: 13px; color: #64748b; line-height: 1.5; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.login-box { max-width: 380px; margin: 80px auto; }

.summary-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.summary-box {
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 8px;
  padding: 14px 16px;
  text-align: center;
}
.summary-box strong { display: block; font-size: 1.75rem; color: #f8fafc; margin-top: 4px; }
.summary-box span { font-size: 12px; color: #94a3b8; text-transform: uppercase; letter-spacing: 0.04em; }

.agents-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}
.agents-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}
.agent-card {
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 10px;
  padding: 16px;
}
.agent-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}
.mini-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}
.mini-stat {
  background: #1e293b;
  border-radius: 8px;
  padding: 10px 8px;
  text-align: center;
}
.mini-stat span { display: block; font-size: 10px; color: #64748b; text-transform: uppercase; }
.mini-stat strong { font-size: 15px; color: #f1f5f9; }
.metric-row { margin-bottom: 10px; }
.metric-head {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: #94a3b8;
  margin-bottom: 4px;
}
.metric-head strong { color: #e2e8f0; font-size: 13px; }
.bar {
  height: 8px;
  background: #1e293b;
  border-radius: 4px;
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.3s ease;
}
.tone-cpu { background: linear-gradient(90deg, #22c55e, #eab308); }
.tone-ram { background: linear-gradient(90deg, #3b82f6, #8b5cf6); }
.tone-swap { background: linear-gradient(90deg, #64748b, #f97316); }
.tone-disk { background: linear-gradient(90deg, #06b6d4, #3b82f6); }
.disks { margin-top: 12px; padding-top: 10px; border-top: 1px solid #334155; }
.disks-title { font-size: 12px; color: #94a3b8; margin-bottom: 8px; }
.disk-line { margin-bottom: 8px; }
.disk-mount { font-size: 12px; color: #cbd5e1; }
.disk-gb { font-size: 11px; color: #64748b; }
.agent-meta { margin-top: 12px; }
.agent-resp {
  margin-top: 10px;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 13px;
}
.resp-ok { background: #14532d44; color: #86efac; border: 1px solid #166534; }
.resp-err { background: #7f1d1d44; color: #fca5a5; border: 1px solid #991b1b; }
.agent-output {
  margin-top: 8px;
  padding: 10px;
  background: #020617;
  border-radius: 6px;
  font-size: 11px;
  overflow-x: auto;
  max-height: 120px;
  color: #cbd5e1;
}
.api-block { font-size: 13px; }
.api-block summary { cursor: pointer; color: #94a3b8; margin-bottom: 8px; }
@media (max-width: 640px) {
  .mini-stats { grid-template-columns: repeat(2, 1fr); }
  .agents-grid { grid-template-columns: 1fr; }
}

/* Web console */
.console-page .wrap { max-width: 1100px; }
.console-toolbar {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 20px;
  align-items: end;
}
.console-toolbar label { margin-bottom: 0; }
.console-quick {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}
.console-terminal-wrap { padding: 0; overflow: hidden; }
.console-terminal {
  margin: 0;
  padding: 16px;
  min-height: 360px;
  max-height: 55vh;
  overflow: auto;
  background: #020617;
  color: #e2e8f0;
  font-family: Consolas, 'Courier New', monospace;
  font-size: 13px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  border-bottom: 1px solid #334155;
}
.console-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: #0f172a;
}
.console-prompt {
  color: #4ade80;
  font-family: Consolas, monospace;
  font-size: 14px;
  flex-shrink: 0;
}
.console-input {
  flex: 1;
  margin: 0 !important;
  font-family: Consolas, monospace;
  font-size: 14px;
}
@media (max-width: 640px) {
  .console-toolbar { grid-template-columns: 1fr; }
}
