:root {
  --bg: #f4f6f8;
  --panel: #ffffff;
  --ink: #1b2733;
  --muted: #61707f;
  --line: #dde3e9;
  --brand: #003d6b;
  --accent: #50ccff;
  --ok: #2e7d32;
  --warn: #b26a00;
  --err: #c62828;
  --radius: 8px;
}

* { box-sizing: border-box; }

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

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

code {
  font-family: ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
  font-size: 0.9em;
  background: #eef2f6;
  padding: 1px 4px;
  border-radius: 3px;
}

/* ---------- top bar ---------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 16px;
  height: 52px;
  background: var(--brand);
  color: #fff;
}

.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand-mark {
  background: var(--accent);
  color: var(--brand);
  font-weight: 700;
  border-radius: 4px;
  padding: 2px 7px;
  letter-spacing: 0.04em;
}
.brand-name { color: #fff; font-weight: 600; }

.topnav { display: flex; align-items: center; gap: 18px; }
.topnav a { color: #cfe3f2; text-decoration: none; }
.topnav a:hover, .topnav a.active { color: #fff; }
.topnav .who { color: #8fb4d0; font-size: 13px; }
.topnav form { margin: 0; }

.linkish {
  background: none;
  border: 0;
  color: #cfe3f2;
  cursor: pointer;
  font: inherit;
  padding: 0;
}
.linkish:hover { color: #fff; text-decoration: underline; }

/* ---------- flashes ---------- */

.flashes { list-style: none; margin: 0; padding: 8px 16px 0; }
.flash {
  border-radius: var(--radius);
  padding: 9px 12px;
  margin-bottom: 8px;
  border: 1px solid var(--line);
  background: var(--panel);
}
.flash-error { border-color: #f0c4c4; background: #fdf1f1; color: var(--err); }
.flash-success { border-color: #c5e2c7; background: #f1f9f2; color: var(--ok); }

/* ---------- viewer ---------- */

body.viewer { height: 100vh; display: flex; flex-direction: column; }
.split { flex: 1; display: flex; min-height: 0; }

.sidebar {
  width: 208px;
  flex: 0 0 208px;
  background: var(--panel);
  border-right: 1px solid var(--line);
  overflow-y: auto;
  padding: 14px 0 24px;
}
.sidebar h2 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 0 16px 8px;
}
.sidebar .year {
  font-size: 12px;
  color: var(--muted);
  margin: 14px 16px 4px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}
.reportlist { list-style: none; margin: 0; padding: 0; }
.reportlist a {
  display: flex;
  gap: 8px;
  padding: 6px 16px;
  text-decoration: none;
  color: var(--ink);
  border-left: 3px solid transparent;
}
.reportlist a:hover { background: #eef4f9; }
.reportlist a.current {
  background: #e6f2fb;
  border-left-color: var(--brand);
  font-weight: 600;
}
.reportlist .cw { color: var(--muted); font-variant-numeric: tabular-nums; }
.reportlist a.current .cw { color: var(--brand); }

.stage { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.stagebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 16px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.stagebar .actions { display: flex; gap: 14px; font-size: 14px; }
.deck { flex: 1; width: 100%; border: 0; background: #fff; }
.empty { margin: auto; text-align: center; padding: 40px; }

/* ---------- pages and forms ---------- */

.page { max-width: 880px; margin: 0 auto; padding: 24px 16px 60px; }
.page h1 { margin-top: 8px; }
body.centered { display: flex; min-height: 100vh; flex-direction: column; }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 18px;
}
.card h2 { margin-top: 0; font-size: 16px; }

.login { margin: auto; width: min(360px, 92vw); }
.login h1 { margin-top: 0; }

.row { display: flex; gap: 18px; flex-wrap: wrap; align-items: flex-start; }
.field { margin-bottom: 14px; min-width: 200px; }
.field.grow { flex: 1; }
.field.checkbox { padding-top: 22px; }

label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 4px; }
.field.checkbox label { font-weight: 500; }

input[type=text], input[type=password], input[type=date], input[type=file],
select, textarea, .login input {
  width: 100%;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 5px;
  font: inherit;
  background: #fff;
}
textarea { resize: vertical; font-family: inherit; }
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--accent);
  border-color: var(--accent);
}

.hint, .muted { color: var(--muted); font-size: 13px; }
.hint { margin: 4px 0 0; }

button.primary, a.primary.button {
  background: var(--brand);
  color: #fff;
  border: 0;
  border-radius: 5px;
  padding: 9px 18px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
button.primary:hover { background: #00548f; }
button.primary:disabled { background: #93a5b3; cursor: not-allowed; }

.notice {
  border-left: 3px solid var(--warn);
  background: #fff8ec;
  padding: 9px 12px;
  border-radius: 0 5px 5px 0;
  margin: 12px 0;
}

/* ---------- runs ---------- */

.runs { width: 100%; border-collapse: collapse; font-size: 14px; }
.runs th {
  text-align: left;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--line);
  padding: 6px 8px;
}
.runs td { padding: 7px 8px; border-bottom: 1px solid var(--line); }

.status {
  font-size: 12px;
  font-weight: 600;
  border-radius: 999px;
  padding: 2px 9px;
  background: #eef2f6;
}
.status-running { background: #e6f2fb; color: var(--brand); }
.status-succeeded { background: #e8f5e9; color: var(--ok); }
.status-failed, .status-timed-out { background: #fdecea; color: var(--err); }

.facts { display: grid; grid-template-columns: max-content 1fr; gap: 4px 18px;
  margin: 0; }
.facts dt { color: var(--muted); font-size: 13px; }
.facts dd { margin: 0; }

#result:not(.shown) { display: none; }
#result { margin: 16px 0 0; }

.log {
  background: #10202e;
  color: #d7e3ee;
  padding: 14px;
  border-radius: 6px;
  max-height: 460px;
  overflow: auto;
  font-family: ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
  font-size: 12.5px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
}
