:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --ink: #18202a;
  --muted: #687282;
  --line: #dfe4ea;
  --accent: #1267d8;
  --accent-dark: #0d4fa8;
  --ok: #0f8a4b;
  --warn: #a46100;
  --bad: #b3261e;
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

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

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

button,
input,
select,
textarea {
  font: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 56px;
  padding: 0 28px;
  background: #ffffff;
  border-bottom: 1px solid var(--line);
}

.brand {
  color: var(--ink);
  font-weight: 700;
}

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

.topbar nav a {
  color: var(--muted);
  font-weight: 600;
}

.nav-form {
  margin: 0;
}

.nav-form button {
  padding: 0;
  color: var(--muted);
  background: transparent;
  border: 0;
  cursor: pointer;
  font-weight: 600;
}

.shell {
  max-width: 1240px;
  margin: 0 auto;
  padding: 28px;
}

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

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 28px;
}

h2 {
  font-size: 16px;
}

.page-head p,
.subtle,
.empty,
.clip {
  color: var(--muted);
}

.clip {
  display: block;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 18px;
}

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

.section-label {
  margin-top: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

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

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

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

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

tr:last-child td {
  border-bottom: 0;
}

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

.button,
button.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 12px;
  color: var(--ink);
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 6px;
  cursor: pointer;
  font-weight: 650;
}

.button.primary {
  color: #ffffff;
  background: var(--accent);
  border-color: var(--accent);
}

.button.primary:hover {
  background: var(--accent-dark);
}

.button.danger-button {
  color: #ffffff;
  background: var(--bad);
  border-color: var(--bad);
}

.pill,
.status,
.schedule-chip,
.level {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: #eef2f6;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.status.success,
.schedule-chip.on {
  background: #e5f5ec;
  color: var(--ok);
}

.status.running,
.status.pending {
  background: #fff4df;
  color: var(--warn);
}

.status.failed,
.schedule-chip.off,
.danger {
  background: #fff0f0;
  color: var(--bad);
}

.schedule-chip {
  border: 0;
  cursor: pointer;
}

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

.stack {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.form-panel {
  max-width: 860px;
}

.form-panel.wide {
  max-width: none;
}

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

.span-2 {
  grid-column: span 2;
}

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

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

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

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-weight: 650;
}

input,
select,
textarea {
  width: 100%;
  color: var(--ink);
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 10px;
}

textarea {
  min-height: 360px;
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
}

textarea.compact {
  min-height: 220px;
}

summary {
  cursor: pointer;
  color: var(--muted);
  font-weight: 700;
}

details textarea {
  margin-top: 10px;
}

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

.check input {
  width: auto;
}

.fieldset {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.fieldset legend {
  padding: 0 6px;
  color: var(--muted);
  font-weight: 700;
}

.schedule-option {
  align-items: flex-start;
  color: var(--ink);
}

.schedule-option span {
  display: grid;
  gap: 2px;
}

.schedule-option small {
  color: var(--muted);
}

.run-list {
  display: grid;
}

.last-run {
  display: grid;
  gap: 4px;
  justify-items: start;
}

.run-row {
  display: grid;
  grid-template-columns: auto auto 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
}

.run-row:last-child {
  border-bottom: 0;
}

.kv {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
}

.kv div {
  display: grid;
  gap: 6px;
  padding: 16px;
  background: #ffffff;
}

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

pre {
  margin: 0;
  padding: 16px;
  overflow: auto;
  color: #223;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  white-space: pre-wrap;
}

.log {
  display: grid;
}

.log-line {
  display: grid;
  grid-template-columns: minmax(190px, auto) auto 1fr;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
}

.log-line:last-child {
  border-bottom: 0;
}

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

.level.error {
  background: #fff0f0;
  color: var(--bad);
}

.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: #eef2f6;
}

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

.auth-card {
  display: grid;
  gap: 18px;
  padding: 24px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 18px 45px rgba(24, 32, 42, 0.08);
}

.auth-head {
  display: grid;
  gap: 6px;
}

.auth-head p {
  color: var(--muted);
}

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

.auth-form .button {
  width: 100%;
}

.alert {
  padding: 10px 12px;
  border-radius: 6px;
  font-weight: 650;
}

.alert.error {
  color: var(--bad);
  background: #fff0f0;
  border: 1px solid #ffd4d4;
}

@media (max-width: 760px) {
  .topbar,
  .page-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .shell {
    padding: 18px;
  }

  .grid,
  .form-grid,
  .settings-grid,
  .time-grid,
  .days-grid,
  .kv {
    grid-template-columns: 1fr;
  }

  .span-2 {
    grid-column: span 1;
  }

  .run-row,
  .log-line {
    grid-template-columns: 1fr;
  }
}
