:root {
  --bg: #f4f5f7; --panel: #ffffff; --panel2: #eceef2; --ink: #16181d; --muted: #5b6270; --line: #d5d9e0;
  --accent: #1d6fd6; --accent-ink: #ffffff; --warn: #b35c00; --bad: #b3261e; --good: #1d7a46;
  --chip: #e3e8f1; --mono: ui-monospace, SFMono-Regular, Consolas, monospace;
}
:root:not([data-theme="light"]) { color-scheme: light dark; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1216; --panel: #171b21; --panel2: #1e232b; --ink: #e6e9ee; --muted: #8e97a6; --line: #2a313b;
    --accent: #4b94f0; --accent-ink: #07111f; --warn: #e8a24a; --bad: #f2756d; --good: #5fc489; --chip: #242b36;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1216; --panel: #171b21; --panel2: #1e232b; --ink: #e6e9ee; --muted: #8e97a6; --line: #2a313b;
  --accent: #4b94f0; --accent-ink: #07111f; --warn: #e8a24a; --bad: #f2756d; --good: #5fc489; --chip: #242b36;
}

* { box-sizing: border-box; }
html { font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
body { margin: 0; background: var(--bg); color: var(--ink); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.35rem; margin: 0 0 .5rem; }
h2 { font-size: 1.05rem; margin: 0 0 .5rem; }

.center { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 20px; }
.narrow { max-width: 460px; width: 100%; }
.btn, button { font: inherit; cursor: pointer; border: 1px solid var(--line); background: var(--panel2); color: var(--ink);
  padding: 7px 14px; border-radius: 7px; }
.btn.primary, button.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; font-weight: 600; }
.btn:hover, button:hover { filter: brightness(1.08); text-decoration: none; }
button:disabled { opacity: .5; cursor: default; }
button.danger { color: var(--bad); }
button.small { padding: 3px 9px; font-size: .85rem; }

header.bar { display: flex; align-items: center; gap: 14px; padding: 10px 16px; background: var(--panel); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
header.bar .brand { font-weight: 700; letter-spacing: .02em; }
header.bar nav { display: flex; gap: 12px; flex: 1; }
header.bar .who { display: flex; align-items: center; gap: 8px; color: var(--muted); }
header.bar .who img { width: 28px; height: 28px; border-radius: 50%; background: var(--panel2); }
.fresh { color: var(--muted); font-size: .85rem; }

main { padding: 16px; max-width: 1400px; margin: 0 auto; }
.grid { display: grid; gap: 16px; }

/* the scan page's footer: about, contact, the lake's state, the lake's counts */
.foot { max-width: 1400px; margin: 8px auto 28px; padding: 14px 16px 0; border-top: 1px solid var(--line); display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px 28px; color: var(--muted); font-size: .8rem; }
.foot b { color: var(--ink); font-weight: 600; }
.foot ul { margin: .3rem 0 0; padding-left: 1.1rem; }
.foot .line { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: .25rem; }
.foot .kv { display: flex; justify-content: space-between; gap: 12px; margin-top: .15rem; }
.foot .kv b { font-weight: 500; font-variant-numeric: tabular-nums; }
.foot code { font: inherit; font-family: var(--mono); color: var(--ink); }
button.copy { padding: 1px 3px; line-height: 0; background: transparent; border-color: transparent; color: var(--muted); }
button.copy:hover { color: var(--ink); }
button.copy svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.two { grid-template-columns: minmax(260px, 340px) 1fr; align-items: start; }
@media (max-width: 860px) { .two { grid-template-columns: 1fr; } }

textarea#paste { width: 100%; min-height: 300px; resize: vertical; font: .9rem/1.4 var(--mono); background: var(--bg); color: var(--ink);
  border: 1px solid var(--line); border-radius: 8px; padding: 10px; }
textarea#paste:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.hint { color: var(--muted); font-size: .85rem; margin: .4rem 0 0; }
.notes { margin: .5rem 0 0; display: flex; flex-direction: column; gap: 2px; font-size: .85rem; color: var(--warn); }
.status { font-size: .85rem; color: var(--muted); min-height: 1.3em; margin-top: .4rem; }
.status.err { color: var(--bad); }

.strip { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.strip + .sub { margin: -4px 0 12px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 8px 14px; min-width: 110px; }
.stat b { display: block; font-size: 1.25rem; font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: .8rem; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 8px; flex-wrap: wrap; }
.tabs button { border: 0; border-bottom: 2px solid transparent; background: none; border-radius: 0; padding: 7px 12px; color: var(--muted); }
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); font-weight: 600; }

.tablewrap { overflow-x: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; }
table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
th, td { padding: 6px 10px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { font-weight: 600; font-size: .8rem; color: var(--muted); cursor: pointer; user-select: none; position: sticky; top: 0; background: var(--panel); }
th[aria-sort="ascending"]::after { content: " \25B2"; } th[aria-sort="descending"]::after { content: " \25BC"; }
td.num, th.num { text-align: right; }
tr:last-child td { border-bottom: 0; }
tr.quiet td { color: var(--muted); }
tr.flash td { background: var(--chip); }
input.numinput { width: 8em; }
.card.match { display: grid; gap: 8px; }
.card.match.quiet { color: var(--muted); }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--panel2); }
tr.detailrow td { background: var(--panel2); white-space: normal; }
.detail { display: grid; gap: 12px; padding: 4px 2px; }
dl.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 4px 18px; margin: 0; }
dl.facts dt { color: var(--muted); font-size: .78rem; } dl.facts dd { margin: 0 0 4px; }
table.mini { font-size: .85rem; } table.mini td { padding: 3px 8px; border-bottom: 1px solid var(--line); }
.chip.live { background: transparent; border: 1px solid var(--good); color: var(--good); font-weight: 600; }
.chip.pending { background: transparent; border: 1px dashed var(--muted); color: var(--muted); }
.chip.warn { background: transparent; border: 1px solid var(--warn); color: var(--warn); font-weight: 600; }
svg.spark rect { fill: var(--accent); }
.sub.err { color: var(--bad); }
.namebox { display: flex; align-items: center; gap: 8px; }
.namebox img { width: 24px; height: 24px; border-radius: 4px; background: var(--panel2); }
/* the name, then the pilot's flag chips on a line beneath it */
.namecol { display: flex; flex-direction: column; align-items: stretch; gap: 3px; min-width: 0; }
.namecol .badge { margin-left: 6px; }
/* the chips use the width of the column and wrap onto further lines when the table is narrow */
.namecol .chips { flex-wrap: wrap; white-space: normal; min-width: 0; }
.chips { display: flex; gap: 4px; flex-wrap: wrap; white-space: normal; }
.chip { background: var(--chip); border-radius: 999px; padding: 1px 8px; font-size: .78rem; }
.sub { color: var(--muted); font-size: .8rem; }
.empty { color: var(--muted); padding: 24px; text-align: center; }
.timing { color: var(--muted); font-size: .8rem; margin-top: 8px; }

form.inline { display: flex; gap: 8px; flex-wrap: wrap; }
input[type=text] { font: inherit; padding: 7px 10px; border: 1px solid var(--line); border-radius: 7px; background: var(--bg); color: var(--ink); min-width: 280px; flex: 1; }
.matchcard { display: flex; align-items: center; gap: 12px; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel2); margin-top: 10px; }
.matchcard img { width: 48px; height: 48px; border-radius: 6px; }
.badge { font-size: .72rem; padding: 1px 7px; border-radius: 999px; background: var(--chip); color: var(--muted); }
.badge.bad { color: var(--bad); } .badge.good { color: var(--good); }
