:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #1c2430;
  --muted: #5b6676;
  --border: #dde2e8;
  --accent: #1f6feb;
  --accent-text: #ffffff;
  --error-bg: #fdecec;
  --error-text: #9b1c1c;
  --ok-bg: #e8f6ec;
  --ok-text: #1d6b35;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1419;
    --surface: #182029;
    --text: #e6e9ee;
    --muted: #9aa5b4;
    --border: #2c3744;
    --accent: #4c8dff;
    --error-bg: #3a1717;
    --error-text: #ffb4b4;
    --ok-bg: #12301d;
    --ok-text: #9be2b0;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

a { color: var(--accent); }

.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 24px;
  padding: 12px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.brand { font-weight: 600; color: var(--text); text-decoration: none; }
.topbar nav { display: flex; flex-wrap: wrap; gap: 16px; }
.topbar nav a { text-decoration: none; }

.page { max-width: 1100px; margin: 24px auto; padding: 0 16px; }
.narrow { max-width: 560px; margin: 40px auto; padding: 0 16px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 24px;
  margin-bottom: 16px;
}

h1 { font-size: 1.4rem; margin: 0 0 12px; }
h2 { font-size: 1.1rem; margin: 0 0 8px; }

.heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }

label { display: block; margin: 12px 0 4px; font-weight: 500; }
label.inline { display: flex; gap: 8px; align-items: baseline; font-weight: 400; margin: 6px 0; }

input[type="email"], input[type="password"], input[type="text"], input:not([type]) {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
}

fieldset { border: 1px solid var(--border); border-radius: 8px; margin: 16px 0; padding: 8px 14px 12px; }
legend { font-weight: 500; padding: 0 4px; }

button, .button {
  display: inline-block;
  margin-top: 16px;
  padding: 9px 16px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: var(--accent);
  color: var(--accent-text);
  font: inherit;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
}
button.secondary, .button.secondary { background: transparent; color: var(--accent); }
button[disabled] { opacity: 0.6; cursor: default; }
.heading button, .heading .button { margin-top: 0; }

.alert { padding: 10px 12px; border-radius: 6px; }
.alert.error { background: var(--error-bg); color: var(--error-text); }
.alert.ok { background: var(--ok-bg); color: var(--ok-text); }

.muted { color: var(--muted); }
.mono { font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; }

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-weight: 600; font-size: 0.9rem; color: var(--muted); }
tr.inactive td { color: var(--muted); }
td.details { font-size: 0.85rem; color: var(--muted); max-width: 360px; overflow-wrap: anywhere; }

.tag {
  display: inline-block;
  margin: 0 4px 4px 0;
  padding: 1px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.85rem;
}

.status { font-weight: 600; }
.status.ok { color: var(--ok-text); }
.status.failed, .status.interrupted { color: var(--error-text); }

.footer { text-align: center; color: var(--muted); font-size: 0.8rem; padding: 24px; }

@media (max-width: 720px) {
  table { display: block; overflow-x: auto; }
}
