:root {
  color-scheme: dark;
  --bg: #0f1117;
  --surface: #1a1d27;
  --surface-raised: #22263a;
  --surface-soft: #151924;
  --text: #eef2ff;
  --muted: #8b93a7;
  --border: rgba(255, 255, 255, 0.06);
  --accent: #4f9cf9;
  --ok: #22c55e;
  --warn: #f59e0b;
  --err: #ef4444;
  --info: #7c8599;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
}
.page {
  max-width: 1320px;
  margin: 0 auto;
  padding: 20px;
}
.header, .panel-header, .status-strip, .grid, .platform-grid, .log-controls, .platform-head, .meta-row, .heartbeat-head, .refresh-group, .log-tools, .actions-wrap {
  display: flex;
}
.header, .panel-header, .status-strip, .log-controls, .platform-head, .heartbeat-head { justify-content: space-between; }
.header, .panel-header, .status-strip, .grid, .platform-grid { gap: 12px; }
.header, .panel-header, .log-controls, .platform-head, .meta-row, .heartbeat-head, .refresh-group, .log-tools, .actions-wrap { align-items: center; }
.header { margin-bottom: 14px; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1rem; }
h3 { font-size: 0.85rem; }
.sub, .muted { color: var(--muted); }
.actions button, .tabs button, select, input {
  background: var(--surface-raised);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 7px 10px;
}
input { min-width: 180px; }
.actions button:hover, .tabs button:hover { cursor: pointer; background: #2a3046; }
.tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.tabs .active { border-color: var(--accent); color: var(--accent); }
.status-strip {
  margin-bottom: 14px;
  padding: 12px 14px;
  background: var(--surface);
  border-radius: 14px;
  flex-wrap: wrap;
}
.status-item {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding-right: 16px;
}
.status-label, .metric-label {
  color: var(--muted);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.status-value {
  font-weight: 700;
  font-size: 0.92rem;
}
.panel, .alert-banner, .platform-card, .metric-card {
  background: var(--surface);
  border-radius: 14px;
}
.panel {
  padding: 14px;
  margin-bottom: 14px;
}
.overview-panel { padding-bottom: 12px; }
.grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 10px;
  margin-bottom: 8px;
}
.metric-card {
  padding: 12px 13px;
  background: var(--surface-soft);
  min-width: 0;
}
.metric-card.warn { background: rgba(245, 158, 11, 0.08); }
.metric-value {
  margin-top: 6px;
  font-size: 1.5rem;
  font-weight: 800;
  line-height: 1.15;
  word-break: break-word;
}
.badge {
  display: inline-flex;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 700;
}
.badge.ok { color: #86efac; background: rgba(34, 197, 94, 0.14); }
.badge.warn { color: #fcd34d; background: rgba(245, 158, 11, 0.14); }
.badge.err { color: #fca5a5; background: rgba(239, 68, 68, 0.14); }
.badge.neutral { color: #cbd5e1; background: rgba(124, 133, 153, 0.16); }
.alert-banner {
  margin-bottom: 14px;
  padding: 12px 14px;
}
.alert-banner.warn { background: rgba(245, 158, 11, 0.08); }
.alert-banner.error { background: rgba(239, 68, 68, 0.1); }
.alert-title { font-weight: 800; margin-bottom: 10px; font-size: 0.95rem; }
.alert-list {
  display: grid;
  gap: 8px;
}
.alert-card {
  border-radius: 12px;
  background: var(--surface-soft);
  border-left: 3px solid transparent;
}
.alert-card.warning { border-left-color: var(--warn); }
.alert-card.critical { border-left-color: var(--err); }
.alert-card summary {
  list-style: none;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  cursor: pointer;
}
.alert-card summary::-webkit-details-marker { display: none; }
.alert-icon { font-size: 15px; line-height: 1.2; }
.alert-copy {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
}
.alert-card-title { font-weight: 700; color: var(--text); }
.alert-card-summary { color: var(--muted); font-size: 0.82rem; }
.alert-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font-size: 0.74rem;
  font-weight: 700;
}
.alert-details {
  margin: 0;
  padding: 0 18px 12px 40px;
  color: var(--text);
  font-size: 0.8rem;
}
.heartbeat-inline {
  margin-top: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
.heartbeat-chart {
  height: 72px;
  display: flex;
  align-items: end;
  gap: 6px;
  margin-top: 8px;
  padding: 6px 0;
}
.heartbeat-chart.empty-state {
  height: auto;
  align-items: center;
}
.heartbeat-empty-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--surface-raised);
  color: var(--muted);
  font-size: 0.76rem;
}
.heartbeat-bar {
  flex: 1;
  min-width: 6px;
  border-radius: 6px 6px 0 0;
  background: linear-gradient(180deg, #67b2ff, var(--accent));
}
.platform-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}
.platform-card {
  padding: 14px;
}
.meta-row {
  justify-content: space-between;
  margin-top: 8px;
  color: var(--muted);
  gap: 12px;
}
.meta-row.column { display: block; }
.meta-row code {
  display: block;
  margin-top: 6px;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text);
}
.log-meta { margin: 8px 0 10px; color: var(--muted); font-size: 0.8rem; }
.log-output {
  min-height: 420px;
  max-height: 720px;
  overflow: auto;
  background: var(--surface-soft);
  border-radius: 12px;
  padding: 4px 0;
  font-family: "JetBrains Mono", "Fira Code", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.78rem;
  line-height: 1.45;
}
.log-line {
  display: grid;
  grid-template-columns: 104px 14px minmax(0, 1fr);
  gap: 12px;
  padding: 7px 12px;
  align-items: start;
}
.log-line + .log-line { border-top: 1px solid rgba(255, 255, 255, 0.04); }
.log-line.info { color: #d7dceb; }
.log-line.warning { color: #f8e3b0; }
.log-line.error, .log-line.critical { color: #ffd0d0; }
.log-line.debug { color: #9aa3b8; }
.log-time {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.log-level-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  margin-top: 5px;
  background: var(--info);
}
.log-level-dot.info { background: var(--info); }
.log-level-dot.warning { background: var(--warn); }
.log-level-dot.error, .log-level-dot.critical { background: var(--err); }
.log-level-dot.debug { background: #64748b; }
.log-content { min-width: 0; }
.log-message {
  max-height: 220px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}
.log-message-collapsed summary {
  cursor: pointer;
  color: var(--accent);
  margin-bottom: 6px;
}
.log-block-wrap {
  max-width: 100%;
  overflow-x: auto;
}
.log-block {
  margin: 0;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--surface-raised);
  color: #e2e8f0;
  white-space: pre;
}
.toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
}
.toggle input { min-width: auto; }
.log-controls-wrap {
  align-items: flex-start;
  gap: 12px;
  flex-direction: column;
}
.control-inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
}
.search-box input { min-width: 220px; }
.compact { margin-top: 8px; }
.empty { color: var(--muted); padding: 8px 12px; }
.error { color: #fecaca; }
@media (max-width: 980px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .header, .panel-header, .actions-wrap { flex-direction: column; align-items: stretch; }
}
@media (max-width: 680px) {
  .page { padding: 14px; }
  .grid { grid-template-columns: 1fr; }
  .status-strip { gap: 8px; }
  .log-line { grid-template-columns: 1fr; gap: 4px; }
}
