:root {
  --bg: #f4f6f8; --fg: #12141a; --muted: #5d6b78; --card: #ffffff; --row: #f8fafb;
  --line: #e1e6ea; --accent: #1f86bd; --warn: #b4540f; --error: #b3261e;
  --shade: rgba(8, 10, 14, .55);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12141a; --fg: #eef1f5; --muted: #8f9cab; --card: #1a1d25; --row: #1e222b;
    --line: #2c313c; --accent: #6fe3f2; --warn: #f0a35c; --error: #ff8a80;
    --shade: rgba(0, 0, 0, .65);
  }
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif;
}
/* The page's top bar only -- not the header inside a site panel. */
body > header {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .65rem 1.25rem; background: #12141a; color: #fff;
}
.brand { font-weight: 700; letter-spacing: .01em; }
.brand span { color: #6fe3f2; }
.brand small { font-weight: 400; color: #8f9cab; margin-left: .35rem; }
.logout { display: flex; align-items: center; gap: .75rem; margin: 0; }
.logout button { background: transparent; color: #fff; border: 1px solid #3a4150; }
main { max-width: 84rem; margin: 0 auto; padding: 1.25rem; }

h1 { margin: 0; font-size: 1.5rem; }
.page-head { display: flex; align-items: baseline; gap: .75rem; margin-bottom: .9rem; }
.count { color: var(--muted); }
code { font-size: .85em; }
.dim, .note { color: var(--muted); }
.note { font-size: .85rem; }

input, select, button { font: inherit; }
input, select {
  padding: .4rem .55rem; border: 1px solid var(--line); border-radius: 6px;
  background: var(--card); color: var(--fg); min-height: 2.1rem;
}
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
button {
  font-weight: 600; padding: .4rem .9rem; border: 0; border-radius: 6px; min-height: 2.1rem;
  background: var(--accent); color: #12141a; cursor: pointer;
}

/* Login */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 1.25rem; }
.login { max-width: 22rem; margin: 3rem auto; display: grid; gap: .9rem; }
.login h1 { margin: 0; }
.login label { display: grid; gap: .3rem; font-weight: 600; }
.error { color: var(--error); margin: 0; }

/* Filter toolbar: one row, wrapping only when the window is narrow. */
.toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: .5rem;
  padding: .55rem; margin-bottom: 1rem;
  background: var(--card); border: 1px solid var(--line); border-radius: 8px;
}
.toolbar select { max-width: 14rem; }
.toolbar input[type=search] { flex: 1 1 12rem; min-width: 10rem; }
.toolbar .reset { color: var(--muted); padding: 0 .4rem; }

/* The fleet table */
.scroll { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: 8px; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .5rem .75rem; white-space: nowrap; }
thead th {
  position: sticky; top: 0; background: var(--card);
  font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted);
  border-bottom: 1px solid var(--line);
}
th a { color: inherit; text-decoration: none; display: inline-flex; gap: .25rem; }
th a:hover { color: var(--accent); }
th[aria-sort] a { color: var(--fg); }
.arrow { display: inline-block; width: .8em; }
tbody tr + tr td { border-top: 1px solid var(--line); }
tbody tr:hover td { background: var(--row); }
td.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.stale td { color: var(--muted); }
.badge {
  font-size: .7rem; font-weight: 600; color: var(--warn);
  border: 1px solid currentColor; border-radius: 4px; padding: 0 .3rem;
}
a.admin-link { color: var(--fg); font-variant-numeric: tabular-nums; text-decoration: none;
               border-bottom: 1px dotted var(--muted); }
a.admin-link:hover { color: var(--accent); border-bottom-color: var(--accent); }
.chan { font-size: .75rem; font-weight: 600; padding: .05rem .4rem; border-radius: 999px; }
.chan-stable { background: rgba(46, 158, 91, .15); color: #2e9e5b; }
.chan-testing { background: rgba(201, 121, 26, .15); color: #c9791a; }
a.site-link { color: var(--accent); font-weight: 600; text-decoration: none; }
a.site-link:hover { text-decoration: underline; }
a.site-link.unnamed { color: var(--muted); font-weight: 400; font-style: italic; }

/* Site panel: hidden until its #site-N is the target, then a centred
   overlay. The backdrop and × link to "#"; app.js adds Esc. */
.modal { display: none; position: fixed; inset: 0; z-index: 10; padding: 1rem;
         align-items: center; justify-content: center; }
.modal:target { display: flex; }
.modal .backdrop { position: absolute; inset: 0; background: var(--shade); }
.modal .panel {
  position: relative; width: min(46rem, 100%); max-height: 88vh; overflow-y: auto;
  background: var(--card); color: var(--fg); border: 1px solid var(--line);
  border-radius: 12px; padding: 1.25rem 1.4rem; box-shadow: 0 20px 60px rgba(0, 0, 0, .35);
}
.modal header { display: flex; align-items: center; justify-content: space-between; margin-bottom: .9rem; }
.modal h2 { margin: 0; font-size: 1.25rem; }
.modal .close { font-size: 1.6rem; line-height: 1; color: var(--muted); text-decoration: none; padding: 0 .25rem; }
.name-form { display: flex; gap: .5rem; margin-bottom: 1rem; }
.name-form input { flex: 1; }
.facts { display: flex; flex-wrap: wrap; gap: .5rem 2rem; margin: 0 0 1rem; }
.facts dt { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.facts dd { margin: 0; font-weight: 600; }
table.members { border: 1px solid var(--line); border-radius: 8px; margin-bottom: .75rem; }
table.members thead th { position: static; }
.modal h3 { font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 1rem 0 .4rem; }
a.badge.key { text-decoration: none; margin-left: .35rem; }
/* Owner, 2026-09-13: "once a display is approved change the client id text to
   green". The tooltip and legend say it in words too, so colour isn't the
   only signal. */
code.approved { color: #2e9e5b; font-weight: 600; }
code.pair-code { font-size: 1rem; letter-spacing: .08em; font-weight: 600; }
.legend { font-size: .8rem; color: var(--muted); margin: .5rem 0 0; }
form.approve { margin: 0; }
form.approve button { padding: .2rem .7rem; min-height: 0; font-size: .8rem; }
