:root {
  color-scheme: light;
  --bg: #f6f7fb;
  --card: #ffffff;
  --ink: #162033;
  --muted: #647084;
  --line: #dde3ee;
  --accent: #2846f0;
  --ok: #0f8f5f;
  --bad: #c43434;
}

* {
  box-sizing: border-box;
}

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

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

button,
select,
input {
  border: 1px solid var(--line);
  border-radius: 10px;
  font: inherit;
  padding: 10px 12px;
}

button {
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  font-weight: 700;
}

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

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 12px;
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

code,
pre {
  background: #eef2ff;
  border-radius: 8px;
  padding: 2px 6px;
}

pre {
  overflow: auto;
  padding: 16px;
}

.topbar {
  align-items: center;
  background: #111827;
  display: flex;
  justify-content: space-between;
  padding: 16px 28px;
}

.topbar a {
  color: #fff;
  margin-left: 18px;
}

.topbar nav {
  align-items: center;
  display: flex;
}

.brand {
  font-size: 18px;
  font-weight: 800;
  margin-left: 0 !important;
}

.logout-form {
  display: inline-block;
  margin-left: 18px;
}

.logout-form button {
  background: rgba(255, 255, 255, .12);
  border-color: rgba(255, 255, 255, .18);
  padding: 8px 10px;
}

.container {
  margin: 0 auto;
  max-width: 1180px;
  padding: 32px 24px;
}

.hero,
.page-title {
  align-items: end;
  display: flex;
  gap: 24px;
  justify-content: space-between;
  margin-bottom: 24px;
}

.hero h1,
.page-title h1 {
  font-size: 42px;
  line-height: 1.05;
  margin: 6px 0 10px;
}

.eyebrow {
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .08em;
  margin: 0;
  text-transform: uppercase;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 8px 30px rgba(22, 32, 51, .06);
  margin-bottom: 20px;
  padding: 20px;
}

.compact {
  min-width: 280px;
}

.compact label,
.compact select,
.compact button {
  display: block;
  margin-top: 10px;
  width: 100%;
}

.grid {
  display: grid;
  gap: 18px;
}

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

.metric {
  font-size: 36px;
  font-weight: 800;
  margin: 0;
}

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

.status {
  border-radius: 999px;
  color: #fff;
  display: inline-block;
  font-size: 12px;
  font-weight: 800;
  padding: 4px 8px;
}

.status.success,
.toggle.on {
  background: var(--ok);
}

.status.failed {
  background: var(--bad);
}

.status.running {
  background: var(--accent);
}

.toggle {
  background: #8490a7;
  min-width: 68px;
}

.tabs a {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  display: inline-block;
  margin-left: 8px;
  padding: 8px 12px;
}

.tabs a.active {
  background: var(--accent);
  color: #fff;
}

.filters {
  align-items: end;
  display: flex;
  gap: 12px;
}

.filters label {
  display: grid;
  gap: 6px;
}

.login-page {
  background:
    radial-gradient(circle at top left, rgba(40, 70, 240, .16), transparent 32rem),
    var(--bg);
}

.login-shell {
  align-items: center;
  display: grid;
  min-height: 100vh;
  padding: 24px;
}

.login-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: 0 24px 80px rgba(22, 32, 51, .14);
  margin: 0 auto;
  max-width: 420px;
  padding: 32px;
  width: 100%;
}

.login-card h1 {
  font-size: 38px;
  margin: 8px 0 8px;
}

.login-form {
  display: grid;
  gap: 16px;
  margin-top: 24px;
}

.login-form label {
  display: grid;
  gap: 8px;
  font-weight: 700;
}

.alert {
  background: #fff0f0;
  border: 1px solid #f2b7b7;
  border-radius: 12px;
  color: var(--bad);
  padding: 10px 12px;
}

.notice {
  background: #eef8ff;
  border: 1px solid #b9d9f6;
  border-radius: 14px;
  color: #184b7a;
  margin-bottom: 20px;
  padding: 14px 16px;
}

.help-text {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
  margin: 10px 0 0;
}

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

.card-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 12px;
}

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

.runs-table td,
.runs-table th {
  min-width: 120px;
}

.nowrap {
  white-space: nowrap;
}

.pill {
  background: #eef2ff;
  border-radius: 999px;
  display: inline-block;
  font-weight: 800;
  padding: 4px 10px;
}

.date-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.date-tag {
  background: #f3f6fb;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12px;
  padding: 2px 8px;
}

.error-text {
  color: var(--bad);
  font-size: 12px;
  margin-top: 6px;
}

.calendar-nav {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin-bottom: 18px;
}

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

.calendar-weekday {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-align: center;
  text-transform: uppercase;
}

.calendar-cell {
  background: #fff;
  border: 2px solid #c5cedd;
  border-radius: 14px;
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  min-height: 110px;
  padding: 10px;
  text-align: left;
  width: 100%;
}

.calendar-cell.selected {
  background: #edf2ff;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(40, 70, 240, .18);
}

.fetch-panel-head {
  align-items: start;
  display: flex;
  gap: 16px;
  justify-content: space-between;
}

.fetch-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.ghost-btn {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  padding: 10px 12px;
}

.ghost-btn:disabled {
  cursor: not-allowed;
  opacity: .5;
}

.progress-panel {
  margin-top: 18px;
}

.progress-panel.hidden,
.hidden {
  display: none;
}

.progress-meta {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
}

.progress-bar {
  background: #edf1f7;
  border-radius: 999px;
  height: 10px;
  overflow: hidden;
}

.progress-fill {
  background: var(--accent);
  height: 100%;
  transition: width .3s ease;
  width: 0;
}

.calendar-cell.empty {
  background: transparent;
  border-color: transparent;
}

.calendar-cell.has-data {
  background: #e7f8ee;
  border-color: #2f9d62;
}

.calendar-cell.no-data {
  background: #f8fafc;
  border-color: #b8c2d4;
}

.calendar-cell.has-data .calendar-meta,
.calendar-cell.no-data .calendar-meta {
  color: #24324a;
}

.calendar-day {
  color: #111827;
  font-size: 20px;
  font-weight: 800;
}

.calendar-meta {
  color: #24324a;
  font-weight: 600;
  margin-top: 8px;
}

.calendar-meta .muted,
.calendar-cell .muted {
  color: #4b5c78;
}

.calendar-runs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 8px;
}

.calendar-link {
  color: var(--accent);
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  margin-top: 8px;
}

.run-chip {
  background: #fff;
  border: 1px solid #9db0cf;
  border-radius: 999px;
  color: #24324a;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 6px;
}

.danger-btn {
  background: #fff0f0;
  border: 1px solid #efb4b4;
  border-radius: 10px;
  color: var(--bad);
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  padding: 8px 10px;
}

.danger-btn:disabled {
  cursor: wait;
  opacity: .7;
}

@media (max-width: 800px) {
  .hero,
  .page-title,
  .filters {
    align-items: stretch;
    display: grid;
  }

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