:root {
  color-scheme: light;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f6f7f9;
  color: #1d2430;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  overflow-x: hidden;
}

button,
input {
  font: inherit;
}

button {
  border: 1px solid #1f6feb;
  background: #1f6feb;
  color: white;
  border-radius: 6px;
  padding: 8px 12px;
  cursor: pointer;
}

.icon-button {
  width: 24px;
  height: 24px;
  border-color: #c9d1dc;
  background: #ffffff;
  color: #1d2430;
  padding: 0;
  font-weight: 700;
  line-height: 1;
}

.actions {
  display: flex;
  gap: 8px;
}

input {
  border: 1px solid #c9d1dc;
  border-radius: 6px;
  padding: 8px 10px;
  min-width: min(520px, 80vw);
}

.shell {
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: 20px;
  overflow-x: hidden;
}

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

h1,
h2,
p {
  margin: 0;
}

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

h2 {
  font-size: 15px;
  line-height: 1.3;
  margin-bottom: 10px;
}

#status {
  color: #5c6776;
  margin-top: 4px;
}

.live-status {
  display: grid;
  grid-template-columns: 10px 64px 260px;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  color: #394454;
  font-size: 12px;
  line-height: 1.2;
}

.poll-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: #94a3b8;
}

.poll-dot.polling {
  background: #2563eb;
}

.poll-dot.ready {
  background: #16a34a;
}

.poll-dot.stale {
  background: #d97706;
}

.poll-dot.error {
  background: #dc2626;
}

.poll-state,
.poll-meta {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.poll-state {
  font-weight: 600;
}

.band,
article {
  min-width: 0;
  background: white;
  border: 1px solid #d8dee8;
  border-radius: 8px;
  padding: 14px;
}

.controls {
  margin-bottom: 16px;
}

form {
  display: flex;
  align-items: end;
  gap: 12px;
  flex-wrap: wrap;
}

label {
  display: grid;
  gap: 6px;
  color: #465160;
  font-size: 13px;
}

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

.inline input {
  min-width: auto;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.chip {
  border: 1px solid #d8dee8;
  border-radius: 999px;
  padding: 5px 9px;
  background: #fafbfc;
  color: #394454;
  font-size: 12px;
}

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

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

.runtime-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  min-width: 0;
}

.runtime-cell {
  min-width: 0;
  min-height: 58px;
  border: 1px solid #edf0f4;
  border-radius: 6px;
  padding: 9px 10px;
  background: #fafbfc;
}

.runtime-cell span {
  display: block;
  color: #647084;
  font-size: 11px;
  line-height: 1.2;
  margin-bottom: 6px;
}

.runtime-cell strong {
  display: block;
  color: #1d2430;
  font-size: 14px;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.runtime-state {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.runtime-state::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #94a3b8;
}

.runtime-state.live::before {
  background: #16a34a;
}

.runtime-state.catching-up::before {
  background: #2563eb;
}

.runtime-state.stale::before {
  background: #d97706;
}

.runtime-state.error::before {
  background: #dc2626;
}

.table {
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
}

table {
  width: 100%;
  min-width: max-content;
  border-collapse: collapse;
  font-size: 12px;
}

th,
td {
  text-align: left;
  border-bottom: 1px solid #edf0f4;
  padding: 7px 8px;
  white-space: nowrap;
}

th {
  color: #526071;
  font-weight: 600;
}

.group-row td {
  background: #f6f7f9;
  color: #1d2430;
  font-weight: 700;
  border-top: 1px solid #d8dee8;
}

.detail-row td {
  padding: 0;
  background: #fbfcfe;
}

.detail-row details {
  padding: 8px 12px 12px;
}

.detail-row summary {
  color: #526071;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 8px;
}

.leg-detail {
  max-width: 100%;
  overflow-x: auto;
}

.stale-row {
  color: #6b7280;
}

.stale-row td {
  background: #fbfaf7;
}

.fresh,
.leg-status {
  display: inline-block;
  min-width: 52px;
  border-radius: 999px;
  padding: 2px 7px;
  font-weight: 600;
  text-align: center;
}

.fresh.live,
.leg-status.markable {
  background: #dcfce7;
  color: #166534;
}

.fresh.stale,
.leg-status.stale-book,
.leg-status.missing-book,
.leg-status.missing-mark {
  background: #fef3c7;
  color: #92400e;
}

.tag {
  border-radius: 999px;
  padding: 2px 7px;
  font-weight: 600;
}

.tag.TESTABLE {
  background: #dcfce7;
  color: #166534;
}

.tag.NO_EDGE {
  background: #eef2f7;
  color: #465160;
}

.tag.GHOST,
.tag.NOT_CAPTURABLE {
  background: #fee2e2;
  color: #991b1b;
}

.tag.INSIDE_SPREAD,
.tag.TAIL_STRUCTURE,
.tag.SPREAD_ILLUSION {
  background: #fef3c7;
  color: #92400e;
}

@media (max-width: 900px) {
  .grid {
    grid-template-columns: 1fr;
  }

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

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