:root {
  color-scheme: dark;
  --bg: #07111f;
  --panel: #111c2d;
  --panel-2: #0d1727;
  --line: #26354c;
  --muted: #96a1b4;
  --text: #edf3ff;
  --green: #28d126;
  --teal: #14c8a0;
  --amber: #d09b21;
  --red: #ff474d;
  --orange: #f7a14a;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(180deg, #0a1627 0%, var(--bg) 42%, #06101d 100%);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.shell {
  width: min(1720px, calc(100vw - 48px));
  margin: 0 auto;
  padding: 18px 0 28px;
}

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 14px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--teal);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(26px, 3vw, 38px);
  line-height: 1;
}

.toolbar {
  display: flex;
  align-items: end;
  gap: 10px;
}

.search {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

input,
select,
button {
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0a1423;
  color: var(--text);
  font: inherit;
}

input {
  width: 260px;
  padding: 0 12px;
}

select {
  padding: 0 10px;
}

button {
  cursor: pointer;
  padding: 0 16px;
  background: #14233a;
  font-weight: 700;
}

button:hover {
  border-color: #3d5371;
}

button:disabled {
  cursor: wait;
  opacity: .65;
}

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

.summary-card {
  min-height: 56px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(17, 28, 45, .8);
  padding: 10px 12px;
}

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

.summary-card strong {
  font-size: 22px;
}

.summary-card.good strong {
  color: var(--green);
}

.summary-card.warn strong {
  color: var(--amber);
}

.summary-card.bad strong {
  color: var(--red);
}

.statusline {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 12px;
}

.error-box {
  border: 1px solid rgba(255, 71, 77, .5);
  border-radius: 8px;
  background: rgba(255, 71, 77, .1);
  color: #ffc4c6;
  padding: 12px 14px;
  margin-bottom: 16px;
}

.hidden {
  display: none;
}

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

.channel-card {
  min-width: 0;
  min-height: 280px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(20, 31, 49, .95), rgba(14, 24, 40, .95));
  box-shadow: 0 12px 28px rgba(0, 0, 0, .2);
  padding: 20px;
}

.channel-card.degraded {
  border-color: rgba(208, 155, 33, .36);
}

.channel-card.error {
  border-color: rgba(255, 71, 77, .35);
}

.channel-card.disabled {
  opacity: .72;
}

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

.brand {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: #263648;
  color: var(--orange);
  font-size: 20px;
  font-weight: 900;
}

.brand.openai {
  color: #37e39d;
  background: #123b37;
}

.title-block {
  min-width: 0;
}

h2 {
  margin: 0 0 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 16px;
  line-height: 1.15;
}

.title-block p {
  margin: 0;
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
}

.title-block span {
  display: inline-block;
  margin-right: 6px;
  border-radius: 6px;
  background: rgba(247, 161, 74, .18);
  color: #ffb35f;
  padding: 2px 6px;
  font-family: inherit;
  font-weight: 700;
}

.pill {
  border-radius: 999px;
  padding: 4px 10px;
  background: rgba(40, 209, 38, .14);
  color: #68e8aa;
  font-weight: 800;
  font-size: 12px;
}

.pill.warning {
  background: rgba(208, 155, 33, .18);
  color: #f1c45b;
}

.pill.degraded {
  background: rgba(208, 155, 33, .18);
  color: #f1c45b;
}

.pill.error {
  background: rgba(255, 71, 77, .16);
  color: #ff8286;
}

.pill.disabled {
  background: rgba(150, 161, 180, .16);
  color: #bac4d4;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 20px 0 12px;
}

.metrics div {
  min-height: 66px;
  border: 1px solid #24334b;
  border-radius: 12px;
  background: #101a2c;
  padding: 12px;
}

.metrics span,
.availability span,
.history-head,
footer {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
}

.metrics strong {
  display: block;
  margin-top: 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 18px;
}

.availability {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  border-top: 1px solid #24334b;
  border-bottom: 1px solid #24334b;
  padding: 12px 0;
}

.availability strong {
  color: var(--green);
  font-size: 30px;
  line-height: 1;
}

.degraded .availability strong {
  color: var(--amber);
}

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

.availability small {
  font-size: 14px;
}

.history-head {
  display: flex;
  justify-content: space-between;
  margin: 14px 0 8px;
}

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

.bars i {
  display: block;
  height: 20px;
  border-radius: 3px;
  background: var(--teal);
}

.bars i.degraded {
  background: #f5a20e;
}

.bars i.error {
  background: var(--red);
}

.bars i.empty-bar {
  height: 3px;
  background: #435168;
}

.axis,
footer {
  display: flex;
  justify-content: space-between;
}

.axis {
  margin-top: 4px;
  font-size: 9px;
  color: #6d778a;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: .12em;
}

footer {
  gap: 18px;
  margin-top: 18px;
  border-top: 1px solid rgba(38, 53, 76, .7);
  padding-top: 16px;
}

footer span:first-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.message {
  margin: 14px 0 0;
  color: #ffafb2;
  font-size: 13px;
}

.empty {
  grid-column: 1 / -1;
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 60px;
  color: var(--muted);
  text-align: center;
}

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

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

@media (max-width: 760px) {
  .shell {
    width: min(100vw - 24px, 720px);
    padding-top: 18px;
  }

  .topbar,
  .toolbar,
  .statusline {
    align-items: stretch;
    flex-direction: column;
  }

  input {
    width: 100%;
  }

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

  .channel-card {
    padding: 20px;
  }

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

  .pill {
    grid-column: 1 / -1;
    justify-self: start;
  }

  h2 {
    font-size: 20px;
  }

  .availability strong {
    font-size: 38px;
  }
}
