:root {
  --bg: #ffffff; --bg-soft: #f5f7fa; --bg-card: #ffffff; --text: #1b2330; --muted: #5b6676;
  --border: #dde3ea; --accent: #1f5fa8; --accent-soft: #e6eff9; --accent-text: #ffffff;
  --ok: #1a7f37; --warn: #9a6700; --bad: #cf222e; --code: #0f3d6e; --cover: #cfe2f7;
  --radius: 8px; --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f141a; --bg-soft: #161d26; --bg-card: #141a22; --text: #e3e8ef; --muted: #98a4b3;
    --border: #2a3441; --accent: #6aa8ee; --accent-soft: #1b2a3c; --accent-text: #0f141a;
    --ok: #4cc26b; --warn: #d9a520; --bad: #f2645f; --code: #a8cdf5; --cover: #24476e;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f141a; --bg-soft: #161d26; --bg-card: #141a22; --text: #e3e8ef; --muted: #98a4b3;
  --border: #2a3441; --accent: #6aa8ee; --accent-soft: #1b2a3c; --accent-text: #0f141a;
  --ok: #4cc26b; --warn: #d9a520; --bad: #f2645f; --code: #a8cdf5; --cover: #24476e;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text); line-height: 1.55;
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code, .mono { font-family: var(--mono); font-size: .92em; color: var(--code); word-break: break-all; }
h1, h2, h3 { line-height: 1.25; margin: 1.4em 0 .5em; }
h1 { font-size: 1.7rem; margin-top: .6em; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }

/* header */
.site-header { border-bottom: 1px solid var(--border); background: var(--bg-card); position: sticky; top: 0; z-index: 10; }
.site-header .wrap { display: flex; align-items: center; gap: 20px; min-height: 60px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.15rem; color: var(--text); }
.brand img { width: 34px; height: 34px; }
.brand:hover { text-decoration: none; }
.nav { display: flex; gap: 4px; flex-wrap: wrap; margin-left: auto; }
.nav a { color: var(--muted); padding: 6px 10px; border-radius: 6px; font-size: .95rem; }
.nav a:hover, .nav a.active { color: var(--text); background: var(--bg-soft); text-decoration: none; }
.theme-toggle { background: none; border: 1px solid var(--border); color: var(--muted); border-radius: 6px; padding: 4px 8px; cursor: pointer; }

main { padding: 8px 0 48px; }
.site-footer { border-top: 1px solid var(--border); padding: 24px 0; color: var(--muted); font-size: .875rem; background: var(--bg-soft); }
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 8px 24px; justify-content: space-between; }

/* hero / search box */
.hero { padding: 40px 0 16px; }
.hero h1 { font-size: 2rem; margin: 0 0 .3em; }
.hero p { color: var(--muted); max-width: 720px; margin: 0 0 1.2em; font-size: 1.05rem; }
.searchbar { display: flex; gap: 8px; max-width: 760px; }
.searchbar input[type=search] { flex: 1; min-width: 0; }
input, select, textarea {
  font: inherit; color: var(--text); background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 6px; padding: 9px 11px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
textarea { width: 100%; font-family: var(--mono); font-size: .9rem; }
.btn {
  display: inline-block; font: inherit; font-weight: 600; background: var(--accent); color: var(--accent-text);
  border: 0; border-radius: 6px; padding: 9px 16px; cursor: pointer; white-space: nowrap;
}
.btn:hover { text-decoration: none; filter: brightness(1.08); }
.btn.secondary { background: var(--bg-soft); color: var(--text); border: 1px solid var(--border); }
.examples { margin-top: 10px; font-size: .9rem; color: var(--muted); }
.examples a { margin-right: 10px; }

/* stats */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 28px 0; }
.stat { background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.stat b { display: block; font-size: 1.6rem; line-height: 1.2; }
.stat span { color: var(--muted); font-size: .875rem; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; }
.card h3 { margin-top: 0; }
.card p { margin: .3em 0 0; color: var(--muted); font-size: .95rem; }

/* layout with facets */
.with-sidebar { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 28px; }
@media (max-width: 860px) { .with-sidebar { grid-template-columns: minmax(0, 1fr); } }
.facets h3 { font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 18px 0 6px; }
.facets label { display: flex; gap: 6px; align-items: baseline; font-size: .9rem; padding: 2px 0; cursor: pointer; }
.facets label span.n { margin-left: auto; color: var(--muted); font-size: .8rem; }
.facets input[type=checkbox] { margin: 0; }
details.facet-box summary { cursor: pointer; font-weight: 600; padding: 6px 0; }
@media (min-width: 861px) { details.facet-box summary { display: none; } }

.toolbar { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between; margin: 12px 0; }
.toolbar .downloads a { margin-left: 8px; font-size: .9rem; }

/* tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { background: var(--bg-soft); font-weight: 600; white-space: nowrap; position: sticky; top: 0; }
th a { color: var(--text); }
tr:last-child td { border-bottom: 0; }
td:first-child code { display: inline-block; min-width: 14em; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tbody tr:hover { background: var(--bg-soft); }

.badge { display: inline-block; font-size: .75rem; font-weight: 600; padding: 1px 7px; border-radius: 999px; border: 1px solid currentColor; white-space: nowrap; }
.badge.approved { color: var(--ok); }
.badge.review { color: var(--warn); }
.ppm-ok { color: var(--ok); } .ppm-warn { color: var(--warn); } .ppm-bad { color: var(--bad); font-weight: 600; }

.pagination { display: flex; gap: 6px; align-items: center; margin: 16px 0; flex-wrap: wrap; }
.pagination a, .pagination span { padding: 5px 10px; border: 1px solid var(--border); border-radius: 6px; font-size: .9rem; }

/* detail pages */
.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 18px; margin: 12px 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.seq-title { font-family: var(--mono); font-size: 1.5rem; word-break: break-all; }
.coverage-bar { position: relative; height: 14px; background: var(--bg-soft); border: 1px solid var(--border); border-radius: 4px; margin: 6px 0 2px; }
.coverage-bar span { position: absolute; top: -1px; bottom: -1px; background: var(--accent); border-radius: 3px; }
.protein-seq { font-family: var(--mono); font-size: .85rem; line-height: 1.9; word-break: break-all; background: var(--bg-soft); padding: 12px; border-radius: var(--radius); border: 1px solid var(--border); }
.protein-seq .cov { background: var(--cover); border-radius: 2px; }
.notice { background: var(--accent-soft); border-left: 3px solid var(--accent); padding: 10px 14px; border-radius: 4px; margin: 14px 0; font-size: .95rem; }
.notice.warn { border-color: var(--warn); }

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin: 12px 0; }
.form-grid label { display: flex; flex-direction: column; gap: 4px; font-size: .9rem; color: var(--muted); }
fieldset { border: 1px solid var(--border); border-radius: 6px; padding: 8px 12px; margin: 0; }
fieldset label { flex-direction: row !important; gap: 6px !important; color: var(--text) !important; }
legend { font-size: .9rem; color: var(--muted); padding: 0 4px; }
.peak-block { border: 1px solid var(--border); border-radius: var(--radius); margin: 10px 0; overflow: hidden; }
.peak-block > div:first-child { background: var(--bg-soft); padding: 8px 12px; font-weight: 600; }
.peak-block table { border: 0; }
.prose { max-width: 760px; }
.prose p, .prose li { color: var(--text); }
pre { background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; overflow-x: auto; font-size: .85rem; }
