:root {
  color-scheme: light;
  --bg: #f5f7fa;
  --panel: #ffffff;
  --ink: #17212b;
  --muted: #657282;
  --line: #d9e0e7;
  --soft: #ecf1f5;
  --primary: #0f766e;
  --primary-ink: #ffffff;
  --danger: #b42318;
  --code: #111827;
  --code-ink: #f9fafb;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
}

.topbar {
  background: #25323a;
  color: #fff;
}

.nav {
  display: flex;
  align-items: center;
  gap: 6px;
  max-width: 1180px;
  margin: 0 auto;
  padding: 14px 22px;
  overflow-x: auto;
}

.nav a {
  color: #eaf0f5;
  text-decoration: none;
  padding: 8px 10px;
  border-radius: 6px;
  white-space: nowrap;
}

.nav a:hover,
.nav a.active {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.nav .brand {
  font-weight: 700;
  margin-right: 10px;
}

.page {
  max-width: 1180px;
  margin: 0 auto;
  padding: 26px 22px 44px;
}

.hero,
.page-heading,
.panel,
.auth-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  align-items: end;
  padding: 28px;
  margin-bottom: 18px;
}

.page-heading {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
  padding: 22px 24px;
  margin-bottom: 18px;
}

.panel {
  padding: 20px;
  margin-bottom: 18px;
}

.auth-card {
  max-width: 420px;
  padding: 24px;
  margin: 48px auto;
}

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

h1 {
  font-size: 28px;
  line-height: 1.18;
  margin-bottom: 8px;
}

h2 {
  font-size: 17px;
  margin-bottom: 6px;
}

.lede {
  color: var(--muted);
  line-height: 1.5;
  max-width: 780px;
  margin-bottom: 0;
}

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

.section-title {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
  margin-bottom: 14px;
}

.section-title p {
  color: var(--muted);
  margin-bottom: 0;
}

.quick-actions,
.form-actions,
.actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  border: 1px solid #9aa9b5;
  background: #fff;
  color: var(--ink);
  border-radius: 6px;
  padding: 7px 12px;
  font: inherit;
  text-decoration: none;
  cursor: pointer;
}

button:hover,
.button:hover {
  border-color: #687987;
}

.primary {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--primary-ink);
}

.danger {
  border-color: var(--danger);
  color: var(--danger);
}

label {
  display: block;
  font-size: 13px;
  font-weight: 650;
  margin-bottom: 5px;
}

input,
select {
  width: 100%;
  min-height: 38px;
  border: 1px solid #c5ced7;
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 8px 10px;
  font: inherit;
}

.form-stack {
  display: grid;
  gap: 14px;
}

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

.repo-form .wide,
.repo-form .form-actions {
  grid-column: 1 / -1;
}

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

pre {
  margin: 0;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  background: var(--code);
  color: var(--code-ink);
  padding: 14px;
  border-radius: 6px;
}

code,
.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

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

table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
}

th,
td {
  text-align: left;
  border-bottom: 1px solid #e4e9ee;
  padding: 10px 11px;
  vertical-align: top;
}

th {
  background: var(--soft);
  color: #394a58;
  font-size: 12px;
  text-transform: uppercase;
}

.url-cell {
  overflow-wrap: anywhere;
}

.empty,
.status {
  color: var(--muted);
}

.notice {
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 6px;
  background: #fff4f2;
}

.error {
  color: var(--danger);
}

.stat {
  min-width: 190px;
  padding: 12px 14px;
  background: var(--soft);
  border-radius: 6px;
}

.stat span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 4px;
}

.stat strong {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.table-link {
  color: var(--primary);
  font-weight: 650;
}

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

.script-list {
  position: sticky;
  top: 16px;
  max-height: calc(100vh - 110px);
  overflow: auto;
}

.file-links {
  display: grid;
  gap: 4px;
  margin-top: 14px;
}

.file-links a {
  color: var(--ink);
  text-decoration: none;
  border-radius: 5px;
  padding: 7px 8px;
  overflow-wrap: anywhere;
}

.file-links a:hover,
.file-links a.active {
  background: var(--soft);
}

.source-panel {
  min-width: 0;
}

.source {
  min-height: 440px;
}

@media (max-width: 820px) {
  .page {
    padding: 18px 14px 32px;
  }

  .hero,
  .page-heading,
  .section-title {
    display: block;
  }

  .quick-actions,
  .page-heading > button {
    margin-top: 14px;
  }

  .repo-form,
  .command-grid,
  .viewer-layout {
    grid-template-columns: 1fr;
  }

  .script-list {
    position: static;
    max-height: none;
  }

  .optional {
    display: none;
  }
}
