:root {
  --bg: #f5f6f8; --fg: #1d2330; --muted: #5a6475; --card: #fff; --line: #d9dde4;
  --accent: #1f5fbf; --err: #a3231b; --warn-bg: #fff4d6; --ok: #1d6b35;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--fg); line-height: 1.45; }
.topbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: .5rem; padding: .75rem 1.25rem; background: #14213d; color: #fff; }
.topbar h1 { font-size: 1.2rem; margin: 0; }
nav { display: flex; flex-wrap: wrap; gap: .4rem; }
nav button { background: transparent; color: #fff; border: 1px solid #ffffff55; }
nav button[aria-current="page"] { background: #fff; color: #14213d; }
main { padding: 1rem 1.25rem; max-width: 1200px; margin: 0 auto; }
.view { display: flex; flex-direction: column; gap: 1rem; }
.view[hidden] { display: none; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 1rem; }
.narrow { max-width: 420px; margin: 2rem auto; display: flex; flex-direction: column; gap: .75rem; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 1rem; }
.row { display: flex; flex-wrap: wrap; gap: .75rem; align-items: flex-end; margin: .5rem 0; }
label { display: flex; flex-direction: column; gap: .25rem; font-weight: 600; font-size: .9rem; }
input, select, textarea { font: inherit; padding: .45rem; border: 1px solid var(--line); border-radius: 6px; }
textarea { width: 100%; font-family: ui-monospace, monospace; font-size: .85rem; }
button { font: inherit; padding: .45rem .9rem; border-radius: 6px; border: 1px solid var(--accent);
  background: var(--accent); color: #fff; cursor: pointer; }
button:disabled { opacity: .6; cursor: progress; }
button:focus-visible, a:focus-visible, select:focus-visible, input:focus-visible,
textarea:focus-visible { outline: 3px solid #f2a900; outline-offset: 2px; }
.link { background: none; border: none; color: var(--accent); padding: 0; text-decoration: underline; cursor: pointer; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .75rem; }
.stat { display: flex; flex-direction: column; align-items: flex-start; gap: .2rem; text-align: left;
  background: var(--card); color: var(--fg); border: 1px solid var(--line); border-radius: 8px; padding: .75rem; }
.stat-value { font-size: 1.5rem; font-weight: 700; }
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; }
th, td { border-bottom: 1px solid var(--line); padding: .45rem .6rem; text-align: left; vertical-align: top; }
th small { display: block; font-weight: 400; color: var(--muted); }
.count { font-weight: 700; }
.sources li { margin-bottom: .4rem; }
.evidence-list { list-style: none; padding: 0; margin: 0; }
.evidence-list li { border-bottom: 1px solid var(--line); padding: .5rem 0; }
.snippet { margin: .2rem 0 0; color: var(--muted); font-size: .9rem; }
.muted { color: var(--muted); }
.error { color: var(--err); font-weight: 600; }
.ok { color: var(--ok); font-weight: 600; }
.warn { background: var(--warn-bg); padding: .4rem .6rem; border-radius: 6px; }
.answer { font-size: 1.05rem; }
.banner { padding: .6rem 1.25rem; font-weight: 600; }
.banner.warn { background: var(--warn-bg); border-bottom: 1px solid #e6c766; border-radius: 0; }
.detail { position: fixed; top: 0; right: 0; width: min(460px, 100%); height: 100%; overflow-y: auto;
  background: var(--card); border-left: 1px solid var(--line); padding: 1rem; box-shadow: -4px 0 16px #0002; }
.detail dl { display: grid; grid-template-columns: max-content 1fr; gap: .3rem .75rem; }
.detail dt { font-weight: 600; }
.detail dd { margin: 0; word-break: break-word; }
blockquote { margin: 0; padding: .5rem .75rem; border-left: 4px solid var(--accent); background: var(--bg); white-space: pre-wrap; }
@media (max-width: 600px) { main { padding: .75rem; } .stat-value { font-size: 1.2rem; } }