:root {
  color-scheme: light;
  --page: #f6f7f9;
  --surface: #ffffff;
  --surface-soft: #eef2f7;
  --text: #20242c;
  --muted: #5e6878;
  --line: #d9dee7;
  --ok: #197a52;
  --ok-bg: #e8f5ee;
  --review: #a36a00;
  --review-bg: #fff4d7;
  --blocker: #b2382f;
  --blocker-bg: #fce8e6;
  --manual: #3f638e;
  --manual-bg: #e8f0f9;
  --ink: #14171d;
  --focus: #255fbd;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--page);
  color: var(--text);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

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

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

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(28px, 4vw, 48px);
  line-height: 1;
  letter-spacing: 0;
}

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

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

.tabs {
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(92px, 1fr));
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface);
}

.tab {
  min-height: 38px;
  border: 0;
  padding: 0 16px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
}

.tab.active {
  background: var(--ink);
  color: #fff;
}

.command-button,
.minor-button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  padding: 0 14px;
  font-weight: 700;
}

.command-button:hover,
.minor-button:hover,
.tab:hover {
  border-color: #aeb7c5;
}

.command-button:disabled {
  cursor: wait;
  opacity: 0.7;
}

.refresh-status {
  min-width: 104px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-align: right;
}

.status-band {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  gap: 16px;
  align-items: center;
  min-height: 106px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  margin-bottom: 14px;
}

.label,
.caption {
  color: var(--muted);
  font-size: 13px;
}

.status-title {
  margin-top: 4px;
  font-size: clamp(24px, 3vw, 36px);
  font-weight: 800;
}

.status-title.ok {
  color: var(--ok);
}

.status-title.review,
.status-title.manual {
  color: var(--review);
}

.status-title.blocker {
  color: var(--blocker);
}

.status-meta {
  display: grid;
  gap: 5px;
  min-width: 260px;
  color: var(--muted);
  font-size: 13px;
  text-align: right;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(130px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.metric {
  min-height: 92px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.metric-value {
  margin-top: 8px;
  font-size: 28px;
  font-weight: 800;
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
  gap: 14px;
  margin-bottom: 14px;
}

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

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 58px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

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

.gate {
  min-height: 114px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfe;
}

.gate-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  font-weight: 800;
}

.gate-value {
  margin-top: 8px;
  font-size: 20px;
  font-weight: 800;
}

.gate-detail {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.feature-list {
  display: grid;
  gap: 8px;
  padding: 14px;
  max-height: 552px;
  overflow: auto;
}

.feature {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  min-height: 36px;
  border-bottom: 1px solid #edf0f5;
  padding-bottom: 8px;
}

.feature:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.feature-name {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  overflow-wrap: anywhere;
}

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

.table-heading {
  align-items: flex-end;
}

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

input,
select {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  padding: 0 10px;
}

input {
  width: 190px;
}

.table-wrap {
  overflow: auto;
}

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

th,
td {
  padding: 12px 14px;
  border-bottom: 1px solid #edf0f5;
  text-align: left;
  vertical-align: top;
  font-size: 13px;
}

th {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0;
  background: #fbfcfe;
}

tbody tr:hover {
  background: #faf7ef;
}

tbody tr.schedule-divider:hover,
.schedule-divider {
  background: #f1f4f8;
}

.schedule-divider td {
  padding: 0;
  border-top: 2px solid #9aa7b7;
  border-bottom: 1px solid var(--line);
}

.schedule-divider-label {
  display: block;
  padding: 10px 14px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.standby-rank {
  color: var(--muted);
  font-weight: 800;
}

th:nth-child(1),
td:nth-child(1) {
  width: 18%;
}

th:nth-child(2),
td:nth-child(2),
th:nth-child(6),
td:nth-child(6) {
  width: 8%;
}

th:nth-child(3),
td:nth-child(3),
th:nth-child(4),
td:nth-child(4),
th:nth-child(5),
td:nth-child(5),
th:nth-child(7),
td:nth-child(7) {
  width: 17%;
}

.bp-name {
  font-weight: 800;
}

.bp-url,
.small-note {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

a {
  color: var(--focus);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 2px 9px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.pill.ok {
  background: var(--ok-bg);
  color: var(--ok);
}

.pill.review {
  background: var(--review-bg);
  color: var(--review);
}

.pill.blocker {
  background: var(--blocker-bg);
  color: var(--blocker);
}

.pill.manual,
.pill.unknown {
  background: var(--manual-bg);
  color: var(--manual);
}

.row-notes {
  margin-top: 6px;
  display: grid;
  gap: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
}

.evidence-panel pre {
  min-height: 180px;
  max-height: 360px;
  margin: 0;
  padding: 14px;
  overflow: auto;
  background: #11161d;
  color: #dbe5f0;
  border-radius: 0 0 8px 8px;
  font-size: 12px;
  line-height: 1.45;
}

.skeleton {
  color: #8c96a6;
}

.error-box {
  padding: 16px;
  color: var(--blocker);
}

@media (max-width: 1100px) {
  .metrics-grid {
    grid-template-columns: repeat(3, minmax(140px, 1fr));
  }

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

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

  .topbar,
  .status-band,
  .table-heading {
    grid-template-columns: 1fr;
    flex-direction: column;
    align-items: stretch;
  }

  .topbar-actions,
  .table-tools {
    justify-content: stretch;
  }

  .tabs,
  .command-button,
  .refresh-status,
  input,
  select {
    width: 100%;
  }

  .refresh-status {
    min-width: 0;
    text-align: left;
  }

  .status-meta {
    min-width: 0;
    text-align: left;
  }

  .metrics-grid,
  .gates {
    grid-template-columns: 1fr;
  }

  table {
    min-width: 1100px;
  }
}
