:root {
  color-scheme: dark;
  --bg: #0b0f13;
  --surface: #12181f;
  --surface-2: #17212b;
  --line: #2a3744;
  --text: #ecf4f7;
  --muted: #93a4ae;
  --cyan: #4de8f1;
  --green: #7ce38b;
  --amber: #f0bf61;
  --red: #ff7a7a;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button {
  appearance: none;
  border: 1px solid var(--cyan);
  background: var(--cyan);
  color: #041114;
  border-radius: 6px;
  padding: 0.68rem 0.95rem;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  min-height: 42px;
}

button.secondary {
  background: transparent;
  color: var(--cyan);
}

button.ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--text);
}

button:disabled {
  cursor: wait;
  opacity: 0.55;
}

.shell {
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 24px 0 48px;
}

.topbar,
.panel-heading,
.brand,
.topbar-actions {
  display: flex;
  align-items: center;
}

.topbar {
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.brand {
  gap: 12px;
}

.brand img {
  border-radius: 8px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 1.35rem;
}

h2 {
  font-size: 1.08rem;
}

.eyebrow {
  margin-bottom: 4px;
  color: var(--cyan);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

.topbar-actions {
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.auth-panel,
.loading {
  min-height: 55vh;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 18px;
  text-align: center;
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.status-grid article,
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.status-grid article {
  padding: 14px;
}

.status-grid span,
dt,
th {
  color: var(--muted);
  font-size: 0.78rem;
}

.status-grid strong {
  display: block;
  margin-top: 6px;
  font-size: 1.2rem;
}

.dashboard {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
  gap: 16px;
}

.panel {
  padding: 16px;
  min-width: 0;
}

.panel.wide {
  grid-column: 1 / -1;
}

.panel-heading {
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.badge {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.28rem 0.55rem;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
}

.badge.ready,
.badge.healthy {
  border-color: rgba(124, 227, 139, 0.5);
  color: var(--green);
}

.badge.stale,
.badge.not-checked {
  border-color: rgba(240, 191, 97, 0.5);
  color: var(--amber);
}

.badge.error,
.badge.degraded {
  border-color: rgba(255, 122, 122, 0.55);
  color: var(--red);
}

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

.facts div {
  background: var(--surface-2);
  border-radius: 6px;
  padding: 10px;
}

dd {
  margin: 4px 0 0;
  font-weight: 700;
}

.warnings {
  display: grid;
  gap: 8px;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
}

.warnings li {
  border-left: 3px solid var(--amber);
  background: var(--surface-2);
  padding: 8px 10px;
  color: var(--muted);
}

.warnings li.critical {
  border-left-color: var(--red);
  color: var(--text);
}

.table-wrap {
  overflow-x: auto;
  margin-top: 10px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 10px 8px;
  text-align: left;
  white-space: nowrap;
}

td:last-child,
th:last-child {
  text-align: right;
}

[hidden] {
  display: none !important;
}

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

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .status-grid,
  .dashboard,
  .facts {
    grid-template-columns: 1fr;
  }

  .table-wrap {
    overflow-x: visible;
  }

  table {
    table-layout: fixed;
  }

  th,
  td {
    padding: 9px 5px;
    white-space: normal;
    overflow-wrap: break-word;
    word-break: normal;
  }

  td:last-child,
  th:last-child {
    text-align: left;
  }

  .topbar-actions {
    width: 100%;
  }

  .topbar-actions button {
    flex: 1 1 130px;
  }

  .panel.wide th:nth-child(1),
  .panel.wide td:nth-child(1) {
    width: 22%;
  }

  .panel.wide th:nth-child(2),
  .panel.wide td:nth-child(2) {
    width: 23%;
  }

  .panel.wide th:nth-child(3),
  .panel.wide td:nth-child(3) {
    width: 22%;
  }

  .panel.wide th:nth-child(4),
  .panel.wide td:nth-child(4) {
    width: 18%;
  }

  .panel.wide th:nth-child(5),
  .panel.wide td:nth-child(5) {
    width: 15%;
  }

  .panel.wide th,
  .panel.wide td {
    padding-inline: 3px;
    font-size: 0.8rem;
    line-height: 1.15;
  }
}
