:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --panel: #ffffff;
  --text: #17202a;
  --muted: #65717f;
  --line: #dce2e8;
  --good: #146c43;
  --warn: #946200;
  --bad: #a52828;
  --accent: #1d5d9b;
  --ink: #243447;
}

* {
  box-sizing: border-box;
}

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

button,
input {
  font: inherit;
}

code {
  font-family: ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  color: var(--ink);
}

button {
  min-height: 36px;
  border: 1px solid #b9c5d0;
  background: #ffffff;
  color: var(--ink);
  padding: 0 12px;
  border-radius: 6px;
  cursor: pointer;
}

button.primary,
button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

button.danger:hover {
  border-color: var(--bad);
  color: var(--bad);
}

input {
  width: 100%;
  min-height: 38px;
  border: 1px solid #b9c5d0;
  border-radius: 6px;
  padding: 0 10px;
}

.shell {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 18px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 24px;
  line-height: 1.2;
}

h2 {
  font-size: 16px;
  line-height: 1.3;
}

#subtitle {
  color: var(--muted);
  margin-top: 4px;
}

.actions,
.token-row,
.button-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.button-row {
  flex-wrap: wrap;
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

.auth-panel {
  margin-bottom: 14px;
}

.auth-panel label {
  display: block;
  color: var(--muted);
  margin-bottom: 8px;
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.metric,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.metric {
  padding: 14px;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 6px;
}

.metric strong {
  font-size: 20px;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.45fr);
  gap: 12px;
}

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

.span-2 {
  grid-column: span 2;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.badge,
.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 12px;
  background: #eef2f6;
  color: var(--ink);
  white-space: nowrap;
}

.pill.good {
  background: #e7f4ed;
  color: var(--good);
}

.pill.warn {
  background: #fff3cd;
  color: var(--warn);
}

.pill.bad {
  background: #f8d7da;
  color: var(--bad);
}

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

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

th,
td {
  text-align: left;
  vertical-align: top;
  border-top: 1px solid var(--line);
  padding: 10px 8px;
}

th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

td {
  overflow-wrap: anywhere;
}

.kv,
.stack {
  display: grid;
  gap: 8px;
}

.kv div,
.stack-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

.kv span,
.stack-item span {
  color: var(--muted);
}

.alert {
  border: 1px solid #e1c45f;
  background: #fff8df;
  color: #5f4300;
  padding: 10px 12px;
  border-radius: 8px;
  margin-bottom: 12px;
}

.hidden {
  display: none;
}

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

@media (max-width: 880px) {
  .topbar,
  .actions,
  .token-row {
    align-items: stretch;
    flex-direction: column;
  }

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

  .span-2 {
    grid-column: auto;
  }
}
