:root {
  --bg: #10151c;
  --panel: #171e27;
  --line: #263141;
  --text: #dce3ec;
  --muted: #8a97a8;
  --accent: #4da3ff;
  --ok: #3fb950;
  --warn: #d29922;
  --err: #f85149;
}

* { box-sizing: border-box; }

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

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.9em; color: #b8c6d8; }

.topbar {
  display: flex; align-items: center; gap: 24px;
  padding: 12px 24px; background: var(--panel); border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; letter-spacing: 0.02em; }
.topbar nav { display: flex; gap: 16px; flex: 1; }
.topbar nav a { color: var(--muted); padding: 4px 2px; }
.topbar nav a.active, .topbar nav a:hover { color: var(--text); border-bottom: 2px solid var(--accent); text-decoration: none; }
.who { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 14px; }

main { max-width: 1200px; margin: 0 auto; padding: 24px; }
footer { max-width: 1200px; margin: 0 auto; padding: 16px 24px 32px; color: var(--muted); font-size: 13px; }

h1 { font-size: 22px; margin: 0 0 20px; }
h2 { font-size: 16px; margin: 0 0 12px; color: var(--text); }
section { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 16px 20px; margin-bottom: 20px; }
.muted { color: var(--muted); font-size: 13px; }
/* A standing caution rather than an error: the page is fine, what it is
   describing is not. Tinted like .pill.warn so the two read as the same news. */
p.warn { background: rgba(210, 153, 34, 0.12); border: 1px solid rgba(210, 153, 34, 0.4); border-radius: 6px; padding: 10px 12px; margin: 0 0 12px; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 20px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; }
.tile .k { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; }
.tile .v { font-size: 26px; font-weight: 600; }
.tile .v.warn { color: var(--warn); }
.tile .s { color: var(--muted); font-size: 12px; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; color: var(--muted); font-weight: 500; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; padding: 6px 10px; border-bottom: 1px solid var(--line); }
td { padding: 7px 10px; border-bottom: 1px solid rgba(38, 49, 65, 0.5); vertical-align: top; }
tr:last-child td { border-bottom: none; }
td.num { text-align: right; font-variant-numeric: tabular-nums; }
td.actions { white-space: nowrap; text-align: right; }
td.err-cell { color: var(--err); max-width: 320px; }
code.url { word-break: break-all; }

.pill { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px; background: rgba(138, 151, 168, 0.18); color: var(--muted); }
.pill.ok { background: rgba(63, 185, 80, 0.16); color: var(--ok); }
.pill.off { background: rgba(248, 81, 73, 0.14); color: var(--err); }
.pill.warn { background: rgba(210, 153, 34, 0.16); color: var(--warn); }

.flash { padding: 10px 14px; border-radius: 6px; margin-bottom: 18px; }
.flash.ok { background: rgba(63, 185, 80, 0.12); border: 1px solid rgba(63, 185, 80, 0.4); color: var(--ok); }
.flash.err { background: rgba(248, 81, 73, 0.12); border: 1px solid rgba(248, 81, 73, 0.4); color: var(--err); }

button, input, select, textarea {
  font: inherit; color: var(--text); background: #1d2733;
  border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px;
}
button { background: #22303f; cursor: pointer; }
button:hover { border-color: var(--accent); }
button.danger:hover { border-color: var(--err); color: var(--err); }
button.link { background: none; border: none; color: var(--muted); padding: 0; }
button.link:hover { color: var(--text); }
/* A link that opens a page rather than posting to one, drawn like the button
   beside it so a row of actions reads as one row. */
a.button { display: inline-block; padding: 6px 10px; border: 1px solid var(--line); border-radius: 6px; background: #22303f; color: var(--text); text-decoration: none; }
a.button:hover { border-color: var(--accent); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); }

label { display: flex; flex-direction: column; gap: 4px; color: var(--muted); font-size: 13px; }
label.check { flex-direction: row; align-items: center; gap: 6px; }
/* The note under a settings box saying where its value comes from. It sits inside
   the label's column, so it has to give the line back rather than stretch. */
label .hint { font-size: 12px; line-height: 1.4; }
fieldset { border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px; }
legend { color: var(--muted); font-size: 12px; padding: 0 4px; }

form.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); align-items: end; }
form.inline { display: inline-flex; gap: 8px; align-items: center; }
form.inline + table { margin-top: 12px; }
textarea { width: 100%; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; line-height: 1.45; }

.tabs { display: flex; gap: 8px; margin-bottom: 18px; align-items: center; }
.tabs a { padding: 6px 14px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); color: var(--muted); }
.tabs a.active { color: var(--text); border-color: var(--accent); }
.tabs a.right { margin-left: auto; }

/* The request indicator htmx shows while a swap is in flight. */
/* The job form hides the fields of the job types that are not chosen, and a
   hidden attribute has to beat the layout rules above it. */
[hidden] { display: none !important; }
/* A job form's boxes fill the column their label sits in. */
label.field > input, label.field > select { width: 100%; }
label.field .flabel { color: var(--text); }

.busy { display: none; }
.busy.htmx-request { display: block; float: right; color: var(--muted); font-size: 12px; margin: -34px 0 0; }

.login-wrap { display: flex; justify-content: center; padding-top: 8vh; }
.card.login { width: 100%; max-width: 380px; }
.card.login h1 { margin-bottom: 2px; }
.card.login .sub { color: var(--muted); margin: 0 0 20px; }
.card.login form { display: grid; gap: 12px; }
.card.login button { margin-top: 4px; }
.endpoints { margin-top: 24px; border-top: 1px solid var(--line); padding-top: 16px; }
.endpoints h2 { font-size: 13px; color: var(--muted); }
.endpoints code { word-break: break-all; }
