/* Sapione Lens design system for the classic pages (home, sponsor map, comparators, readout
   windows, trends, contacts, team, super admin, sign-in). One stylesheet for every page.
   Tokens first; components below. Dark is the default; html[data-theme="light"] switches.
   The Lens app keeps the choice in localStorage "lens_theme" and shell.js applies it.

   Rule for every surface (panel, card, popup, dropdown, modal, drawer, toast): an OPAQUE
   background. Something translucent over a map or a table is unreadable. */

/* Space Grotesk: one variable font, weights 400-700. Anybody 800 at 125% width: display
   numbers only. Files ship with the app; nothing is fetched from a third party. */
@font-face { font-family: "Space Grotesk"; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url("/web/lens/fonts/space-grotesk-vietnamese.woff2") format("woff2");
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB; }
@font-face { font-family: "Space Grotesk"; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url("/web/lens/fonts/space-grotesk-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Space Grotesk"; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url("/web/lens/fonts/space-grotesk-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Anybody"; font-style: normal; font-weight: 800; font-stretch: 125%; font-display: swap;
  src: url("/web/lens/fonts/anybody-800-vietnamese.woff2") format("woff2");
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB; }
@font-face { font-family: "Anybody"; font-style: normal; font-weight: 800; font-stretch: 125%; font-display: swap;
  src: url("/web/lens/fonts/anybody-800-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Anybody"; font-style: normal; font-weight: 800; font-stretch: 125%; font-display: swap;
  src: url("/web/lens/fonts/anybody-800-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

/* ------------------------------------------------------------------ tokens: dark (default) */
:root {
  /* the Lens palette, exactly as the Lens app defines it */
  --bg: #0f0e0e; --bg-top: #1a1918;
  --ink: #f3f2f2; --ink-2: #bab6b6; --muted: #8a8684; --line: #3a3736; --line-soft: #262423;
  --accent: #62c5ee; --accent-deep: #38a6cf; --on-accent: #0a303e; --accent-hi: #99e0ff;
  --orange: #f08a3c; --yellow: #e3c84a; --signal: #ff458e; --gold: #d8b25a; --green: #3fae74;
  --page-bg: radial-gradient(ellipse at 70% -10%, rgba(0,136,176,.26), transparent 55%),
             radial-gradient(ellipse at 10% 110%, rgba(214,0,108,.07), transparent 48%),
             linear-gradient(180deg, #1a1918, #0f0e0e);

  /* surfaces - opaque, always */
  --surface: #1a1918; --surface-2: #211f1e; --surface-3: #2b2928; --line-2: #4a4644;
  --card-border: var(--line);

  /* the classic pages' semantic names, mapped onto the palette */
  --primary: var(--accent); --primary-600: var(--accent-hi); --primary-50: #13303b; --primary-100: #1d4757;
  --accent-50: var(--primary-50);
  --hot: var(--orange); --hot-50: #33210f; --on-hot: #2a1200;            /* "act now": hot leads, open buy windows */
  --ok: var(--green); --ok-50: #13291d; --on-ok: #04210f;
  --warn: var(--yellow); --warn-50: #2c2610;
  --danger: var(--signal); --danger-50: #351421; --on-danger: #2b0614;
  --info: var(--accent-hi); --info-50: #142a36;

  /* charts: CSS colours, so a theme switch recolours them without a re-render */
  --c1: #62c5ee; --c2: #f08a3c; --c3: #3fae74; --c4: #e3c84a; --c5: #ff458e; --c6: #d8b25a; --c7: #99e0ff; --c8: #8a8684;
  --seq1: #99e0ff; --seq2: #62c5ee; --seq3: #2b86ad;

  --radius: 2px; --radius-sm: 2px; --radius-xs: 2px;
  --shadow-1: none;
  --shadow-2: 0 10px 28px rgba(0,0,0,.5), 0 1px 0 rgba(255,255,255,.03) inset;
  --shadow-3: 0 24px 64px rgba(0,0,0,.7);
  --tip-bg: #2b2928; --tip-ink: #f3f2f2;
  --overlay: rgba(6,6,6,.72);
  /* where fixed overlays (modal, drawer, toasts) sit: the whole viewport normally; inside the
     Lens frame, which grows to the page's height, shell.js narrows it to the part on screen */
  --vv-top: 0px; --vv-h: 100vh;
  --nav-w: 248px; --top-h: 60px;
  --font: "Space Grotesk", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Anybody", "Space Grotesk", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: dark;
}
/* ------------------------------------------------------------------ tokens: light */
:root[data-theme="light"] {
  --bg: #e9ebef; --bg-top: #f6f6f8;
  --ink: #000000; --ink-2: #2a333c; --muted: #5b6670; --line: #c9ced4; --line-soft: #e2e5e9;
  --accent: #0b7fa6; --accent-deep: #0b7fa6; --on-accent: #ffffff; --accent-hi: #075e80;
  --orange: #c2410c; --yellow: #92400e; --signal: #ff2d7a; --gold: #8a6a12; --green: #15803d;
  --page-bg: radial-gradient(ellipse at 70% -10%, rgba(56,166,207,.16), transparent 55%),
             linear-gradient(180deg, #f6f6f8, #e9ebef);

  --surface: #ffffff; --surface-2: #f4f5f7; --surface-3: #e9ebef; --line-2: #b9c0c8;
  --card-border: transparent;

  /* text on tints needs a deeper blue than the accent to stay above 4.5:1 */
  --primary: #0a6f92; --primary-600: #075e80; --primary-50: #e4f2f8; --primary-100: #c5e3ef;
  --accent-50: var(--primary-50);
  --hot: #b13a0a; --hot-50: #fcebe2; --on-hot: #ffffff;
  --ok: #12703a; --ok-50: #e3f3e8; --on-ok: #ffffff;
  --warn: #8a5a00; --warn-50: #fbf1d9;
  --danger: #c0164f; --danger-50: #fde8ef; --on-danger: #ffffff;
  --info: #2456b8; --info-50: #e8effc;

  --c1: #0b7fa6; --c2: #c2410c; --c3: #15803d; --c4: #a16207; --c5: #d81b60; --c6: #8a6a12; --c7: #5fb3d6; --c8: #5b6670;
  --seq1: #8fd0ea; --seq2: #2a9cc6; --seq3: #0a5e7d;

  --radius: 14px; --radius-sm: 2px; --radius-xs: 2px;
  --shadow-1: 0 1px 2px rgba(10,20,30,.08), 0 10px 30px rgba(10,20,30,.12);
  --shadow-2: 0 4px 14px rgba(10,20,30,.12), 0 18px 44px rgba(10,20,30,.16);
  --shadow-3: 0 24px 70px rgba(10,20,30,.30);
  --tip-bg: #1b232b; --tip-ink: #ffffff;
  --overlay: rgba(30,38,46,.45);
  color-scheme: light;
}

* { box-sizing: border-box; }
/* Every icon from GEOBD.icon() is aria-hidden: give it a sane default size so an icon in a
   context nobody styled can never blow up to full width. Specific rules below override. */
svg[aria-hidden="true"] { width: 16px; height: 16px; flex-shrink: 0; vertical-align: -3px; }
html, body { margin: 0; height: 100%; }
html { background: var(--bg); }
body { font-family: var(--font); font-size: 14px; line-height: 1.5; color: var(--ink); background: var(--page-bg); background-color: var(--bg);
  background-attachment: fixed; -webkit-font-smoothing: antialiased; }
a { color: var(--primary); text-decoration: none; } a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; letter-spacing: -.01em; font-weight: 600; }
h1 { font-size: 1.5rem; font-weight: 700; } h2 { font-size: 1.2rem; } h3 { font-size: 1rem; }
code, .mono { font-family: var(--mono); font-size: .86em; }
code { background: var(--surface-2); border: 1px solid var(--line); border-radius: 2px; padding: 1px 5px; overflow-wrap: anywhere; }
hr { border: none; border-top: 1px solid var(--line); margin: 16px 0; }
::selection { background: var(--accent-deep); color: var(--on-accent); }
.muted { color: var(--muted); } .small { font-size: .82rem; } .tiny { font-size: .74rem; }
.nowrap { white-space: nowrap; } .ta-right { text-align: right; } .center { text-align: center; }
.num { font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.hidden { display: none !important; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; } .grow { flex: 1; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.grid { display: grid; gap: 14px; }
.grid > * { min-width: 0; }
.g2 { grid-template-columns: repeat(2, minmax(0,1fr)); } .g3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
@media (max-width: 1100px) { .g4 { grid-template-columns: repeat(2, minmax(0,1fr)); } .g3 { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (max-width: 640px) { .g2, .g3 { grid-template-columns: 1fr; } .g4 { grid-template-columns: repeat(2, minmax(0,1fr)); } }
/* the small uppercase label the Lens app uses for every section and field title */
.eyebrow { font-size: 11px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }

/* ------------------------------------------------------------------ app shell (opened directly) */
.app { display: grid; grid-template-columns: var(--nav-w) minmax(0,1fr); min-height: 100vh; transition: grid-template-columns .18s ease; }
html[data-nav="collapsed"] { --nav-w: 72px; }
.sidenav { position: sticky; top: 0; height: 100vh; background: var(--bg-top); border-right: 1px solid var(--line-soft);
  display: flex; flex-direction: column; z-index: 40; overflow: hidden; }
.brand { height: var(--top-h); display: flex; align-items: center; gap: 10px; padding: 0 18px; border-bottom: 1px solid var(--line-soft); flex-shrink: 0; }
.brand .logo { width: 30px; height: 30px; display: grid; place-items: center; flex-shrink: 0; color: var(--accent); }
.brand .logo svg { width: 30px; height: 30px; }
.brand .word { font-weight: 700; font-size: 1.12rem; letter-spacing: -.01em; white-space: nowrap; color: var(--ink); }
.brand .word span { color: var(--accent); }
.navscroll { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 10px 10px 16px; }
.navgroup { margin-top: 14px; } .navgroup:first-child { margin-top: 4px; }
.navlabel { font-size: 10.5px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--muted);
  padding: 6px 10px; white-space: nowrap; }
.navitem { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 2px; color: var(--ink-2);
  font-weight: 500; white-space: nowrap; position: relative; text-decoration: none !important; }
.navitem svg { width: 18px; height: 18px; flex-shrink: 0; stroke: currentColor; }
.navitem:hover { background: var(--surface-2); color: var(--ink); }
.navitem.on { background: var(--primary-50); color: var(--primary); font-weight: 600; }
.navitem.on::before { content: ""; position: absolute; left: -10px; top: 8px; bottom: 8px; width: 2px; background: var(--accent); }
.navitem .pill { margin-left: auto; font-size: .68rem; padding: 1px 7px; border-radius: 2px; background: var(--hot-50); color: var(--hot); font-weight: 600; }
.navfoot { border-top: 1px solid var(--line-soft); padding: 10px; flex-shrink: 0; }
.collapse-btn { width: 100%; justify-content: flex-start; }
html[data-nav="collapsed"] .navlabel, html[data-nav="collapsed"] .navitem .txt,
html[data-nav="collapsed"] .brand .word, html[data-nav="collapsed"] .navitem .pill,
html[data-nav="collapsed"] .collapse-btn .txt { display: none; }
html[data-nav="collapsed"] .navitem { justify-content: center; padding: 10px 0; }
html[data-nav="collapsed"] .brand { justify-content: center; padding: 0; }
html[data-nav="collapsed"] .collapse-btn { justify-content: center; }
html[data-nav="collapsed"] .collapse-btn svg { transform: rotate(180deg); }
html[data-nav="collapsed"] .navlabel { height: 1px; padding: 0; margin: 10px 8px; background: var(--line); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { height: var(--top-h); position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 14px;
  padding: 0 24px; background: var(--bg-top); border-bottom: 1px solid var(--line-soft); }
.topbar .title { min-width: 0; flex: 0 1 auto; }
.topbar > .btn { flex-shrink: 0; }
.topbar .title h1 { font-size: 1.1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .title .sub { font-size: .78rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .spacer { flex: 1; }
/* .btn sets display, so this needs the extra specificity or the drawer button shows on desktop */
.topbar .hamburger { display: none; }
.page { padding: 24px; max-width: 1480px; width: 100%; margin: 0 auto; }
.page.wide { max-width: none; }
.page.flush { padding: 0; max-width: none; }

@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0,1fr); }
  .sidenav { position: fixed; left: 0; top: 0; width: 272px; transform: translateX(-100%); visibility: hidden; transition: transform .2s ease, visibility 0s linear .2s; box-shadow: var(--shadow-3); }
  html[data-drawer="open"] .sidenav { transform: none; visibility: visible; transition: transform .2s ease; }
  html[data-drawer="open"]::after { content: ""; position: fixed; inset: 0; background: var(--overlay); z-index: 35; }
  html[data-nav="collapsed"] .navitem .txt, html[data-nav="collapsed"] .navlabel, html[data-nav="collapsed"] .brand .word { display: revert; }
  .topbar .hamburger { display: inline-flex; } .navfoot { display: none; }   /* the drawer has no collapsed state */
  .topbar { padding: 0 14px; } .page { padding: 16px; }
}

/* ------------------------------------------------------------------ embedded in the Lens app
   Inside the Lens iframe (or with ?embed=1) the shell draws no navigation, top bar or
   footer: only the page heading and the page itself. Sticky offsets drop to zero. */
html[data-embed] { --top-h: 0px; }
.embed-app { display: flex; flex-direction: column; min-width: 0; }
.embed-head { display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; padding: 22px 24px 2px; max-width: 1480px; width: 100%; margin: 0 auto; }
.embed-head.wide { max-width: none; }
.embed-head .title { min-width: 0; flex: 1; }
.embed-head .kicker { margin-bottom: 4px; }
.embed-head h1 { font-size: 1.45rem; line-height: 1.2; overflow-wrap: anywhere; }
.embed-head .sub { font-size: .84rem; color: var(--muted); margin-top: 3px; overflow-wrap: anywhere; }
.embed-head #topactions:empty { display: none; }
.embed-app #pagehost { flex: 1; min-width: 0; }
/* pages that fill the frame (the sponsor map): heading on top, the rest is the page */
.embed-app.fill { height: 100vh; height: 100dvh; min-height: 0; }
/* a one-screen page (the sponsor map) opened directly: the top bar, then the page fills the rest */
html[data-layout="fill"] .app .main { height: 100vh; height: 100dvh; }
html[data-layout="fill"] .app #pagehost, html[data-layout="fill"] .app #content { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.embed-app.fill .embed-head { padding-bottom: 12px; }
.embed-app.fill #pagehost, .embed-app.fill #content { flex: 1; min-height: 0; display: flex; flex-direction: column; }
@media (max-width: 900px) { .embed-head { padding: 16px 16px 0; } }

/* user menu */
.usermenu { position: relative; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--primary-100); color: var(--primary);
  display: grid; place-items: center; font-weight: 700; font-size: .82rem; }
.userbtn { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); background: var(--surface);
  padding: 4px 10px 4px 4px; border-radius: 99px; cursor: pointer; font: inherit; color: var(--ink); }
.userbtn:hover { border-color: var(--line-2); }
.userbtn { flex-shrink: 0; max-width: 260px; }
.userbtn .who { text-align: left; line-height: 1.2; min-width: 0; }
.userbtn .who b, .userbtn .who span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 180px; }
.userbtn .who b { font-size: .82rem; } .userbtn .who span { font-size: .72rem; color: var(--muted); }
.userbtn > svg { width: 14px; height: 14px; color: var(--muted); flex-shrink: 0; }
@media (max-width: 700px) { .userbtn .who { display: none; } .userbtn { padding: 3px; } }
.menu { position: absolute; right: 0; top: calc(100% + 8px); min-width: 240px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-2); padding: 6px; display: none; z-index: 60; }
.menu.open { display: block; }
.menu .mi { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: none; background: none;
  border-radius: 2px; font: inherit; color: var(--ink-2); cursor: pointer; text-align: left; text-decoration: none !important; }
.menu .mi:hover { background: var(--surface-2); color: var(--ink); }
.menu .mi svg { width: 17px; height: 17px; }
.menu .mhead { padding: 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; overflow-wrap: anywhere; }
.menu .mhead b { display: block; } .menu .mhead span { font-size: .78rem; color: var(--muted); }

/* ------------------------------------------------------------------ primitives */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 34px; padding: 0 14px;
  border-radius: 2px; border: 1px solid transparent; font: inherit; font-weight: 600; font-size: 12px; line-height: 1;
  text-transform: uppercase; letter-spacing: .1em;
  cursor: pointer; white-space: nowrap; text-decoration: none !important; transition: background .12s, border-color .12s, color .12s; }
.btn svg { width: 15px; height: 15px; }
.btn.primary { background: var(--accent-deep); color: var(--on-accent); border-color: var(--accent-deep); }
.btn.primary:hover { background: var(--accent); border-color: var(--accent); }
:root[data-theme="light"] .btn.primary:hover { background: var(--accent-hi); border-color: var(--accent-hi); }
.btn.secondary { background: var(--surface); border-color: var(--line-2); color: var(--ink); }
.btn.secondary:hover { border-color: var(--accent); color: var(--primary); }
.btn.ghost { background: transparent; color: var(--ink-2); } .btn.ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn.danger { background: var(--danger); color: var(--on-danger); border-color: var(--danger); } .btn.danger:hover { filter: brightness(1.08); }
.btn.soft { background: var(--primary-50); color: var(--primary); border-color: var(--primary-100); } .btn.soft:hover { background: var(--primary-100); }
.btn.sm { height: 30px; padding: 0 11px; font-size: 11px; }
.btn.xs { height: 26px; padding: 0 8px; font-size: 10.5px; letter-spacing: .08em; }
.btn.icon { width: 34px; padding: 0; } .btn.sm.icon { width: 30px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn.block { width: 100%; }

.card { background: var(--surface); border: 1px solid var(--card-border); border-radius: var(--radius); box-shadow: var(--shadow-1);
  min-width: 0; overflow-wrap: anywhere; }
.card-h { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line-soft); flex-wrap: wrap; }
.card-h h2 { font-size: 1.05rem; min-width: 0; }
.card-h h3 { font-size: 11.5px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); min-width: 0;
  display: inline-flex; align-items: center; gap: 7px; }
.card-h .sub { font-size: .8rem; color: var(--muted); }
.card-b { padding: 16px 18px; } .card-b.flush { padding: 0; }
.card-f { padding: 12px 18px; border-top: 1px solid var(--line-soft); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }

.kpi { padding: 16px 18px; min-width: 0; overflow-wrap: anywhere; }
.kpi .k { font-size: 11px; color: var(--muted); font-weight: 600; letter-spacing: .12em; text-transform: uppercase; display: flex; align-items: center; gap: 6px; min-width: 0; }
.kpi .row.between { flex-wrap: nowrap; align-items: flex-start; }
.kpi .v { font-family: var(--font-display); font-stretch: 125%; font-weight: 800; font-size: 1.5rem; line-height: 1.15; letter-spacing: -.01em;
  margin-top: 8px; font-variant-numeric: tabular-nums; color: var(--ink); }
.kpi .d { font-size: .78rem; color: var(--muted); margin-top: 4px; }
.kpi .ico { width: 32px; height: 32px; border-radius: 2px; display: grid; place-items: center; background: var(--primary-50); color: var(--primary); flex-shrink: 0; }
.kpi .ico svg { width: 17px; height: 17px; }
.kpi.accent .ico { background: var(--hot-50); color: var(--hot); }
.kpi.ok .ico { background: var(--ok-50); color: var(--ok); }
.up { color: var(--ok); } .down { color: var(--danger); }

.badge { display: inline-flex; align-items: center; gap: 5px; font-size: .72rem; font-weight: 600; padding: 2px 8px;
  border-radius: 2px; background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); white-space: nowrap; }
.badge.primary { background: var(--primary-50); color: var(--primary); border-color: var(--primary-100); }
.badge.ok { background: var(--ok-50); color: var(--ok); border-color: transparent; }
.badge.warn { background: var(--warn-50); color: var(--warn); border-color: transparent; }
.badge.danger { background: var(--danger-50); color: var(--danger); border-color: transparent; }
.badge.accent { background: var(--hot-50); color: var(--hot); border-color: transparent; }
.badge.info { background: var(--info-50); color: var(--info); border-color: transparent; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: currentColor; }

.chip { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border-radius: 2px; border: 1px solid var(--line-2);
  background: var(--surface); color: var(--ink-2); font: inherit; font-size: .8rem; font-weight: 500; cursor: pointer; white-space: nowrap; }
.chip:hover { border-color: var(--accent); color: var(--ink); }
.chip.on { background: var(--accent-deep); border-color: var(--accent-deep); color: var(--on-accent); }
.chip .n { font-size: .72rem; opacity: .75; font-variant-numeric: tabular-nums; }
.chip.dim { opacity: .5; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }

.seg { display: inline-flex; flex-wrap: wrap; padding: 3px; gap: 2px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 2px; max-width: 100%; }
.seg button { border: none; background: none; height: 28px; padding: 0 12px; border-radius: 2px; font: inherit; font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .1em;
  color: var(--muted); cursor: pointer; display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.seg button svg { width: 15px; height: 15px; }
.seg button:hover { color: var(--ink); }
.seg button.on { background: var(--surface); color: var(--primary); box-shadow: inset 0 0 0 1px var(--line-2); }

.input, .select, textarea.input { height: 36px; width: 100%; padding: 0 12px; border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink); font: inherit; font-size: .88rem; outline: none; transition: border-color .12s, box-shadow .12s; }
.input::placeholder { color: var(--muted); opacity: 1; }
textarea.input { height: auto; padding: 10px 12px; min-height: 80px; resize: vertical; }
.input:focus, .select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--primary-50); }
.input.sm, .select.sm { height: 32px; font-size: .82rem; }
/* native dropdown lists: never transparent, never light text on a light list */
select option, select optgroup { background: var(--surface); color: var(--ink); }
.searchbox { position: relative; }
.searchbox svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--muted); pointer-events: none; }
.searchbox .input { padding-left: 36px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .label { font-size: 11px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.field > label .muted { text-transform: none; letter-spacing: 0; }
.field .help { font-size: .76rem; color: var(--muted); }

.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .track { width: 38px; height: 22px; border-radius: 99px; background: var(--line-2); position: relative; transition: background .15s; flex-shrink: 0; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.35); transition: transform .15s; }
.switch input:checked + .track { background: var(--accent-deep); }
.switch input:checked + .track::after { transform: translateX(16px); }
.switch input:focus-visible + .track { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch input:disabled + .track { opacity: .5; }
.switch .lbl { font-size: .86rem; }

/* tri-state access control: inherit / on / off */
.tri { display: inline-flex; border: 1px solid var(--line-2); border-radius: 2px; overflow: hidden; flex-shrink: 0; }
.tri button { border: none; background: var(--surface); height: 28px; padding: 0 10px; font: inherit; font-size: .74rem; font-weight: 600; color: var(--muted); cursor: pointer; }
.tri button + button { border-left: 1px solid var(--line-2); }
.tri button.on.inherit { background: var(--surface-3); color: var(--ink); }
.tri button.on.yes { background: var(--ok); color: var(--on-ok); }
.tri button.on.no { background: var(--danger); color: var(--on-danger); }

.table-wrap { overflow: auto; }
table.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .86rem; }
.table th { position: sticky; top: 0; z-index: 1; text-align: left; font-size: 10.5px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase;
  color: var(--muted); background: var(--surface-2); padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table th.sortable { cursor: pointer; user-select: none; } .table th.sortable:hover { color: var(--ink); }
.table th .arr { opacity: .5; margin-left: 3px; }
/* cells wrap at word boundaries and break only a token that is longer than the column
   (an email, a URL); a table wider than its card scrolls inside .table-wrap */
.table td { padding: 11px 14px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; min-width: 0; overflow-wrap: break-word; word-break: normal; }
.table td .mono { white-space: nowrap; }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr.click { cursor: pointer; } .table tbody tr.click:hover td { background: var(--surface-2); }
.table tbody tr.sel td { background: var(--primary-50); }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; overflow-wrap: normal; }
.table .strong { font-weight: 600; color: var(--ink); }
.table .sub { font-size: .76rem; color: var(--muted); }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); overflow-x: auto; overflow-y: hidden; }
.tab { border: none; background: none; padding: 11px 14px; font: inherit; font-weight: 600; font-size: 11.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted);
  cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; display: inline-flex; align-items: center; gap: 8px; }
.tab svg { width: 16px; height: 16px; }
.tab:hover { color: var(--ink); } .tab.on { color: var(--primary); border-bottom-color: var(--accent); }
.tab .count { font-size: .72rem; background: var(--surface-2); padding: 0 7px; border-radius: 2px; color: var(--muted); }

.callout { display: flex; gap: 12px; padding: 12px 14px; border-radius: var(--radius-sm); border: 1px solid var(--line); border-left-width: 3px;
  background: var(--surface-2); font-size: .86rem; color: var(--ink-2); min-width: 0; overflow-wrap: anywhere; }
.callout > div { min-width: 0; }
.callout svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }
.callout.info { background: var(--info-50); border-color: var(--info-50); border-left-color: var(--info); } .callout.info svg { color: var(--info); }
.callout.warn { background: var(--warn-50); border-color: var(--warn-50); border-left-color: var(--warn); } .callout.warn svg { color: var(--warn); }
.callout.danger { background: var(--danger-50); border-color: var(--danger-50); border-left-color: var(--danger); } .callout.danger svg { color: var(--danger); }
.callout.ok { background: var(--ok-50); border-color: var(--ok-50); border-left-color: var(--ok); } .callout.ok svg { color: var(--ok); }
.callout b { color: var(--ink); }

.empty { padding: 44px 20px; text-align: center; color: var(--muted); overflow-wrap: anywhere; }
.empty svg { width: 34px; height: 34px; color: var(--line-2); margin-bottom: 8px; }
.empty b { display: block; color: var(--ink); font-size: .95rem; margin-bottom: 4px; }

.skel { background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 37%, var(--surface-2) 63%); background-size: 400% 100%;
  animation: skel 1.3s ease infinite; border-radius: 2px; height: 14px; }
@keyframes skel { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
.spinner { width: 18px; height: 18px; border: 2px solid var(--line-2); border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------------ collapsible side panels */
.panel { background: var(--surface); border: 1px solid var(--card-border); display: flex; flex-direction: column; min-width: 0; min-height: 0; transition: width .18s ease; }
.panel-h { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line-soft); flex-shrink: 0; }
.panel-h h3 { font-size: 11.5px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--muted);
  flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.panel-b { flex: 1; overflow-y: auto; min-height: 0; }
.panel.collapsed { width: 44px !important; }
.panel.collapsed .panel-b, .panel.collapsed .panel-h h3, .panel.collapsed .panel-h .extra { display: none; }
.panel.collapsed .panel-h { flex-direction: column; padding: 10px 0; border-bottom: none; }
.panel .collapse-toggle svg { transition: transform .18s; }
/* side modifiers are at-left / at-right - NOT .left/.right, which would collide with text utilities */
.panel.at-left.collapsed .collapse-toggle svg { transform: rotate(180deg); }
.panel.at-right.collapsed .collapse-toggle svg { transform: rotate(180deg); }
.panel .vlabel { display: none; writing-mode: vertical-rl; transform: rotate(180deg); font-size: 11px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase;
  color: var(--muted); margin-top: 10px; cursor: pointer; white-space: nowrap; }
.panel.collapsed .vlabel { display: block; }
.fsec { padding: 14px; border-bottom: 1px solid var(--line-soft); }
.fsec:last-child { border-bottom: none; }
.fsec > .label { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.fsec > .label .tiny { text-transform: none; letter-spacing: 0; font-weight: 500; }

/* right drawer */
.drawer { position: fixed; top: var(--vv-top); right: 0; height: var(--vv-h); width: min(560px, 100vw); background: var(--surface); border-left: 1px solid var(--line);
  box-shadow: var(--shadow-3); z-index: 90; transform: translateX(100%); visibility: hidden; transition: transform .2s ease, visibility 0s linear .2s;
  display: flex; flex-direction: column; }
.drawer.open { transform: none; visibility: visible; transition: transform .2s ease, visibility 0s; }
.drawer-h { display: flex; align-items: flex-start; gap: 10px; padding: 18px 20px; border-bottom: 1px solid var(--line-soft); }
.drawer-h .t { flex: 1; min-width: 0; overflow-wrap: anywhere; } .drawer-h h2 { font-size: 1.1rem; }
.drawer-b { flex: 1; overflow-y: auto; padding: 18px 20px 40px; min-width: 0; overflow-wrap: anywhere; }
.backdrop { position: fixed; left: 0; right: 0; top: var(--vv-top); height: var(--vv-h); background: var(--overlay); z-index: 80; opacity: 0; pointer-events: none; transition: opacity .2s; }
.backdrop.open { opacity: 1; pointer-events: auto; }

/* modal */
.modal { position: fixed; left: 0; right: 0; top: var(--vv-top); height: var(--vv-h); z-index: 120; display: none; align-items: center; justify-content: center; padding: 20px; background: var(--overlay); }
.modal.open { display: flex; }
.modal-box { background: var(--surface); border: 1px solid var(--card-border); border-radius: var(--radius); box-shadow: var(--shadow-3);
  width: min(560px, 100%); max-height: calc(var(--vv-h) - 40px); display: flex; flex-direction: column; min-width: 0; }
.modal-box.lg { width: min(1180px, 100%); height: calc(var(--vv-h) - 40px); }
.modal-h { display: flex; align-items: center; gap: 12px; padding: 16px 22px; border-bottom: 1px solid var(--line-soft); }
.modal-h h2 { flex: 1; font-size: 1.1rem; min-width: 0; overflow-wrap: anywhere; }
.modal-b { padding: 20px 22px; overflow-y: auto; flex: 1; min-width: 0; overflow-wrap: anywhere; }
.modal-f { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; padding: 14px 22px; border-top: 1px solid var(--line-soft); }

/* toasts: an opaque Lens card with a coloured edge - readable in both themes */
.toasts { position: fixed; top: calc(var(--vv-top) + var(--vv-h) - 20px); transform: translateY(-100%); right: 20px; left: auto; z-index: 200; display: flex; flex-direction: column; gap: 8px; max-width: calc(100vw - 40px); }
.toast { display: flex; align-items: center; gap: 10px; min-width: 260px; max-width: 420px; padding: 12px 14px; border-radius: var(--radius-sm);
  background: var(--surface-3); color: var(--ink); border: 1px solid var(--line-2); border-left: 3px solid var(--accent);
  box-shadow: var(--shadow-2); font-size: .86rem; overflow-wrap: anywhere; animation: tin .2s ease; }
:root[data-theme="light"] .toast { background: var(--surface); border-color: var(--line); border-left-color: var(--accent); }
.toast svg { color: var(--accent); }
.toast.err { border-left-color: var(--danger); } .toast.err svg { color: var(--danger); }
.toast.ok { border-left-color: var(--ok); } .toast.ok svg { color: var(--ok); }
@keyframes tin { from { transform: translateY(8px); } }
@media (max-width: 500px) { .toast { min-width: 0; } }

/* tooltips on collapsed nav + anything with data-tip */
[data-tip] { position: relative; }
.tipbox { position: fixed; z-index: 300; background: var(--tip-bg); color: var(--tip-ink); border: 1px solid var(--line-2); font-size: .76rem; padding: 5px 9px; border-radius: 2px;
  pointer-events: none; white-space: nowrap; box-shadow: var(--shadow-2); }

/* charts */
.chart { width: 100%; display: block; }
.chart text { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.chart .grid line { stroke: var(--line-soft); }
.legend-row { display: flex; flex-wrap: wrap; gap: 14px; font-size: .78rem; color: var(--muted); }
.legend-row span { display: inline-flex; align-items: center; gap: 6px; }
.legend-row i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.hbar { display: grid; grid-template-columns: minmax(90px, 34%) minmax(40px, 1fr) auto; gap: 10px; align-items: center; padding: 6px 0; font-size: .84rem; }
.hbar .nm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.hbar .track { height: 8px; border-radius: 2px; background: var(--surface-2); overflow: hidden; }
.hbar .fill { height: 100%; border-radius: 2px; background: var(--accent); }
.hbar .val { font-variant-numeric: tabular-nums; color: var(--ink-2); font-weight: 600; min-width: 42px; text-align: right; white-space: nowrap; }

/* steps explaining a calculation */
.calc { display: flex; align-items: stretch; gap: 8px; flex-wrap: wrap; }
.calc .term { flex: 1; min-width: 110px; padding: 10px 12px; border-radius: 2px; background: var(--surface-2); border: 1px solid var(--line); overflow-wrap: anywhere; }
.calc .term .k { font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.calc .term .v { font-size: 1.05rem; font-weight: 700; }
.calc .op { display: grid; place-items: center; color: var(--muted); font-weight: 700; }
.calc .term.result { background: var(--primary-50); border-color: var(--primary-100); } .calc .term.result .v { color: var(--primary); }

.list-item { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line-soft); }
.list-item:last-child { border-bottom: none; }
.list-item.click { cursor: pointer; } .list-item.click:hover { background: var(--surface-2); }

.quick { display: flex; gap: 14px; align-items: flex-start; padding: 18px; border-radius: var(--radius); border: 1px solid var(--card-border);
  background: var(--surface); box-shadow: var(--shadow-1); color: var(--ink); text-decoration: none !important; min-width: 0; overflow-wrap: anywhere;
  transition: border-color .12s, transform .12s, box-shadow .12s; }
.quick:hover { border-color: var(--accent); box-shadow: var(--shadow-2); transform: translateY(-1px); }
.quick > div { min-width: 0; }
.quick .qi { width: 42px; height: 42px; border-radius: 2px; display: grid; place-items: center; background: var(--primary-50); color: var(--primary); flex-shrink: 0; }
.quick .qi svg { width: 21px; height: 21px; }
.quick h3 { font-size: .98rem; margin-bottom: 3px; } .quick p { margin: 0; font-size: .82rem; color: var(--muted); }
.quick.locked { opacity: .55; pointer-events: none; }

.notice-bar { font-size: .74rem; color: var(--muted); padding: 14px 24px 22px; text-align: center; }


/* ------------------------------------------------------------------ keyboard focus */
.btn:focus-visible, .chip:focus-visible, .seg button:focus-visible, .tab:focus-visible, .navitem:focus-visible,
.linkbtn:focus-visible, .pc-sel:focus-visible, .quick:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.linkbtn { border: none; background: none; padding: 0; font: inherit; color: var(--primary); cursor: pointer; font-weight: 600; }
.linkbtn:hover { text-decoration: underline; }
.ok-t { color: var(--ok); font-weight: 600; } .warn-t { color: var(--warn); }
.spinner.sm { width: 14px; height: 14px; border-width: 2px; vertical-align: -2px; }
.field-err { color: var(--danger); font-size: .8rem; min-height: 18px; margin-top: 8px; }
.orline { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: .74rem; letter-spacing: .12em; text-transform: uppercase; margin: 12px 0; }
.orline::before, .orline::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* ------------------------------------------------------------------ people browser (web/people.js) */
.cx { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.cx.busy { opacity: .6; pointer-events: none; }
.cx-head { display: flex; align-items: flex-start; gap: 8px; }
.cx-t { font-weight: 600; font-size: .95rem; overflow-wrap: anywhere; }
.cx-s { font-size: .8rem; color: var(--muted); margin-top: 1px; min-height: 18px; }
.cx-cost { display: flex; gap: 8px; align-items: flex-start; font-size: .78rem; color: var(--ink-2); background: var(--primary-50);
  border: 1px solid var(--primary-100); border-radius: 2px; padding: 8px 10px; }
.cx-cost svg { color: var(--primary); margin-top: 1px; }
.cx-presets { gap: 5px; } .cx-presets .chip { height: 28px; padding: 0 10px; font-size: .76rem; }
.cx-adv { display: flex; flex-direction: column; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 2px; background: var(--surface-2); }
.cx-adv .chips .chip { height: 26px; padding: 0 9px; font-size: .74rem; text-transform: capitalize; }
.cx-tools { display: flex; gap: 8px; align-items: center; }
.cx-bulk { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 6px 8px; border-radius: 2px; border: 1px solid var(--line); background: var(--surface); }
.cx-bulk.on { border-color: var(--primary-100); background: var(--primary-50); }
.cx-check { display: inline-flex; align-items: center; gap: 7px; font-size: .8rem; color: var(--ink-2); cursor: pointer; }
.cx-check input, .pc-sel { accent-color: var(--accent-deep); width: 16px; height: 16px; cursor: pointer; margin: 0; }
.cx-list { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; background: var(--surface); }
.cx.wide .cx-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(330px, 100%), 1fr)); gap: 0; }
.pc { display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto; gap: 10px; align-items: start; padding: 11px 12px;
  border-bottom: 1px solid var(--line-soft); transition: background .12s; }
.cx.wide .pc { border-right: 1px solid var(--line-soft); }
.pc:last-child { border-bottom: none; }
.pc:hover { background: var(--surface-2); }
.pc.sel { background: var(--primary-50); }
.pc .pc-sel { margin-top: 9px; }
.pc-main { min-width: 0; overflow-wrap: anywhere; }
.pc-av { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-3); color: var(--ink-2);
  font-weight: 700; font-size: .74rem; letter-spacing: .02em; }
.pc.unlocked .pc-av { background: var(--ok-50); color: var(--ok); }
.pc-name { font-weight: 600; font-size: .88rem; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.pc-name .badge { font-size: .64rem; padding: 0 6px; }
.pc-title { font-size: .8rem; color: var(--ink-2); margin-top: 1px; }
.pc-meta { font-size: .74rem; color: var(--muted); margin-top: 1px; }
.pc-rev { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 6px; font-size: .8rem; align-items: center; }
.pc-rev a { display: inline-flex; align-items: center; gap: 5px; word-break: break-all; }
.pc-rev svg { width: 14px; height: 14px; }
.pc-rev .linkbtn { font-size: .72rem; color: var(--muted); }
.pc-note { font-size: .72rem; color: var(--ok); margin-top: 4px; display: flex; gap: 5px; align-items: center; }
.pc-note svg { width: 13px; height: 13px; }
.pc-act { display: flex; flex-direction: column; gap: 5px; align-items: flex-end; }
.pc-act .btn svg { width: 13px; height: 13px; }
.pc-none { font-size: .7rem; color: var(--muted); white-space: nowrap; border: 1px dashed var(--line-2); border-radius: 2px; padding: 3px 7px; cursor: help; }
.pc .skel { height: 12px; } .pc-av.skel { height: 34px; }
.cx-pager { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; font-size: .78rem; color: var(--muted); }
.cx-more { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: .8rem; color: var(--ink-2); padding: 10px 12px; border-radius: 2px; background: var(--surface-2); }
.cx-more svg { color: var(--info); }
.cx-foot { display: flex; gap: 8px; align-items: flex-start; font-size: .74rem; color: var(--muted); line-height: 1.5; overflow-wrap: anywhere; }
.cx-foot svg { width: 14px; height: 14px; color: var(--ok); margin-top: 2px; }
.cx-site .input { min-width: 0; }
/* the one place the contact-data provider is credited: tiny, quiet, at the end of the list */
.cx-powered { font-size: 10px; line-height: 1.4; color: var(--muted); opacity: .8; text-align: right; letter-spacing: .02em; margin-top: -2px; }

/* ------------------------------------------------------------------ MapLibre controls in the Lens look */
.maplibregl-ctrl-group { background: var(--surface) !important; border: 1px solid var(--line); border-radius: 2px !important; box-shadow: var(--shadow-2) !important; }
.maplibregl-ctrl-group button + button { border-top-color: var(--line) !important; }
:root:not([data-theme="light"]) .maplibregl-ctrl-group button .maplibregl-ctrl-icon { filter: invert(1) hue-rotate(180deg) brightness(.92); }
.maplibregl-ctrl-attrib.maplibregl-compact, .maplibregl-ctrl.maplibregl-ctrl-attrib { background: var(--surface) !important; color: var(--muted); }
.maplibregl-ctrl-attrib a { color: var(--ink-2) !important; }
:root:not([data-theme="light"]) .maplibregl-ctrl-attrib-button { filter: invert(1); }

/* ================================================================== embedded pages flow
   Lens sizes its iframe to the page: the bottom of the lowest child of <body>. So an embedded
   page has no viewport-height shell and no inner scroll box, and a closed drawer is not laid
   out at all (it would keep the frame open). The sponsor map is the exception: Lens gives it
   a viewport-sized frame (html[data-layout="fill"]). */
html[data-embed]:not([data-layout="fill"]), html[data-embed]:not([data-layout="fill"]) body { height: auto; }
html[data-embed]:not([data-layout="fill"]) .panel { max-height: none !important; }
html[data-embed] .drawer:not(.open), html[data-embed] .backdrop:not(.open) { display: none; }
html[data-embed] .drawer.open { animation: drawer-in .2s ease; }
@keyframes drawer-in { from { transform: translateX(40px); } }

/* ================================================================== wide tables: a visible sideways affordance
   Shadows appear at whichever edge has more table behind it (background-attachment: local). */
:root { --x-shadow: rgba(0,0,0,.6); }
:root[data-theme="light"] { --x-shadow: rgba(10,20,30,.2); }
.table-wrap { scrollbar-width: thin; scrollbar-color: var(--line-2) transparent;
  background: linear-gradient(90deg, var(--surface) 30%, transparent) left / 28px 100% no-repeat local,
              linear-gradient(270deg, var(--surface) 30%, transparent) right / 28px 100% no-repeat local,
              radial-gradient(farthest-side at 0 50%, var(--x-shadow), transparent) left / 12px 100% no-repeat scroll,
              radial-gradient(farthest-side at 100% 50%, var(--x-shadow), transparent) right / 12px 100% no-repeat scroll; }
.table-wrap::-webkit-scrollbar { height: 8px; width: 8px; }
.table-wrap::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 4px; }

/* ================================================================== touch: every target at least 40px tall */
:root { --check: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230a303e' stroke-width='3.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12 5 5 9-10'/%3E%3C/svg%3E"); }
:root[data-theme="light"] { --check: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='3.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12 5 5 9-10'/%3E%3C/svg%3E"); }
@media (max-width: 900px), (pointer: coarse) {
  .btn, .btn.sm, .btn.xs { min-height: 40px; height: auto; padding-top: 6px; padding-bottom: 6px; line-height: 1.2; }
  .btn.icon, .btn.sm.icon { width: 40px; height: 40px; min-height: 40px; padding: 0; }
  .chip, .cx-presets .chip, .cx-adv .chips .chip { min-height: 40px; height: auto; }
  .seg button { min-height: 40px; height: auto; }
  .tab { min-height: 44px; }
  .tri button { min-height: 40px; }
  .navitem, .menu .mi { min-height: 44px; }
  .input, .select, textarea.input, .input.sm, .select.sm { min-height: 44px; }
  .switch { min-height: 40px; }
  details > summary { min-height: 44px; }
  /* small inline controls get a taller tap area without moving the text around them */
  .linkbtn { padding: 12px 6px; margin: -12px -6px; }
  a:not([class]) { padding: 13px 4px; margin: -13px -4px; }
  input[type="checkbox"]:not(.switch > input) { -webkit-appearance: none; appearance: none; width: 40px; height: 40px; margin: -10px; flex-shrink: 0;
    cursor: pointer; border: 0; border-radius: 0; vertical-align: middle;
    background: linear-gradient(var(--surface), var(--surface)) center / 16px 16px no-repeat, linear-gradient(var(--line-2), var(--line-2)) center / 20px 20px no-repeat; }
  input[type="checkbox"]:not(.switch > input):checked {
    background: var(--check) center / 14px 14px no-repeat, linear-gradient(var(--accent-deep), var(--accent-deep)) center / 20px 20px no-repeat; }
  input[type="checkbox"]:not(.switch > input):focus-visible { outline: 2px solid var(--accent); outline-offset: -8px; }
  /* list text wraps rather than hiding behind an ellipsis */
  .hbar .nm, .litem .nm, .panel-h h3, .topbar .title h1, .topbar .title .sub { white-space: normal; overflow: visible; text-overflow: clip; overflow-wrap: anywhere; }
}

/* ================================================================== phones and portrait tablets (Lens switches at 900px too) */
@media (max-width: 900px) {
  /* iOS zooms into any focused field under 16px */
  input:not(.codein), select, textarea { font-size: max(16px, 1em) !important; }
  .page { padding: 14px max(14px, env(safe-area-inset-right)) calc(14px + env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left)); }
  .embed-head { padding: 14px 14px 0; } .embed-head h1 { font-size: 1.2rem; }
  .topbar { height: auto; min-height: var(--top-h); gap: 10px;
    padding: calc(8px + env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) 8px max(12px, env(safe-area-inset-left)); }
  .sidenav { padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom); }
  .topbar .title h1 { font-size: 1rem; line-height: 1.25; } .topbar .title .sub { font-size: .72rem; }
  .card-h, .card-b, .card-f { padding-left: 14px; padding-right: 14px; }
  .card-h > .grow:not(:empty) { flex: 1 1 100%; }   /* a card's title gets its own line; its buttons wrap below */
  .card-h > .grow:not(:empty) ~ .btn { flex: 1 1 auto; }
  .grid { gap: 10px; }
  .kpi { padding: 14px; } .kpi .v { font-size: 1.3rem; }
  .g4 > .kpi .ico { display: none; }   /* two KPI cards a row: the decorative icon gives way to the label */
  .g4 > .kpi .v { font-size: 1.15rem; }
  .callout { padding: 10px 12px; gap: 10px; }
  .hbar { grid-template-columns: minmax(84px, 40%) minmax(24px, 1fr) auto; gap: 8px; }
  /* forms and toolbars: fields full width, buttons share a row */
  .toolbar .searchbox, .toolbar .select, .filters .searchbox, .filters .select, .filters .input, .vtools .searchbox {
    flex: 1 1 100%; width: 100% !important; max-width: none !important; min-width: 0 !important; }
  .toolbar .btn, .filters .btn, .vtools .btn { flex: 1 1 auto; }
  .toolbar > .grow:empty, .filters > .grow:empty, .vtools > .grow:empty { display: none; }
  .row > .select, .row > .input { flex: 1 1 100%; max-width: none !important; }
  /* modals are bottom sheets; the big ones and drawers take the whole screen */
  .modal { padding: 0; align-items: flex-end; }
  .modal-box { width: 100%; max-height: calc(var(--vv-h) - 16px); border-radius: var(--radius) var(--radius) 0 0; border-bottom: 0; }
  .modal-box.lg { height: var(--vv-h); max-height: none; border-radius: 0; }
  .modal-h, .modal-b, .modal-f { padding-left: 16px; padding-right: 16px; }
  .modal-f .btn { flex: 1 1 0; }
  .modal-box > :last-child { padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
  .drawer { width: 100vw; border-left: 0; }
  .drawer-h, .drawer-b { padding-left: 16px; padding-right: 16px; }
  .drawer-b { padding-bottom: calc(40px + env(safe-area-inset-bottom)); }
  .toasts { left: 12px; right: 12px; max-width: none; top: calc(var(--vv-top) + var(--vv-h) - 12px - env(safe-area-inset-bottom)); }
  .toast { min-width: 0; max-width: none; }
  .pager { flex-wrap: wrap; }
  /* a side panel stacks above the page here; folded, it is a full-width header bar */
  .panel.collapsed { width: 100% !important; cursor: pointer; }
  .panel.collapsed .panel-h { flex-direction: row; padding: 4px 8px 4px 14px; }
  .panel.collapsed .panel-h h3 { display: block; }
  .panel.collapsed .vlabel { display: none; }
  .panel.at-left .collapse-toggle { order: 9; margin-left: auto; flex-shrink: 0; }
  .panel.at-left .collapse-toggle svg { transform: rotate(90deg); }
  .panel.at-left.collapsed .collapse-toggle svg { transform: rotate(-90deg); }

  /* key tables become stacked cards: one card per row, the column name beside each value.
     shell.js copies each column header onto its cells as data-label. */
  .table-wrap:has(> table.stack) { overflow: visible; background: none; }
  table.stack, table.stack > tbody, table.stack > tbody > tr { display: block; width: 100%; }
  table.stack > thead { display: none; }
  table.stack > tbody > tr { position: relative; padding: 10px 14px; border-bottom: 1px solid var(--line); }
  table.stack > tbody > tr:last-child { border-bottom: 0; }
  table.stack > tbody > tr.click:hover, table.stack > tbody > tr.sel { background: var(--surface-2); }
  table.stack > tbody > tr.sel { background: var(--primary-50); }
  table.stack > tbody > tr > td { display: grid; grid-template-columns: minmax(84px, 34%) minmax(0, 1fr); column-gap: 12px; row-gap: 0; align-items: start; justify-items: start;
    padding: 4px 0 !important; border: 0 !important; background: none !important; text-align: left !important; white-space: normal !important;
    overflow-wrap: anywhere; width: auto !important; max-width: none !important; min-height: 0; }
  table.stack > tbody > tr > td > .td-v { grid-column: 2; min-width: 0; max-width: 100%; }
  table.stack > tbody > tr > td::before { content: attr(data-label); grid-column: 1; padding-top: 3px; line-height: 1.35;
    font-size: 10.5px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); overflow-wrap: anywhere; }
  table.stack > tbody > tr > td:not([data-label]), table.stack > tbody > tr > td[colspan] { display: block; }
  table.stack > tbody > tr > td:not([data-label])::before, table.stack > tbody > tr > td[colspan]::before { content: none; }
  table.stack > tbody > tr > td:empty { display: none; }
  table.stack > tbody > tr > td.cb { position: absolute; top: 4px; right: 4px; padding: 0 !important; }
  table.stack > tbody > tr:has(> td.cb) { padding-right: 52px; }
  /* a table whose header holds the "select this page" box keeps just that box */
  /* people browser: the unlock buttons move under the person, the website form wraps */
  .pc { grid-template-columns: auto auto minmax(0, 1fr); }
  .pc-act { grid-column: 3; flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: flex-start; }
  .pc-act:empty { display: none; }
  .cx-site .row { flex-wrap: wrap !important; }
  .cx-site .row > * { flex: 1 1 100%; }
  .cx-pager > .btn { flex: 1 1 0; } .cx-pager > span { order: -1; flex: 1 1 100%; text-align: center; }
  table.stack.keep-head > thead { display: block; }
  table.stack.keep-head > thead > tr { display: flex; align-items: center; padding: 2px 14px; border-bottom: 1px solid var(--line); }
  table.stack.keep-head > thead > tr > th { display: none; }
  table.stack.keep-head > thead > tr > th.cb { display: flex; align-items: center; gap: 2px; position: static; width: auto; padding: 0; border: 0; background: none;
    font-size: .82rem; font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--ink-2); }
  table.stack.keep-head > thead > tr > th.cb::after { content: "Select this page"; }
  /* compact cards for long lists of short facts: each value sits after its label, the
     facts wrap like words, and a card is a few lines instead of one line per column */
  table.stack.compact > tbody > tr { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; }
  table.stack.compact > tbody > tr > td { display: inline-flex; align-items: baseline; gap: 6px; max-width: 100%; padding: 1px 0 !important; }
  table.stack.compact > tbody > tr > td::before { padding-top: 0; flex-shrink: 0; font-size: 9.5px; }
  table.stack.compact > tbody > tr > td > .td-v { min-width: 0; }
  table.stack.compact > tbody > tr > td.full { flex: 1 1 100%; }
}
