:root {
  color-scheme: dark;
  --bg: #0c1014;
  --panel: #141a20;
  --panel-2: #10161c;
  --line: #26313a;
  --text: #e8eef2;
  --muted: #8f9ca8;
  --ride: #49d17f;
  --watch: #f2c15b;
  --danger: #ff6b6b;
  --accent: #62b6ff;
}

* {
  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;
  letter-spacing: 0;
}

button,
input {
  font: inherit;
}

.shell {
  width: min(1440px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(540px, 1.5fr);
  gap: 18px;
  align-items: stretch;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
}

h1 {
  font-size: 34px;
  line-height: 1.05;
}

h2 {
  font-size: 15px;
}

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

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

.metric {
  min-height: 84px;
  padding: 14px;
}

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

.metric strong {
  display: block;
  margin-top: 10px;
  font-size: 25px;
}

.metric.ride strong {
  color: var(--ride);
}

.metric.watch strong {
  color: var(--watch);
}

.metric.danger strong {
  color: var(--danger);
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 340px) auto max-content;
  gap: 12px;
  margin: 18px 0;
  align-items: center;
}

input[type="search"] {
  width: 100%;
  height: 40px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-2);
  color: var(--text);
  outline: none;
}

input[type="search"]:focus {
  border-color: var(--accent);
}

.segmented {
  display: inline-flex;
  width: fit-content;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
}

.segmented button,
.scan-button {
  height: 40px;
  border: 0;
  color: var(--text);
  background: var(--panel-2);
  cursor: pointer;
}

.segmented button {
  padding: 0 13px;
  border-right: 1px solid var(--line);
}

.segmented button:last-child {
  border-right: 0;
}

.segmented button.active {
  background: #22303a;
  color: #ffffff;
}

.scan-button {
  padding: 0 16px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  color: #dff0ff;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 16px;
  align-items: start;
}

.table-wrap {
  overflow: hidden;
}

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

th,
td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 14px;
}

th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  background: #10171d;
  cursor: pointer;
  user-select: none;
}

tbody tr:hover {
  background: #17212a;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-width: 58px;
  height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.badge.ride {
  background: rgba(73, 209, 127, 0.14);
  color: var(--ride);
}

.badge.watch {
  background: rgba(242, 193, 91, 0.14);
  color: var(--watch);
}

.slope-up {
  color: var(--ride);
  font-weight: 800;
}

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

.empty {
  height: 160px;
  text-align: center;
  color: var(--muted);
}

.health-panel {
  padding: 16px;
}

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

.definitions {
  margin-bottom: 14px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
}

.definitions p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.definitions p + p {
  margin-top: 6px;
}

.definitions strong {
  color: var(--text);
}

.state {
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
}

.state.ok {
  background: rgba(73, 209, 127, 0.14);
  color: var(--ride);
}

.state.bad {
  background: rgba(255, 107, 107, 0.14);
  color: var(--danger);
}

.state.neutral {
  background: rgba(143, 156, 168, 0.14);
  color: var(--muted);
}

dl {
  display: grid;
  gap: 2px;
  margin: 0;
}

dl div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

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

dd {
  margin: 0;
  text-align: right;
}

.errors {
  margin-top: 12px;
  color: var(--danger);
  font-size: 12px;
  line-height: 1.5;
}

@media (max-width: 980px) {
  .topbar,
  .content-grid,
  .toolbar {
    grid-template-columns: 1fr;
  }

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

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

  table {
    min-width: 860px;
  }
}

@media (max-width: 560px) {
  .shell {
    width: min(100% - 20px, 1440px);
    padding-top: 18px;
  }

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

  .segmented {
    width: 100%;
  }

  .segmented button {
    flex: 1;
    padding: 0 8px;
  }
}
