:root {
  color-scheme: light;
  --bg: #f5f6f4;
  --surface: #ffffff;
  --surface-soft: #fafbf9;
  --line: #dfe4dc;
  --line-soft: #ecefeb;
  --text: #1f2623;
  --muted: #66736b;
  --green: #2f8a4d;
  --green-soft: #edf8ef;
  --amber: #a66700;
  --amber-soft: #fff7e5;
  --red: #bd4545;
  --red-soft: #fff0ef;
  --mono: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    linear-gradient(#00000005 1px, transparent 1px),
    linear-gradient(90deg, #00000004 1px, transparent 1px),
    var(--bg);
  background-size: 32px 32px;
}

#app {
  width: min(1440px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 28px 0 48px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-start;
  padding: 16px 0 22px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.02;
  letter-spacing: 0;
  font-weight: 680;
}

.meta {
  color: var(--muted);
  margin-top: 8px;
  font-size: 14px;
}

.refresh-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.refresh-note {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px;
  padding: 0 12px;
  white-space: nowrap;
}

.refresh-feedback {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.refresh-button {
  min-height: 36px;
  border: 1px solid #202722;
  background: #202722;
  color: #fff;
  border-radius: 8px;
  font: inherit;
  font-size: 13px;
  padding: 0 12px;
  cursor: pointer;
  white-space: nowrap;
}

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

.boot {
  min-height: 70vh;
  display: grid;
  place-items: center;
  color: var(--muted);
}

.boot.error {
  gap: 14px;
}

.boot button {
  font: inherit;
  min-height: 44px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 8px;
  padding: 0 16px;
  cursor: pointer;
}

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

.metrics div {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.metrics span,
.label {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 4px;
}

.metrics strong {
  font-size: 28px;
  line-height: 1;
  font-weight: 680;
  font-variant-numeric: tabular-nums;
}

.table-head,
.instrument-row {
  display: grid;
  grid-template-columns: minmax(260px, 1.7fr) 86px 90px 82px 90px minmax(260px, 1.2fr);
  gap: 12px;
  align-items: center;
}

.table-head {
  padding: 10px 14px;
  color: var(--muted);
  font-size: 12px;
}

.section-list {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.group-section {
  min-width: 0;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 6px;
  padding: 0 2px;
}

.section-head h2 {
  font-size: 18px;
  line-height: 1.2;
  font-weight: 680;
}

.section-head span {
  min-width: 32px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.instrument-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.instrument-row {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
}

.instrument-row.degraded {
  border-color: #e7c77e;
  background: linear-gradient(90deg, var(--amber-soft), #fff 28%);
}

.instrument-row.restricted,
.instrument-row.nomodel {
  border-color: #c7cfc6;
  background: linear-gradient(90deg, #f1f3ef, #fff 28%);
}

.instrument-row.down {
  border-color: #e0aaa5;
  background: linear-gradient(90deg, var(--red-soft), #fff 28%);
}

.name-cell {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.avatar {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  background: var(--surface-soft);
  border-radius: 7px;
  font-weight: 680;
}

.name-cell h2,
.story-row h2 {
  font-size: 15px;
  font-weight: 650;
  overflow-wrap: anywhere;
}

.name-cell p,
.story-row p,
.editorial-hero p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  margin-top: 3px;
}

.instrument-row strong {
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.history {
  display: grid;
  grid-template-columns: repeat(60, minmax(2px, 1fr));
  gap: 2px;
  align-items: end;
}

.bar {
  display: block;
  min-height: 22px;
  border-radius: 2px;
  background: #c9d0c8;
}

.bar.ok {
  background: var(--green);
}

.bar.warn {
  background: #d69a35;
}

.bar.bad {
  background: var(--red);
}

@media (max-width: 900px) {
  #app {
    width: min(100% - 20px, 720px);
    padding-top: 14px;
  }

  .topbar,
  .refresh-actions {
    grid-template-columns: 1fr;
    display: grid;
  }

  .refresh-note,
  .refresh-feedback,
  .refresh-button {
    width: 100%;
    justify-content: center;
  }

  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .group-section .table-head {
    display: none;
  }

  .instrument-row {
    grid-template-columns: 1fr 1fr;
  }

  .instrument-row .name-cell,
  .instrument-row .history {
    grid-column: 1 / -1;
  }

}
