:root {
  color-scheme: light;
  --bg: #f6f4ef;
  --bg-strong: #efebe3;
  --surface: #fffefa;
  --surface-soft: #faf8f2;
  --surface-strong: #f1ede5;
  --border: #ded8cc;
  --border-strong: #c9c0b1;
  --ink: #17161b;
  --muted: #6f6a61;
  --muted-strong: #494640;
  --nav: #101418;
  --nav-soft: #182127;
  --teal: #147f7a;
  --teal-soft: #e5f3ef;
  --blue: #355f91;
  --green: #23724a;
  --amber: #966315;
  --red: #a13b2b;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --serif: Georgia, "Times New Roman", serif;
  --shadow: 0 10px 24px rgba(31, 28, 22, 0.05);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1.42;
}

body.login-page {
  display: grid;
  min-height: 100vh;
  place-items: center;
}

button,
input,
table {
  font: inherit;
}

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

a:hover {
  text-decoration: underline;
}

.shell {
  display: grid;
  grid-template-columns: 226px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px 14px;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  background: var(--nav);
  color: #ffffff;
}

.brand {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 28px;
  padding: 0 2px;
}

.brand.compact {
  margin-bottom: 18px;
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 7px;
  background: var(--teal);
  color: #ffffff;
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 700;
}

.brand strong,
.brand span {
  display: block;
}

.brand strong {
  font-size: 13px;
}

.brand span {
  color: #9fa9b2;
  font-size: 11px;
}

nav {
  display: grid;
  gap: 4px;
}

nav a {
  color: #bac4cc;
  padding: 8px 10px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}

nav a.active,
nav a:hover {
  background: var(--nav-soft);
  color: #ffffff;
  text-decoration: none;
}

main {
  min-width: 0;
  padding: 24px;
}

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

.topbar-copy {
  max-width: 720px;
}

.topbar-copy p:last-child {
  max-width: 64ch;
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--teal);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-family: var(--serif);
  font-size: 32px;
  font-weight: 500;
  line-height: 1.05;
}

h2 {
  margin-bottom: 0;
  font-size: 16px;
  font-weight: 760;
}

h3 {
  margin-bottom: 0;
  font-size: 14px;
}

button {
  min-height: 34px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  font-size: 12px;
  font-weight: 750;
  padding: 7px 12px;
}

button:hover {
  border-color: var(--teal);
  color: var(--teal);
}

button:disabled {
  cursor: wait;
  opacity: 0.64;
}

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

.summary-grid article,
.panel {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.summary-grid article {
  min-height: 86px;
  padding: 13px 14px;
}

.summary-grid span {
  display: block;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

.summary-grid strong {
  display: block;
  margin-top: 12px;
  font-family: var(--serif);
  font-size: 29px;
  font-weight: 500;
  line-height: 1;
}

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

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

.timestamp {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
}

.runner-list {
  min-width: 0;
}

.fleet-console,
.table-wrap {
  min-width: 0;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-soft);
}

.fleet-table,
table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.fleet-table {
  min-width: 880px;
}

table {
  min-width: 520px;
}

.fleet-table th,
th {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-strong);
  color: var(--muted-strong);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  text-align: left;
  text-transform: uppercase;
}

.fleet-table td,
td {
  padding: 10px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  vertical-align: top;
}

td {
  font-size: 12px;
}

.fleet-table tbody tr:last-child td,
tbody tr:last-child td {
  border-bottom: 0;
}

.fleet-table tbody tr:hover td,
tbody tr:hover td {
  background: #fffdf7;
}

.runner-identity,
.runner-scope,
.check-stack {
  display: grid;
  gap: 4px;
}

.runner-identity strong,
.runner-scope strong,
td strong {
  color: var(--ink);
  font-size: 12px;
  font-weight: 760;
}

.runner-identity span,
.runner-scope span,
.fleet-muted {
  color: var(--muted);
  font-size: 11px;
  overflow-wrap: anywhere;
}

.fleet-muted {
  display: block;
  margin-top: 4px;
}

.fleet-table .labels {
  margin-top: 0;
}

.check-stack .check {
  display: grid;
  gap: 1px;
  width: max-content;
  max-width: 250px;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.check-stack .check strong {
  color: var(--ink);
  font-size: 10px;
}

.meta {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
}

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

.labels,
.checks,
.job-labels,
.matching-runners {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.labels,
.checks {
  margin-top: 8px;
}

.check {
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 11px;
  padding: 3px 7px;
}

.check.ok {
  border-color: #b9dac7;
  color: var(--green);
}

.check.failed {
  border-color: #e5b8af;
  color: var(--red);
}

.label,
.status {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  border-radius: 999px;
  padding: 2px 7px;
  font-size: 10px;
  font-weight: 800;
}

.label {
  background: #ece7dc;
  color: #3d3a34;
}

.status.online,
.status.completed,
.status.ready,
.status.receiving {
  background: #e2f1e8;
  color: var(--green);
}

.status.offline,
.status.failed,
.status.missing,
.status.not_configured {
  background: #f6e1dd;
  color: var(--red);
}

.status.degraded,
.status.queued,
.status.running,
.status.waiting,
.status.manual {
  background: #f9ecd0;
  color: var(--amber);
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 12px;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 8px;
}

.detail-grid div {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 10px;
}

.detail-grid span,
.login-panel label {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.detail-grid strong {
  display: block;
  margin-top: 3px;
  overflow-wrap: anywhere;
  font-size: 12px;
}

.login-shell {
  width: min(100%, 420px);
  padding: 20px;
}

.login-panel {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 22px;
}

.login-panel h1 {
  margin-bottom: 18px;
  font-family: var(--sans);
  font-size: 28px;
  font-weight: 800;
}

.login-github {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--ink);
  color: #ffffff;
  font-weight: 750;
  text-decoration: none;
}

.login-github:hover {
  color: #ffffff;
  text-decoration: none;
  opacity: 0.92;
}

.login-divider {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 10px;
  align-items: center;
  margin: 16px 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.login-divider::before,
.login-divider::after {
  content: "";
  height: 1px;
  background: var(--border);
}

.login-panel input {
  width: 100%;
  min-height: 42px;
  margin-top: 8px;
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 9px 11px;
}

.login-panel button {
  width: 100%;
  margin-top: 15px;
  background: var(--teal);
  color: #ffffff;
}

.form-message {
  min-height: 20px;
  margin: 11px 0 0;
  color: var(--red);
  font-size: 13px;
}

.audit-list {
  display: grid;
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.audit-list li {
  display: grid;
  grid-template-columns: 124px minmax(0, 1fr) auto;
  gap: 10px;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-soft);
  font-size: 12px;
}

.audit-list time {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
}

.empty {
  padding: 18px;
  border: 1px dashed var(--border-strong);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

.onboarding-grid {
  display: grid;
  gap: 10px;
}

.onboarding-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 12px;
}

.card-heading,
.setup-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.card-heading h3 {
  margin: 0 0 3px;
  font-size: 14px;
}

.readiness-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.readiness-item {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  padding: 9px;
}

.readiness-item > span {
  display: block;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

.readiness-item strong {
  display: block;
  margin-top: 5px;
}

.readiness-item p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.matching-runners {
  margin-top: 8px;
}

.matching-runners span {
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
  color: var(--muted);
  font-size: 11px;
  padding: 5px 7px;
}

.matching-runners strong {
  color: var(--ink);
}

.setup-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.78fr) minmax(0, 1.22fr);
  gap: 8px;
  margin-top: 8px;
}

.setup-block {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  padding: 10px;
}

.setup-heading {
  align-items: center;
  margin-bottom: 8px;
}

.setup-heading strong {
  font-size: 12px;
}

.setup-heading button {
  min-height: 28px;
  padding: 4px 9px;
  font-size: 11px;
}

pre {
  max-height: 190px;
  margin: 0;
  overflow: auto;
  border-radius: 7px;
  background: #0f141b;
  color: #e8ecef;
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.5;
  padding: 10px;
  white-space: pre;
}

@media (max-width: 1100px) {
  .summary-grid,
  .split,
  .readiness-grid,
  .setup-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

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

  .sidebar {
    position: static;
    height: auto;
  }

  nav {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  main {
    padding: 18px;
  }
}

@media (max-width: 640px) {
  main {
    padding: 14px;
  }

  .topbar,
  .panel-heading,
  .card-heading {
    flex-direction: column;
  }

  nav,
  .summary-grid,
  .split,
  .detail-grid,
  .readiness-grid,
  .setup-grid {
    grid-template-columns: 1fr;
  }

  .audit-list li {
    grid-template-columns: 1fr;
  }
}
