/* Plain dark theme, one gold accent. Arimo for text, Cousine (its monospace sibling) for code. */
[hidden] { display: none !important; }
:root {
  --bg: #121212;
  --surface: #1b1b1b;
  --surface-2: #242424;
  --border: #303030;
  --text: #ececec;
  --muted: #a6a6a6;
  --accent: #d9a54a;
  --accent-ink: #1a1306;
  --green: #5cb87f;
  --blue: #6aa5dc;
  --amber: #d9a54a;
  --red: #e06c5e;
  --grey: #8f8f8f;
  --purple: #a891d6;
  --radius: 8px;
  --sans: "Arimo", Arial, "Helvetica Neue", sans-serif;
  --mono: "Cousine", ui-monospace, Consolas, monospace;
}
* { box-sizing: border-box; }
html { background: var(--bg); }
body { margin: 0; color: var(--text); background: var(--bg); font: 16px/1.6 var(--sans); }
a { color: var(--accent); text-underline-offset: 2px; }
code, .mono { font-family: var(--mono); font-size: 0.9em; }
h1, h2, h3 { line-height: 1.25; }

/* header */
header.site { text-align: center; padding: 36px 16px 8px; }
header.site .logo { display: block; width: min(460px, 86vw); height: auto; margin: 0 auto; }
header.site h1 { font-size: 22px; font-weight: 700; margin: 14px 0 0; letter-spacing: 0.01em; }
header.site p.sub { margin: 8px auto 0; color: var(--muted); max-width: 640px; }

/* tabs */
nav.tabs {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px;
  margin: 24px auto 8px;
  padding: 0 16px;
  max-width: 960px;
  border-bottom: 1px solid var(--border);
}
nav.tabs a {
  color: var(--muted);
  text-decoration: none;
  font-weight: 700;
  font-size: 15px;
  padding: 10px 14px;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
nav.tabs a:hover { color: var(--text); }
nav.tabs a[aria-current="page"] { color: var(--text); border-bottom-color: var(--accent); }

main { max-width: 960px; margin: 0 auto; padding: 8px 16px 64px; }

/* panels */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin: 16px 0;
}
.panel h2 { font-size: 20px; margin: 0 0 6px; }
.panel h3 { font-size: 15px; margin: 24px 0 10px; color: var(--text); }
.panel p { margin: 8px 0; }
.muted { color: var(--muted); }
.small { font-size: 14px; }

.note {
  border-left: 3px solid var(--amber);
  background: rgba(217, 165, 74, 0.08);
  border-radius: 0 6px 6px 0;
  padding: 10px 14px;
  margin: 14px 0;
  font-size: 15px;
}

/* form controls */
input[type="text"], input[type="search"], input[type="number"], select, textarea {
  font: 15px var(--sans);
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  max-width: 100%;
  min-width: 0;
}
textarea { font: 13px/1.5 var(--mono); width: 100%; resize: vertical; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
input[type="radio"], input[type="checkbox"] { accent-color: var(--accent); width: 16px; height: 16px; margin: 0; }

button, .button {
  font: 700 14px var(--sans);
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 14px;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  line-height: 1.2;
}
button:hover, .button:hover { border-color: #4a4a4a; background: #2b2b2b; }
button.small { font-size: 13px; padding: 5px 10px; }
.primary, .primary:hover { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }
.primary:hover { filter: brightness(1.08); }

/* labelled fields: label text above the control */
.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px 20px; align-items: start; }
@media (max-width: 820px) { .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) { .grid { grid-template-columns: 1fr; } }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 14px; color: var(--muted); }
.field > select, .field > input { width: 100%; }

/* radio / checkbox rows: the box sits on the first line of the title */
.choices { display: flex; flex-direction: column; gap: 8px; }
.choices.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.choice {
  display: grid;
  grid-template-columns: 16px 1fr;
  column-gap: 12px;
  align-items: start;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
}
.choice input { margin-top: 3px; }
.choice:hover { border-color: #444; }
.choice:has(input:checked) { border-color: var(--accent); background: rgba(217, 165, 74, 0.06); }
.choice b { font-weight: 700; }
.choice small { display: block; color: var(--muted); font-size: 14px; margin-top: 2px; }
.choice.disabled { opacity: 0.5; cursor: default; }

.out-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; justify-content: space-between; margin-bottom: 8px; }
.out-head h2, .out-head h3 { margin: 0; }
.out-head h3 { font-family: var(--mono); font-size: 15px; }
.out-head .actions { display: flex; gap: 6px; }
.outputs { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; margin-top: 16px; }
.outputs textarea { min-height: 280px; }

/* badges: tinted background, coloured text */
.badge {
  display: inline-block;
  font: 700 12px/1 var(--sans);
  padding: 4px 7px;
  border-radius: 4px;
  white-space: nowrap;
  color: var(--c, var(--grey));
  background: color-mix(in srgb, var(--c, var(--grey)) 16%, transparent);
}
.b-ok { --c: var(--green); }
.b-init { --c: var(--blue); }
.b-menu, .b-risk { --c: var(--amber); }
.b-blocked { --c: var(--red); }
.b-dead, .b-missing, .b-ignored { --c: var(--grey); }
.b-group { --c: var(--purple); }

/* tables */
table { border-collapse: collapse; width: 100%; font-size: 15px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: 13px; color: var(--muted); font-weight: 700; }
.table-wrap { overflow-x: auto; }

/* database */
.db-controls { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin: 12px 0 4px; }
.db-controls > * { min-width: 0; }
.db-controls input[type="search"] { flex: 3 1 260px; }
.db-controls > select { flex: 1 1 200px; }
.db-controls > .field { flex: 0 1 200px; }
.db-controls > button, .db-controls > .button { height: 40px; display: inline-flex; align-items: center; justify-content: center; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 12px; }
.chip {
  font: 14px var(--sans);
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
}
.chip:hover { color: var(--text); background: transparent; }
.chip[aria-pressed="true"] { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }
.cv-list { border-top: 1px solid var(--border); }
.cv { border-bottom: 1px solid var(--border); }
.cv > button.cv-row {
  all: unset;
  box-sizing: border-box;
  cursor: pointer;
  display: grid;
  grid-template-columns: minmax(200px, 2fr) 150px minmax(0, 3fr);
  gap: 4px 14px;
  align-items: center;
  width: 100%;
  padding: 9px 8px;
}
.cv > button.cv-row:hover, .cv.open > button.cv-row { background: var(--surface-2); }
.cv > button.cv-row:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.cv-name { font: 700 14px var(--mono); word-break: break-all; }
.cv-help { color: var(--muted); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cv-detail { padding: 8px 14px 18px; background: var(--surface-2); }
.cv-detail dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; margin: 8px 0 12px; }
.cv-detail dt { font-size: 13px; color: var(--muted); padding-top: 2px; }
.cv-detail dd { margin: 0; }
.cv-detail pre { white-space: pre-wrap; font: 13px/1.5 var(--mono); margin: 0; }
.cv-detail .add { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 12px; }
.cv-detail .add input { width: 120px; }
.rec { border-left: 3px solid var(--green); background: rgba(92, 184, 127, 0.08); border-radius: 0 6px 6px 0; padding: 10px 14px; margin: 12px 0; }
.rec.dont { border-color: var(--red); background: rgba(224, 108, 94, 0.08); }
.levels td, .levels th { text-align: center; font-family: var(--mono); font-size: 13px; }
.levels td:first-child, .levels th:first-child { text-align: left; word-break: break-all; min-width: 12ch; }
.more { text-align: center; margin: 16px 0 0; }

.legend { display: grid; grid-template-columns: max-content 1fr; gap: 8px 12px; align-items: baseline; font-size: 15px; }
ol, ul { padding-left: 22px; }
li { margin: 4px 0; }

footer.site { text-align: center; color: var(--muted); font-size: 14px; padding: 8px 16px 48px; }
footer.site a { color: var(--muted); }

@media (max-width: 640px) {
  .panel { padding: 18px 16px; }
  .cv > button.cv-row { grid-template-columns: 1fr auto; }
  .cv-help { grid-column: 1 / -1; white-space: normal; }
  .cv-detail dl { grid-template-columns: 1fr; gap: 2px; }
  .cv-detail dd { margin-bottom: 8px; }
}

/* one look for every <select>: same height as text inputs, own arrow */
select {
  appearance: none;
  -webkit-appearance: none;
  height: 40px;
  padding: 0 34px 0 10px;
  line-height: 38px;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23a6a6a6' stroke-width='1.6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  text-overflow: ellipsis;
}
select option { background: var(--surface); color: var(--text); }
input[type="text"], input[type="search"], input[type="number"] { height: 40px; }
.field .hint { font-size: 13px; color: var(--muted); }

/* graphics presets */
.check { display: flex; align-items: center; gap: 8px; height: 40px; font-size: 14px; cursor: pointer; }
.preset .out-head { margin-bottom: 12px; }
.preset h2 { font-size: 18px; }
.preset-id { font: 400 13px var(--mono); color: var(--muted); margin-left: 8px; }
.ptable td:first-child { word-break: normal; }
.ptable .pname { white-space: nowrap; }
.ptable td a { color: var(--text); text-decoration: none; }
.ptable td a:hover { color: var(--accent); text-decoration: underline; }
.ptable td .badge { margin-left: 4px; }
.ptable td.chg { color: var(--accent); font-weight: 700; background: rgba(217, 165, 74, 0.08); }
.ptable tr.same td, .ptable tr.same td a { color: var(--muted); }
.p-sep { font-size: 18px; margin: 36px 0 4px; }
.p-sep-text { margin: 0 0 8px; }
@media (max-width: 760px) {
  .ptable thead { display: none; }
  .ptable tr { display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); border-bottom: 1px solid var(--border); padding: 8px 0; }
  .ptable td, .ptable td:first-child { border: 0; padding: 2px 4px; text-align: left; }
  .ptable td:first-child { grid-column: 1 / -1; }
  .ptable td[data-l]::before { content: attr(data-l); display: block; font: 11px var(--sans); color: var(--muted); }
}
