:root {
  --navy: #00356b; --navy-2: #286dc0; --ink: #1d2433; --ink-2: #4a5468; --muted: #6b7486;
  --line: #e3e7ee; --bg: #ffffff; --soft: #f4f6fa; --soft-2: #eef2f8;
  --good: #1a7f37; --good-bg: #e8f5ec; --partial: #a15c00; --partial-bg: #fff4e0;
  --poor: #b42318; --poor-bg: #fdecea; --unknown: #6b7486; --unknown-bg: #f1f3f6;
  --yale: #1f3a68; --yale-bg: #e7eef9;
  --shadow: 0 2px 6px rgba(20, 30, 50, .12), 0 8px 24px rgba(20, 30, 50, .10);
  --canvas: #edf1f6; --card-line: #d9e0ea; --card-line-2: #c3cfdf; --well: #f3f6fa;
  --lift-1: 0 1px 2px rgba(0, 38, 84, .07), 0 2px 8px rgba(0, 38, 84, .05);
  --lift-2: 0 2px 4px rgba(0, 38, 84, .07), 0 10px 28px rgba(0, 38, 84, .14);
  --r: 12px; --panel-w: clamp(440px, 34vw, 560px); --hist-w: 244px; --col: 780px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; font-family: var(--font); color: var(--ink); background: #e9edf2; font-size: 14px; }
html, body { overscroll-behavior-y: none; } /* phones: a downward swipe never reloads the page (pull to refresh) */
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; }
a { color: var(--navy-2); }
.muted { color: var(--muted); }
/* keyboard users see where they are; mouse clicks do not draw rings */
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible {
  outline: 2px solid var(--navy-2); outline-offset: 2px; border-radius: 6px; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
.small { font-size: 12px; }
.refine-toggle { display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--line); border-radius: 20px; background: var(--soft); padding: 4px 8px; font-size: 12px; white-space: nowrap; }
.refine-toggle i { display: inline-block; width: 23px; height: 13px; border-radius: 9px; background: var(--muted); position: relative; }
.refine-toggle i::after { content: ''; position: absolute; width: 9px; height: 9px; top: 2px; left: 2px; border-radius: 50%; background: white; }
.refine-toggle[aria-pressed=true] i { background: var(--navy); }
.refine-toggle[aria-pressed=true] i::after { left: 12px; }
.refine-directions { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; margin: 10px 0 5px; font-size: 11.5px; color: var(--muted); }
.refine-chip { border: 1px solid var(--card-line); border-radius: 16px; padding: 4px 8px; background: transparent; font-size: 11.5px; color: var(--ink-2); }
.refine-chip:hover, .refine-chip[aria-pressed=true] { background: var(--soft-2); border-color: var(--navy-2); }
.refine-row.used { opacity: .4; pointer-events: none; }
.refine-off .refine-row { display: none; }
.refine-card { border: 1px solid var(--card-line); border-radius: var(--r); padding: 14px; background: var(--bg); box-shadow: var(--lift-1); overflow-wrap: anywhere; }
.refine-heading { display: flex; flex-wrap: wrap; gap: 6px 12px; justify-content: space-between; }
.refine-from { color: var(--muted); font-size: 12px; line-height: 1.5; }
.refine-version { border-left: 3px solid var(--unknown); padding: 9px 0 9px 11px; margin: 14px 0; font-size: 12px; line-height: 1.5; }
.refine-version.ready { border-color: var(--good); }
.refine-version.partial { border-color: var(--partial); }
.refine-version.gaps { border-color: var(--poor); }
.refine-version p { margin: 5px 0; }
.refine-question { font-size: 13px; font-weight: 600; }
.refine-data { margin: 8px 0; }
.refine-data summary { cursor: pointer; }
.refine-version.ready summary { color: var(--good); }
.refine-version.partial summary { color: var(--partial); }
.refine-version.gaps summary { color: var(--poor); }
.refine-data .badge { margin: 2px; }
.refine-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.refine-actions .btn { font-size: 11.5px; padding: 5px 8px; }
.refine-foot { border-top: 1px solid var(--line); padding-top: 10px; line-height: 1.5; margin-bottom: 0; }
.refine-status { display: flex; align-items: center; gap: 8px; margin: 12px 0; padding: 7px 11px; border-radius: 8px;
  background: var(--soft); color: var(--ink-2); font-size: 12.5px; }
.refine-status .st { width: 12px; height: 12px; flex: none; border-radius: 50%; border: 2px solid var(--navy-2);
  border-right-color: transparent; animation: spin .8s linear infinite; }
.refine-status .secs { margin-left: auto; color: var(--muted); font-variant-numeric: tabular-nums; }
.refine-version.checking summary::after { content: ''; display: inline-block; width: 9px; height: 9px; margin-left: 7px;
  vertical-align: -1px; border-radius: 50%; border: 2px solid var(--muted); border-right-color: transparent;
  animation: spin .8s linear infinite; }
.refined-tag { display: block; font-size: 10px; opacity: .75; margin-bottom: 4px; }
.rough-examples .example { text-align: left; font-size: 12px; }
.welcome-tour { margin-top: 12px; font-size: 12px; }
.tour { width: min(520px, calc(100vw - 28px)); max-height: calc(100dvh - 28px); padding: 0; overflow-y: auto; }
.tour .dlg-head { gap: 12px; justify-content: space-between; }
.tour .dlg-head b { font-size: 16px; }
.tour-picture { border: 1px solid var(--card-line); background: var(--soft); padding: 14px; border-radius: var(--r); min-height: 132px; font-size: 13px;
  display: flex; flex-direction: column; justify-content: center; gap: 10px; }
.tour-ask { border: 1px solid var(--line); background: #fff; border-radius: var(--r); padding: 10px 10px 8px 12px; box-shadow: var(--lift-1); }
.tour-q { font-size: 14px; color: var(--ink); padding-bottom: 8px; }
.tour-bar { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.tour-bar .grow { flex: 1; }
.tour-bar .send { width: 26px; height: 26px; }
.tour-clip { color: var(--ink-2); display: grid; place-items: center; }
.tour-link { color: var(--navy-2); text-decoration: underline; }
.tour-picture .refine-version { margin: 0; background: #fff; border-radius: 0 8px 8px 0; padding: 8px 10px; }
.tour-picture .refine-question { font-weight: 600; }
.tour-status { margin: 4px 0 0; font-size: 12px; }
.tour-picture .refine-version.ready .tour-status { color: var(--good); }
.tour-picture .refine-version.partial .tour-status { color: var(--partial); }
.tour-picture .refine-actions { margin-top: 8px; }
.tour-answer { margin: 0; font-size: 13px; line-height: 1.45; }
.tour-picture .strip { display: flex; gap: 6px; flex-wrap: wrap; }
.tour-picture .refine-directions { margin: 0; }
.tour-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 0 18px 18px; }
.tour-controls button { font-size: 12px; }
.refine-version.chosen { background: var(--good-bg); outline: 1px solid var(--good); border-radius: 4px; }
@media (max-width: 720px) {
  .ask-bar .refine-toggle { padding: 3px 5px; font-size: 11px; gap: 4px; }
  #refineFirst { font-size: 11px; white-space: nowrap; padding: 3px; }
  .refine-card { padding: 11px; }
  .tour-picture { padding: 11px; min-height: 0; }
  .tour-controls { gap: 6px; }
  .tour .dlg-body { padding: 14px; }
}

/* Desktop: the map starts right of the chat panel, so nothing hides behind it and zooms center in the visible part. */
#map { position: fixed; top: 0; right: 0; bottom: 0; left: calc(var(--panel-w) + 24px); }
body.collapsed #map { left: 0; }
/* iframes are replaced elements: left+right do not stretch them, so the width is explicit */
#geolibre { position: fixed; top: 0; bottom: 0; left: calc(var(--panel-w) + 24px); width: calc(100vw - var(--panel-w) - 24px); height: 100vh; border: 0; background: #fff; z-index: 2; }
body.collapsed #geolibre { left: 0; width: 100vw; }
/* the border between the panel and the map: drag it, or focus it and use the arrow keys */
.panel-resizer { position: fixed; top: 12px; bottom: 12px; left: calc(var(--panel-w) + 12px); width: 12px; z-index: 6; cursor: col-resize;
  display: grid; place-items: center; touch-action: none; }
.panel-resizer i { width: 4px; height: 44px; border-radius: 3px; background: #b7c3d4; opacity: .55; transition: opacity .12s, background .12s, height .12s; }
.panel-resizer:hover i, .panel-resizer:focus-visible i, body.resizing .panel-resizer i { opacity: 1; background: var(--navy-2); height: 64px; }
.panel-resizer:focus-visible { outline: none; }
body.resizing, body.resizing * { cursor: col-resize !important; user-select: none !important; }
body.resizing #geolibre, body.resizing #map { pointer-events: none; }
body.collapsed .panel-resizer { display: none; }

/* ---------- floating panel (Google Maps style) ---------- */
.panel { position: fixed; top: 12px; left: 12px; bottom: 12px; width: var(--panel-w); z-index: 5; display: flex; flex-direction: column;
  background: var(--bg); border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden; }
body.collapsed .panel { bottom: auto; }
body.collapsed .tabs, body.collapsed .tabbody, body.collapsed .hist { display: none !important; }
.sheet-grip { display: none; } /* phones: the handle at the top of the chat sheet */
.brand-logo { height: 30px; width: auto; }
.brand-logo + .logo { display: none; }
body.wide { --panel-w: min(1100px, 64vw); } /* the large chat still leaves at least a third of the screen for the map */
#btnWide[aria-pressed="true"] { background: var(--soft-2); color: var(--navy); }
.stepper { display: flex; list-style: none; margin: 0; padding: 6px 12px; gap: 4px; border-bottom: 1px solid var(--line); background: #fbfcfe; }
.stepper li { flex: 1; display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--muted); cursor: pointer; padding: 3px 4px; border-radius: 6px; }
.stepper li:hover { background: var(--soft); }
.stepper li b { width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; background: var(--soft-2); color: var(--muted); }
.stepper li.active b { background: #fff; border: 2px solid var(--navy-2); color: var(--navy-2); }
.stepper li.active { color: var(--navy-2); font-weight: 600; }
.stepper li.done b { background: var(--navy); color: #fff; }
.stepper li.done { color: var(--ink); }
body.collapsed .stepper { display: none; }
.choices { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 2px; }
.choices button { border: 1px solid var(--navy-2); color: var(--navy-2); background: #fff; border-radius: 16px; padding: 5px 11px; font-size: 12.5px; text-align: left; }
.choices button:hover { background: var(--navy-2); color: #fff; }
.choices.used button { opacity: .45; pointer-events: none; }
#matrix:not(:empty) { background: #fff; border: 1px solid var(--card-line); border-radius: 12px; box-shadow: var(--lift-1); overflow: hidden; margin-bottom: 10px; }
.matrix { width: 100%; border-collapse: collapse; font-size: 12px; margin: 0; }
.matrix th { text-align: center; color: var(--ink-2); font-weight: 600; padding: 7px 4px 6px; background: var(--well); border-bottom: 1px solid var(--card-line); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.matrix th:first-child { text-align: left; }
.matrix td { padding: 6px 2px; border-bottom: 1px solid #edf0f5; text-align: center; }
.matrix th:first-child, .matrix td:first-child { padding-left: 12px; }
.matrix th:last-child, .matrix td:last-child { padding-right: 8px; }
.matrix tbody tr:last-child td { border-bottom: 0; }
.matrix tbody tr:hover td { background: #f7f9fc; }
.matrix td:first-child { text-align: left; max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; color: var(--navy-2); }
.matrix .fitdot { display: inline-block; }
.tb { margin: 4px 0 2px; position: relative; padding-top: 15px; }
.timebar { display: block; width: 100%; height: 16px; }
.tb-l { position: relative; height: 14px; font-size: 10.5px; color: var(--muted); margin-top: 1px; }
.tb-l span { position: absolute; top: 0; white-space: nowrap; }
.tb-w { position: absolute; top: 0; font-size: 10.5px; color: var(--navy); font-weight: 600; white-space: nowrap; }
.themes { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; margin: 0 0 8px; }
.themes button { border: 0; background: var(--soft-2); border-radius: 12px; padding: 2px 9px; font-size: 12px; color: var(--ink-2); }
.themes button:hover { background: var(--navy-2); color: #fff; }
/* ---------- concise layout (v2) ---------- */
.sec-h { font-size: 13.5px; margin: 18px 0 8px; color: var(--ink); font-weight: 700; }
.demo-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
body.wide .demo-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } /* minmax(0, ...): one-line labels must not widen a column */
.more-demos { margin-top: 8px; }
.more-demos summary { cursor: pointer; font-size: 12.5px; color: var(--navy-2); margin-bottom: 6px; }
.demo-find { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; margin: 2px 0 8px; }
.demo-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.demo-chips button { border: 1px solid var(--card-line); background: #fff; border-radius: 12px; padding: 2px 10px; font-size: 12px; color: var(--ink-2); }
.demo-chips button:hover { border-color: var(--navy-2); color: var(--navy); }
.demo-chips button[aria-pressed="true"] { background: var(--navy); border-color: var(--navy); color: #fff; }
#demoQ { flex: 1 1 180px; min-width: 0; border: 1px solid var(--card-line); border-radius: 8px; padding: 4px 9px; font: inherit; font-size: 12.5px; background: #fff; }
#demoQ:focus { border-color: var(--navy-2); outline: 2px solid rgba(40, 80, 140, .18); outline-offset: 0; }
.demo-card[hidden] { display: none; }
.demo-none { font-size: 12.5px; color: var(--muted); margin: 4px 0; }
.demo-head .based { font-size: 12px; color: var(--ink-2); margin-top: 3px; }
.demo-card { min-width: 0; text-align: left; border: 1px solid var(--card-line); border-left: 3px solid var(--navy); background: #fff; border-radius: 9px; padding: 8px 10px; min-height: 52px; box-shadow: var(--lift-1); }
.demo-card { transition: transform .12s ease, box-shadow .12s ease, background .12s ease; }
.demo-card:hover { background: #fff; border-color: var(--navy-2); transform: translateY(-1px); box-shadow: 0 4px 14px rgba(20, 30, 50, .09); }
.demo-card .field { font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--navy-2); font-weight: 700;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } /* one line; the full program name is in the tooltip */
.demo-card .title { font-weight: 600; font-size: 13px; margin-top: 1px; line-height: 1.25; }
.examples { flex-direction: row !important; flex-wrap: wrap; gap: 6px !important; }
.example { border-radius: 16px !important; padding: 5px 11px !important; font-size: 12.5px; }
.tabs button.done::after { content: " \2713"; color: var(--good); font-weight: 700; }
.act { margin: 0 0 6px; font-size: 12px; color: var(--muted); }
.act summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px 3px 7px; border-radius: 12px; background: var(--soft); }
.act summary::-webkit-details-marker { display: none; }
.act .st { width: 11px; height: 11px; border-radius: 50%; flex: none; }
.act .st.run { border: 2px solid var(--navy-2); border-right-color: transparent; animation: spin .8s linear infinite; }
.act .st.ok { background: var(--good); mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3 8.5l3 3 7-7' stroke='black' stroke-width='2.6' fill='none'/%3E%3C/svg%3E") center/contain no-repeat; }
.act .lbl { color: var(--ink-2); }
.steps { margin: 6px 0 2px 8px; border-left: 2px solid var(--line); padding-left: 10px; }
.stp { padding: 2px 0; color: var(--ink-2); }
.stp.error { color: var(--partial); }
.stp .sum { color: var(--muted); }
.stp ul { margin: 2px 0 4px; padding-left: 16px; }
.strip { display: flex; flex-wrap: wrap; gap: 5px; margin: 2px 0 8px; }
.rpill { display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--line); background: #fff; border-radius: 14px; padding: 3px 10px 3px 8px; font-size: 12px; color: var(--ink-2); }
.rpill:hover { border-color: var(--navy-2); background: var(--soft); }
.rpill b { color: var(--navy); font-weight: 600; }
.rpill .thumb-svg { width: 22px; height: 16px; border-radius: 3px; }
.tail .cites details summary { cursor: pointer; font-size: 11.5px; color: var(--muted); }
.tail .cites a { display: block; font-size: 11.5px; margin: 2px 0 0 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dcard { padding: 8px 10px; margin-bottom: 6px; cursor: pointer; }
.dcard .t { font-size: 13.5px; align-items: center; }
.dcard .t .tt { flex: 1; min-width: 0; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; line-height: 1.3; }
.dcard.open .t .tt { display: block; } /* an open card shows the whole name */
.dcard .chev { color: var(--muted); transition: transform .15s; }
.dcard.open .chev { transform: rotate(90deg); }
.dcard .src { margin: 2px 0 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dcard .one { font-size: 13px; color: var(--ink-2); }
.dcard .one.poor { color: var(--poor); } .dcard .one.partial { color: var(--partial); } .dcard .one.good { color: var(--good); }
.dcard .more { cursor: default; }
.dcard .well { margin: 10px -4px 0; padding: 9px 12px 11px; background: var(--well); border-radius: 10px; box-shadow: inset 0 1px 3px rgba(0, 38, 84, .08); }
.dcard .well > :first-child { margin-top: 0; }
.dcard .well:not(:has(*)) { display: none; }
.mlist { margin: 0; padding-left: 18px; font-size: 12.5px; line-height: 1.5; }
#methods .mlist { background: #fff; border: 1px solid var(--card-line); border-radius: 12px; box-shadow: var(--lift-1); padding: 10px 14px 10px 32px; }
#methods .mlist li + li { margin-top: 3px; }
.tab { overflow-x: hidden; }
.matrix { table-layout: fixed; }
.matrix th:first-child, .matrix td:first-child { width: 44%; }
.dcard .one.unknown { color: var(--ink-2); }
.data-foot { display: flex; gap: 6px; flex-wrap: wrap; margin: 14px 0 4px; }
/* the Yes or No under an answer */
.fb { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 10px; font-size: 12px; color: var(--muted); }
.fb button { font-size: 12px; padding: 2px 10px; border-radius: 12px; border: 1px solid var(--line); background: #fff; color: var(--ink-2); }
.fb button:hover { border-color: var(--navy-2); color: var(--navy); }
.fb input { font: inherit; font-size: 12px; padding: 3px 8px; border: 1px solid var(--line); border-radius: 8px; min-width: 220px; }
.welcome-foot { margin-top: 20px; }
.demo-note { font-size: 12px; padding: 5px 9px; }
.demo-card .who { font-size: 12px; color: var(--ink-2); line-height: 1.4; }
.demo-card .shows { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.demo-card .shows span { font-size: 11px; background: var(--soft-2); border-radius: 8px; padding: 1px 7px; color: var(--ink-2); }
.demo-head { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: linear-gradient(180deg, #f3f7fd, #fff); }
.demo-head .field { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--navy-2); font-weight: 700; }
.demo-head h3 { margin: 2px 0 4px; font-size: 15px; }
.demo-head .who { font-size: 12.5px; color: var(--ink-2); line-height: 1.45; }
.demo-head ul { margin: 6px 0 0; padding-left: 18px; font-size: 12.5px; }
.demo-ctl { display: flex; gap: 12px; align-items: center; margin-top: 6px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.demo-ctl select { font: inherit; color: var(--ink-2); padding: 1px 4px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.demo-ctl .linkbtn { color: var(--ink-2); }
.demo-note { border-left: 3px solid #d4a017; background: #fffaeb; border-radius: 6px; padding: 7px 10px; font-size: 12.5px; line-height: 1.45; color: #5c4400; }
.demo-note b { color: #8a6500; }
.demo-end { border: 1px dashed var(--navy-2); border-radius: 10px; padding: 9px 11px; font-size: 13px; color: var(--navy); background: #f6f9fe; }
.brand { display: flex; align-items: center; gap: 10px; padding: 10px 12px 6px 14px; }
.logo { width: 30px; height: 30px; border-radius: 8px; background: var(--navy); color: #fff; display: grid; place-items: center; font-weight: 700; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; flex: 1; }
.brand-text b { font-size: 16px; }
.brand-text span { font-size: 12px; color: var(--muted); }
.icon-btn { border: 0; background: transparent; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; color: var(--ink-2); }
.icon-btn:hover { background: var(--soft); }
body.collapsed #btnCollapse svg { transform: rotate(180deg); }

.ask { display: flex; flex-direction: column; gap: 2px; width: calc(100% - 24px); max-width: var(--col); margin: 6px auto 12px; padding: 8px 8px 6px 14px;
  border: 1px solid var(--line); border-radius: 22px; background: #fff; box-shadow: 0 2px 10px rgba(20,30,50,.08); flex: none; position: relative; }
/* a short note just above the control it is about (the Refine switch), with an arrow pointing down at it */
.near-tip { position: absolute; bottom: calc(100% + 9px); box-sizing: border-box; background: #1d2433; color: #fff; padding: 8px 12px;
  border-radius: 8px; font-size: 12.5px; line-height: 1.4; box-shadow: var(--shadow); z-index: 6; pointer-events: none; --arrow: 24px; }
.near-tip::after { content: ''; position: absolute; top: 100%; left: var(--arrow); margin-left: -6px; border: 6px solid transparent; border-top-color: #1d2433; }
/* the Catalog tab while a page of cards is on its way */
#catMeta.loading::before, .cat-more.loading::before { content: ''; display: inline-block; width: 10px; height: 10px; margin-right: 7px; vertical-align: -1px;
  border: 2px solid var(--line); border-top-color: var(--navy-2); border-radius: 50%; animation: spin .8s linear infinite; }
.cat-more { display: block; margin: 6px auto 14px; padding: 6px 16px; border: 1px solid var(--line); border-radius: 18px; background: #fff; color: var(--navy-2); font-size: 12.5px; cursor: pointer; }
.cat-more:disabled { cursor: default; color: var(--muted); }
.ask:focus-within { border-color: var(--navy-2); box-shadow: 0 0 0 3px rgba(43,79,138,.13), 0 2px 10px rgba(20,30,50,.08); }
.ask textarea { border: 0; outline: 0; resize: none; font: inherit; font-size: 15px; padding: 4px 2px; min-height: 52px; max-height: 220px; line-height: 1.45; background: transparent; }
.ask-bar { display: flex; align-items: center; gap: 4px; margin-left: -8px; }
.ask-bar .grow { flex: 1; }
.send { border: 0; width: 34px; height: 34px; border-radius: 50%; background: var(--navy); color: #fff; display: grid; place-items: center; flex: none; }
.send:disabled { background: #9aa6ba; cursor: default; }
.attach-info { width: calc(100% - 32px); max-width: var(--col); margin: 4px auto 0; font-size: 12px; color: var(--ink-2); display: flex; gap: 8px; align-items: center; }
.attach-info button { border: 0; background: none; color: var(--poor); padding: 0; }

.tabs { display: flex; overflow-x: auto; border-bottom: 1px solid var(--line); padding: 0 8px; background: #fff; position: relative; z-index: 1; box-shadow: 0 2px 6px rgba(0, 38, 84, .05); }
.tabs button { flex-shrink: 0; white-space: nowrap; }
.study-card, .studies-data { border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; margin: 10px 0; overflow-wrap: anywhere; background: #fff; }
.study-card h3, .studies-data h3 { font-size: 15px; margin: 0 0 6px; }
.study-card p { margin: 4px 0; }
.study-card dl { display: grid; grid-template-columns: max-content 1fr; gap: 3px 12px; margin: 8px 0 0; font-size: 13px; }
.study-card dt { font-weight: 600; color: var(--ink-2); }
.study-card dd { margin: 0; line-height: 1.45; }
#studiesStatus { padding-top: 10px; }
.studies-intro { border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; margin: 10px 0; background: #fff; }
.studies-intro p { margin: 0 0 8px; line-height: 1.5; }
.tabs button { border: 0; background: none; padding: 10px 12px 9px; color: var(--ink-2); border-bottom: 2px solid transparent; font-weight: 500; }
.tabs button.on { color: var(--navy); border-bottom-color: var(--navy); }
.count { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 9px; background: var(--navy); color: #fff; font-size: 11px; line-height: 18px; text-align: center; }
.tabbody { flex: 1; min-height: 0; position: relative; }
.tab { position: absolute; inset: 0; overflow-y: auto; padding: 14px 16px 22px; display: none; background: var(--canvas); }
#tab-chat { background: var(--bg); } /* chat is for reading; the card tabs sit on the canvas */
.tab.on { display: block; }
.empty { color: var(--muted); padding: 28px 8px; text-align: center; line-height: 1.5; }

/* ---------- welcome ---------- */
.welcome h2 { font-size: 20px; margin: 4px 0 4px; letter-spacing: -.01em; }
body.wide .welcome h2 { font-size: 24px; }
.how { display: grid; grid-template-columns: repeat(2, 1fr); gap: 7px; margin: 14px 0 4px; }
body.wide .how { grid-template-columns: repeat(4, 1fr); }
.how-s { display: grid; grid-template-columns: 20px 1fr; column-gap: 7px; align-items: center; padding: 8px 10px; border-radius: 10px;
  background: var(--soft); font-size: 11.5px; color: var(--ink-2); line-height: 1.3; }
.how-s svg { width: 18px; height: 18px; color: var(--navy-2); grid-row: span 2; }
.how-s b { color: var(--ink); font-size: 12.5px; }
.welcome p { line-height: 1.5; color: var(--ink-2); margin: 6px 0; }
.examples { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.example { text-align: left; border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 9px 11px; line-height: 1.4; }
.example:hover { border-color: var(--navy-2); background: var(--soft); }
.example b { display: block; font-size: 12px; color: var(--muted); font-weight: 600; margin-bottom: 2px; }
.tri { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12px; color: var(--ink-2); margin: 4px 0 10px; }
.tri span { background: var(--soft-2); border-radius: 12px; padding: 3px 9px; }
.tri span.on { background: var(--navy); color: #fff; }
.tri i { width: 12px; height: 1px; background: var(--muted); position: relative; }
.tri i::after { content: ""; position: absolute; right: -1px; top: -3px; border: 3.5px solid transparent; border-left: 5px solid var(--muted); }

/* ---------- chat ---------- */
.msgs { display: flex; flex-direction: column; gap: 12px; }
.msg.user { align-self: flex-end; max-width: 82%; background: var(--soft-2); color: var(--ink); padding: 9px 14px; border-radius: 18px; line-height: 1.5; white-space: pre-wrap; font-size: 14.5px; }
.msg.bot { align-self: stretch; }
.activity { display: flex; flex-direction: column; gap: 4px; margin-bottom: 8px; }
.chip { display: flex; align-items: flex-start; gap: 8px; font-size: 12.5px; color: var(--ink-2); background: var(--soft); border-radius: 8px; padding: 6px 9px; }
.chip .st { width: 14px; height: 14px; flex: none; margin-top: 1px; border-radius: 50%; }
.chip.start .st { border: 2px solid var(--navy-2); border-right-color: transparent; animation: spin .8s linear infinite; }
.chip.done .st { background: var(--good); mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3 8.5l3 3 7-7' stroke='black' stroke-width='2.4' fill='none'/%3E%3C/svg%3E") center/contain no-repeat; }
.chip.error .st { background: var(--partial); mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Ccircle cx='8' cy='8' r='7'/%3E%3C/svg%3E") center/contain no-repeat; }
.chip .tx { flex: 1; min-width: 0; }
.chip .sum { color: var(--muted); }
.chip details { margin-top: 3px; }
.chip summary { cursor: pointer; color: var(--navy-2); }
.chip ul { margin: 4px 0 0; padding-left: 16px; }
.chip li { margin: 2px 0; }
@keyframes spin { to { transform: rotate(360deg); } }
.thinking { display: inline-flex; gap: 4px; padding: 6px 2px; }
.thinking i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite; }
.thinking i:nth-child(2) { animation-delay: .2s; } .thinking i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }

.md { line-height: 1.6; font-size: 14.5px; }
.md p { margin: 6px 0; }
.md ul, .md ol { margin: 6px 0; padding-left: 20px; }
.md li { margin: 3px 0; }
.md code { background: var(--soft); padding: 1px 4px; border-radius: 4px; font-size: 12.5px; }
.md pre { background: #0f1b2d; color: #e6edf6; padding: 10px; border-radius: 8px; overflow-x: auto; font-size: 12px; }
.md pre code { background: none; padding: 0; color: inherit; }
.md h1, .md h2, .md h3 { font-size: 15px; margin: 12px 0 4px; }
.md table { border-collapse: collapse; font-size: 12px; }
.md td, .md th { border: 1px solid var(--line); padding: 3px 6px; }
.cites { margin-top: 6px; font-size: 12px; color: var(--muted); }
.cites a { margin-right: 8px; }
.meta-line { font-size: 11px; color: var(--muted); margin-top: 6px; }

/* inline cards in chat (ChatGPT-style visual results) */
.inline-card { border: 1px solid var(--card-line); border-radius: 12px; padding: 10px 12px; margin: 6px 0; background: #fff; display: flex; gap: 10px; align-items: center; box-shadow: var(--lift-1); }
.inline-card .ic-body { flex: 1; min-width: 0; }
.inline-card .ic-title { font-weight: 600; font-size: 13px; }
.inline-card .ic-sub { font-size: 12px; color: var(--muted); }
.inline-card button, .btn { border: 1px solid var(--card-line); background: #fff; border-radius: 16px; padding: 4px 11px; font-size: 12px; color: var(--navy); text-decoration: none; display: inline-block;
  box-shadow: 0 1px 1px rgba(0, 38, 84, .06); }
.inline-card button:hover, .btn:hover { background: var(--soft); }
.btn.primary { background: var(--navy); color: #fff; border-color: var(--navy); }
.btn.ghost { color: var(--navy-2); }
.thumb-svg { width: 64px; height: 48px; flex: none; border-radius: 6px; background: var(--soft-2); }
.mini-picks { margin: 4px 0 0; padding: 0; list-style: none; }
.mini-picks li { display: flex; gap: 6px; align-items: center; font-size: 12.5px; padding: 2px 0; }

/* ---------- fit badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 3px; border-radius: 10px; padding: 1px 7px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.badge.good { color: var(--good); background: var(--good-bg); }
.badge.partial { color: var(--partial); background: var(--partial-bg); }
.badge.poor { color: var(--poor); background: var(--poor-bg); }
.badge.unknown { color: var(--unknown); background: var(--unknown-bg); }
.badge.open { color: var(--good); background: var(--good-bg); }
.badge.yale { color: var(--yale); background: var(--yale-bg); }
.badge.request, .badge.paid { color: var(--partial); background: var(--partial-bg); }
.fitdot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.fitdot.good { background: var(--good); } .fitdot.partial { background: #d48a12; } .fitdot.poor { background: var(--poor); } .fitdot.unknown { background: #aab2c0; }

/* ---------- data cards ---------- */
.group-h { font-size: 13.5px; color: var(--ink); margin: 18px 2px 8px; font-weight: 700; display: flex; align-items: center; gap: 7px; }
.group-h .gcount { font-size: 11px; font-weight: 600; color: var(--ink-2); background: #fff; border: 1px solid var(--card-line); border-radius: 9px; padding: 0 6px; line-height: 17px; }
.dcard { border: 1px solid var(--card-line); border-radius: 12px; padding: 12px 14px; margin-bottom: 10px; background: #fff; box-shadow: var(--lift-1);
  transition: box-shadow .15s ease, border-color .15s ease; }
.dcard:hover { border-color: var(--card-line-2); }
.dcard.open { box-shadow: var(--lift-2); border-color: var(--card-line-2); }
.dcard.poorfit { background: #fbf8f8; border-color: #e9dddd; box-shadow: none; } /* poor fits recede */
.dcard.poorfit.open { box-shadow: var(--lift-1); }
.dcard .t { font-weight: 650; font-size: 14.5px; display: flex; gap: 7px; align-items: baseline; }
.dcard .t a { color: var(--ink); text-decoration: none; }
.dcard .t a:hover { text-decoration: underline; }
.dcard .src { font-size: 12px; color: var(--muted); margin: 2px 0 6px; }
.dcard .badges { display: flex; gap: 5px; flex-wrap: wrap; margin: 4px 0 6px; }
.dcard .why { font-size: 13px; line-height: 1.5; margin: 8px 0 0; color: var(--ink); }
.dcard .lim { font-size: 12.5px; color: #5c3d00; line-height: 1.45; background: var(--partial-bg); border-radius: 8px; padding: 7px 10px; margin-top: 9px; }
.dcard .lim b { color: var(--partial); }
.dcard .reasons { font-size: 12.5px; color: var(--ink-2); margin: 6px 0 0; padding-left: 17px; line-height: 1.5; }
.dcard .factors { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 9px; }
.dcard .factors span { font-size: 11.5px; background: #fff; border: 1px solid var(--card-line); border-radius: 9px; padding: 1px 8px; color: var(--ink-2); }
.dcard .row { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; align-items: center; }
.dcard .verified { font-size: 11px; color: var(--muted); margin-left: auto; }
.dcard .verified.warn { color: var(--poor); font-weight: 600; }
.dcard .yale-note { font-size: 12px; background: var(--yale-bg); color: var(--yale); border-radius: 8px; padding: 6px 10px; margin-top: 9px; }
.dcard img.tn { width: 100%; max-height: 120px; object-fit: cover; border-radius: 6px; margin-top: 6px; background: var(--soft); }
.mcard { border-left: 3px solid var(--navy-2); background: var(--soft); border-radius: 6px; padding: 7px 10px; margin-bottom: 7px; font-size: 13px; line-height: 1.45; }
.mcard b { display: block; }
.mcard .tools { font-size: 12px; color: var(--muted); }
.toggle { display: flex; gap: 6px; align-items: center; font-size: 12.5px; color: var(--ink-2); margin-bottom: 4px; }

/* ---------- frame ---------- */
/* Research Architect canvas: pure white with a faint indigo dot grid */
#graph { height: 380px; border: 1px solid var(--card-line); border-radius: 12px;
  background: radial-gradient(circle at 1px 1px, rgba(79, 70, 229, .07) 1px, transparent 0) 0 0 / 26px 26px, #ffffff;
  box-shadow: var(--lift-1); }
.ra-legend { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.graph-bar { display: flex; align-items: center; gap: 8px; margin: 0 0 6px; font-size: 12.5px; color: var(--muted, #64748b); }
.graph-bar select { border: 1px solid var(--line); border-radius: 8px; padding: 3px 6px; font: inherit; font-size: 12.5px; color: #0f172a; background: #fff; max-width: 260px; }
.graph-bar .btn { padding: 2px 10px; font-size: 12px; }
.ra-lg { background: rgba(255, 255, 255, .94); border: 1px solid #e5e7eb; border-radius: 9px; box-shadow: 0 1px 2px rgba(15, 23, 42, .06);
  padding: 6px 10px 7px; display: flex; flex-wrap: wrap; align-items: center; gap: 3px 11px; }
.ra-lt { flex: 0 0 100%; font-size: 9.6px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: #475569; }
.ra-li { display: inline-flex; align-items: center; gap: 6px; font-size: 11.4px; font-weight: 600; color: #334155; cursor: help; white-space: nowrap; }
.ra-li b { min-width: 18px; text-align: center; font-size: 9.6px; background: #f1f5f9; color: #475569; border-radius: 999px; padding: 0 5px; font-variant-numeric: tabular-nums; }
.ra-n { width: 14px; height: 14px; border-radius: 50%; background: #93c5fd; border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(100, 116, 139, .24); display: inline-block; flex: none; }
.ra-n.src { background: #6ee7b7; }
.ra-n.sink { background: #c4b5fd; border-color: #a78bfa; }
.ra-n.core { background: #fff; border-color: #334155; }
.ra-n.unc { background: rgba(147, 197, 253, .3); border: 1.5px dashed #94a3b8; box-shadow: none; }
.legend { display: flex; gap: 10px; flex-wrap: wrap; font-size: 11.5px; color: var(--ink-2); margin: 6px 2px 8px; }
.legend span { display: inline-flex; align-items: center; gap: 4px; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.dot.covered { background: #2e9e57; } .dot.partial { background: #e0a030; } .dot.uncovered { background: #cfd5df; } .dot.outcome { background: var(--navy); border-radius: 2px; transform: rotate(45deg); }
.ring { width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--ink); display: inline-block; }
.node-info { border: 1px solid var(--card-line); border-radius: 12px; padding: 10px 12px; margin: 10px 0; font-size: 13px; line-height: 1.45; background: #fff; box-shadow: var(--lift-1); }
.node-info h4 { margin: 0 0 4px; font-size: 14px; }
.graph-reading { border: 1px solid var(--card-line); border-radius: 12px; padding: 10px 12px; margin: 8px 0; background: #fff; font-size: 12px; line-height: 1.45; overflow-wrap: anywhere; }
.graph-reading p { margin: 0 0 5px; }
.graph-reading p:last-child { margin-bottom: 0; }
.graph-reading .btn { white-space: normal; text-align: left; padding: 4px 8px; font-size: inherit; }
.graph-reading a { display: block; margin-top: 4px; }
.scope-card { border: 1px solid var(--card-line); border-radius: 12px; padding: 12px 14px; margin: 10px 0; background: #fff; box-shadow: var(--lift-1); }
.scope-card h4 { margin: 0 0 6px; font-size: 14px; display: flex; justify-content: space-between; align-items: center; }
.scope-grid { display: grid; grid-template-columns: 96px 1fr; gap: 6px 8px; align-items: center; font-size: 13px; }
.scope-grid label { color: var(--muted); font-size: 12px; }
.scope-grid input { width: 100%; border: 1px solid var(--line); border-radius: 6px; padding: 4px 7px; font: inherit; font-size: 13px; }
.assumed { font-size: 10.5px; background: var(--partial-bg); color: var(--partial); border-radius: 6px; padding: 0 5px; margin-left: 4px; font-weight: 600; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }

/* ---------- catalog ---------- */
.cat-search input { width: 100%; border: 1px solid var(--card-line); border-radius: 20px; padding: 8px 14px; font: inherit; background: #fff; box-shadow: var(--lift-1); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0; }
.chips button { border: 1px solid var(--line); background: #fff; border-radius: 14px; padding: 3px 10px; font-size: 12px; }
.chips button.on { background: var(--navy); color: #fff; border-color: var(--navy); }
.ccard { background: #fff; border: 1px solid var(--card-line); border-radius: 12px; padding: 10px 13px; margin-bottom: 8px; box-shadow: var(--lift-1); }
.ccard .t { font-weight: 600; font-size: 13.5px; }
.ccard .src { font-size: 12px; color: var(--muted); }
.ccard .d { font-size: 12.5px; color: var(--ink-2); margin: 3px 0; line-height: 1.4; }
.ccard .row { display: flex; gap: 5px; flex-wrap: wrap; align-items: center; margin-top: 4px; }

/* ---------- top right, layers, dialogs ---------- */
.topright { position: fixed; top: 12px; right: 12px; z-index: 6; display: flex; gap: 8px; align-items: center; }
.pill, .seg { background: #fff; border-radius: 18px; box-shadow: var(--shadow); border: 0; }
.pill { padding: 7px 13px; }
.seg { display: inline-flex; padding: 3px; }
.seg button { border: 0; background: transparent; border-radius: 15px; padding: 4px 11px; color: var(--ink-2); }
.seg button.on { background: var(--navy); color: #fff; }
.seg.small { box-shadow: none; border: 1px solid var(--line); }
.seg.small button { padding: 2px 9px; font-size: 12px; }
.seg.basemap-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 3px; border-radius: 10px; }
.seg.basemap-grid button { min-height: 30px; padding: 4px 6px; border-radius: 7px; }
.gis-bar { display: flex; align-items: center; } /* sits in the top bar in Full GIS mode */
.gis-bar.tight { display: none; } /* steps aside when it would run into the chat panel (fitTopBar in app.js) */
.gis-bar .seg button { font-size: 12.5px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
body.gis #geolibre { top: 58px; height: calc(100vh - 58px); } /* nothing of Y-finder covers GeoLibre's own toolbar */
body.gis { background: #eef1f5; }
.layers-box { position: fixed; left: calc(var(--panel-w) + 24px); bottom: 26px; z-index: 4; }
.map-legend { position: fixed; right: 56px; bottom: 30px; z-index: 4; width: 230px; max-height: 46vh; overflow-y: auto; background: rgba(255,255,255,.96);
  border-radius: 12px; box-shadow: var(--shadow); font-size: 12px; }
.map-legend .ml-head { position: sticky; top: 0; display: flex; justify-content: space-between; align-items: center; width: 100%; border: 0; background: inherit;
  padding: 8px 12px 6px; cursor: pointer; font-size: 12.5px; color: var(--ink, #1d2433); }
.map-legend .ml-chev { transition: transform .15s; color: var(--muted); }
.map-legend.closed .ml-chev { transform: rotate(180deg); }
.map-legend.closed .ml-body { display: none; }
.map-legend .ml-body { padding: 0 12px 10px; }
.ml-i { padding: 6px 0; border-top: 1px solid var(--line); }
.ml-t { display: flex; flex-direction: column; margin-bottom: 4px; font-weight: 600; line-height: 1.25; }
.ml-t small { font-weight: 400; color: var(--muted); font-size: 11px; }
.ml-r { display: flex; align-items: center; gap: 7px; line-height: 1.45; }
.ml-r i { width: 16px; height: 11px; border-radius: 2px; flex: none; border: 1px solid rgba(0,0,0,.08); }
.ml-r i.dot { width: 10px; height: 10px; border-radius: 50%; margin: 0 3px; }
.ml-r i.line { height: 3px; border: 0; }
.ml-r .gl { width: 18px; height: 14px; }
.ml-i img { display: block; max-width: 100%; margin-top: 4px; }
body.collapsed .layers-box { left: 12px; }
.layers-btn { width: 62px; height: 62px; border-radius: 12px; border: 1px solid var(--line); background: #fff; color: var(--navy); box-shadow: var(--shadow);
  padding: 0; position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; cursor: pointer; }
.layers-btn:hover { background: var(--soft); }
.layers-btn.sat { background: #253f36; color: #fff; border-color: #39584a; }
.layers-btn.sat:hover { background: #304e43; }
.layers-btn svg { width: 27px; height: 27px; }
.layers-btn .lb-t { font-size: 11.5px; font-weight: 600; }
.layers-btn .lb-n { position: absolute; top: -7px; right: -7px; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 10px; background: var(--navy); color: #fff;
  font-size: 11px; font-weight: 600; display: grid; place-items: center; box-shadow: 0 0 0 2px #fff; }
.layer-panel { position: absolute; left: 0; bottom: 72px; width: 340px; max-height: 50vh; overflow-y: auto; background: #fff; border-radius: 12px; box-shadow: var(--shadow); padding: 10px 12px; }
.lp-head { display: flex; justify-content: space-between; align-items: center; margin: 4px 0 8px; }
.lp-head .lp-link { font-size: 11.5px; font-weight: 400; }
.tail .earth-note { margin-top: 8px; font-size: 12px; line-height: 1.45; }
.lrow { display: flex; align-items: flex-start; gap: 7px; padding: 6px 0; border-top: 1px solid var(--line); font-size: 12.5px; }
.gl { width: 20px; height: 16px; flex: none; display: inline-block; vertical-align: middle; overflow: visible; }
.lrow .gl { margin-top: 1px; }
.lrow .lgap { width: 25px; height: 25px; flex: none; }
.lrow .lmain { flex: 1; min-width: 0; }
.lrow .nm { line-height: 1.3; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; word-break: break-word; }
.lrow .ls { font-size: 11px; color: var(--muted); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lrow.off .nm, .lrow.off .ls, .lrow.off .gl { opacity: .45; }
.lrow .lact { display: flex; gap: 1px; flex: none; }
.lundo { display: flex; align-items: center; gap: 8px; padding: 6px 9px; margin: 2px 0 6px; border-radius: 8px; background: var(--soft); font-size: 12px; color: var(--ink-2); }
.lundo span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lremoved { border-top: 1px solid var(--line); padding-top: 6px; margin-top: 2px; font-size: 12px; }
.lremoved summary { cursor: pointer; color: var(--muted); padding: 2px 0; }
.lgone { display: flex; align-items: center; gap: 8px; padding: 4px 0; }
.lgone span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); }
.lgone .btn { font-size: 11.5px; padding: 3px 8px; flex: none; }
.lrow .lact button, .lrow .lact a { width: 25px; height: 25px; display: inline-grid; place-items: center; padding: 0; border: 0; border-radius: 6px; background: none; color: var(--navy-2); }
.lrow .lact button:hover, .lrow .lact a:hover { background: var(--soft); }
.lrow .lact svg { width: 15px; height: 15px; }
.lrow button { border: 0; background: none; color: var(--navy-2); font-size: 12px; padding: 0 3px; }
.lrow .tag { font-size: 10.5px; color: #8a5a00; background: #fff4dc; border-radius: 4px; padding: 0 4px; margin-left: 4px; white-space: nowrap; display: inline-block; line-height: 1.4; }
/* the layer glyph is the style button; the editor opens under its row */
.lrow .lsty { flex: none; width: 30px; height: 24px; margin-top: -3px; display: inline-grid; place-items: center; padding: 0;
  border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.lrow .lsty:hover, .lrow .lsty[aria-expanded="true"] { border-color: var(--navy-2); background: var(--soft); }
.lrow .lsty .gl { margin: 0; }
.lsty-ed { margin: -2px 0 8px; padding: 8px 10px; display: grid; gap: 7px; font-size: 12px; background: var(--well);
  border: 1px solid var(--card-line); border-radius: 8px; }
.lsty-ed .sr { display: grid; grid-template-columns: 66px 1fr; align-items: center; gap: 8px; }
.lsty-ed .k { color: var(--ink-2); }
.lsty-ed select { font: inherit; font-size: 12px; min-width: 0; max-width: 100%; border: 1px solid var(--line); border-radius: 6px; padding: 3px 4px; background: #fff; }
.lsty-ed .sw, .lsty-ed .ramps, .lsty-ed .cls { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; }
.lsty-ed .sw { gap: 3px; } /* eight swatches and the ring fit one line beside a scrollbar */
.lsty-ed .sw button { width: 18px; height: 18px; padding: 0; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--card-line-2); }
.lsty-ed .sw button.on, .lsty-ed .ramps button.on { box-shadow: 0 0 0 2px var(--navy); }
/* any colour: the picker sits in a rainbow ring, so it does not read as one more swatch */
.lsty-ed .any { width: 22px; height: 22px; flex: none; border-radius: 50%; padding: 3px; display: inline-grid;
  background: conic-gradient(#e4002b, #f7b500, #3cb043, #00a3e0, #5b2a86, #e4002b); }
.lsty-ed .any input { width: 100%; height: 100%; padding: 0; border: 2px solid #fff; border-radius: 50%; background: #fff; cursor: pointer; -webkit-appearance: none; appearance: none; }
.lsty-ed .any input::-webkit-color-swatch-wrapper { padding: 0; }
.lsty-ed .any input::-webkit-color-swatch { border: 0; border-radius: 50%; }
.lsty-ed .any input::-moz-color-swatch { border: 0; border-radius: 50%; }
.lsty-ed .ramps { flex-wrap: nowrap; }
.lsty-ed .ramps button { flex: 1 1 0; min-width: 0; height: 14px; padding: 0; border-radius: 3px; border: 1px solid rgba(0, 0, 0, .12); }
.lsty-ed .rng { display: flex; align-items: center; gap: 6px; min-width: 0; }
.lsty-ed input[type=range] { flex: 1; min-width: 0; accent-color: var(--navy-2); }
.lsty-ed output { width: 42px; text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }
.lsty-ed .note { color: var(--muted); font-size: 11px; line-height: 1.35; }
.lsty-ed .foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.lsty-ed .btn.small { padding: 2px 10px; font-size: 12px; }
.dl-form { display: flex; gap: 6px; margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--line); }
.dl-form input { flex: 1; min-width: 0; border: 1px solid var(--line); border-radius: 8px; padding: 5px 8px; font: inherit; font-size: 12.5px; }
.dl-note { font-size: 11px; margin-top: 4px; }
.dcard .pv { display: block; font-size: 12px; line-height: 1.5; margin-top: 5px; } /* one sentence with its buttons, not wrapped in pieces */
.dcard .pv .pv-dot, .dcard .pv .pv-globe { display: inline-block; vertical-align: 0; margin-right: 5px; }
.dcard .pv .pv-a { margin-left: 4px; }
.dcard .pv:empty { display: none; }
.pv-dot { width: 7px; height: 7px; border-radius: 50%; background: #cbd5e1; flex: none; }
.pv-globe { width: 13px; height: 13px; color: var(--navy-2); flex: none; }
.pv-step { font-style: italic; }
.pv-dot.ok { background: #16a34a; }
.pv-dot.run { background: #f59e0b; animation: pvblink 1s ease-in-out infinite; }
@keyframes pvblink { 50% { opacity: .35; } }
.tbl-badge { font-size: 10.5px; font-weight: 600; color: #6b4e16; background: #fbf1dc; border-radius: 4px; padding: 0 5px; margin-left: 6px; }
.pv-spark { flex-basis: 100%; margin-top: 4px; }
.pv-spark .pv-sl { font-size: 11.5px; color: var(--ink-2); margin-bottom: 1px; }
.pv-spark svg { width: 100%; max-width: 320px; height: 46px; display: block; }
.pv-tbl { flex-basis: 100%; overflow-x: auto; margin-top: 5px; border: 1px solid var(--line); border-radius: 6px; }
.pv-tbl table { border-collapse: collapse; font-size: 11.5px; white-space: nowrap; }
.pv-tbl th, .pv-tbl td { padding: 3px 7px; border-bottom: 1px solid var(--line); text-align: left; }
.pv-tbl th { background: var(--soft); font-weight: 600; }
.pv-a { border: 0; background: none; color: var(--navy-2); font-size: 12px; padding: 0 2px; cursor: pointer; text-decoration: underline; }
.dlg { border: 0; border-radius: 14px; box-shadow: var(--shadow); padding: 0; width: min(760px, 94vw); max-height: 86vh; }
.dlg::backdrop { background: rgba(15, 25, 45, .35); }
.dlg-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: #fff; }
.dlg-body { padding: 10px 18px 18px; overflow-y: auto; max-height: calc(86vh - 56px); }
.toast { position: fixed; top: 64px; left: 50%; transform: translateX(-50%); background: #1d2433; color: #fff; padding: 9px 14px; border-radius: 8px; z-index: 20; font-size: 13px; box-shadow: var(--shadow); max-width: 80vw; }
.maplibregl-popup-content { font-family: var(--font); font-size: 12px; max-height: 240px; overflow-y: auto; border-radius: 8px; background: #fff; color: var(--ink); }
.maplibregl-ctrl-attrib { color: #222; background: rgba(255,255,255,.96); }
.maplibregl-ctrl-attrib a { color: #333; }
.maplibregl-popup-content table { border-collapse: collapse; }
.maplibregl-popup-content td { padding: 1px 6px 1px 0; vertical-align: top; }
.maplibregl-popup-content td:first-child { color: var(--muted); }
.yf-pop .maplibregl-popup-content { padding: 10px 12px 8px; max-height: 280px; }
.pp-head { display: flex; align-items: center; gap: 6px; margin: 0 14px 6px 0; }
.pp-head .gl { width: 18px; height: 14px; }
.pp-head b { flex: 1; min-width: 0; line-height: 1.25; }
.pp-nav { display: inline-flex; align-items: center; gap: 2px; font-size: 11px; color: var(--muted); white-space: nowrap; }
.pp-nav button { border: 1px solid var(--line); background: #fff; border-radius: 6px; width: 20px; height: 20px; padding: 0; line-height: 1; color: var(--navy-2); cursor: pointer; }
.pp-nav button:hover { background: var(--soft); }
.maplibregl-ctrl-bottom-right { bottom: 8px; }


/* ---------- ChatGPT-style chat: sidebar of past conversations, centered message column, composer at the bottom ---------- */
.pbody { flex: 1; min-height: 0; display: flex; position: relative; }
.pmain { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.msgs { max-width: var(--col); margin: 0 auto; padding-bottom: 6px; }
.msgs .msg.bot, .msgs .demo-head, .msgs .demo-note, .msgs .demo-end { width: 100%; }
body.wide .welcome { max-width: var(--col); margin: 4vh auto 0; }
body.wide .md, body.wide .msg.user { font-size: 15px; }
body.wide #graph { height: 520px; }
.hist { position: absolute; top: 0; bottom: 0; left: 0; z-index: 4; width: min(290px, 86%); display: flex; flex-direction: column;
  background: #f7f9fc; border-right: 1px solid var(--line); box-shadow: 6px 0 20px rgba(20,30,50,.12);
  transform: translateX(-104%); visibility: hidden; transition: transform .18s ease, visibility 0s linear .18s; }
body.hist-open .hist { transform: none; visibility: visible; transition: transform .18s ease; }
body.wide .hist { position: relative; z-index: auto; width: var(--hist-w); flex: none; box-shadow: none; transform: none; transition: none; display: none; visibility: visible; }
body.wide.hist-open .hist { display: flex; }
#btnHist[aria-expanded="true"] { background: var(--soft-2); color: var(--navy); }
.hist-new { display: flex; align-items: center; gap: 8px; margin: 10px 10px 6px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; font-weight: 600; color: var(--navy); text-align: left; }
.hist-new:hover { border-color: var(--navy-2); background: var(--soft); }
.hist-list { flex: 1; min-height: 0; overflow-y: auto; padding: 0 6px 8px; }
.hist-grp { font-size: 12px; font-weight: 600; color: var(--muted); margin: 14px 9px 4px; }
.hitem { display: flex; align-items: center; border-radius: 8px; }
.hitem:hover { background: #e9eef6; }
.hitem.on { background: #fff; box-shadow: var(--lift-1); }
.hitem.on .ht { color: var(--navy); font-weight: 600; }
.hopen { flex: 1; min-width: 0; border: 0; background: none; text-align: left; padding: 6px 4px 6px 9px; }
.hopen .ht { display: block; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); }
.hopen .hm { display: block; font-size: 11px; color: var(--muted); }
.hdel { border: 0; background: none; color: var(--muted); width: 28px; height: 28px; border-radius: 6px; opacity: 0; flex: none; font-size: 16px; }
.hitem:hover .hdel, .hitem.on .hdel, .hdel:focus { opacity: 1; }
.hdel:hover { color: var(--poor); background: #fff; }
.hist-empty { padding: 14px 10px; line-height: 1.5; }
.hist-foot { font-size: 11px; color: var(--muted); padding: 8px 12px 10px; border-top: 1px solid var(--line); }
.linkbtn { border: 0; background: none; padding: 0; color: var(--navy-2); font-size: inherit; text-decoration: underline; }
.restored-note { align-self: center; font-size: 11.5px; color: var(--muted); }

/* ---------- phones: panel becomes a bottom sheet ---------- */
@media (max-width: 720px) {
  :root { --panel-w: 100vw; --sheet-h: 62vh; } /* app.js replaces --sheet-h with the sheet's measured height */
  body.wide { --panel-w: 100vw; } /* a window narrowed from the large chat */
  body.wide .demo-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #map, body.collapsed #map { left: 0; } /* phones: the chat is a bottom sheet over the map */
  /* Three heights, like a map app: folded (header and ask box), half (the default) and full (below the top bar).
     svh is the screen with the browser's toolbars showing, so the sheet always fits; vh is the fallback. */
  .panel { top: auto; left: 0; right: 0; bottom: 0; width: auto; height: 62vh; height: 62svh; border-radius: 14px 14px 0 0; }
  body.sheet-full:not(.collapsed) .panel { top: 56px; height: auto; }
  body.collapsed .panel { height: auto; top: auto; bottom: 0; } /* folded, the sheet stays at the bottom, clear of the top bar */
  body.sheet-full:not(.collapsed) :is(.layers-box, .map-legend, .xpill) { display: none !important; } /* nothing floats over the full sheet */
  #btnWide svg { transform: rotate(-45deg); } /* the arrows point up and down: a taller or shorter sheet */
  /* the sheet's header is its handle: a swipe up makes it taller, a swipe down shorter (app.js) */
  .sheet-grip { display: block; position: relative; height: 14px; flex: none; }
  .sheet-grip::before { content: ""; position: absolute; top: 5px; left: 50%; width: 36px; height: 4px; margin-left: -18px; border-radius: 2px; background: var(--card-line-2); }
  .brand { padding: 4px 6px 2px 8px; gap: 6px; }
  .brand-text span { display: none; } /* the subtitle: the banner and the name say enough on a small screen */
  .logo { width: 26px; height: 26px; border-radius: 7px; font-size: 13px; }
  .brand-logo { height: 26px; }
  /* the tabs stay on one line (the check marks wrapped below the names); on the narrowest screens they scroll sideways */
  .tabs { overflow-x: auto; scrollbar-width: none; padding: 0 4px; }
  .tabs::-webkit-scrollbar { display: none; }
  .tabs button { flex: none; white-space: nowrap; padding: 9px 9px 8px; }
  /* the ask box is one line, as in phone chat apps: attach, text, send */
  .ask { flex-direction: row; align-items: flex-end; gap: 2px; padding: 4px; margin: 4px auto 8px; border-radius: 24px; }
  .ask-bar { display: contents; }
  .ask-bar .grow { display: none; }
  #btnAttach { order: -1; }
  .ask .icon-btn, .ask .send { width: 36px; height: 36px; flex: none; }
  .ask textarea { flex: 1; min-width: 0; min-height: 36px; padding: 7px 4px; line-height: 1.4; }
  .topright { top: 8px; right: 8px; left: 8px; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
  /* things over the map sit just above the sheet, whatever its height (app.js measures it into --sheet-h): the scale bar
     at the left, the map credits at the right with the Layers button above them; pinching zooms, so no zoom buttons */
  .maplibregl-ctrl-bottom-left, .maplibregl-ctrl-bottom-right { bottom: var(--sheet-h, 62vh); }
  .maplibregl-ctrl-bottom-right .maplibregl-ctrl-group { display: none; }
  body.sheet-full:not(.collapsed) :is(.maplibregl-ctrl-bottom-left, .maplibregl-ctrl-bottom-right) { display: none; }
  .layers-box, body.collapsed .layers-box { left: auto; right: 10px; bottom: calc(var(--sheet-h, 62vh) + 40px); }
  .matrix { font-size: 11px; }
  .matrix th { font-size: 11px; padding-left: 2px; padding-right: 2px; }
  .matrix th:first-child, .matrix td:first-child { width: 34%; }
  .matrix th:last-child, .matrix td:last-child { width: 58px; } /* the access badge ("Open", "Yale") fits */
  .map-legend { right: auto; left: 8px; bottom: auto; top: 56px; width: min(200px, 55vw); max-height: 30vh; }
  body:has(#layerPanel:not([hidden])) .map-legend { display: none; } /* the open Layers panel takes that corner */
  .layers-btn { width: 54px; height: 54px; }
  .layer-panel { left: auto; right: 0; width: min(340px, 92vw); }
  /* the sheet is folded while Layers is open; the panel ends below the top bar */
  body.collapsed .layer-panel { max-height: calc(100vh - var(--sheet-h, 120px) - 180px); max-height: calc(100svh - var(--sheet-h, 120px) - 180px); }
  .lrow .lact button, .lrow .lact a { width: 32px; height: 32px; }
  .lrow .lsty { width: 36px; height: 32px; margin-top: -4px; }
  .lsty-ed .sw button { width: 26px; height: 26px; }
  .lsty-ed .any { width: 30px; height: 30px; }
  .lsty-ed .ramps button { height: 24px; }
  /* Full GIS: the sheet folds and GeoLibre fills the screen above it */
  #geolibre { left: 0; width: 100vw; top: 0; height: calc(100vh - var(--sheet-h, 62vh)); height: calc(100svh - var(--sheet-h, 62svh)); }
  .gis-bar { display: none !important; } /* phones keep GeoLibre's full menus */
  body.gis #geolibre { top: 52px; height: calc(100vh - 52px - var(--sheet-h, 62vh)); height: calc(100svh - 52px - var(--sheet-h, 62svh)); }
  .panel-resizer { display: none; }
  /* finger-sized controls: about 32 px tall or more */
  .rpill { padding: 6px 11px 6px 9px; }
  .fb button { padding: 6px 14px; }
  .act summary { padding: 6px 10px 6px 8px; }
  .choices button { padding: 7px 12px; }
  .seg button { padding: 7px 12px; }
  .seg.basemap-grid button { min-height: 34px; padding: 6px 4px; }
  .pill { padding: 8px 13px; }
  .chips button, .demo-chips button, .themes button { padding: 6px 12px; }
  .demo-ctl select { font-size: 16px; }  /* under 16 px, iOS zooms the page on focus */
  .btn { padding-top: 6px; padding-bottom: 6px; }
}
/* iOS zooms the page into any text box under 16 px when it is tapped, and does not zoom back out */
@media (max-width: 720px), (pointer: coarse) {
  input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=file]), select, textarea { font-size: 16px !important; }
}

/* ------------------------------------------------------------------ Insights: Y-finder explores the previews */
.tabs button.running::after { content: ""; display: inline-block; width: 6px; height: 6px; margin-left: 5px; border-radius: 50%;
  background: var(--navy-2); vertical-align: 2px; animation: xpulse 1.4s ease-in-out infinite; }
@keyframes xpulse { 0%, 100% { opacity: .35; transform: scale(.8); } 50% { opacity: 1; transform: scale(1.15); } }
.xdot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); flex: none; }
.xdot.running, .xdot.waiting, .xpill.running .xdot, .xpill.waiting .xdot { background: var(--navy-2); animation: xpulse 1.4s ease-in-out infinite; }
.xdot.paused, .xpill.paused .xdot { background: #d18b00; }
.xdot.done, .xpill.done .xdot { background: var(--good); }
.xdot.stale { background: #fff; box-shadow: inset 0 0 0 2px #d18b00; }
.xhead { background: #fff; border: 1px solid var(--card-line); border-radius: 12px; padding: 12px 14px 10px; box-shadow: var(--lift-1); margin-bottom: 12px; }
.xh-row { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.xh-ctl { margin-left: auto; display: flex; gap: 6px; }
.xh-step { color: var(--ink-2); font-size: 12.5px; margin: 5px 0 0 17px; line-height: 1.4; }
.xplan { margin: 9px 0 2px; font-size: 12.5px; }
.xplan summary { cursor: pointer; color: var(--navy-2); font-weight: 600; }
.xplan ol { list-style: none; margin: 8px 0 2px; padding: 8px 10px; background: var(--well); border-radius: 9px; box-shadow: inset 0 1px 3px rgba(0, 38, 84, .08); }
.xplan li { display: flex; gap: 8px; align-items: baseline; padding: 3px 0; line-height: 1.4; color: var(--ink-2); }
.xplan .pi { flex: none; width: 10px; height: 10px; border-radius: 50%; border: 1.5px solid #a9b6c8; position: relative; top: 1px; }
.xplan li.done { color: var(--ink); }
.xplan li.done .pi { background: var(--good); border-color: var(--good); }
.xplan li.doing { color: var(--ink); font-weight: 600; }
.xplan li.doing .pi { border-color: var(--navy-2); border-top-color: transparent; animation: xspin .9s linear infinite; }
.xplan li.skipped { color: var(--muted); }
.xplan li.skipped .pi { border-style: dashed; }
@keyframes xspin { to { transform: rotate(360deg); } }
.xauto { display: flex; gap: 6px; align-items: center; font-size: 12px; color: var(--muted); margin-top: 8px; }
.xsyn { background: #fff; border: 1px solid var(--card-line-2); border-left: 4px solid var(--navy); border-radius: 12px; padding: 12px 14px; margin-bottom: 14px; box-shadow: var(--lift-2); }
.xsyn h3 { margin: 0 0 6px; font-size: 14.5px; color: var(--navy); }
.xsyn p { margin: 0 0 8px; font-size: 13.5px; line-height: 1.55; }
.xsyn ul { margin: 2px 0 8px; padding-left: 18px; font-size: 13px; line-height: 1.5; }
.xs-sub { font-size: 12px; font-weight: 700; color: var(--ink-2); margin-top: 4px; }
.xsyn .lim { font-size: 12.5px; color: #5c3d00; line-height: 1.45; background: var(--partial-bg); border-radius: 8px; padding: 7px 10px; }
.xsyn .lim b { color: var(--partial); }
.xs-by { font-size: 11.5px; color: var(--muted); margin-top: 8px; }
.xcite { border: 0; background: var(--yale-bg); color: var(--navy); font-size: 11px; font-weight: 700; border-radius: 5px; padding: 0 5px; margin: 0 1px; line-height: 16px; vertical-align: 1px; }
.xcite:hover { background: var(--navy); color: #fff; }
.xcard { background: #fff; border: 1px solid var(--card-line); border-radius: 12px; padding: 11px 14px 12px; margin-bottom: 10px; box-shadow: var(--lift-1); transition: box-shadow .2s, border-color .2s; }
.xcard:hover { border-color: var(--card-line-2); box-shadow: var(--lift-2); }
.xcard.flash { border-color: var(--navy-2); box-shadow: 0 0 0 3px rgba(40, 109, 192, .25), var(--lift-2); }
.xc-top { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; font-size: 11.5px; }
.xnum { width: 20px; height: 20px; border-radius: 50%; background: var(--navy); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 11px; flex: none; }
.xedge, .xfac { background: #e8f1fd; color: #1e3a8a; border-radius: 10px; padding: 1px 8px; line-height: 18px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.xfac { background: var(--soft-2); color: var(--ink-2); }
.xrho { border: 1px solid var(--card-line-2); border-radius: 10px; padding: 0 7px; line-height: 17px; color: var(--ink-2); font-weight: 600; font-variant-numeric: tabular-nums; }
.xrho.on { background: var(--navy); color: #fff; border-color: var(--navy); }
.xcard h4 { margin: 7px 0 4px; font-size: 14.5px; line-height: 1.35; font-weight: 650; color: var(--ink); }
.xc-d { margin: 6px 0 2px; font-size: 12.5px; line-height: 1.5; color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.xc-d.open { display: block; }
.xmore { font-size: 12px; margin: 0 0 8px; }
.xcard .row { margin-top: 6px; }
.xcard .row { display: flex; gap: 6px; flex-wrap: wrap; }
.xchart { margin: 6px 0 2px; padding: 6px 4px 2px; background: var(--well); border-radius: 9px; }
.xchart svg { width: 100%; height: auto; display: block; max-height: 150px; }
.xchart .ax { stroke: #b9c6d8; stroke-width: 1; }
.xchart .tk { font-size: 9px; fill: var(--muted); font-variant-numeric: tabular-nums; }
.xchart .al { font-size: 9.5px; fill: var(--ink-2); }
.xchart .dots circle { fill: #286dc0; fill-opacity: .42; }
.xchart rect { fill: #a9c3e6; }
.xchart rect.pk { fill: #286dc0; }
.xchart .ln { fill: none; stroke: #286dc0; stroke-width: 2; }
.xchart .ln2 { stroke: #8aa4c8; stroke-dasharray: 4 3; stroke-width: 1.6; }
.xchart .md { stroke: #00356b; stroke-width: 2.4; }
.xfoot { font-size: 11.5px; color: var(--muted); line-height: 1.5; margin: 4px 2px 0; }
/* the pill on the map: what the explorer is doing, with pause and stop */
.xpill { position: fixed; top: 12px; left: calc(var(--panel-w) + 36px); z-index: 5; display: flex; align-items: center; gap: 4px;
  background: rgba(255, 255, 255, .97); border: 1px solid var(--card-line-2); border-radius: 18px; padding: 3px 4px 3px 11px; box-shadow: var(--lift-2);
  max-width: max(240px, calc(100vw - var(--panel-w) - 440px)); font-size: 12.5px; }
.xp-t { border: 0; background: none; padding: 4px 4px; color: var(--ink); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; }
.xp-t:hover { color: var(--navy-2); text-decoration: underline; }
.xpill.done .xp-t, .xpill.stopped .xp-t { color: var(--navy); font-weight: 600; }
.xp-b { border: 1px solid var(--card-line); background: #fff; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; color: var(--navy); flex: none; padding: 0; }
.xp-b:hover { background: var(--soft); border-color: var(--card-line-2); }
.xmk { display: flex; align-items: center; gap: 4px; pointer-events: none; }
.xmk b { width: 20px; height: 20px; margin-left: -10px; border-radius: 50%; background: #e8590c; color: #fff; font-size: 11px; display: grid; place-items: center;
  box-shadow: 0 0 0 2px #fff, 0 2px 6px rgba(0, 0, 0, .3); }
.xmk span { background: rgba(255, 255, 255, .95); border: 1px solid var(--card-line-2); border-radius: 8px; padding: 1px 6px; font-size: 11.5px; color: var(--ink);
  max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; box-shadow: var(--lift-1); }
.ra-e { display: inline-block; width: 18px; height: 0; border-top: 2.6px solid #286dc0; vertical-align: middle; }
.ra-e.dash { border-top-style: dashed; }
@media (max-width: 720px) {
  .xpill, body.collapsed .xpill { left: 8px; right: 74px; top: auto; bottom: calc(var(--sheet-h, 62vh) + 40px); max-width: none; }
}

/* ---------- screens of every size ---------- */
:root { --ui: 1; } /* how much the panel and the map's controls are scaled up on very large screens */
@media (min-width: 721px) {
  /* notices appear over the map, so they never cover the chat's send button */
  .toast { left: calc((100vw + var(--panel-w) + 24px) / 2 / var(--ui)); max-width: calc((100vw - var(--panel-w) - 48px) / var(--ui)); }
  body.collapsed .toast { left: calc(50vw / var(--ui)); max-width: calc(80vw / var(--ui)); }
  .maplibregl-ctrl-bottom-left .maplibregl-ctrl-scale { margin: 0 0 30px 64px; } /* beside the Layers button, clear of the legend */
}
/* Very large screens (a 4K monitor at 100% scaling, ultrawide monitors): text and controls would be tiny and the panel
   a narrow strip, so the panel and the floating map controls scale up together. The map canvas and the graph canvas are
   not scaled: CSS zoom on a canvas's ancestor shifts its pointer positions. */
@media (min-width: 2600px) and (min-height: 1100px) { :root { --ui: 1.2; } }
@media (min-width: 3400px) and (min-height: 1600px) { :root { --ui: 1.4; } }
@media (min-width: 2600px) and (min-height: 1100px) {
  :root { --panel-w: clamp(calc(440px * var(--ui)), 34vw, calc(560px * var(--ui))); }
  body.wide { --panel-w: min(calc(1100px * var(--ui)), 46vw); }
  .sheet-grip, header.brand, .hist, .tabs, #tab-chat, #tab-data, #tab-insights, #tab-catalog, .attach-info, .ask,
  #tab-frame > :not(#graph), .topright, .xpill, .map-legend, .layers-box, .toast, .dlg,
  .maplibregl-ctrl-top-right, .maplibregl-ctrl-bottom-left, .maplibregl-ctrl-bottom-right { zoom: var(--ui); }
  .xpill { left: calc((var(--panel-w) + 36px) / var(--ui)); }
  .layers-box { left: calc((var(--panel-w) + 24px) / var(--ui)); }
  #graph { height: calc(380px * var(--ui)); }  /* a taller canvas: fitting the graph to it enlarges nodes and labels */
  body.wide #graph { height: calc(520px * var(--ui)); }
  body.gis #geolibre { top: calc(58px * var(--ui)); height: calc(100vh - 58px * var(--ui)); } /* the top bar is scaled up too */
}

/* Web leads share the card palette and wrap inside the existing details. */
.refine-need { min-width: 0; overflow-wrap: anywhere; }
.refine-web-lead { font-size: 12px; line-height: 1.5; padding-left: 8px; }
.refine-web-lead .badge { font-size: 10px; }
/* One compact save/share control beside New conversation. */
.project-controls { position:relative; flex-shrink:0; }
.project-menu { position:absolute; top:calc(100% + 8px); right:0; width:240px; max-width:calc(100vw - 24px); max-height:calc(100dvh - 140px); overflow:auto; padding:6px; background:#fff; color:var(--ink); border:1px solid #dbe1e8; border-radius:10px; box-shadow:0 8px 32px #15243b29; z-index:100; }
.project-menu[hidden] { display:none; }
.project-menu button { display:block; width:100%; padding:8px 10px; border:0; background:transparent; text-align:left; color:inherit; border-radius:5px; font:inherit; font-size:13px; cursor:pointer; }
.project-menu button:hover, .project-menu button:focus-visible { background:#eef3fa; }
.project-menu button:disabled { opacity:.5; cursor:default; }
.project-menu button[hidden], .project-menu span[hidden] { display:none; }
.project-menu span { display:block; padding:0 10px 4px; font-size:11px; }
.project-menu hr { border:0; border-top:1px solid #e4e8ef; margin:5px; }
.project-preview { padding:8px 0; line-height:1.5; }
.project-chat-note { padding:0 0 10px; }
@media(max-width:720px) { .project-menu { position:fixed; top:auto; bottom:70px; left:12px; right:auto; max-height:calc(100dvh - 150px); } .brand { gap:5px; } }
