
:root {
  --bg: #f6f6f3; --panel: #ffffff; --text: #1c1d1f; --muted: #66696f; --line: #e0e0da;
  --accent: #1f5f8b; --accent-hover: #174a6d; --accent-text: #ffffff;
  --good-bg: #e6f3ea; --good-text: #1d5c34; --warn-bg: #fbf1dc; --warn-text: #72500b;
  --bad-bg: #fbe5e3; --bad-text: #8c231b; --bad: #b3261e; --bad-hover: #8c1d17;
  --radius: 8px; --space: 16px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #151618; --panel: #1e2023; --text: #e9e9e6; --muted: #a0a3a8; --line: #33363b;
    --accent: #6fb3e0; --accent-hover: #92c7ea; --accent-text: #10222f;
    --good-bg: #1c3425; --good-text: #a3dcb6; --warn-bg: #3a2f14; --warn-text: #ecd193;
    --bad-bg: #3e1f1d; --bad-text: #f3b5af; --bad: #e4776e; --bad-hover: #ee9c95;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif; }
a { color: var(--accent); }
a:hover { color: var(--accent-hover); }
h1 { font-size: 24px; line-height: 1.25; margin: 0 0 var(--space); }
h2 { font-size: 17px; margin: 0 0 12px; }
header.top { display: flex; flex-wrap: wrap; gap: 8px 24px; align-items: center; padding: 12px 24px; background: var(--panel); border-bottom: 1px solid var(--line); }
.brand { font-weight: 650; color: var(--text); text-decoration: none; }
nav { display: flex; flex-wrap: wrap; gap: 4px; flex: 1; }
nav a { padding: 4px 10px; border-radius: var(--radius); color: var(--muted); text-decoration: none; }
nav a:hover { background: var(--bg); color: var(--text); }
nav a[aria-current="page"] { color: var(--text); font-weight: 600; background: var(--bg); }
main { max-width: 1040px; margin: 0 auto; padding: 24px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--space); margin-bottom: var(--space); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: var(--space); }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px var(--space); }
.stat b { display: block; font-size: 24px; line-height: 1.3; font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: 13px; }
.table-wrap { position: relative; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 13px; color: var(--muted); font-weight: 600; }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
tbody tr:hover { background: var(--bg); }
tbody tr:last-child td { border-bottom: 0; }
table.details th { width: 110px; }
table.details td { overflow-wrap: anywhere; }
.truncate { display: block; max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; background: var(--bg); color: var(--muted); white-space: nowrap; }
.badge.good { background: var(--good-bg); color: var(--good-text); }
.badge.warn { background: var(--warn-bg); color: var(--warn-text); }
.badge.bad { background: var(--bad-bg); color: var(--bad-text); }
.notice { padding: 10px 14px; border-radius: var(--radius); margin-bottom: var(--space); }
.notice.good { background: var(--good-bg); color: var(--good-text); }
.notice.warn { background: var(--warn-bg); color: var(--warn-text); }
.notice.bad { background: var(--bad-bg); color: var(--bad-text); }
.empty { padding: 24px; text-align: center; color: var(--muted); }
form.stack { display: grid; gap: 12px; }
form.row { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
form.row label { flex: 1 1 180px; }
label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
input, select { width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); color: var(--text); font: inherit; }
input:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
button, a.button { padding: 8px 14px; border: 1px solid transparent; border-radius: var(--radius); background: var(--accent); color: var(--accent-text); font: inherit; font-weight: 600; cursor: pointer; }
a.button { display: inline-block; text-decoration: none; }
button:hover, a.button:hover { background: var(--accent-hover); color: var(--accent-text); }
button:disabled { opacity: .6; cursor: progress; }
button.danger { background: transparent; border-color: var(--bad); color: var(--bad); }
button.danger:hover { background: var(--bad-bg); color: var(--bad-hover); }
button.small { padding: 3px 10px; font-size: 13px; }
pre.reveal { padding: 12px; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); overflow-x: auto; white-space: pre-wrap; word-break: break-all; }
pre.body { max-height: 480px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; margin: 0; }
.query-row { display: flex; gap: 12px; align-items: flex-end; }
.query-row label { flex: 1; }
.stats.filters { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); margin-bottom: 0; }
.hits { list-style: none; margin: 0; padding: 0; }
.hits h2 { margin-bottom: 2px; overflow-wrap: anywhere; }
.hit-meta { margin: 0 0 8px; font-size: 13px; overflow-wrap: anywhere; }
pre.quote { max-height: 320px; font: inherit; }
mark { padding: 0 2px; border-radius: 3px; background: var(--warn-bg); color: var(--warn-text); }
.pager { display: flex; justify-content: space-between; gap: 12px; margin-top: 12px; }
.login { max-width: 360px; margin: 10vh auto 0; }
details summary { cursor: pointer; color: var(--muted); }
.setup h3 { font-size: 15px; margin: 20px 0 2px; }
.setup .notice, .setup .muted { margin-top: 0; }
@media (max-width: 600px) {
  main { padding: var(--space); }
  header.top { padding: 12px var(--space); justify-content: space-between; }
  nav { order: 3; flex-basis: 100%; }
  .truncate { max-width: 180px; }
}
