/* The pages' fonts, served by the site itself (Fontsource variable builds, SIL Open Font License 1.1,
 * see fonts/OFL.txt): Figtree, JetBrains Mono and Orbitron, latin and latin-ext. A browser downloads a file
 * only for the characters and styles a page shows. File names carry their content hash. */
@font-face{font-family:"Figtree";font-style:normal;font-display:swap;font-weight:300 900;src:url("/assets/figtree-latin-ext-normal-bf7828e2c2-DCwSJGxG.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:"Figtree";font-style:normal;font-display:swap;font-weight:300 900;src:url("/assets/figtree-latin-normal-4ba7d3d096-D_ZTVpCC.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:"Figtree";font-style:italic;font-display:swap;font-weight:300 900;src:url("/assets/figtree-latin-ext-italic-a0cc105b32-Q0qr0lrZ.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:"Figtree";font-style:italic;font-display:swap;font-weight:300 900;src:url("/assets/figtree-latin-italic-7242fa62d1-BEAWuiTz.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:"JetBrains Mono";font-style:normal;font-display:swap;font-weight:100 800;src:url("/assets/jetbrains-mono-latin-ext-normal-79bfdab9ba-DBQx-q_a.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:"JetBrains Mono";font-style:normal;font-display:swap;font-weight:100 800;src:url("/assets/jetbrains-mono-latin-normal-18be452724-B9CIFXIH.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:"Orbitron";font-style:normal;font-display:swap;font-weight:400 900;src:url("/assets/orbitron-latin-normal-c25a9f9da5-Du7j2Vp2.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}
/* Bootstrap Icons v1.11.3 (MIT, https://github.com/twbs/icons), only the icons the pages use:
 * built by scripts/subset-icons.py from vendor/bootstrap-icons. */
@font-face{font-display:block;font-family:bootstrap-icons;src:url("/assets/bootstrap-icons-6212990af6-B5MqfuDU.woff2") format("woff2")}.bi::before,[class*=" bi-"]::before,[class^=bi-]::before{display:inline-block;font-family:bootstrap-icons!important;font-style:normal;font-weight:400!important;font-variant:normal;text-transform:none;line-height:1;vertical-align:-.125em;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.bi-arrow-left-right::before{content:"\f12b"}.bi-arrow-repeat::before{content:"\f130"}.bi-box-arrow-right::before{content:"\f1c3"}.bi-broadcast::before{content:"\f1d6"}.bi-broadcast-pin::before{content:"\f1d5"}.bi-chat-dots-fill::before{content:"\f249"}.bi-check-lg::before{content:"\f633"}.bi-chevron-down::before{content:"\f282"}.bi-chevron-right::before{content:"\f285"}.bi-circle-half::before{content:"\f288"}.bi-clock-history::before{content:"\f292"}.bi-cloud-upload::before{content:"\f2c0"}.bi-copy::before{content:"\f759"}.bi-crosshair::before{content:"\f769"}.bi-dash-lg::before{content:"\f63b"}.bi-database::before{content:"\f8c4"}.bi-download::before{content:"\f30a"}.bi-exclamation-lg::before{content:"\f63c"}.bi-exclamation-triangle-fill::before{content:"\f33a"}.bi-geo-alt::before{content:"\f3e8"}.bi-globe::before{content:"\f3ee"}.bi-graph-up::before{content:"\f3f2"}.bi-grid-3x3-gap-fill::before{content:"\f3f8"}.bi-info-circle::before{content:"\f431"}.bi-info-lg::before{content:"\f646"}.bi-key::before{content:"\f44f"}.bi-layers::before{content:"\f45b"}.bi-list::before{content:"\f479"}.bi-moon::before{content:"\f497"}.bi-people-fill::before{content:"\f4cf"}.bi-person-circle::before{content:"\f4d7"}.bi-person-plus::before{content:"\f4dd"}.bi-phone::before{content:"\f4e7"}.bi-plus-lg::before{content:"\f64d"}.bi-reception-0::before{content:"\f510"}.bi-reception-1::before{content:"\f511"}.bi-reception-3::before{content:"\f513"}.bi-reception-4::before{content:"\f514"}.bi-rocket-takeoff::before{content:"\f845"}.bi-rss::before{content:"\f522"}.bi-search::before{content:"\f52a"}.bi-shield-check::before{content:"\f52f"}.bi-sliders::before{content:"\f56b"}.bi-sun::before{content:"\f5a2"}.bi-tag::before{content:"\f5b0"}.bi-thermometer-half::before{content:"\f5cd"}.bi-tools::before{content:"\f5db"}.bi-trash::before{content:"\f5de"}.bi-x-lg::before{content:"\f659"}/* #BEmesh colours: shared by the configurator, the map, stats and region map pages. Radio-Actief house style. */
:root {
  --gold: #d4a017;
  /* The open state of a bar button (☰, account): the same gold in both themes, as the bar is ink in both. */
  --topbar-open-ring: #d4a017;
  /* Gold as text: the dark shade on light backgrounds, where #d4a017 is too faint to read. */
  --gold-text: #7a5c00;
  --gold-bg: #fbf4dc;
  --ink: #1a202c;
  --mut: #64748b;
  /* Muted text on the cream --gold-bg: #64748b is 4.32:1 there, #4a5568 is 6.84:1. */
  --mut-on-gold-bg: #4a5568;
  --line: #e2e8f0;
  --ok: #1a7f37;
  --warn: #9a5b00;
  --bad: #c62828;
  --node: #1159af;
  --info-bg: #e8f0fe;
  --panel: #ffffff;
  --bar: #f7fafc;
  --page: #ffffff;
  --on-gold: #1f1600;
  --on-bad: #ffffff;
  --shadow: rgb(0 0 0 / 0.12);
  --backdrop: rgb(15 20 25 / 0.4);
  /* The command script and the console stay dark in both themes. */
  --code-bg: #12161f;
  --code-ink: #edf2f7;
  --code-mut: #a0aec0;
  --code-ok: #3fb950;
  --code-bad: #f85149;
  /* The top bar (Inktbalk) stays dark in both themes; its active tab is signal yellow. */
  --topbar-bg: #1a202c;
  --topbar-ink: #edf2f7;
  --topbar-mut: #a0aec0;
  --topbar-line: #2d3748;
  --topbar-control: #4a5568;
  --signal: #ffff00;
  /* Selected button in a segmented control: ink with signal yellow text. */
  --pressed-bg: #1a202c;
  --pressed-ink: #ffff00;
  --pressed-ring: transparent;
  --font-ui: "Figtree", system-ui, sans-serif;
  --font-display: "Orbitron", "Figtree", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  /* Glass: panels, popups and menus floating over the map. These opacities are the measured
   * minimum for readable text over any map background: never lower them. */
  --glass: rgb(255 255 255 / 0.82);
  --glass-bar: rgb(26 32 44 / 0.86);
  --glass-line: rgb(26 32 44 / 0.12);
  --glass-shadow: 0 8px 24px rgb(26 32 44 / 0.12), inset 0 1px 0 rgb(255 255 255 / 0.6);
  --glass-blur: blur(14px) saturate(140%);
  /* On glass the usual muted and link colours are too faint. */
  --glass-mut: #4a5568;
  --glass-link: #0d3c74;
  /* States: keyboard focus ring, primary button hover, field borders (--line is too faint for inputs). */
  --focus: #1159af;
  --gold-hover: #b8890f;
  --field-line: #64748b;
  /* The 2px rim around a single node on the map. */
  --node-rim: #1a202c;
  --dur: 150ms;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --gold-text: #d4a017;
    --gold-bg: #3a2f10;
    --ink: #edf2f7;
    --mut: #a0aec0;
    --mut-on-gold-bg: #a0aec0;
    --line: #2d3748;
    --ok: #3fb950;
    --warn: #d29922;
    --bad: #f85149;
    --on-bad: #12161f;
    --node: #63b3ed;
    --info-bg: #132a46;
    --panel: #1a202c;
    --bar: #12161f;
    --page: #12161f;
    --shadow: rgb(0 0 0 / 0.5);
    --backdrop: rgb(0 0 0 / 0.6);
    /* The ink button sits on an ink panel here, so it gets a 1px gold ring; the 2px yellow ring is focus only. */
    --pressed-ring: #d4a017;
    --glass: rgb(26 32 44 / 0.82);
    --glass-line: rgb(237 242 247 / 0.14);
    --glass-shadow: 0 8px 24px rgb(0 0 0 / 0.45), inset 0 1px 0 rgb(237 242 247 / 0.08);
    --glass-mut: #cbd5e0;
    --glass-link: #90cdf4;
    --focus: #ffff00;
    --field-line: #a0aec0;
    --node-rim: #edf2f7;
  }
}

:root[data-theme="light"] {
  color-scheme: light;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --gold-text: #d4a017;
  --gold-bg: #3a2f10;
  --ink: #edf2f7;
  --mut: #a0aec0;
  --mut-on-gold-bg: #a0aec0;
  --line: #2d3748;
  --ok: #3fb950;
  --warn: #d29922;
  --bad: #f85149;
  --on-bad: #12161f;
  --node: #63b3ed;
  --info-bg: #132a46;
  --panel: #1a202c;
  --bar: #12161f;
  --page: #12161f;
  --shadow: rgb(0 0 0 / 0.5);
  --backdrop: rgb(0 0 0 / 0.6);
  --pressed-ring: #d4a017;
  --glass: rgb(26 32 44 / 0.82);
  --glass-line: rgb(237 242 247 / 0.14);
  --glass-shadow: 0 8px 24px rgb(0 0 0 / 0.45), inset 0 1px 0 rgb(237 242 247 / 0.08);
  --glass-mut: #cbd5e0;
  --glass-link: #90cdf4;
  --focus: #ffff00;
  --field-line: #a0aec0;
  --node-rim: #edf2f7;
}

/* The theme's own surface colours, kept for the menus that open from the dark top bar. */
:root {
  --theme-panel: var(--panel);
  --theme-ink: var(--ink);
  --theme-mut: var(--mut);
  --theme-line: var(--line);
  --theme-bar: var(--bar);
  --theme-gold-bg: var(--gold-bg);
  --theme-gold-text: var(--gold-text);
  --theme-focus: var(--focus);
  --theme-field-line: var(--field-line);
}
/* #BEmesh shell: the top bar, page switcher, chips, buttons, cards and fields shared by the configurator and the tool pages. Colours come from bemesh-tokens.css. */

* {
  box-sizing: border-box;
}

/* Body text 13/18; a ratio, so larger text inside keeps a fitting line height. */
body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 13px;
  line-height: calc(18 / 13);
}

/* Keys, call signs and commands. */
code,
kbd,
samp,
.mono {
  font-family: var(--font-mono);
}

button {
  font: inherit;
  font-size: inherit;
  color: inherit;
}

/* The ink bar: one row of 44px (the 1px line included) at every width. What doesn't fit moves into
 * the ☰ menu: the switcher, account and language below 1024px (bemesh-shell.css, each page's own css). */
.topbar {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding: 0 12px;
  background: var(--topbar-bg);
  color: var(--topbar-ink);
  border-bottom: 1px solid var(--topbar-line);
  flex-wrap: nowrap;
  flex-shrink: 0;
  font-size: 12px;
  line-height: 16px;
  /* Chips, icons and switches on the bar take the bar's dark colours in both themes. */
  --panel: transparent;
  --ink: var(--topbar-ink);
  --mut: var(--topbar-mut);
  --line: var(--topbar-control);
  --bar: var(--topbar-line);
  /* Open, hovered and "on" controls: the dark gold, so the light bar text stays readable. */
  --gold-bg: #3a2f10;
  --gold-text: var(--gold);
  /* Focus ring and field borders on the bar. */
  --focus: var(--signal);
  --field-line: var(--topbar-mut);
  /* Above every Leaflet pane (up to 1000), so the ☰ menu and other top bar dropdowns open over the map. */
  position: relative;
  z-index: 1100;
}

.wordmark {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 14px;
  flex-shrink: 0;
  white-space: nowrap;
}

.wordmark b {
  color: var(--gold-text);
}

.topbar .wordmark b {
  color: var(--signal);
}

/* Menus that open from the top bar keep the theme's own colours. */
.topbar .menu {
  --panel: var(--theme-panel);
  --ink: var(--theme-ink);
  --mut: var(--theme-mut);
  --line: var(--theme-line);
  --bar: var(--theme-bar);
  --gold-bg: var(--theme-gold-bg);
  --gold-text: var(--theme-gold-text);
  --focus: var(--theme-focus);
  --field-line: var(--theme-field-line);
  color: var(--ink);
}

/* The switcher starts at the same x (212px) in every tool. */
@media (min-width: 1024px) {
  .topbar .wordmark {
    min-width: 192px;
  }
}

/* Phone: 13px, the same "#BEmesh <page>" text; on a very narrow screen it ends in "…" rather than
 * pushing the buttons off the bar. */
@media (max-width: 600px) {
  .topbar .wordmark {
    flex-shrink: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 13px;
  }
}

.spacer {
  flex: 1;
}

/* The account chip and language switch mount into these; the wrappers take no gap of their own. */
.topbar > [data-account-chip],
.topbar > [data-lang-switch] {
  display: contents;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--panel);
  border: 1px solid var(--line);
  font-size: 12px;
  white-space: nowrap;
  min-width: 0;
}

/* Text controls on the bar: Figtree 12/16, 24px high. */
.topbar .chip {
  height: 24px;
  padding: 0 10px;
  line-height: 16px;
}

.icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel);
  cursor: pointer;
}

.icon.on {
  background: var(--gold-bg);
  border-color: var(--gold);
}

/* Icon buttons on the bar: a 28px frame around a 16px Bootstrap icon, and a larger hit area
 * around the frame (32px, 44px on a phone) that takes no room in the row. */
.topbar .icon {
  position: relative;
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
  padding: 0;
  color: var(--topbar-ink);
  font-size: 16px;
  line-height: 1;
}

.topbar .icon .bi::before {
  vertical-align: 0;
}

.topbar .icon::after {
  content: "";
  position: absolute;
  inset: -3px;
}

/* Phone: 44px hit areas that meet but don't overlap; the frames sit 16px apart. */
@media (max-width: 600px) {
  .topbar .icon {
    margin: 0 4px;
  }

  .topbar .icon::after {
    inset: -9px;
  }
}

.btn {
  white-space: nowrap;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel);
  cursor: pointer;
}

.btn.primary {
  background: var(--gold);
  border-color: var(--gold);
  color: var(--on-gold);
  font-weight: 700;
}

.btn:disabled,
.btn[aria-disabled="true"] {
  background: var(--bar);
  border-color: var(--line);
  color: var(--mut);
  cursor: not-allowed;
}

.btn.small {
  padding: 3px 8px;
  font-size: 12px;
}

.segmented {
  display: flex;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.segmented button {
  flex: 1;
  padding: 6px 4px;
  border: 0;
  border-left: 1px solid var(--line);
  background: var(--panel);
  cursor: pointer;
  font-size: 12px;
  white-space: nowrap;
}

.segmented button:first-child {
  border-left: 0;
}

.segmented button[aria-pressed="true"] {
  /* Ink fill: the focus ring is yellow, in both themes. */
  --focus: var(--signal);
  background: var(--pressed-bg);
  color: var(--pressed-ink);
  font-weight: 700;
  box-shadow: inset 0 0 0 1px var(--pressed-ring);
}

.switcher {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
}

.switcher a {
  padding: 4px 10px;
  line-height: 16px;
  border-left: 1px solid var(--line);
  background: var(--panel);
  color: inherit;
  font-size: 12px;
  text-decoration: none;
  white-space: nowrap;
}

.switcher a:first-child {
  border-left: 0;
}

.switcher a:hover {
  background: var(--gold-bg);
}

.switcher a[aria-current="page"],
.switcher a[aria-current="page"]:hover {
  background: var(--signal);
  color: var(--topbar-bg);
  font-weight: 700;
}

/* Phone and tablet: each page shows these links in its ☰ menu instead. */
@media (max-width: 1023px) {
  .switcher {
    display: none;
  }
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.card h2 {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 8px;
  font-size: 14px;
}

.muted {
  color: var(--mut);
}

.input {
  width: 100%;
  padding: 7px 9px;
  border: 1px solid var(--field-line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  font: inherit;
}

.input::placeholder {
  color: var(--mut);
}

/* A dropdown opened from a top bar icon or chip (☰, download, filters). */
.menu {
  position: absolute;
  z-index: 1000;
  min-width: 200px;
  padding: 6px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 6px 20px var(--shadow);
}

.menu a,
.menu button {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 6px 8px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.menu a:hover,
.menu button:hover {
  background: var(--gold-bg);
}

/* Log out is a small form (a POST); it takes no room of its own. */
.menu-logout {
  margin: 0;
}

.menu hr {
  margin: 4px 0;
  border: 0;
  border-top: 1px solid var(--line);
}

.menu-wrap {
  position: relative;
  display: inline-flex;
  flex-shrink: 0;
}

/* Right-aligned under its button, just below the bar; menu-place.js keeps it inside the window. */
.menu-wrap .menu {
  top: calc(100% + 12px);
  right: 0;
}

/* The ☰ menu: the same in every #BEmesh tool. Rows of Figtree 13/18, 32px high (44px on a phone). */
.page-menu {
  width: 220px;
  max-width: calc(100vw - 16px);
  max-height: calc(100vh - 56px);
  max-height: calc(100dvh - 56px);
  overflow-y: auto;
  /* A swipe that reaches the end of the menu stops there instead of scrolling the page. */
  overscroll-behavior: contain;
  font-size: 13px;
  line-height: 18px;
  font-weight: 400;
}

.page-menu a,
.page-menu > button,
.page-menu .menu-logout button {
  min-height: 32px;
  padding: 7px 8px;
  white-space: normal;
}

.page-menu .menu-user {
  min-height: 32px;
  align-items: flex-start;
}

.page-menu .menu-check {
  margin-left: auto;
  font-size: 16px;
}

.page-menu .lang-switch button {
  min-height: 32px;
}

.menu[hidden] {
  display: none;
}

.menu a[aria-current="page"] {
  background: var(--gold-bg);
  font-weight: 700;
}

.menu a {
  white-space: nowrap;
}

.menu .ext {
  margin-left: auto;
  padding-left: 12px;
}

/* The account group's first row: the name as Discord shows it, the @handle under it. */
.menu-user {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 6px 8px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.menu-handle {
  font-size: 12px;
  line-height: 16px;
  font-weight: 400;
  color: var(--mut);
}

/* The claimed-node count on My nodes (the map knows it), right-aligned. */
.menu-mynodes {
  margin-left: auto;
  padding-left: 12px;
  font-weight: 400;
  color: var(--mut);
}

.menu-mynodes[hidden] {
  display: none;
}

/* The tools are in the ☰ menu on a phone and a tablet only (the bar's switcher shows them on a computer). */
.menu .menu-page {
  display: none;
}

@media (max-width: 1023px) {
  .menu .menu-page {
    display: flex;
  }

  .menu hr.menu-page {
    display: block;
  }

  /* Sign in is in the ☰ menu here. */
  .topbar .signin-chip {
    display: none;
  }
}

@media (max-width: 600px) {
  /* Every row is a 44px tap target on a phone; a long menu scrolls instead of running off screen. */
  .menu a,
  .menu button,
  .page-menu a,
  .page-menu > button,
  .page-menu .menu-logout button,
  .page-menu .menu-user,
  .page-menu .lang-switch button {
    min-height: 44px;
  }

  .menu {
    max-height: calc(100dvh - 56px);
    overflow-y: auto;
    overscroll-behavior: contain;
  }
}

/* EN · NL · FR in the top bar; on a phone and a tablet it moves into the ☰ menu. The selected
 * language is light on ink, never yellow: the current tool is the bar's only yellow block. */
.lang-switch {
  display: inline-flex;
  flex-shrink: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.lang-switch button {
  height: 24px;
  padding: 5px 7px;
  border: 0;
  border-left: 1px solid var(--line);
  background: var(--panel);
  font-size: 11px;
  line-height: 14px;
  font-weight: 600;
  cursor: pointer;
}

.lang-switch button:first-child {
  border-left: 0;
}

.lang-switch button:hover {
  background: var(--gold-bg);
}

.lang-switch button[aria-pressed="true"],
.lang-switch button[aria-pressed="true"]:hover {
  background: var(--topbar-ink);
  color: var(--topbar-bg);
  font-weight: 700;
}

.menu .lang-switch,
.menu hr.menu-lang {
  display: none;
}

.menu .lang-switch {
  margin: 2px 8px 4px;
}

.menu .lang-switch button {
  flex: 1;
  justify-content: center;
  width: auto;
  height: auto;
  padding: 6px 8px;
  border-radius: 0;
  border-left: 1px solid var(--line);
}

.menu .lang-switch button:first-child {
  border-left: 0;
}

/* In the menu: ink on the light glass, light in dark; never yellow. */
.menu .lang-switch button[aria-pressed="true"],
.menu .lang-switch button[aria-pressed="true"]:hover {
  background: var(--ink);
  color: var(--panel);
}

@media (max-width: 1023px) {
  .topbar .lang-switch:not(.menu-lang) {
    display: none;
  }

  .menu .lang-switch {
    display: flex;
  }

  .menu hr.menu-lang {
    display: block;
  }
}

.signin-chip {
  color: inherit;
  text-decoration: none;
}

.signin-chip:hover {
  background: var(--gold-bg);
  border-color: var(--gold);
}

/* The sign-in chip: below 1280 px it is a framed icon button in the same place, on every page. */
.signin-chip .bi {
  display: none;
}

@media (max-width: 1279px) {
  .topbar .signin-chip {
    width: 28px;
    height: 28px;
    padding: 0;
    justify-content: center;
    border-radius: 8px;
    border: 1px solid #4a5568;
    position: relative;
  }
  .topbar .signin-chip .signin-text {
    display: none;
  }
  .topbar .signin-chip .bi {
    display: inline-block;
    font-size: 16px;
    color: #edf2f7;
  }
}

/* Signed in: the account button in the sign-in chip's place. A 28px circle with the person's
 * initial, light on the ink bar (never yellow: the current tool is the bar's only yellow block), in
 * the icon buttons' hit area (32px, 44px on a phone). On a phone the account is in ☰ only. */
.topbar .account-btn {
  border-radius: 50%;
  border-color: var(--topbar-ink);
  background: var(--topbar-ink);
  color: var(--topbar-bg);
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 700;
}

/* Open: the disc keeps its own colours, with the pressed ring of an ink control on ink (1px gold,
 * as --pressed-ring is wherever the ink button sits on ink; the bar is ink in both themes). */
.topbar .account-btn[aria-expanded="true"],
.topbar .icon[aria-expanded="true"] {
  box-shadow: 0 0 0 1px var(--topbar-open-ring);
}

.account-initial {
  line-height: 1;
}

@media (max-width: 600px) {
  .topbar .account-wrap {
    display: none;
  }
}

/* A panel floating on a Leaflet map. */
.map-float {
  position: absolute;
  z-index: 800;
  background: var(--panel);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 2px 8px var(--shadow);
}

/* Leaflet's zoom buttons, credit line and labels take the page font; the credit line is 11px, the
 * smallest text the tools use. body: the configurator loads leaflet.css after this file. */
body .leaflet-container {
  font-family: var(--font-ui);
}

body .leaflet-container .leaflet-control-attribution {
  font-size: 11px;
  line-height: 14px;
}

/* Leaflet chrome follows the theme (load leaflet.css before this file). */
.leaflet-popup-content-wrapper,
.leaflet-popup-tip,
.leaflet-tooltip {
  background: var(--panel);
  color: var(--ink);
  border: 1px solid var(--line);
  box-shadow: 0 2px 8px var(--shadow);
}

.leaflet-tooltip-top::before,
.leaflet-tooltip-bottom::before,
.leaflet-tooltip-left::before,
.leaflet-tooltip-right::before {
  border-color: transparent;
}

.leaflet-container a.leaflet-popup-close-button {
  color: var(--mut);
}

.leaflet-bar {
  border: 1px solid var(--line);
  box-shadow: 0 2px 8px var(--shadow);
}

/* .leaflet-container: the configurator loads leaflet.css after this file, so plain .leaflet-bar a would lose. */
.leaflet-container .leaflet-bar a,
.leaflet-container .leaflet-bar a.leaflet-disabled {
  background: var(--panel);
  color: var(--ink);
  border-bottom-color: var(--line);
}

.leaflet-container .leaflet-bar a:hover {
  background: var(--gold-bg);
}

.leaflet-container .leaflet-bar a.leaflet-disabled {
  opacity: 0.5;
}

/* The map's credit line: solid, so its text and focus ring read over any tile.
 * .leaflet-control: the configurator loads leaflet.css after this file, so a tie would lose. */
.leaflet-container .leaflet-control-attribution.leaflet-control {
  background: var(--panel);
  color: var(--ink);
}

.leaflet-container .leaflet-control-attribution a {
  color: var(--node);
}

/* Dark map tiles: the OpenStreetMap layer only. Markers, polygons, popups and controls follow the tokens. */
.map-dark .osm-tiles {
  filter: invert(1) hue-rotate(180deg) brightness(0.95) contrast(0.9) saturate(0.7);
}

.leaflet-bar a.map-shade-button {
  width: 36px;
  height: 36px;
  line-height: 36px;
  font-size: 18px;
  text-decoration: none;
}

/* The ☰ menu's About box (src/shared/about.js). */
.about-dialog {
  width: min(440px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 10px 30px var(--shadow);
  overflow-y: auto;
  overflow-wrap: anywhere;
}

.about-dialog::backdrop {
  background: rgb(0 0 0 / 0.35);
}

.about-dialog h2 {
  margin: 0 0 4px;
  font-size: 17px;
}

.about-dialog h3 {
  margin: 14px 0 4px;
  font-size: 14px;
}

.about-dialog h4 {
  margin: 10px 0 2px;
  font-size: 13px;
  color: var(--mut);
}

.about-dialog p,
.about-dialog li {
  font-size: 13px;
  line-height: 1.45;
}

.about-dialog p {
  margin: 4px 0;
}

.about-dialog ul {
  margin: 2px 0 0;
  padding-left: 18px;
}

.about-dialog .sub {
  color: var(--mut);
}

.about-facts {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px 12px;
  margin: 12px 0 0;
  font-size: 13px;
}

.about-facts dt {
  color: var(--mut);
}

.about-facts dd {
  margin: 0;
  font-weight: 600;
}

.about-links {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  margin-top: 14px !important;
}

.about-links a {
  color: inherit;
}

.about-error {
  color: var(--bad, #c0392b);
}

.about-foot {
  display: flex;
  justify-content: flex-end;
  margin-top: 14px;
}

/* Close on the glass box: no fill of its own, a field border. */
.about-dialog .about-foot .btn {
  background: transparent;
  border-color: var(--field-line);
}

/* Map clusters: gold with an ink rim, in both themes. */
.marker-cluster-small,
.marker-cluster-medium,
.marker-cluster-large {
  background-color: rgb(212 160 23 / 0.35);
}

.marker-cluster-small div,
.marker-cluster-medium div,
.marker-cluster-large div {
  background-color: var(--gold);
  box-shadow: 0 0 0 2px var(--topbar-bg);
}

.marker-cluster span {
  color: var(--on-gold);
}

/* Glass: what floats over the map (search, filters, legends, popups, tooltips, dropdowns, menus and
 * dialogs). Never on fields, tables, code, content cards or anything yellow, and never glass on glass.
 * The top bar stays solid ink: nothing scrolls under it on these pages. */
.glass,
.map-float,
.menu,
.about-dialog,
.leaflet-container .leaflet-popup-content-wrapper,
.leaflet-container .leaflet-popup-tip,
.leaflet-container .leaflet-tooltip,
.bemesh-popup .maplibregl-popup-content,
.bemesh-popup .maplibregl-popup-tip {
  background: var(--glass);
  border-color: var(--glass-line);
  box-shadow: var(--glass-shadow);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  color: var(--ink);
  /* The usual muted and link colours are too faint on glass. */
  --mut: var(--glass-mut);
  --node: var(--glass-link);
}

.map-float,
.menu,
.about-dialog,
.leaflet-container .leaflet-popup-content-wrapper,
.bemesh-popup .maplibregl-popup-content {
  border-radius: 8px;
}

/* Menus that open from the top bar: glass in the theme's colours. */
.topbar .menu {
  --mut: var(--glass-mut);
}

/* No backdrop-filter, or the visitor asked for less transparency: solid panels. */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .glass,
  .map-float,
  .menu,
  .about-dialog,
  .leaflet-container .leaflet-popup-content-wrapper,
  .leaflet-container .leaflet-popup-tip,
  .leaflet-container .leaflet-tooltip,
  .bemesh-popup .maplibregl-popup-content,
  .bemesh-popup .maplibregl-popup-tip {
    background: var(--panel);
  }
}

@media (prefers-reduced-transparency: reduce) {
  .glass,
  .map-float,
  .menu,
  .about-dialog,
  .leaflet-container .leaflet-popup-content-wrapper,
  .leaflet-container .leaflet-popup-tip,
  .leaflet-container .leaflet-tooltip,
  .bemesh-popup .maplibregl-popup-content,
  .bemesh-popup .maplibregl-popup-tip {
    background: var(--panel);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
}

/* Keyboard focus: always visible. Blue on light, yellow in dark and on the bar, ink on yellow. */
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

/* Inside a clipped group the ring goes inside, or the group would cut it off. */
.segmented button:focus-visible,
.switcher a:focus-visible,
.lang-switch button:focus-visible,
.leaflet-container .leaflet-bar a:focus-visible {
  outline-offset: -2px;
}

.switcher a[aria-current="page"]:focus-visible,
.lang-switch button[aria-pressed="true"]:focus-visible {
  outline-color: var(--topbar-bg);
}

.menu .lang-switch button[aria-pressed="true"]:focus-visible {
  outline-color: var(--panel);
}

/* Hover: pale gold with a gold rim in the work area; the dark gold on the bar (set on .topbar).
 * Only with a real pointer: on a touch screen the hover look would stick after a tap. */
@media (hover: hover) {
  .btn:hover:not(:disabled, [aria-disabled="true"]),
  .icon:hover,
  .signin-chip:hover {
    background: var(--gold-bg);
    border-color: var(--gold);
  }

  /* No gold fill on the disc: only its rim turns gold. */
  .topbar .account-btn:hover {
    background: var(--topbar-ink);
    border-color: var(--gold);
  }

  .btn.primary:hover:not(:disabled, [aria-disabled="true"]) {
    background: var(--gold-hover);
    border-color: var(--gold-hover);
    color: var(--on-gold);
  }

  .segmented button:hover:not([aria-pressed="true"]) {
    background: var(--gold-bg);
  }
}

/* Colour and border fade; the layout never moves. */
.btn,
.icon,
.chip,
.input,
.switcher a,
.lang-switch button,
.segmented button,
.menu a,
.menu button,
.leaflet-container .leaflet-bar a {
  transition:
    background-color var(--dur) ease-out,
    border-color var(--dur) ease-out,
    color var(--dur) ease-out;
}

@media (prefers-reduced-motion: reduce) {
  .btn,
  .icon,
  .chip,
  .input,
  .switcher a,
  .lang-switch button,
  .segmented button,
  .menu a,
  .menu button,
  .leaflet-container .leaflet-bar a {
    transition: none;
  }
}

/* Fields: 16px text on a phone, or iOS zooms in on the field and the page stays zoomed. A floor
 * for every field on every page, so it outranks each page's own (smaller) field sizes. Pinch zoom
 * stays allowed: the viewport tag has no maximum-scale. */
@media (max-width: 600px) {
  input:not([type="checkbox"], [type="radio"], [type="range"], [type="hidden"], [type="color"], [type="file"]),
  select,
  textarea {
    font-size: 16px !important;
  }
}

/* A single node on the map: a 2px rim, dark on light and light in dark, so it reads on any tile. */
.node-icon {
  border-radius: 50%;
  box-shadow: 0 0 0 2px var(--node-rim);
}

/* /auth/signout and /auth/failed: the site's top bar, then one card in the middle of the page. */
.signout-page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}
.signout-main {
  flex: 1;
  display: grid;
  place-items: center;
  padding: 16px;
}
.signout {
  box-sizing: border-box;
  width: 100%;
  max-width: 28rem;
  padding: 24px;
}
.signout h1 {
  margin: 0 0 8px;
  font-size: 1.25rem;
}
/* The partner's address under the consent page's title. */
.signout .signout-host {
  margin: -4px 0 12px;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 16px;
  color: var(--mut);
  overflow-wrap: anywhere;
}
.signout-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}
.signout-actions form {
  margin: 0;
}
.signout-actions a.btn {
  color: var(--ink);
  font: inherit;
  text-decoration: none;
}
.signout-actions a.btn.primary {
  font-weight: 700;
  color: var(--on-gold);
}
.signout-actions .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  box-sizing: border-box;
  font: inherit;
}
.signout-actions .btn.primary {
  font-weight: 700;
}
@media (max-width: 600px) {
  .signout-actions .btn {
    min-height: 44px;
  }
}

/* A short word after something happened (logged out): a snackbar on ink, bottom centre, for 6 s,
 * like the map's notice when a map style can't load. */
.bemesh-toast {
  position: fixed;
  z-index: 2000;
  left: 50%;
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  width: max-content;
  max-width: calc(100% - 32px);
  box-sizing: border-box;
  padding: 10px 14px;
  background: var(--topbar-bg);
  color: var(--topbar-ink);
  border-radius: 8px;
  box-shadow: 0 4px 16px var(--shadow);
  font: 13px/18px var(--font-ui);
}
.bemesh-toast .bi {
  flex: none;
  font-size: 16px;
}
.bemesh-toast[hidden] {
  display: none;
}
@media (max-width: 600px) {
  .bemesh-toast {
    bottom: calc(84px + env(safe-area-inset-bottom, 0px));
  }
}
/* The maps of the tool pages (src/map-engine/: MapLibre, or Leaflet without WebGL): their controls,
 * popups, credit line, notices and focus ring, the same on the map page, the region map and the
 * configurator. The engine marks its container .bemesh-map. Colours come from bemesh-tokens.css. */

/* Map controls, bottom left (both engines): 36px glass buttons with 16px icons in ink, +/- in one
 * frame with a 1px divider; 44px hit areas on a phone. The MapLibre ones are .map-ctrl (below). */
.bemesh-map .leaflet-bottom.leaflet-left {
  display: flex;
  flex-direction: column;
  /* Each control keeps its own width; an open layers panel must not stretch the zoom bar. */
  align-items: flex-start;
  gap: 6px;
  bottom: calc(10px + var(--map-safe-bottom, 0px));
  left: max(10px, env(safe-area-inset-left, 0px));
}

.bemesh-map .leaflet-bottom.leaflet-left .leaflet-control {
  flex-shrink: 0;
  margin: 0 !important;
}

.bemesh-map .leaflet-control-container .leaflet-bar,
.bemesh-map .leaflet-control-container .leaflet-control-layers,
.map-ctrl {
  background: var(--glass) !important;
  color: var(--ink);
  border: 1px solid var(--glass-line) !important;
  border-radius: 8px;
  box-shadow: var(--glass-shadow);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
}

.bemesh-map .leaflet-control-container .leaflet-bar a,
.map-ctrl--bar button,
.map-basemap__toggle,
.bemesh-map .leaflet-control-layers-toggle {
  position: relative;
  display: grid !important;
  place-items: center;
  width: 36px !important;
  height: 36px !important;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent !important;
  background-image: none !important;
  color: var(--ink) !important;
  font-size: 16px !important;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  transition: background-color var(--dur) ease-out;
}

.bemesh-map .leaflet-control-container .leaflet-bar a:first-child,
.map-ctrl--bar button:first-child {
  border-radius: 7px 7px 0 0;
}

.bemesh-map .leaflet-control-container .leaflet-bar a:last-child,
.map-ctrl--bar button:last-child,
.map-basemap__toggle,
.bemesh-map .leaflet-control-layers-toggle {
  border-radius: 0 0 7px 7px;
}

.bemesh-map .leaflet-control-container .leaflet-bar a:only-child,
.map-ctrl--bar button:only-child,
.map-basemap:not(.open) .map-basemap__toggle,
.bemesh-map .leaflet-control-layers-toggle {
  border-radius: 7px;
}

.bemesh-map .leaflet-control-container .leaflet-bar a + a,
.map-ctrl--bar button + button {
  border-top: 1px solid var(--glass-line) !important;
}

.bemesh-map .leaflet-control-container .leaflet-bar a.leaflet-disabled,
.map-ctrl--bar button:disabled {
  opacity: 0.5;
  cursor: default;
}

@media (hover: hover) {
  .bemesh-map .leaflet-control-container .leaflet-bar a:hover:not(.leaflet-disabled),
  .map-ctrl--bar button:hover:not(:disabled),
  .map-basemap__toggle:hover,
  .bemesh-map .leaflet-control-layers-toggle:hover {
    background: var(--gold-bg) !important;
  }
}

.bemesh-map .leaflet-control-container .leaflet-bar a:focus-visible,
.map-ctrl button:focus-visible {
  outline-offset: -2px;
}

/* No backdrop-filter, or less transparency asked for: solid controls. */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .bemesh-map .leaflet-control-container .leaflet-bar,
  .bemesh-map .leaflet-control-container .leaflet-control-layers,
  .map-ctrl {
    background: var(--panel) !important;
  }
}

@media (prefers-reduced-transparency: reduce) {
  .bemesh-map .leaflet-control-container .leaflet-bar,
  .bemesh-map .leaflet-control-container .leaflet-control-layers,
  .map-ctrl {
    background: var(--panel) !important;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
}

/* A phone: 44px hit areas around the 36px buttons (outwards only, so neighbours don't overlap) */
@media (max-width: 600px), (pointer: coarse) {
  .bemesh-map .leaflet-bottom.leaflet-left,
  .map-ctrls {
    gap: 10px;
  }

  .bemesh-map .leaflet-control-container .leaflet-bar a::after,
  .map-ctrl--bar button::after,
  .map-basemap__toggle::after,
  .bemesh-map .leaflet-control-layers-toggle::after {
    content: "";
    position: absolute;
    inset: 0 -4px;
  }

  .bemesh-map .leaflet-control-container .leaflet-bar a:first-child::after,
  .map-ctrl--bar button:first-child::after {
    top: -4px;
  }

  .bemesh-map .leaflet-control-container .leaflet-bar a:last-child::after,
  .map-ctrl--bar button:last-child::after,
  .map-basemap__toggle::after,
  .bemesh-map .leaflet-control-layers-toggle::after {
    bottom: -4px;
  }
}

.leaflet-control-layers.leaflet-control-layers-expanded {
  padding: 6px 10px !important;
}

.leaflet-control-layers label {
  font-family: var(--app-font-body);
  color: var(--ink);
}

.leaflet-control-layers-separator {
  border-top-color: var(--glass-line);
}

.leaflet-control-layers-list {
  margin-block-start: 0 !important;
}

.leaflet-bottom.leaflet-right {
  margin-right: max(0px, env(safe-area-inset-right, 0px));
  margin-bottom: var(--map-safe-bottom, 0px);
  z-index: 1000 !important;
}

/* The MapLibre map (src/map-engine/maplibre-engine.js): its chrome in the look of the Leaflet map's.
 * Until the engine is in, the map's area shows the page background. */
.bemesh-map {
  background: var(--page);
}
/* Around the globe (the map page, zoomed out): ink in both themes */
.bemesh-map.bemesh-map--space {
  background: var(--code-bg);
}

.bemesh-map.maplibregl-map {
  font-family: var(--font-ui);
}

/* Popups: the Leaflet card's frame (glass from bemesh-shell.css) */
.maplibregl-popup.bemesh-popup {
  z-index: 5;
  max-width: none !important;
}

.bemesh-popup .maplibregl-popup-content {
  padding: 0;
  border: 1px solid var(--glass-line);
  overflow: visible;
  /* Leaflet's popup text size and line height, which the card's own sizes build on */
  font: 13px/1.3 var(--font-ui);
}

/* The tip: a glass triangle (the content's border would show through a translucent square) */
.bemesh-popup .maplibregl-popup-tip {
  width: 20px;
  height: 10px;
  border: 0;
  box-shadow: none;
  clip-path: polygon(0 0, 100% 0, 50% 100%);
}

.bemesh-popup.maplibregl-popup-anchor-top .maplibregl-popup-tip {
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
}

.bemesh-popup .maplibregl-popup-close-button {
  z-index: 2;
  top: 4px;
  right: 4px;
  padding: 4px 8px;
  border-radius: 6px;
  color: var(--app-text-muted, #57534e);
  font: 22px/1 var(--font-ui);
}

.bemesh-popup .maplibregl-popup-close-button:hover {
  background: transparent;
  color: var(--app-text, #1a1917);
}

/* Controls, bottom left (or top right, where a panel covers the left): map shade, zoom, base map
 * (as the Leaflet map's stack; their look is
 * with the Leaflet controls' above) */
.map-ctrls {
  position: absolute;
  z-index: 2;
  left: max(10px, env(safe-area-inset-left, 0px));
  bottom: calc(10px + var(--map-safe-bottom, 0px));
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

.map-ctrls--top-right {
  top: 10px;
  right: max(10px, env(safe-area-inset-right, 0px));
  bottom: auto;
  left: auto;
  align-items: flex-end;
}

.bemesh-map .leaflet-top.leaflet-right .leaflet-control {
  margin: 0 0 6px 0;
}

/* The style host is down: a small ⚠ on the base map button */
.map-basemap__warn {
  display: none;
}

.map-basemap__toggle--down .map-basemap__warn {
  display: block;
  position: absolute;
  top: 1px;
  right: 1px;
  color: var(--warn);
  font-size: 10px;
}

/* The base map list opens above its button */
.map-basemap {
  display: flex;
  flex-direction: column-reverse;
}

.map-basemap__list {
  display: grid;
  gap: 4px;
  min-width: 150px;
  margin: 0;
  padding: 6px 10px 8px;
  border: 0;
  border-bottom: 1px solid var(--line);
}

.map-basemap__list[hidden] {
  display: none;
}

.map-basemap__list legend {
  float: left;
  width: 100%;
  margin: 0 0 2px;
  padding: 0;
  color: var(--mut);
  font-size: 11px;
}

.map-basemap__list label {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  cursor: pointer;
  font-family: var(--app-font-body);
}

/* The credit line: solid, 11px, as on the Leaflet map (above MapLibre's own rule also where its
   stylesheet loads after this one, as in the configurator) */
.bemesh-map .maplibregl-ctrl-bottom-right {
  margin-right: max(0px, env(safe-area-inset-right, 0px));
  margin-bottom: var(--map-safe-bottom, 0px);
}

.bemesh-map .maplibregl-ctrl.maplibregl-ctrl-attrib {
  background: var(--panel);
  color: var(--ink);
  font: 11px/14px var(--font-ui);
}

.bemesh-map .maplibregl-ctrl-attrib a {
  color: var(--node);
}

.bemesh-map.map-dark .maplibregl-ctrl-attrib-button {
  filter: invert(1);
}

/* "The map style could not be loaded": a snackbar on ink, bottom centre, for 8 s */
.map-snackbar {
  position: absolute;
  z-index: 3;
  left: 50%;
  bottom: calc(16px + var(--map-safe-bottom, 0px));
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  width: max-content;
  max-width: min(480px, calc(100% - 32px));
  padding: 10px 14px;
  background: var(--topbar-bg);
  color: var(--topbar-ink);
  border-radius: 8px;
  box-shadow: 0 4px 16px var(--shadow);
  font: 13px/1.4 var(--font-ui);
}

.map-snackbar .bi {
  flex: none;
  font-size: 16px;
}

.map-snackbar[hidden] {
  display: none;
}

/* Keyboard on the map itself (arrows pan, + and − zoom): a 2px focus ring around the map */
.bemesh-map:has(> .maplibregl-canvas-container > .maplibregl-canvas:focus-visible),
.bemesh-map.leaflet-container:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: -2px;
}

.bemesh-map .maplibregl-canvas:focus,
.bemesh-map.leaflet-container:focus {
  outline: none;
}

@media (max-width: 600px) {
  .map-ctrls:not(.map-ctrls--top-right),
  .bemesh-map .leaflet-bottom.leaflet-left {
    bottom: calc(34px + var(--map-safe-bottom, 0px));
  }

  .bemesh-popup .maplibregl-popup-close-button {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    padding: 0;
    top: 0;
    right: 0;
  }

  .map-snackbar {
    bottom: calc(84px + var(--map-safe-bottom, 0px));
  }
}

/* Hover labels (region names, places): one at a time, above their spot, glass as Leaflet's tooltip */
.bemesh-tooltip {
  position: absolute;
  z-index: 4;
  top: 0;
  left: 0;
  padding: 4px 8px;
  border: 1px solid var(--glass-line);
  border-radius: 6px;
  background: var(--glass);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  box-shadow: var(--glass-shadow);
  color: var(--ink);
  font: 600 12px/1.3 var(--font-ui);
  white-space: nowrap;
  pointer-events: none;
}

.bemesh-tooltip[hidden] {
  display: none;
}

@media (prefers-reduced-transparency: reduce) {
  .bemesh-tooltip {
    background: var(--panel);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
}

/* Region map page: side panel + map under the shared #BEmesh top bar. */
html,
body {
  height: 100%;
}

body.region-map-body {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

html.region-map-embed .topbar {
  display: none;
}

.region-map-layout {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
}

.region-map-controls {
  width: 300px;
  flex-shrink: 0;
  background: var(--panel);
  border-right: 1px solid var(--line);
  overflow-y: auto;
  transition: width 0.2s ease;
}

.region-map-controls.collapsed {
  width: 0;
  border-right: 0;
  overflow: hidden;
}

.region-map-controls-inner {
  width: 300px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.region-map-search-wrap {
  position: relative;
}

#counter {
  font-size: 12px;
  min-height: 1em;
}

.field-label {
  margin-top: 4px;
  font-size: 12px;
  font-weight: 700;
}

.region-map-places-check {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.region-map-places-check input {
  accent-color: var(--gold);
}

#autocomplete {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  z-index: 1000;
  max-height: 220px;
  overflow-y: auto;
  /* Glass (.glass in the shell): colours, blur and shadow come from there. */
  border-width: 1px;
  border-style: solid;
  border-radius: 8px;
}

#autocomplete:empty {
  display: none;
}

.autocomplete-item {
  padding: 6px 10px;
  cursor: pointer;
  border-bottom: 1px solid var(--line);
}

.autocomplete-item:last-child {
  border-bottom: 0;
}

.autocomplete-item:hover,
.autocomplete-item.active {
  background: var(--gold-bg);
}

.autocomplete-item code {
  color: var(--mut);
}

.autocomplete-item:hover code,
.autocomplete-item.active code {
  color: var(--mut-on-gold-bg);
}

/* Region code rows, as in the configurator. */
.hierarchy-node {
  width: 100%;
  border: 0;
  background: none;
  text-align: left;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 8px;
  border-bottom: 1px solid var(--line);
  border-radius: 6px;
  cursor: pointer;
}

.hierarchy-node:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: -2px;
}

.hierarchy-node:hover {
  background: var(--bar);
}

.hierarchy-node.active {
  background: var(--gold-bg);
}

/* "be · country" on the selected row: the muted grey is too faint on cream. */
.hierarchy-node.active .region-meta {
  color: var(--mut-on-gold-bg);
}

.hierarchy-node.indent-1 {
  padding-left: 20px;
}

.hierarchy-node.indent-2 {
  padding-left: 32px;
}

.region-name {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.region-title {
  overflow-wrap: anywhere;
}

.region-meta {
  font-size: 11px;
}

.region-count {
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.region-map-main {
  position: relative;
  flex: 1;
  min-width: 0;
}

#region-map-container {
  position: absolute;
  inset: 0;
  background: var(--bar);
}

.region-map-controls-toggle {
  position: absolute;
  z-index: 900;
  top: 50%;
  left: 300px;
  width: 20px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--line);
  border-left: 0;
  border-radius: 0 8px 8px 0;
  background: var(--panel);
  cursor: pointer;
  transition: left 0.2s ease;
}

.region-map-controls.collapsed + .region-map-controls-toggle {
  left: 0;
}

.region-map-controls.collapsed + .region-map-controls-toggle span {
  display: inline-block;
  transform: rotate(180deg);
}

/* Leaflet popups and tooltips follow the theme. */
.leaflet-popup-content-wrapper,
.leaflet-popup-tip,
.leaflet-tooltip.region-map-tooltip {
  background: var(--panel);
  color: var(--ink);
  border: 1px solid var(--line);
  box-shadow: 0 2px 8px var(--shadow);
}

.leaflet-tooltip.region-map-tooltip::before {
  display: none;
}

.leaflet-popup-content {
  margin: 10px 28px 10px 12px;
  font-family: inherit;
  font-size: 13px;
}

.leaflet-container a.leaflet-popup-close-button {
  color: var(--mut);
}

.region-locode-popup .leaflet-popup-content {
  min-width: 14rem;
}

/* The same popup on the MapLibre map (its frame: src/shared/map-engine.css) */
.region-locode-popup .maplibregl-popup-content {
  padding: 10px 28px 10px 12px;
  font-size: 13px;
}

.region-map-locode-popup__grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.region-map-locode-popup__pair {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px 10px;
  align-items: start;
}

.region-map-locode-popup__label {
  margin-top: 4px;
  font-size: 11px;
  font-weight: 600;
}

.region-map-locode-popup__name {
  font-weight: 600;
  overflow-wrap: anywhere;
}

.region-map-locode-popup__code code {
  padding: 1px 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bar);
  color: var(--ink);
}

.node-popup__muted {
  color: var(--mut);
}

@media (max-width: 767px) {
  .region-map-layout {
    flex-direction: column;
  }

  .region-map-main {
    order: -1;
    flex: 0 0 45vh;
  }

  .region-map-controls,
  .region-map-controls.collapsed {
    width: 100%;
    flex: 1;
    min-height: 0;
    border-right: 0;
    border-top: 1px solid var(--line);
    overflow-y: auto;
  }

  .region-map-controls-inner {
    width: auto;
  }

  .region-map-controls-toggle {
    display: none;
  }
}