:root {
  color-scheme: dark;
  --bg: #0b0d10;
  --panel: #12161b;
  --panel-2: #171d23;
  --text: #e8edf2;
  --muted: #8d98a5;
  --line: #26313b;
  --good: #29b36a;
  --warn: #e0a43a;
  --bad: #d85b66;
  --accent: #4aa3ff;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.4 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 60px;
  padding: 10px 18px;
  background: rgba(11, 13, 16, 0.96);
  border-bottom: 1px solid var(--line);
}

.brand {
  font-size: 18px;
  font-weight: 700;
}

.muted {
  color: var(--muted);
  font-size: 12px;
}

.top-actions,
.inline-controls,
.command-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.token-form {
  display: flex;
  align-items: center;
  gap: 8px;
}

.layout {
  display: grid;
  gap: 14px;
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 14px;
}

.band {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
}

.narrow-right {
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.6fr);
}

.metrics {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 10px;
}

.metric {
  min-height: 66px;
  padding: 10px 12px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 6px;
}

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

.metric strong {
  display: block;
  margin-top: 7px;
  font-size: 24px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  min-height: 34px;
  margin-bottom: 8px;
}

h1 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
}

table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  background: #0f1318;
}

th,
td {
  height: 34px;
  padding: 7px 9px;
  text-align: right;
  border-bottom: 1px solid #202933;
  white-space: nowrap;
}

th:first-child,
td:first-child,
th:nth-child(2),
td:nth-child(2) {
  text-align: left;
}

th {
  position: sticky;
  top: 0;
  background: #151b21;
  color: #aab5c0;
  font-weight: 600;
}

tr:last-child td {
  border-bottom: 0;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 2px 7px;
  border-radius: 999px;
  background: #1d2630;
  color: var(--text);
  font-size: 12px;
}

.pill.good {
  color: #c8f5dc;
  background: rgba(41, 179, 106, 0.2);
}

.pill.bad {
  color: #ffd7db;
  background: rgba(216, 91, 102, 0.22);
}

.icon-btn,
.text-btn,
select,
input {
  height: 34px;
  border: 1px solid var(--line);
  background: #151b21;
  color: var(--text);
  border-radius: 6px;
}

.icon-btn {
  width: 36px;
  font-size: 18px;
  cursor: pointer;
}

.text-btn {
  padding: 0 12px;
  cursor: pointer;
  font-weight: 600;
}

.text-btn:hover,
.icon-btn:hover {
  border-color: var(--accent);
}

.text-btn.danger {
  color: #ffd7db;
  border-color: rgba(216, 91, 102, 0.6);
}

label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

select {
  min-width: 92px;
  padding: 0 8px;
}

input {
  width: 100%;
  min-width: 0;
  padding: 0 10px;
}

#dashboard-token {
  width: 190px;
}

pre {
  min-height: 160px;
  max-height: 340px;
  margin: 10px 0 0;
  padding: 10px;
  overflow: auto;
  background: #0f1318;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: #dce5ef;
  font: 12px/1.45 ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
}

.events {
  display: grid;
  gap: 6px;
  max-height: 420px;
  overflow: auto;
}

.event {
  padding: 8px 9px;
  background: #0f1318;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.event-time {
  color: var(--muted);
  font-size: 12px;
}

@media (max-width: 900px) {
  .split,
  .narrow-right,
  .metrics {
    grid-template-columns: 1fr;
  }

  .topbar,
  .section-head,
  .top-actions,
  .token-form,
  .inline-controls {
    align-items: stretch;
    flex-wrap: wrap;
  }

  #dashboard-token {
    width: min(100%, 260px);
  }

  .topbar {
    position: static;
  }
}
