/* The dashboard's visual language, shared by / and /user/<id>.

   Served from its own route rather than pasted into both pages: two copies of this would drift,
   and the drift would show up as the two pages looking like different products. */

:root {
  color-scheme: light dark;
  --bg: #fbfbfa; --panel: #fff; --ink: #1a1a19; --muted: #6b6b68;
  --line: #e4e4e1; --warn: #8a5a1a;
  --verified: #2f6f4f; --dwell: #8a5a1a; --served: #6b6b68;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161614; --panel: #1e1e1c; --ink: #ececea; --muted: #9a9a95;
    --line: #32322e; --warn: #e0a86a;
    --verified: #7fc9a0; --dwell: #e0a86a; --served: #9a9a95;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 14px/1.5 ui-sans-serif, -apple-system, "Segoe UI", Roboto, sans-serif;
}
header {
  padding: 22px 24px 16px; border-bottom: 1px solid var(--line);
  display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap;
}
h1 { margin: 0; font-size: 17px; letter-spacing: -0.01em; }
.status { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
main { padding: 20px 24px 60px; max-width: 1180px; }
section { margin-bottom: 30px; }
h2 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted);
     margin: 0 0 10px; font-weight: 600; }
/* A qualifier on a heading - "top 100 of 4,812" - which is part of the heading's meaning rather
   than decoration, so it stays legible instead of shouting in the heading's own capitals. */
h2 .hint { text-transform: none; letter-spacing: 0; font-weight: 400; opacity: 0.85; }
h2 .hint::before { content: "\2014\00a0"; }
.cards { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 13px 15px; }
.card .k { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; }
.card .v { font-size: 21px; font-weight: 600; margin-top: 3px; font-variant-numeric: tabular-nums; }
.scroll { overflow-x: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; }
table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
th, td { padding: 9px 13px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--line); }
th:first-child, td:first-child { text-align: left; }
th { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); font-weight: 600; }
tbody tr:last-child td { border-bottom: none; }
.tag { font-size: 10px; text-transform: uppercase; letter-spacing: 0.05em; padding: 2px 6px;
       border-radius: 4px; border: 1px solid currentColor; font-weight: 600; }
.verified { color: var(--verified); } .dwell { color: var(--dwell); } .served { color: var(--served); }
.dash { color: var(--muted); }
.note { color: var(--muted); font-size: 12px; margin: 8px 2px 0; max-width: 76ch; }
.banner { background: var(--panel); border: 1px solid var(--warn); color: var(--warn);
          border-radius: 8px; padding: 10px 13px; margin-bottom: 14px; font-size: 13px; }
.empty { padding: 34px; text-align: center; color: var(--muted); }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px;
       background: var(--bg); padding: 1px 5px; border-radius: 4px; border: 1px solid var(--line); }

/* Admin form - the only place in this page that writes anything. */
.admin { background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
         padding: 15px; display: grid; gap: 13px;
         grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); align-items: end; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field > span { color: var(--muted); font-size: 11px; text-transform: uppercase;
                letter-spacing: 0.05em; }
.field .hint { text-transform: none; letter-spacing: 0; font-size: 11px; }
.row2 { display: flex; gap: 6px; }
input, select, button { font: inherit; color: var(--ink); background: var(--bg);
                        border: 1px solid var(--line); border-radius: 7px; padding: 7px 9px;
                        min-width: 0; }
input:focus-visible, select:focus-visible, button:focus-visible {
  outline: 2px solid var(--verified); outline-offset: 1px; }
input[type=number] { font-variant-numeric: tabular-nums; }
button { background: var(--ink); color: var(--bg); border-color: var(--ink);
         font-weight: 600; cursor: pointer; }
button:disabled { opacity: 0.5; cursor: default; }
/* The buttons on these pages change something; this one only asks for more of what is already
   on screen, so it does not look like the ones that do. */
.more { background: var(--bg); color: var(--ink); border-color: var(--line);
        font-weight: 500; padding: 3px 9px; margin-left: 8px; }
.saved { color: var(--muted); font-size: 12px; align-self: center; }
.saved.bad { color: var(--warn); }

.open { color: var(--verified); }
.sub { display: block; color: var(--muted); font-size: 10px; }
td.over { font-weight: 700; }
.total { border-left: 1px solid var(--line); }

/* Links. The dashboard had none until the user matrix started pointing at /user/<id>, so these
   inherit rather than arriving in browser blue and dragging a second accent colour into a palette
   that deliberately has one. */
a { color: inherit; text-decoration: none; border-bottom: 1px solid var(--line); }
a:hover { border-bottom-color: currentColor; }
a:focus-visible { outline: 2px solid var(--verified); outline-offset: 2px; border-bottom-color: transparent; }
h1 a { border-bottom: none; }
.back { color: var(--muted); font-size: 12px; }

/* Identity block on a user page. Long ids and addresses wrap rather than stretching the grid. */
.meta { background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
        padding: 15px; display: grid; gap: 14px;
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.meta .k { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; }
.meta .v { margin-top: 4px; overflow-wrap: anywhere; }

/* A verified address is a claim Firebase made; an unverified one is a claim nobody checked. The
   second is worth colouring like a caveat, which is what --warn is for everywhere else here. */
.tag.warn { color: var(--warn); }

/* Sign out sits at the far end of the header, away from everything that reports a number. */
.signout { margin-left: auto; }

/* The sign-in page. A different shape from the two dashboard pages - one centred card rather than
   a header over a grid - but the same palette, the same inputs and the same button, so that
   arriving at the dashboard afterwards does not feel like arriving at a different site. */
.gate { display: flex; align-items: center; justify-content: center;
        min-height: 100vh; max-width: none; padding: 24px; }
.gatecard { background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
            padding: 26px 24px; width: 100%; max-width: 370px; display: grid; gap: 14px; }
.gatecard h1 { font-size: 19px; }
.gatecard .lede { color: var(--muted); font-size: 13px; margin: -9px 0 2px; }
.gatecard button { padding: 9px; margin-top: 2px; }
/* Deliberately the same treatment as .banner, which is how the dashboard says "read this before
   you carry on" everywhere else. */
.gateerror { margin: 0; font-size: 13px; color: var(--warn); border: 1px solid var(--warn);
             border-radius: 8px; padding: 9px 11px; }
.gatenote { color: var(--muted); font-size: 12px; margin: 2px 0 0;
            border-top: 1px solid var(--line); padding-top: 15px; }

/* Tabs. A row under the header, marking the current view with weight and a rule beneath it rather
   than a filled pill: the global button rule above fills, and these are navigation rather than
   controls that change something. */
.tabs { display: flex; gap: 2px; padding: 0 24px; border-bottom: 1px solid var(--line); }
.tab { background: none; color: var(--muted); border: none; border-radius: 0;
       border-bottom: 2px solid transparent; font-weight: 500; padding: 10px 12px; cursor: pointer; }
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"] { color: var(--ink); font-weight: 600; border-bottom-color: var(--ink); }
.tab:focus-visible { outline: 2px solid var(--verified); outline-offset: -3px; }
/* Panels are shown and hidden with the attribute, so nothing here needs to know their display
   mode - and a section that later becomes a grid keeps working without a rule of its own. */
[hidden] { display: none !important; }
