/* The admin console.
 *
 * A tool, not a page. Dense rows, monospaced identifiers, numbers right-aligned
 * so they can be compared by eye — the things a console is for. It borrows the
 * site's typeface and nothing else: the marketing page is trying to persuade
 * somebody and this one is trying to be read quickly by three people who
 * already work here.
 */

:root {
  --ink: #14171a;
  --muted: #6b7480;
  --line: #e4e7eb;
  --bg: #fbfbfc;
  --panel: #ffffff;
  --accent: #2f6df6;
  --down: #b4232c;
  --up: #14794a;
  --warn: #8a5a00;
  --warn-bg: #fff6e0;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #e9ecf1;
    --muted: #9aa3b0;
    --line: #2a2f37;
    --bg: #14171a;
    --panel: #1b1f24;
    --accent: #6f9bff;
    --down: #ff7b83;
    --up: #4cc38a;
    --warn: #ffcf70;
    --warn-bg: #33290f;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.45 ui-sans-serif, -apple-system, "Segoe UI", Roboto, sans-serif;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  position: sticky;
  top: 0;
  z-index: 5;
}

.brand { display: flex; align-items: center; gap: 10px; font-size: 15px; }
.brand strong { font-weight: 600; }
.who { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; }

main { padding: 20px; max-width: 1240px; margin: 0 auto; }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 28px;
}
.centred { max-width: 400px; margin: 12vh auto; text-align: center; }
.centred h1 { margin: 0 0 6px; font-size: 20px; }
#google-button { display: flex; justify-content: center; margin-top: 18px; }

.muted { color: var(--muted); font-size: 13px; }
.error { color: var(--down); font-size: 13px; margin-top: 12px; }

.tabs { display: flex; gap: 4px; margin-bottom: 16px; }
.tabs button {
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  padding: 8px 14px;
  font: inherit;
  color: var(--muted);
  cursor: pointer;
}
.tabs button.on { color: var(--ink); border-bottom-color: var(--accent); }

.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.filters input[type="search"], .filters input[type="text"], .filters select {
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  font: inherit;
  min-width: 200px;
}
.check { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }

button {
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
button:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
button:disabled { opacity: 0.4; cursor: default; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.link { border-color: transparent; background: none; color: var(--muted); }

/* Wide tables scroll inside their own box. A console that makes the whole page
   scroll sideways loses the header and the tabs, which are how you get out. */
.scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }

table { border-collapse: collapse; width: 100%; font-size: 13px; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--muted); font-weight: 500; position: sticky; top: 0; background: var(--panel); }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: color-mix(in srgb, var(--accent) 6%, transparent); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
td.strong { font-weight: 600; }
td.down { color: var(--down); }
td.up { color: var(--up); }
tr.deleted td { opacity: 0.5; text-decoration: line-through; }
/* The last column is the buttons; it should not be as wide as the id next to it. */
td:last-child { display: flex; gap: 6px; }

.pager { display: flex; gap: 8px; margin-top: 12px; }

dialog {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  color: var(--ink);
  padding: 24px;
  width: min(440px, 92vw);
}
dialog::backdrop { background: rgba(0, 0, 0, 0.35); }
dialog h2 { margin: 0 0 4px; font-size: 17px; }
dialog label { display: block; margin-top: 14px; font-size: 13px; color: var(--muted); }
dialog label input[type="text"], dialog label input[type="number"] {
  display: block;
  width: 100%;
  margin-top: 5px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--ink);
  font: inherit;
}
dialog menu { display: flex; justify-content: flex-end; gap: 8px; margin: 22px 0 0; padding: 0; }

#toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  margin: 0;
  padding: 10px 16px;
  border-radius: 10px;
  background: var(--ink);
  color: var(--bg);
  font-size: 13px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.18);
}
#toast.warn { background: var(--warn-bg); color: var(--warn); border: 1px solid currentColor; }
