:root {
  --bg: #fafaf9;
  --surface: #ffffff;
  --ink: #18181b;
  --muted: #5b5b63;
  --line: #e4e4e7;
  --line-strong: #c9c9cf;
  --hover: #f1f1f2;
  --ok-bg: #eef6ef;
  --ok-line: #b9d9bf;
  --warn-bg: #fdf6e7;
  --warn-line: #ebd5a1;
  --error-bg: #fcefee;
  --error-line: #e8b9b4;
  --focus: #2563eb;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111113;
    --surface: #18181b;
    --ink: #f4f4f5;
    --muted: #b4b4bb;
    --line: #2e2e33;
    --line-strong: #4a4a52;
    --hover: #232327;
    --ok-bg: #16261a;
    --ok-line: #2f5537;
    --warn-bg: #2a2314;
    --warn-line: #5c4b22;
    --error-bg: #2c1716;
    --error-line: #63302c;
    --focus: #60a5fa;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

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

a { color: inherit; text-underline-offset: 2px; }
a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

h1 { font-size: 26px; line-height: 1.25; margin: 0 0 12px; letter-spacing: -0.01em; }
h2 { font-size: 16px; margin: 0 0 6px; }
p { margin: 0 0 12px; }

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.brand { font-weight: 650; text-decoration: none; font-size: 16px; }
.top nav { display: flex; align-items: center; gap: 18px; font-size: 14px; }
.top nav a { text-decoration: none; color: var(--muted); }
.top nav a[aria-current="page"], .top nav a:hover { color: var(--ink); }

.page { max-width: 820px; margin: 0 auto; padding: 32px 16px 64px; }
.page.wide { max-width: 1120px; }
.narrow { max-width: 460px; margin: 0 auto; padding: 72px 16px; }
section { margin-top: 36px; }

.muted { color: var(--muted); }
.small-text { font-size: 13px; }
.block { display: block; }
.mono, code { font-family: var(--mono); font-size: 0.92em; }
.nowrap { white-space: nowrap; }

button, .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 16px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  font-weight: 550;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 120ms ease, border-color 120ms ease;
}
button:hover, .button:hover { background: var(--hover); }
button.primary { background: var(--ink); color: var(--bg); border-color: var(--ink); }
button.primary:hover { opacity: 0.9; background: var(--ink); }
button:disabled { opacity: 0.5; cursor: not-allowed; }
button.small { min-height: 30px; padding: 0 10px; font-size: 13px; }
button.quiet { border-color: transparent; color: var(--muted); background: transparent; }
button.quiet:hover { color: var(--ink); background: var(--hover); }
button.link { border: 0; min-height: 0; padding: 0; background: none; color: var(--muted); font-weight: 400; }
button.link:hover { color: var(--ink); background: none; }
form.inline { display: inline; }

.signin { display: flex; flex-direction: column; gap: 10px; margin-top: 24px; }
.signin .button { min-height: 44px; }

input[type="email"], textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
}
.stack { display: flex; flex-direction: column; gap: 8px; margin: 20px 0; }
.stack label { font-size: 14px; font-weight: 550; }
.row-form { display: flex; gap: 8px; margin-top: 12px; max-width: 520px; }
.row-form input { flex: 1; }

.welcome { margin-top: 0; padding-bottom: 28px; border-bottom: 1px solid var(--line); }
.command {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 14px 14px 18px;
  border-radius: 8px;
  background: var(--ink);
  color: var(--bg);
}
.command code { flex: 1; font-size: 15px; overflow-wrap: break-word; }
.command button { background: transparent; color: var(--bg); border-color: currentColor; }
.command button:hover { background: rgba(127, 127, 127, 0.25); }

.notice { padding: 12px 14px; border: 1px solid; border-radius: 6px; margin-bottom: 20px; }
.notice p:last-child { margin-bottom: 0; }
.notice-ok { background: var(--ok-bg); border-color: var(--ok-line); }
.notice-warn { background: var(--warn-bg); border-color: var(--warn-line); }
.notice-error { background: var(--error-bg); border-color: var(--error-line); }
.copy-row { display: flex; align-items: center; gap: 10px; margin: 4px 0 6px; }
.copy-row code { flex: 1; word-break: break-all; user-select: all; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); margin-top: 12px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-weight: 550; font-size: 13px; color: var(--muted); padding: 9px 12px; border-bottom: 1px solid var(--line); }
td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
td.actions { text-align: right; white-space: nowrap; }
td.note { max-width: 420px; white-space: pre-wrap; }
.empty { padding: 32px; text-align: center; border: 1px dashed var(--line-strong); border-radius: 8px; color: var(--muted); }

.tabs { display: flex; gap: 22px; border-bottom: 1px solid var(--line); margin-bottom: 20px; font-size: 14px; }
.tabs a { padding: 8px 0; text-decoration: none; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a[aria-current="page"] { color: var(--ink); border-color: var(--ink); font-weight: 550; }

.graph-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 8px 20px; }
.legend { display: flex; gap: 16px; font-size: 13px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.graph { overflow: auto; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); margin-top: 8px; }
.graph svg { display: block; font-size: 13px; }
.edge { fill: none; stroke: var(--line-strong); stroke-width: 1.25; }
.edge.lit { stroke: var(--ink); stroke-width: 1.75; }
.edge.dashed { stroke-dasharray: 3 3; }
.fill-ink { fill: var(--ink); }
.hollow { fill: var(--surface); stroke: var(--muted); stroke-width: 1.25; }
.node text { fill: var(--ink); }
.node text.pending-text { fill: var(--muted); }
.node text.strong { font-weight: 650; }
.node .count { fill: var(--muted); font-weight: 400; }
.node .hit { fill: transparent; }
.node:hover .hit { fill: var(--hover); }
.node.selected .hit { fill: var(--hover); stroke: var(--line-strong); }
.node:focus-visible { outline: none; }
.node:focus-visible .hit { stroke: var(--focus); stroke-width: 2; }
.details { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); }

@media (max-width: 560px) {
  .top { padding: 12px 16px; }
  .narrow { padding-top: 40px; }
  .row-form { flex-direction: column; }
  .command { flex-direction: column; align-items: stretch; }
}
