/* Mobile first, dark by OS preference like the React dashboard. */
:root {
  --bg: #ffffff;
  --fg: #101418;
  --muted: #5b6672;
  --card: #f6f8fa;
  --line: #dfe4ea;
  --running: #1f9d55;
  --degraded: #c78a00;
  --stopped: #c0392b;
  --unknown: #7a5cc0;
  --off: #97a2ad;
  --error: #c0392b;
  --pending: #97a2ad;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1418;
    --fg: #e6eaee;
    --muted: #94a1ad;
    --card: #171d23;
    --line: #262e36;
    --running: #35c46b;
    --degraded: #e0a419;
    --stopped: #e35d4f;
    --unknown: #a48ae0;
    --off: #6b7783;
    --error: #e35d4f;
    --pending: #6b7783;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 0 16px 32px;
  background: var(--bg);
  color: var(--fg);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.bar {
  position: sticky;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

.bar h1 { margin: 0; font-size: 18px; letter-spacing: 0.02em; }

.bar-right { display: flex; align-items: center; gap: 10px; }

.muted { color: var(--muted); font-size: 13px; }

.user-line { display: flex; gap: 12px; margin: 10px 0 0; }

button {
  font: inherit;
  color: var(--fg);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 5px 10px;
  cursor: pointer;
}

button:hover:not(:disabled) { border-color: var(--muted); }
button:disabled { opacity: 0.5; cursor: default; }
button.small { padding: 2px 7px; line-height: 1.2; }

.pill {
  padding: 2px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12px;
  color: var(--muted);
}

.pill-open { color: var(--degraded); border-color: var(--degraded); }

.card {
  margin-top: 16px;
  padding: 12px 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.card h2 { margin: 0 0 8px; font-size: 15px; font-weight: 600; }

.row {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto auto;
  grid-template-areas:
    "dot host state button"
    ".   detail detail checked";
  align-items: center;
  gap: 4px 8px;
  padding: 7px 0;
  border-top: 1px solid var(--line);
}

.row:first-of-type { border-top: 0; }

.dot {
  grid-area: dot;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--unknown);
}

.host { grid-area: host; font-weight: 500; overflow-wrap: anywhere; }
.state { grid-area: state; font-size: 12px; color: var(--muted); }
.row button { grid-area: button; }

.detail {
  grid-area: detail;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.checked { grid-area: checked; text-align: right; white-space: nowrap; }

.state-running .dot { background: var(--running); }
.state-degraded .dot { background: var(--degraded); }
.state-stopped .dot { background: var(--stopped); }
.state-unknown .dot { background: var(--unknown); }
.state-error .dot { background: var(--error); }
.state-off .dot { background: var(--off); }
.state-pending .dot { background: var(--pending); }

/* Hosts that are off are greyed out, not red: some instances only run during
   market hours. */
.state-off, .state-pending { color: var(--muted); }
.state-off .host, .state-pending .host { font-weight: 400; }

.error { color: var(--error); }

.banner {
  margin: 12px 0 0;
  padding: 8px 12px;
  border: 1px solid var(--degraded);
  border-radius: 8px;
  color: var(--degraded);
  font-size: 13px;
}

@media (min-width: 720px) {
  body { padding: 0 24px 40px; max-width: 1100px; margin: 0 auto; }
  .row {
    grid-template-columns: 10px 180px 90px minmax(0, 1fr) 90px auto;
    grid-template-areas: "dot host state detail checked button";
  }
}
