:root {
  --bg: #0e1116;
  --panel: #161b22;
  --panel-2: #1f262e;
  --line: #2a3038;
  --text: #e6edf3;
  --muted: #8a96a3;
  --accent: #4f9cff;
  --ok: #2ea043;
  --fail: #f85149;
  --warn: #d29922;
  --running: #4f9cff;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
}

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

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 24px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.topbar .brand { font-weight: 600; font-size: 16px; color: var(--text); }
.topbar nav { display: flex; gap: 18px; align-items: center; }
.topbar nav a { color: var(--muted); }
.topbar nav a:hover { color: var(--text); text-decoration: none; }
.topbar form { margin: 0; }
.topbar button.link {
  background: none; border: none; color: var(--muted); font: inherit; cursor: pointer; padding: 0;
}
.topbar button.link:hover { color: var(--text); }

.content { max-width: 1180px; margin: 0 auto; padding: 28px 24px 60px; }

h1 { font-size: 22px; font-weight: 600; margin: 0 0 20px; }
h2 { font-size: 16px; font-weight: 600; margin: 0; }

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

/* ---- login ---- */
.login-wrap {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
}
.login-card {
  width: 100%; max-width: 360px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 28px; display: flex; flex-direction: column; gap: 14px;
}
.login-card h1 { margin: 0 0 6px; font-size: 18px; }
.login-card label { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--muted); }
.login-card input {
  background: var(--bg); color: var(--text);
  border: 1px solid var(--line); border-radius: 6px;
  padding: 9px 10px; font: inherit;
}
.login-card input:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
.login-card button {
  background: var(--accent); color: white; border: none; border-radius: 6px;
  padding: 10px; font: inherit; font-weight: 600; cursor: pointer;
}
.login-card button:hover { filter: brightness(1.1); }
.login-card .error {
  background: rgba(248, 81, 73, 0.12); color: var(--fail);
  border: 1px solid rgba(248, 81, 73, 0.4);
  border-radius: 6px; padding: 8px 10px; margin: 0; font-size: 13px;
}

/* ---- cards ---- */
.cards {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
}
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 18px; display: flex; flex-direction: column; gap: 12px;
}
.card header { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.card .domain { font-size: 12px; color: var(--muted); }
.card .status { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0; font-size: 12px; }
.card .ts { color: var(--muted); }
.card .last-log { font-size: 12px; }
.card .actions { display: flex; flex-wrap: wrap; gap: 6px; }
.card .actions form { margin: 0; }
.card .actions .action {
  background: var(--panel-2); color: var(--text);
  border: 1px solid var(--line); border-radius: 6px;
  padding: 6px 10px; font: inherit; font-size: 12px; cursor: pointer;
}
.card .actions .action:hover { border-color: var(--accent); color: var(--accent); }
.card .actions .action.danger { color: var(--warn); }
.card .actions .action.danger:hover { border-color: var(--warn); }

/* ---- badges ---- */
.badge {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em;
}
.badge-ok      { background: rgba(46, 160, 67, 0.15);  color: var(--ok); }
.badge-fail    { background: rgba(248, 81, 73, 0.15);  color: var(--fail); }
.badge-running { background: rgba(79, 156, 255, 0.15); color: var(--running); }
.badge-never   { background: rgba(138, 150, 163, 0.15); color: var(--muted); }

/* ---- logs ---- */
.meta { color: var(--muted); margin: 0 0 14px; display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.log {
  background: #000; color: #d4d4d4;
  padding: 14px 16px; border-radius: 8px; border: 1px solid var(--line);
  font: 12.5px/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre-wrap; word-break: break-word;
  max-height: 70vh; overflow-y: auto;
  margin: 0;
}
.log .stderr { color: #ffb4ad; }
.log .meta-line { color: #6cb6ff; }

/* ---- history ---- */
.filter { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 16px; }
.filter a {
  padding: 4px 10px; border-radius: 999px; font-size: 12px;
  background: var(--panel-2); color: var(--muted); border: 1px solid var(--line);
}
.filter a:hover { color: var(--text); text-decoration: none; }
.filter a.active { background: var(--accent); color: white; border-color: var(--accent); }

.history {
  width: 100%; border-collapse: collapse;
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px; overflow: hidden;
}
.history th, .history td {
  padding: 10px 14px; text-align: left;
  border-bottom: 1px solid var(--line);
}
.history th { background: var(--panel-2); font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.history tbody tr:last-child td { border-bottom: none; }
.history code { font-size: 12px; color: var(--accent); }
