/* BirdDog: single column, readable on a phone, no framework. */
:root {
  color-scheme: light;
  --fg: #1d232a; --muted: #5d6874; --bg: #f5f6f8; --card: #fff; --line: #d8dde3;
  --accent: #1f5f9e; --on-accent: #fff; --ok-bg: #e5f4e8; --ok-fg: #1d5e2c; --err-bg: #fbe7e6; --err-fg: #8a1f17;
  --new-bg: #fff8dc; --header-bg: #17324d; --input-bg: #fff; --badge-bg: #eef1f4;
  --covert-bg: #e8e1f7; --covert-line: #b9a6e6; --overt-bg: #dcecf9; --overt-line: #9cc3e6;
  --both-bg: #e0f0ef; --both-line: #99cfc9; --mixed-bg: #fff0d6; --mixed-line: #e7b75c;
  --service-line: #e3a19b; --equipment-line: #97cfa2;
}
/* Dark: follows the device unless the person picked Light; or forced by picking Dark. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --fg: #e3e7ec; --muted: #9aa5b1; --bg: #121619; --card: #1b2126; --line: #333c46;
    --accent: #7ab0e6; --on-accent: #0b1520; --ok-bg: #1d3a25; --ok-fg: #a3dcaf; --err-bg: #4a211d; --err-fg: #f4b0a9;
    --new-bg: #36301a; --header-bg: #0c1824; --input-bg: #11161a; --badge-bg: #262e36;
    --covert-bg: #33294d; --covert-line: #6e5aa8; --overt-bg: #1d3450; --overt-line: #41709e;
    --both-bg: #1b3a37; --both-line: #3f8a82; --mixed-bg: #43351a; --mixed-line: #9a7a32;
    --service-line: #9a4a43; --equipment-line: #3f8a52;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --fg: #e3e7ec; --muted: #9aa5b1; --bg: #121619; --card: #1b2126; --line: #333c46;
  --accent: #7ab0e6; --on-accent: #0b1520; --ok-bg: #1d3a25; --ok-fg: #a3dcaf; --err-bg: #4a211d; --err-fg: #f4b0a9;
  --new-bg: #36301a; --header-bg: #0c1824; --input-bg: #11161a; --badge-bg: #262e36;
  --covert-bg: #33294d; --covert-line: #6e5aa8; --overt-bg: #1d3450; --overt-line: #41709e;
  --both-bg: #1b3a37; --both-line: #3f8a82; --mixed-bg: #43351a; --mixed-line: #9a7a32;
  --service-line: #9a4a43; --equipment-line: #3f8a52;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
       color: var(--fg); background: var(--bg); }
a { color: var(--accent); }
main { max-width: 1200px; margin: 0 auto; padding: 1rem; }
h1 { font-size: 1.5rem; margin: .5rem 0 1rem; overflow-wrap: anywhere; }
h2 { font-size: 1.15rem; margin: 0 0 .75rem; }
h3 { font-size: 1rem; }
header.site { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center;
              padding: .6rem 1rem; background: var(--header-bg); color: #fff; }
header.site a, header.site button.link { color: #fff; }
header.site .brand { font-weight: 700; text-decoration: none; font-size: 1.1rem;
                     display: inline-flex; align-items: center; gap: .45rem; }
header.site .brand img { display: block; }
header.site nav { display: flex; flex-wrap: wrap; gap: .25rem 1rem; align-items: center; }
footer.site { text-align: center; color: var(--muted); font-size: .85rem; padding: 2rem 1rem; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 6px;
        padding: 1rem; margin-bottom: 1rem; }
.narrow { max-width: 32rem; margin-left: auto; margin-right: auto; }
.muted { color: var(--muted); font-size: .9rem; }
.flash { padding: .6rem .8rem; border-radius: 4px; }
.flash.ok { background: var(--ok-bg); color: var(--ok-fg); }
.flash.error { background: var(--err-bg); color: var(--err-fg); }
.error-text { color: var(--err-fg); overflow-wrap: anywhere; }

form label { display: block; margin: .5rem 0; font-weight: 600; }
form label.check { font-weight: normal; }
input[type=text], input[type=email], input[type=search], input[type=number], select, textarea {
  display: block; width: 100%; margin-top: .25rem; padding: .45rem; font: inherit;
  border: 1px solid var(--line); border-radius: 4px; background: var(--input-bg); color: var(--fg); }
select[multiple] { min-height: 12rem; }
textarea { resize: vertical; }
button { font: inherit; padding: .45rem .9rem; border: 1px solid var(--accent); border-radius: 4px;
         background: var(--accent); color: var(--on-accent); cursor: pointer; margin-top: .25rem; }
a.button { display: inline-block; padding: .55rem 1rem; border-radius: 4px; text-decoration: none;
            background: var(--accent); color: var(--on-accent); font-weight: 600; }
a.button:focus-visible, a.button:hover { filter: brightness(1.1); }
details.backup-login { margin-top: 1.25rem; border-top: 1px solid var(--line); padding-top: .75rem; }
details.backup-login summary { cursor: pointer; color: var(--muted); font-size: .9rem; }
button.link { background: none; border: none; padding: 0; margin: 0; text-decoration: underline; }
form.inline { display: inline; }
/* Theme picker: a small segmented control (header and My settings). */
form.theme-pick { display: inline-flex; margin: 0; }
form.theme-pick button { margin: 0; padding: .15rem .55rem; font-size: .85rem; border-radius: 0;
  background: transparent; color: inherit; border: 1px solid currentColor; opacity: .75; }
form.theme-pick button + button { border-left: none; }
form.theme-pick button:first-child { border-radius: 4px 0 0 4px; }
form.theme-pick button:last-child { border-radius: 0 4px 4px 0; }
form.theme-pick button.current { opacity: 1; font-weight: 700; background: rgba(127, 127, 127, .25); }
/* Admin tabs: one page per tab; scrolls sideways on a phone instead of wrapping. */
nav.tabs { display: flex; gap: .25rem; overflow-x: auto; border-bottom: 1px solid var(--line);
           margin-bottom: 1rem; }
nav.tabs a { padding: .5rem .8rem; white-space: nowrap; text-decoration: none; color: var(--muted);
             border-bottom: 3px solid transparent; margin-bottom: -1px; }
nav.tabs a:hover { color: var(--fg); }
nav.tabs a[aria-current="page"] { color: var(--fg); font-weight: 600; border-bottom-color: var(--accent); }
fieldset.choices { border: 1px solid var(--line); border-radius: 4px; padding: .5rem .8rem; margin: .5rem 0; }
fieldset.choices legend { font-weight: 600; padding: 0 .3rem; }
code { font-size: .9em; background: var(--badge-bg); padding: 0 .25rem; border-radius: 3px; }
.help h2 { margin-top: 1.4rem; }
.help li { margin-bottom: .35rem; }
.row-actions button { font-size: .85rem; padding: .25rem .5rem; }

.filters { display: grid; grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
           gap: 0 1rem; background: var(--card); border: 1px solid var(--line);
           border-radius: 6px; padding: .5rem 1rem; margin-bottom: 1rem; }
.filters .actions { align-self: end; padding-bottom: .5rem; }
.count { color: var(--muted); }

table { width: 100%; border-collapse: collapse; background: var(--card); }
th, td { text-align: left; padding: .45rem .5rem; border-bottom: 1px solid var(--line);
         vertical-align: top; }
th { font-size: .85rem; color: var(--muted); }
td.title a { font-weight: 600; }
td.score, dd.score { font-weight: 700; }
tr.is-new { background: var(--new-bg); }

.badge { display: inline-block; font-size: .75rem; padding: .05rem .4rem; margin: 0 .2rem .2rem 0;
         border-radius: 3px; border: 1px solid var(--line); background: var(--badge-bg); white-space: nowrap; }
.badge.new { background: #f0c400; border-color: #d4ad00; color: #000; font-weight: 700; }
.badge.cat-covert { background: var(--covert-bg); border-color: var(--covert-line); }
.badge.cat-overt { background: var(--overt-bg); border-color: var(--overt-line); }
.badge.cat-both { background: var(--both-bg); border-color: var(--both-line); }
.badge.wt-mixed { background: var(--mixed-bg); border-color: var(--mixed-line); }
.badge.wt-service-only { background: var(--err-bg); border-color: var(--service-line); }
.badge.wt-equipment-only { background: var(--ok-bg); border-color: var(--equipment-line); }

dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: .25rem 1rem; margin: 0; }
dl.facts dt { color: var(--muted); }
dl.facts dd { margin: 0; overflow-wrap: anywhere; }
ul.links { padding-left: 1.2rem; overflow-wrap: anywhere; }
.unsafe-url { font-family: monospace; font-size: .9rem; color: var(--muted); }
pre.description { white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; margin: 0; }
ol.notes { list-style: none; padding: 0; }
ol.notes li { border-bottom: 1px solid var(--line); padding: .5rem 0; }
.note-meta { color: var(--muted); font-size: .85rem; }
.note-body { white-space: pre-wrap; overflow-wrap: anywhere; }
.pager { display: flex; justify-content: space-between; margin: 1rem 0; }

/* Phones: tables become stacked cards labelled from data-label. */
@media (max-width: 720px) {
  main { padding: .5rem; }
  table, thead, tbody, tr, th, td { display: block; }
  thead { position: absolute; left: -9999px; }
  tr { border: 1px solid var(--line); border-radius: 6px; margin-bottom: .6rem; padding: .3rem; }
  td { border: none; padding: .2rem .4rem; }
  td[data-label]::before { content: attr(data-label) ": "; color: var(--muted); font-size: .85rem; }
  dl.facts { grid-template-columns: 1fr; }
  dl.facts dd { margin-bottom: .4rem; }
}
