  /* Light theme only (owner request, 2026-11). Text colours meet WCAG AA on --panel and --bg. */
  :root { color-scheme: light; --bg:#f5f6f8; --panel:#fff; --ink:#1a1d21; --muted:#596069; --line:#dfe3e8; --accent:#1f4e79;
          --accent-ink:#fff; --accent-soft:#e9f0f7; --warn:#6e4500; --warn-bg:#fff4dc; --ok:#1e6b3a; --bad:#a51c1c; --bad-bg:#fdecec; }
  * { box-sizing: border-box; }
  body { margin:0; font:15px/1.55 system-ui, -apple-system, "Segoe UI", sans-serif; background:var(--bg); color:var(--ink);
         display:grid; grid-template-columns: 264px 1fr; height:100vh; height:100dvh; }
  button { font:inherit; color:inherit; }
  :focus-visible { outline:2px solid var(--accent); outline-offset:2px; }
  .sr { position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0 0 0 0); white-space:nowrap; }

  /* Sidebar */
  aside { border-right:1px solid var(--line); padding:14px 12px; background:var(--panel); display:flex; flex-direction:column; gap:10px; min-height:0; }
  .brand { font-weight:700; font-size:17px; padding:0 4px; }
  aside button.new { width:100%; padding:8px; border:1px solid var(--line); background:var(--accent-soft); border-radius:8px; cursor:pointer; }
  #search { width:100%; padding:7px 10px; border:1px solid var(--line); border-radius:8px; background:var(--bg); font:inherit; font-size:13px; }
  #convs { flex:1; overflow:auto; min-height:0; }
  .group { font-size:11px; font-weight:600; color:var(--muted); text-transform:uppercase; letter-spacing:.04em; margin:12px 6px 4px; }
  .conv-row { display:flex; align-items:center; border-radius:6px; }
  .conv-row:hover, .conv-row.active { background:var(--accent-soft); }
  .conv { flex:1; min-width:0; text-align:left; border:none; background:none; padding:7px 8px; cursor:pointer; font-size:13px;
          white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
  .conv-row .icon { visibility:hidden; }
  .conv-row:hover .icon, .conv-row:focus-within .icon, .conv-row.active .icon { visibility:visible; }
  .icon { border:none; background:none; cursor:pointer; padding:4px 6px; border-radius:6px; font-size:13px; color:var(--muted); }
  .icon:hover { background:var(--line); color:var(--ink); }
  input.rename { flex:1; min-width:0; font:inherit; font-size:13px; padding:5px 7px; border:1px solid var(--accent); border-radius:6px; }
  .empty { color:var(--muted); font-size:13px; padding:8px; }
  .nav-btn { display:flex; align-items:center; gap:8px; width:100%; padding:7px 10px; border:1px solid var(--line); border-radius:8px;
             background:var(--panel); cursor:pointer; font-size:14px; }
  .nav-btn:hover, .nav-btn[aria-current="page"] { background:var(--accent-soft); border-color:var(--accent); }
  body.on-map #log, body.on-map form#ask { display:none; }
  #profile:empty { display:none; }
  #profile { position:relative; border-top:1px solid var(--line); padding-top:8px; }
  .me { width:100%; display:flex; align-items:center; gap:10px; border:none; background:none; padding:6px; border-radius:8px; cursor:pointer; text-align:left; }
  .me:hover { background:var(--accent-soft); }
  .avatar { width:30px; height:30px; border-radius:50%; background:var(--accent); color:var(--accent-ink); display:grid; place-items:center; font-size:12px; font-weight:700; flex:none; }
  .me-name { flex:1; font-size:14px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
  .pmenu { position:absolute; bottom:calc(100% + 4px); left:0; right:0; background:var(--panel); border:1px solid var(--line); border-radius:10px; box-shadow:0 8px 24px rgba(16,24,40,.12); padding:4px; z-index:40; }
  .pmenu[hidden] { display:none; }
  .pmenu .usage { font-size:12px; color:var(--muted); padding:6px 10px 8px; border-bottom:1px solid var(--line); margin-bottom:4px; }
  .pmenu button { display:block; width:100%; text-align:left; border:none; background:none; padding:8px 10px; border-radius:6px; cursor:pointer; font-size:14px; }
  .pmenu button:hover, .pmenu button:focus-visible { background:var(--accent-soft); }
  dialog#settings { border:1px solid var(--line); border-radius:12px; padding:18px 20px; width:min(440px, 92vw); color:var(--ink); }
  dialog#settings::backdrop { background:rgba(0,0,0,.3); }
  dialog#settings h2 { margin:0 0 12px; font-size:18px; }
  .st-row { display:flex; justify-content:space-between; align-items:center; gap:12px; margin-top:12px; font-weight:600; font-size:14px; }
  .st-note { color:var(--muted); font-size:13px; margin-top:4px; }
  .st-foot { display:flex; justify-content:flex-end; margin-top:18px; }
  .btn.danger { color:var(--bad); border-color:#f1c3c3; }
  .btn.danger:hover { background:var(--bad-bg); }

  /* Main column */
  main { display:flex; flex-direction:column; height:100vh; height:100dvh; min-width:0; }
  .topbar { display:none; }
  #log { flex:1; overflow:auto; padding:24px 16px 40px; } .wrap { max-width:860px; margin:0 auto; }
  .msg { margin:0 0 22px; } .user { background:var(--accent-soft); padding:10px 14px; border-radius:10px; width:fit-content; max-width:85%; margin-left:auto; white-space:pre-wrap; }
  .bot { background:var(--panel); border:1px solid var(--line); border-radius:10px; padding:14px 16px; }
  .bot table { border-collapse:collapse; margin:8px 0; font-size:14px; } .bot th, .bot td { border:1px solid var(--line); padding:4px 8px; text-align:left; }
  .cite { display:inline-block; font-size:11px; line-height:1.5; padding:0 5px; margin:0 1px; border-radius:4px; border:none; background:var(--accent-soft);
          color:var(--accent); cursor:pointer; vertical-align:super; font-weight:700; }
  .cite:hover { background:var(--accent); color:var(--accent-ink); }

  /* Landing: name and description centred at the top, four examples in a 2 x 2 grid (owner's sketch) */
  .examples { max-width:760px; margin:6vh auto 0; text-align:center; }
  .examples h1 { font-size:30px; margin:0 0 8px; letter-spacing:-.01em; }
  .examples p { color:var(--muted); margin:0 auto 28px; max-width:620px; }
  .ex-grid { display:grid; grid-template-columns:1fr 1fr; gap:12px; text-align:left; }
  .ex { border:1px solid var(--line); background:var(--panel); border-radius:10px; padding:12px 14px; cursor:pointer; font-size:14px; text-align:left; }
  .ex:hover { border-color:var(--accent); background:var(--accent-soft); }
  .ex span { display:block; font-size:11px; font-weight:600; color:var(--accent); text-transform:uppercase; letter-spacing:.04em; margin-bottom:3px; }

  /* Progress, steps, notes */
  .progress { display:flex; align-items:center; gap:10px; color:var(--muted); font-size:13px; }
  .progress .ptext { color:var(--ink); } .progress .stop { margin-left:auto; }
  .thinking { margin-top:8px; max-height:9.5em; overflow-y:auto; padding:6px 0 6px 12px; border-left:2px solid var(--line);
    font-size:13px; line-height:1.45; color:var(--muted); white-space:pre-wrap; overflow-wrap:anywhere; }
  .thinking .th + .th { margin-top:6px; } .thinking .th b { color:var(--ink); font-weight:600; margin-right:6px; }
  .thinking .th.live span::after { content:'▍'; animation:blink 1s steps(1) infinite; }
  @keyframes blink { 50% { opacity:0; } }
  @media (prefers-reduced-motion: reduce) { .thinking .th.live span::after { animation:none; } }
  .step.thought { font-family:inherit; white-space:pre-wrap; }
  .spin { width:14px; height:14px; border:2px solid var(--line); border-top-color:var(--accent); border-radius:50%; animation:spin .9s linear infinite; }
  @keyframes spin { to { transform:rotate(360deg); } }
  @media (prefers-reduced-motion: reduce) { .spin { animation:none; } }
  details.steps { margin-top:10px; font-size:13px; color:var(--muted); } details.steps summary { cursor:pointer; }
  .step { font-family: ui-monospace, Consolas, monospace; font-size:12px; padding:2px 0; overflow-wrap:anywhere; }
  .step .args { color:var(--muted); } .step .err { color:var(--bad); }
  .warn { background:var(--warn-bg); color:var(--warn); border-radius:8px; padding:8px 10px; margin-top:10px; font-size:13px; }
  .note { margin-top:10px; font-size:13px; color:var(--muted); }
  .errcard { border:1px solid #f1c3c3; background:var(--bad-bg); color:var(--bad); border-radius:8px; padding:10px 12px; margin-top:10px; font-size:13px; }
  .errcard div { color:var(--ink); margin:2px 0 8px; overflow-wrap:anywhere; }

  /* Approval card */
  .approval { border:1px solid var(--accent); border-radius:10px; padding:12px; margin-top:12px; background:var(--accent-soft); }
  .approval .sub { font-size:12px; color:var(--muted); margin-bottom:8px; }
  .approval .preview { font-size:13px; max-height:260px; overflow:auto; background:var(--panel); padding:4px 12px; border-radius:6px; border:1px solid var(--line); }
  .approval .row { margin-top:10px; display:flex; gap:8px; }
  .approval .row button { padding:6px 14px; border-radius:6px; border:1px solid var(--line); cursor:pointer; }
  .approve { background:var(--ok); color:#fff; border-color:var(--ok) !important; } .reject { background:var(--panel); color:var(--bad); }
  .approval.ok { border-color:var(--ok); } .approval.no { border-color:var(--line); background:var(--bg); }

  /* Message footer */
  .foot { display:flex; justify-content:space-between; align-items:center; gap:8px; flex-wrap:wrap; margin-top:10px; }
  .foot:empty { display:none; }
  .foot .actions { display:flex; gap:6px; flex-wrap:wrap; }
  .msg:not(:last-child) .b-regen { display:none; }
  .btn.fb.on { background:var(--accent-soft); border-color:var(--accent); }
  .btn:disabled { opacity:.55; cursor:default; }
  .meta { font-size:12px; color:var(--muted); display:flex; gap:12px; flex-wrap:wrap; }
  .sources { font-size:13px; margin-top:10px; border-top:1px solid var(--line); padding-top:8px; }
  .sources div { margin:2px 0; }
  .tag { display:inline-block; font-size:11px; font-weight:600; padding:0 6px; border-radius:4px; }
  .tag.news { background:#f1ecf9; color:#5a3c8a; } .tag.official { background:#e6f2ea; color:#1e6b3a; }

  /* Composer: one floating box in the chat area, no separate bar (owner request) */
  form#ask { padding:0 16px 18px; background:linear-gradient(to bottom, rgba(245,246,248,0), var(--bg) 40%); margin-top:-24px; position:relative; }
  form#ask .wrap { display:flex; align-items:flex-end; gap:8px; background:var(--panel); border:1px solid var(--line); border-radius:16px;
                   padding:8px 8px 8px 14px; box-shadow:0 4px 18px rgba(16,24,40,.08), 0 1px 3px rgba(16,24,40,.06); }
  form#ask .wrap:focus-within { border-color:var(--accent); box-shadow:0 0 0 1px var(--accent), 0 4px 18px rgba(16,24,40,.08); }
  form#ask textarea:focus, form#ask textarea:focus-visible { outline:none; }   /* the box above shows focus instead */
  textarea { flex:1; resize:none; height:44px; max-height:180px; padding:10px 0; border:none; outline:none; background:transparent;
             color:var(--ink); font:inherit; }
  form#ask button { height:38px; padding:0 18px; border-radius:10px; border:none; background:var(--accent); color:var(--accent-ink);
                    cursor:pointer; font-weight:600; }
  form#ask button:disabled { background:#5b6b7c; cursor:default; }

  /* Passage panel */
  #passage { position:fixed; right:0; top:0; width:min(480px, 100vw); height:100vh; height:100dvh; background:var(--panel); border-left:1px solid var(--line);
             padding:18px; overflow:auto; box-shadow:-6px 0 20px rgba(0,0,0,.08); z-index:30; }
  #passage[hidden] { display:none; }
  #passage h3 { margin:0 28px 4px 0; } #passage .sub { color:var(--muted); font-size:13px; }
  #passage .ptext-body { font-size:14px; overflow-x:auto; }
  #passage .close { position:absolute; right:12px; top:10px; cursor:pointer; border:none; background:none; font-size:22px; color:var(--muted); }
  .typing { color:var(--muted); font-size:13px; }

  /* Phone: the chat list becomes a drawer */
  @media (max-width: 760px) {
    body { grid-template-columns: 1fr; }
    aside { position:fixed; inset:0 auto 0 0; width:min(300px, 86vw); z-index:20; transform:translateX(-100%); transition:transform .2s; visibility:hidden; }
    body.drawer aside { transform:none; visibility:visible; box-shadow:6px 0 20px rgba(0,0,0,.12); }
    #scrim { position:fixed; inset:0; background:rgba(0,0,0,.3); z-index:10; }
    #scrim[hidden] { display:none; }
    .topbar { display:flex; align-items:center; gap:8px; padding:6px 8px; border-bottom:1px solid var(--line); background:var(--panel); }
    .topbar .icon { font-size:18px; color:var(--ink); padding:6px 10px; } .tb-title { flex:1; font-weight:700; }
    .conv-row .icon { visibility:visible; }
    #log { padding:16px 10px; } .bot { padding:12px; }
    .ex-grid { grid-template-columns:1fr; } .examples { margin-top:2vh; } .examples h1 { font-size:24px; }
    form#ask { padding:0 10px 10px; }
  }

  /* Widgets: tables and charts */
  .card { border:1px solid var(--line); border-radius:10px; margin:12px 0; background:var(--panel); overflow:hidden; }
  .card-h { display:flex; justify-content:space-between; align-items:center; gap:8px; padding:8px 12px; border-bottom:1px solid var(--line); flex-wrap:wrap; }
  .card-t { font-weight:600; font-size:14px; }
  .card-a { display:flex; gap:6px; flex-wrap:wrap; }
  .card-a button, .btn { font:inherit; font-size:12px; padding:4px 10px; border-radius:6px; border:1px solid var(--line); background:var(--panel); color:var(--ink); cursor:pointer; }
  .card-a button:hover, .btn:hover { background:var(--accent-soft); }
  .card-a button:disabled { opacity:.5; cursor:default; }
  .card-f { font-size:12px; color:var(--muted); padding:6px 12px; border-top:1px solid var(--line); background:var(--bg); }
  .tscroll { max-height:360px; overflow:auto; }
  .bot table.dt { border-collapse:separate; border-spacing:0; width:100%; margin:0; font-size:13px; }
  .bot table.dt th, .bot table.dt td { border:none; border-bottom:1px solid var(--line); padding:6px 10px; text-align:left; }
  .bot table.dt th { position:sticky; top:0; background:var(--bg); z-index:1; padding:0; }
  .dt th button { all:unset; display:block; width:100%; box-sizing:border-box; padding:6px 10px; font-weight:600; cursor:pointer; }
  .dt th button:focus-visible { outline:2px solid var(--accent); outline-offset:-2px; }
  .bot table.dt .num, .dt .num button { text-align:right; font-variant-numeric:tabular-nums; }
  .vis { padding:10px 12px; min-height:60px; } div.vis.vega-embed { display:block; width:100%; box-sizing:border-box; }
  .data-pane { border-top:1px solid var(--line); }

  /* Exposure map page (D63) */
  #mapview { flex:1; overflow:auto; padding:14px 20px 20px; }
  #mapview[hidden] { display:none; }
  .map-head { display:flex; align-items:baseline; gap:12px; flex-wrap:wrap; margin-bottom:10px; }
  .map-head h2 { margin:0; font-size:20px; } .map-lenshelp { color:var(--muted); font-size:13px; }
  .map-body { display:grid; grid-template-columns:240px minmax(0, 1fr); gap:16px; align-items:start; }
  .map-body.with-panel { grid-template-columns:240px minmax(0, 1fr) 340px; }
  .map-rail > summary { display:none; }
  .rail-inner { font-size:13px; }
  .f-group { border:none; padding:0; margin:0; } .f-group legend, .f-label { display:block; font-size:12px; font-weight:600; margin:10px 0 4px; padding:0; }
  .rail-inner select, .rail-inner input[type=search] { width:100%; padding:6px 8px; border:1px solid var(--line); border-radius:6px; font:inherit; font-size:13px; background:#fff; color:var(--ink); }
  .rail-inner input[type=range] { width:100%; }
  .f-help { color:var(--muted); font-size:12px; margin:4px 0; }
  .chk { display:flex; gap:6px; align-items:center; margin-top:10px; font-size:13px; }
  [data-for][hidden], .map-loading[hidden], .map-tip[hidden], .map-panel[hidden] { display:none !important; }
  .seg { display:flex; border:1px solid var(--line); border-radius:8px; overflow:hidden; }
  .seg button { flex:1; border:none; background:#fff; padding:6px; font-size:13px; cursor:pointer; color:var(--ink); }
  .seg button[aria-pressed="true"] { background:var(--accent); color:var(--accent-ink); }
  .chips { display:flex; flex-wrap:wrap; gap:4px; margin:6px 0; }
  .chip { font-size:11px; padding:2px 8px; border-radius:999px; border:1px solid var(--line); background:#fff; cursor:pointer; color:var(--ink); }
  .chip[aria-pressed="true"] { background:var(--accent); color:var(--accent-ink); border-color:var(--accent); }
  .occ-results { max-height:210px; overflow:auto; }
  .f-groups summary { cursor:pointer; font-size:12px; color:var(--accent); margin:6px 0; }
  .occ { display:block; width:100%; text-align:left; border:none; background:none; padding:5px 6px; font-size:13px; cursor:pointer; border-radius:6px; color:var(--ink); }
  .occ:hover, .occ:focus-visible { background:var(--accent-soft); } .occ span { color:var(--muted); font-size:11px; }
  .occ-chosen { display:flex; gap:6px; flex-wrap:wrap; align-items:center; margin-bottom:6px; }
  .f-reset { margin-top:14px; } .f-na { margin-top:12px; font-size:12px; color:var(--muted); } .f-na ul { padding-left:16px; }
  .map-legend { font-size:12px; margin-bottom:8px; } .lg-title { font-weight:600; font-size:13px; }
  .lg-sw { display:flex; flex-wrap:wrap; gap:4px 14px; list-style:none; padding:0; margin:6px 0; }
  .sw { display:inline-block; width:16px; height:12px; border:1px solid #b8bec6; margin-right:6px; vertical-align:-2px; }
  .sw.hatch { background:repeating-linear-gradient(45deg, #eceef1 0 3px, #9aa1aa 3px 4.5px); }
  .lg-note { color:var(--muted); margin-top:3px; }
  .map-canvas { position:relative; background:var(--panel); border:1px solid var(--line); border-radius:10px; padding:6px; }
  .map-canvas svg { width:100%; height:auto; display:block; }
  .map-canvas svg:focus-visible { outline:2px solid var(--accent); outline-offset:2px; }
  .area { stroke:#fff; stroke-width:.6; cursor:pointer; }
  svg.geo-msa .area { stroke:#fff; stroke-width:.3; } .dot { stroke:#1a1d21; stroke-width:.8; }
  .mesh { stroke:#fff; stroke-width:1.1; pointer-events:none; } svg.geo-msa .mesh { stroke:#8f979f; stroke-width:.6; } svg.geo-msa .nation { stroke:#8f979f; stroke-width:.6; }
  .nation { pointer-events:none; }
  .hl path, .hl circle { fill:none; stroke:#1a1d21; stroke-width:2; pointer-events:none; }
  .hl .sel { stroke:var(--accent); stroke-width:2.5; }
  .map-tip { position:absolute; z-index:5; pointer-events:none; background:#fff; border:1px solid var(--line); border-radius:8px;
             box-shadow:0 4px 14px rgba(16,24,40,.12); padding:8px 10px; font-size:12px; max-width:320px; line-height:1.45; }
  .map-tip b { font-size:13px; }
  .map-loading { position:absolute; top:10px; right:10px; display:flex; gap:6px; align-items:center; background:#fff; border:1px solid var(--line);
                 border-radius:6px; padding:4px 8px; font-size:12px; color:var(--muted); }
  .map-foot { font-size:12px; color:var(--muted); margin:10px 0 0; }
  .map-panel { display:block; gap:0; background:var(--panel); border:1px solid var(--line); border-radius:10px; padding:14px; font-size:13px; position:sticky; top:0;
               max-height:calc(100vh - 110px); overflow:auto; }
  .map-panel h3 { margin:0 28px 2px 0; font-size:16px; } .map-panel .close { position:absolute; right:8px; top:6px; border:none; background:none; font-size:20px; cursor:pointer; color:var(--muted); }
  .map-panel .p-actions { display:flex; gap:6px; flex-wrap:wrap; margin:10px 0; }
  .map-panel h4 { margin:14px 0 4px; font-size:13px; }
  .map-panel .news li { margin-bottom:4px; }
  .map-compare { display:flex; gap:10px; flex-wrap:wrap; margin-top:10px; }
  .map-compare:empty { display:none; }
  .cmp-card { flex:1 1 180px; border:1px solid var(--line); border-radius:10px; background:var(--panel); padding:8px 10px; font-size:12px; position:relative; }
  .cmp-card b { font-size:13px; display:block; margin-right:20px; } .cmp-card .v { font-size:18px; font-weight:600; }
  .cmp-card .x { position:absolute; right:6px; top:4px; border:none; background:none; cursor:pointer; color:var(--muted); font-size:16px; }
  @media (max-width: 760px) {
    #mapview { padding:10px; }
    .map-body, .map-body.with-panel { grid-template-columns:minmax(0, 1fr); }
    .map-main { order:1; } .map-panel { order:2; position:static; max-height:none; } .map-rail { order:3; }
    .map-rail > summary { display:block; cursor:pointer; font-weight:600; padding:8px 0; }
    .map-tip { position:static; max-width:none; margin-top:6px; box-shadow:none; }
  }

  /* Sign-in gate and user admin (D66) */
  body.gated > aside, body.gated > main { display:none; }
  body.gated { display:block; }
  #gate { min-height:100vh; display:grid; place-items:center; padding:16px; }
  #gate[hidden] { display:none; }
  .gate-card { background:var(--panel); border:1px solid var(--line); border-radius:14px; padding:28px 30px; max-width:440px; width:100%; text-align:center; }
  .gate-card h1 { margin:0 0 8px; font-size:26px; }
  .btn-google { display:inline-block; margin:10px 0 6px; padding:10px 18px; border-radius:8px; background:var(--accent); color:var(--accent-ink);
                text-decoration:none; font-weight:600; }
  .btn-google:hover { filter:brightness(1.1); }
  dialog#users-dlg { border:1px solid var(--line); border-radius:12px; padding:18px 20px; width:min(760px, 94vw); color:var(--ink); }
  dialog#users-dlg::backdrop { background:rgba(0,0,0,.3); }
  dialog#users-dlg h2 { margin:0 0 10px; font-size:18px; }
  table.users { border-collapse:collapse; width:100%; font-size:13px; }
  table.users th, table.users td { border-bottom:1px solid var(--line); padding:6px 8px; text-align:left; vertical-align:top; }
