:root {
  --bg: #fafafa; --card: #ffffff; --text: #18181b; --muted: #71717a; --line: #e4e4e7;
  --accent: #2563eb; --accent2: #0d9488; --warn: #dc2626; --soft: #f4f4f5; --ok: #15803d; --amber: #b45309;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #09090b; --card: #18181b; --text: #fafafa; --muted: #a1a1aa; --line: #27272a;
    --accent: #60a5fa; --accent2: #2dd4bf; --warn: #f87171; --soft: #27272a; --ok: #4ade80; --amber: #fbbf24;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", sans-serif;
}
[hidden] { display: none !important; }
.brand { font-weight: 600; font-size: 16px; letter-spacing: -0.01em; }
.shell { display: grid; grid-template-columns: 208px minmax(0, 1fr); min-height: 100vh; }
.side {
  border-right: 1px solid var(--line); background: var(--card); padding: 16px 12px;
  display: flex; flex-direction: column; gap: 16px; position: sticky; top: 0; height: 100vh;
}
.side .brand { padding: 0 8px; }
.side nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.side nav a {
  display: flex; align-items: center; justify-content: space-between; padding: 7px 8px; border-radius: 6px;
  color: var(--text); text-decoration: none;
}
.side nav a:hover { background: var(--soft); }
.side nav a.on { background: var(--soft); font-weight: 600; }
.side nav .group { color: var(--muted); font-size: 12px; padding: 12px 8px 4px; }
.side .who { display: flex; flex-direction: column; gap: 8px; font-size: 13px; }
.side .who label { display: flex; flex-direction: column; gap: 4px; color: var(--muted); }
main { padding: 24px 24px 48px; max-width: 1180px; width: 100%; }
@media (max-width: 760px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .side nav { flex-direction: row; flex-wrap: wrap; }
  .side nav .group { display: none; }
  main { padding: 16px 16px 48px; }
}
.card { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 16px; margin-bottom: 16px; }
.narrow { max-width: 420px; margin: 72px auto; }
.narrow .brand { margin-bottom: 16px; }
h1 { font-size: 20px; margin: 0; letter-spacing: -0.01em; }
h2 { font-size: 14px; font-weight: 600; margin: 0 0 12px; }
.head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.head .sub { color: var(--muted); font-size: 13px; }
.crumb { color: var(--muted); text-decoration: none; font-size: 13px; }
.crumb:hover { color: var(--text); }
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: 13px; margin: 4px 0 0; }
.error { color: var(--warn); margin: 8px 0; }
.error:empty { display: none; }
label.field { display: block; margin: 12px 0; }
label.field > span { display: block; margin-bottom: 4px; color: var(--muted); font-size: 13px; }
form label { display: block; margin: 12px 0; color: var(--muted); }
form label > span { display: block; margin-bottom: 4px; }
input, select, button, textarea {
  font: inherit; color: var(--text); background: var(--card);
  border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px; height: 36px;
}
input[type=checkbox] { height: auto; padding: 0; }
form input:not([type=checkbox]), form select { width: 100%; }
button { cursor: pointer; background: var(--text); color: var(--bg); border-color: var(--text); font-weight: 500; white-space: nowrap; }
button.ghost { background: transparent; color: var(--text); border-color: var(--line); }
button.danger { background: transparent; color: var(--warn); border-color: var(--line); }
button.small { height: 28px; padding: 2px 8px; font-size: 13px; }
button:disabled { opacity: .5; cursor: default; }
input:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs a {
  padding: 8px 12px; color: var(--muted); text-decoration: none; border-bottom: 2px solid transparent;
  margin-bottom: -1px; white-space: nowrap;
}
.tabs a.on { color: var(--text); border-bottom-color: var(--text); font-weight: 600; }
/* six numbers in a row, three, or two: the same columns in every row, every tile as tall as its row */
.tiles { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
@media (max-width: 1280px) { .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 560px) { .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 12px 16px; display: flex; flex-direction: column; min-width: 0; }
.tile .label { color: var(--muted); font-size: 13px; }
.tile .value { font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 6px; }
.tile .unit { font-size: 13px; font-weight: 400; color: var(--muted); margin-left: 4px; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; margin-bottom: 16px; }
.grid .card { margin-bottom: 0; }
.chart { height: 200px; position: relative; }
.chart svg { width: 100%; height: 100%; display: block; }
.chart .empty { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--muted); }
.legend { display: flex; gap: 16px; font-size: 12px; color: var(--muted); margin-top: 6px; flex-wrap: wrap; }
.legend i { display: inline-block; width: 10px; height: 2px; vertical-align: middle; margin-right: 6px; }
.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.row.between { justify-content: space-between; }
.row h2 { margin: 0; }
.gap { margin-bottom: 12px; }
.switch { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
td { white-space: nowrap; }
td.sql, td.wrap { white-space: normal; }
th { color: var(--muted); font-weight: 500; white-space: nowrap; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td.act { text-align: right; white-space: nowrap; }
td.act button { margin-left: 6px; }
tr.link { cursor: pointer; }
tr.link:hover td { background: var(--soft); }
td.sql, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; word-break: break-all; }
td.sql { max-width: 560px; }
.empty-state { text-align: center; color: var(--muted); padding: 32px 16px; }
.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; background: var(--soft); font-size: 12px; white-space: nowrap; }
.badge.ok { color: var(--ok); }
.badge.warn { color: var(--warn); }
.badge.amber { color: var(--amber); }
.copy {
  display: flex; align-items: stretch; gap: 8px; margin: 6px 0 12px;
}
.copy code, pre.code {
  flex: 1; background: var(--soft); border-radius: 6px; padding: 8px 10px; margin: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px;
  overflow-x: auto; white-space: pre; min-width: 0;
}
.copy code.wrap { white-space: normal; word-break: break-all; }
.secret { border: 1px solid var(--accent); border-radius: 8px; padding: 12px; margin: 12px 0; }
.secret .hint { margin-bottom: 4px; }
.checks { display: flex; gap: 16px; flex-wrap: wrap; margin: 8px 0 12px; }
.checks label { display: flex; align-items: center; gap: 6px; margin: 0; color: var(--text); }
.inline { display: flex; gap: 8px; align-items: end; flex-wrap: wrap; }
.inline label.field { margin: 0; flex: 1; min-width: 140px; }
.alert { border-left: 3px solid var(--amber); padding: 6px 10px; margin: 6px 0; background: var(--soft); border-radius: 4px; }
.alert.critical { border-left-color: var(--warn); }
dialog { border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--text); padding: 20px; width: min(460px, 92vw); }
dialog::backdrop { background: rgba(0, 0, 0, .45); }
dialog h2 { font-size: 16px; margin-bottom: 4px; }
dialog .row.end { margin-top: 16px; }
#toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--bg);
  padding: 8px 14px; border-radius: 8px; font-size: 13px; z-index: 10; max-width: 90vw;
}
#toast.bad { background: #b91c1c; color: #fff; }
.bar { height: 6px; background: var(--soft); border-radius: 3px; min-width: 60px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--accent); }
.bar.hot i { background: var(--warn); }
.banner {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; padding: 8px 12px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--soft); font-size: 13px;
}
.banner select { height: 30px; padding: 2px 8px; }
.notice { border-left: 3px solid var(--amber); background: var(--soft); border-radius: 4px; padding: 6px 10px; margin: 0 0 12px; }
.notice:empty { display: none; }
.search { width: 220px; max-width: 100%; }
.foot { margin-top: 12px; }
.badge.after { margin-left: 8px; }
a.name { color: var(--text); font-weight: 500; text-decoration: none; }
a.name:hover { text-decoration: underline; }
tr.on td { background: var(--soft); }
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 4px 16px; }
.fields label.field { margin: 8px 0; }
.fields input { width: 100%; }
.tip {
  position: absolute; left: 72px; top: 0; font-size: 12px; color: var(--muted); background: var(--card);
  padding: 0 4px; pointer-events: none; white-space: nowrap; max-width: calc(100% - 80px); overflow: hidden; text-overflow: ellipsis;
}
.lang { height: 30px; padding: 2px 8px; font-size: 13px; }
.copy button.small { height: 32px; }
dialog .checks { margin: 12px 0 2px; }
.search.wide { width: 300px; }
td.act { position: sticky; right: 0; background: var(--card); }
td.wrap { min-width: 220px; }
dialog .error { margin: 8px 0 0; }
@media (max-width: 760px) {
  td.act { position: static; }
  .side { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 10px 12px; }
  .side nav { order: 3; flex: 1 0 100%; flex-wrap: nowrap; overflow-x: auto; gap: 4px; }
  .side nav a { white-space: nowrap; padding: 6px 10px; }
  .side .who { flex-direction: row; align-items: center; margin-left: auto; gap: 8px; }
  .side .who button { height: 30px; padding: 2px 10px; }
  .head { align-items: flex-start; }
  .search { width: 100%; }
}
.push { margin-left: auto; }
.brand { display: flex; align-items: center; gap: 8px; color: var(--text); text-decoration: none; }
.brand img { display: block; border-radius: 6px; }
a.button {
  display: inline-flex; align-items: center; height: 36px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 6px;
  color: var(--text); text-decoration: none; font-weight: 500; white-space: nowrap;
}
details.op { border-top: 1px solid var(--line); padding: 10px 0; }
details.op:first-of-type { border-top: 0; }
details.op summary { display: flex; align-items: center; gap: 10px; cursor: pointer; flex-wrap: wrap; list-style: none; }
details.op summary::-webkit-details-marker { display: none; }
details.op summary code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; }
details.op .verb { font-size: 11px; font-weight: 600; padding: 1px 6px; border-radius: 4px; background: var(--soft); color: var(--accent); }
details.op .what { color: var(--muted); }
details.op[open] summary { margin-bottom: 10px; }
details.op h3 { font-size: 13px; font-weight: 600; margin: 14px 0 6px; }
pre.code { white-space: pre; overflow-x: auto; }

/* the sign-in page: one way under the other; and a button that reads as a link */
.stack { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
button.link { background: none; border: 0; padding: 4px 0; color: var(--muted); text-decoration: underline; font-weight: 400; cursor: pointer; }
button.link:hover { color: var(--text); background: none; }

/* a database's overview: a small line under each number, and whether it went up or down */
.tile .spark { display: block; width: 100%; height: 28px; margin-top: auto; }
.tile .unit.down, .tile .unit.up { font-size: 12px; margin-left: 8px; }
.tile .unit.down { color: var(--accent); }
.tile .unit.up { color: var(--ok); }
.wrapline { flex-wrap: wrap; margin-bottom: 16px; }
.grow { flex: 1 1 320px; min-width: 0; }
