/* The model and location pickers: only what the kit (controls.css) doesn't give. Load after it. The model
 * picker's rail, lines and preview are at the end. */

/* ================================================================ model picker
 * Fixed to the left of the screen at full height; the width follows the list (one or two columns). */
.pk-panel {
  top: var(--inset) !important; left: var(--inset) !important;
  height: calc(100vh - 2 * var(--inset)) !important; max-height: none !important;
  transition: width var(--dur-move) var(--ease-spring);
}
.pk-panel .c-float-body { display: flex; flex-direction: column; overflow: hidden; }

/* header: the search and the Baseline switch share one hairline */
.pk-head {
  flex: none; display: flex; align-items: center; gap: var(--space-12);
  margin-bottom: var(--space-6); padding-right: var(--space-8);
  border-bottom: var(--stroke-hairline) solid var(--fill-selected);
}
.pk-head .c-search { flex: 1; margin-bottom: 0; border-bottom: 0; }
.pk-base {
  display: inline-flex; align-items: center; gap: var(--space-8); flex: none;
  height: var(--size-chip); margin: 0; padding: 0; border: 0; background: none; border-radius: var(--radius-tag);
  font: inherit; font-size: var(--text-control); font-weight: var(--weight-medium); line-height: 1;
  color: var(--ink-secondary); cursor: pointer;
  transition: color var(--dur-fast) var(--ease-out);
}
.pk-base:hover, .pk-base[aria-checked="true"] { color: var(--ink-primary); }

/* a row: the kit's two-line row is the name target (role checkbox); the chart circle sits over its lead */
.pk-row { position: relative; }
.pk-row > .c-row { scroll-margin-block: var(--space-4); }
.pk-row:has(> .pk-dot:hover) > .c-row { background-image: linear-gradient(var(--fill-hover), var(--fill-hover)); }
.pk-dot {
  position: absolute; z-index: 1; top: 50%;
  left: calc(var(--space-8) + var(--size-icon) / 2 - var(--size-control-sm) / 2);
  display: grid; place-items: center;
  width: var(--size-control-sm); height: var(--size-control-sm); margin: 0; padding: 0;
  border: 0; border-radius: 50%; background: none; cursor: pointer;
  translate: 0 -50%;
}
.pk-dot > i {
  display: grid; place-items: center;
  width: var(--size-icon-sm); height: var(--size-icon-sm); border-radius: 50%;
  box-shadow: inset 0 0 0 1.5px var(--ink-faint);
  transition: background-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
}
.pk-dot:hover > i { box-shadow: inset 0 0 0 1.5px var(--ink-secondary); }
.pk-dot.on > i { background-color: var(--c); box-shadow: none; }
/* drawn as grey context (Show all) */
.pk-dot.grey > i::after { content: ""; width: var(--space-6); height: var(--space-6); border-radius: 50%; background: var(--ink-tertiary); }
.pk-miss { color: var(--ink-secondary); }

.pk-empty { padding: var(--space-8); font-size: var(--text-small); color: var(--ink-tertiary); }

/* the foot: what is selected, as chips (charted first, in their colours), then counts and actions */
.pk-foot {
  flex: none; margin-top: var(--space-6); padding: var(--space-6) var(--space-8) 0;
  border-top: var(--stroke-hairline) solid var(--fill-selected);
  font-size: var(--text-small); font-variant-numeric: tabular-nums; color: var(--ink-tertiary);
}
.pk-tray {
  display: flex; flex-wrap: wrap; gap: var(--space-4);
  max-height: calc(3 * var(--size-control-sm) + 2 * var(--space-4)); overflow: auto; overscroll-behavior: contain;
  margin-bottom: var(--space-6); scrollbar-width: thin; scrollbar-color: var(--ink-faint) transparent;
}
.pk-tchip {
  display: inline-flex; align-items: center; height: var(--size-control-sm); max-width: 100%;
  border-radius: var(--radius-pill); background: var(--fill-field); color: var(--ink-secondary);
}
.pk-tname, .pk-tx { display: inline-flex; align-items: center; height: 100%; margin: 0; padding: 0; border: 0; background: none; font: inherit; color: inherit; cursor: pointer; }
.pk-tname { gap: var(--space-6); min-width: 0; padding-left: var(--space-8); }
.pk-tname > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pk-tname > i { flex: none; width: var(--space-8); height: var(--space-8); border-radius: 50%; box-shadow: inset 0 0 0 1.25px var(--ink-faint); }
.pk-tname > i.on { background: var(--c); box-shadow: none; }
.pk-tname:hover { color: var(--ink-primary); }
.pk-tx { padding: 0 var(--space-6) 0 var(--space-4); color: var(--ink-tertiary); border-radius: 0 var(--radius-pill) var(--radius-pill) 0; }
.pk-tx:hover { color: var(--ink-primary); }
.pk-tx svg { width: 12px; height: 12px; }
.pk-foot-line { display: flex; align-items: center; gap: var(--space-12); height: var(--size-chip); }
.pk-acts { margin-left: auto; display: inline-flex; gap: var(--space-12); }

/* ================================================================ location picker */
.lp-chips { display: flex; flex-wrap: wrap; gap: var(--space-6); padding: 0 var(--space-8); }
.lp-recent { padding-block: var(--space-6); }
.lp-map { padding: var(--space-6) var(--space-8) var(--space-8); }
.lp-map > .lp-chips { padding: var(--space-12) 0 0; }
.lp-us { width: 100%; margin-bottom: var(--space-8); }
.lp-tiles { grid-template-columns: repeat(11, 1fr); }
.lp-results { max-height: 280px; overflow: auto; padding: 0 var(--space-4) var(--space-4); }
.lp-results.is-compact { max-height: 152px; margin-bottom: var(--space-4); border-bottom: var(--stroke-hairline) solid var(--fill-selected); }
.lp-cross-head {
  padding: var(--space-4) var(--space-8) var(--space-2);
  font-size: var(--text-micro); font-weight: var(--weight-medium); letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--ink-tertiary);
}
.lp-eu-tiles {
  --eu-tile: 27px;
  display: grid; gap: 3px; justify-content: center;
  grid-template-columns: repeat(12, var(--eu-tile));
  grid-template-rows: repeat(11, var(--eu-tile));
}
.lp-eu-tiles .c-tile { height: auto; min-width: 0; padding: 0 2px; font-size: 10px; border-radius: var(--radius-tile); }
.lp-ctx-bar {
  display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-8);
  padding: 0 0 var(--space-8); font-size: var(--text-small); color: var(--ink-secondary);
}
.lp-ctx-title { font-weight: var(--weight-medium); color: var(--ink-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lp-ctx-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; flex: none; }
.lp-ctx-act.is-on { color: var(--ink-primary); font-weight: var(--weight-medium); }
.c-tile.is-muted { opacity: 0.28; cursor: default; }
.c-tile.is-mc-avail { color: var(--ink-primary); box-shadow: inset 0 0 0 var(--stroke-hairline) var(--line-axis); }
.lp-hsa-wrap { padding: var(--space-4) 0 var(--space-8); }
.lp-hsa-svg { width: 100%; height: 196px; display: block; overflow: visible; }
.lp-hsa-svg.is-clipped { overflow: hidden; border-radius: var(--radius-tag); }
.lp-hsa-state-bg { fill: var(--fill-field); stroke: var(--line-hairline); stroke-width: 1; vector-effect: non-scaling-stroke; }
.lp-hsa-poly {
  fill: var(--fill-selected); stroke: var(--ink-tertiary); stroke-width: 1; vector-effect: non-scaling-stroke;
  cursor: pointer; transition: fill var(--dur-fast) var(--ease-out), stroke var(--dur-fast) var(--ease-out);
}
.lp-hsa-poly:hover, .lp-hsa-poly:focus-visible { fill: var(--fill-hover); stroke: var(--ink-primary); stroke-width: 1.5; outline: none; }
.lp-hsa-poly.is-on { fill: var(--accent); fill-opacity: 0.85; stroke: var(--ink-primary); stroke-width: 1.5; }
.lp-hsa-cap {
  margin: var(--space-4) 0 var(--space-8); min-height: 1.3em;
  font-size: var(--text-small); color: var(--ink-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
/* searching: everything else dims, matches get a ring, the best (what Enter picks) a stronger one */
.lp-panel.filtering .lp-map [data-loc]:not(.match) { opacity: var(--opacity-disabled); }
.lp-panel.filtering .lp-map .match:not(.on) { color: var(--ink-primary); box-shadow: inset 0 0 0 var(--stroke-hairline) var(--accent); }
.lp-panel.filtering .lp-map .match.best { box-shadow: inset 0 0 0 var(--stroke-focus) var(--accent); }

/* a row's details (the model sheet): a small open-page arrow at the end of the row, on hover */
.pk-info {
  position: absolute; z-index: 1; top: 50%; right: calc(var(--space-8) + var(--size-icon-sm) + var(--space-8)); translate: 0 -50%;
  display: grid; place-items: center; width: var(--space-24); height: var(--space-24); padding: 0; border: 0; border-radius: 50%; background: none; cursor: pointer;
  color: var(--ink-tertiary);
  opacity: 0; transition: opacity var(--dur-fast) var(--ease-out), background-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
.pk-info .c-icon, .pk-info svg { display: block; width: var(--size-icon-sm); height: var(--size-icon-sm); }
.pk-row:hover .pk-info, .pk-info:focus-visible { opacity: 1; }
.pk-info:hover { color: var(--ink-primary); background: var(--fill-hover); }
.pk-acts .pk-combine { margin-left: 0; }

/* ================================================================ model picker: rail, results, preview */

.mb-head { gap: var(--space-12); }
.mb-when { display: inline-flex; flex: none; padding: 2px; border-radius: var(--radius-pill); background: var(--fill-field); }
.mb-when > button {
  height: calc(var(--size-control-sm) - 4px); padding: 0 var(--space-10, 10px); margin: 0; border: 0; border-radius: var(--radius-pill);
  background: none; font: inherit; font-size: var(--text-small); color: var(--ink-secondary); cursor: pointer; white-space: nowrap;
  transition: background-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
.mb-when > button:hover { color: var(--ink-primary); }
.mb-when > button[aria-checked="true"] { background: var(--fill-selected); color: var(--ink-primary); }

/* suggestions under the search: the word you're typing, as a filter */
.mb-suggest { flex: none; display: flex; flex-wrap: wrap; gap: var(--space-6); padding: 0 var(--space-8) var(--space-8); }
.mb-sg { height: var(--size-control-sm); padding: 0 var(--space-12); gap: var(--space-6); font-size: var(--text-small); }
.mb-sg-k { color: var(--ink-tertiary); }

/* three columns, each scrolling on its own */
.mb-body { flex: 1; min-height: 0; display: grid; grid-template-columns: 184px minmax(0, 1fr) 252px; gap: var(--space-16); }
.mb-rail, .mb-list, .mb-preview { min-height: 0; overflow: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--ink-faint) transparent; }

/* the rail: sets and filters as short lists with counts */
.mb-rail { padding: var(--space-2) var(--space-4) var(--space-8) 0; }
.mb-rail-block + .mb-rail-block { margin-top: var(--space-16); }
.mb-rail-title {
  display: flex; align-items: baseline; justify-content: space-between; padding: 0 var(--space-8) var(--space-4);
  font-size: var(--text-micro); font-weight: var(--weight-medium); letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-tertiary);
}
.mb-rail-title .c-link { font-size: var(--text-small); text-transform: none; letter-spacing: 0; }
.mb-opt {
  display: flex; align-items: center; gap: var(--space-8); width: 100%; height: 26px; margin: 0; padding: 0 var(--space-8);
  border: 0; border-radius: var(--radius-tag); background: none; font: inherit; font-size: var(--text-small); color: var(--ink-secondary);
  text-align: left; cursor: pointer; transition: background-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
.mb-opt:hover { background: var(--fill-hover); color: var(--ink-primary); }
.mb-opt.on { background: var(--fill-selected); color: var(--ink-primary); font-weight: var(--weight-medium); }
.mb-opt-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mb-opt-n { flex: none; font-variant-numeric: tabular-nums; font-weight: var(--weight-regular, 400); color: var(--ink-tertiary); }
.mb-opt.is-zero { opacity: var(--opacity-disabled); }

/* results: a count bar, then sections by source with lines and rows */
.mb-results { min-height: 0; display: flex; flex-direction: column; }
.mb-bar {
  flex: none; display: flex; align-items: center; gap: var(--space-12); height: var(--size-control-sm); padding: 0 var(--space-8);
  font-size: var(--text-small); color: var(--ink-tertiary);
}
.mb-shown { font-variant-numeric: tabular-nums; }
.mb-bar-acts { margin-left: auto; display: inline-flex; gap: var(--space-12); }
.mb-bar-acts .c-link:disabled { opacity: var(--opacity-disabled); cursor: default; }
.mb-list { flex: 1; margin: 0 calc(-1 * var(--space-4)); padding: 0 var(--space-4) var(--space-8); }

.mb-group {
  display: flex; align-items: baseline; gap: var(--space-8); width: 100%; margin: var(--space-12) 0 var(--space-2); padding: 0 var(--space-8);
  border: 0; background: none; font: inherit; text-align: left;
  font-size: var(--text-micro); font-weight: var(--weight-medium); letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-tertiary);
}
.mb-group:first-child { margin-top: var(--space-4); }
.mb-away { cursor: pointer; }
.mb-away svg { width: 12px; height: 12px; align-self: center; transition: rotate var(--dur-fast) var(--ease-out); rotate: -90deg; }
.mb-away[aria-expanded="true"] svg { rotate: 0deg; }

.mb-name-line { display: flex; align-items: baseline; gap: var(--space-8); min-width: 0; }
.mb-name-line > .c-slide { min-width: 0; }
.mb-tag {
  flex: none; padding: 0 var(--space-6); border-radius: var(--radius-pill); box-shadow: inset 0 0 0 var(--stroke-hairline) var(--fill-selected);
  font-size: var(--text-micro); line-height: 16px; color: var(--ink-tertiary);
}

/* a line of variants: a header row that opens; inside, the parts that tell them apart, then the variants */
.mb-line { position: relative; display: flex; align-items: center; border-radius: var(--radius-tag); }
.mb-line:hover { background: var(--fill-hover); }
.mb-lhead {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: var(--space-8); min-height: 46px; margin: 0; padding: var(--space-6) var(--space-8);
  border: 0; background: none; font: inherit; color: var(--ink-primary); text-align: left; cursor: pointer; border-radius: var(--radius-tag);
}
.mb-lhead > svg { flex: none; width: var(--size-icon-sm); height: var(--size-icon-sm); color: var(--ink-tertiary); rotate: -90deg; transition: rotate var(--dur-fast) var(--ease-out); }
.mb-line.is-open .mb-lhead > svg { rotate: 0deg; }
.mb-ltext { display: flex; flex-direction: column; min-width: 0; }
.mb-ltitle { display: flex; align-items: baseline; gap: var(--space-8); font-size: var(--text-body); font-weight: var(--weight-medium); }
.mb-lcount { font-size: var(--text-small); font-weight: var(--weight-regular, 400); color: var(--ink-tertiary); font-variant-numeric: tabular-nums; }
.mb-lall { flex: none; margin-right: var(--space-8); font-size: var(--text-small); }
.mb-parts { display: flex; flex-wrap: wrap; gap: var(--space-4); padding: var(--space-4) var(--space-8) var(--space-8) calc(var(--space-8) + var(--size-icon-sm) + var(--space-8)); }
.mb-part { height: 24px; padding: 0 var(--space-8); gap: var(--space-4); font-size: var(--text-small); }
.mb-part.on { background-color: var(--fill-selected); color: var(--ink-primary); }
.mb-child { margin-left: calc(var(--size-icon-sm) + var(--space-8)); }

/* the preview: what the hovered model (or line) is */
.mb-preview {
  padding: var(--space-12); border-radius: var(--radius-tag); background: var(--fill-field);
  font-size: var(--text-small); color: var(--ink-secondary); align-self: start; max-height: 100%;
}
.mb-pv-kicker { font-size: var(--text-micro); letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-tertiary); }
.mb-pv-title { margin-top: var(--space-4); font-size: var(--text-body); font-weight: var(--weight-medium); color: var(--ink-primary); overflow-wrap: anywhere; }
.mb-pv-sub { margin-top: var(--space-2); color: var(--ink-secondary); }
.mb-pv-empty .mb-pv-sub { color: var(--ink-tertiary); }
.mb-pv-tags { display: flex; flex-wrap: wrap; gap: var(--space-4); margin-top: var(--space-8); }
.mb-pv-tag { padding: 0 var(--space-6); border-radius: var(--radius-pill); background: var(--fill-selected); line-height: 20px; color: var(--ink-secondary); }
.mb-pv-method { margin-top: var(--space-8); line-height: 1.45; color: var(--ink-secondary); }
.mb-pv-method:empty { display: none; }
.mb-pv-block { margin-top: var(--space-8); }
.mb-pv-label { color: var(--ink-tertiary); }
.mb-pv-facts { display: grid; grid-template-columns: auto 1fr; gap: var(--space-2) var(--space-12); margin: var(--space-12) 0 0; }
.mb-pv-facts dt { color: var(--ink-tertiary); }
.mb-pv-facts dd { margin: 0; color: var(--ink-secondary); font-variant-numeric: tabular-nums; }
.mb-pv-acts { display: flex; flex-wrap: wrap; gap: var(--space-12); margin-top: var(--space-12); }

/* ---------- responsive layout (strictly <= 960px) ---------- */
@media (max-width: 960px) {
  .mb-body { grid-template-columns: 168px minmax(0, 1fr); gap: var(--space-12); }
  .mb-preview { display: none; }
}
@media (max-width: 600px) {
  .mb-head { flex-wrap: wrap; gap: var(--space-8); padding-right: 0; }
  .mb-body { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 136px) minmax(0, 1fr); gap: var(--space-8); }
  .mb-rail { border-bottom: var(--stroke-hairline) solid var(--fill-selected); padding: 0 0 var(--space-8); }
  .pk-foot-line { flex-wrap: wrap; height: auto; gap: var(--space-6) var(--space-12); }
}
@media (max-width: 440px) {
  .lp-map { padding: var(--space-6) var(--space-4) var(--space-8); }
  .lp-tiles .c-tile { min-width: 0; padding: 0 2px; font-size: var(--text-axis); }
  .lp-eu-tiles { --eu-tile: minmax(0, 1fr); width: 100%; }
  .lp-eu-tiles .c-tile { aspect-ratio: 1; }
}
