/* ***************************************************
 * MAP LAYOUT
 * The replay with its playback bar below the map (the map card of the result pages is in the section RESULT PAGES).
 * *************************************************** */

/* Remove focus ring from the map shell when the replay uses it as a neutral keyboard target after closing the speed
   dropdown of the playback bar. */
#analyzer-map-shell:focus,
#analyzer-map-shell:focus-visible {
  outline: none;
  box-shadow: none;
}

/* Note: .sesam-ellipsis lives in static/css/components.css.
   Nav-tabs styling (gray inactive, SESAM-blue hover/active) lives in
   static/css/base.css. */

/* ***************************************************
 * BADGES AND INTERACTIVE ELEMENTS
 * Clickable links inside analyzer tables.
 * *************************************************** */

.edge-link,
.trip-link {
  cursor: pointer;
}

/* ***************************************************
 * CHART
 * Layout and styling for the trip statistics chart
 * and its metric selector buttons.
 * *************************************************** */

.chart-container {
  position: relative;
  min-height: 290px;
}

/* In the tab Trip Statistics the chart takes the fixed height of the tab (variant G of issue #514) */
.sesam-analyzer-chart-pane .chart-container {
  min-height: 0;
}

/* The bar of the chart tabs is the slim row of the table tabs (.sesam-analyzer-table-bar): the metric as a segmented
   control (.sesam-segmented, like the Simulator) on the left, the trips on the right. A click does not leave a focus
   ring on the chosen metric; the keyboard still gets one. */
.sesam-analyzer-chart-metric > .btn {
  font-size: var(--sesam-text-meta);
  line-height: 1.25;
}

.sesam-analyzer-chart-metric > .btn-check:focus:not(:focus-visible) + .btn,
.sesam-analyzer-chart-filter > .btn:focus:not(:focus-visible) {
  box-shadow: none;
}

.sesam-analyzer-chart-filter {
  margin-left: auto;
}

.sesam-analyzer-chart-filter > .btn {
  font-size: var(--sesam-text-meta);
  line-height: 1.25;
}

/* The chosen trips in the menu use the SESAM blue active highlight. */
[data-role="chart-filter-dropdown"] .dropdown-item.active,
[data-role="chart-filter-dropdown"] .dropdown-item:active {
  background-color: var(--sesam-blue);
  color: #fff;
}

/* ---- the tab Trip Statistics (chart.js): two columns like the tab Overview, the metrics with their means on the
   left, the distribution of the chosen one in the full height on the right */
.sesam-analyzer-tripstats {
  grid-template-columns: minmax(15rem, 0.32fr) minmax(0, 1fr);
}

/* Less room below than in the tab Overview: the x axis has no title, its labels end the column */
.sesam-analyzer-tripstats > .sesam-analyzer-overview-col {
  padding-bottom: 0.5rem;
}

.sesam-analyzer-tripstats-metrics {
  display: flex;
  flex-direction: column;
}

/* A metric is a row of the key figure list; the chosen one is tinted blue like a segmented control. The tint reaches
   a little past the text on both sides (padding, taken back by a negative margin), so the text stays in line with the
   title and the note. Two classes, so the spacing of the list on the office display (.sesam-analyzer-runfact) does
   not take the side padding away. */
.sesam-analyzer-tripstats-metrics > .sesam-analyzer-tripstats-metric {
  margin: 0 -0.5rem;
  padding-right: 0.5rem;
  padding-left: 0.5rem;
  border-radius: 0.25rem 0.25rem 0 0;
  cursor: pointer;
}

.sesam-analyzer-tripstats-metric:hover {
  background: var(--sesam-content-bg);
}

.btn-check:checked + .sesam-analyzer-tripstats-metric {
  background: rgba(var(--sesam-blue-rgb), 0.1);
}

.btn-check:checked + .sesam-analyzer-tripstats-metric,
.btn-check:checked + .sesam-analyzer-tripstats-metric .sesam-analyzer-tripstats-mean {
  color: var(--sesam-blue);
  font-weight: 600;
}

/* The keyboard still shows where it is */
.btn-check:focus-visible + .sesam-analyzer-tripstats-metric {
  outline: 2px solid rgba(var(--sesam-blue-rgb), 0.5);
  outline-offset: -2px;
}

.sesam-analyzer-tripstats-mean {
  color: var(--sesam-heading-color);
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}

/* The chosen class behind the titles: quiet, in the colour of its button, so the choice reads as one for both columns */
.sesam-analyzer-tripstats-class {
  margin-left: 0.5rem;
  color: var(--sesam-analyzer-load-color);
  font-size: var(--sesam-text-meta);
  font-weight: 400;
}

.sesam-analyzer-tripstats-class::before {
  content: "· ";
  color: var(--sesam-gray-500);
}

.sesam-analyzer-tripstats-class i {
  margin-right: 0.125rem;
}

.sesam-analyzer-tripstats-note {
  margin: auto 0 0;
  padding-top: 0.5rem;
  /* Lighter, like the other notes of the tabs */
  color: var(--sesam-gray-500);
  font-size: var(--sesam-text-meta);
}

/* The chart fills the rest of its column */
.sesam-analyzer-chart-canvas {
  flex: 1 1 auto;
  min-height: 0;
}

/* ***************************************************
 * TABLES
 * Trips and Edges of the result pages (analyzer/js/paged_table.js): the look of the other SESAM tables
 * (.sesam-scenario-table.sesam-data-table in components.css, the Workspace pager below), plus sortable headers and
 * the map buttons of the rows.
 * *************************************************** */

/* The header band and the row hover of the Workspace list (.sesam-workspace-table in components.css); the header
   cells hold the sort buttons */
.sesam-analyzer-data-table th {
  padding: 0.6875rem 0.75rem;
  background: var(--sesam-card-header-bg);
  vertical-align: bottom;
}

.sesam-analyzer-data-table tbody tr:hover td {
  background: var(--sesam-card-header-bg);
}

/* A centred column (paged_table.js `align: "center"`): the map buttons and the clock times, which are all equally
   wide. Two classes: the shared header rule (.sesam-scenario-table th) left-aligns the headers. */
.sesam-analyzer-data-table .sesam-analyzer-col-center {
  font-variant-numeric: tabular-nums;
  text-align: center;
}

/* A vehicle type opens the modal with its parameters (vtype_dialog.js): a quiet link in SESAM blue, no underline */
.sesam-analyzer-vtype-link {
  padding: 0;
  border: 0;
  background: none;
  color: var(--sesam-blue);
  font: inherit;
}

.sesam-analyzer-vtype-link:hover,
.sesam-analyzer-vtype-link:focus-visible {
  color: var(--sesam-heading-color);
}

/* The modal of a vehicle type: the head like the page header (icon tile, name, class), the parameters as a calm list
   like Key Figures; the comparison adds a column per simulation */
.sesam-analyzer-vtype-head {
  gap: 0.75rem;
}

.sesam-analyzer-vtype-heading {
  flex: 1 1 auto;
  min-width: 0;
}

.sesam-analyzer-vtype-title {
  overflow: hidden;
  font-family: var(--bs-font-monospace);
  font-size: 1rem;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sesam-analyzer-vtype-class {
  margin: 0.125rem 0 0;
  color: var(--sesam-gray-600);
  font-size: var(--sesam-text-meta);
}

.sesam-analyzer-vtype-params {
  margin: 0;
  font-size: var(--sesam-text-body);
}

.sesam-analyzer-vtype-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 1rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--sesam-card-border);
}

.sesam-analyzer-vtype-params.is-compare .sesam-analyzer-vtype-row {
  grid-template-columns: minmax(0, 1fr) minmax(6rem, auto) minmax(6rem, auto);
}

.sesam-analyzer-vtype-row dt {
  color: var(--sesam-gray-700);
  font-weight: 400;
}

.sesam-analyzer-vtype-row dd {
  margin: 0;
  color: var(--sesam-value-color);
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  text-align: right;
  white-space: nowrap;
}

/* The vehicle class in the list: its icon in front of the name */
.sesam-analyzer-vtype-row dd.sesam-analyzer-vtype-vclass {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.4rem;
}

.sesam-analyzer-vtype-vclass i {
  color: var(--sesam-gray-600);
}

.sesam-analyzer-vtype-row-head dd {
  color: var(--sesam-gray-600);
  font-size: 0.75rem;
  font-weight: 600;
}

.sesam-analyzer-vtype-empty {
  margin: 0;
  color: var(--sesam-gray-600);
}

/* A vehicle class with the icon of the lane permissions in front */
.sesam-analyzer-vclass {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.sesam-analyzer-vclass i {
  color: var(--sesam-gray-600);
}

/* Rows of 2rem: the paged tables fill the height of their tab with whole rows (paged_table.js, ROW_HEIGHT). Every cell
   centred vertically: `.sesam-scenario-table td` (components.css) comes after `.sesam-data-table td` with the same
   specificity and sets `top`, which put ids and values at the top of a row next to the map buttons. */
.sesam-analyzer-data-table tbody td {
  height: 2rem;
  padding-top: 0;
  padding-bottom: 0;
  color: var(--sesam-value-color);
  vertical-align: middle;
}

/* The row of "Show in table" (selection highlight of the map) */
.sesam-analyzer-data-table tbody tr.is-selected td {
  background: rgba(var(--sesam-blue-rgb), 0.08);
}

/* A column name as a button: the header typography of the shared rule (uppercase, gray), an arrow on the right that
   shows the sort (blue for the sorted column) */
.sesam-analyzer-sort {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  white-space: nowrap;
  cursor: pointer;
}

.sesam-analyzer-sort i {
  color: var(--sesam-gray-400);
  font-size: 0.6875rem;
}

.sesam-analyzer-sort:hover,
.sesam-analyzer-sort:focus-visible,
.sesam-analyzer-data-table th[aria-sort] .sesam-analyzer-sort {
  color: var(--sesam-heading-color);
}

.sesam-analyzer-data-table th[aria-sort] .sesam-analyzer-sort i {
  color: var(--sesam-blue);
}

/* The map buttons (locate an edge, show the route of a trip) as quiet icon buttons without a frame (issue #505): gray,
   a light blue ground and the blue icon on hover and focus, so their rows stay as high and as calm as the others */
.sesam-analyzer-row-map {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  padding: 0;
  border: 0;
  border-radius: 0.375rem;
  background: none;
  color: var(--sesam-gray-600);
  font-size: 0.875rem;
  line-height: 1;
}

.sesam-analyzer-row-map:hover,
.sesam-analyzer-row-map:focus-visible,
.sesam-analyzer-row-map.active {
  background: rgba(var(--sesam-blue-rgb), 0.1);
  color: var(--sesam-blue);
}

/* ***************************************************
   PLAYBACK CONTROLS
   *************************************************** */

/* Ensure all transport buttons have equal width */
.analyzer-playback-controls__transport .btn {
  width: 32px; /* fixed width - otherwise play/pause have different widths */
  height: 32px;
  display: inline-flex; /* center icon properly */
  align-items: center;
  justify-content: center;
}

/* Use tabular numerals so equal-length time labels stay visually stable. */
.analyzer-playback-controls__time-label {
  appearance: none;
  border: 0;
  background: transparent;
  display: inline-block;
  padding: 0;
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}

.analyzer-playback-controls__time-label:hover,
.analyzer-playback-controls__time-label:focus-visible {
  color: var(--bs-body-color) !important;
}

/* Let clicks on the speed label pass through to the dropdown button */
.analyzer-playback-controls [data-role="speed-dropdown-label"] {
  pointer-events: none;
}

/* Playback speed dropdown: enforce SESAM blue for btn-primary */
.analyzer-playback-controls [data-role="speed-dropdown-toggle"].btn-primary {
  --bs-btn-bg: var(--sesam-blue);
  --bs-btn-border-color: var(--sesam-blue);
  --bs-btn-hover-bg: var(--sesam-blue);
  --bs-btn-hover-border-color: var(--sesam-blue);
  --bs-btn-active-bg: var(--sesam-blue);
  --bs-btn-active-border-color: var(--sesam-blue);
}

.analyzer-playback-controls [data-role="speed-dropdown-toggle"].btn-primary:focus,
.analyzer-playback-controls [data-role="speed-dropdown-toggle"].btn-primary.focus {
  background-color: var(--sesam-blue);
  border-color: var(--sesam-blue);
  box-shadow: none;
}

/* Playback speed dropdown: fixed width */
.analyzer-playback-controls [data-role="speed-dropdown-toggle"] {
  width: 65px; /* adjust as needed (e.g. 80–100px) */
  text-align: center; /* keeps label centered */
  box-shadow: none;
}

/* Ensure text + caret are spaced nicely */
.analyzer-playback-controls [data-role="speed-dropdown-toggle"]::after {
  margin-left: 0.4rem; /* default is ~0.255em → this increases spacing */
}

/* ***************************************************
   PLAYBACK LOOP SWITCH
   Compact vertical switch with icon (top) and toggle (bottom)
   *************************************************** */

/* Container: stack icon and switch vertically and align the block
   slightly lower so it matches the slider axis more closely. */
.analyzer-playback-controls__loop {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin-top: 4px;
}

/* Remove Bootstrap default offset from form-switch */
.analyzer-playback-controls__loop.form-switch {
  padding-left: 0;
}

/* Icon label above the switch */
.analyzer-playback-controls__loop-label {
  margin-bottom: 0.2rem;
  font-size: 1rem;
  line-height: 1;
  color: var(--bs-gray-400);
  cursor: pointer;
  transition: color 0.1s ease;
}

/* Switch input: remove Bootstrap margins and render slightly smaller.
   transform-origin keeps visual alignment predictable. */
.analyzer-playback-controls__loop .form-check-input {
  margin: 0;
  margin-left: 0;
  transform: scale(0.85);
  transform-origin: top center;
  background-color: var(--bs-gray-100);
  border-color: var(--bs-gray-300);
  cursor: pointer;
  transition:
    background-color 0.1s ease,
    border-color 0.1s ease;
}

/* Off-state hover: make the loop control read as clickable without using the active color.
   Keep this darker than the default off state but clearly lighter than the SESAM-blue
   active state. The :has(:checked) guard prevents hover styles from muting the active state. */
.analyzer-playback-controls__loop:not(:has(.form-check-input:checked)):hover .analyzer-playback-controls__loop-label,
.analyzer-playback-controls__loop:not(:has(.form-check-input:checked)):focus-within
  .analyzer-playback-controls__loop-label {
  color: var(--bs-gray-500);
}

/* Apply the same off-state hover/focus contrast to the switch itself. */
.analyzer-playback-controls__loop:not(:has(.form-check-input:checked)):hover .form-check-input,
.analyzer-playback-controls__loop:not(:has(.form-check-input:checked)) .form-check-input:focus-visible {
  background-color: var(--bs-gray-200);
  border-color: var(--bs-gray-400);
}

/* Active state: use SESAM brand color for the switch */
.analyzer-playback-controls__loop .form-check-input:checked {
  background-color: var(--sesam-blue);
  border-color: var(--sesam-blue);
}

/* Active state: also highlight the loop icon */
.analyzer-playback-controls__loop:has(.form-check-input:checked) .analyzer-playback-controls__loop-label {
  color: var(--sesam-blue);
}

/* Focus state: remove default Bootstrap glow */
.analyzer-playback-controls__loop .form-check-input:focus {
  box-shadow: none;
}

/* ***************************************************
 * MAP INFO PANEL
 * The info panel of the clicked element is the panel "Selection" of the panel column of the map (issues #514, #505):
 * a side card (.sesam-side-card in components.css) with a calm list of fixed values like the Key Figures, no form
 * fields: label left, value right, thin lines between the rows (map/selection_card.js). The actions are quiet icon
 * buttons in the head next to ×.
 * *************************************************** */

/* The actions in the head: icon buttons without a frame, a light blue ground on hover; Follow stays blue while the
   map follows the vehicle */
.sesam-analyzer-selection-actions {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 0.125rem;
  margin-left: auto;
}

.sesam-analyzer-selection-actions:empty {
  display: none;
}

.sesam-analyzer-selection-action {
  display: inline-grid;
  place-items: center;
  width: 1.75rem;
  height: 1.75rem;
  padding: 0;
  border: 0;
  border-radius: 0.375rem;
  background: none;
  color: var(--sesam-gray-600);
  font-size: 0.875rem;
}

.sesam-analyzer-selection-action:hover,
.sesam-analyzer-selection-action:focus-visible,
.sesam-analyzer-selection-action.active {
  background: rgba(var(--sesam-blue-rgb), 0.1);
  color: var(--sesam-blue);
}

/* A compact head of the Selection card: the same space above the title and below the description, and the icon
   buttons reach a little over the line of the title instead of making it taller */
.sesam-analyzer-selection .sesam-side-card-head {
  padding: 0.6rem 0.75rem 0.6rem 1rem;
}

.sesam-analyzer-selection .sesam-side-card-desc {
  margin-top: 0.1rem;
  line-height: 1.4;
}

.sesam-analyzer-selection .sesam-analyzer-selection-action,
.sesam-analyzer-selection .sesam-net-close {
  margin-block: -0.2rem;
}

/* The rows bring their own padding: the body adds only a little, so the space above the first row and below the
   last one matches the head */
.sesam-side-card-body:has(> .sesam-analyzer-selection-rows) {
  padding: 0.1rem 1rem 0.2rem;
}

.sesam-analyzer-selection-rows {
  display: flex;
  flex-direction: column;
}

.sesam-analyzer-selection-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  /* Compact enough that a whole vehicle (nine rows) fits beside a map of an office screen's default height */
  min-height: 2.2rem;
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--sesam-card-border);
  font-size: var(--sesam-text-meta);
}

.sesam-analyzer-selection-row:last-child {
  border-bottom: 0;
}

.sesam-analyzer-selection-label {
  flex: none;
  color: var(--sesam-gray-700);
}

/* The value: right-aligned, cut with an ellipsis rather than wrapped (the whole text is the tooltip) */
.sesam-analyzer-selection-value {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.3rem;
  min-width: 0;
  color: var(--sesam-value-color);
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  text-align: right;
}

.sesam-analyzer-selection-text {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
}

.sesam-analyzer-selection-unit {
  flex: none;
}

/* A SUMO id in monospace, the small copy button after it */
.sesam-analyzer-selection-id {
  font-family: var(--bs-font-monospace);
  font-size: 0.75rem;
}

.sesam-analyzer-selection-copy {
  display: inline-grid;
  flex: none;
  place-items: center;
  width: 1.375rem;
  height: 1.375rem;
  padding: 0;
  border: 0;
  border-radius: 0.25rem;
  background: none;
  color: var(--sesam-gray-600);
  font-size: 0.75rem;
}

.sesam-analyzer-selection-copy:hover,
.sesam-analyzer-selection-copy:focus-visible {
  background: rgba(var(--sesam-blue-rgb), 0.1);
  color: var(--sesam-blue);
}

/* The allowed vehicle classes: the icons fill the value from the right ("+3" for those that do not fit) */
.sesam-analyzer-selection-icons {
  flex: 1 1 auto;
  color: var(--sesam-gray-600);
}

/* The position: a link that shows it on the map (a button in the look of a link, no underline) */
.sesam-analyzer-selection-link {
  min-width: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--sesam-blue);
  font: inherit;
}

.sesam-analyzer-selection-link:hover,
.sesam-analyzer-selection-link:focus-visible {
  color: var(--sesam-heading-color);
}

/* The status of a closed lane and the closed lanes of an edge: the barrier beside the text (only shown when closed) */
.sesam-analyzer-lane-status {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

/* The value of the metric that colours the map, first in the card of an edge (analysis, issue #505): a quiet tint,
   the swatch in the colour of the edge on the map */
.sesam-analyzer-selection-row.is-metric {
  margin: 0 -1rem;
  padding-right: 1rem;
  padding-left: 1rem;
  background: rgba(var(--sesam-blue-rgb), 0.05);
}

.sesam-analyzer-selection-row.is-metric .sesam-analyzer-selection-label {
  color: var(--sesam-heading-color);
  font-weight: 600;
}

.sesam-analyzer-metric-swatch {
  flex: none;
  width: 0.625rem;
  height: 0.625rem;
  border-radius: 2px;
}

/* The cycle of a traffic light in the Signal Plan card (signal_cycle.js): one bar with a segment per phase (the
   running one in SESAM blue, a range lighter from its minimum on), the line of the replay time and the length of the
   bar. The segments open the signal plan at their phase. */
.sesam-analyzer-cycle {
  padding: 0.15rem 0 0.35rem;
  border-top: 1px solid var(--sesam-card-border);
}

/* "Current phase" as a row of the card, its bar directly below it without a line in between */
.sesam-analyzer-cycle-current {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 2.3rem;
  font-size: var(--sesam-text-meta);
}

.sesam-analyzer-cycle-bar {
  position: relative;
  height: 1.375rem;
  overflow: hidden;
  border-radius: 0.3rem;
  background: var(--sesam-surface-muted);
}

/* Position and width come from the program (inline values); the right border keeps the segments apart */
.sesam-analyzer-cycle-segment {
  --sesam-cycle-alpha: 0.45;
  position: absolute;
  top: 0;
  bottom: 0;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-right: 2px solid var(--sesam-card-bg);
  background: rgba(var(--sesam-blue-rgb), var(--sesam-cycle-alpha));
  color: var(--bs-white);
  font-size: 0.6875rem;
  font-weight: 600;
  line-height: 1;
}

/* A phase with a range: darker up to its minimum (--sesam-cycle-min-share, set per segment), lighter up to its
   maximum */
.sesam-analyzer-cycle-segment.is-range {
  background: linear-gradient(
    to right,
    rgba(var(--sesam-blue-rgb), var(--sesam-cycle-alpha)) var(--sesam-cycle-min-share),
    rgba(var(--sesam-blue-rgb), calc(var(--sesam-cycle-alpha) * 0.4)) var(--sesam-cycle-min-share)
  );
}

.sesam-analyzer-cycle-segment:hover,
.sesam-analyzer-cycle-segment:focus-visible {
  --sesam-cycle-alpha: 0.7;
  outline: none;
}

.sesam-analyzer-cycle-segment.is-running {
  --sesam-cycle-alpha: 1;
}

.sesam-analyzer-cycle-now {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  margin-left: -1px;
  background: var(--sesam-heading-color);
  pointer-events: none;
}

.sesam-analyzer-cycle-scale {
  display: flex;
  justify-content: space-between;
  margin-top: 0.2rem;
  color: var(--sesam-gray-600);
  font-size: 0.6875rem;
}

/* A value that shows a place on the map (the edges of a trip, the position): the locate icon in front of it */
.sesam-analyzer-map-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
}

.sesam-analyzer-map-link i {
  flex: none;
  font-size: 0.75rem;
}

/* "Not during the run" in place of the arrival time */
.sesam-analyzer-value-note {
  color: var(--sesam-gray-500);
  font-weight: 400;
}

/* The edge a trip starts or ends on: monospace like the ids; the link shows the edge on the map */
.sesam-analyzer-edge-link,
.sesam-analyzer-edge-id {
  font-family: var(--bs-font-monospace);
  font-size: 0.75rem;
}

.sesam-analyzer-edge-link {
  color: var(--sesam-blue);
  text-decoration: none;
}

.sesam-analyzer-edge-link:hover,
.sesam-analyzer-edge-link:focus-visible {
  color: var(--sesam-heading-color);
  text-decoration: none;
}

/* ***************************************************
 * ANALYSIS METRIC LEGEND
 * The legend of the metric that colours the edges (AnalysisMetricLegendControl, issue #505): a compact strip at the
 * bottom centre of the analysis map, which is free there (the controls are on the left, the panels on the right). The
 * name and unit of the metric beside it, one colour per class with its range below.
 * *************************************************** */

.analysis-metric-legend {
  position: absolute;
  bottom: 0.75rem;
  left: 50%;
  /* Above the canvas of the map, below the controls and the panels they open (their corners have 2) */
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.2rem 0.6rem;
  max-width: calc(100% - 1.5rem);
  padding: 0.3rem 0.55rem;
  border: 1px solid var(--bs-gray-200);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  color: var(--sesam-gray-700);
  font-family: "Inter", sans-serif;
  font-size: 0.625rem;
  transform: translateX(-50%);
}

.analysis-metric-legend[hidden] {
  display: none;
}

.analysis-metric-legend__title {
  color: var(--sesam-heading-color);
  font-size: 0.6875rem;
  font-weight: 600;
  white-space: nowrap;
}

.analysis-metric-legend__strip {
  display: flex;
  gap: 1px;
}

/* One class: its colour as a part of the strip, its range below it (as wide as its text needs) */
.analysis-metric-legend__class {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  min-width: 2.25rem;
}

.analysis-metric-legend__swatch {
  align-self: stretch;
  height: 0.375rem;
}

.analysis-metric-legend__class:first-child .analysis-metric-legend__swatch {
  border-radius: 3px 0 0 3px;
}

.analysis-metric-legend__class:last-child .analysis-metric-legend__swatch {
  border-radius: 0 3px 3px 0;
}

.analysis-metric-legend__label {
  padding: 0 0.15rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ***************************************************
 * COMPARE VIEW
 * Two simulations, color-coded:
 * the baseline ("before") and the variant ("after").
 * The comparison colors are app-local to the analyzer.
 * *************************************************** */

:root {
  --sesam-compare-baseline: var(--sesam-blue);
  --sesam-compare-baseline-rgb: var(--sesam-blue-rgb);
  --sesam-compare-variant: #c0631a; /* orange counterpart to the blue baseline */
  --sesam-compare-variant-rgb: 192, 99, 26;
  /* The colours of a change that is better or worse (design of 2026-11-24): a clear green, friendlier than the olive
     SESAM green, and a strong red; both reach 4.5:1 as text on white */
  --sesam-change-better: #198754;
  --sesam-change-worse: var(--sesam-red-strong);
}

/* ***************************************************
 * START PAGE (issue #504)
 * The scenario browser with the intent `analyze`: scenarios
 * as groups of their simulations, the Compare blocks in the
 * colours of the comparison page, and the candidates.
 * *************************************************** */

.sesam-analyzer-start {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0.5rem 0;
}

/* Space between the page head and the first block or the browser */
.sesam-analyzer-start-head {
  margin-bottom: 1.25rem;
}

/* The browser brings its own centring and padding (.sesam-workspace); inside a block it fills the block */
.sesam-step-card .sesam-analyzer-browser {
  padding: 0;
}

/* Compare: the variant block takes the variant colour of the comparison page */
.sesam-step-card-variant {
  --sesam-step-color: var(--sesam-compare-variant);
  --sesam-step-color-rgb: var(--sesam-compare-variant-rgb);
}

/* ------------------------------------------------------------------ groups of simulations */

/* Fixed column widths: the name column takes the rest and long names, descriptions and lines of facts end with "…"
   instead of widening the table. Below the minimum width the table scrolls inside its card. */
.sesam-analyzer-table-wrap,
.sesam-analyzer-candidate-scroll {
  overflow-x: auto;
  container-type: inline-size;
}

.sesam-analyzer-groups,
.sesam-analyzer-candidate-table {
  min-width: 40rem;
  table-layout: fixed;
}

/* The column widths include the cell padding */
.sesam-analyzer-groups th,
.sesam-analyzer-candidate-table th {
  box-sizing: border-box;
}

.sesam-analyzer-col-state {
  width: 10.75rem;
}

.sesam-analyzer-col-runs {
  width: 4.5rem;
}

.sesam-analyzer-col-created {
  width: 8.75rem;
}

.sesam-analyzer-groups .sesam-workspace-name,
.sesam-analyzer-groups .sesam-workspace-subline,
.sesam-analyzer-candidate-table .sesam-workspace-name,
.sesam-analyzer-candidate-table .sesam-workspace-subline {
  max-width: 100%;
}

.sesam-analyzer-col-icon {
  width: 2.75rem;
  color: var(--sesam-gray-600);
  text-align: center;
}

/* Wide enough for the pill "Version 12" */
.sesam-analyzer-col-version {
  width: 7rem;
  white-space: nowrap;
}

.sesam-analyzer-col-action {
  width: 10.25rem;
  text-align: right;
}

/* The head row of a scenario: preview, name and the line of plain facts; a click expands its simulations. White like
   the rows of the Simulator list and without the grey hover of the table: only the simulations below it are targets. */
.sesam-analyzer-group-head td,
.sesam-workspace-table tbody .sesam-analyzer-group-head:hover td {
  background: var(--sesam-card-bg);
}

.sesam-analyzer-group-head td {
  border-top: 1px solid var(--sesam-card-border);
  cursor: pointer;
}

.sesam-analyzer-group-head-inner {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  min-width: 0;
}

.sesam-analyzer-group-head-inner .sesam-workspace-name-text {
  flex: 1 1 auto;
}

.sesam-analyzer-group-toggle {
  flex: 0 0 auto;
  width: 1.75rem;
  height: 1.75rem;
  padding: 0;
  border: 0;
  background: none;
  color: var(--sesam-blue);
}

.sesam-analyzer-group-toggle i {
  transition: transform 0.15s ease;
}

.sesam-analyzer-group.is-open .sesam-analyzer-group-toggle i {
  transform: rotate(90deg);
}

.sesam-analyzer-group-name {
  color: var(--sesam-heading-color);
  font-weight: 600;
}

/* The project as a pill, then the line of facts, which takes the rest of the width and ends with "…" */
.sesam-analyzer-group-facts {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
  margin-top: 0.125rem;
}

.sesam-analyzer-group-facts .sesam-workspace-pill {
  flex: 0 0 auto;
}

.sesam-analyzer-group-line {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 100%;
}

.sesam-analyzer-group-count {
  flex: 0 0 auto;
  margin-left: auto;
  color: var(--sesam-gray-600);
  font-size: var(--sesam-text-meta);
  white-space: nowrap;
}

/* Rows that open something show it with the pointer and the grey of the Simulator list while hovered (the row
   background of .sesam-workspace-table) */
.sesam-analyzer-simulation[data-open-url] {
  cursor: pointer;
}

/* The simulations are indented below their scenario (the table has a fixed layout, so the head cell sets the width):
   the name starts where the name of the scenario starts, the icon in a small tile right before it */
.sesam-analyzer-groups th.sesam-analyzer-col-icon {
  width: 8rem;
}

.sesam-analyzer-groups td.sesam-analyzer-col-icon {
  padding-right: 0;
  text-align: right;
}

/* Neutral and light: the blue tile belongs to the page title, the simulation tile stays in the background */
.sesam-analyzer-simulation-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  color: var(--sesam-gray-600);
  background: var(--sesam-card-header-bg);
  border: 1px solid var(--sesam-gray-300);
  border-radius: 0.5rem;
  font-size: 0.875rem;
}

/* A hovered row turns grey like the tile: the tile lightens, so it stays visible on the row */
.sesam-analyzer-simulation[data-open-url]:hover .sesam-analyzer-simulation-icon {
  background: var(--sesam-card-bg);
}

.sesam-analyzer-more td {
  padding-left: 8.75rem;
}

/* "Show all": a link-styled button, without the underline of .btn-link (links are never underlined) */
.sesam-analyzer-more .btn-link {
  padding: 0;
  font-size: var(--sesam-text-body);
  text-decoration: none;
}

/* Row actions: one quiet link per row with its icon in front, like the "Open" links of the result tables and
   "Read more" on the Dashboard. The hovered row is highlighted already, so the link only darkens; all links of a
   column end at the same edge. */
.sesam-analyzer-row-button {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.4rem;
  width: 8.5rem;
  white-space: nowrap;
}

.sesam-analyzer-row-link {
  color: var(--sesam-blue);
  font-size: var(--sesam-text-body);
  text-decoration: none;
}

.sesam-analyzer-row-link:hover,
.sesam-analyzer-row-link:focus-visible {
  color: var(--sesam-heading-color);
}

/* The two modes of the start page as cards below the title (variant B of the Analyze | Compare canvas): icon, name and
   one line, quiet enough not to compete with the heading. The active mode has a thin SESAM blue frame on a light tint,
   a blue icon and a check; the other one is white with a grey icon. */
.sesam-analyzer-mode-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.sesam-analyzer-mode-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 1rem;
  border: 1px solid var(--sesam-card-border);
  border-radius: 0.625rem;
  background: var(--sesam-card-bg);
  color: var(--sesam-heading-color);
  text-decoration: none;
}

.sesam-analyzer-mode-card:hover {
  border-color: var(--sesam-gray-400);
  color: var(--sesam-heading-color);
}

.sesam-analyzer-mode-card.is-active,
.sesam-analyzer-mode-card.is-active:hover {
  border-color: rgba(var(--sesam-blue-rgb), 0.6);
  background: rgba(var(--sesam-blue-rgb), 0.05);
}

.sesam-analyzer-mode-card-icon {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 0.5rem;
  background: var(--sesam-card-header-bg);
  color: var(--sesam-gray-600);
  font-size: 0.875rem;
}

.sesam-analyzer-mode-card.is-active .sesam-analyzer-mode-card-icon {
  background: rgba(var(--sesam-blue-rgb), 0.12);
  color: var(--sesam-blue);
}

.sesam-analyzer-mode-card-text {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  min-width: 0;
}

.sesam-analyzer-mode-card-title {
  font-size: 1rem;
  font-weight: 600;
}

.sesam-analyzer-mode-card-line {
  color: var(--sesam-gray-600);
  font-size: var(--sesam-text-meta);
}

/* The check at the end of the active mode */
.sesam-analyzer-mode-card-check {
  color: var(--sesam-blue);
}

/* On a phone the cards stack and drop their line */
@media (max-width: 575.98px) {
  .sesam-analyzer-mode-cards {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.5rem;
  }

  .sesam-analyzer-mode-card-line {
    display: none;
  }
}

/* An action that is not available (the status page is gone, no overview to compare): grey, not clickable */
.sesam-analyzer-row-link.is-disabled {
  color: var(--sesam-gray-500);
  cursor: not-allowed;
}

.sesam-analyzer-groups.is-compare .sesam-analyzer-row-button {
  width: 9.25rem;
}

.sesam-analyzer-groups.is-compare .sesam-analyzer-col-action {
  width: 11rem;
}

/* A narrow table keeps its buttons but hides their labels first (design guidelines, responsive behavior); the icon
   keeps the title. */
@container (max-width: 58rem) {
  .sesam-analyzer-row-label {
    display: none;
  }

  .sesam-analyzer-row-button,
  .sesam-analyzer-groups.is-compare .sesam-analyzer-row-button {
    width: 2.25rem;
  }

  .sesam-analyzer-col-action,
  .sesam-analyzer-groups.is-compare .sesam-analyzer-col-action {
    width: 3.75rem;
  }
}

/* On a phone the rows stack (design D of #504): name and state on the left, the button on the right; version, runs
   and the creation date are left out, the scenario of a candidate goes below its name. */
@container (max-width: 36rem) {
  .sesam-analyzer-groups,
  .sesam-analyzer-candidate-table {
    display: block;
    min-width: 0;
  }

  .sesam-analyzer-groups thead,
  .sesam-analyzer-candidate-table thead,
  .sesam-analyzer-groups td.sesam-analyzer-col-icon,
  .sesam-analyzer-groups td.sesam-analyzer-col-version,
  .sesam-analyzer-groups td.sesam-analyzer-col-runs,
  .sesam-analyzer-groups td.sesam-analyzer-col-created,
  .sesam-analyzer-candidate-table td.sesam-analyzer-col-icon,
  .sesam-analyzer-candidate-table td.sesam-analyzer-col-version,
  .sesam-analyzer-candidate-table td.sesam-analyzer-col-runs,
  .sesam-analyzer-candidate-table td.sesam-analyzer-col-created {
    display: none;
  }

  .sesam-analyzer-groups tbody:not([hidden]),
  .sesam-analyzer-candidate-table tbody {
    display: block;
  }

  .sesam-analyzer-groups tr:not([hidden]),
  .sesam-analyzer-candidate-table tr:not([hidden]) {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    column-gap: 0.75rem;
    row-gap: 0.25rem;
    border-bottom: 1px solid var(--sesam-surface-muted);
  }

  /* The row draws the separator; the borders of the cells would show as fragments */
  .sesam-analyzer-groups td,
  .sesam-analyzer-candidate-table td {
    display: block;
    border: 0;
  }

  .sesam-analyzer-col-name,
  .sesam-analyzer-col-state,
  .sesam-analyzer-col-scenario {
    grid-column: 1;
    padding-top: 0.25rem;
    padding-bottom: 0.25rem;
  }

  .sesam-analyzer-col-action {
    grid-column: 2;
    grid-row: 1 / span 2;
    width: auto;
  }

  .sesam-analyzer-group-head td {
    grid-column: 1 / -1;
  }

  .sesam-analyzer-group-head-inner {
    flex-wrap: wrap;
  }

  .sesam-analyzer-group-head-inner .sesam-workspace-name-text {
    flex-basis: 10rem;
  }

  .sesam-analyzer-group-count {
    margin-left: 2.625rem;
  }

  /* Phones have no icon column: the simulations are indented like the count line of their scenario */
  .sesam-analyzer-groups tr.sesam-analyzer-simulation:not([hidden]),
  .sesam-analyzer-groups tr.sesam-analyzer-more:not([hidden]) {
    padding-left: 2.625rem;
  }

  .sesam-analyzer-more td {
    padding-left: 1rem;
  }

  .sesam-analyzer-candidate-section {
    padding-right: 1rem;
    padding-left: 1rem;
  }
}

/* ------------------------------------------------------------------ Compare, step 2 */

/* "Change" of the variant ends flush with "Compare" of the candidates below, which sits inside the table frame by the
   border and the cell padding. On a phone the rows are stacked and nothing lines up with it. */
@media (min-width: 576px) {
  .sesam-analyzer-start .sesam-step-card-variant .sesam-step-card-link {
    margin-right: calc(1px + 0.75rem);
  }
}

/* Up to 21rem next to the title; on a phone it wraps below the title and takes the width */
.sesam-analyzer-candidate-search {
  flex: 1 1 14rem;
  max-width: 21rem;
}

/* The facts of the chosen variant: the project as a pill before the line, as in the list of step 1 */
.sesam-analyzer-variant-facts {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 0.5rem;
}

/* The scenario icon of the result headers before the scenario's name */
.sesam-analyzer-variant-scenario-icon {
  margin-right: 0.35rem;
}

/* In the body size like the search of the toolbar in step 1 (Bootstrap sizes inputs at 1rem) */
.sesam-analyzer-candidate-search .form-control {
  font-size: var(--sesam-text-body);
}

/* The candidates are flat sections of the variant block, not cards inside the card */
.sesam-analyzer-candidate-section {
  padding: 1rem 1.5rem 0.5rem;
}

.sesam-analyzer-candidate-section + .sesam-analyzer-candidate-section {
  margin-top: 0.75rem;
  padding-top: 1.75rem;
  border-top: 1px solid var(--sesam-card-border);
}

.sesam-analyzer-candidate-title {
  margin: 0 0 0.5rem;
  color: var(--sesam-heading-color);
  font-size: var(--sesam-text-item);
  font-weight: 600;
}

.sesam-analyzer-candidate-count {
  color: var(--sesam-gray-600);
  font-weight: 400;
}

.sesam-analyzer-candidate-scroll {
  overflow-x: auto;
}

/* One line like the names: the full name is in the title */
.sesam-analyzer-candidate-scenario {
  max-width: 100%;
  overflow: hidden;
  color: var(--sesam-heading-color);
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* A note rather than content: lighter, like the other notes of the Analyzer */
.sesam-analyzer-candidate-empty {
  margin: 0.25rem 0 0.75rem;
  color: var(--sesam-gray-500);
  font-size: var(--sesam-text-body);
}

/* Failed runs of a finished simulation, below the run count, in the colour of "Finished with errors" */
.sesam-analyzer-failed-runs {
  display: block;
  color: var(--sesam-yellow-strong);
  font-size: 0.75rem;
}

/* ***************************************************
 * RESULT PAGES (issues #505, #514 variant G)
 * Run, overview and comparison (analyzer/results_base.html): the header in two lines, page tabs of the overview and the
 * runs, the map over the full width with its panels inside on the right (as in the Builder) and the tabs below it. The
 * header and the side cards are the shared ones (components.css, sections 12 and 13); this section adds what only the
 * Analyzer needs.
 * *************************************************** */

/* The page fills the window below the topbar: the map takes about two thirds of what the header leaves, the tabs one
   third (flex 2.2 : 1 with the playback bar and the tab bar; 27-inch: map ~745px, tab ~315px; office display: ~500px
   and ~205px). Both keep a minimum, so a small window or a tall header (the role cards of the comparison) scrolls. */
.sesam-analyzer-results {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-height: calc(100vh - var(--sesam-navbar-height) - 0.75rem);
  /* The topbar keeps 1.5rem below it (mb-4); the page starts 0.75rem below it */
  margin-top: -0.75rem;
  padding: 0 0 1rem;
}

/* At least as high as the controls on the left need, with the scale and the attribution below them and the playback
   bar of the replay: a smaller map put them on top of each other (issue #505) */
.sesam-analyzer-maps {
  display: flex;
  flex: 2.2 1 0;
  flex-direction: column;
  min-height: 25rem;
}

/* ---- header: line 1 icon and title, line 2 description, scenario, pills and time window; actions at the title */

.sesam-analyzer-title-row {
  align-items: center;
  gap: 0.75rem;
}

.sesam-analyzer-title-icon {
  flex-basis: 2.5rem;
  width: 2.5rem;
  height: 2.5rem;
  font-size: 1.1rem;
}

/* The actions on the right: centred on the header, the menu as a square icon button a little lower than the icon tile
   on the left; its name "Actions" is the tooltip and the accessible name (issue #505) */
.sesam-analyzer-header {
  align-items: center;
}

.sesam-analyzer-actions-button {
  display: inline-grid;
  place-items: center;
  width: 2.125rem;
  height: 2.125rem;
  padding: 0;
  border-radius: 0.5rem;
}

/* The menu icon in SESAM blue, like the icons of the entries, centred: without the gap the icons of the header
   buttons keep before their text (.sesam-scenario-actions .btn i in components.css) */
.sesam-analyzer-actions .sesam-analyzer-actions-button i {
  margin: 0;
  color: var(--sesam-blue);
  font-size: 0.875rem;
}

.sesam-analyzer-heading {
  margin: 0;
  font-size: 1.25rem;
  line-height: 1.2;
  font-weight: 700;
}

.sesam-analyzer-header .sesam-analyzer-scenario-line {
  gap: 0.25rem 0.625rem;
  margin-top: 0.2rem;
}

/* The description is the first part of the meta line, in the size of the line */
.sesam-analyzer-scenario-line .sesam-analyzer-description {
  margin: 0;
  font-size: inherit;
  line-height: inherit;
}

/* A thin rule between the description and the scenario */
.sesam-analyzer-header-divider {
  width: 1px;
  height: 0.875rem;
  background: var(--sesam-card-border);
}

/* The scenario of the simulation in the meta line: a link in SESAM blue with the scenario icon, then pills */
.sesam-analyzer-scenario-line .sesam-analyzer-scenario-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--sesam-blue);
  font-weight: 500;
}

.sesam-analyzer-scenario-line .sesam-analyzer-scenario-link i {
  margin: 0;
  color: inherit;
}

.sesam-analyzer-scenario-line .sesam-workspace-pill i {
  margin-right: 0.25rem;
}

.sesam-analyzer-time-window {
  color: var(--bs-body-color);
  white-space: nowrap;
}

/* The settings of a role card of the comparison: one quiet line below its scenario */
.sesam-analyzer-settings {
  display: block;
  margin: 0.35rem 0 0;
  font-size: var(--sesam-text-meta);
  color: var(--sesam-gray-600);
}

/* ---- page tabs: Overview, Run 1, Run 2 … (stronger than the tabs of the data) */

.sesam-analyzer-run-tabs {
  display: flex;
  gap: 0.25rem;
  border-bottom: 1px solid var(--sesam-gray-300);
  overflow-x: auto;
  scrollbar-width: thin;
}

.sesam-analyzer-run-tab {
  display: inline-flex;
  align-items: center;
  padding: 0.6rem 1rem;
  border: 0;
  border-bottom: 3px solid transparent;
  background: none;
  color: var(--sesam-gray-600);
  font-size: var(--sesam-text-item);
  font-weight: 500;
  white-space: nowrap;
}

.sesam-analyzer-run-tab:hover,
.sesam-analyzer-run-tab:focus-visible {
  color: var(--sesam-heading-color);
}

.sesam-analyzer-run-tab.is-active {
  border-bottom-color: var(--sesam-blue);
  color: var(--sesam-heading-color);
  font-weight: 700;
}

/* Colour dots of the comparison: baseline SESAM blue, variant orange */
.sesam-analyzer-dot {
  display: inline-block;
  width: 0.5rem;
  height: 0.5rem;
  margin: 0 0.3rem 0 0.1rem;
  border-radius: 50%;
  vertical-align: 0.05em;
}

.sesam-analyzer-dot-baseline {
  background: var(--sesam-compare-baseline);
}

.sesam-analyzer-dot-variant {
  background: var(--sesam-compare-variant);
}

/* The menu ⋮ of the header opens over the map card: above its panels (1001), below the topbar and its menus (1030) */
.sesam-analyzer-actions .dropdown-menu {
  z-index: 1020;
}

/* ---- the map card: map stage with the floating switch, playback bar */

/* The width of the panel column grows with the screen: 300px on an office display (1920px), 340px on a 27-inch
   display (2560px), 280px on smaller screens. */
.sesam-analyzer-map-card {
  --sesam-analyzer-panel-width: 300px;
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
  border: 1px solid var(--sesam-card-border);
  border-radius: 0.75rem;
  background: var(--sesam-card-bg);
}

@media (min-width: 2200px) {
  .sesam-analyzer-map-card {
    --sesam-analyzer-panel-width: 340px;
  }
}

@media (max-width: 1399.98px) {
  .sesam-analyzer-map-card {
    --sesam-analyzer-panel-width: 280px;
  }
}

/* The stage takes the height of the card; the map fills it absolutely, so it needs no definite height above it */
.sesam-analyzer-map-stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  border-radius: 0.75rem 0.75rem 0 0;
}

/* Without the playback bar the stage is the bottom of the card and takes its corners */
.sesam-analyzer-map-stage:last-child {
  border-radius: 0.75rem;
}

/* One map for both modes (issue #514): the shell holds it and the loading indicators of the modes */
.sesam-analyzer-map-shell {
  position: absolute;
  inset: 0;
  background: var(--sesam-card-bg);
}

.sesam-analyzer-map {
  height: 100%;
}

/* The loading indicator of the other mode */
.sesam-analyzer-map-stage[data-active-map="replay"] [data-map-mode="analysis"],
.sesam-analyzer-map-stage[data-active-map="analysis"] [data-map-mode="replay"] {
  display: none;
}

/* The playback bar of the replay lies over the bottom of the map, so the map keeps its size when the mode changes
   and the picture stays exactly where it is (also tilted). map_panels.js puts its height on the stage
   (`--sesam-analyzer-playbar-height`); in the replay the corners of the map and the panels keep above it. */
.sesam-analyzer-playback {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  /* Above the map and its loading overlay, below the panels (1001) */
  z-index: 1000;
  padding: 0.45rem 0.75rem;
  border-top: 1px solid var(--sesam-card-border);
  background: var(--sesam-card-bg);
}

/* The open speed menu reaches up over the Selection card: the bar rises above the panels (1001) while it is open */
.sesam-analyzer-playback:has(.dropdown-menu.show) {
  z-index: 1002;
}

/* The playback bar belongs to the replay */
.sesam-analyzer-map-stage[data-active-map="analysis"] .sesam-analyzer-playback {
  display: none;
}

/* The scale, the attribution, the panels and the menus of the controls (`--sesam-map-bottom-inset`, read by
   MapSettingsControl) end above the bar */
.sesam-analyzer-map-stage[data-active-map="replay"] {
  --sesam-map-bottom-inset: var(--sesam-analyzer-playbar-height, 0px);
}

.sesam-analyzer-map-stage[data-active-map="replay"] .maplibregl-ctrl-bottom-left,
.sesam-analyzer-map-stage[data-active-map="replay"] .maplibregl-ctrl-bottom-right {
  bottom: var(--sesam-analyzer-playbar-height, 0px);
}

.sesam-analyzer-map-stage[data-active-map="replay"] .sesam-analyzer-panels {
  bottom: calc(var(--sesam-analyzer-playbar-height, 0px) + 0.75rem);
}

/* Fullscreen (the control of the map) shows the whole card: the map takes what the playback bar leaves */
.sesam-analyzer-map-card:fullscreen {
  border-radius: 0;
}

.sesam-analyzer-map-card:fullscreen .sesam-analyzer-map-stage {
  border-radius: 0;
}

/* ---- the floating switch Replay | Analysis with the metric of the analysis (the comparison adds its pill Difference |
   Baseline | Variant beside it): pills at the top centre of the map. It stays at the centre of the whole map, not of
   the part the panels leave free: the panels differ between the modes, and the pill would jump on every switch. */

.sesam-analyzer-mode-switch {
  position: absolute;
  display: flex;
  gap: 0.5rem;
  top: 0.75rem;
  left: 50%;
  /* Above the map and its loading overlay, below the panels (1001) and the topbar */
  z-index: 1000;
  transform: translateX(-50%);
}

.sesam-analyzer-mode-switch[hidden] {
  display: none;
}

/* A note below the switch, like the read-only note of the Workspace map: a run without traffic (issue #469) */
.sesam-analyzer-map-note {
  position: absolute;
  top: 3.75rem;
  left: 50%;
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  padding: 0.375rem 0.75rem;
  border: 1px solid var(--sesam-card-border);
  border-radius: 999px;
  background: var(--sesam-card-bg);
  box-shadow: var(--sesam-shadow-soft);
  color: var(--sesam-heading-color);
  font-size: var(--sesam-text-meta);
  white-space: nowrap;
  transform: translateX(-50%);
}

.sesam-analyzer-map-note i {
  color: var(--sesam-gray-600);
}

/* The note of "Disable 3D" (issue #589) is hidden until the script shows it; `display: flex` above would win over the
   `hidden` attribute */
.sesam-analyzer-map-note[hidden] {
  display: none;
}

/* "Try 3D again": a link in SESAM blue with an icon, never underlined */
.sesam-analyzer-three-d-retry {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0;
  border: 0;
  background: none;
  color: var(--sesam-blue);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

.sesam-analyzer-three-d-retry:hover,
.sesam-analyzer-three-d-retry:focus-visible {
  color: var(--sesam-link-hover-color);
  text-decoration: none;
}

.sesam-analyzer-three-d-note .sesam-analyzer-three-d-retry i {
  color: inherit;
}

/* The close button of the note: Bootstrap's cross, scaled to the small pill */
.sesam-analyzer-three-d-note-close {
  width: 0.5rem;
  height: 0.5rem;
  margin-left: 0.25rem;
  padding: 0.25rem;
  background-size: 0.5rem;
}

.sesam-analyzer-mode-pill {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border-radius: 999px;
  background: var(--sesam-card-bg);
  box-shadow: 0 4px 16px rgba(19, 50, 78, 0.18);
}

.sesam-analyzer-mode-pill[hidden] {
  display: none;
}

.sesam-analyzer-mode-pill button {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  /* A flat pill: about 30px high with its frame, so it covers little of the map */
  padding: 0.25rem 0.875rem;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--bs-body-color);
  font-size: var(--sesam-text-body);
  white-space: nowrap;
}

.sesam-analyzer-mode-pill button i {
  font-size: 0.75rem;
}

.sesam-analyzer-mode-pill button:hover {
  background: var(--sesam-card-header-bg);
  color: var(--sesam-blue);
}

.sesam-analyzer-mode-pill button.active {
  background: var(--sesam-blue);
  color: var(--bs-white);
  font-weight: 600;
}

.sesam-analyzer-mode-pill button:focus-visible {
  outline: 2px solid rgba(var(--sesam-focus-ring-rgb), 0.6);
  outline-offset: 1px;
}

/* The dots of the comparison keep their colour on the filled button: a white rim */
.sesam-analyzer-mode-pill button.active .sesam-analyzer-dot {
  box-shadow: 0 0 0 1.5px var(--bs-white);
}

/* The metric of the analysis in the pill (analysis/controls.js, issue #505): in the analysis its name follows the
   active button "Analysis" after a thin line, quieter than it; a click opens the list of metrics. Without a replay the
   pill shows only the metric. */
.sesam-analyzer-mode-tabs {
  display: inline-flex;
  gap: 2px;
}

.sesam-analyzer-mode-tabs[hidden],
.sesam-analyzer-map-stage[data-active-map="replay"] .sesam-analyzer-metric-switch,
.sesam-analyzer-metric-switch[hidden] {
  display: none;
}

/* The metric is quieter than the mode: smaller grey text after a thin line, the chevron as the hint of its list */
.sesam-analyzer-mode-pill .sesam-analyzer-metric-toggle {
  gap: 0.35rem;
  padding: 0.25rem 0.75rem 0.25rem 0.625rem;
  color: var(--sesam-gray-700);
  font-size: var(--sesam-text-meta);
  font-weight: 500;
}

/* No `display` here: the rule above hides the metric in the replay */
.sesam-analyzer-mode-tabs:not([hidden]) + .sesam-analyzer-metric-switch {
  margin-left: 0.25rem;
  padding-left: 0.25rem;
  border-left: 1px solid var(--sesam-card-border);
}

.sesam-analyzer-metric-caret {
  font-size: 0.625rem;
  opacity: 0.8;
}

.sesam-analyzer-metric-menu {
  min-width: 12rem;
  font-size: var(--sesam-text-body);
}

/* The items are buttons inside the pill: not its rounded segments (`.sesam-analyzer-mode-pill button`) */
.sesam-analyzer-mode-pill .sesam-analyzer-metric-menu .dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.375rem 1rem;
  border-radius: 0;
  color: var(--sesam-heading-color);
  font-weight: 400;
}

.sesam-analyzer-mode-pill .sesam-analyzer-metric-menu .dropdown-item:hover {
  background: var(--sesam-card-header-bg);
  color: var(--sesam-blue);
}

/* The tick of the chosen metric; the others keep its room so the names stay aligned */
.sesam-analyzer-metric-menu .dropdown-item i {
  width: 0.875rem;
  font-size: 0.75rem;
  visibility: hidden;
}

.sesam-analyzer-metric-menu .dropdown-item.active i {
  visibility: visible;
}

/* The chosen metric quietly marked, not in the strong blue of Bootstrap's active item */
.sesam-analyzer-mode-pill .sesam-analyzer-metric-menu .dropdown-item.active,
.sesam-analyzer-mode-pill .sesam-analyzer-metric-menu .dropdown-item:active {
  background: rgba(var(--sesam-blue-rgb), 0.08);
  color: var(--sesam-blue);
  font-weight: 600;
}

/* ---- the panels inside the map (_results_panels.html, map_panels.js): a column of side cards on the right, the
   handle on its left edge; collapsed, the rail at the right edge of the map. Only the cards catch the pointer, so the
   gaps keep the map draggable. */

.sesam-analyzer-panels {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  bottom: 0.75rem;
  /* Above the map, its controls and its loading overlay (1000), below the topbar and its menus (1030) */
  z-index: 1001;
  display: flex;
  align-items: flex-start;
  pointer-events: none;
}

.sesam-analyzer-panel-column {
  display: flex;
  flex-direction: column;
  align-self: stretch;
  gap: 0.5rem;
  width: var(--sesam-analyzer-panel-width);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  pointer-events: none;
  animation: sesam-analyzer-panels-in 0.18s ease-out;
}

.sesam-analyzer-panel-column > * {
  flex: none;
  pointer-events: auto;
}

@keyframes sesam-analyzer-panels-in {
  from {
    opacity: 0;
    transform: translateX(1rem);
  }
}

@media (prefers-reduced-motion: reduce) {
  .sesam-analyzer-panel-column {
    animation: none;
  }
}

/* The panels of the other map */
.sesam-analyzer-map-stage[data-active-map="replay"] [data-panel-map="analysis"],
.sesam-analyzer-map-stage[data-active-map="analysis"] [data-panel-map="replay"] {
  display: none;
}

/* A panel: a compact side card. The summary in its head only shows while it is collapsed. */
.sesam-analyzer-panel {
  overflow: hidden;
  border-radius: 0.625rem;
  box-shadow: 0 0.25rem 1rem rgba(19, 50, 78, 0.14);
}

.sesam-analyzer-panel .sesam-analyzer-panel-head {
  padding: 0.5rem 0.75rem;
}

.sesam-analyzer-panel details[open] > .sesam-analyzer-panel-head {
  border-bottom-color: var(--bs-border-color-translucent);
}

.sesam-analyzer-panel .sesam-side-card-title {
  font-size: var(--sesam-text-body);
  white-space: nowrap;
}

.sesam-analyzer-panel-icon {
  display: grid;
  place-items: center;
  flex: 0 0 1.375rem;
  width: 1.375rem;
  height: 1.375rem;
  border-radius: 0.375rem;
  background: var(--sesam-light-blue);
  color: var(--sesam-blue);
  font-size: 0.7rem;
}

.sesam-analyzer-panel .sesam-analyzer-panel-summary {
  max-width: none;
  flex: 0 1 auto;
  text-align: right;
  color: var(--sesam-gray-600);
}

.sesam-analyzer-panel details[open] .sesam-analyzer-panel-summary {
  display: none;
}

.sesam-analyzer-panel-body {
  margin: 0;
  padding: 0.6rem 0.75rem 0.75rem;
  font-size: var(--sesam-text-meta);
}

.sesam-analyzer-panel-note {
  margin: 0;
  color: var(--sesam-gray-600);
  font-size: var(--sesam-text-meta);
}

.sesam-analyzer-panel-subtitle {
  margin: 0 0 0.35rem;
  padding: 0;
  color: var(--sesam-gray-600);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* Vehicle Types: a switch, icon, name and the count on the map at the replay time per vehicle class */
.sesam-analyzer-vtypes {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.sesam-analyzer-vtype {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 1.75rem;
  margin: 0;
  /* The switch sits in the row, not in the gutter of .form-check */
  padding-left: 0;
  cursor: pointer;
}

.sesam-analyzer-vtype .form-check-input {
  flex: none;
  margin: 0;
}

.sesam-analyzer-vtype-icon {
  color: var(--sesam-blue);
}

.sesam-analyzer-vtype-name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  color: var(--bs-body-color);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sesam-analyzer-vtype-count {
  color: var(--sesam-gray-600);
  font-variant-numeric: tabular-nums;
}

.sesam-analyzer-vtypes-time {
  margin-top: 0.35rem;
}

.sesam-analyzer-vtypes-time:empty {
  display: none;
}

/* The key figures above the map of a phone (hidden on larger screens, see the phone rules below) */
.sesam-analyzer-kpi-strip {
  display: none;
}

/* ---- the tabs below the map (_results_data.html): one card, the tab bar with "Hide" on the right, then the tab
   panel of a fixed height; collapsed, only the tab bar stays and the map takes the height */

.sesam-analyzer-data {
  display: flex;
  flex: 1 1 0;
  flex-direction: column;
  min-height: 15rem;
  overflow: hidden;
  border: 1px solid var(--sesam-card-border);
  border-radius: 0.75rem;
  background: var(--sesam-card-bg);
}

.sesam-analyzer-data[data-collapsed="true"] {
  flex: none;
  min-height: 0;
}

.sesam-analyzer-tabbar {
  display: flex;
  flex: none;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.5rem 0.75rem;
  padding: 0 0.5rem;
  border-bottom: 1px solid var(--sesam-card-border);
}

.sesam-analyzer-data[data-collapsed="true"] .sesam-analyzer-tabbar {
  border-bottom: 0;
}

.sesam-analyzer-tabbar .nav-tabs {
  flex-wrap: nowrap;
  min-width: 0;
  overflow-x: auto;
  border-bottom: 0;
  scrollbar-width: none;
}

/* Centred: the count pills sit in the middle of the tab name, not on its baseline */
.sesam-analyzer-tabbar .nav-link {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: -1px;
  padding: 0.7rem 1rem 0.625rem;
  white-space: nowrap;
}

/* The number of rows of a tab: a light pill, quieter than its name; light blue on the open tab */
.sesam-analyzer-tab-count {
  padding: 0.0625rem 0.45rem;
  border-radius: 999px;
  background: var(--sesam-surface-muted);
  color: var(--sesam-gray-600);
  font-size: 0.6875rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.sesam-analyzer-tabbar .nav-link.active .sesam-analyzer-tab-count {
  background: rgba(var(--sesam-blue-rgb), 0.1);
  color: var(--sesam-blue);
}

.sesam-analyzer-tab-count:empty,
.sesam-analyzer-tabbar .nav-tabs.is-tight .sesam-analyzer-tab-count {
  display: none;
}

/* The search and the pager of the table tabs, left of "Hide" (issue #505; paged_table.js fills the pager): only those
   of the open tab, none while the tabs are hidden. The search gives way first when the bar gets narrow. */
.sesam-analyzer-tab-tools {
  display: flex;
  flex: 0 1 auto;
  align-items: center;
  gap: 1.5rem;
  min-width: 0;
  /* Clear room before "Hide": the tools belong to the table, the button to the whole tab area */
  margin-right: 1.25rem;
  margin-bottom: 0.375rem;
  margin-left: auto;
}

.sesam-analyzer-tab-tools [data-for-pane]:not(.is-current),
.sesam-analyzer-data[data-collapsed="true"] .sesam-analyzer-tab-tools {
  display: none;
}

/* Wide enough to read its placeholder ("Search trips by ID, kind, class or type"); a narrower bar scrolls its tabs */
.sesam-analyzer-tab-tools .sesam-analyzer-table-search {
  flex: 0 1 20rem;
  min-width: 15rem;
}

.sesam-analyzer-tab-tools .sesam-analyzer-table-pager {
  flex: none;
  margin-left: 0;
}

.sesam-analyzer-tabs-toggle {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.375rem;
  padding: 0.3rem 0.625rem;
  border: 0;
  border-radius: 0.375rem;
  background: none;
  color: var(--sesam-gray-700);
  font-size: var(--sesam-text-meta);
}

.sesam-analyzer-tabs-toggle:hover,
.sesam-analyzer-tabs-toggle:focus-visible {
  background: var(--sesam-card-header-bg);
  color: var(--sesam-blue);
}

.sesam-analyzer-tabs-toggle i {
  font-size: 0.7rem;
  transition: transform 0.15s ease;
}

/* The arrow points to where a click takes the divider: down for "Hide", up for "Show" (tab_area.js sets data-action;
   between the marks the panel can be open while the button says "Show") */
.sesam-analyzer-tabs-toggle[data-action="show"] i {
  transform: rotate(180deg);
}

/* ---- the divider between the map and the tabs (tab_area.js, issue #505): a grip in the gap of the page column. It
   takes the place of the gap with negative margins, so map and tabs keep their spacing. At rest a gray pill; on hover
   and while dragging the pill turns blue and wider and a thin line runs across. Mouse and touch only. */

.sesam-analyzer-split {
  position: relative;
  display: flex;
  flex: none;
  align-items: center;
  justify-content: center;
  height: 0.75rem;
  margin: -0.75rem 0;
  cursor: row-resize;
  /* The browser must not scroll the page while a finger drags the divider */
  touch-action: none;
  user-select: none;
}

.sesam-analyzer-split::before {
  position: absolute;
  top: 50%;
  right: 0;
  left: 0;
  height: 2px;
  margin-top: -1px;
  border-radius: 1px;
  background: transparent;
  content: "";
  transition: background-color 0.15s ease;
}

.sesam-analyzer-split-pill {
  position: relative;
  width: 2.5rem;
  height: 4px;
  border-radius: 2px;
  background: var(--sesam-gray-500);
  transition:
    background-color 0.15s ease,
    width 0.15s ease;
}

.sesam-analyzer-split:hover::before,
.sesam-analyzer-split.is-dragging::before {
  background: rgba(var(--sesam-blue-rgb), 0.35);
}

.sesam-analyzer-split:hover .sesam-analyzer-split-pill,
.sesam-analyzer-split.is-dragging .sesam-analyzer-split-pill {
  width: 3.5rem;
  background: var(--sesam-blue);
}

/* No text selection on the page while the divider is dragged */
body.sesam-analyzer-resizing {
  user-select: none;
}

.sesam-analyzer-data-phone {
  display: none;
}

/* The tab panel takes the height of the card; every tab fills it absolutely, so all tabs are equally high */
.sesam-analyzer-tab-panel {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
}

.sesam-analyzer-tab-panel[hidden] {
  display: none;
}

.sesam-analyzer-tab-panel > .tab-pane {
  position: absolute;
  inset: 0;
  overflow: auto;
}

/* The chart tabs fill the pane like the table tabs: the bar runs from edge to edge */
.sesam-analyzer-chart-pane {
  padding: 0;
}

/* A tab with a table: the table, which does not scroll down (a page holds the rows that fit) but sideways when it is
   wide; its search and pager sit in the tab bar (issue #505) */
.sesam-analyzer-tab-panel > .sesam-analyzer-table-pane.active {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* A slim row of controls above a chart (the comparison's Trip Statistics, compare/chart.js) */
.sesam-analyzer-table-bar {
  display: flex;
  flex: none;
  align-items: center;
  gap: 0.75rem;
  padding: 0.375rem 0.75rem;
  border-bottom: 1px solid var(--sesam-card-border);
}

.sesam-analyzer-table-search {
  display: flex;
  flex: 0 1 21rem;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
  margin: 0;
  padding: 0 0.6rem;
  border: 1px solid var(--bs-border-color);
  border-radius: var(--bs-border-radius);
  background: var(--sesam-card-bg);
  color: var(--sesam-gray-600);
}

.sesam-analyzer-table-search .form-control {
  min-height: 0;
  height: 1.75rem;
  padding: 0;
  border: 0;
  box-shadow: none;
  font-size: var(--sesam-text-meta);
}

.sesam-analyzer-table-pager {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-left: auto;
  color: var(--sesam-gray-700);
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
}

.sesam-analyzer-table-pager[hidden] {
  display: none;
}

.sesam-analyzer-page-buttons {
  display: inline-flex;
  gap: 0.25rem;
}

.sesam-analyzer-page-button {
  display: grid;
  place-items: center;
  width: 1.75rem;
  height: 1.75rem;
  padding: 0;
  border: 1px solid var(--bs-border-color);
  border-radius: 0.375rem;
  background: var(--sesam-card-bg);
  color: var(--bs-body-color);
  font-size: 0.9375rem;
  line-height: 1;
}

.sesam-analyzer-page-button:hover:not(:disabled) {
  border-color: var(--sesam-blue);
  color: var(--sesam-blue);
}

.sesam-analyzer-page-button:disabled {
  color: var(--sesam-gray-500);
}

.sesam-analyzer-table-wrap {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: auto;
  overflow-y: hidden;
}

/* A narrow tab folds the columns that do not fit (paged_table.js, as DataTables' Responsive extension): a caret in
   front of each row opens a row below it with the folded values. While one is open the table can be taller than the
   tab, which then scrolls. */
.sesam-analyzer-table-wrap.has-details {
  overflow-y: auto;
}

.sesam-analyzer-table-wrap .is-collapsed,
.sesam-analyzer-table-wrap table:not(.has-collapsed) .sesam-analyzer-col-toggle {
  display: none;
}

.sesam-analyzer-table-wrap .sesam-analyzer-col-toggle {
  width: 2rem;
  padding-right: 0;
}

.sesam-analyzer-row-toggle {
  display: inline-grid;
  place-items: center;
  width: 1.5rem;
  height: 1.5rem;
  padding: 0;
  border: 0;
  border-radius: 0.3rem;
  background: none;
  color: var(--sesam-blue);
}

.sesam-analyzer-row-toggle:hover,
.sesam-analyzer-row-toggle:focus-visible {
  background: rgba(var(--sesam-blue-rgb), 0.1);
}

.sesam-analyzer-row-toggle i {
  transition: transform 0.15s ease;
}

.sesam-analyzer-row-toggle[aria-expanded="true"] i {
  transform: rotate(90deg);
}

/* The folded values of a row: a quiet line below it, one step smaller than the rows, each value right after its
   label and the pairs side by side as many as fit */
.sesam-analyzer-data-table tbody tr.sesam-analyzer-row-details > td {
  height: auto;
  padding: 0.3rem 0.75rem 0.4rem 2.75rem;
  background: var(--sesam-surface-muted);
  font-size: var(--sesam-text-meta);
  white-space: normal;
}

.sesam-analyzer-row-details dl {
  display: flex;
  flex-wrap: wrap;
  gap: 0.15rem 1.5rem;
  margin: 0;
}

.sesam-analyzer-row-details dl > div {
  display: inline-flex;
  align-items: baseline;
  gap: 0.4rem;
  min-width: 0;
}

.sesam-analyzer-row-details dt {
  color: var(--sesam-gray-600);
  font-weight: 400;
}

.sesam-analyzer-row-details dd {
  margin: 0;
  color: var(--sesam-value-color);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

/* Runs is a short server-rendered table: it scrolls inside the tab when it does not fit */
.sesam-analyzer-table-pane > .sesam-analyzer-figures-wrap {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}

/* ---- the tab All Figures (_results_all_figures.html, issue #505): the groups side by side as columns, each figure
   with its value right next to its name and a one-line note below; no search. The comparison has two wider columns
   (Baseline, Variant, Change). The tab scrolls when the groups do not fit its height. */

/* The groups fill the tab without a margin, so the lines between them run down to the edge of the card, also when
   the groups are shorter than the tab */
.sesam-analyzer-figures-pane > .sesam-analyzer-figures-wrap {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  padding: 0;
}

.sesam-analyzer-figures-pane .sesam-analyzer-figure-groups {
  flex: 1 0 auto;
}

/* Columns like those of the tab Overview: padded, a line between them. Each group draws the line on its left edge;
   the grid clips the line of the first group of a row, so the lines stay between the columns however many fit. */
.sesam-analyzer-figure-groups {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr));
  overflow: hidden;
}

.sesam-analyzer-figure-group {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  /* Little room at the bottom: the last figure keeps its own padding below its note */
  padding: 1.125rem 1.5rem 0.5rem;
}

.sesam-analyzer-figure-group::before {
  position: absolute;
  top: 0;
  bottom: 0;
  left: -1px;
  border-left: 1px solid var(--sesam-card-border);
  content: "";
}

/* The name of a group with its icon in SESAM blue in front, like the heads of the tab Overview */
.sesam-analyzer-figure-group-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 0.25rem;
  color: var(--sesam-heading-color);
  font-size: var(--sesam-text-body);
  font-weight: 600;
}

.sesam-analyzer-figure {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  padding: 0.4375rem 0;
  border-bottom: 1px solid var(--sesam-card-border);
}

/* The last figure of a group draws no line: the end of the tab follows */
.sesam-analyzer-figure:last-child {
  border-bottom: 0;
}

.sesam-analyzer-figure-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: var(--sesam-text-body);
}

.sesam-analyzer-figure-label {
  min-width: 0;
  color: var(--sesam-gray-700);
}

.sesam-analyzer-figure-value {
  color: var(--sesam-value-color);
  font-weight: 500;
  white-space: nowrap;
}

/* The standard deviation of an overview figure, after its mean */
.sesam-analyzer-figure-spread {
  margin-left: 0.35rem;
  color: var(--sesam-gray-600);
  font-weight: 400;
}

/* The note: one line, cut with an ellipsis when the column is narrower (the full explanation is the tooltip) */
.sesam-analyzer-figure-note {
  overflow: hidden;
  /* Lighter than the label, like the other notes of the tabs */
  color: var(--sesam-gray-500);
  font-size: 0.75rem;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---- the tab Overview (_results_overview.html): three columns of equal height, Key Figures 1.2fr, Trip Duration and
   Vehicles in the Network 1fr each, the settings of the runs as one line below them */

.sesam-analyzer-overview {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  height: 100%;
}

/* Key Figures, Run Details and Traffic in the Network: the chart takes the largest share. Key Figures and Run
   Details are never narrower than their values (the ± of the overview makes the figures longer); in a narrow window
   the chart gives way. */
.sesam-analyzer-overview-cols-3 {
  grid-template-columns: minmax(max-content, 1fr) minmax(max-content, 0.9fr) minmax(0, 1.25fr);
}

/* Each column of the key figures and of the run details is as wide as its longest row at least, so no value is cut
   off (a comparison shows these lists once per mode, so the rule goes by class, not by id) */
.sesam-analyzer-overview .sesam-analyzer-runfacts {
  grid-template-columns: repeat(2, minmax(max-content, 1fr));
}

/* The settings of the run: a list in two columns, label left and value right, divided by thin lines */
.sesam-analyzer-runfacts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-content: start;
  gap: 0 1rem;
  margin: 0;
}

.sesam-analyzer-runfact {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  min-width: 0;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--sesam-card-border);
  font-size: var(--sesam-text-body);
}

.sesam-analyzer-runfact dt {
  flex: none;
  color: var(--sesam-gray-700);
  font-weight: 400;
  white-space: nowrap;
}

/* The last row of the list draws no line: the edge of the card or the end of the tab follows. In two columns that is
   the last item and, when it is in the right column, the one before it; not before the wide row of the outputs. */
.sesam-analyzer-runfacts > .sesam-analyzer-runfact:last-child,
.sesam-analyzer-runfacts
  > .sesam-analyzer-runfact:nth-last-child(2):nth-child(odd):has(+ .sesam-analyzer-runfact:not(.is-wide)) {
  border-bottom: 0;
}

/* A row over both columns of the list (the outputs of the simulation) */
.sesam-analyzer-runfact.is-wide {
  grid-column: 1 / -1;
}

/* Key figures in the list: a check at zero teleports or collisions, a warning otherwise */
.sesam-analyzer-runfact.is-ok dd i {
  color: var(--sesam-green-strong);
}

.sesam-analyzer-runfact.is-warn dd {
  color: var(--sesam-yellow-strong);
}

.sesam-analyzer-runfact.is-warn dd i {
  color: var(--sesam-yellow);
}

.sesam-analyzer-runfact dd {
  min-width: 0;
  overflow: hidden;
  margin: 0;
  text-overflow: ellipsis;
  /* The values of every list and table of the tabs share one colour (All Figures, the tables; issue #505) */
  color: var(--sesam-value-color);
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  text-align: right;
  white-space: nowrap;
}

/* Key Figures and Traffic in the Network: the chart takes the larger share, Key Figures stays in full */
.sesam-analyzer-overview-cols-2 {
  grid-template-columns: minmax(max-content, 1fr) minmax(0, 1.4fr);
}

/* The comparison in difference mode: the key figures and the traffic share the width (no run details) */
.sesam-analyzer-overview-cols-diff {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

/* One pane per mode of the comparison (compare.js shows the active one); each fills the tab like the overview */
.sesam-analyzer-compare-pane {
  height: 100%;
}

.sesam-analyzer-compare-pane[hidden] {
  display: none;
}

.sesam-analyzer-overview-col {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  /* More room at the bottom than at the top: the axis labels of the charts and the last tile row need air above the
     run line and the edge of the card */
  padding: 1.125rem 1.5rem 1.25rem;
  overflow: hidden;
  border-right: 1px solid var(--sesam-card-border);
}

.sesam-analyzer-overview-col:last-of-type {
  border-right: 0;
}

/* The head of a column like the head of a side card: icon in SESAM blue, title, a short summary on the right */
.sesam-analyzer-overview-head {
  display: flex;
  flex: none;
  align-items: center;
  gap: 0.5rem;
  min-height: 1.5rem;
  margin-bottom: 1rem;
}

.sesam-analyzer-overview-icon {
  flex: none;
  color: var(--sesam-blue);
}

.sesam-analyzer-overview-title {
  margin: 0;
  color: var(--sesam-heading-color);
  font-size: var(--sesam-text-item);
  font-weight: 600;
  line-height: 1.3;
  white-space: nowrap;
}

.sesam-analyzer-overview-summary {
  min-width: 0;
  margin-left: auto;
  overflow: hidden;
  color: var(--sesam-gray-700);
  font-size: var(--sesam-text-meta);
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* A note rather than a summary (the vehicles still running at the end): lighter, like the other notes */
.sesam-analyzer-overview-summary.is-note {
  color: var(--sesam-gray-500);
}

.sesam-analyzer-overview-empty {
  margin: auto;
  color: var(--sesam-gray-600);
  font-size: var(--sesam-text-meta);
}

/* The label and value of the key figures in the strip of a phone (.sesam-analyzer-kpi-chip) */
.sesam-analyzer-kpi-label {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  overflow: hidden;
  color: var(--sesam-gray-700);
  font-size: var(--sesam-text-meta);
  font-weight: 500;
  white-space: nowrap;
}

.sesam-analyzer-kpi-value {
  overflow: hidden;
  color: var(--sesam-heading-color);
  font-size: 1.625rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* The standard deviation after a mean of the overview */
.sesam-analyzer-kpi-spread {
  color: var(--sesam-gray-600);
  font-size: var(--sesam-text-meta);
  font-weight: 500;
  letter-spacing: 0;
}

/* Office display (up to 1920px): the same content, closer spacing and smaller values for the lower tab */
@media (max-width: 1920px) {
  .sesam-analyzer-overview-col {
    padding: 0.875rem 1.25rem 1rem;
  }

  .sesam-analyzer-overview-head {
    margin-bottom: 0.625rem;
  }

  /* Five rows of key figures fit into the lower tab of a 1920 × 1080 display; All Figures uses the same size */
  .sesam-analyzer-runfact {
    padding: 0.25rem 0;
    font-size: var(--sesam-text-meta);
  }

  .sesam-analyzer-figure {
    padding: 0.3125rem 0;
  }

  .sesam-analyzer-figure-group {
    padding: 0.875rem 1.25rem 0.5rem;
  }

  .sesam-analyzer-figure-line {
    font-size: var(--sesam-text-meta);
  }
}

/* ---- the charts of the tab Overview (chart_scales.js): an SVG stretched to the column, the labels of its axes and
   its marker as HTML placed by `--at` */

.sesam-analyzer-overview-chart {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
  /* Air between the head and the top label of the y axis or the cursor label */
  padding-top: 0.5rem;
}

.sesam-analyzer-chart {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  margin-left: 2.375rem;
  border-bottom: 1px solid var(--sesam-gray-400);
}

.sesam-analyzer-chart-svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.sesam-analyzer-chart-grid {
  fill: none;
  stroke: var(--sesam-card-border);
  stroke-width: 1;
}

.sesam-analyzer-chart-bars {
  fill: var(--sesam-blue);
  fill-opacity: 0.85;
}

.sesam-analyzer-chart-line {
  fill: none;
  stroke: var(--sesam-blue);
  stroke-width: 2;
  stroke-linejoin: round;
}

.sesam-analyzer-chart-area {
  fill: var(--sesam-blue);
  fill-opacity: 0.07;
}

/* The median and the replay time: a dashed line */
.sesam-analyzer-chart-cursor {
  stroke: var(--sesam-heading-color);
  stroke-dasharray: 4 3;
  stroke-width: 1.5;
}

.sesam-analyzer-chart-ylabel,
.sesam-analyzer-chart-xlabel,
.sesam-analyzer-chart-marker {
  position: absolute;
  color: var(--sesam-gray-700);
  font-size: 0.6875rem;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  white-space: nowrap;
}

.sesam-analyzer-chart-ylabel {
  top: var(--at);
  right: calc(100% + 0.35rem);
  transform: translateY(-50%);
}

.sesam-analyzer-chart-axis {
  position: relative;
  flex: none;
  height: 1.125rem;
  margin-left: 2.375rem;
}

.sesam-analyzer-chart-xlabel {
  top: 0.3rem;
  left: var(--at);
  transform: translateX(-50%);
}

.sesam-analyzer-chart-xlabel:first-child {
  transform: none;
}

.sesam-analyzer-chart-xlabel:last-child {
  transform: translateX(-100%);
}

/* The label of the marker stands right of its line, past 60% of the width left of it */
.sesam-analyzer-chart-marker {
  top: 0;
  left: calc(var(--at) + 0.375rem);
  /* A light ground keeps the label readable where it crosses a line or a fill */
  padding: 0.125rem 0.3rem;
  border-radius: 0.25rem;
  background: color-mix(in srgb, var(--sesam-card-bg) 88%, transparent);
  color: var(--sesam-heading-color);
  font-size: 0.75rem;
  font-weight: 600;
}

.sesam-analyzer-chart-marker.is-left {
  left: auto;
  right: calc(100% - var(--at) + 0.375rem);
}

.sesam-analyzer-chart-dot {
  position: absolute;
  top: var(--y);
  left: var(--at);
  width: 0.625rem;
  height: 0.625rem;
  margin: -0.3125rem 0 0 -0.3125rem;
  border-radius: 50%;
  background: var(--sesam-blue);
  box-shadow: 0 0 0 2px var(--sesam-card-bg);
}

/* ---- Vehicles in the Network (network_load.js, issue #523): a row of toggles per vehicle class above stacked areas
   in the slots of the chart palette (tokens.css), in the order of the classes of the run */

/* The two sides of a comparison in its difference mode (network_load.js, renderNetworkLoadComparison) */
.sesam-analyzer-load-slot-variant {
  --sesam-analyzer-load-color: var(--sesam-compare-variant);
}
.sesam-analyzer-load-slot-baseline {
  --sesam-analyzer-load-color: var(--sesam-compare-baseline);
}
.sesam-analyzer-load-slot-miv-1 {
  --sesam-analyzer-load-color: var(--sesam-load-miv-1);
}
.sesam-analyzer-load-slot-miv-2 {
  --sesam-analyzer-load-color: var(--sesam-load-miv-2);
}
.sesam-analyzer-load-slot-miv-3 {
  --sesam-analyzer-load-color: var(--sesam-load-miv-3);
}
.sesam-analyzer-load-slot-miv-4 {
  --sesam-analyzer-load-color: var(--sesam-load-miv-4);
}
.sesam-analyzer-load-slot-pt-1 {
  --sesam-analyzer-load-color: var(--sesam-load-pt-1);
}
.sesam-analyzer-load-slot-pt-2 {
  --sesam-analyzer-load-color: var(--sesam-load-pt-2);
}
.sesam-analyzer-load-slot-pt-3 {
  --sesam-analyzer-load-color: var(--sesam-load-pt-3);
}
.sesam-analyzer-load-slot-pt-4 {
  --sesam-analyzer-load-color: var(--sesam-load-pt-4);
}
.sesam-analyzer-load-slot-active-1 {
  --sesam-analyzer-load-color: var(--sesam-load-active-1);
}
.sesam-analyzer-load-slot-active-2 {
  --sesam-analyzer-load-color: var(--sesam-load-active-2);
}
.sesam-analyzer-load-slot-other {
  --sesam-analyzer-load-color: var(--sesam-load-other);
}

/* The toggles follow the chart toggle of the Simulator status page: small buttons, the shown ones tinted */
.sesam-analyzer-load-toggles {
  display: flex;
  flex: none;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-bottom: 0.375rem;
}

/* In the head of the column: on the right, where the other columns show their summary */
.sesam-analyzer-load-toggles-slot {
  min-width: 0;
  margin-left: auto;
}

.sesam-analyzer-load-toggles-slot .sesam-analyzer-load-toggles {
  flex-wrap: nowrap;
  justify-content: flex-end;
  gap: 0.25rem;
  margin-bottom: 0;
}

/* No focus ring after a click on a toggle; the keyboard still shows a thin one */
.sesam-analyzer-load-toggles .btn-check:focus + label {
  outline: 0;
  box-shadow: none;
}

.sesam-analyzer-load-toggles .btn-check:focus-visible + label {
  outline: 1px solid var(--sesam-blue);
  outline-offset: 1px;
}

/* The icon in the colour of its class; a hidden class turns gray */
.sesam-analyzer-load-toggles label i {
  color: var(--sesam-analyzer-load-color);
}

.sesam-analyzer-load-toggles .btn-check:not(:checked) + label i {
  color: var(--sesam-gray-500);
}

/* The icon only; the name is the tooltip and the accessible name (visually hidden) */
.sesam-analyzer-load-toggles label {
  display: inline-flex;
  align-items: center;
  gap: 0.3125rem;
  height: 1.375rem;
  padding: 0 0.3rem;
  margin: 0;
  color: var(--sesam-gray-600);
  border: 1px solid var(--sesam-card-border);
  border-radius: 0.375rem;
  font-size: 0.6875rem;
  white-space: nowrap;
  cursor: pointer;
}

.sesam-analyzer-load-toggles label:hover {
  color: var(--sesam-heading-color);
}

.sesam-analyzer-load-toggles .btn-check:checked + label {
  color: var(--sesam-heading-color);
  background: var(--sesam-card-header-bg);
}

/* A hidden class keeps its colour as an outline, so its button still names it */
.sesam-analyzer-load-toggles .btn-check:not(:checked) + label .sesam-analyzer-load-swatch {
  background: transparent;
  box-shadow: inset 0 0 0 1.5px var(--sesam-analyzer-load-color);
}

.sesam-analyzer-load-toggles .btn-check:focus-visible + label {
  outline: 2px solid rgba(var(--sesam-blue-rgb), 0.5);
  outline-offset: 1px;
}

.sesam-analyzer-load-swatch {
  flex: none;
  width: 0.625rem;
  height: 0.625rem;
  border-radius: 2px;
  background: var(--sesam-analyzer-load-color);
}

.sesam-analyzer-load-body {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
}

/* The stacked areas: the colour of the class, a thin outline in the colour of the surface between them */
/* The fill of a class: its colour fading towards the base line (the gradient of network_load.js), like the chart of
   the simulator status */
.sesam-analyzer-load-area {
  stroke: none;
}

.sesam-analyzer-load-stop-top {
  stop-color: var(--sesam-analyzer-load-color);
  stop-opacity: 0.32;
}

.sesam-analyzer-load-stop-bottom {
  stop-color: var(--sesam-analyzer-load-color);
  stop-opacity: 0.04;
}

/* The upper edge of a class in its full colour */
.sesam-analyzer-load-line {
  fill: none;
  stroke: var(--sesam-analyzer-load-color);
  stroke-width: 1.5;
  stroke-linejoin: round;
}

/* The lines of a comparison carry the whole chart: a little stronger than the edges of the stacked areas */
.sesam-analyzer-load-line.is-compare {
  stroke-width: 2;
}

/* The range of the total over the runs (overview): two thin dashed lines */
.sesam-analyzer-load-band {
  fill: none;
  stroke: var(--sesam-heading-color);
  stroke-dasharray: 3 3;
  stroke-opacity: 0.6;
  stroke-width: 1;
}

.sesam-analyzer-load-hover {
  stroke: var(--sesam-gray-600);
  stroke-width: 1;
}

/* The tooltip of the hovered time: right of the line, past the middle left of it */
.sesam-analyzer-load-tooltip {
  position: absolute;
  z-index: 2;
  top: 0.25rem;
  left: calc(var(--at) + 0.5rem);
  min-width: 8rem;
  padding: 0.375rem 0.5rem;
  color: var(--sesam-heading-color);
  background: var(--sesam-card-bg);
  border: 1px solid var(--sesam-card-border);
  border-radius: 0.375rem;
  box-shadow: var(--sesam-shadow-soft);
  font-size: 0.6875rem;
  font-variant-numeric: tabular-nums;
  line-height: 1.35;
  pointer-events: none;
}

.sesam-analyzer-load-tooltip.is-left {
  left: auto;
  right: calc(100% - var(--at) + 0.5rem);
}

.sesam-analyzer-load-tooltip-time {
  margin-bottom: 0.125rem;
  font-weight: 600;
}

.sesam-analyzer-load-tooltip-row {
  display: grid;
  grid-template-columns: 0.625rem 1fr auto;
  align-items: center;
  gap: 0.375rem;
}

.sesam-analyzer-load-tooltip-row > span:last-child {
  text-align: right;
}

.sesam-analyzer-load-tooltip-total {
  margin-top: 0.125rem;
  padding-top: 0.125rem;
  border-top: 1px solid var(--sesam-card-border);
  font-weight: 600;
}

/* Runs: a calm server-rendered table, numbers right-aligned in tabular figures */
.sesam-analyzer-figures-wrap {
  overflow-x: auto;
  padding: 0 0.75rem 0.5rem;
}

.sesam-analyzer-figures {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--sesam-text-body);
}

.sesam-analyzer-figures th,
.sesam-analyzer-figures td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--sesam-card-border);
  white-space: nowrap;
}

.sesam-analyzer-figures td {
  color: var(--sesam-value-color);
  vertical-align: middle;
}

.sesam-analyzer-figures thead th {
  color: var(--sesam-gray-600);
  font-size: var(--sesam-text-meta);
  font-weight: 600;
}

.sesam-analyzer-figures td:first-child {
  color: var(--sesam-gray-700);
}

.sesam-analyzer-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* The change of a comparison above 1 % (results.change_tone, design of 2026-11-24): red when the variant is worse,
   green when it is better. The sign of the number carries the direction too, so the colour is never alone. Without a
   tone the difference looks like any other value of the list or table it stands in. */
.sesam-analyzer-change.is-worse {
  color: var(--sesam-change-worse);
}

.sesam-analyzer-change.is-better {
  color: var(--sesam-change-better);
}

/* The change in percent after the difference: smaller, grey unless the change is coloured. A sub-column of fixed
   width, right-aligned, also when it is empty (±0): the differences of a column or list end at one edge and the
   percentages at another, so the column reads calm (tabular figures keep the digits equally wide). */
.sesam-analyzer-change-percent {
  display: inline-block;
  min-width: 4.75em;
  margin-left: 0.4rem;
  color: var(--sesam-gray-600);
  font-size: 0.75rem;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.sesam-analyzer-change.is-worse .sesam-analyzer-change-percent,
.sesam-analyzer-change.is-better .sesam-analyzer-change-percent {
  color: inherit;
}

/* The key of the colours in the head of the key figures: "Changes above 1 %: ■ better ■ worse" */
.sesam-analyzer-change-key {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
}

.sesam-analyzer-change-key-item {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.sesam-analyzer-change-key-item::before {
  content: "";
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 2px;
  background: var(--sesam-change-better);
}

.sesam-analyzer-change-key-item.is-worse::before {
  background: var(--sesam-change-worse);
}

/* The key of the two lines of the traffic in a comparison, in the colours of the roles */
.sesam-analyzer-load-legend {
  display: inline-flex;
  flex: 1 1 auto;
  gap: 0.875rem;
  min-width: 0;
  margin-left: 0.5rem;
  color: var(--sesam-gray-700);
  font-size: var(--sesam-text-meta);
}

.sesam-analyzer-load-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
}

.sesam-analyzer-load-legend-item::before {
  content: "";
  width: 0.875rem;
  height: 2px;
  background: var(--sesam-compare-baseline);
}

.sesam-analyzer-load-legend-item.is-variant::before {
  background: var(--sesam-compare-variant);
}

.sesam-analyzer-empty-search {
  margin: 0.75rem 0.75rem 0.25rem;
  font-size: var(--sesam-text-meta);
  color: var(--sesam-gray-600);
}

/* Runs of the overview: the whole row opens the run; the link at its end is as quiet as the links of the other
   tables */
.sesam-analyzer-runs tr[data-open-url] {
  cursor: pointer;
}

.sesam-analyzer-runs tbody tr:hover td {
  background: rgba(var(--sesam-blue-rgb), 0.04);
}

.sesam-analyzer-runs td.sesam-analyzer-run-name {
  color: var(--sesam-heading-color);
  font-weight: 600;
  padding-left: 0.75rem;
}

.sesam-analyzer-row-actions {
  text-align: right;
}

.sesam-analyzer-runs tr:hover .sesam-analyzer-selection-link {
  color: var(--sesam-heading-color);
}

/* ---- comparison: the two role cards with Swap between them */

.sesam-analyzer-roles {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 0.75rem;
}

.sesam-analyzer-roles .sesam-step-card {
  height: 100%;
  margin: 0;
}

.sesam-analyzer-swap {
  order: 0;
}

/* Badge and name on one line; a long name ends with "…" (the full name is in the title) */
.sesam-analyzer-role-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

.sesam-analyzer-role-head .sesam-step-card-badge {
  flex: 0 0 auto;
  align-self: center;
}

.sesam-analyzer-role-link {
  overflow: hidden;
  min-width: 0;
  color: var(--sesam-heading-color);
  white-space: nowrap;
  text-overflow: ellipsis;
}

.sesam-analyzer-role-link:hover {
  color: var(--sesam-blue);
}

.sesam-analyzer-roles .sesam-analyzer-scenario-line {
  margin: 0.15rem 0 0;
}

/* Tablets and phones: the role cards stack, Swap turns into an up-down arrow between them */
@media (max-width: 991.98px) {
  .sesam-analyzer-roles {
    grid-template-columns: minmax(0, 1fr);
  }

  .sesam-analyzer-swap {
    justify-self: center;
  }

  .sesam-analyzer-swap i {
    transform: rotate(90deg);
  }
}

/* Phones (variants F and G of issue #514): a reduced header, the key figures as a strip above the map that scrolls
   sideways, the map with the floating switch and the playback bar, the selection as a bottom sheet; no panel column
   and no tabs below the map (a short note instead). The page does not fill the window: the map has its own height. */
@media (max-width: 767.98px) {
  .sesam-analyzer-results {
    gap: 0.625rem;
    min-height: 0;
  }

  .sesam-analyzer-header {
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.5rem;
  }

  .sesam-analyzer-header .sesam-scenario-header-main {
    flex-basis: auto;
  }

  .sesam-analyzer-title-icon,
  .sesam-analyzer-description,
  .sesam-analyzer-header-divider,
  .sesam-analyzer-header-pill {
    display: none;
  }

  .sesam-analyzer-heading {
    font-size: 1.0625rem;
  }

  .sesam-analyzer-maps {
    flex: none;
    min-height: 0;
  }

  .sesam-analyzer-map-stage {
    flex: none;
    height: max(320px, calc(100vh - 330px));
  }

  /* The strip of key figures is the top of the card */
  .sesam-analyzer-kpi-strip + .sesam-analyzer-map-stage {
    border-top-left-radius: 0;
    border-top-right-radius: 0;
  }

  .sesam-analyzer-mode-pill button {
    min-height: 2.25rem;
    padding: 0.4375rem 0.875rem;
  }

  .sesam-analyzer-kpi-strip {
    display: flex;
    gap: 0.5rem;
    margin: 0;
    padding: 0.5rem 0.75rem;
    overflow-x: auto;
    border-bottom: 1px solid var(--sesam-card-border);
    list-style: none;
    scrollbar-width: none;
  }

  .sesam-analyzer-kpi-chip {
    display: flex;
    flex: 0 0 auto;
    flex-direction: column;
    padding: 0.35rem 0.75rem;
    border: 1px solid var(--sesam-card-border);
    border-radius: 0.5rem;
    background: var(--sesam-card-bg);
  }

  .sesam-analyzer-kpi-chip .sesam-analyzer-kpi-label {
    font-size: 0.6875rem;
  }

  .sesam-analyzer-kpi-chip .sesam-analyzer-kpi-value {
    font-size: var(--sesam-text-item);
  }

  /* Only the selection of the panel column stays: a sheet at the bottom of the screen */
  .sesam-analyzer-panel:not(.sesam-analyzer-selection) {
    display: none;
  }

  .sesam-analyzer-panels[data-column] .sesam-analyzer-panel-column {
    display: block;
    animation: none;
  }

  .sesam-analyzer-selection {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 1020;
    max-height: 55vh;
    overflow-y: auto;
    border-radius: 1rem 1rem 0 0;
    box-shadow: 0 -0.5rem 1.5rem rgba(19, 50, 78, 0.2);
  }

  /* A phone has no tables to jump into */
  .sesam-analyzer-selection [data-show-in-trips-table],
  .sesam-analyzer-selection [data-show-in-edge-table] {
    display: none;
  }

  .sesam-analyzer-data {
    flex: none;
    min-height: 0;
    border: 0;
    background: none;
  }

  .sesam-analyzer-split,
  .sesam-analyzer-tabbar,
  .sesam-analyzer-tab-panel {
    display: none;
  }

  .sesam-analyzer-data-phone {
    display: block;
    margin: 0;
    color: var(--sesam-gray-600);
    font-size: var(--sesam-text-meta);
    text-align: center;
  }
}

/* The seek bar of the replay shows its buffer like a video player (issue #526): played from the start to the playhead,
   loaded but not played yet, not loaded. controls.js writes the gradient into --sesam-timeline-track
   (timelineTrackBackground); the track pseudo-elements differ between WebKit/Blink and Gecko. */
.analyzer-playback-controls__slider .form-range {
  --sesam-timeline-played: var(--sesam-blue);
  /* Loaded: the blue of the played part at 35 % over the card, lighter than played and clearly apart from not loaded */
  --sesam-timeline-loaded: color-mix(in srgb, var(--sesam-blue) 35%, var(--sesam-card-bg));
  --sesam-timeline-empty: var(--sesam-gray-300);
}

/* The dark card is so close to "not loaded" that the mix over it would hardly show: the blue mixed with gray-400
   instead (about #3B4D63) */
[data-bs-theme="dark"] .analyzer-playback-controls__slider .form-range {
  --sesam-timeline-loaded: color-mix(in srgb, var(--sesam-blue) 45%, var(--sesam-gray-400));
}

.analyzer-playback-controls__slider .form-range::-webkit-slider-runnable-track {
  background: var(--sesam-timeline-track, var(--sesam-timeline-empty));
}

.analyzer-playback-controls__slider .form-range::-moz-range-track {
  background: var(--sesam-timeline-track, var(--sesam-timeline-empty));
}
