/* One small stylesheet; no build step, no fonts to fetch on a Pi. */
:root {
  --bg: #f6f5f2; --panel: #fff; --ink: #23211d; --muted: #6b665e;
  --line: #ddd8cf; --accent: #7a4a1e; --accent-soft: #f0e7dc; --error: #a12b1e;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #191816; --panel: #232120; --ink: #ece8e1; --muted: #a29a8e;
    --line: #3a3734; --accent: #d9a066; --accent-soft: #2e2823; --error: #e2705f;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.5 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
header {
  display: flex; justify-content: space-between; align-items: center;
  padding: .75rem 1.25rem; border-bottom: 1px solid var(--line); background: var(--panel);
}
.brand { font-weight: 650; letter-spacing: .01em; color: var(--ink); text-decoration: none; }
main { max-width: 78rem; margin: 0 auto; padding: 1.25rem; }
footer { max-width: 78rem; margin: 0 auto; padding: 2rem 1.25rem; color: var(--muted); font-size: .85rem; }

h1 { font-size: 1.4rem; margin: 0 0 .35rem; }
h2 { font-size: 1.05rem; margin: 0 0 .75rem; }

.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 1.1rem; margin-bottom: 1.25rem;
}
.narrow { max-width: 24rem; margin: 3rem auto; }

label { display: block; font-size: .82rem; color: var(--muted); margin-bottom: .6rem; }
input, select {
  display: block; width: 100%; margin-top: .2rem; padding: .5rem .6rem;
  font: inherit; color: var(--ink); background: var(--bg);
  border: 1px solid var(--line); border-radius: 6px;
}
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
button {
  font: inherit; font-weight: 600; padding: .5rem 1.1rem; border: 0; border-radius: 6px;
  background: var(--accent); color: #fff; cursor: pointer;
}
button.link, a.link {
  background: none; color: var(--accent); border: 0; padding: 0;
  text-decoration: underline; cursor: pointer; font-weight: 500;
}
.row { display: flex; gap: .9rem; align-items: flex-end; flex-wrap: wrap; }
.row.end { justify-content: flex-end; align-items: center; gap: 1.2rem; margin-top: .3rem; }
.grow { flex: 1 1 22rem; }
.grid { display: grid; gap: 0 .9rem; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); }
details summary { cursor: pointer; color: var(--accent); font-size: .88rem; margin: .3rem 0 .7rem; }
.hint { font-size: .82rem; color: var(--muted); margin: .9rem 0 0; }
.error { color: var(--error); font-size: .9rem; }
.empty { color: var(--muted); }
.citation { color: var(--muted); font-size: .9rem; margin-top: 0; }

.resultbar {
  display: flex; justify-content: space-between; align-items: center;
  margin: 0 0 .6rem; font-size: .9rem; color: var(--muted); flex-wrap: wrap; gap: .5rem;
}
table {
  width: 100%; border-collapse: collapse; background: var(--panel);
  border: 1px solid var(--line); border-radius: 10px; overflow: hidden; font-size: .92rem;
}
th, td { text-align: left; padding: .5rem .65rem; border-bottom: 1px solid var(--line); }
th { background: var(--accent-soft); font-size: .78rem; text-transform: uppercase;
     letter-spacing: .04em; color: var(--muted); }
tbody tr:hover { background: var(--accent-soft); cursor: pointer; }
tbody tr:last-child td { border-bottom: 0; }
td a { color: var(--ink); font-weight: 600; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
table.plain, table.plain th, table.plain td { border: 0; background: none; }

.pager { display: flex; gap: 1.25rem; align-items: center; justify-content: center;
         margin: 1.1rem 0; color: var(--muted); font-size: .9rem; }
.pager a { color: var(--accent); }

dl { display: grid; grid-template-columns: max-content 1fr; gap: .3rem 1.25rem; margin: 1rem 0; }
dt { color: var(--muted); font-size: .85rem; }
dd { margin: 0; }
pre { background: var(--bg); border: 1px solid var(--line); border-radius: 6px;
      padding: .7rem; overflow-x: auto; font-size: .82rem; }

/* Tables are the one thing that must never widen the page on a phone. */
@media (max-width: 40rem) {
  .resultbar, table { font-size: .86rem; }
  main { padding: .9rem; }
  table { display: block; overflow-x: auto; white-space: nowrap; }
}

/* Which datasets a search landed in -- the point of one shared schema. */
.facets { list-style: none; display: flex; flex-wrap: wrap; gap: .4rem; padding: 0; margin: 0 0 .8rem; }
.facets a {
  display: inline-block; padding: .25rem .6rem; border: 1px solid var(--line);
  border-radius: 999px; background: var(--panel); color: var(--ink);
  text-decoration: none; font-size: .82rem;
}
.facets a:hover, .facets a.on { background: var(--accent-soft); border-color: var(--accent); }
.facets .count { color: var(--muted); font-variant-numeric: tabular-nums; margin-left: .3rem; }
td.muted { color: var(--muted); font-size: .84rem; }

.hint-inline { color: var(--muted); font-size: .85rem; }
.aliases ul { list-style: none; padding: 0; margin: .4rem 0; }
.aliases li { padding: .15rem 0; }
.aliases a { color: var(--accent); font-weight: 600; }
.aliases .count, .aliases .kind { color: var(--muted); font-size: .8rem; margin-left: .5rem; }
.aliases .kind { font-style: italic; }

/* --- accounts: the header strip, and the approval queue --- */
.whoami { display: flex; align-items: center; gap: .9rem; }
.whoami .hint { margin: 0; }
.whoami a { color: var(--accent); text-decoration: none; }

textarea {
  display: block; width: 100%; margin-top: .2rem; padding: .5rem .6rem;
  font: inherit; color: var(--ink); background: var(--bg);
  border: 1px solid var(--line); border-radius: 6px; resize: vertical;
}
textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

.badge {
  display: inline-block; padding: 0 .4rem; margin-left: .3rem;
  font-size: .72rem; line-height: 1.5; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent);
}
.notice {
  background: var(--accent-soft); border: 1px solid var(--line);
  border-radius: 6px; padding: .55rem .7rem; font-size: .9rem; margin: 0 0 1rem;
}

.accounts td { vertical-align: top; }
.accounts .reason {
  margin-top: .35rem; font-size: .85rem; color: var(--muted);
  white-space: pre-wrap; max-width: 26rem;
}
.accounts .actions form { display: flex; flex-wrap: wrap; gap: .35rem; }
.accounts .actions button { margin: 0; }
button.quiet {
  background: transparent; color: var(--muted); border: 1px solid var(--line);
}
button.quiet:hover { color: var(--ink); border-color: var(--accent); }

/* A row that needs looking at should be the one the eye lands on. */
tr.state-pending td { background: var(--accent-soft); }
tr.state-locked td, tr.state-declined td { color: var(--muted); }
