/* =============================================================================================
   Tokens — colour (light default; dark is its own selected set, not an automatic flip),
   spacing (8px grid, 4px micro-step), type scale, radii (outer = inner + padding), icons, targets.
   ============================================================================================= */
:root {
  color-scheme: light;
  --page: #f9f9f7;
  --surface: #fcfcfb;
  --surface-2: #f3f2ee;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #6f6d67; /* same warm grey as before, darkened to clear 4.5:1 on every surface */
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --border: rgba(11, 11, 11, 0.1);
  /* Interactive boundary: every input, select, segmented control, chip button and card button carries this outline
     (3.6–4.0:1 here, 4.4–4.9:1 in dark), so it reads as clickable next to static tiles, tags and chips (≈1.3:1 or none) */
  --control-border: #807e78;
  --control-border-hover: var(--ink-2);
  --divider: #d6d5cc; /* structural rules (tab row, table rows, footers) — one step firmer than chart --grid */
  --surface-edge: transparent; /* hairline on --surface-2 tiles; only dark needs it, where a 1.1:1 fill step vanishes */
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.06), 0 4px 14px rgba(0, 0, 0, 0.08);
  --ring: 0 0 0 1px var(--border); /* hairline ring for floating cards (no layout pixels) */
  --accent: #2a78d6; /* series slot 1 — fills, lines, bars */
  --accent-soft: rgba(42, 120, 214, 0.12);
  --accent-text: #1c5cab; /* blue ramp 550 — link/label text (5.1:1+) */
  --accent-strong: #256abf; /* blue ramp 500 — solid button fill (white text 5.4:1) */
  --up: #006300;
  --down: #c93636; /* same red, 2% darker: clears 4.5:1 on --surface-2 (KPI tiles, hovered rows), not just --surface */
  --flat: #52514e;
  --focus: var(--ink);
  /* Chart series: categorical slots 1–4 (fixed order, validated adjacent pairs) + neutral "other";
     ordinal one-hue ramp for levels junior → lead (validated --ordinal, light end ≥ 2:1 on surface) */
  --series-1: #2a78d6; --series-2: #eb6834; --series-3: #1baf7a; --series-4: #eda100;
  --series-other: #898781;
  --ord-1: #86b6ef; --ord-2: #3987e5; --ord-3: #1c5cab; --ord-4: #0d366b;

  /* Sequential (open positions): blue ramp, light → dark = few → many */
  --seq-1: #b7d3f6; --seq-2: #86b6ef; --seq-3: #5598e7; --seq-4: #3987e5;
  --seq-5: #256abf; --seq-6: #184f95; --seq-7: #0d366b;
  /* Diverging (MoM): red ← grey → blue */
  --div-neg: #e34948; --div-pos: #2a78d6; --div-mid: #e1e0d9;
  --untracked: #e6e5df;
  --ocean: #dde5ee;
  --stroke: #ffffff;
  /* Google sign-in button, light theme (fixed by Google's branding guidelines) */
  --g-bg: #ffffff; --g-bg-hover: #f2f2f2; --g-border: #747775; --g-ink: #1f1f1f;

  /* Spacing — 8px grid; --space-1 (4px) only for tight icon/label pairs and compact badges */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 16px;
  --space-4: 24px;
  --space-5: 32px;
  --space-6: 40px;
  --space-7: 48px;
  --space-8: 64px;

  /* Type scale */
  --font: system-ui, -apple-system, "Segoe UI", sans-serif;
  --text-2xs: 11px; /* chart ticks, legend ticks, compact badges — the floor */
  --text-xs: 12px; /* metadata, captions, hints, section labels */
  --text-sm: 13px; /* secondary body, bars, chips */
  --text-md: 14px; /* body, list titles */
  --text-lg: 16px; /* brand title */
  --text-xl: 20px; /* position title, card figures, KPI deltas */
  --text-2xl: 24px; /* panel title, KPI values */
  --text-3xl: 28px; /* salary hero */
  --leading-tight: 1.2; /* large headings and figures */
  --leading-snug: 1.3; /* small headings, list titles */
  --leading-body: 1.5; /* anything that can wrap */
  --line-label: 16px; /* single-line 11–12px labels and badges: a 16px line box on the 4px grid */
  --line-title: 20px; /* single-line 16px title */
  --weight-regular: 400;
  --weight-medium: 500;
  --weight-semibold: 600;
  --weight-bold: 700;
  --measure: 70ch;

  /* Radii — nested elements use outer = inner + padding (e.g. 12 = 8 + 4) */
  --radius-xs: 4px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-pill: 999px;

  /* Icons — 16px inline with text, 20px with large figures, 12px only inside compact badges */
  --icon-xs: 12px;
  --icon-sm: 16px;
  --icon-md: 20px;
  --icon-lg: 24px;

  /* Targets */
  --hit: 40px; /* dense desktop minimum */
  --hit-touch: 44px;

  /* Layout — a 12-column frame: the map spans 8 columns, the details panel 4 (⅓ of the window),
     bounded so it never gets cramped on laptops or sprawls on 4K screens. A dragged width
     (splitter.js) overrides --panel-w inline on .app. */
  --panel-cols: 4;
  --panel-min: 400px;
  --panel-max: 720px;
  --panel-w: clamp(var(--panel-min), calc(100vw * var(--panel-cols) / 12), var(--panel-max));
}

@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --page: #0d0d0d; --surface: #1a1a19; --surface-2: #232321;
    --ink: #f0efec; --ink-2: #c3c2b7; --muted: #93918b;
    --grid: #2c2c2a; --axis: #383835; --border: rgba(255, 255, 255, 0.1); --control-border: #898781;
    --divider: #3b3b38; --surface-edge: var(--border);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 6px 18px rgba(0, 0, 0, 0.45);
    --accent: #3987e5; --accent-soft: rgba(57, 135, 229, 0.18);
    --accent-text: #6da7ec; --accent-strong: #256abf;
    --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --series-4: #c98500; --series-other: #898781;
    --ord-1: #184f95; --ord-2: #2a78d6; --ord-3: #6da7ec; --ord-4: #b7d3f6;
    --up: #0ca30c; --down: #e66767; --flat: #c3c2b7;
    /* dark: anchor flips — few = dim (near surface), many = bright */
    --seq-1: #104281; --seq-2: #184f95; --seq-3: #1c5cab; --seq-4: #256abf;
    --seq-5: #3987e5; --seq-6: #6da7ec; --seq-7: #b7d3f6;
    --div-neg: #e66767; --div-pos: #3987e5; --div-mid: #383835;
    --untracked: #262624; --ocean: #10161d; --stroke: #0d0d0d;
    --g-bg: #131314; --g-bg-hover: #1f1f20; --g-border: #8e918f; --g-ink: #e3e3e3;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0d0d0d; --surface: #1a1a19; --surface-2: #232321;
  --ink: #f0efec; --ink-2: #c3c2b7; --muted: #93918b;
  --grid: #2c2c2a; --axis: #383835; --border: rgba(255, 255, 255, 0.1); --control-border: #898781;
  --divider: #3b3b38; --surface-edge: var(--border);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 6px 18px rgba(0, 0, 0, 0.45);
  --accent: #3987e5; --accent-soft: rgba(57, 135, 229, 0.18);
  --accent-text: #6da7ec; --accent-strong: #256abf;
  --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --series-4: #c98500; --series-other: #898781;
  --ord-1: #184f95; --ord-2: #2a78d6; --ord-3: #6da7ec; --ord-4: #b7d3f6;
  --up: #0ca30c; --down: #e66767; --flat: #c3c2b7;
  --seq-1: #104281; --seq-2: #184f95; --seq-3: #1c5cab; --seq-4: #256abf;
  --seq-5: #3987e5; --seq-6: #6da7ec; --seq-7: #b7d3f6;
  --div-neg: #e66767; --div-pos: #3987e5; --div-mid: #383835;
  --untracked: #262624; --ocean: #10161d; --stroke: #0d0d0d;
  --g-bg: #131314; --g-bg-hover: #1f1f20; --g-border: #8e918f; --g-ink: #e3e3e3;
}

/* =============================================================================================
   Base
   ============================================================================================= */
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--page);
  color: var(--ink);
  font: var(--weight-regular) var(--text-md) / var(--leading-body) var(--font);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { line-height: var(--leading-snug); }
button { font: inherit; color: inherit; }
a { color: var(--accent-text); }
/* Rows, cards and chips that move the map are links (they open in a new tab, and search engines follow them), with
   the look of the buttons they replaced. */
a:is(.item, .rowbtn, .company-link) { color: inherit; text-decoration: none; }
a:is(.chip-btn, .link-btn) { text-decoration: none; }
a.table-link { display: inline-flex; align-items: center; text-decoration: none; }
/* A skill or tool in a job ad that has its own page: a chip like the others, reading as a link. */
a.chip-link { color: var(--accent-text); text-decoration: none; }
a.chip-link:hover { box-shadow: inset 0 0 0 1px var(--control-border-hover); text-decoration: underline; text-underline-offset: 2px; }

/* One focus treatment everywhere: a 2px ink ring, offset so it clears fills and pills. */
:where(a, button, select, input, textarea, summary, [tabindex]:not([tabindex="-1"])):focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}
/* Inside a clipping box (scrolling tab row, Leaflet's rounded zoom bar) the ring is drawn inset so it stays visible */
.tabs [role="tab"]:focus-visible, .leaflet-bar a:focus-visible { outline-offset: -2px; }
[tabindex="-1"]:focus { outline: none; } /* programmatic focus targets (panel headings) */

.icon { display: inline-block; flex: none; width: var(--icon-sm); height: var(--icon-sm); vertical-align: -0.125em; }
.icon-star { fill: currentColor; stroke: none; }
/* The star qualifies the figure beside it, so it scales with that figure's text */
.rating { display: inline-flex; align-items: center; gap: 2px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.rating .icon { width: 0.9em; height: 0.9em; }
.sr {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

/* =============================================================================================
   App shell
   ============================================================================================= */
.app {
  position: relative;
  display: grid;
  grid-template-columns: 1fr var(--panel-w);
  height: 100vh;
  height: 100dvh;
}
.stage { position: relative; overflow: hidden; background: var(--ocean); }
.view { position: absolute; inset: 0; }

/* Desktop is a fixed two-column app shell: the page itself never scrolls, only the panel does. */
@media (min-width: 821px) {
  html, body { overflow: hidden; }
}

/* ---------- Floating chrome over the map (cards align on a 48px row) ---------- */
.topbar {
  position: absolute; z-index: 1000; top: var(--space-3); left: var(--space-3); right: var(--space-3);
  display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; pointer-events: none;
}
.topbar > * { pointer-events: auto; }
.brand {
  min-height: var(--space-7); margin-right: auto; padding: var(--space-1) var(--space-3);
  display: flex; flex-direction: column; justify-content: center;
  background: var(--surface); border-radius: var(--radius-md); box-shadow: var(--ring), var(--shadow);
}
.brand h1 {
  display: flex; align-items: center; gap: var(--space-2); margin: 0;
  font-size: var(--text-lg); line-height: var(--line-title); font-weight: var(--weight-semibold); letter-spacing: -0.01em;
}
/* UX Status brand mark: a live-status dot (Nielsen's "visibility of system status") */
.brand-dot { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--up); box-shadow: 0 0 0 3px color-mix(in srgb, var(--up) 18%, transparent); }
.brand-scope { color: var(--muted); font-size: var(--text-sm); font-weight: var(--weight-regular); letter-spacing: 0; }
.brand p { margin: 0; font-size: var(--text-xs); line-height: var(--line-label); color: var(--ink-2); }

/* The sandbox copy's notice (server/sandbox.js): a full-width line under the name and sign-in, floating over the map
   like them, with the same corners and shadow as their cards. */
.site-notice { order: 3; flex-basis: 100%; display: flex; pointer-events: none; }
.site-notice p {
  flex: 1; display: flex; gap: var(--space-2); align-items: flex-start; margin: 0; padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md); background: color-mix(in srgb, var(--series-4) 18%, var(--surface));
  box-shadow: var(--ring), var(--shadow);
  color: var(--ink); font-size: var(--text-sm); line-height: var(--leading-body); pointer-events: auto;
}
.site-notice .icon { margin-top: 2px; color: var(--ink); }
.site-notice a { color: var(--ink); font-weight: var(--weight-semibold); text-underline-offset: 3px; }

/* Account: "Sign in with Google", or the account menu, on the same 48px card row */
.account {
  position: relative; display: inline-flex; align-items: center; gap: var(--space-2); min-width: 0; padding: var(--space-1);
  background: var(--surface); border-radius: var(--radius-md); box-shadow: var(--ring), var(--shadow);
}
.account[hidden] { display: none; }

/* The account menu (account-menu.js): the first letter of the email in a circle (no name or photo is kept) and a
   caret; it opens a panel under the card it sits in (.account here, .doc-account in a page header). */
.acct-trigger {
  display: inline-flex; align-items: center; gap: var(--space-1); min-height: var(--hit); padding: 0 var(--space-2) 0 var(--space-1);
  border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--ink-2); cursor: pointer;
}
.acct-trigger:hover, .acct-trigger[aria-expanded="true"] { background: var(--surface-2); color: var(--ink); }
/* The part of the email before the @, so the button reads as "you"; long ones end in "…" (the panel has it whole). */
.acct-name {
  max-width: 16ch; margin-left: var(--space-1); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: var(--ink); font-size: var(--text-sm); font-weight: var(--weight-medium);
}
@media (max-width: 360px) { .acct-name { display: none; } } /* too narrow for it beside the brand: the letter alone */
.acct-caret { transition: transform 0.15s ease; }
.acct-trigger[aria-expanded="true"] .acct-caret { transform: rotate(180deg); }
@media (prefers-reduced-motion: reduce) { .acct-caret { transition: none; } }
.avatar {
  display: inline-flex; align-items: center; justify-content: center; flex: none; width: 32px; height: 32px; border-radius: 50%;
  background: var(--accent-strong); color: #fff; font-size: var(--text-md); line-height: 1; font-weight: var(--weight-semibold);
}
.avatar-lg { width: 40px; height: 40px; font-size: var(--text-lg); }
.acct-pop {
  position: absolute; z-index: 20; top: calc(100% + var(--space-2)); right: 0;
  width: max-content; min-width: 240px; max-width: min(320px, calc(100vw - 2 * var(--space-3)));
  padding: var(--space-2); border-radius: var(--radius-md); background: var(--surface); box-shadow: var(--ring), var(--shadow);
}
.acct-pop[hidden] { display: none; }
.acct-pop-head {
  display: flex; align-items: center; gap: var(--space-3); padding: var(--space-2) var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--divider);
}
.acct-pop-who { display: flex; flex-direction: column; align-items: flex-start; gap: var(--space-1); min-width: 0; }
.acct-pop-email { color: var(--ink); font-size: var(--text-md); line-height: var(--leading-snug); font-weight: var(--weight-semibold); overflow-wrap: anywhere; }
.acct-pop-plan { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1) var(--space-2); color: var(--muted); font-size: var(--text-xs); line-height: var(--line-label); }
.acct-pop-items { margin: 0; padding: var(--space-2) 0 0; list-style: none; }
.acct-item {
  display: flex; align-items: center; gap: var(--space-3); width: 100%; min-height: var(--hit); padding: var(--space-2);
  border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--ink);
  font: inherit; font-size: var(--text-md); line-height: var(--leading-snug); text-align: left; text-decoration: none; cursor: pointer;
}
.acct-item:hover { background: var(--surface-2); }
.acct-item:disabled { color: var(--muted); cursor: default; background: transparent; }
.acct-item > .icon { color: var(--ink-2); }
.acct-item-hint { display: block; color: var(--muted); font-size: var(--text-xs); line-height: var(--line-label); }
/* The signed-in person's plan: neutral for Free, accent for the paid plans. */
.plan {
  flex: none; padding: 2px var(--space-2); border-radius: var(--radius-pill); background: var(--surface-2);
  box-shadow: inset 0 0 0 1px var(--surface-edge); color: var(--ink-2);
  font-size: var(--text-xs); line-height: var(--line-label); font-weight: var(--weight-semibold); white-space: nowrap;
}
.plan-pro, .plan-team { background: var(--accent-soft); box-shadow: none; color: var(--accent-text); }
/* "See the Individual plan" in a lock card: to the plan's card on the pricing page. */
.lock-link { color: var(--accent-text); font-weight: var(--weight-semibold); text-underline-offset: 3px; white-space: nowrap; }
/* Where the Individual plan adds something: a small "Individual" tag with a lock (KPI values, controls), and the card standing in for a part. */
.pro-tag {
  display: inline-flex; align-items: center; gap: 3px; padding: 1px var(--space-2); border-radius: var(--radius-pill);
  background: var(--accent-soft); color: var(--accent-text); font-size: var(--text-xs); line-height: var(--line-label);
  font-weight: var(--weight-semibold); white-space: nowrap; vertical-align: middle;
}
.pro-tag .icon { width: var(--icon-xs); height: var(--icon-xs); }
.kpi .value .pro-tag { font-size: var(--text-sm); padding: 2px var(--space-2); }
.pro-lock > .icon { color: var(--accent-text); }

/* "Sign in with Google": Google's branding guidelines fix the colours (light: white / #747775 outline / #1f1f1f text;
   dark: #131314 / #8e918f / #e3e3e3), the full-colour G and the wording, so this button doesn't use the app accent. */
.btn-google {
  display: inline-flex; align-items: center; gap: 10px; min-height: var(--hit); padding: 0 12px;
  border-radius: var(--radius-xs); background: var(--g-bg); box-shadow: inset 0 0 0 1px var(--g-border); color: var(--g-ink);
  font-size: var(--text-md); font-weight: var(--weight-medium); text-decoration: none; white-space: nowrap; cursor: pointer;
}
.btn-google:hover { background: var(--g-bg-hover); }
.btn-google .g-mark { width: 20px; height: 20px; flex: none; }

.legend {
  position: absolute; z-index: 1000; left: var(--space-3); bottom: var(--space-4);
  padding: var(--space-2) var(--space-3); border-radius: var(--radius-md);
  background: var(--surface); box-shadow: var(--ring), var(--shadow);
  font-size: var(--text-xs); color: var(--ink-2);
}
.seg-sm.legend-switch { display: flex; margin-bottom: var(--space-2); } /* the switch is the legend's title */
.legend-switch button { flex: 1; }
.legend-key { display: grid; }
.legend-mode { grid-area: 1 / 1; min-width: 0; }
.legend-mode:not(.on) { visibility: hidden; } /* still sizes the cell, so both modes give the same card */
.legend-scale { display: flex; gap: 2px; }
.legend-scale span { display: block; width: var(--space-5); height: var(--space-2); border-radius: 2px; }
.legend-ticks { display: flex; gap: 2px; margin-top: var(--space-1); }
.legend-ticks span { width: var(--space-5); font-size: var(--text-2xs); color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.legend-ticks.centered span { display: flex; justify-content: center; overflow: visible; }
.legend-note { display: flex; align-items: center; gap: var(--space-2); margin-top: var(--space-2); font-size: var(--text-2xs); color: var(--muted); }
.legend-cities { display: flex; align-items: center; gap: var(--space-2); margin-top: var(--space-2); font-size: var(--text-2xs); color: var(--ink-2); font-variant-numeric: tabular-nums; }
.legend-dots { display: inline-flex; align-items: center; gap: 2px; }
.legend-dots i { border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 1px var(--surface); }
.legend-dots i:nth-child(1) { width: 6px; height: 6px; }
.legend-dots i:nth-child(2) { width: 9px; height: 9px; }
.legend-dots i:nth-child(3) { width: 12px; height: 12px; }
.legend-note i { display: inline-block; width: 12px; height: var(--space-2); border-radius: 2px; background: var(--untracked); box-shadow: var(--ring); }

.loading {
  position: absolute; inset: 0; z-index: 999; display: grid; place-items: center;
  background: var(--ocean); color: var(--ink-2); font-size: var(--text-sm);
}
.loading[hidden] { display: none; }

/* ---------- KPI badges on the map ----------
   Compact by design (WCAG 2.5.8 "equivalent" exception: the country shape and the ranked list do the same
   thing at full size). Their hit area is not padded out, or neighbouring badges would steal each other's clicks. */
.badge {
  display: inline-flex; align-items: center; gap: var(--space-1); white-space: nowrap;
  padding: 2px var(--space-2); border: 0; border-radius: var(--radius-pill);
  background: var(--surface); color: var(--ink); box-shadow: var(--ring), var(--shadow);
  font: var(--weight-regular) var(--text-2xs) / var(--line-label) var(--font); cursor: pointer; user-select: none;
  transform: translate(calc(-50% + var(--dx, 0px)), calc(-50% + var(--dy, 0px)));
  /* no transform transition: placement measures the live box, so it must not be mid-animation */
}
.badge b { font-size: var(--text-sm); font-weight: var(--weight-bold); font-variant-numeric: tabular-nums; }
.badge .icon { width: var(--icon-xs); height: var(--icon-xs); }
.badge:hover, .badge.is-hover { transform: translate(calc(-50% + var(--dx, 0px)), calc(-50% + var(--dy, 0px))) scale(1.08); z-index: 1; }
.badge.is-selected { box-shadow: 0 0 0 2px var(--ink), var(--shadow); }
.badge.is-culled { visibility: hidden; }

/* Deltas: an arrow icon + figure, so direction never rests on colour alone. The 2px gap plus the arrow's own
   side bearing reads as an optical 4px. */
.delta { display: inline-flex; align-items: center; gap: 2px; font-weight: var(--weight-semibold); font-variant-numeric: tabular-nums; white-space: nowrap; }
.delta .icon { width: var(--icon-xs); height: var(--icon-xs); }
.delta.up { color: var(--up); }
.delta.down { color: var(--down); }
.delta.flat, .delta.na { color: var(--flat); font-weight: var(--weight-medium); }

/* City points for the selected country: slot-1 blue, sized by √open roles, 2px surface ring */
.leaflet-pane path.city-dot { fill: var(--accent); fill-opacity: 0.8; stroke: var(--surface); stroke-width: 2px; cursor: pointer; }
.leaflet-pane path.city-dot:hover { fill-opacity: 1; }
.leaflet-pane path.city-dot.is-active { fill-opacity: 1; stroke: var(--ink); stroke-width: 3px; }
/* Map shapes take focus on mouse click but aren't keyboard targets (the "Top cities" chips and ranked list
   are); drop the UA ring so a clicked circle doesn't wear a square outline. */
.leaflet-pane path:focus { outline: none; }
.city-label-icon { background: none; border: 0; pointer-events: none; }
.city-label {
  display: inline-block; white-space: nowrap; transform: translate(calc(var(--r) + var(--space-1)), -50%);
  color: var(--ink); font-size: var(--text-xs); line-height: var(--line-label); font-weight: var(--weight-semibold);
  text-shadow: 0 0 2px var(--surface), 0 0 3px var(--surface), 0 0 4px var(--surface); /* halo over the basemap */
}
.city-label b { color: var(--ink-2); font-weight: var(--weight-bold); font-variant-numeric: tabular-nums; }
.city-label.is-culled { visibility: hidden; }
.tip-employers { max-width: 32ch; margin-top: var(--space-1); color: var(--ink-2); white-space: normal; }

/* Leaflet */
.badge-icon { background: none; border: 0; }
.leaflet-container { background: var(--ocean); font-family: var(--font); }
.leaflet-container:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.leaflet-tooltip.tip {
  padding: var(--space-2) var(--space-3); border: 0; border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink); box-shadow: var(--ring), var(--shadow);
  font-size: var(--text-xs); line-height: var(--leading-body);
}
.leaflet-tooltip.tip::before { display: none; }
.tip-title { margin-bottom: var(--space-1); font-size: var(--text-sm); font-weight: var(--weight-semibold); }
.tip-row { display: flex; justify-content: space-between; align-items: center; gap: var(--space-3); color: var(--ink-2); }
.tip-row b { color: var(--ink); font-variant-numeric: tabular-nums; }
.tip-hint { margin-top: var(--space-1); color: var(--muted); font-size: var(--text-2xs); }
.leaflet-bar { border: 0 !important; border-radius: var(--radius-sm) !important; box-shadow: 0 0 0 1px var(--control-border), var(--shadow) !important; overflow: hidden; }
.leaflet-bar a {
  display: flex !important; align-items: center; justify-content: center; text-indent: 0;
  width: var(--hit) !important; height: var(--hit) !important; line-height: var(--hit) !important;
  background: var(--surface) !important; color: var(--ink-2) !important; border-color: var(--border) !important;
}
.leaflet-bar a .icon { width: var(--icon-md); height: var(--icon-md); }
.leaflet-container .leaflet-bar a:first-child { border-radius: var(--radius-sm) var(--radius-sm) 0 0; }
.leaflet-container .leaflet-bar a:last-child { border-radius: 0 0 var(--radius-sm) var(--radius-sm); }
.leaflet-bar a:hover { background: var(--surface-2) !important; color: var(--ink) !important; }
/* At a zoom limit the button dims and stops reacting (Leaflet sets aria-disabled for screen readers) */
.leaflet-bar a.leaflet-disabled { background: var(--surface) !important; color: var(--axis) !important; cursor: default; }
.leaflet-control-attribution { background: var(--surface) !important; color: var(--ink-2) !important; font-size: var(--text-2xs); }
.leaflet-control-attribution a { color: var(--ink-2) !important; }
/* Muted OpenStreetMap: grey the tiles (not the data overlay); invert for dark mode */
#view-map .leaflet-tile-pane { filter: grayscale(1) contrast(0.85) brightness(1.06); }
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) #view-map .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) grayscale(1) brightness(0.72) contrast(0.9); }
}
:root[data-theme="dark"] #view-map .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) grayscale(1) brightness(0.72) contrast(0.9); }

/* =============================================================================================
   Side panel
   ============================================================================================= */
.panel {
  container: panel / inline-size;
  /* position: relative makes the panel the containing block for absolutely positioned bits inside it
     (screen-reader-only labels, tooltips), so they scroll and clip with the panel instead of growing the page. */
  position: relative;
  background: var(--surface); border-left: 1px solid var(--border);
  overflow-y: auto; overscroll-behavior: contain;
}
.panel-inner { padding: var(--space-4) var(--space-4) var(--space-5); }
/* The panel is a column: its content, then the site's page links, pushed to the bottom when the content is short. */
.panel { display: flex; flex-direction: column; }
.panel-inner { flex: 1 0 auto; }
.panel-links {
  display: flex; flex-wrap: wrap; gap: 0 var(--space-3); margin-top: auto;
  padding: var(--space-2) var(--space-4) var(--space-3); border-top: 1px solid var(--divider);
}
.panel-links a {
  display: inline-flex; align-items: center; min-height: 32px;
  color: var(--muted); font-size: var(--text-xs); text-decoration: none;
}
.panel-links a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.panel h2 { margin: 0; font-size: var(--text-2xl); line-height: var(--leading-tight); font-weight: var(--weight-bold); letter-spacing: -0.015em; }
.panel .sub { margin: var(--space-1) 0 var(--space-3); color: var(--ink-2); font-size: var(--text-sm); }
.flag { font-style: normal; }

.section { margin-top: var(--space-5); }
.section h3 {
  margin: 0 0 var(--space-2); color: var(--ink-2);
  font-size: var(--text-xs); line-height: var(--line-label); font-weight: var(--weight-semibold); letter-spacing: 0.04em; text-transform: uppercase;
}
.note { max-width: var(--measure); margin: var(--space-2) 0 0; color: var(--muted); font-size: var(--text-xs); }
.stack-top { margin-top: var(--space-3); }

/* KPI tiles: padding = gap (16), so each tile reads as one group */
.kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3); }
.kpis + .chart { margin-top: var(--space-3); } /* a chart right under the tiles keeps the tiles' own gap */
.kpi { padding: var(--space-3); border-radius: var(--radius-sm); background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--surface-edge); }
.kpi .label { font-size: var(--text-xs); line-height: var(--leading-body); color: var(--ink-2); }
.kpi .value {
  display: flex; align-items: center; gap: var(--space-1); margin-top: var(--space-1);
  font-size: var(--text-2xl); line-height: var(--leading-tight); font-weight: var(--weight-bold);
  letter-spacing: -0.02em; font-variant-numeric: tabular-nums;
}
.kpi .value .delta { font-size: var(--text-xl); gap: var(--space-1); }
.kpi .value .icon { width: var(--icon-md); height: var(--icon-md); }
.kpi .hint { margin-top: var(--space-1); font-size: var(--text-xs); line-height: var(--leading-body); color: var(--muted); }

/* Bars */
.bars { display: grid; gap: var(--space-2); }
.bar-row { display: grid; grid-template-columns: 9.5em 1fr auto; align-items: center; gap: var(--space-2); font-size: var(--text-sm); }
.bar-row .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); }
.bar-track { position: relative; height: 10px; border-left: 1px solid var(--axis); }
.bar-fill { position: absolute; left: 0; top: 0; bottom: 0; min-width: 2px; border-radius: 0 var(--radius-xs) var(--radius-xs) 0; background: var(--accent); }
.bar-row .val { min-width: 5.5em; text-align: right; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.bar-row .val b { color: var(--ink); font-weight: var(--weight-semibold); }

/* Ranked list (overview = table view of the map) */
.rank-list { list-style: none; margin: 0; padding: 0; }
.rank-head, .rowbtn { display: grid; grid-template-columns: 2em 1fr 64px 4.2em 4.8em; align-items: center; gap: var(--space-2); }
.rank-head { padding: 0 var(--space-2) var(--space-1); font-size: var(--text-2xs); color: var(--muted); }
.rank-head span:nth-child(n+4) { text-align: right; }
.rowbtn {
  width: 100%; min-height: var(--hit); padding: var(--space-1) var(--space-2);
  border: 0; border-radius: var(--radius-sm); background: none; cursor: pointer; text-align: left;
}
.rowbtn:hover, .rowbtn.is-hover { background: var(--surface-2); }
.rowbtn .r { color: var(--muted); font-size: var(--text-xs); font-variant-numeric: tabular-nums; }
.rowbtn .n { text-align: right; font-weight: var(--weight-semibold); font-variant-numeric: tabular-nums; }
.rowbtn .delta { justify-content: flex-end; font-size: var(--text-xs); }

/* Charts */
.chart { position: relative; }
/* Only the chart's own SVG fills its container. Small SVGs inside a chart (tooltip/legend swatches, icons)
   keep their own size: a descendant selector here once stretched tooltip swatches into giant pills. */
.chart > svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .gridline { stroke: var(--grid); stroke-width: 1; }
.chart .baseline { stroke: var(--axis); stroke-width: 1; }
.chart .tick { fill: var(--muted); font-size: var(--text-2xs); font-variant-numeric: tabular-nums; }
.chart .line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .area { fill: var(--accent-soft); }
.chart .cross { stroke: var(--axis); stroke-width: 1; }
.chart .dot { fill: var(--accent); stroke: var(--surface); stroke-width: 2; }
.chart .pt { fill: var(--accent); }
.chart .line.gap { stroke-width: 1.5; stroke-dasharray: 3 4; }
.chart-tip {
  position: absolute; pointer-events: none; padding: var(--space-1) var(--space-2); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink-2); box-shadow: var(--ring), var(--shadow);
  font-size: var(--text-xs); white-space: nowrap; font-variant-numeric: tabular-nums;
  z-index: 2; /* positioned by placeTip() in charts.js, clamped inside the chart */
}
.chart-tip b { color: var(--ink); }
.spark .line { stroke-width: 1.5; }

/* Salary (country) */
.salary-hero { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--space-2); }
.salary-hero .big { font-size: var(--text-3xl); line-height: var(--leading-tight); font-weight: var(--weight-bold); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.salary-hero .unit { color: var(--ink-2); font-size: var(--text-sm); }
.range { position: relative; height: var(--space-5); margin: var(--space-2) 0 var(--space-1); }
.range .track { position: absolute; left: 0; right: 0; top: 12px; height: 1px; background: var(--axis); }
.range .iqr { position: absolute; top: 7px; height: 11px; border-radius: var(--radius-xs); background: var(--accent); opacity: 0.85; }
.range .med { position: absolute; top: 3px; width: 2px; height: 19px; background: var(--ink); }
.range .eu { position: absolute; top: 4px; width: 0; height: 17px; border-left: 2px dashed var(--muted); }
.range .lbl { position: absolute; top: 22px; transform: translateX(-50%); color: var(--muted); font-size: var(--text-2xs); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* Chips, empty states, footers */
.chips { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.chip {
  display: inline-flex; align-items: center; gap: var(--space-1); min-height: var(--space-4);
  padding: 2px var(--space-2); border-radius: var(--radius-pill); background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--surface-edge);
  color: var(--ink); font-size: var(--text-xs);
}
.chip span { color: var(--muted); font-variant-numeric: tabular-nums; }
.chip-btn { position: relative; min-height: var(--space-5); padding: 0 var(--space-3); border: 0; box-shadow: inset 0 0 0 1px var(--control-border); cursor: pointer; font-size: var(--text-sm); }
.chip-btn::after { content: ""; position: absolute; inset: -4px 0; } /* 32px pill, 40px target */
.chip-btn:hover { background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--control-border-hover); }
.chip .icon { width: var(--icon-xs); height: var(--icon-xs); color: var(--muted); }
.empty { max-width: var(--measure); margin: var(--space-1) 0 0; color: var(--muted); font-size: var(--text-sm); }
.error { color: var(--down); }

/* Data that needs an account: replaces the list / tab / page the server refused (account.js → loadErrorHtml) */
.locked {
  display: flex; gap: var(--space-3); align-items: flex-start; max-width: var(--measure); margin: var(--space-2) 0 0;
  padding: var(--space-3); border-radius: var(--radius-md); background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--surface-edge);
}
.locked > .icon { width: var(--icon-md); height: var(--icon-md); margin-top: 2px; color: var(--ink-2); }
.locked p { margin: 0 0 var(--space-3); color: var(--ink-2); font-size: var(--text-sm); }
.locked p:last-child { margin-bottom: 0; }
.locked b { color: var(--ink); font-weight: var(--weight-semibold); }
.locked .fine { margin: var(--space-2) 0 0; color: var(--muted); font-size: var(--text-xs); }
.locked .fine a { color: var(--ink-2); }
.foot { margin-top: var(--space-5); padding-top: var(--space-3); border-top: 1px solid var(--divider); color: var(--muted); font-size: var(--text-xs); max-width: var(--measure); }
.skeleton { height: var(--space-3); margin: var(--space-2) 0; border-radius: var(--radius-xs); background: var(--surface-2); }

/* =============================================================================================
   Drill-down: breadcrumbs, lists, company + position views
   ============================================================================================= */
.crumbs ol { list-style: none; display: flex; flex-wrap: wrap; align-items: center; margin: 0 0 var(--space-2); padding: 0; font-size: var(--text-sm); }
.crumbs li { display: inline-flex; align-items: center; min-width: 0; }
.crumbs li + li::before {
  content: ""; flex: none; width: var(--icon-sm); height: var(--icon-sm); margin: 0 var(--space-1); background: var(--muted);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m9 18 6-6-6-6'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m9 18 6-6-6-6'/%3E%3C/svg%3E") center / contain no-repeat;
}
.crumbs :is(button, a) {
  display: inline-flex; align-items: center; gap: var(--space-1); min-height: var(--hit); padding: 0;
  border: 0; background: none; color: var(--accent-text); cursor: pointer; font-weight: var(--weight-medium); white-space: nowrap;
  text-decoration: none;
}
.crumbs :is(button, a):hover { text-decoration: underline; }
.crumbs [aria-current] span {
  display: inline-block; max-width: 22ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  vertical-align: bottom; color: var(--ink-2);
}

.list { list-style: none; margin: 0; padding: 0; display: grid; }
.list li.extra { display: none; }
.list.is-open li.extra { display: block; }
.item {
  position: relative; width: 100%; display: flex; align-items: center; gap: var(--space-2);
  padding: var(--space-2); border: 0; border-radius: var(--radius-sm);
  background: none; text-align: left; cursor: pointer;
}
.item:hover { background: var(--surface-2); }
.item > .logo { margin-right: var(--space-2); }
.item-main { flex: 1; min-width: 0; display: grid; gap: var(--space-1); }
.item .t, .company-link b { color: var(--ink); font-size: var(--text-md); line-height: var(--leading-snug); font-weight: var(--weight-semibold); }
.item .m, .company-link .m { overflow: hidden; text-overflow: ellipsis; color: var(--ink-2); font-size: var(--text-xs); }
.item .s { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1) var(--space-2); font-size: var(--text-xs); }
.item-n { display: grid; justify-items: end; gap: var(--space-1); color: var(--ink-2); font-size: var(--text-xs); white-space: nowrap; font-variant-numeric: tabular-nums; }
.item-n b { color: var(--ink); font-size: var(--text-sm); }
.item.is-past .t { color: var(--ink-2); }
.chev { display: inline-flex; flex: none; color: var(--muted); }
.link-btn .icon, .ext .icon, .cta .icon { width: var(--icon-sm); height: var(--icon-sm); }

.logo {
  position: relative; flex: none; display: grid; place-items: center; overflow: hidden;
  width: var(--space-5); height: var(--space-5); border-radius: var(--radius-sm);
  background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--border);
  color: var(--ink-2); font-size: var(--text-sm); font-weight: var(--weight-bold);
}
.logo img { position: absolute; inset: var(--space-1); width: calc(100% - 8px); height: calc(100% - 8px); object-fit: contain; background: var(--surface-2); }
.logo.lg { width: var(--space-7); height: var(--space-7); border-radius: var(--radius-md); font-size: var(--text-xl); }
.logo.lg img { inset: var(--space-2); width: calc(100% - 16px); height: calc(100% - 16px); }
.title-row { display: flex; align-items: center; gap: var(--space-3); margin-bottom: var(--space-1); }
.title-row .sub { margin: var(--space-1) 0 0; }

/* Text links that stand alone (Website, View, Open) get a full-height target */
.links { display: flex; flex-wrap: wrap; align-items: center; gap: 0 var(--space-3); margin: var(--space-1) 0 var(--space-2); font-size: var(--text-sm); }
.ext {
  display: inline-flex; align-items: center; gap: var(--space-1); min-height: var(--hit);
  color: var(--accent-text); font-weight: var(--weight-medium); text-decoration: none; white-space: nowrap;
}
.ext:hover { text-decoration: underline; }

.link-btn {
  display: inline-flex; align-items: center; gap: var(--space-1); min-height: var(--hit); padding: 0;
  border: 0; background: none; color: var(--accent-text); cursor: pointer;
  font-size: var(--text-sm); font-weight: var(--weight-semibold);
}
.link-btn:hover { text-decoration: underline; }
.link-btn:disabled { color: var(--muted); cursor: default; text-decoration: none; }

.prose { max-width: var(--measure); margin: 0 0 var(--space-2); color: var(--ink); font-size: var(--text-sm); line-height: 1.55; }
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-2) var(--space-3); margin: var(--space-3) 0 0; }
.facts div { min-width: 0; }
.facts dt { color: var(--ink-2); font-size: var(--text-xs); }
.facts dd { margin: 0; overflow-wrap: anywhere; color: var(--ink); font-size: var(--text-sm); font-weight: var(--weight-medium); font-variant-numeric: tabular-nums; }

.ratings { list-style: none; margin: 0; padding: 0; }
.ratings li {
  display: grid; grid-template-columns: 6.5em 1fr auto; grid-template-areas: "src score link" "src n link";
  align-items: center; gap: 0 var(--space-2); padding: var(--space-2) 0; border-bottom: 1px solid var(--divider);
}
.ratings .r-src { grid-area: src; font-size: var(--text-sm); font-weight: var(--weight-semibold); }
.ratings .r-score { grid-area: score; display: inline-flex; align-items: center; gap: var(--space-1); color: var(--ink-2); font-size: var(--text-xs); }
.ratings .r-score b { display: inline-flex; align-items: center; gap: 2px; color: var(--ink); font-size: var(--text-md); font-variant-numeric: tabular-nums; }
.ratings .r-n { grid-area: n; color: var(--muted); font-size: var(--text-xs); font-variant-numeric: tabular-nums; }
.ratings .ext { grid-area: link; font-size: var(--text-xs); }

/* Position */
.status-line { display: flex; flex-wrap: wrap; align-items: center; gap: 0 var(--space-1); margin: 0 0 var(--space-1); color: var(--ink-2); font-size: var(--text-xs); }
.status { display: inline-flex; align-items: center; gap: var(--space-1); font-weight: var(--weight-semibold); }
.status-dot { width: var(--space-2); height: var(--space-2); border-radius: 50%; background: currentColor; }
.status.open { color: var(--up); }
.status.closed { color: var(--muted); }
.panel h2.job-title { margin: 0 0 var(--space-2); font-size: var(--text-xl); line-height: var(--leading-snug); }
.company-link {
  width: 100%; display: flex; align-items: center; gap: var(--space-3); margin-bottom: var(--space-2);
  padding: var(--space-2) var(--space-3); border: 0; border-radius: var(--radius-md); cursor: pointer; text-align: left;
  background: var(--surface); box-shadow: inset 0 0 0 1px var(--control-border);
}
.company-link:hover { background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--control-border-hover); }
.company-link > span:not(.logo):not(.chev) { flex: 1; min-width: 0; display: grid; }
.tags { display: flex; flex-wrap: wrap; gap: var(--space-2); margin: var(--space-1) 0 var(--space-3); }
.tag { display: inline-flex; align-items: center; min-height: var(--space-4); padding: 2px var(--space-2); border-radius: var(--radius-pill); box-shadow: inset 0 0 0 1px var(--border); color: var(--ink); font-size: var(--text-xs); }
.salary-card { position: relative; padding: var(--space-3); border-radius: var(--radius-md); background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--surface-edge); }
.salary-card .label { display: flex; align-items: center; gap: var(--space-1); color: var(--ink-2); font-size: var(--text-xs); }
.salary-card .big { margin-top: var(--space-1); font-size: var(--text-xl); line-height: var(--leading-tight); font-weight: var(--weight-bold); letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.salary-card .hint { margin-top: var(--space-1); color: var(--muted); font-size: var(--text-xs); }
.salary-card.estimate .big { color: var(--ink-2); }
.salary-card.disclosed { /* stated in the ad: a green tint and hairline (no side bar); the check and label say why */
  background: color-mix(in srgb, var(--up) 8%, var(--surface-2));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--up) 30%, transparent);
}
.salary-card .label.sal-ok { color: var(--up); font-weight: var(--weight-semibold); }
.conf-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); margin-top: var(--space-2); }
.conf-row .hint { margin: 0; }
.cta {
  display: flex; align-items: center; justify-content: center; gap: var(--space-2);
  min-height: var(--hit-touch); margin: var(--space-3) 0 var(--space-2); padding: 0 var(--space-3);
  border-radius: var(--radius-sm); background: var(--accent-strong); color: #fff;
  font-weight: var(--weight-semibold); text-decoration: none;
}
.cta:hover { filter: brightness(1.1); }
.desc {
  position: relative; max-width: var(--measure); max-height: 13.5em; overflow: hidden; overflow-wrap: anywhere; white-space: pre-line;
  color: var(--ink); font-size: var(--text-sm); line-height: 1.55;
  -webkit-mask-image: linear-gradient(to bottom, #000 65%, transparent); mask-image: linear-gradient(to bottom, #000 65%, transparent);
}
.desc.is-open { max-height: none; -webkit-mask-image: none; mask-image: none; }
/* Ads that came as HTML (rich-text.js keeps only these tags) */
.desc.is-html { white-space: normal; }
.desc.is-html > :first-child { margin-top: 0; }
.desc.is-html :is(p, ul, ol, blockquote) { margin: 0 0 var(--space-2); }
.desc.is-html :is(ul, ol) { padding-left: 1.25em; }
.desc.is-html li { margin-bottom: 2px; }
.desc.is-html li > p { margin: 0; }
.desc.is-html :is(h4, h5) { margin: var(--space-3) 0 var(--space-1); font-size: var(--text-sm); line-height: 1.4; font-weight: var(--weight-semibold); }
.desc.is-html h5 { color: var(--ink-2); }
.desc.is-html blockquote { padding-left: var(--space-2); border-left: 2px solid var(--divider); color: var(--ink-2); }
.desc.is-html hr { margin: var(--space-3) 0; border: 0; border-top: 1px solid var(--divider); }
.desc.is-html a { color: var(--accent-text); text-decoration: underline; text-underline-offset: 2px; }
.postings { list-style: none; margin: 0; padding: 0; }
.postings li { display: flex; justify-content: space-between; align-items: center; gap: var(--space-2); padding: var(--space-2) 0; border-bottom: 1px solid var(--divider); font-size: var(--text-sm); }
.muted { color: var(--muted); font-size: var(--text-xs); }

/* ---------- Sortable lists ---------- */
.list-controls { display: flex; flex-wrap: wrap; gap: var(--space-3) var(--space-2); margin-bottom: var(--space-2); }
.list-controls:empty { display: none; }
/* Wraps rather than running past a narrow panel (it pushed a phone's page sideways) */
.seg-sm { display: inline-flex; flex-wrap: wrap; max-width: 100%; gap: var(--space-1); padding: var(--space-1); border-radius: var(--radius-md); background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--control-border); }
.seg-sm button {
  position: relative; min-height: var(--space-5); padding: 0 var(--space-2); border: 0; border-radius: var(--radius-sm);
  background: transparent; color: var(--ink-2); cursor: pointer; white-space: nowrap;
  font-size: var(--text-xs); font-weight: var(--weight-medium);
}
.seg-sm button::after { content: ""; position: absolute; inset: -4px 0; } /* 32px pill, 40px target */
.seg-sm button .icon-lock { width: var(--icon-xs); height: var(--icon-xs); margin-right: 3px; }
.seg-sm button:hover { color: var(--ink); }
.seg-sm button[aria-pressed="true"] { background: var(--surface); color: var(--ink); font-weight: var(--weight-semibold); box-shadow: var(--ring), 0 1px 2px rgba(0, 0, 0, 0.12); }
.list-note { margin: 0 0 var(--space-2) !important; }
.list-box { transition: opacity 120ms ease; }
.list-box.is-loading { opacity: 0.5; pointer-events: none; }
.list-box .more { margin-top: var(--space-1); }

/* ---------- Salary tags and confidence badges ---------- */
.sal { display: inline-flex; align-items: center; gap: var(--space-1); font-weight: var(--weight-semibold); font-variant-numeric: tabular-nums; white-space: nowrap; }
.sal .icon { width: var(--icon-xs); height: var(--icon-xs); }
.sal-ok { color: var(--up); }
.sal-est { color: var(--ink-2); }
.sal-lock { color: var(--accent-text); font-weight: var(--weight-medium); }
.note .sal-ok .icon { vertical-align: -1px; }
.conf {
  display: inline-flex; align-items: center; gap: var(--space-1); min-height: 20px; padding: 0 var(--space-2);
  border-radius: var(--radius-pill); font-size: var(--text-2xs); font-weight: var(--weight-semibold); white-space: nowrap;
}
.conf-high { background: var(--accent-soft); color: var(--accent-text); }
.conf-medium { background: var(--surface-2); color: var(--ink-2); box-shadow: inset 0 0 0 1px var(--border); }
.conf-low { background: transparent; color: var(--muted); box-shadow: none; outline: 1px dashed var(--muted); outline-offset: -1px; }
/* Three-step meter: filled dots = model confidence (the word next to it carries the same meaning) */
.meter { display: inline-flex; gap: 2px; }
.meter i { width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: 0.25; }
.meter[data-level="high"] i, .meter[data-level="medium"] i:nth-child(-n+2), .meter[data-level="low"] i:first-child { opacity: 1; }

/* Applicant count: on a row's salary line (dot-separated after the salary) and on the position status line. */
.apps { color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.item .s .apps:not(:first-child)::before { content: "·"; content: "·" / ""; margin-right: var(--space-2); }
.apps-trend { margin-top: var(--space-2); }

/* =============================================================================================
   Tabs (Europe / country views) and the Market insights tab
   ============================================================================================= */
/* Four tabs can outgrow a narrow panel: the row scrolls sideways (no scrollbar) and the bottom rule is a shadow,
   so the selected tab's underline isn't clipped by the overflow. */
.tabs { display: flex; gap: var(--space-1); margin-top: var(--space-4); box-shadow: inset 0 -1px 0 var(--grid); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs.fade-r { mask-image: linear-gradient(to right, #000 calc(100% - 32px), transparent); }
.tabs.fade-l { mask-image: linear-gradient(to right, transparent, #000 32px); }
.tabs.fade-l.fade-r { mask-image: linear-gradient(to right, transparent, #000 32px, #000 calc(100% - 32px), transparent); }
.tabs [role="tab"] {
  position: relative; flex: none; white-space: nowrap; min-height: var(--hit); padding: 0 var(--space-3);
  border: 0; border-bottom: 2px solid transparent; background: none; cursor: pointer;
  color: var(--ink-2); font-size: var(--text-sm); font-weight: var(--weight-medium);
}
.tabs [role="tab"]:hover { color: var(--ink); }
.tabs [role="tab"][aria-selected="true"] { color: var(--ink); font-weight: var(--weight-semibold); border-bottom-color: var(--accent); }
#tabpanel > :first-child { margin-top: var(--space-4); } /* every tab's content starts 24px below the tab rule */
.tabs { --grid: var(--divider); } /* the tab row's bottom rule is a divider, not a chart gridline */

.ins-controls { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-3); margin-bottom: var(--space-3); }
.field { display: grid; gap: var(--space-1); min-width: 0; }
/* Inside a form field every hairline ring is a control boundary, so text inputs styled with the generic --border
   ring get the same outline as selects; hover firms it up on any field control */
.field { --border: var(--control-border); }
.field :is(select, input, textarea):hover { box-shadow: inset 0 0 0 1px var(--control-border-hover); }
.field-label { color: var(--ink-2); font-size: var(--text-xs); font-weight: var(--weight-medium); }
.field select {
  min-height: var(--hit); max-width: 100%; padding: 0 var(--space-5) 0 var(--space-2);
  border: 0; border-radius: var(--radius-sm); background-color: var(--surface-2); box-shadow: inset 0 0 0 1px var(--control-border);
  color: var(--ink); font: inherit; font-size: var(--text-sm); cursor: pointer;
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23807e78' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right var(--space-2) center; background-size: var(--icon-sm);
}
.insights.is-loading, #ins-profile.is-loading { opacity: 0.5; pointer-events: none; transition: opacity 120ms ease; }

.chart-title { margin: var(--space-4) 0 var(--space-2); color: var(--ink); font-size: var(--text-sm); line-height: var(--leading-snug); font-weight: var(--weight-semibold); }
/* Tight only straight under a heading or scope line; after KPI tiles a chart title keeps its full 24px */
.section h3 + .chart-title, .ins-scope + .chart-title { margin-top: var(--space-2); }
.ins-scope { max-width: var(--measure); margin: 0 0 var(--space-2); color: var(--ink-2); font-size: var(--text-sm); }
.ins-scope .vs { color: var(--muted); }
.ins-two { display: grid; gap: 0 var(--space-4); }

/* Legends: line swatch + label in ink (the swatch carries identity, never the text colour) */
.legend-chips { list-style: none; display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-3); margin: 0 0 var(--space-2); padding: 0; font-size: var(--text-xs); color: var(--ink-2); }
.legend-chips li { display: inline-flex; align-items: center; gap: var(--space-1); }
.seg-sm + .legend-chips { margin-top: var(--space-3); } /* the switch above a chart, then its legend, which sits with the chart */
.swatch { width: var(--icon-sm); height: var(--space-2); flex: none; overflow: visible; }
.swatch line { stroke-width: 3; stroke-linecap: round; }

/* Multi-line + radar chart parts */
.chart .mk { stroke: var(--surface); stroke-width: 2; }
.chart .end-label { fill: var(--ink-2); font-size: var(--text-2xs); }
.chart .ring { fill: none; stroke: var(--grid); stroke-width: 1; }
.chart .spoke { stroke: var(--grid); stroke-width: 1; }
.chart .spoke.is-on { stroke: var(--axis); stroke-width: 2; }
.chart .axis-label { fill: var(--ink-2); font-size: var(--text-2xs); }
.chart .axis-label.is-on { fill: var(--ink); font-weight: var(--weight-semibold); }
.chart .shape { stroke-width: 2; stroke-linejoin: round; }
.chart.radar { max-width: 400px; margin: 0 auto; }
.chart-tip-list { white-space: normal; min-width: 180px; max-width: 280px; padding: var(--space-2); }
.chart-tip .tip-head { margin-bottom: var(--space-1); color: var(--ink); font-weight: var(--weight-semibold); }
.chart-tip .tip-line { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: var(--space-1) var(--space-2); }
.chart-tip .tip-line b { color: var(--ink); font-variant-numeric: tabular-nums; }

.radar-grid { display: grid; gap: var(--space-3); margin: var(--space-2) 0 0; }
.kpis.kpis-fit { grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); grid-auto-flow: row; }
.table-links { display: flex; flex-wrap: wrap; gap: 0 var(--space-4); }
.table-links .data-table[open] { flex-basis: 100%; }
.radar-grid figure { margin: 0; min-width: 0; }
.radar-grid figcaption { margin-bottom: var(--space-1); color: var(--ink-2); font-size: var(--text-xs); text-align: center; }
.radar-grid figcaption b { color: var(--ink); font-weight: var(--weight-semibold); }

/* Share bars with a change column (percentage points vs the comparison period) */
.bar-row.has-delta { grid-template-columns: 9.5em 1fr auto 4.5em; }
.pp { display: inline-flex; align-items: center; justify-content: flex-end; gap: 2px; font-size: var(--text-xs); font-weight: var(--weight-semibold); font-variant-numeric: tabular-nums; white-space: nowrap; }
.pp .icon { width: var(--icon-xs); height: var(--icon-xs); }
.pp.up { color: var(--up); }
.pp.down { color: var(--down); }
.pp.flat, .pp.na { color: var(--muted); font-weight: var(--weight-medium); }

/* "Show as table" — the accessible / printable view of each chart */
.data-table { margin-top: var(--space-1); font-size: var(--text-xs); }
.data-table summary { display: inline-flex; align-items: center; min-height: var(--hit); color: var(--accent-text); font-weight: var(--weight-semibold); cursor: pointer; }
.table-scroll { overflow-x: auto; }
.data-table table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.data-table th, .data-table td { padding: var(--space-1) var(--space-2); border-bottom: 1px solid var(--divider); text-align: right; white-space: nowrap; }
.data-table th[scope="row"], .data-table thead th:first-child { text-align: left; font-weight: var(--weight-medium); color: var(--ink); }
.data-table thead th { color: var(--ink-2); font-weight: var(--weight-semibold); }

@container panel (min-width: 600px) {
  .radar-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ins-two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ins-two .bar-row { grid-template-columns: 7em 1fr auto; }
  .ins-two .bar-row.has-delta { grid-template-columns: 7em 1fr auto 4.5em; }
}

/* =============================================================================================
   Competitor benchmark (company page tab)
   ============================================================================================= */
/* Where you sit: one strip per metric — peers as small grey dots, market as a dashed mark, the company highlighted */
.strip-legend { display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-3); margin: 0 0 var(--space-2); color: var(--ink-2); font-size: var(--text-xs); }
.strip-legend span { display: inline-flex; align-items: center; gap: var(--space-1); }
.strip-legend [hidden] { display: none; }
.strip-legend i { display: inline-block; flex: none; }
.key-you { width: 12px; height: 12px; border-radius: 50%; background: var(--series-1); box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px var(--ink); }
.key-peer { width: 8px; height: 8px; border-radius: 50%; background: var(--series-other); }
.key-market { width: 0; height: 14px; border-left: 2px dashed var(--ink-2); }
.strips { display: grid; gap: var(--space-1); }
.strip-row { display: grid; grid-template-columns: 9.5em 1fr 6.5em; align-items: center; gap: var(--space-2); min-height: var(--space-5); font-size: var(--text-sm); }
.strip-label { color: var(--ink); }
.strip { position: relative; height: var(--space-4); }
.strip-track { position: absolute; left: 0; right: 0; top: 50%; height: 2px; margin-top: -1px; border-radius: var(--radius-pill); background: var(--grid); }
.strip-peer, .strip-you, .strip-market { position: absolute; top: 50%; transform: translate(-50%, -50%); }
.strip-peer { width: 8px; height: 8px; border-radius: 50%; background: var(--series-other); opacity: 0.75; box-shadow: 0 0 0 1px var(--surface); }
.strip-market { width: 0; height: 18px; border-left: 2px dashed var(--ink-2); }
.strip-you { z-index: 1; width: 12px; height: 12px; border-radius: 50%; background: var(--series-1); box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px var(--ink); }
.strip-val { display: grid; justify-items: end; line-height: 1.25; font-variant-numeric: tabular-nums; }
.strip-val b { color: var(--ink); font-weight: var(--weight-semibold); }
.strip-val span { color: var(--muted); font-size: var(--text-2xs); }

/* Mixes: 100% bars for you / peers / market, 2px gaps between segments */
.mix-legend { list-style: none; display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-3); margin: 0 0 var(--space-2); padding: 0; color: var(--ink-2); font-size: var(--text-xs); }
.mix-legend li { display: inline-flex; align-items: center; gap: var(--space-1); }
.mix-legend i { width: 12px; height: var(--space-2); border-radius: 2px; }
.mix { display: grid; gap: var(--space-1); }
.mix-row { display: grid; grid-template-columns: 4.5em 1fr; align-items: center; gap: var(--space-2); font-size: var(--text-xs); color: var(--ink-2); }
.mix-bar { display: flex; gap: 2px; height: var(--space-3); }
.mix-bar > span { min-width: 2px; }
.mix-bar > span:first-child { border-radius: var(--radius-xs) 0 0 var(--radius-xs); }
.mix-bar > span:last-child { border-radius: 0 var(--radius-xs) var(--radius-xs) 0; }
.mix-empty { color: var(--muted); }

/* Benchmark tables */
.bench-table { width: 100%; border-collapse: collapse; font-size: var(--text-xs); font-variant-numeric: tabular-nums; }
.bench-table th, .bench-table td { padding: var(--space-1) var(--space-2); border-bottom: 1px solid var(--divider); text-align: right; white-space: nowrap; }
.bench-table thead th { color: var(--ink-2); font-weight: var(--weight-semibold); }
.bench-table th[scope="row"], .bench-table thead th:first-child { text-align: left; color: var(--ink); font-weight: var(--weight-medium); white-space: normal; }
.bench-table td.c { text-align: center; }
.bench-table tr.is-you { background: var(--accent-soft); }
.bench-table tr.is-you .muted { color: var(--ink-2); } /* --muted drops to 4.3:1 on the tint */
.bench-table .sal-ok .icon { width: var(--icon-sm); height: var(--icon-sm); }
.cell-bar { display: inline-block; width: 40px; height: 6px; margin-right: var(--space-1); vertical-align: middle; border-radius: var(--radius-pill); background: var(--grid); overflow: hidden; }
.cell-bar span { display: block; height: 100%; background: var(--series-other); }
.table-link { min-width: var(--hit); min-height: var(--hit); padding: 0; border: 0; background: none; color: var(--accent-text); cursor: pointer; text-align: left; font-weight: var(--weight-medium); }
.table-link:hover { text-decoration: underline; }
@container panel (min-width: 600px) {
  .strip-row { grid-template-columns: 11em 1fr 7em; }
}

/* =============================================================================================
   Hiring moves (Europe and country tab)
   ============================================================================================= */
.h-count { margin-left: var(--space-1); color: var(--muted); font-weight: var(--weight-medium); letter-spacing: 0; font-variant-numeric: tabular-nums; }
/* Tracking changes: a neutral note, not an alert — it qualifies the numbers, nothing is wrong */
.callout { max-width: var(--measure); margin: var(--space-3) 0 0; padding: var(--space-2) var(--space-3); border-radius: var(--radius-sm); background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--surface-edge); color: var(--ink-2); font-size: var(--text-xs); line-height: var(--leading-body); }
.callout-title { margin: 0 0 var(--space-1); color: var(--ink); font-weight: var(--weight-semibold); }
.callout ul { margin: 0; padding-left: var(--space-4); display: grid; gap: var(--space-1); }
.callout b { color: var(--ink); font-weight: var(--weight-semibold); }
/* Row: logo · name + roles · 12 weekly bars · figure · chevron */
.item.move .wk { display: none; flex: none; line-height: 0; }
.wk-bars rect { fill: var(--series-other); }
.wk-bars rect.is-zero { fill: var(--axis); }
.wk-bars rect.is-now { fill: var(--series-1); }
.item.move .m { white-space: normal; }
@container panel (min-width: 440px) {
  .item.move .wk { display: block; }
}

/* =============================================================================================
   Where you stand (Europe and country tab)
   ============================================================================================= */
.kpi .value .unit { color: var(--ink-2); font-size: var(--text-xs); font-weight: var(--weight-medium); }
/* Pay strip: each stated salary a grey dot, middle half shaded, median in ink, "you" in the accent */
.pay-strip svg { display: block; width: 100%; height: auto; }
.pay-strip .iqr { fill: var(--accent-soft); }
.pay-strip .dot-ad { fill: var(--series-other); opacity: 0.6; }
.pay-strip .med { stroke: var(--ink); stroke-width: 2; stroke-linecap: round; }
.pay-strip .you { stroke: var(--series-1); stroke-width: 2; stroke-linecap: round; }
.pay-strip .you-lbl { fill: var(--accent-text); font-size: var(--text-2xs); font-weight: var(--weight-semibold); }
.key-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--series-other); }
.key-iqr { width: 14px; height: 10px; border-radius: 2px; background: var(--accent-soft); }
.key-med { width: 0; height: 12px; border-left: 2px solid var(--ink); }
.key-you-line { width: 0; height: 12px; border-left: 2px solid var(--series-1); }
.you-pay { margin-top: var(--space-3); }
.you-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.you-row input {
  width: 10em; min-height: var(--hit); padding: 0 var(--space-2); border: 0; border-radius: var(--radius-sm);
  background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--control-border); color: var(--ink); font: inherit; font-size: var(--text-sm);
  font-variant-numeric: tabular-nums;
}
.you-row select {
  min-height: var(--hit); padding: 0 var(--space-2); border: 0; border-radius: var(--radius-sm);
  background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--control-border); color: var(--ink); font: inherit; font-size: var(--text-sm);
}
.you-result { margin: var(--space-2) 0 0; color: var(--ink-2); font-size: var(--text-sm); }
.you-result:empty { display: none; }
.you-result b { color: var(--ink); }
/* Pay ladder: the chosen level in the accent, the others grey */
.ladder .bar-fill { background: var(--series-other); }
.ladder .is-sel .bar-fill { background: var(--series-1); }
.ladder .is-sel .name { font-weight: var(--weight-semibold); }
.ladder .is-empty .val { min-width: 5.5em; text-align: right; }

/* =============================================================================================
   Panel splitter — drag (or focus + arrow keys) to resize; double-click / Enter resets
   ============================================================================================= */
.splitter {
  position: absolute; z-index: 1100; top: 0; bottom: 0; right: var(--panel-w);
  width: var(--space-3); transform: translateX(50%); /* 16px target straddling the border */
  display: flex; justify-content: center; cursor: col-resize; touch-action: none;
}
.splitter::before { /* the visible rail: hairline at rest, accent while hovered/focused/dragged */
  content: ""; width: 2px; height: 100%; background: transparent; transition: background-color 120ms ease;
}
.splitter::after { /* grip */
  content: ""; position: absolute; top: 50%; left: 50%; width: 4px; height: var(--space-5);
  transform: translate(-50%, -50%); border-radius: var(--radius-pill); background: var(--axis); opacity: 0;
  transition: opacity 120ms ease;
}
.splitter:hover::before, .splitter:focus-visible::before, .is-resizing .splitter::before { background: var(--accent); }
.splitter:hover::after, .splitter:focus-visible::after, .is-resizing .splitter::after { opacity: 1; }
.splitter:focus-visible { outline: none; } /* the accent rail + grip are the focus indicator */
.is-resizing, .is-resizing * { cursor: col-resize !important; user-select: none !important; }
.is-resizing .stage { pointer-events: none; } /* keep Leaflet from grabbing the drag */

/* Wide panel: use the room instead of stretching two columns */
@container panel (min-width: 600px) {
  .facts { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .bar-row { grid-template-columns: 14em 1fr auto; }
}
@container panel (min-width: 700px) { /* the default max panel (720px − scrollbar); tiles stay ≈ 150px+ wide */
  .kpis { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); }
}

/* =============================================================================================
   Motion
   ============================================================================================= */
@keyframes enter-forward { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: none; } }
@keyframes enter-back { from { opacity: 0; transform: translateX(-16px); } to { opacity: 1; transform: none; } }
.panel-inner.enter-forward { animation: enter-forward 180ms ease-out; }
.panel-inner.enter-back { animation: enter-back 180ms ease-out; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
  .badge:hover, .badge.is-hover { transform: translate(calc(-50% + var(--dx, 0px)), calc(-50% + var(--dy, 0px))); }
}

/* =============================================================================================
   Narrow screens: map on top, panel below (the page scrolls)
   ============================================================================================= */
@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; grid-template-rows: 58vh auto; height: auto; min-height: 100vh; }
  .splitter { display: none; }
  .panel { border-left: 0; border-top: 1px solid var(--border); overflow: visible; }
  .panel-inner { padding: var(--space-3) var(--space-3) var(--space-5); }
  .panel-links { padding-inline: var(--space-3); }
  .panel-links a { min-height: var(--hit); }
  .topbar { top: var(--space-2); left: var(--space-2); right: var(--space-2); }
  .site-notice p { padding: var(--space-1) var(--space-2); font-size: var(--text-xs); }
  .brand p { display: none; }
  .btn-google, .acct-trigger, .acct-item { min-height: var(--hit-touch); }
  .acct-name { max-width: 11ch; } /* keeps the name card beside the brand on a 375px phone */
  .legend { left: var(--space-2); bottom: var(--space-2); padding: var(--space-2); }
  .legend-switch button { min-height: 36px; } /* 44px target with the ::after */
  .legend-note { display: none; }
  .item { min-height: var(--hit-touch); }
  .tabs [role="tab"], .field select, .you-row input, .you-row select { min-height: var(--hit-touch); }
}
