:root {
  --bg: #ede7dc;
  --bg-accent: #e6dfd2;
  --card: #fcfaf5;
  --line: rgba(27, 37, 34, 0.14);
  --ink: #17211e;
  --muted: #6c716d;
  --ok: #1b9a68;
  --error: #cb4b4b;
  --idle: #c8c4b7;
  --accent: #0c6d59;
  --shadow: 0 10px 24px rgba(32, 38, 34, 0.06);
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  color: var(--ink);
  font-family: "Avenir Next", "Segoe UI", "Helvetica Neue", sans-serif;
  background:
    linear-gradient(rgba(23, 33, 30, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(23, 33, 30, 0.035) 1px, transparent 1px),
    linear-gradient(180deg, var(--bg), var(--bg-accent));
  background-size: 24px 24px, 24px 24px, auto;
}

.page-shell {
  width: min(1480px, calc(100vw - 28px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 18px 0 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.hero,
.summary-card,
.runtime-bar,
.status-card,
.warning-card,
.empty-state {
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.hero {
  border-radius: 24px;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  position: relative;
  overflow: hidden;
}

.hero::after {
  content: "";
  position: absolute;
  inset: auto -10% 0 auto;
  width: 260px;
  height: 8px;
  background: linear-gradient(90deg, transparent, rgba(12, 109, 89, 0.9));
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 11px;
}

h1,
h2 {
  margin: 0;
  font-family: "Avenir Next Condensed", "Arial Narrow", "Avenir Next", sans-serif;
  letter-spacing: -0.04em;
}

h1 {
  font-size: clamp(30px, 3vw, 44px);
}

.hero-copy {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.refresh-button {
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, #0f7b65, #15a07c);
  color: #fff;
  padding: 14px 20px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.refresh-button:disabled {
  cursor: wait;
  opacity: 0.75;
}

.summary-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

.summary-card {
  border-radius: 16px;
  padding: 14px 16px;
}

.summary-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.summary-card strong {
  display: block;
  margin-top: 8px;
  font-size: 26px;
}

.summary-ok strong {
  color: var(--ok);
}

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

.summary-idle strong {
  color: #8d9892;
}

.summary-accent strong {
  color: var(--accent);
}

.runtime-bar {
  border-radius: 16px;
  padding: 12px 16px;
  display: flex;
  gap: 20px;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 13px;
}

.runtime-bar strong {
  color: var(--ink);
}

.warnings:empty {
  display: none;
}

.warning-card {
  border-radius: 16px;
  padding: 12px 16px;
  color: #8b3a41;
  background: rgba(255, 242, 243, 0.88);
}

.warning-card p {
  margin: 0;
}

.group-grid {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  align-content: start;
}

.status-card {
  border-radius: var(--radius);
  padding: 16px;
  min-height: 240px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}

.status-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  background: var(--idle);
}

.status-healthy::before {
  background: var(--ok);
}

.status-error::before {
  background: var(--error);
}

.status-top {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
}

.group-badge {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: #f1ede5;
  color: var(--muted);
  font-weight: 700;
  border: 1px solid rgba(27, 37, 34, 0.08);
}

.group-copy h2 {
  font-size: 28px;
  line-height: 0.95;
}

.group-copy p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.status-pill {
  justify-self: end;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.status-healthy .status-pill {
  background: rgba(18, 165, 111, 0.14);
  color: var(--ok);
}

.status-error .status-pill {
  background: rgba(215, 75, 82, 0.14);
  color: var(--error);
}

.status-idle .status-pill {
  background: rgba(141, 152, 146, 0.18);
  color: #7a8881;
}

.metrics-band {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 14px 0 10px;
}

.metric-box {
  background: #f5f2eb;
  border-radius: 16px;
  padding: 12px;
  border: 1px solid rgba(27, 37, 34, 0.06);
}

.metric-box span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.metric-box strong {
  display: block;
  margin-top: 8px;
  font-size: 22px;
}

.history-labels {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.energy-grid {
  display: grid;
  grid-template-columns: repeat(60, minmax(0, 1fr));
  gap: 4px;
}

.energy-cell {
  display: block;
  width: 100%;
  height: 36px;
  border-radius: 999px;
  background: var(--idle);
}

.energy-healthy {
  background: var(--ok);
}

.energy-error {
  background: var(--error);
}

.energy-idle {
  background: var(--idle);
}

.empty-state {
  border-radius: 24px;
  padding: 28px;
  text-align: center;
}

.status-note {
  margin: 12px 0 0;
  min-height: 38px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

@media (max-width: 1320px) {
  .group-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .page-shell {
    width: min(100vw - 20px, 100%);
    min-height: auto;
  }

  .hero,
  .runtime-bar {
    flex-direction: column;
    align-items: flex-start;
  }

  .summary-strip,
  .group-grid {
    grid-template-columns: 1fr;
  }

  .status-top {
    grid-template-columns: 48px minmax(0, 1fr);
  }

  .status-pill {
    justify-self: start;
    grid-column: 2;
  }

  .metrics-band {
    grid-template-columns: 1fr;
  }
}
