/* Barebones. One accent, one danger colour, a system font stack, no framework. */
:root {
  --bg: #ffffff;
  --panel: #f7f7f8;
  --line: #dcdce0;
  --ink: #16161a;
  --muted: #6a6a73;
  --accent: #2b5cd9;
  --danger: #b3261e;
  --ok: #1a7f45;
  --warn: #9a6400;
}

* { box-sizing: border-box; }

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

h1 { font-size: 18px; margin: 0; }
h2 { font-size: 15px; margin: 0 0 4px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }

/* ---- chrome ---- */
#topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 10px 16px; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; background: var(--bg); z-index: 5;
}
#tabs { display: flex; gap: 4px; }
.tab {
  background: none; border: 1px solid transparent; border-radius: 6px;
  padding: 5px 12px; cursor: pointer; color: var(--muted); font: inherit;
}
.tab:hover { background: var(--panel); }
.tab[aria-current="true"] { color: var(--ink); border-color: var(--line); background: var(--panel); }
.health { color: var(--muted); font-size: 12px; }
.health .down { color: var(--danger); font-weight: 600; }
.health .up { color: var(--ok); }

.who {
  margin-left: auto; display: flex; align-items: center; gap: 8px;
  color: var(--muted); font-size: 12px;
}
.who img { width: 22px; height: 22px; border-radius: 50%; }
.who button { padding: 3px 9px; font-size: 12px; }

/* ---- sign-in gate ---- */
.gate {
  position: fixed; inset: 0; z-index: 30; background: var(--bg);
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.gate-card {
  border: 1px solid var(--line); border-radius: 10px; padding: 28px 32px;
  max-width: 420px; width: 100%; text-align: center;
}
.gate-card h2 { font-size: 22px; margin-bottom: 8px; }
.gate-card .note { text-align: left; margin: 0 0 14px; }
a.button {
  display: inline-block; text-decoration: none; padding: 8px 18px;
  border: 1px solid var(--accent); border-radius: 6px;
  background: var(--accent); color: #fff;
}
a.button:hover { background: #244cb5; }
.gate-card .hint:last-child { margin: 14px 0 0; word-break: break-all; }

.banner {
  padding: 8px 16px; background: #fff7e0; border-bottom: 1px solid #e8d9a8;
  display: flex; gap: 12px; align-items: center; font-size: 13px;
}
.toast {
  position: fixed; right: 16px; bottom: 16px; z-index: 20; max-width: 460px;
  padding: 10px 14px; border-radius: 6px; border: 1px solid var(--line);
  background: var(--ink); color: #fff; white-space: pre-wrap;
}
.toast.error { background: var(--danger); }

main { padding: 16px; }
.hidden { display: none !important; }
.spacer { flex: 1; }

/* ---- controls ---- */
button, select, input, textarea { font: inherit; color: inherit; }
button {
  padding: 5px 11px; border: 1px solid var(--line); border-radius: 6px;
  background: #fff; cursor: pointer;
}
button:hover:not(:disabled) { background: var(--panel); }
button:disabled { opacity: .45; cursor: not-allowed; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.primary:hover:not(:disabled) { background: #244cb5; }
button.danger { color: var(--danger); border-color: #e3bcb9; }
button.icon { padding: 2px 6px; border: 0; background: none; font-size: 15px; line-height: 1; }
input, select, textarea {
  padding: 5px 8px; border: 1px solid var(--line); border-radius: 6px; background: #fff;
  width: 100%;
}
textarea { resize: vertical; }
label { display: block; margin-bottom: 10px; color: var(--muted); font-size: 12px; }
label > input, label > select, label > textarea { margin-top: 3px; color: var(--ink); font-size: 14px; }
label.check { display: flex; align-items: center; gap: 7px; }
label.check input { width: auto; margin: 0; }
fieldset { border: 1px solid var(--line); border-radius: 6px; padding: 12px; margin: 0 0 12px; }
legend { color: var(--muted); font-size: 12px; padding: 0 4px; }

.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.toolbar input, .toolbar select { width: auto; }
.toolbar.bulk { color: var(--muted); font-size: 12px; }
.pager { margin-top: 10px; }
.row { display: flex; gap: 10px; align-items: center; }
.row > label { flex: 1; }
.hint { color: var(--muted); font-size: 12px; margin: 0 0 10px; }
.csv-summary { white-space: pre-line; margin-top: -4px; }
.csv-summary.error-text { color: var(--danger); font-weight: 600; }

.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); gap: 16px; }
.card { border: 1px solid var(--line); border-radius: 8px; padding: 14px; margin-bottom: 16px; }
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }

/* ---- tables ---- */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); }
th { font-size: 12px; color: var(--muted); font-weight: 600; }
td.num, th.num { text-align: right; }
th.tick, td.tick { width: 28px; }
th.tick input, td.tick input { width: auto; }
tbody tr:hover { background: var(--panel); }
tr.selected { background: #eef3ff; }
tr.clickable { cursor: pointer; }
td.actions { white-space: nowrap; }
.empty { color: var(--muted); padding: 20px 8px; }

.pill {
  display: inline-block; padding: 1px 7px; border-radius: 10px;
  font-size: 11px; border: 1px solid var(--line); background: var(--panel);
}
.pill.Completed { color: var(--ok); border-color: #b9dcc7; background: #f0f9f3; }
.pill.Pending   { color: var(--warn); border-color: #e8d9a8; background: #fff9e9; }
.pill.Failed    { color: var(--danger); border-color: #e3bcb9; background: #fdf1f0; }
.pill.Archived  { color: var(--muted); }
.pill.running   { color: var(--warn); border-color: #e8d9a8; background: #fff9e9; }
.pill.completed { color: var(--ok); border-color: #b9dcc7; background: #f0f9f3; }
.pill.failed, .pill.cancelled { color: var(--danger); border-color: #e3bcb9; background: #fdf1f0; }
.stale { color: var(--warn); }

/* ---- run log ---- */
.log {
  font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace;
  background: #14141a; color: #d8d8e0; padding: 10px; border-radius: 6px;
  max-height: 340px; overflow: auto; margin: 0; white-space: pre-wrap;
}
.log .e { color: #ff8f85; }
.log .a { color: #8fd1ff; }
.log .p { color: #b8f0a8; }
#run-stats { margin: 0; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ---- report panel ---- */
.panel {
  border: 1px solid var(--line); border-radius: 8px; padding: 16px; margin-top: 16px;
  background: var(--panel);
}
.panel h2 { font-size: 17px; }
.panel section { margin-top: 16px; }
.panel h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .04em;
            color: var(--muted); margin: 0 0 6px; }
.panel table { background: #fff; }
.panel ul { margin: 0; padding-left: 18px; }
.panel li { margin-bottom: 3px; }
.score {
  font-size: 26px; font-weight: 700;
}
.note { border-left: 3px solid #e8d9a8; background: #fff9e9; padding: 8px 12px;
        font-size: 12px; border-radius: 0 4px 4px 0; }
.note.bad { border-color: #e3bcb9; background: #fdf1f0; }
a { color: var(--accent); }
