/*
 * SESAM components.
 *
 * Reusable, project-specific classes. All classes are prefixed with `sesam-`
 * so they can never collide with Bootstrap or third-party styles.
 *
 * Section order:
 *   1. Text & color utilities
 *   2. Borders, shadows & separators
 *   3. Layout, sizing & cursors
 *   4. Overlays
 *   5. Buttons
 *   6. Forms & inputs
 *   7. Cards & overlays
 *   8. Chrome (topbar, dropdowns, list groups, modals, badges)
 *   9. Interactive (switch, terminal, toolbars)
 *  10. Widgets, marketing & misc
 *  11. Scenario browser (Workspace, Editor start page)
 *  12. Map pages with a card column (Builder, Editor)
 *  13. Scenario cards (Scenario details page, Editor tabs)
 *  14. Signal plan modal (Editor, Analyzer)
 */

/* ***************************************************
 * 1. TEXT & COLOR UTILITIES
 *
 * All `.sesam-text-*` color utilities use `!important` for parity with
 * Bootstrap's `.text-*` utilities; that way they always win against the
 * surrounding component color.
 * *************************************************** */

.sesam-text-green       { color: var(--sesam-green)         !important; }
.sesam-text-red         { color: var(--sesam-red-strong)    !important; }
.sesam-text-yellow      { color: var(--sesam-yellow)        !important; }
.sesam-text-heading     { color: var(--sesam-heading-color) !important; }
.sesam-text-premium     { color: var(--sesam-premium)       !important; }
.sesam-text-muted-soft  { color: var(--sesam-muted-soft)    !important; }

.sesam-text-gray-300    { color: var(--sesam-gray-300)      !important; }
.sesam-text-gray-400    { color: var(--sesam-gray-400)      !important; }
.sesam-text-gray-500    { color: var(--sesam-gray-500)      !important; }
.sesam-text-gray-600    { color: var(--sesam-gray-600)      !important; }
.sesam-text-gray-700    { color: var(--sesam-gray-700)      !important; }

/* Bold, heading-colored label. Apply to non-heading elements (e.g.
   dynamically generated <div>) that should match the SESAM h6 look. */
.sesam-label-strong {
  font-weight: 700;
  color: var(--sesam-heading-color);
}

/* Smaller text scale. `sesam-text-xs` (~60%) is below Bootstrap `.small`;
   `sesam-text-smaller` mirrors the CSS `smaller` keyword (~80%). */
.sesam-text-xs       { font-size: 60%; font-weight: 400; }
.sesam-text-smaller  { font-size: smaller; }

/* Bootstrap 5 removed `.text-justify`; this class restores the utility
   intentionally for free-form user comments. */
.sesam-text-justify        { text-align: justify; }
/* Preserve newlines from user input without collapsing whitespace runs. */
.sesam-whitespace-pre-line { white-space: pre-line; }
/* Comment popovers are plain-text (never HTML); keep the newlines the user typed. Help popovers (column headers of
   the Scenario details page) use blank lines as paragraphs the same way. */
.sesam-comment-popover .popover-body,
.sesam-help-popover .popover-body { white-space: pre-line; }
/* Aggressive line-breaking inside tight UI rows (vehicle pickers etc.). */
.sesam-break-all           { word-break: break-all; }

/* ***************************************************
 * 2. BORDERS, SHADOWS & SEPARATORS
 * *************************************************** */

.sesam-border-start-teal     { border-left: 0.5rem solid var(--sesam-teal-muted)     !important; }
.sesam-border-start-info     { border-left: 0.5rem solid var(--sesam-accent-purple)  !important; }
.sesam-border-start-success  { border-left: 0.5rem solid var(--sesam-accent-green)   !important; }
.sesam-border-bottom-success { border-bottom: 0.5rem solid var(--sesam-accent-green) !important; }

.sesam-border-highlighted {
  border: 1px solid var(--sesam-marketing-blue-bright);
  box-shadow: var(--sesam-shadow-strong) !important;
}

.sesam-shadow        { box-shadow: var(--sesam-shadow-soft) !important; }
.sesam-shadow:hover {
  box-shadow: var(--sesam-shadow-strong) !important;
  border: 1px solid var(--sesam-gray-300);
}

/* Thin 2-pixel horizontal separator used between sections (plans, usage,
   account pages). Resets the default <hr> chrome so margins can be
   supplied via Bootstrap utility classes (e.g. `mb-4`, `my-4`). */
.sesam-hr-thin {
  margin: 0;
  border: none;
  height: 2px !important;
  background-color: var(--sesam-gray-300);
}

/* ***************************************************
 * 3. LAYOUT, SIZING & CURSORS
 * *************************************************** */

/* Full-height container minus the white navbar and a 1.5rem mb-4 offset. */
.sesam-container-height          { height: calc(100% - calc(1.5rem + var(--sesam-navbar-height))); }
/* Same but used where the white navbar has no bottom margin. */
.sesam-container-height-complete { height: calc(100% - var(--sesam-navbar-height)); }
/* Inside editor/builder map pages a sub-menubar takes 54px. */
.sesam-content-height            { height: calc(100% - 54px) !important; }

/* Minimum height for map containers before MapLibre measures the canvas. */
.sesam-map-min                   { min-height: 350px; }

/* Narrow centered card (e.g. 404 fallback page). Width helper, no chrome. */
.sesam-narrow-card               { width: 100%; max-width: 540px; }

.sesam-ellipsis {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1 1 auto;
}

.sesam-cursor-help        { cursor: help; }
.sesam-cursor-pointer     { cursor: pointer; }

/* ***************************************************
 * 4. OVERLAYS
 * *************************************************** */

/* Translucent overlay used by builder/editor while a long action runs. The
   `top` offset clears the white application navbar so the overlay starts
   below it; +15px keeps a small gap consistent with the historical look. */
.sesam-blur {
  position: fixed;
  top: calc(var(--sesam-navbar-height) + 15px);
  width: 100%;
  height: 100%;
  padding: 0;
  margin: 0;
  z-index: 1000;
  text-shadow: rgba(255, 255, 255, 0.5) 0 3px 3px;
  background-color: rgba(255, 255, 255, 0.9);
}

/* Use a real CSS backdrop-filter blur where the browser supports it; the
   solid white fallback above kicks in otherwise. */
@supports ((-webkit-backdrop-filter: none) or (backdrop-filter: none)) {
  .sesam-blur {
    background: rgba(180, 180, 180, 0.2);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
  }
}

/* Translucent white overlay used for the analyzer/editor map loading spinner. */
.sesam-map-spinner-overlay {
  background-color: rgba(255, 255, 255, 0.55);
  z-index: 10;
}

/* ***************************************************
 * 5. BUTTONS
 * *************************************************** */

.sesam-btn-xs,
.sesam-btn-group-xs > .btn {
  padding: 0.25rem 0.5rem !important;
  font-size: 0.7rem !important;
  line-height: 1 !important;
  border-radius: 0.2rem !important;
}

.sesam-btn-light-border {
  color: var(--sesam-gray-700);
  border: 1px solid var(--sesam-gray-400);
}

/* Outline-secondary in SESAM blue (legacy builder button). */
.sesam-btn-outline-secondary {
  color: var(--sesam-blue);
  background-color: #fff;
  background-image: none;
}
.sesam-btn-outline-secondary:hover {
  background-color: var(--sesam-blue);
  color: #fff;
}

/* ***************************************************
 * 6. FORMS & INPUTS
 * *************************************************** */

/* Account login/registration field with a leading icon inside the input
   box. The icon is positioned absolutely on the left edge; the input
   reserves matching left padding so text never overlaps the glyph. */
.sesam-input-icon-wrap {
  position: relative;
  /* Vertical breathing room between stacked input groups, mirroring the
     legacy Bootstrap 4 `.form-group` default. */
  margin-bottom: 1rem;
}

.sesam-input-icon-wrap .fa-solid,
.sesam-input-icon-wrap .far {
  position: absolute;
  padding: 16px;
  pointer-events: none;
}

.sesam-input-icon-wrap .fa-solid { left: 0; }
/* `.far` is intentionally pinned to the right edge: the only Font Awesome
   `.far` glyph used inside the login form is the password-reveal eye icon,
   which sits opposite the left-side `.fa-solid` icon. */
.sesam-input-icon-wrap .far      { right: 0; }
/* Left padding for the input itself is set by the input's own class
   (e.g. `.sesam-form-control-user`) so the value can match the icon size
   and beat the wrap selector's specificity. */

/* Bold, heading-colored input that visually reads as a heading: the scenario name of the Builder upload page. */
input#id_scenarioName {
  font-weight: 700;
  color: var(--sesam-heading-color);
  background: transparent;
}

/* Transparent input-group addon (e.g. unit labels like "step" or "seconds"). */
.sesam-input-group-text-transparent { background-color: transparent !important; }

/* Password input that leaves room on the right for a visibility toggle. */
.sesam-password-input-with-toggle { padding-right: 40px !important; }

/* Progress bar slimmer than the Bootstrap default. */
.sesam-progress-thin { height: 4px; }

/* Slightly enlarge Font Awesome solid icons inside Bootstrap nav tabs / pills
   so the tab labels match the legacy SESAM weight. Matches `.fas` only, so
   icons declared as `fa-solid` (FA6 shorthand) keep their natural 1em size. */
.nav-link .fas { font-size: 18px; }

/* Auth/account form inputs and submit button (legacy SB-Admin "form-user"
   look). Standalone classes; no longer scoped to `form.user`. */
.sesam-form-control-user {
  /* Explicit height keeps the input visually compact even though the
     padding is generously sized to leave room for the leading icon. */
  height: calc(1.5em + 0.75rem + 2px);
  padding: 1.5rem 1rem 1.5rem 40px;
  color: var(--sesam-blue) !important;
}

.sesam-btn-user { padding: 0.75rem 1rem; }

/* ***************************************************
 * 7. CARDS & OVERLAYS
 * *************************************************** */

.sesam-content-card {
  padding: 2rem;
  background-color: var(--sesam-card-bg);
  border: 1px solid var(--sesam-gray-300);
}

/* Dashed-outline card used for "new …" tiles across workspace/builder. */
.sesam-card-dashed {
  border-style: dashed;
  border-width: 2px;
  color: inherit;
}

.sesam-card-dashed-hover:hover {
  background-color: rgba(var(--sesam-surface-muted-rgb), 0.1);
}

/* Workspace card-overlay link covers the full card area. No z-index: the
   later-in-DOM positioned dropdown must stay clickable above the overlay. */
.sesam-card-overlay-link {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  cursor: pointer;
  text-decoration: none;
}

/* Network preview SVGs (templates and scenarios, see static/js/network_preview.js) contain only grayscale geometry
   with transparency. The surface color therefore remains a frontend decision and can vary by display context. */
.sesam-network-preview {
  --sesam-network-preview-color: var(--sesam-blue-rgb);
  background-color: rgba(var(--sesam-network-preview-color), 0.12);
}

.sesam-network-preview img,
.sesam-network-preview-svg {
  display: block;
  width: 100%;
  height: 100%;
  color: rgb(var(--sesam-network-preview-color));
  opacity: 0.78;
}

.sesam-release-name {
  font-weight: 700;
  color: var(--sesam-heading-color);
  font-size: 1rem;
}
.sesam-release-date {
  color: var(--sesam-gray-400);
  font-size: 80%;
  font-weight: 400;
}

/* ***************************************************
 * 8. CHROME — TOPBAR, DROPDOWNS, LIST GROUPS, MODALS, BADGES
 * *************************************************** */

/* h1 used in the white topbar to render the current page title. */
.sesam-page-title       { font-size: 1rem;   font-weight: bolder; }

/* Compact breadcrumb used in the topbar when a page needs hierarchy without
   competing with its main content heading (fragments/page_breadcrumb.html).
   It fills at most the free space of the topbar title (app-shell.css), so it
   truncates exactly where the user menu begins on every window width. Long
   names end with "…"; the fragment keeps the full text as a tooltip. */
.sesam-page-breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  min-width: 0;
  max-width: 100%;
  color: var(--sesam-gray-500);
  font-size: 0.875rem;
  font-weight: 500;
}

/* Items shrink in proportion to their length (flex-basis auto), so a short
   label such as "Run 3" or "Compare" barely shrinks next to a long name. */
.sesam-page-breadcrumb-item {
  flex: 0 1 auto;
  min-width: 0;
  max-width: 18rem;
  display: inline-block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* The app in front ("Analyzer", "Editor", …) is the anchor of the breadcrumb
   and is always shown in full. */
.sesam-page-breadcrumb-root {
  flex-shrink: 0;
  max-width: none;
}

.sesam-page-breadcrumb-link {
  color: var(--sesam-gray-500);
  font-weight: 500;
}

.sesam-page-breadcrumb-link:hover,
.sesam-page-breadcrumb-link:focus-visible,
.sesam-page-breadcrumb-link:active {
  color: var(--sesam-blue);
}

.sesam-page-breadcrumb-separator {
  flex: 0 0 auto;
  color: var(--sesam-gray-400);
  font-size: 0.625rem;
}

/* The intermediate item (e.g. the simulation before "Run 3", "Compare") keeps
   its width up to the 18rem cap of its item instead of shrinking to a few
   letters; on narrower windows it is left out entirely (see the media query
   below). */
.sesam-page-breadcrumb-intermediate {
  flex: 0 0 auto;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

/* The current item is the title of the page on every page (fragments/page_breadcrumb.html): heading color, while the
   items before it stay light links. */
.sesam-page-breadcrumb-title {
  max-width: 28rem;
  color: var(--sesam-heading-color);
  font-weight: 600;
}

/* Comparison "A ↔ B" (Analyzer): each part is truncated on its own, so the
   second simulation never disappears behind the first. */
.sesam-page-breadcrumb-pair {
  flex: 0 1 auto;
  min-width: 0;
  max-width: 44rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.sesam-page-breadcrumb-pair-part {
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* The arrow between the two simulations reads like their names: it is part of the title, not a divider */
.sesam-page-breadcrumb-pair-separator {
  flex: 0 0 auto;
  color: var(--sesam-heading-color);
  font-weight: 600;
}

/* A breadcrumb followed by a status badge (Editor: "Version 3"): the badge is
   never truncated, the breadcrumb takes the remaining space. */
.sesam-page-title-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
  max-width: 100%;
}

.sesam-page-title-row > .sesam-page-breadcrumb {
  flex: 0 1 auto;
}

.sesam-page-title-row > :not(.sesam-page-breadcrumb) {
  flex: 0 0 auto;
}

/* Below the lg breakpoint the topbar title is too narrow for three items: the
   intermediate item is left out, app and page title remain. (A container
   query on the title would be more precise, but the W3C CSS validator of the
   test suite does not know it yet.) */
@media (max-width: 991.98px) {
  .sesam-page-breadcrumb-intermediate {
    display: none;
  }
}

/* h1 used on auth/account form pages (login, register, welcome, logout). */
.sesam-form-page-title  { font-size: 1.4rem; font-weight: bolder; }

/* Wider topbar user dropdown to fit the plan badge, with a soft shadow.
   Typography and border color come from the global `.dropdown-menu` rule
   in base.css. */
.sesam-user-dropdown-menu {
  min-width: 250px;
  box-shadow: var(--sesam-shadow-soft) !important;
}

/* Footer row inside a dropdown (Privacy / Terms / Imprint links). Shares
   horizontal padding with the surrounding .dropdown-item rows. */
.sesam-user-dropdown-menu .dropdown-element {
  padding: 0.25rem 1.5rem;
}

.sesam-no-caret::after { display: none !important; }

.sesam-build-upload-dropdown .dropdown-menu {
  margin-top: -36px !important;
}

/* Common icon spacing utilities shared across SESAM apps. Spacing is given
   in rem so the gap scales with the surrounding text. */
.sesam-icon-dropdown-item { margin-right: 0.7rem; }   /* icons inside .dropdown-item */
.sesam-icon-label         { margin-right: 0.45rem; }  /* icons in front of inline labels */
.sesam-icon-chevron       { margin: 0 0.125rem; }     /* small chevron inside icon-only dropdown buttons */

/* Active list-group item rendered like a regular item (no SESAM-blue fill).
   Used by the workspace scenario detail page. */
.list-group-item.active.sesam-list-no-active {
  background-color: inherit;
  color: inherit;
  border-color: rgba(0, 0, 0, 0.125);
  border-top-width: 0 !important;
  margin-top: 0 !important;
}

/* Inline list-style helper for marker text inside modal bodies. */
.sesam-list-style-inside { list-style: inside; }

/* Light/header strip used in muted modals such as the About dialog. */
.sesam-modal-header-muted { background-color: var(--sesam-surface-muted); }

/* Light-red form warning box and matching label, used by destructive flows. */
.sesam-danger-box {
  background-color: var(--sesam-danger-bg);
  border-radius: 0.35rem;
  border: 1px solid var(--sesam-danger-border);
}
.sesam-danger-box-label {
  color: var(--sesam-red);
  font-weight: bold;
}

.sesam-counter-badge {
  background-color: var(--sesam-card-header-bg);
  color: var(--sesam-gray-700);
}

/* Plan-status pill ("Active", "Trial", …) aligned with the surrounding h6. */
.sesam-plan-status-badge {
  vertical-align: middle;
  position: relative;
  top: -2px;
}

/* What a feature does and what it takes, for plans without it (editor/_editor_intro.html: Editor start page and
   the page an Editor link leads to without the Editor): a card with the reason, the benefits and one action. */
/* The yellow frame and the band of the plan lock (.sesam-plan-notice) make clear that this is not the page's own
   content but what the plan lacks. */
.sesam-feature-intro {
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
  margin-bottom: 1.25rem;
  padding: 0 1.75rem 1.5rem;
  overflow: hidden;
  border: 1px solid rgba(var(--sesam-yellow-rgb), 0.55);
  border-radius: 0.875rem;
  background: var(--sesam-card-bg);
  box-shadow: var(--sesam-shadow-soft);
}

/* The plan lock as a band across the top of the card: edge to edge, a larger lock. */
.sesam-feature-intro .sesam-feature-intro-notice {
  align-items: center;
  margin: 0 -1.75rem 0.375rem;
  padding: 1rem 1.75rem;
  border: 0;
  border-bottom: 1px solid rgba(var(--sesam-yellow-rgb), 0.45);
  border-radius: 0;
  box-shadow: inset 5px 0 0 var(--sesam-yellow);
  font-size: var(--sesam-text-body);
}

.sesam-feature-intro .sesam-feature-intro-notice .sesam-plan-notice-icon {
  width: 2.5rem;
  height: 2.5rem;
  font-size: 1.1rem;
}

.sesam-feature-intro-title {
  margin: 0;
  color: var(--sesam-heading-color);
  font-size: 1.25rem;
  font-weight: 600;
}

.sesam-feature-intro-text {
  max-width: 48rem;
  margin: 0;
  color: var(--sesam-gray-600);
  font-size: var(--sesam-text-body);
  line-height: 1.6;
}

.sesam-feature-intro-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
  gap: 0.625rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.sesam-feature-intro-list li {
  display: flex;
  align-items: flex-start;
  gap: 0.625rem;
  padding: 0.625rem 0.75rem;
  border: 1px solid var(--sesam-surface-muted);
  border-radius: 0.625rem;
  color: var(--sesam-gray-600);
  font-size: var(--sesam-text-meta);
}

.sesam-feature-intro-list i {
  flex: none;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 0.5rem;
  background: rgba(var(--sesam-blue-rgb), 0.1);
  color: var(--sesam-blue);
  font-size: 0.8125rem;
  line-height: 1.75rem;
  text-align: center;
}

.sesam-feature-intro-list b {
  display: block;
  color: var(--sesam-heading-color);
  font-size: var(--sesam-text-body);
  font-weight: 600;
}

/* The one action of the card, centered below the benefits. */
.sesam-feature-intro-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 0.25rem;
}

/* The card in front of the page content it locks (Editor start page): both share one grid cell, the content behind
   is blurred, faded and inert (no pointer, no focus), the card stays sharp. Works in all current browsers (filter:
   blur, inert); an old browser without inert still shows the blurred content and blocks the pointer. */
.sesam-feature-locked {
  display: grid;
}

.sesam-feature-locked > * {
  grid-area: 1 / 1;
  min-width: 0;
}

.sesam-feature-locked > .sesam-feature-intro {
  z-index: 1;
  align-self: start;
  justify-self: center;
  width: min(100%, 60rem);
  margin: 1.5rem 0;
  box-shadow: var(--sesam-shadow-strong);
}

.sesam-feature-locked-content {
  filter: blur(3px);
  opacity: 0.55;
  pointer-events: none;
  user-select: none;
}

/* The Workspace tree behind such a lock: the wrapper takes the tree's place in the flex row of .sesam-workspace. */
.sesam-workspace-tree-locked {
  flex: 1 1 240px;
  max-width: 290px;
}

.sesam-workspace-tree-locked > .sesam-workspace-tree {
  max-width: none;
}

/* The card alone on a page (editor_not_available.html), with a way back below it. */
.sesam-feature-intro-page {
  max-width: 60rem;
  margin: 2rem auto;
  padding: 0 1rem;
}

.sesam-feature-intro-back {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: var(--sesam-text-body);
}

/* Notice for "your plan does not allow this": a warm amber card with a filled icon tile, noticeable without the
   alarm of a red Bootstrap alert. Markup: <div class="sesam-plan-notice" role="note"><span
   class="sesam-plan-notice-icon"><i class="fa-solid fa-lock"></i></span><div class="sesam-plan-notice-body">…</div>
   </div>. Toggle visibility with `d-none` only; `d-block` would override the flex layout. */
.sesam-plan-notice {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  font-size: 0.9rem;
  line-height: 1.4;
  color: var(--sesam-heading-color);
  background-color: rgba(var(--sesam-yellow-rgb), 0.14);
  border: 1px solid rgba(var(--sesam-yellow-rgb), 0.45);
  border-radius: 0.5rem;
  /* The accent strip is an inset shadow (not border-left) so it follows the rounded corners without tapering. */
  box-shadow: inset 5px 0 0 var(--sesam-yellow), var(--sesam-shadow-soft);
}
/* Compact variant for page-level notices: as wide as its text instead of the full content width. */
.sesam-plan-notice-compact {
  width: fit-content;
  max-width: min(100%, 36rem);
}
/* Selection table whose rows cannot be chosen because the plan lacks the feature. */
.sesam-table-locked {
  opacity: 0.6;
  pointer-events: none;
  cursor: not-allowed;
}
.sesam-plan-notice-icon {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  font-size: 0.9rem;
  color: var(--bs-white);
  background-color: var(--sesam-yellow);
  border-radius: 50%;
}
.sesam-plan-notice-body { flex: 1 1 auto; min-width: 0; align-self: center; text-wrap: pretty; }
.sesam-plan-notice-body strong { font-weight: 600; }
/* Plan name inside running text ("Your Starter plan …"): semibold, no further chrome. */
.sesam-plan-name {
  font-weight: 600;
  white-space: nowrap;
}

/* About dialog header: logo left, version pill and close button right, on a flat light brand tint with a
   brand-colored strip on top. */
.sesam-about-header {
  align-items: center;
  padding: 1.1rem 1.25rem;
  background-color: rgba(var(--sesam-blue-rgb), 0.08);
  border-bottom: 1px solid rgba(var(--sesam-blue-rgb), 0.12);
  box-shadow: inset 0 4px 0 var(--sesam-blue);
}
.sesam-about-version {
  font-weight: 500;
  color: var(--sesam-blue);
  background-color: var(--sesam-card-bg);
  border: 1px solid rgba(var(--sesam-blue-rgb), 0.25);
}

/* About dialog (guests): one usage row = label and remaining count above a slim progress bar. */
.sesam-about-meter {
  margin-bottom: 1rem;
  font-size: 0.875rem;
}
.sesam-about-meter .progress { margin-top: 0.35rem; }
/* Plan name in the plan's own color (set as --sesam-plan-color from the plan definition). */
.sesam-about-plan-name {
  font-weight: 600;
  color: var(--sesam-plan-color, inherit);
}

/* Feedback form: Django's field error lists as small red text under the field. */
#feedbackForm .errorlist {
  margin: 0.25rem 0 0;
  padding: 0;
  list-style: none;
  font-size: 0.875rem;
  color: var(--sesam-red-strong);
}

/* Feedback page for guests: centered call-to-action card with a round brand-tinted icon on top. */
.sesam-feedback-gate-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 4rem;
  height: 4rem;
  margin-bottom: 1.25rem;
  font-size: 1.6rem;
  color: var(--sesam-blue);
  background-color: rgba(var(--sesam-blue-rgb), 0.1);
  border-radius: 50%;
}

/* ***************************************************
 * 9. INTERACTIVE — MONTHLY/YEARLY SWITCH, TERMINAL, TOOLBARS
 * *************************************************** */

/* Monthly/yearly switch (plans page). Pill border-radius and
   the 4px padding are decorative; the rest of the geometry scales with
   text via rem units.
   Source: https://webdesign.tutsplus.com/tutorials/pricing-table-with-monthly-yearly-css-toggle-switch--cms-93335 */
.sesam-switch {
  position: relative;
  display: inline-flex;
  padding: 4px;
  border: 1px solid lightgrey;
  margin-bottom: 1.25rem;
  border-radius: 30px;
  background: white;
}
.sesam-switch [type="radio"] {
  position: absolute;
  left: -9999px;
}
.sesam-switch [type="radio"]:checked#first_option ~ label[for="first_option"],
.sesam-switch [type="radio"]:checked#second_option ~ label[for="second_option"] {
  color: white;
}
.sesam-switch [type="radio"]:checked#first_option ~ label[for="first_option"]:hover,
.sesam-switch [type="radio"]:checked#second_option ~ label[for="second_option"]:hover {
  background: transparent;
}
.sesam-switch [type="radio"]:checked#first_option + label[for="second_option"] ~ .sesam-switch-highlighter {
  transform: none;
}
.sesam-switch [type="radio"]:checked#second_option + label[for="first_option"] ~ .sesam-switch-highlighter {
  transform: translateX(100%);
}
.sesam-switch label {
  font-size: 0.875rem;
  z-index: 1;
  min-width: 5.625rem;
  line-height: 1.75rem;
  cursor: pointer;
  border-radius: 30px;
  transition: color 0.25s ease-in-out;
  margin-bottom: 0 !important;
}
.sesam-switch label:hover {
  background: whitesmoke;
}
.sesam-switch-highlighter {
  position: absolute;
  top: 4px;
  left: 4px;
  width: calc(50% - 4px);
  height: calc(100% - 8px);
  border-radius: 30px;
  background: var(--sesam-blue);
  transition: transform 0.25s ease-in-out;
}

.sesam-terminal {
  background-color: var(--sesam-terminal-bg) !important;
  overflow-x: auto;
  white-space: nowrap;
  color: var(--sesam-terminal-fg) !important;
}

/* Base toolbar used across SESAM app pages. `z-index: 5` keeps the
   toolbar above in-page dropdowns and overlays; the inner container and
   buttons are layered above the toolbar background so click targets are
   never occluded. */
.sesam-toolbar {
  min-height: 54px !important;
  position: relative;
  z-index: 5;
}
.sesam-toolbar > .container-fluid { position: relative; z-index: 1; }
.sesam-toolbar .btn               { position: relative; z-index: 2; }

/* Three-part workflow toolbar shared by Builder, Editor, Simulator and Analyzer. */
.navbar.sesam-toolbar > .sesam-flow-toolbar {
  width: 100%;
  display: grid;
  grid-template-areas: "start hint end";
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
}

.sesam-flow-toolbar-start {
  grid-area: start;
  justify-self: start;
}

.sesam-flow-back {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 2rem;
  padding: 0.25rem 0.5rem;
  color: var(--sesam-gray-600);
  background: transparent;
  border: 0;
  border-radius: var(--bs-border-radius-sm);
  box-shadow: none;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.5;
  text-decoration: none;
}

.sesam-flow-back:visited { color: var(--sesam-gray-600); }
.sesam-flow-back:hover,
.sesam-flow-back:focus,
.sesam-flow-back:active {
  color: var(--sesam-blue);
  background: transparent;
  text-decoration: none;
}

.sesam-flow-toolbar-hint {
  grid-area: hint;
  color: var(--sesam-gray-600);
  font-weight: 600;
  text-align: center;
  user-select: none;
}

.sesam-flow-toolbar-end {
  grid-area: end;
  justify-self: end;
}

/* Shared introduction and table shell for selection-based app start pages. */
.container-fluid.sesam-selection-page {
  width: 100%;
  padding: 2rem clamp(1rem, 2vw, 2rem) 1.5rem;
}

.sesam-selection-page-header {
  margin-bottom: 2rem;
}

.sesam-selection-page-header h2 {
  margin: 0;
  color: var(--sesam-heading-color);
  font-size: var(--sesam-text-title);
  font-weight: 600;
}

.sesam-selection-page-header p {
  margin: 0.75rem 0 0;
  font-size: var(--sesam-text-body);
  line-height: 1.625;
}

.sesam-selection-table {
  overflow: hidden;
  background: var(--sesam-card-bg);
  border: 1px solid var(--sesam-card-border);
  border-radius: var(--bs-border-radius-sm);
}

@media (max-width: 575px) {
  .navbar.sesam-toolbar > .sesam-flow-toolbar {
    grid-template-areas: "start end";
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .sesam-flow-toolbar-hint {
    display: none;
  }
}

/* Reusable status surface for Builder workflows that report structured task
   stages. The bounded column follows the detail-page layout pattern while the
   individual panels can be shared by template, upload and custom-build tasks. */
/* A small top padding: the app shell already sets the content 24px below the top bar */
.container-fluid.sesam-async-task-page {
  width: 100%;
  min-height: calc(100vh - var(--sesam-navbar-height) - 54px);
  padding: 1.25rem clamp(1rem, 3vw, 2rem) 3rem;
}

.sesam-async-task {
  width: min(100%, 60rem);
  margin: 0 auto;
}

.sesam-async-task-hero {
  text-align: center;
}

.sesam-async-task-hero h2 {
  margin: 1rem 0 0.5rem;
  color: var(--sesam-heading-color);
  font-size: var(--sesam-text-title);
  font-weight: 600;
}

.sesam-async-task-hero p {
  margin: 0;
  font-size: var(--sesam-text-body);
}

.sesam-async-task-status {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.75rem;
  color: var(--sesam-gray-700);
  background: var(--sesam-card-header-bg);
  border: 1px solid var(--sesam-card-border);
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.sesam-async-task-status-processing {
  color: var(--sesam-blue);
  background: rgba(var(--sesam-blue-rgb), 0.08);
  border-color: rgba(var(--sesam-blue-rgb), 0.25);
}

.sesam-async-task-status-success {
  color: var(--sesam-green);
  background: rgba(var(--bs-success-rgb), 0.08);
  border-color: rgba(var(--bs-success-rgb), 0.3);
}

.sesam-async-task-status-failure {
  color: var(--sesam-red-strong);
  background: var(--sesam-danger-bg);
  border-color: var(--sesam-danger-border);
}

.sesam-async-task-overview {
  margin: 2rem 0 1.5rem;
}

.sesam-async-task-segments {
  display: flex;
  gap: 0.4rem;
}

.sesam-async-task-segment {
  flex: 1 1 0;
  height: 0.35rem;
  background: var(--sesam-gray-300);
  border-radius: 999px;
}

.sesam-async-task-segment-success { background: var(--sesam-green); }
.sesam-async-task-segment-complete { background: var(--sesam-green); }
.sesam-async-task-segment-failure { background: var(--sesam-red); }
.sesam-async-task-segment-started,
.sesam-async-task-segment-progress,
.sesam-async-task-segment-retry,
.sesam-async-task-segment-received {
  background: linear-gradient(90deg, var(--sesam-green) 50%, var(--sesam-gray-300) 50%);
}

.sesam-async-task-overview p {
  margin: 0.6rem 0 0;
  color: var(--sesam-gray-600);
  font-size: var(--sesam-text-meta);
}

.sesam-async-task-next,
.sesam-async-task-panel {
  margin-top: 1rem;
  background: var(--sesam-card-bg);
  border: 1px solid var(--sesam-card-border);
  border-radius: 0.6rem;
  box-shadow: var(--sesam-shadow-soft);
}

/* The failure card of the status pages (Builder, upload, Simulator), like the plan-lock card (.sesam-feature-intro) in red, with its band as a
   column on the left: a white card with a red frame, the column with the accent strip and the icon, the heading, the
   error and the way back beside it. */
.sesam-async-task-failure {
  display: flex;
  margin-top: 1rem;
  overflow: hidden;
  background: var(--sesam-card-bg);
  border: 1px solid rgba(var(--sesam-red-rgb), 0.45);
  border-radius: 0.875rem;
  box-shadow: var(--sesam-shadow-soft);
}

/* The accent strip is an inset shadow (not border-left), so it follows the rounded corners; the icon in the middle */
.sesam-async-task-failure-side {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.1rem 1rem 1.1rem 1.3rem;
  background: rgba(var(--sesam-red-rgb), 0.1);
  border-right: 1px solid rgba(var(--sesam-red-rgb), 0.3);
  box-shadow: inset 5px 0 0 var(--sesam-red);
}

.sesam-async-task-failure-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  color: var(--bs-white);
  background: var(--sesam-red);
  border-radius: 50%;
  /* Larger than the lock of the plan card (1.1rem): the triangle fills less of its box */
  font-size: 1.75rem;
  line-height: 1;
}

/* The triangle is centered by its outline, but its wide base pulls it down for the eye: a little up */
.sesam-async-task-failure-icon i { transform: translateY(-0.12rem); }

.sesam-async-task-failure-body {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 0.75rem;
  min-width: 0;
  padding: 1.1rem 1.5rem 1.25rem;
}

.sesam-async-task-failure-heading {
  color: var(--sesam-heading-color);
  font-weight: 600;
}

/* One sentence on what happened, close below the heading */
.sesam-async-task-failure-lead {
  margin: -0.5rem 0 0;
  color: var(--sesam-gray-700);
  font-size: var(--sesam-text-body);
}

.sesam-async-task-failure-lead:empty { display: none; }

/* One entry per error: where it stopped, then the error block */
.sesam-async-task-failure-entries {
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
}

.sesam-async-task-failure-entries:empty { display: none; }

.sesam-async-task-failure-entry-lead:empty { display: none; }

.sesam-async-task-failure-entry-lead {
  margin: 0 0 0.35rem;
  color: var(--sesam-gray-700);
  font-size: var(--sesam-text-meta);
}

/* The error as the output it is: monospace in a framed block, in the red of errors, wrapped at any point */
.sesam-async-task-error {
  margin: 0;
  padding: 0.6rem 0.75rem;
  color: var(--sesam-red-strong);
  background: rgba(var(--sesam-red-rgb), 0.06);
  border: 1px solid rgba(var(--sesam-red-rgb), 0.25);
  border-radius: 0.4rem;
  font-family: var(--bs-font-monospace);
  font-size: 0.8125rem;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* The copy button sits in the top right corner of the error block, which keeps room for it */
.sesam-async-task-error-wrap { position: relative; }

.sesam-async-task-error-wrap .sesam-async-task-error { padding-right: 2.75rem; }

.sesam-async-task-error-copy {
  position: absolute;
  top: 0.3rem;
  right: 0.3rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.9rem;
  height: 1.9rem;
  /* Gray, the action is no error: darker on hover */
  color: var(--sesam-gray-600);
  background: none;
  border: 0;
  border-radius: 0.375rem;
  font-size: 0.875rem;
}

.sesam-async-task-error-copy:hover { color: var(--sesam-heading-color); }

.sesam-async-task-error-copy:focus-visible {
  outline: 2px solid rgba(var(--sesam-blue-rgb), 0.5);
  outline-offset: 1px;
}

.sesam-async-task-failure .sesam-async-task-failure-actions { margin-top: 0; }

.sesam-async-task-failure-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  margin-top: 1rem;
}

.sesam-async-task-failure-actions a,
.sesam-async-task-failure-actions button {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--sesam-blue);
  font-size: 0.875rem;
  text-decoration: none;
}

.sesam-async-task-failure-actions a:hover,
.sesam-async-task-failure-actions a:focus,
.sesam-async-task-failure-actions a:active {
  color: var(--sesam-blue);
  text-decoration: none;
}

.sesam-async-task-next { padding: 1.25rem 1.5rem; }

.sesam-async-task-next h3 {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin: 0;
  color: var(--sesam-heading-color);
  font-size: var(--sesam-text-section);
  font-weight: 600;
}

.sesam-async-task-next h4 {
  margin: 0 0 0.75rem;
  color: var(--sesam-gray-600);
  font-size: var(--sesam-text-meta);
  font-weight: 600;
}

.sesam-async-task-next-group { margin-top: 1.25rem; }
.sesam-async-task-next-group + .sesam-async-task-next-group {
  padding-top: 1.1rem;
  border-top: 1px solid var(--sesam-card-border);
}


.sesam-async-task-actions a,
.sesam-async-task-actions button,
.sesam-async-task-navigation a {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  width: fit-content;
  padding: 0;
  color: var(--sesam-blue);
  font-size: var(--sesam-text-body);
  font-weight: 600;
  text-align: left;
  text-decoration: none;
}

.sesam-async-task-actions a:hover,
.sesam-async-task-actions button:hover,
.sesam-async-task-navigation a:hover { color: var(--sesam-blue); text-decoration: none; }

/* Both rows of the next steps set their links side by side and wrap; a two-column grid put the second action halfway
   across the card. */
.sesam-async-task-actions,
.sesam-async-task-navigation {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.75rem;
}

.sesam-async-task-panel { overflow: hidden; }

/* Title, the meta text (right aligned, optional) and the chevron in the last column, so the chevrons of all panels
   line up */
.sesam-async-task-panel > summary {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.75rem;
  min-height: 3.6rem;
  padding: 0.85rem 1.1rem;
  cursor: pointer;
  list-style: none;
}

.sesam-async-task-panel > summary::-webkit-details-marker { display: none; }
/* Compact panel (the save dialog of the Editor): a lower header, matching the compact stage list */
.sesam-async-task-panel-compact > summary { min-height: 2.6rem; padding: 0.45rem 1rem; }
.sesam-async-task-panel[open] > summary { border-bottom: 1px solid var(--sesam-card-border); }

.sesam-async-task-panel-title {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--sesam-heading-color);
  font-weight: 600;
}

.sesam-async-task-panel-meta {
  justify-self: end;
  color: var(--sesam-gray-600);
  font-size: var(--sesam-text-meta);
}

.sesam-async-task-chevron { grid-column: 3; color: var(--sesam-gray-600); transition: transform 0.2s ease; }
.sesam-async-task-panel[open] .sesam-async-task-chevron { transform: rotate(180deg); }

/* The copy button of a log floats in the top right corner of the box around the log, outside the scrolling content,
   so it stays in view; it keeps clear of the vertical scrollbar. Light gray on the dark log, white on hover. Used by
   the Builder and upload status pages (fragments/async_task_status.html) and the Simulator status page. */
.sesam-async-task-log-box { position: relative; }

/* An empty log has nothing to copy: no button */
.sesam-async-task-log:empty + .sesam-async-task-log-copy { display: none; }

.sesam-async-task-log-copy {
  position: absolute;
  top: 0.4rem;
  right: 1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.9rem;
  height: 1.9rem;
  color: var(--sesam-gray-500);
  background: var(--sesam-terminal-bg);
  border: 0;
  border-radius: 0.375rem;
  font-size: 0.875rem;
}

.sesam-async-task-log-copy:hover { color: var(--bs-white); }

.sesam-async-task-log-copy:focus-visible {
  outline: 2px solid rgba(var(--sesam-blue-rgb), 0.6);
  outline-offset: 1px;
}

.sesam-async-task-panel-body { padding: 1rem 1.25rem 1.25rem; }
.sesam-async-task-stage-list,
.sesam-async-task-substage-list { margin: 0; padding: 0; list-style: none; }

.sesam-async-task-stage {
  position: relative;
  display: grid;
  grid-template-columns: 1.5rem minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.7rem;
  min-height: 2.75rem;
  padding: 0.35rem 0.6rem;
  border-radius: 0.4rem;
}

.sesam-async-task-stage + .sesam-async-task-stage { margin-top: 0.15rem; }
.sesam-async-task-stage:not(:last-child)::before {
  position: absolute;
  top: 2.05rem;
  bottom: -0.85rem;
  left: 1.18rem;
  width: 1px;
  background: var(--sesam-gray-300);
  content: "";
}
.sesam-async-task-stage-started,
.sesam-async-task-stage-progress,
.sesam-async-task-stage-retry,
.sesam-async-task-stage-received { background: var(--sesam-card-header-bg); }

.sesam-async-task-stage-marker {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  height: 1.25rem;
  color: var(--sesam-gray-500);
  border: 2px solid var(--sesam-gray-400);
  border-radius: 50%;
  font-size: 0.62rem;
}

.sesam-async-task-stage-success > .sesam-async-task-stage-marker {
  color: var(--sesam-card-bg);
  background: var(--sesam-green);
  border-color: var(--sesam-green);
}

.sesam-async-task-stage-failure > .sesam-async-task-stage-marker {
  color: var(--sesam-card-bg);
  background: var(--sesam-red);
  border-color: var(--sesam-red);
}

/* A running stage: a pale blue ring whose blue arc turns, like the steps of the Simulator status page
   (.sesam-sim-status-marker in simulator_additions.css) */
.sesam-async-task-stage-started > .sesam-async-task-stage-marker,
.sesam-async-task-stage-progress > .sesam-async-task-stage-marker,
.sesam-async-task-stage-retry > .sesam-async-task-stage-marker,
.sesam-async-task-stage-received > .sesam-async-task-stage-marker {
  border-color: rgba(var(--sesam-blue-rgb), 0.2);
  border-top-color: var(--sesam-blue);
  animation: sesam-async-task-spin 1s linear infinite;
}

@keyframes sesam-async-task-spin {
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .sesam-async-task-stage-started > .sesam-async-task-stage-marker,
  .sesam-async-task-stage-progress > .sesam-async-task-stage-marker,
  .sesam-async-task-stage-retry > .sesam-async-task-stage-marker,
  .sesam-async-task-stage-received > .sesam-async-task-stage-marker { animation: none; }
}

.sesam-async-task-stage-label { color: var(--sesam-heading-color); font-size: var(--sesam-text-item); font-weight: 600; }
.sesam-async-task-stage-state { color: var(--sesam-gray-600); font-size: var(--sesam-text-meta); }
.sesam-async-task-stage-success > .sesam-async-task-stage-state { color: var(--sesam-green); }
.sesam-async-task-stage-failure > .sesam-async-task-stage-state { color: var(--sesam-red-strong); }
.sesam-async-task-stage-started > .sesam-async-task-stage-state,
.sesam-async-task-stage-progress > .sesam-async-task-stage-state,
.sesam-async-task-stage-retry > .sesam-async-task-stage-state,
.sesam-async-task-stage-received > .sesam-async-task-stage-state { color: var(--sesam-blue); }
.sesam-async-task-substage-list { grid-column: 2 / -1; padding: 0.2rem 0 0.45rem; }
.sesam-async-task-substage { min-height: 2.25rem; padding-left: 0; }
.sesam-async-task-substage .sesam-async-task-stage-label { font-size: var(--sesam-text-body); font-weight: 400; }
/* A substage is a stage in a smaller row without left padding, so the connector line of a main stage (which assumes
   the 2.75rem row and the 0.6rem padding) would be offset to the right and start inside the marker. This version
   runs from the bottom of one marker to the top of the next one, through the marker centers (0.625rem from the left). */
.sesam-async-task-substage:not(:last-child)::before {
  top: 1.8rem;
  bottom: -0.6rem;
  left: 0.6rem;
}

/* Compact stage list (the save dialog of the Editor): lower rows, no gap between them. The connector lines are moved
   with the markers: a row is 2rem high (a substage 1.75rem), its marker of 1.25rem sits in the middle, and the line
   runs from just below one marker to just above the next one. */
.sesam-async-task-stage-list-compact .sesam-async-task-stage { min-height: 2rem; padding-top: 0.15rem; padding-bottom: 0.15rem; }
.sesam-async-task-stage-list-compact .sesam-async-task-stage + .sesam-async-task-stage { margin-top: 0; }
.sesam-async-task-stage-list-compact .sesam-async-task-stage:not(:last-child)::before { top: 1.7rem; bottom: -0.3rem; }
.sesam-async-task-stage-list-compact .sesam-async-task-substage-list { padding: 0 0 0.25rem; }
.sesam-async-task-stage-list-compact .sesam-async-task-substage { min-height: 1.75rem; }
.sesam-async-task-stage-list-compact .sesam-async-task-substage:not(:last-child)::before { top: 1.55rem; bottom: -0.2rem; }

.sesam-async-task-log {
  max-height: 26rem;
  overflow: auto;
  padding: 1rem 1.25rem;
  color: var(--sesam-terminal-fg);
  background: var(--sesam-terminal-bg);
  font-family: var(--bs-font-monospace);
  font-size: 0.8rem;
  line-height: 1.55;
  white-space: pre;
}

.sesam-async-task-log-line-error { color: var(--sesam-red); }

@media (max-width: 575px) {
  .sesam-async-task-panel-meta { display: none; }
  .sesam-async-task-stage { grid-template-columns: 1.5rem minmax(0, 1fr); }
  .sesam-async-task-stage-state { grid-column: 2; }
}

/* Builder/editor toolbar that has to render above the MapLibre canvas. The
   z-index is intentionally lower than .sesam-toolbar (which sits above the
   in-page dropdowns); the map canvas defaults to a lower stacking context,
   so 4 is enough to win against it. */
.sesam-toolbar-above-map { z-index: 4 !important; }

/* ***************************************************
 * 10. WIDGETS, MARKETING & MISC
 *
 * Sub-sections:
 *   10a. Dashboard
 *   10b. News
 *   10c. Profile / theme
 *   10d. Account form chrome
 *   10e. Decorative helpers
 *   10f. Marketing background
 * *************************************************** */

/* --- 10a. Dashboard --- */

/* Dashboard quick-action card row: full-link card + leading 2x icon. */
.sesam-dashboard-link       { color: inherit; text-decoration: none; }
.sesam-dashboard-card-icon  { margin-right: 1.25rem; }
/* "Welcome, …" heading: smaller than h2, semibold instead of bold. */
.sesam-dashboard-welcome    { font-size: 1.4rem; font-weight: 600; }

/* --- 10b. News --- */

/* SESAM News dashboard card spacing. */
.sesam-news-card { margin-top: 2rem; margin-bottom: 5px; }

/* SESAM News offcanvas — large screenshots displayed under each release
   entry. The default carries a thin light-gray frame; add the
   `--borderless` modifier for full-bleed screenshots that already supply
   their own frame. */
.sesam-news-screenshot {
  width: 100%;
  height: auto;
  border: 1px solid var(--sesam-gray-300);
  -moz-user-select: none;
  -webkit-user-select: none;
  -ms-user-select: none;
  user-select: none;
  -webkit-user-drag: none;
}
.sesam-news-screenshot--borderless { border: none; }

/* --- 10c. Profile / theme --- */

/* Theme preview card width (light/dark/system selection on profile page). */
.sesam-theme-card { width: 140px; }

/* --- 10d. Account form chrome --- */

/* Section heading distanced from the previous block. */
.sesam-section-heading { margin-top: 2rem; }

/* Account form submit row with extra top spacing. */
.sesam-form-submit-row { margin-top: 4rem; }

/* --- 10e. Decorative helpers --- */

/* Code/log container with monospace font and modest side padding. */
.sesam-log-output {
  font-size: smaller;
  margin: 0.75rem 1.25rem;
}

/* Marketing feature hero block (alternating screenshot + headline rows).
   Shared by `sesam_pages/templates/pages/edit_feature_text.html`, which is
   included from both the marketing index page and the editor
   "not available" upsell page, so the rules live globally instead of in
   `pages_additions.css`. */
.sesam-pages-feature-hero {
  padding: 100px 0;
}
.sesam-pages-feature-hero-img {
  width: 85%;
  height: auto;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  -webkit-user-drag: none;
}
.sesam-pages-feature-hero-title {
  color: var(--sesam-marketing-blue);
  font-weight: 600;
  font-size: 5rem !important;
}
.sesam-pages-feature-hero-subtitle {
  color: var(--sesam-marketing-blue-bright);
  font-weight: 600;
}
.sesam-pages-feature-hero-body {
  margin-top: 30px;
  color: var(--sesam-muted-soft);
  line-height: 1.8;
}

/* --- Shared plan comparison --- */

/* pages/plans.html is included by both the landing page and account settings.
   Keep its presentation here so both template stacks load the same rules. */

/* Wrap according to the available container width, including inside account
   settings. Cards only shrink when a single card cannot fit on a small screen. */
.sesam-pages-plans-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1.5rem;
}

.sesam-pages-plans-column {
  flex: 0 1 20rem;
  width: 100%;
  /* Three cards plus gaps must fit beside the account navigation: at a 1440px window the row is about 1018px wide,
     three 20rem cards with two 1.5rem gaps take 1008px (21rem wrapped the third card). */
  max-width: 20rem;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* Row above each plan card: "Your current plan" plus chevron (two lines) for the current plan, empty for the others.
   The fixed minimum height keeps all cards starting at the same level. */
.sesam-pages-plans-current-label {
  min-height: 3rem;
  margin-bottom: 1rem;
  text-align: center;
}

/* Inline chevron icon used in CTA buttons across the marketing pages. */
.sesam-pages-cta-chevron { margin-left: 10px; }

/* Highlight the current plan in the shared comparison fragment. */
.sesam-pages-plans-card-current { border: 3px solid var(--sesam-blue); }

/* fa-stack badge centered inside a plan-card header. */
.sesam-pages-plans-card-stack { margin-top: 8px; }

/* Price suffix " / month|year " rendered next to the big plan amount. */
.sesam-pages-plans-price-suffix { font-size: 1rem; }

/* Custom yellow header for the "Enterprise / Custom" plan card. */
.sesam-pages-plans-enterprise-header { color: #F2D138; }

/* Shared plan card with elevated shadow. */
.sesam-pages-plans-card {
  color: rgb(33, 37, 41);
  background: #fff;
  border-radius: 8px;
  box-shadow:
    0 8px 12px 1px rgba(29, 17, 51, 0.04),
    0 3px 16px 2px rgba(9, 32, 77, 0.12),
    0 5px 10px -3px rgba(29, 17, 51, 0.12);
  border-collapse: separate;
  margin-left: auto;
  margin-right: auto;
  width: 100%;
  max-width: 21rem;
  /* Align card footers within each row despite different feature-list lengths. */
  flex: 1;
}

/* Feature list inside a plan card. */
ul.sesam-pages-plans-list {
  list-style-type: none;
  margin: 1rem 0 0;
  padding: 0;
  text-align: left;
}

ul.sesam-pages-plans-list > li:not(:last-child) {
  margin-bottom: 3px;
}

ul.sesam-pages-plans-list > li > .fas {
  margin-right: 1rem;
}

/* Monthly/yearly price label inside a plan card: deliberately modest so the feature list stays the focus. */
.sesam-pages-price {
  font-weight: 600;
  font-size: 1.6rem;
  color: var(--sesam-heading-color);
}

/* --- 10f. Marketing background --- */

/* Lines-pattern background used on marketing/account pages. */
.sesam-lines-background {
  background-color: #f5f5f7;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 2000 1500'%3E%3Cdefs%3E%3CradialGradient id='a' gradientUnits='objectBoundingBox'%3E%3Cstop offset='0' stop-color='%23dcdcdc'/%3E%3Cstop offset='1' stop-color='%23f5f5f7'/%3E%3C/radialGradient%3E%3ClinearGradient id='b' gradientUnits='userSpaceOnUse' x1='0' y1='750' x2='1550' y2='750'%3E%3Cstop offset='0' stop-color='%23e9e9ea'/%3E%3Cstop offset='1' stop-color='%23f5f5f7'/%3E%3C/linearGradient%3E%3Cpath id='s' fill='url(%23b)' d='M1549.2 51.6c-5.4 99.1-20.2 197.6-44.2 293.6c-24.1 96-57.4 189.4-99.3 278.6c-41.9 89.2-92.4 174.1-150.3 253.3c-58 79.2-123.4 152.6-195.1 219c-71.7 66.4-149.6 125.8-232.2 177.2c-82.7 51.4-170.1 94.7-260.7 129.1c-90.6 34.4-184.4 60-279.5 76.3C192.6 1495 96.1 1502 0 1500c96.1-2.1 191.8-13.3 285.4-33.6c93.6-20.2 185-49.5 272.5-87.2c87.6-37.7 171.3-83.8 249.6-137.3c78.4-53.5 151.5-114.5 217.9-181.7c66.5-67.2 126.4-140.7 178.6-218.9c52.3-78.3 96.9-161.4 133-247.9c36.1-86.5 63.8-176.2 82.6-267.6c18.8-91.4 28.6-184.4 29.6-277.4c0.3-27.6 23.2-48.7 50.8-48.4s49.5 21.8 49.2 49.5c0 0.7 0 1.3-0.1 2L1549.2 51.6z'/%3E%3Cg id='g'%3E%3Cuse href='%23s' transform='scale(0.12) rotate(60)'/%3E%3Cuse href='%23s' transform='scale(0.2) rotate(10)'/%3E%3Cuse href='%23s' transform='scale(0.25) rotate(40)'/%3E%3Cuse href='%23s' transform='scale(0.3) rotate(-20)'/%3E%3Cuse href='%23s' transform='scale(0.4) rotate(-30)'/%3E%3Cuse href='%23s' transform='scale(0.5) rotate(20)'/%3E%3Cuse href='%23s' transform='scale(0.6) rotate(60)'/%3E%3Cuse href='%23s' transform='scale(0.7) rotate(10)'/%3E%3Cuse href='%23s' transform='scale(0.835) rotate(-40)'/%3E%3Cuse href='%23s' transform='scale(0.9) rotate(40)'/%3E%3Cuse href='%23s' transform='scale(1.05) rotate(25)'/%3E%3Cuse href='%23s' transform='scale(1.2) rotate(8)'/%3E%3Cuse href='%23s' transform='scale(1.333) rotate(-60)'/%3E%3Cuse href='%23s' transform='scale(1.45) rotate(-30)'/%3E%3Cuse href='%23s' transform='scale(1.6) rotate(10)'/%3E%3C/g%3E%3C/defs%3E%3Cg transform='rotate(0 0 0)'%3E%3Cg transform='rotate(0 0 0)'%3E%3Ccircle fill='url(%23a)' r='3000'/%3E%3Cg opacity='0.5'%3E%3Ccircle fill='url(%23a)' r='2000'/%3E%3Ccircle fill='url(%23a)' r='1800'/%3E%3Ccircle fill='url(%23a)' r='1700'/%3E%3Ccircle fill='url(%23a)' r='1651'/%3E%3Ccircle fill='url(%23a)' r='1450'/%3E%3Ccircle fill='url(%23a)' r='1250'/%3E%3Ccircle fill='url(%23a)' r='1175'/%3E%3Ccircle fill='url(%23a)' r='900'/%3E%3Ccircle fill='url(%23a)' r='750'/%3E%3Ccircle fill='url(%23a)' r='500'/%3E%3Ccircle fill='url(%23a)' r='380'/%3E%3Ccircle fill='url(%23a)' r='250'/%3E%3C/g%3E%3Cg transform='rotate(0 0 0)'%3E%3Cuse href='%23g' transform='rotate(10)'/%3E%3Cuse href='%23g' transform='rotate(120)'/%3E%3Cuse href='%23g' transform='rotate(240)'/%3E%3C/g%3E%3Ccircle fill-opacity='0.46' fill='url(%23a)' r='3000'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  background-size: cover;
}

/* ***************************************************
 * 11. SCENARIO BROWSER
 *
 * The tree of projects and the scenario table of templates/fragments/scenario_browser/, shared by the Workspace
 * (workspace/index.html) and the Editor start page (editor/index.html), plus the surfaces, pills and dialogs the
 * Scenario details page uses as well. The `sesam-workspace-*` names come from the Workspace, where the browser was
 * built first (issue #452); they are kept so templates, scripts and tests stay stable.
 * *************************************************** */

/* ------------------------------------------------------------------ page layout */

.sesam-workspace-page {
  padding-bottom: 3rem;
}

/* Two columns: the tree keeps its width, the content takes the rest and stacks below the tree on narrow screens
   (flex-wrap with a large grow factor on the content, see DEV-css.md). */
.sesam-workspace {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 1.5rem;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0.5rem 0;
}

/* ------------------------------------------------------------------ shared surfaces */

/* Card chrome of both pages (tree, project card, table, map card, overview cards, simulation list) */
.sesam-workspace-card {
  background: var(--sesam-card-bg);
  border: 1px solid var(--sesam-card-border);
  border-radius: 0.875rem;
  box-shadow: var(--sesam-shadow-soft);
}

/* Pills: status, expiry and label badges of both pages share one shape; a modifier sets the color pair. The
   templates build the modifier from data where the values are colors or states (`-{{ expiry.level }}` is green,
   yellow or red; `-{{ simulation.status }}` is finished, running or failed). `width: max-content` keeps a pill
   from stretching in a column flex container (the name cell of the table). */
.sesam-workspace-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  width: max-content;
  padding: 0.1rem 0.5rem;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

/* Neutral label: origin, version, built-in type, inspector chips, members of a type distribution */
.sesam-workspace-pill-neutral {
  border-color: var(--sesam-card-border);
  background: var(--sesam-card-header-bg);
  color: var(--sesam-gray-600);
  font-weight: 500;
}

.sesam-workspace-pill-neutral i {
  color: var(--sesam-gray-600);
}

/* Link to the project of a scenario (project column of the table) */
.sesam-workspace-pill-project {
  border-color: rgba(var(--bs-success-rgb), 0.35);
  background: rgba(var(--bs-success-rgb), 0.12);
  color: var(--sesam-green);
  font-weight: 500;
}

a.sesam-workspace-pill-project:hover {
  border-color: var(--sesam-green);
}

.sesam-workspace-pill-blue,
.sesam-workspace-pill-running {
  background: var(--sesam-light-blue);
  color: var(--sesam-blue);
}

.sesam-workspace-pill-green,
.sesam-workspace-pill-finished {
  background: rgba(var(--bs-success-rgb), 0.12);
  color: var(--sesam-green);
}

.sesam-workspace-pill-yellow {
  background: rgba(var(--sesam-yellow-rgb), 0.18);
  color: #8a6d00;
}

.sesam-workspace-pill-red,
.sesam-workspace-pill-failed {
  background: var(--sesam-danger-bg);
  color: var(--sesam-red-strong);
}

/* ------------------------------------------------------------------ tree */

.sesam-workspace-tree {
  flex: 1 1 240px;
  max-width: 290px;
  padding: 0.625rem;
}

.sesam-workspace-tree-item {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  width: 100%;
  padding: 0.5625rem 0.625rem;
  border-radius: 0.5rem;
  color: var(--sesam-heading-color);
  font-size: var(--sesam-text-body);
  font-weight: 500;
  text-decoration: none;
  transition: background-color 0.15s ease;
}

.sesam-workspace-tree-item i {
  width: 1rem;
  text-align: center;
  color: var(--sesam-blue);
}

.sesam-workspace-tree-item:hover {
  background: var(--sesam-card-header-bg);
  color: var(--sesam-heading-color);
}

.sesam-workspace-tree-item.is-active {
  background: var(--sesam-light-blue);
  color: var(--sesam-blue);
}

[data-bs-theme="dark"] .sesam-workspace-tree-item.is-active {
  background: rgba(var(--sesam-blue-rgb), 0.35);
  color: #fff;
}

.sesam-workspace-tree-project i {
  color: var(--sesam-green);
}

.sesam-workspace-tree-item.is-active.sesam-workspace-tree-project i {
  color: inherit;
}

/* Drop target while a scenario row is dragged over it */
.sesam-workspace-tree-item.is-drop-target {
  outline: 2px dashed var(--sesam-blue);
  outline-offset: -2px;
  background: var(--sesam-light-blue);
}

.sesam-workspace-tree-label {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.sesam-workspace-tree-count {
  margin-left: auto;
  font-size: var(--sesam-text-meta);
  font-variant-numeric: tabular-nums;
  color: var(--sesam-gray-600);
}

.sesam-workspace-tree-children {
  margin: 0.125rem 0 0 1.125rem;
  padding-left: 0.5rem;
  border-left: 1px solid var(--sesam-card-border);
}

.sesam-workspace-tree-new {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  width: 100%;
  margin-top: 0.5rem;
  padding: 0.5625rem 0.625rem;
  border: 1px dashed var(--sesam-gray-400);
  border-radius: 0.5rem;
  background: none;
  color: var(--sesam-blue);
  font-size: var(--sesam-text-body);
  font-weight: 600;
}

.sesam-workspace-tree-new:hover {
  border-color: var(--sesam-blue);
}

.sesam-workspace-tree-hint {
  margin: 0.875rem 0.625rem 0.25rem;
  font-size: var(--sesam-text-meta);
  line-height: 1.5;
  color: var(--sesam-gray-600);
}

/* ------------------------------------------------------------------ content header */

.sesam-workspace-content {
  flex: 999 1 560px;
  min-width: 0;
}

.sesam-workspace-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.sesam-workspace-title {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  min-width: 0;
}

.sesam-workspace-title-icon {
  display: flex;
  flex: 0 0 2.75rem;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 0.625rem;
  background: var(--sesam-light-blue);
  color: var(--sesam-blue);
  font-size: 1.25rem;
}

.sesam-workspace-title-icon.is-project {
  background: rgba(var(--bs-success-rgb), 0.15);
  color: var(--sesam-green);
}

.sesam-workspace-heading {
  margin: 0;
  color: var(--sesam-heading-color);
  font-size: var(--sesam-text-title);
  font-weight: 600;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.sesam-workspace-subtitle {
  margin: 0.25rem 0 0;
  font-size: var(--sesam-text-body);
  color: var(--sesam-gray-600);
}

.sesam-workspace-head-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.sesam-workspace-head-actions .btn i {
  margin-right: 0.35rem;
}

/* Square icon-only header button, as high as a .btn-sm: 1.5 x 0.875rem line + 0.5rem padding + 2px border */
.sesam-workspace-icon-button-lg {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: calc(1.8125rem + 2px);
  height: calc(1.8125rem + 2px);
  padding: 0;
}

.sesam-workspace-icon-button-lg i {
  margin: 0 !important;
}

/* ------------------------------------------------------------------ toasts */

/* The line of a toast (scenario_dialogs.js showToast): an optional spinner, then the message. A name (oneLine) stays on
   one line and is cut with "…"; the full name is the tooltip. */
.sesam-toast-line {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

.sesam-toast-spinner {
  flex: none;
  color: var(--sesam-blue);
}

/* The toast stack is as wide as its content (base.css sets the toasts to its width): a name would stretch it */
.sesam-toast-line.is-one-line {
  max-width: 24rem;
}

.sesam-toast-line.is-one-line .sesam-toast-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ------------------------------------------------------------------ toolbar */

.sesam-workspace-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.625rem;
  min-height: 3.875rem;
  margin-top: 1.125rem;
  padding: 0.625rem 0.75rem;
  background: var(--sesam-card-header-bg);
  border: 1px solid var(--sesam-card-border);
  border-radius: 0.75rem;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

/* The toolbar becomes the selection bar while scenarios are selected */
.sesam-workspace-toolbar.is-selecting {
  background: var(--sesam-light-blue);
  border-color: rgba(var(--sesam-blue-rgb), 0.35);
}

[data-bs-theme="dark"] .sesam-workspace-toolbar.is-selecting {
  background: rgba(var(--sesam-blue-rgb), 0.3);
}

.sesam-workspace-toolbar-search {
  display: flex;
  flex: 1 1 280px;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.sesam-workspace-search {
  position: relative;
  flex: 1 1 240px;
  max-width: 380px;
  margin: 0;
}

.sesam-workspace-search i {
  position: absolute;
  top: 50%;
  left: 0.8rem;
  z-index: 1;
  color: var(--sesam-gray-600);
  transform: translateY(-50%);
  pointer-events: none;
}

.sesam-workspace-search .form-control {
  padding-left: 2.35rem;
}

/* Bootstrap sizes inputs at 1rem; in the toolbar they use the body size so they do not outweigh the list */
.sesam-workspace-toolbar .form-control,
.sesam-workspace-toolbar .form-select {
  font-size: var(--sesam-text-body);
}

/* No margin of the global label rule: it would lift the label above the middle of the search field */
.sesam-workspace-check {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  font-size: var(--sesam-text-meta);
  color: var(--sesam-heading-color);
  white-space: nowrap;
}

.sesam-workspace-check .form-check-input {
  margin: 0;
}

.sesam-workspace-toolbar-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.625rem;
  margin-left: auto;
}

.sesam-workspace-toolbar-filters label {
  margin: 0;
}

.sesam-workspace-selection {
  display: flex;
  flex: 1 1 auto;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.sesam-workspace-selection-count {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  height: 2rem;
  margin-right: 0.25rem;
  padding: 0 0.75rem;
  border-radius: 999px;
  background: var(--sesam-blue);
  color: #fff;
  font-size: var(--sesam-text-meta);
  font-weight: 600;
}

.sesam-workspace-selection .btn i {
  margin-right: 0.35rem;
}

.sesam-workspace-danger-button {
  color: var(--sesam-red-strong);
}

.sesam-workspace-danger-button:hover {
  background: var(--sesam-danger-bg);
  border-color: var(--sesam-danger-border);
  color: var(--sesam-red-strong);
}

.sesam-workspace-clear {
  margin-left: auto;
  font-size: var(--sesam-text-body);
  text-decoration: none;
}

.sesam-workspace-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  margin-top: 0.625rem;
  padding: 0.5625rem 0.75rem;
  border: 1px solid var(--sesam-card-border);
  border-radius: 0.625rem;
  background: var(--sesam-card-header-bg);
  font-size: var(--sesam-text-meta);
  color: var(--sesam-heading-color);
}

.sesam-workspace-banner .sesam-workspace-link-button {
  margin: 0;
}

/* ------------------------------------------------------------------ table */

/* position: relative keeps absolutely positioned content (the visually hidden "Actions" header) inside the
   horizontally scrolling wrapper; without it that span widens the whole page on narrow screens */
.sesam-workspace-table-wrap {
  position: relative;
  margin-top: 0.875rem;
}

.sesam-workspace-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  color: var(--sesam-heading-color);
  font-size: var(--sesam-text-body);
  font-variant-numeric: tabular-nums;
}

/* Header typography shared with the tables of the Scenario details tabs (.sesam-scenario-table) */
.sesam-workspace-table th,
.sesam-scenario-table th {
  border-bottom: 1px solid var(--sesam-card-border);
  color: var(--sesam-gray-600);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}

.sesam-workspace-table th {
  padding: 0.6875rem 0.75rem;
  background: var(--sesam-card-header-bg);
}

.sesam-workspace-table th:first-child {
  border-top-left-radius: 0.8125rem;
}

.sesam-workspace-table th:last-child {
  border-top-right-radius: 0.8125rem;
}

.sesam-workspace-table td {
  padding: 0.5625rem 0.75rem;
  border-bottom: 1px solid var(--sesam-surface-muted);
  vertical-align: middle;
}

.sesam-workspace-table tbody tr:last-child td {
  border-bottom: 0;
}

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

.sesam-workspace-row.is-selected td {
  background: rgba(var(--sesam-blue-rgb), 0.08);
}

.sesam-workspace-row.is-dragging {
  opacity: 0.5;
}

.sesam-workspace-row .form-check-input {
  cursor: pointer;
}

.sesam-workspace-col-check {
  width: 2.75rem;
}

.sesam-workspace-col-actions {
  width: 6.5rem;
}

/* Two classes: the shared header rule (.sesam-workspace-table th) would otherwise left-align the number headers */
.sesam-workspace-table .sesam-workspace-col-num {
  text-align: right;
  white-space: nowrap;
}

.sesam-workspace-col-created {
  white-space: nowrap;
  color: var(--sesam-gray-600);
}

/* The expiry pill follows the creation date */
.sesam-workspace-col-created .sesam-workspace-pill {
  margin-left: 0.4rem;
}

/* The project column only appears while the search spans the entire Workspace */
.sesam-workspace-col-project {
  display: none;
}

.sesam-workspace-show-project .sesam-workspace-col-project {
  display: table-cell;
}

.sesam-workspace-name-cell {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

/* The preview thumbnail is a tinted SVG (shared tint in components.css) */
.sesam-workspace-thumb {
  display: block;
  flex: 0 0 4.5rem;
  width: 4.5rem;
  height: 2.875rem;
  overflow: hidden;
  border-radius: 0.4375rem;
}

.sesam-workspace-name-text {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  min-width: 0;
}

.sesam-workspace-name {
  max-width: 24rem;
  overflow: hidden;
  color: var(--sesam-heading-color);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.sesam-workspace-name:hover {
  color: var(--sesam-blue);
}

.sesam-workspace-subline {
  max-width: 24rem;
  overflow: hidden;
  font-size: var(--sesam-text-meta);
  color: var(--sesam-gray-600);
  white-space: nowrap;
  text-overflow: ellipsis;
}

.sesam-workspace-muted {
  color: var(--sesam-gray-500);
}

.sesam-workspace-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.375rem;
}

.sesam-workspace-icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.125rem;
  height: 2.125rem;
  padding: 0;
}

.sesam-workspace-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.375rem;
  padding: 3rem 1rem;
  text-align: center;
  color: var(--sesam-gray-600);
}

/* Only the large placeholder icon, not the icon of the button below it */
.sesam-workspace-empty > i {
  margin-bottom: 0.5rem;
  font-size: 1.75rem;
  color: var(--sesam-gray-400);
}

.sesam-workspace-empty strong {
  color: var(--sesam-heading-color);
}

/* Move dialog: the places are <label>s; base.css gives labels a bottom margin (gaps in the list) and list items an
   inherited muted color, so the selectable places get the heading color and no margin, the current place stays gray */
.sesam-workspace-move-list .list-group-item {
  margin-bottom: 0;
  color: var(--sesam-heading-color);
}

.sesam-workspace-move-list .list-group-item.disabled {
  color: var(--sesam-gray-500);
  cursor: not-allowed;
}

/* The dialogs of fragments/scenario_browser/dialogs.html: running text in the body size of the app pages */
.sesam-workspace-modal .modal-body {
  font-size: var(--sesam-text-body);
}

/* The objects a delete dialog removes: one framed row per name instead of a bulleted list */
.sesam-workspace-delete-list {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  margin: 0.75rem 0 0;
  padding: 0;
  list-style: none;
}

.sesam-workspace-delete-list li {
  padding: 0.4rem 0.75rem;
  border: 1px solid var(--sesam-card-border);
  border-radius: 0.5rem;
  background: var(--sesam-surface-muted);
  color: var(--sesam-heading-color);
  font-weight: 500;
  overflow-wrap: anywhere;
}

.sesam-workspace-delete-note {
  margin: 0.75rem 0 0;
  color: var(--sesam-red);
  font-size: var(--sesam-text-meta);
}

/* ------------------------------------------------------------------ pager */

.sesam-workspace-pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 0.875rem;
  font-size: var(--sesam-text-meta);
  color: var(--sesam-gray-600);
}

.sesam-workspace-pages {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.sesam-workspace-page-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.125rem;
  height: 2.125rem;
  padding: 0 0.5rem;
  border: 1px solid var(--sesam-card-border);
  border-radius: 0.5rem;
  background: var(--sesam-card-bg);
  color: var(--sesam-heading-color);
  font-size: var(--sesam-text-meta);
  font-weight: 500;
}

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

.sesam-workspace-page-button.is-active {
  border-color: var(--sesam-blue);
  background: var(--sesam-blue);
  color: #fff;
}

.sesam-workspace-page-button:disabled {
  opacity: 0.45;
}

.sesam-workspace-page-gap {
  padding: 0 0.25rem;
}

.sesam-workspace-page-size {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
}

.sesam-workspace-page-size .form-select {
  width: auto;
}

.sesam-workspace-retention {
  margin: 2rem 0 0;
  font-size: var(--sesam-text-meta);
  text-align: center;
  color: var(--sesam-gray-500);
}

/* Wide screens: the name column takes the remaining width and truncates name and description, so the table never
   grows wider than its card. max-width: 0 lets the cell shrink below its content in the automatic table layout. */
@media (min-width: 992px) {
  .sesam-workspace-table .sesam-workspace-col-name {
    width: 100%;
    max-width: 0;
  }
}

/* ------------------------------------------------------------------ narrow screens */

@media (max-width: 991.98px) {
  .sesam-workspace-tree,
  .sesam-workspace-tree-locked {
    max-width: none;
  }

  .sesam-workspace-table-wrap {
    overflow-x: auto;
  }

  .sesam-workspace-table {
    min-width: 760px;
  }

  .sesam-workspace-toolbar-filters {
    margin-left: 0;
  }
}

/* A click anywhere on a row opens it: the Scenario details page in the Workspace (workspace.js), the Editor on the
   Editor start page (editor_index.js, only rows that can be edited carry data-open-url). */
.sesam-scenario-browser-open-rows tr[data-open-url] {
  cursor: pointer;
}

/* --- reduced motion --- */

@media (prefers-reduced-motion: reduce) {
  .sesam-workspace-tree-item,
  .sesam-workspace-toolbar {
    transition: none;
  }
}

/* ***************************************************
 * 12. MAP PAGES WITH A CARD COLUMN
 *
 * The Custom Scenario Builder and the Editor: the map fills the page and a column of cards floats over its right
 * side; the map controls sit on the left. Below 992px the cards stack below the map. Built for the Builder first.
 *
 *   .sesam-map-stage          position container (the page body below the topbar or toolbar)
 *     .sesam-map-stage-map    the map
 *     .sesam-map-stage-side   the 400px column over the right side of the map
 *       .sesam-map-stage-cards  scrolling stack of .sesam-side-card
 * *************************************************** */

/* Only the cards catch the pointer, so the gaps between them keep the map draggable. */
.sesam-map-stage {
  position: relative;
}

.sesam-map-stage-map {
  position: absolute;
  inset: 0;
}

.sesam-map-stage-side {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  /* Above the map, its controls and its loading overlay (1000), below the topbar and its menus (1030, app-shell.css) */
  z-index: 1001;
  width: 400px;
  pointer-events: none;
}

/* The attribution at the bottom right of the map (as on every SESAM map) stays left of the card column, which covers
   the right of the map down to its bottom edge (issue #505); below 992px the cards are below the map. */
.sesam-map-stage .maplibregl-ctrl-bottom-right {
  right: 400px;
}

.sesam-map-stage-cards {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  height: 100%;
  padding: 0.75rem;
  overflow-y: auto;
  scrollbar-width: thin;
  pointer-events: none;
}

.sesam-map-stage-cards > * {
  flex: none;
  pointer-events: auto;
}

/* Fullscreen (stage_fullscreen.js) shows the stage with its cards; the dialogs move into it, their backdrop stays at the
   body, so the open dialog dims the stage itself. */
.sesam-map-stage:fullscreen {
  background: var(--sesam-content-bg);
}

.sesam-map-stage:fullscreen > .modal.show {
  background: rgba(0, 0, 0, 0.5);
}

/* Narrow viewports: the cards stack below the map instead of floating over it. */
@media (max-width: 991px) {
  .sesam-map-stage {
    display: flex;
    flex-direction: column;
  }

  .sesam-map-stage-map {
    position: relative;
    inset: auto;
    flex: none;
    height: 40vh;
  }

  .sesam-map-stage .maplibregl-ctrl-bottom-right {
    right: 0;
  }

  .sesam-map-stage-side {
    position: static;
    flex: 1;
    width: 100%;
    min-height: 0;
    background: var(--sesam-content-bg);
    pointer-events: auto;
  }

  .sesam-map-stage-cards {
    pointer-events: auto;
  }
}

/* One card per topic, in the style of the Upload and Template pages: icon, title, description, collapsible through
   <details>. */
.sesam-side-card {
  background: var(--sesam-card-bg);
  border: 1px solid var(--sesam-card-border);
  border-radius: 0.875rem;
  box-shadow: 0 0.25rem 0.875rem rgba(19, 50, 78, 0.12);
}

.sesam-side-card-head {
  display: block;
  padding: 0.85rem 1rem;
  cursor: pointer;
  list-style: none;
}

.sesam-side-card-head::-webkit-details-marker {
  display: none;
}

details[open] > .sesam-side-card-head,
.sesam-side-card-head-static {
  border-bottom: 1px solid var(--sesam-card-border);
}

/* A card head that does not fold (the Lane card). */
.sesam-side-card-head-static {
  cursor: default;
}

/* No ring around the whole header (it also showed after closing the dialog); keyboard focus tints the chevron. */
.sesam-side-card-head:focus,
.sesam-side-card-head:focus-visible {
  outline: none;
}

.sesam-side-card-head:focus-visible .sesam-side-card-chevron {
  color: var(--sesam-blue);
}

.sesam-side-card-row {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.sesam-side-card-row h2,
.sesam-side-card-title {
  flex: 1;
  min-width: 0;
  margin: 0;
  color: var(--sesam-heading-color);
  font-size: var(--sesam-text-item);
  font-weight: 600;
}

.sesam-side-card-icon {
  color: var(--sesam-blue);
}

/* Inside <summary> only phrasing content is valid: the network cards use spans for row, title and description. */
.sesam-side-card-desc {
  display: block;
  margin: 0.25rem 0 0;
  color: var(--sesam-gray-600);
  font-size: var(--sesam-text-meta);
  line-height: 1.55;
}

details:not([open]) > .sesam-side-card-head .sesam-side-card-desc {
  display: none;
}

/* Plan-limit notices sit in the header, above the divider, so they stay visible when the card is collapsed. */
.sesam-side-card-head .sesam-plan-notice {
  margin-top: 0.6rem;
  cursor: default;
}

.sesam-side-card-chevron {
  color: var(--sesam-gray-600);
  font-size: 0.7rem;
  transition: transform 0.15s ease;
}

details[open] > .sesam-side-card-head .sesam-side-card-chevron {
  transform: rotate(180deg);
}

/* Summary on the right of a header (vehicle icons, flow color dots, a phase count), cut with an ellipsis. */
.sesam-side-card-summary {
  position: relative;
  max-width: 9rem;
  min-width: 0;
  overflow: hidden;
  color: var(--sesam-gray-700);
  font-size: 0.8rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sesam-side-card-summary:empty {
  display: none;
}

.sesam-side-card-summary > * + * {
  margin-left: 0.35rem;
}

.sesam-side-card-body {
  padding: 0.85rem 1rem 1rem;
}

.sesam-side-stack > * + * {
  margin-top: 0.75rem;
}

/* ------------------------------------------------------------------ network cards */

/* Cards of a selected network element (templates/fragments/network_cards/, static/js/network_cards/): the Editor's
   card column (issue #463), later the Scenario details page (#467). A group (lane: Lane and Connections cards;
   junction: Junction and Signal plan cards) stacks its cards with the gap of the column. */
.sesam-net-group {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* Equal label widths in the input groups of the cards (Lane ID, Allowed, Status, ...). The label may be a <label>,
   which the global styles give a bottom margin. */
.sesam-side-prefix {
  width: 6.25rem;
  margin-bottom: 0;
}

/* Values that cannot be changed: in the frame of an input, but in the gray of the prefix, so the row reads as one
   quiet block; values that can be changed stay white (inputs, and .sesam-net-value-editable for the allowed classes
   that the Edit button changes). Cut with an ellipsis. */
.sesam-net-value {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  min-width: 0;
  overflow: hidden;
  background: var(--bs-tertiary-bg);
  /* Dark gray text: only values that can be changed are in the dark blue of the inputs. */
  color: var(--bs-gray-600);
  white-space: nowrap;
  text-overflow: ellipsis;
}

.sesam-net-value.sesam-net-value-editable {
  background: var(--bs-body-bg);
  color: var(--sesam-heading-color);
}

.sesam-net-value-icon {
  color: var(--sesam-gray-700);
}

/* Technical SUMO ids (often long, e.g. "cluster_281_4410"): one line in a monospace font, cut with an ellipsis. A
   block box, because text-overflow does not apply to the text of a flex container (.sesam-net-value). */
.sesam-net-id {
  display: block;
  min-width: 0;
  overflow: hidden;
  font-family: var(--bs-font-monospace);
  font-size: 0.75rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Allowed vehicle classes as a row of icons, in the gray of the Builder's vehicle rows. */
.sesam-net-icons {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  line-height: 1;
  overflow: hidden;
  color: var(--sesam-gray-700);
}

.sesam-net-icons-more {
  flex: none;
  color: var(--sesam-gray-600);
  font-size: 0.75rem;
}

.sesam-net-icons-none {
  color: var(--sesam-gray-500);
}

/* A choice of a few values as a joined button group: radios (.btn-check) or buttons with .active, the labels or
   buttons .btn-outline-secondary in a .btn-group-sm. The chosen one is tinted blue like the segmented controls of the
   Builder (.sesam-builder-segmented) and the lane status of the Editor (.sesam-net-segmented). Used by the simulator
   configuration (step length, sublane model, seeds, quick values). */
/* Room around short values ("1", "5 min"); a minimum width keeps single digits from looking cramped. */
.sesam-segmented > .btn {
  min-width: 2.5rem;
  margin-bottom: 0;
  padding-right: 0.75rem;
  padding-left: 0.75rem;
}

.sesam-segmented > .btn-check:checked + .btn,
.sesam-segmented > .btn.active {
  border-color: var(--sesam-blue);
  background: rgba(var(--sesam-blue-rgb), 0.1);
  color: var(--sesam-blue);
}

/* Open / Closed as two buttons that fill the rest of the input group; the chosen one is tinted blue like the
   segmented controls of the Builder (.sesam-builder-segmented). */
.sesam-net-segmented > .btn {
  flex: 1 1 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
}

.sesam-net-segmented > .btn-check:checked + .btn {
  z-index: 1;
  border-color: var(--sesam-blue);
  background: rgba(var(--sesam-blue-rgb), 0.1);
  color: var(--sesam-blue);
}

/* Lane status: the chosen state is set off by a light background and a frame, and its icon carries the meaning (a
   green check with a light green frame for Open, a red barrier with a light red frame for Closed). Open, the normal
   state, keeps gray text; Closed is red throughout.
   The other state stays a plain outline with muted text and a gray icon, so it reads as the action. */
.sesam-net-segmented > .sesam-net-status-open,
.sesam-net-segmented > .sesam-net-status-closed {
  color: var(--sesam-gray-500);
}

/* Hovering the other state previews the colors it gets when chosen. */
.sesam-net-segmented > .btn-check:checked + .sesam-net-status-open,
.sesam-net-segmented > .btn-check:not(:checked, :disabled) + .sesam-net-status-open:hover {
  border-color: var(--sesam-green);
  background: color-mix(in srgb, var(--sesam-green) 8%, transparent);
  color: var(--sesam-gray-700);
  font-weight: 500;
}

.sesam-net-segmented > .btn-check:checked + .sesam-net-status-open i,
.sesam-net-segmented > .btn-check:not(:checked, :disabled) + .sesam-net-status-open:hover i {
  color: var(--sesam-green);
}

.sesam-net-segmented > .btn-check:checked + .sesam-net-status-closed,
.sesam-net-segmented > .btn-check:not(:checked, :disabled) + .sesam-net-status-closed:hover {
  border-color: var(--sesam-red);
  background: color-mix(in srgb, var(--sesam-red) 7%, transparent);
  color: var(--sesam-red);
  font-weight: 500;
}

.sesam-net-segmented > .btn-check:checked + .sesam-net-status-closed i,
.sesam-net-segmented > .btn-check:not(:checked, :disabled) + .sesam-net-status-closed:hover i {
  color: var(--sesam-red);
}

/* Entered values in the strong contrast of the shown values (like the Builder's sidebar). */
.sesam-net-group input.form-control {
  color: var(--sesam-heading-color);
}

/* A changed value that is not saved yet (the changes panel lists it). */
.form-control.is-changed {
  border-color: var(--sesam-blue);
  box-shadow: 0 0 0 0.15rem rgba(var(--sesam-blue-rgb), 0.18);
}

.sesam-net-note {
  margin: 0;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--sesam-card-border);
  border-radius: 0.6rem;
  background: var(--sesam-card-header-bg);
  color: var(--sesam-gray-700);
  font-size: var(--sesam-text-meta);
}

.sesam-net-note + * {
  margin-top: 0.6rem;
}

/* Clear-selection button in the header of the first card. */
.sesam-net-close {
  padding: 0.1rem 0.35rem;
  color: var(--sesam-gray-600);
  line-height: 1;
}

.sesam-net-close:hover,
.sesam-net-close:focus-visible {
  background: var(--sesam-surface-muted);
  color: var(--sesam-heading-color);
}

/* Nothing selected: a compact hint, the icon beside the text. */
.sesam-net-empty-body {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
}

.sesam-net-empty-icon {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 0.5rem;
  background: rgba(var(--sesam-blue-rgb), 0.08);
  color: var(--sesam-blue);
  font-size: 0.875rem;
}

.sesam-net-empty-body h2 {
  margin: 0;
  color: var(--sesam-heading-color);
  font-size: var(--sesam-text-body);
  font-weight: 600;
}

.sesam-net-empty-body p {
  margin: 0.125rem 0 0;
  color: var(--sesam-gray-600);
  font-size: var(--sesam-text-meta);
}

.sesam-net-empty-body kbd {
  min-width: 1.6rem;
  padding: 0.05rem 0.35rem;
  border: 1px solid var(--sesam-gray-400);
  border-bottom-width: 2px;
  border-radius: 0.3rem;
  background: var(--sesam-card-header-bg);
  color: var(--sesam-heading-color);
  font-family: inherit;
  font-size: 0.7rem;
  font-weight: 600;
  text-align: center;
}


/* ---- connections */

/* Turn direction of a connection: an inline SVG stroked in the amber of the connection arrows on the map. */
.sesam-conn-dir {
  display: inline-flex;
  flex: none;
  width: 1rem;
  height: 1rem;
  color: var(--sesam-connection);
}

.sesam-conn-dir svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sesam-net-conns {
  margin: -0.35rem 0 0;
  padding: 0;
  list-style: none;
}

/* One row per connection, separated by thin lines like the vehicle rows of the Builder. Rows are not selectable: a
   row and its arrow on the map point at each other on hover (.is-linked from the map); on the delete button both
   turn red. */
.sesam-net-conn {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.45rem 0.25rem;
  border-bottom: 1px solid var(--sesam-surface-muted);
}

.sesam-net-conn:last-child {
  border-bottom: 0;
}

.sesam-net-conn:hover,
.sesam-net-conn.is-linked {
  background: rgba(var(--sesam-connection-rgb), 0.12);
}

.sesam-net-conn.is-danger {
  background: var(--sesam-danger-bg);
}

.sesam-net-conn-text {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
  color: var(--sesam-heading-color);
  line-height: 1.3;
}

.sesam-net-conn-meta {
  overflow: hidden;
  color: var(--sesam-gray-600);
  font-size: 0.75rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sesam-net-conn-meta:empty {
  display: none;
}

.sesam-net-conn-delete {
  padding: 0.2rem 0.4rem;
  color: var(--sesam-gray-600);
}

.sesam-net-conn-delete:hover,
.sesam-net-conn-delete:focus-visible {
  color: var(--sesam-red-strong);
}

/* "Add connection": a plus in a small blue outline button, centered below the list, that turns into × while the
   possible targets are open below it. Hover and the open list only tint it (no filled hover like
   .btn-outline-primary in base.css), so the action stays secondary to the connection rows. */
.sesam-net-adder {
  margin-top: 0.5rem;
  text-align: center;
}

/* The quiet outline of the card actions ("Add connection", "Edit phase durations"): a light blue frame; hover and an
   open state only tint it (no filled hover like .btn-outline-primary in base.css), so the action stays secondary to
   the content of the card. */
.sesam-net-add,
.sesam-net-action {
  --bs-btn-padding-x: 0.9rem;
  --bs-btn-padding-y: 0.2rem;
  --bs-btn-color: var(--sesam-blue);
  --bs-btn-border-color: rgba(var(--sesam-blue-rgb), 0.45);
  --bs-btn-hover-color: var(--sesam-blue);
  --bs-btn-hover-bg: rgba(var(--sesam-blue-rgb), 0.08);
  --bs-btn-hover-border-color: var(--sesam-blue);
  --bs-btn-active-color: var(--sesam-blue);
  --bs-btn-active-bg: rgba(var(--sesam-blue-rgb), 0.14);
  --bs-btn-active-border-color: var(--sesam-blue);
  --bs-btn-disabled-color: var(--sesam-gray-500);
  --bs-btn-disabled-border-color: var(--sesam-gray-400);
}

.sesam-net-add i {
  transition: transform 0.15s ease;
}

.sesam-net-add[aria-expanded="true"] {
  border-color: var(--sesam-blue);
  background: rgba(var(--sesam-blue-rgb), 0.08);
}

.sesam-net-add[aria-expanded="true"] i {
  transform: rotate(45deg);
}

.sesam-net-picker {
  margin-top: 0.5rem;
  text-align: left;
  padding: 0.3rem;
  border: 1px solid var(--sesam-card-border);
  border-radius: 0.6rem;
  box-shadow: 0 0.4rem 1.2rem rgba(19, 50, 78, 0.12);
}

.sesam-net-picker-head {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.25rem 0.5rem;
  color: var(--sesam-gray-600);
  font-size: 0.75rem;
}

/* Many targets scroll inside the list, the card column stays short. */
.sesam-net-picker-list {
  max-height: 15rem;
  overflow-y: auto;
  scrollbar-width: thin;
}

.sesam-conn-candidate {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  padding: 0.3rem 0.5rem;
  border: 0;
  border-radius: 0.45rem;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
}

/* Hover, keyboard focus and the pointer on the target in the map (.is-linked) preview the connection. */
.sesam-conn-candidate:hover,
.sesam-conn-candidate:focus-visible,
.sesam-conn-candidate.is-linked {
  background: rgba(var(--sesam-connection-rgb), 0.14);
}

.sesam-conn-candidate:focus-visible {
  outline: none;
  box-shadow: inset 3px 0 0 var(--sesam-connection);
}

/* ---- signal plan: one row per phase, the bar shows when the phase runs in the cycle */

.sesam-net-phases {
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

/* Every row is its own grid: the last column has a fixed width (wide enough for a range such as "12.5–120 s"), so
   the bars of all rows start and end at the same x. */
.sesam-net-phase {
  display: grid;
  grid-template-columns: 1.5rem minmax(0, 1fr) 5rem;
  align-items: center;
  gap: 0.75rem;
  padding: 0.3rem 0.5rem;
  border-radius: 0.5rem;
}

.sesam-net-phase:hover,
.sesam-net-phase:focus-visible,
.sesam-net-phase.is-active {
  background: rgba(var(--sesam-blue-rgb), 0.07);
  outline: none;
}

.sesam-net-phase-num {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  border: 1px solid var(--sesam-card-border);
  border-radius: 50%;
  background: var(--sesam-card-header-bg);
  color: var(--sesam-gray-700);
  font-size: 0.75rem;
  font-weight: 600;
}

.sesam-net-phase.is-active .sesam-net-phase-num {
  border-color: var(--sesam-blue);
  background: var(--sesam-blue);
  color: #fff;
}

/* The bar spans the longest cycle; <i> is the shortest length of the phase (its duration, or the minimum of a range),
   <b> the rest up to its maximum. */
.sesam-net-phase-bar {
  position: relative;
  height: 0.625rem;
  overflow: hidden;
  border-radius: 999px;
  background: var(--sesam-surface-muted);
}

.sesam-net-phase-bar > i,
.sesam-net-phase-bar > b {
  position: absolute;
  top: 0;
  bottom: 0;
}

.sesam-net-phase-bar > i,
.sesam-net-phase-nominal {
  border-radius: 999px;
  background: rgba(var(--sesam-blue-rgb), 0.55);
}

.sesam-net-phase-bar > b,
.sesam-net-phase-maximum {
  border-radius: 0 999px 999px 0;
  background: rgba(var(--sesam-blue-rgb), 0.2);
}

.sesam-net-phase.is-active .sesam-net-phase-bar > i {
  background: var(--sesam-blue);
}

.sesam-net-phase-dur {
  color: var(--sesam-heading-color);
  font-size: 0.8rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

/* "More" / "Less" below a long list, like the Builder's link below the vehicle rows. */
.sesam-net-more-row {
  text-align: right;
}

.sesam-net-more,
.sesam-net-more:visited {
  padding: 0.25rem 0.5rem;
  color: var(--sesam-blue);
  font-size: 0.8rem;
  text-decoration: none;
}

/* Hover only darkens the link, like Select all / Select none (no underline). */
.sesam-net-more:hover,
.sesam-net-more:focus-visible {
  color: var(--sesam-dark-blue);
  text-decoration: none;
}

/* An action below a list (Edit phase durations): centered, like the Builder's "Select scenario area". */
/* Centered below its list: a flex box as wide as its content, the icon beside the text. */
.sesam-net-action {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  width: fit-content;
  margin: 0.9rem auto 0;
}

.sesam-net-action > i {
  font-size: 0.75rem;
}

.sesam-net-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1rem;
  margin-top: 0.6rem;
  padding: 0 0.5rem;
  color: var(--sesam-gray-600);
  font-size: 0.75rem;
}

.sesam-net-legend span {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.sesam-net-legend i {
  display: inline-block;
  width: 1rem;
  height: 0.5rem;
}

/* ***************************************************
 * 13. SCENARIO CARDS
 *
 * The header, fact tiles, the underlined tab bar, the cards with a header band, setting rows and tables of the Scenario
 * details page (workspace/scenario.html, issue #452), also used by the Demand and Settings tabs of the Editor (#463) and
 * the result pages of the Analyzer (#505).
 * *************************************************** */

/* ---- header: icon and title, description with its pen button, a quiet meta line, actions on the right (Scenario
   details, Analyzer result pages) */

.sesam-scenario-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.sesam-scenario-header-main {
  flex: 1 1 480px;
  min-width: 0;
}

.sesam-scenario-title-row {
  display: flex;
  align-items: flex-start;
  gap: 0.875rem;
  min-width: 0;
}

.sesam-scenario-title-text {
  min-width: 0;
}

.sesam-scenario-heading {
  margin: 0.125rem 0 0;
  color: var(--sesam-heading-color);
  font-size: var(--sesam-text-title);
  font-weight: 600;
  overflow-wrap: anywhere;
}

/* Description with the pen button right after the text */
.sesam-scenario-description {
  margin: 0.25rem 0 0;
  font-size: var(--sesam-text-body);
  line-height: 1.6;
}

/* Only the text keeps the user's line breaks; on the paragraph, pre-line would also break before the pen button */
.sesam-scenario-description-text {
  white-space: pre-line;
}

.sesam-scenario-inline-button {
  padding: 0 0.3rem;
  font-size: var(--sesam-text-meta);
  line-height: 1;
  vertical-align: baseline;
  color: var(--sesam-gray-600);
  text-decoration: none;
}

.sesam-scenario-inline-button:hover {
  color: var(--sesam-blue);
}

/* Quiet meta line: project, duplicate of, version pill, created, expiry */
.sesam-scenario-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.375rem 0.875rem;
  margin: 0.5rem 0 0;
  font-size: var(--sesam-text-meta);
  color: var(--sesam-gray-600);
}

.sesam-scenario-meta i {
  margin-right: 0.2rem;
  color: var(--sesam-gray-500);
}

.sesam-scenario-meta a {
  color: inherit;
  font-weight: 600;
}

.sesam-scenario-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.sesam-scenario-actions .btn i {
  margin-right: 0.35rem;
}

.sesam-scenario-actions .sesam-workspace-icon-button-lg i {
  margin: 0;
}

/* ---- fact tiles: auto-fit grid, a value and its label each */

.sesam-scenario-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 0.75rem;
  margin: 1.25rem 0 0;
  padding: 0;
  list-style: none;
}

.sesam-scenario-tile {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  padding: 0.875rem 1rem;
  background: var(--sesam-card-bg);
  border: 1px solid var(--sesam-card-border);
  border-radius: 0.75rem;
  box-shadow: var(--sesam-shadow-soft);
}

.sesam-scenario-tile-value {
  color: var(--sesam-heading-color);
  font-size: 1.375rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* Small label with its icon above the value */
.sesam-scenario-tile-label {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: var(--sesam-text-meta);
  font-weight: 500;
  color: var(--sesam-gray-600);
  white-space: nowrap;
}

.sesam-scenario-tile-label i {
  width: 0.875rem;
  font-size: 0.75rem;
  text-align: center;
}

/* ---- tabs: underlined, in the brand blue */

.sesam-scenario-tabs .nav-tabs {
  border-bottom: 1px solid var(--sesam-card-border);
}

.sesam-scenario-tabs .nav-link {
  padding: 0.6rem 1rem;
  border: 0;
  border-bottom: 2px solid transparent;
  color: var(--sesam-gray-600);
  font-size: var(--sesam-text-body);
  font-weight: 600;
}

.sesam-scenario-tabs .nav-link:hover {
  color: var(--sesam-blue);
}

.sesam-scenario-tabs .nav-link.active {
  border-bottom-color: var(--sesam-blue);
  background: transparent;
  color: var(--sesam-blue);
}

/* ---- cards */

/* Cards of the tabs: a header band (title, optional text) above full-width content */
.sesam-scenario-card {
  padding: 0;
  overflow: hidden;
}

.sesam-scenario-card + .sesam-scenario-card {
  margin-top: 1rem;
}

.sesam-scenario-card-head,
.sesam-scenario-card > .sesam-scenario-card-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.375rem 0.75rem;
  margin: 0;
  padding: 0.75rem 1rem;
  background: var(--sesam-card-header-bg);
  border-bottom: 1px solid var(--sesam-card-border);
}

.sesam-scenario-card-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  color: var(--sesam-heading-color);
  font-size: var(--sesam-text-item);
  font-weight: 600;
}

.sesam-scenario-card-title i {
  color: var(--sesam-blue);
  font-size: 0.875rem;
}

.sesam-scenario-card-text {
  flex: 1 1 18rem;
  margin: 0;
  font-size: var(--sesam-text-meta);
  color: var(--sesam-gray-600);
}

.sesam-scenario-count {
  padding: 0.0625rem 0.5rem;
  border: 1px solid var(--sesam-card-border);
  border-radius: 999px;
  background: var(--sesam-card-header-bg);
  color: var(--sesam-gray-600);
  font-size: 0.75rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

/* ---- settings */

/* Settings: one row per option, name and help on the left, value or chips on the right */
.sesam-scenario-setting {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.25rem 0.875rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--sesam-surface-muted);
}

.sesam-scenario-setting:last-child {
  border-bottom: 0;
}

/* Setting rows inside a side card (Builder): the card body already has the side padding. */
.sesam-side-card-body .sesam-scenario-setting {
  padding: 0.625rem 0;
}

.sesam-side-card-body .sesam-scenario-setting:first-child {
  padding-top: 0;
}

/* "On" / "Off" right of a switch (static/js/switch_state.js): a fixed width keeps the switches of all rows aligned. */
.sesam-switch-state {
  min-width: 1.75rem;
  margin-bottom: 0;
  color: var(--sesam-gray-700);
  font-size: var(--sesam-text-meta);
}

/* As a <label> it would get the 0.5rem bottom margin of base.css; the help text sits right below it as under a <span>. */
.sesam-scenario-setting-label {
  display: block;
  margin-bottom: 0;
  color: var(--sesam-heading-color);
  font-size: 0.875rem;
  font-weight: 600;
}

.sesam-scenario-setting-help {
  display: block;
  margin-top: 0.125rem;
  color: var(--sesam-gray-600);
  font-size: 0.75rem;
  line-height: 1.5;
}

.sesam-scenario-setting-help code {
  color: var(--sesam-gray-500);
  font-size: 0.6875rem;
}

.sesam-scenario-setting-value {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  color: var(--sesam-heading-color);
  font-size: 0.875rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.sesam-scenario-setting-value.is-off {
  color: var(--sesam-gray-500);
  font-weight: 500;
}

/* Active / not active marks of the Settings tab */
.sesam-scenario-state {
  font-size: 1.125rem;
}

.sesam-scenario-state.is-on {
  color: var(--sesam-green);
}

.sesam-scenario-state.is-off {
  color: var(--sesam-gray-400);
}

.sesam-scenario-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.375rem;
}

/* ---- tables of the Demand and Vehicle types tabs */

.sesam-scenario-table-wrap {
  overflow-x: auto;
}

/* Data tables of the demand (Demand tab of the Editor, Scenario details page): add .sesam-data-table to a
   .sesam-scenario-table. Every row as high as one with a form control and centered on it, no wrapping (a table wider
   than its card scrolls in .sesam-scenario-table-wrap), even gaps, the column names on one line at the top with an
   optional unit below them. */
.sesam-data-table th,
.sesam-data-table td {
  padding-right: 0.75rem;
  padding-left: 0.75rem;
}

.sesam-data-table th {
  vertical-align: top;
}

.sesam-data-table td {
  height: 2.75rem;
  vertical-align: middle;
  white-space: nowrap;
}

/* the shared rules let ids and files break anywhere */
.sesam-data-table .sesam-scenario-id,
.sesam-data-table .sesam-scenario-file {
  max-width: none;
  overflow-wrap: normal;
}

/* SUMO ids (types, flows, edges) in a monospace font, like the ids of the network cards */
.sesam-data-table .sesam-scenario-id {
  font-family: var(--bs-font-monospace);
  font-size: 0.8125rem;
}

/* The unit below a column name, in normal case (the header row is uppercase). */
.sesam-data-table-unit {
  display: block;
  color: var(--sesam-gray-500);
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
}

/* Secondary information (what uses a type), in the gray of the file column. */
.sesam-data-table-secondary {
  color: var(--sesam-gray-600);
}

/* A column of icons (vehicle class, status), centered under its header; the name is a tooltip. Two classes: the
   shared header rule left-aligns the headers. */
.sesam-data-table .sesam-data-table-icon {
  text-align: center;
}

.sesam-data-table td.sesam-data-table-icon {
  color: var(--sesam-gray-500);
  font-size: 1rem;
}

/* A cell whose content may take several lines (the composition of a type distribution). */
.sesam-data-table td.sesam-data-table-multiline {
  min-width: 16rem;
  white-space: normal;
}

/* Pager below a long table (table_pager.js): inside the card, so it gets the padding of the card content instead of
   the top margin of the Workspace pager. */
.sesam-scenario-pager {
  margin: 0;
  padding: 0.625rem 1rem;
  border-top: 1px solid var(--sesam-card-border);
}

/* Tools column on the right of a card head (table_pager.js puts the search first, the template's switches follow
   below it): title and description on the left, the tools spanning both lines on the right. Phones stack them. */
.sesam-scenario-card-head:has(> .sesam-scenario-card-tools) {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  column-gap: 1.5rem;
  align-items: start;
}

.sesam-scenario-card-head:has(> .sesam-scenario-card-tools) > :not(.sesam-scenario-card-tools) {
  grid-column: 1;
}

.sesam-scenario-card-tools {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.5rem;
  grid-column: 2;
  grid-row: 1 / span 2;
}

.sesam-scenario-card-tools > .sesam-scenario-table-search {
  flex: none;
  width: 16rem;
}

.sesam-scenario-card-tools > .form-switch {
  margin: 0;
  font-size: var(--sesam-text-body);
}

@media (max-width: 575.98px) {
  .sesam-scenario-card-head:has(> .sesam-scenario-card-tools) {
    grid-template-columns: minmax(0, 1fr);
    row-gap: 0.5rem;
  }

  .sesam-scenario-card-tools {
    grid-column: 1;
    grid-row: auto;
    align-items: stretch;
  }

  .sesam-scenario-card-tools > .sesam-scenario-table-search {
    width: 100%;
  }
}

/* Tool row between the card head and a table (table_pager.js): the search field on the left, switches of the
   template (e.g. "Show unused defaults") on the right. */
.sesam-scenario-table-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  padding: 0.625rem 1rem;
  border-bottom: 1px solid var(--sesam-card-border);
}

/* Switches in the size of the search field and the table text, not the larger Bootstrap default. */
.sesam-scenario-table-tools > .form-switch {
  margin: 0 0 0 auto;
  font-size: var(--sesam-text-body);
}

/* The magnifier sits inside the field, on its left. */
.sesam-scenario-table-search {
  position: relative;
  flex: 0 1 16rem;
}

.sesam-scenario-table-search > i {
  position: absolute;
  top: 50%;
  left: 0.625rem;
  transform: translateY(-50%);
  color: var(--sesam-gray-500);
  font-size: 0.75rem;
  pointer-events: none;
}

.sesam-scenario-table-search > .form-control {
  padding-left: 1.875rem;
}

@media (max-width: 575.98px) {
  .sesam-scenario-table-search {
    flex-basis: 100%;
  }
}

/* In place of a table whose search matches nothing: a centered message with "Clear search". */
.sesam-scenario-table-empty {
  padding: 2rem 1rem;
  text-align: center;
}

.sesam-scenario-table-empty-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  margin-bottom: 0.625rem;
  border-radius: 50%;
  background: var(--sesam-surface-muted);
  color: var(--sesam-gray-600);
}

.sesam-scenario-table-empty-title {
  margin: 0;
  color: var(--sesam-heading-color);
  font-weight: 600;
}

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

/* Help icon in a column header (_th_info.html): a borderless button that opens a popover */
.sesam-scenario-th-info {
  padding: 0 0.125rem;
  border: 0;
  background: none;
  color: var(--sesam-gray-500);
  font-size: 0.8125rem;
  line-height: 1;
  vertical-align: baseline;
  cursor: help;
}

.sesam-scenario-th-info:hover,
.sesam-scenario-th-info:focus-visible {
  color: var(--sesam-blue);
}

/* Explanation inside a column header, e.g. "Type (vehicle class)": lighter than the header text itself */
.sesam-scenario-th-note {
  font-weight: 400;
  color: var(--sesam-gray-500);
}

.sesam-scenario-table {
  width: 100%;
  border-collapse: collapse;
  color: var(--sesam-heading-color);
  font-size: var(--sesam-text-body);
  font-variant-numeric: tabular-nums;
}

/* Header typography: see the shared rule next to .sesam-workspace-table th */
.sesam-scenario-table th {
  padding: 0.4rem 0.625rem;
}

.sesam-scenario-table td {
  padding: 0.5rem 0.625rem;
  border-bottom: 1px solid var(--sesam-surface-muted);
  vertical-align: top;
}

/* is-last-visible: the last row of the current page of a paginated table (table_pager.js) */
.sesam-scenario-table tbody tr:last-child td,
.sesam-scenario-table tbody tr.is-last-visible td {
  border-bottom: 0;
}

/* Two classes: the shared header rule (.sesam-scenario-table th) would otherwise left-align the number headers */
.sesam-scenario-table .sesam-scenario-col-num {
  text-align: right;
  white-space: nowrap;
}

.sesam-scenario-id {
  overflow-wrap: anywhere;
}

.sesam-scenario-file {
  max-width: 16rem;
  overflow-wrap: anywhere;
  color: var(--sesam-gray-600);
  font-size: var(--sesam-text-meta);
}

/* Type distribution: a stacked bar and one neutral pill per member; the colors cycle through six hues */
.sesam-scenario-bar {
  display: flex;
  width: 100%;
  max-width: 320px;
  height: 0.5rem;
  margin: 0.2rem 0 0.5rem;
  overflow: hidden;
  border-radius: 999px;
  background: var(--sesam-surface-muted);
}

.sesam-scenario-bar-segment {
  display: block;
  height: 100%;
}

.sesam-scenario-members {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
}

.sesam-scenario-member-dot {
  display: inline-block;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
}

.sesam-scenario-bar-0, .sesam-scenario-member-0 .sesam-scenario-member-dot { background: var(--sesam-blue); }
.sesam-scenario-bar-1, .sesam-scenario-member-1 .sesam-scenario-member-dot { background: var(--sesam-green); }
.sesam-scenario-bar-2, .sesam-scenario-member-2 .sesam-scenario-member-dot { background: var(--sesam-yellow); }
.sesam-scenario-bar-3, .sesam-scenario-member-3 .sesam-scenario-member-dot { background: var(--sesam-red); }
.sesam-scenario-bar-4, .sesam-scenario-member-4 .sesam-scenario-member-dot { background: var(--sesam-gray-600); }
.sesam-scenario-bar-5, .sesam-scenario-member-5 .sesam-scenario-member-dot { background: var(--sesam-gray-400); }

/* ---- status icons and swatches, empty and footnote texts */

.sesam-scenario-status-icon {
  margin-right: 0.3rem;
}

.sesam-scenario-status-icon.is-ok,
.sesam-scenario-status-icon.is-open,
.sesam-scenario-status-icon.is-signalized {
  color: var(--sesam-green);
}

.sesam-scenario-status-icon.is-warn {
  color: var(--sesam-yellow);
}

.sesam-scenario-status-icon.is-bad,
.sesam-scenario-status-icon.is-closed {
  color: var(--sesam-red-strong);
}

.sesam-scenario-status-icon.is-off {
  color: var(--sesam-gray-500);
}

.sesam-scenario-swatch {
  display: inline-block;
  width: 0.75rem;
  height: 0.75rem;
  margin-right: 0.4rem;
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: 0.2rem;
  vertical-align: -0.1rem;
}

.sesam-scenario-empty,
.sesam-scenario-footnote {
  margin: 0.75rem 0 0;
  font-size: var(--sesam-text-body);
  color: var(--sesam-gray-600);
}

/* ------------------------------------------------------------------ numbered step cards */

/* A step of a two-step choice (Analyzer start page, issue #504: 1 Baseline, 2 Variant): a card whose head has a side
   panel with a large number on an accent strip, built like the failure card of a task (.sesam-async-task-failure-side),
   then a badge, the title and an optional line and action. `--sesam-step-color(-rgb)` sets the colour (SESAM blue by
   default); `.is-pending` shows a step that comes later, faded. The body holds the step's content. */
.sesam-step-card {
  --sesam-step-color: var(--sesam-blue);
  --sesam-step-color-rgb: var(--sesam-blue-rgb);
  overflow: hidden;
  background: var(--sesam-card-bg);
  border: 1px solid var(--sesam-step-color);
  border-radius: 0.875rem;
}

.sesam-step-card + .sesam-step-card {
  margin-top: 1.25rem;
}

/* Positioned, so the stretched link of a done step (Change) makes the whole head clickable */
.sesam-step-card-head {
  position: relative;
  display: flex;
}

.sesam-step-card-head:not(:last-child) {
  border-bottom: 1px solid rgba(var(--sesam-step-color-rgb), 0.25);
}

/* The accent strip is an inset shadow (not border-left), so it follows the rounded corner */
.sesam-step-card-side {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  padding: 0.875rem 1rem 0.875rem 1.3rem;
  background: rgba(var(--sesam-step-color-rgb), 0.08);
  border-right: 1px solid rgba(var(--sesam-step-color-rgb), 0.25);
  box-shadow: inset 5px 0 0 var(--sesam-step-color);
}

.sesam-step-card-number {
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  background: var(--sesam-step-color);
  color: var(--bs-white);
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1;
}

.sesam-step-card-main {
  display: flex;
  flex: 1 1 auto;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  min-width: 0;
  padding: 0.75rem 1.5rem 0.75rem 1rem;
}

.sesam-step-card-text {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
}

/* The badge names the role of the step, like the badges of the comparison page */
.sesam-step-card-badge {
  align-self: flex-start;
  padding: 0.3rem 0.55rem;
  border-radius: 0.375rem;
  background: var(--sesam-step-color);
  color: var(--bs-white);
  font-size: 0.8125rem;
  font-weight: 700;
  line-height: 1;
}

.sesam-step-card-title {
  color: var(--sesam-heading-color);
  font-weight: 600;
}

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

/* In the body size: a quiet action beside the title, not a second title */
.sesam-step-card-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: var(--sesam-text-body);
  white-space: nowrap;
}

.sesam-step-card-body {
  padding: 1.25rem 1.5rem 1.5rem;
}

.sesam-step-card.is-pending {
  border-color: var(--sesam-card-border);
  opacity: 0.6;
}

.sesam-step-card.is-pending .sesam-step-card-title {
  color: var(--sesam-gray-600);
}

/* On a phone the side panel and its number shrink, so the title and the search keep the width */
@media (max-width: 575.98px) {
  .sesam-step-card-side {
    padding: 0.75rem 0.625rem 0.75rem 0.9rem;
  }

  .sesam-step-card-number {
    width: 2.25rem;
    height: 2.25rem;
    font-size: 1.125rem;
  }

  .sesam-step-card-main {
    padding: 0.75rem;
  }

  .sesam-step-card-body {
    padding: 1rem 0.75rem;
  }
}

/* ------------------------------------------------------------------ download dialog */

/* The dialog "Download Outputs" (templates/fragments/download_outputs_dialog.html, issue #527) of the run and
   simulation ZIPs: the Analyzer result pages, the Workspace scenario page and the Simulator status page. Airy: wide
   paddings and gaps, the file lists side by side. */
.sesam-download-dialog {
  max-width: 41.25rem;
}

.sesam-download-modal .modal-content {
  overflow: hidden;
}

.sesam-download-header {
  gap: 1rem;
  padding: 1.25rem 1.75rem;
}

/* Title and subtitle on one baseline; the subtitle (a user-supplied name) ends in "…" instead of wrapping */
.sesam-download-title-row {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  min-width: 0;
}

.sesam-download-title-row .modal-title {
  color: var(--sesam-heading-color);
  font-size: var(--sesam-text-section);
  font-weight: 600;
  white-space: nowrap;
}

.sesam-download-subtitle {
  min-width: 0;
  color: var(--sesam-gray-600);
  font-size: var(--sesam-text-meta);
}

.sesam-download-body {
  padding: 1.5rem 1.75rem 1.75rem;
  font-size: var(--sesam-text-body);
}

.sesam-download-content {
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

/* `hidden` must win over the flex layout above */
.sesam-download-content[hidden] {
  display: none;
}

.sesam-download-loading {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  color: var(--sesam-gray-600);
}

.sesam-download-loading[hidden] {
  display: none;
}

.sesam-download-group {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

/* Section titles with a rule below; Bootstrap's legend floats and is large, so both are reset */
.sesam-download-legend {
  float: none;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  width: 100%;
  margin-bottom: 0.5rem;
  padding: 0 0 0.375rem;
  border-bottom: 1px solid var(--sesam-card-border);
  color: var(--sesam-heading-color);
  font-size: 0.8125rem;
  font-weight: 600;
}

.sesam-download-format {
  color: var(--sesam-gray-500);
  font-family: var(--bs-font-monospace);
  font-size: 0.75rem;
  font-weight: 400;
}

.sesam-download-muted {
  color: var(--sesam-gray-500);
}

/* Runs: All (n) · Selected [1-5, 12] · 6 runs in one row; wraps on a phone */
.sesam-download-runs-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
  min-height: 2.75rem;
  padding: 0 0.5rem;
  color: var(--sesam-heading-color);
}

.sesam-download-runs-choice {
  margin-bottom: 0;
  white-space: nowrap;
}

.sesam-download-runs-input {
  flex: 1 1 8rem;
  min-width: 0;
  color: var(--sesam-heading-color);
}

.sesam-download-runs-summary {
  min-width: 3.25rem;
  color: var(--sesam-gray-500);
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.sesam-download-runs-error {
  margin: 0.25rem 0 0 0.5rem;
  color: var(--sesam-red-strong);
  font-size: 0.8125rem;
}

/* SUMO Outputs | Tables side by side, stacked on a phone */
.sesam-download-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.75rem 2rem;
}

@media (max-width: 575.98px) {
  .sesam-download-columns {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* One file: the whole row toggles the checkbox; the help button sits outside the label */
.sesam-download-file {
  display: flex;
  align-items: center;
  gap: 2px;
}

.sesam-download-file[hidden] {
  display: none;
}

.sesam-download-file-label {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  gap: 0.625rem;
  min-width: 0;
  min-height: 2.5rem;
  padding: 0 0.5rem;
  border-radius: 0.375rem;
  color: var(--sesam-heading-color);
  cursor: pointer;
}

.sesam-download-file-label:hover {
  background: var(--sesam-surface-muted);
}

.sesam-download-file-label .form-check-input {
  flex: none;
  margin: 0;
}

/* An unticked file is gray, so the chosen ones stand out ("Off states" in the design guidelines) */
.sesam-download-file-label:has(.form-check-input:not(:checked)) {
  color: var(--sesam-gray-500);
}

/* A file that none of the chosen runs has */
.sesam-download-file.is-disabled .sesam-download-file-label {
  color: var(--sesam-gray-400);
  cursor: not-allowed;
}

.sesam-download-file.is-disabled .sesam-download-file-label:hover {
  background: none;
}

.sesam-download-file-name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sesam-download-file-size,
.sesam-download-fcd-size {
  color: var(--sesam-gray-500);
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.sesam-download-file-info {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 1.625rem;
  height: 1.625rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--sesam-gray-500);
  font-size: 0.875rem;
  cursor: help;
}

.sesam-download-file-info:hover,
.sesam-download-file-info:focus-visible {
  color: var(--sesam-blue);
}

.sesam-download-help {
  margin: 0 0 0.5rem;
  color: var(--sesam-gray-600);
  font-size: 0.8125rem;
}

/* The FCD periods as equal segments with the size below the name (.sesam-segmented tints the chosen one): three, or
   four with "Every step" for step lengths below 1 s. The radios are positioned absolutely and take no grid cell. */
.sesam-download-fcd {
  display: grid;
  grid-auto-columns: minmax(0, 1fr);
  grid-auto-flow: column;
  width: 100%;
}

/* `hidden` must win over the flex layout of the segments below */
.sesam-download-fcd > .btn[hidden] {
  display: none;
}

.sesam-download-fcd > .btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 3.5rem;
  /* Two lines of text on the button: a light hover instead of the dark fill of .btn-outline-secondary, so the gray
     size stays legible */
  --bs-btn-color: var(--sesam-heading-color);
  --bs-btn-hover-color: var(--sesam-heading-color);
  --bs-btn-hover-bg: var(--sesam-surface-muted);
  --bs-btn-hover-border-color: var(--bs-btn-border-color);
}

.sesam-download-fcd-label {
  font-weight: 500;
}

.sesam-download-limit {
  align-items: center;
}

/* Counts left, Cancel and Download right; wraps on a phone */
.sesam-download-footer {
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1.125rem 1.75rem;
}

.sesam-download-footer > * {
  margin: 0;
}

.sesam-download-summary {
  color: var(--sesam-heading-color);
  font-size: 0.875rem;
}

.sesam-download-summary strong {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.sesam-download-actions {
  display: flex;
  gap: 0.5rem;
  margin-left: auto;
}

@media (max-width: 575.98px) {
  .sesam-download-header,
  .sesam-download-body,
  .sesam-download-footer {
    padding-right: 1rem;
    padding-left: 1rem;
  }
}

/* ***************************************************
 * 14. SIGNAL PLAN MODAL
 *
 * The modal of templates/fragments/network_cards/signal_plan_modal.html (static/js/network_cards/
 * signal_plan_modal.js): edited in the Editor, read-only in the Analyzer. Cycle bar on top, the phase table on the
 * left, the preview of the selected phase on the right.
 * *************************************************** */

.sesam-tls-modal-header {
  align-items: flex-start;
  gap: 0.875rem;
}

.sesam-tls-modal-icon {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 0.6rem;
  background: rgba(var(--sesam-blue-rgb), 0.08);
  color: var(--sesam-blue);
}

/* The long SUMO ids give way (ellipsis), the chips keep their width. */
.sesam-tls-modal-heading {
  flex: 1 1 auto;
  min-width: 0;
}

.sesam-tls-modal-ids {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.1rem;
  margin-top: 0.2rem;
  color: var(--sesam-gray-600);
  font-size: var(--sesam-text-meta);
}

.sesam-tls-modal-ids > span {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-width: 0;
  max-width: 100%;
}

.sesam-tls-chips {
  display: flex;
  flex: none;
  flex-wrap: nowrap;
  justify-content: flex-end;
  gap: 0.4rem;
  align-self: center;
}

.sesam-tls-chip {
  padding: 0.15rem 0.6rem;
  border: 1px solid var(--sesam-card-border);
  border-radius: 999px;
  background: var(--sesam-card-header-bg);
  color: var(--sesam-gray-700);
  font-size: 0.75rem;
  white-space: nowrap;
}

.sesam-tls-chip b {
  color: var(--sesam-heading-color);
  font-weight: 600;
}

.sesam-tls-chip.is-changed {
  border-color: rgba(var(--sesam-blue-rgb), 0.35);
  background: rgba(var(--sesam-blue-rgb), 0.08);
}

.sesam-tls-modal-body {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.sesam-tls-cycle h6,
.sesam-tls-preview-head h6 {
  margin: 0 0 0.5rem;
  color: var(--sesam-gray-700);
  font-size: var(--sesam-text-meta);
  font-weight: 600;
}

.sesam-tls-cycle small {
  color: var(--sesam-gray-600);
  font-weight: 400;
}

/* One segment per phase in the room of its longest length (signal_plan_modal.js). */
.sesam-tls-cycle-bar {
  position: relative;
  height: 1.875rem;
  overflow: hidden;
  border-radius: 0.45rem;
  background: var(--sesam-surface-muted);
}

.sesam-tls-segment {
  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), 0.45);
  color: var(--bs-white);
  font-size: 0.75rem;
  font-weight: 600;
}

.sesam-tls-segment:hover,
.sesam-tls-segment:focus-visible {
  background: rgba(var(--sesam-blue-rgb), 0.7);
  outline: none;
}

.sesam-tls-segment.is-selected {
  background: var(--sesam-blue);
}

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

.sesam-tls-segment.is-range:hover,
.sesam-tls-segment.is-range:focus-visible {
  --sesam-tls-segment-alpha: 0.7;
}

/* Read-only (Analyzer): the moment of the replay in the phase that runs then, a line across the bar (which clips) */
.sesam-tls-now {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  margin-left: -1px;
  border-radius: 1px;
  background: var(--sesam-heading-color);
  pointer-events: none;
}

.sesam-tls-segment.is-range.is-selected {
  --sesam-tls-segment-alpha: 1;
}

.sesam-tls-cycle-ticks {
  position: relative;
  height: 1rem;
  margin-top: 0.2rem;
  color: var(--sesam-gray-600);
  font-size: 0.7rem;
}

.sesam-tls-cycle-ticks span {
  position: absolute;
  transform: translateX(-50%);
  white-space: nowrap;
}

.sesam-tls-cycle-ticks span:first-child {
  transform: none;
}

/* The table takes the width of its columns, the preview the rest. */
.sesam-tls-split {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 1.5rem;
  align-items: start;
}

.sesam-tls-table {
  overflow: hidden;
  border: 1px solid var(--sesam-card-border);
  border-radius: 0.75rem;
}

/* --sesam-tls-fields is the number of timing columns (1: Duration; 3: Duration, Min and Max Duration), set on the
   table by signal_plan_modal.js. */
.sesam-tls-row {
  display: grid;
  grid-template-columns: 2.5rem repeat(var(--sesam-tls-fields, 1), 7rem) 4.5rem;
  align-items: center;
  column-gap: 0.75rem;
  row-gap: 0.15rem;
  padding: 0.45rem 1rem;
  border-bottom: 1px solid var(--sesam-surface-muted);
  cursor: pointer;
}

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

.sesam-tls-row:hover {
  background: var(--sesam-card-header-bg);
}

.sesam-tls-row.is-selected {
  background: rgba(var(--sesam-blue-rgb), 0.05);
  box-shadow: inset 3px 0 0 var(--sesam-blue);
}

.sesam-tls-row.has-error {
  background: var(--sesam-danger-bg);
  box-shadow: inset 3px 0 0 var(--bs-form-invalid-border-color);
}

.sesam-tls-head {
  padding-top: 0.55rem;
  padding-bottom: 0.55rem;
  background: var(--sesam-card-header-bg);
  color: var(--sesam-gray-600);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: default;
}

.sesam-tls-head > :last-child,
.sesam-tls-share {
  text-align: right;
}

/* Read-only (Analyzer): a timing as text, centred in its column like the dash of a field the phase does not have */
.sesam-tls-value {
  color: var(--sesam-value-color);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.sesam-tls-num {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.6rem;
  height: 1.6rem;
  border: 1px solid var(--sesam-card-border);
  border-radius: 50%;
  background: var(--sesam-card-header-bg);
  color: var(--sesam-gray-700);
  font-size: 0.75rem;
  font-weight: 600;
}

.sesam-tls-row.is-selected .sesam-tls-num {
  border-color: var(--sesam-blue);
  background: var(--sesam-blue);
  color: var(--bs-white);
}

.sesam-tls-input .form-control {
  text-align: right;
}

/* The cell of a field that the phase does not have (the other form) */
.sesam-tls-empty::before {
  content: "–";
  display: block;
  color: var(--sesam-gray-500);
  text-align: center;
}

.sesam-tls-share {
  display: flex;
  flex-direction: column;
  color: var(--sesam-heading-color);
  font-size: var(--sesam-text-body);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.sesam-tls-row-error {
  grid-column: 2 / -1;
  color: var(--bs-form-invalid-color);
  font-size: 0.75rem;
}

/* Long programs scroll the dialog: the preview of the selected phase stays in view. */
.sesam-tls-preview-pane {
  position: sticky;
  top: 0;
}

.sesam-tls-preview-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.sesam-tls-preview-head span,
.sesam-tls-hint {
  color: var(--sesam-gray-600);
  font-size: 0.75rem;
}

.sesam-tls-preview {
  height: 20rem;
  padding: 0.5rem;
  overflow: hidden;
  border: 1px solid var(--sesam-card-border);
  border-radius: 0.75rem;
  background: var(--sesam-card-header-bg);
}

.sesam-tls-preview-empty {
  margin: 0;
  padding-top: 8rem;
  color: var(--sesam-gray-600);
  text-align: center;
}

.sesam-tls-preview-below {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.5rem 1.5rem;
  margin-top: 0.75rem;
}

.sesam-tls-facts {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.3rem 0.9rem;
  margin: 0;
  font-size: var(--sesam-text-meta);
}

.sesam-tls-facts dt {
  color: var(--sesam-gray-600);
  font-weight: 400;
}

.sesam-tls-facts dd {
  margin: 0;
  color: var(--sesam-heading-color);
  font-weight: 500;
}

.sesam-tls-legend {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  color: var(--sesam-gray-600);
  font-size: 0.75rem;
}

.sesam-tls-legend span {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

/* Swatches in the signal colors of the map (set from SIGNAL_STATE_COLORS by signal_plan_modal.js). */
.sesam-tls-legend i {
  display: inline-block;
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 2px;
}

.sesam-tls-hint {
  margin: 0.6rem 0 0;
}

.sesam-tls-error {
  margin-right: auto;
  color: var(--bs-form-invalid-color);
  font-size: var(--sesam-text-body);
}

/* The junction preview (signal_plan_preview.js) */
.sesam-tls-junction-svg {
  display: block;
  width: 100%;
  height: 100%;
}

.sesam-tls-junction-svg__lane {
  fill: var(--bs-gray-300);
  stroke: var(--bs-gray-500);
  stroke-width: 0.75;
  fill-rule: evenodd;
}

.sesam-tls-junction-svg__junction {
  fill: var(--bs-gray-200);
  stroke: var(--bs-gray-500);
  stroke-width: 1;
  fill-rule: evenodd;
}

/* Signalised pedestrian crossings (#475): the crossing area in the colour of its signal, set per phase through the
   fill attribute (signal_plan_preview.js); translucent, so the connections above stay the main element. */
.sesam-tls-junction-svg__crossing {
  fill-opacity: 0.55;
  stroke: var(--bs-gray-500);
  stroke-width: 0.5;
}

.sesam-tls-junction-svg__connection-casing,
.sesam-tls-junction-svg__connection {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sesam-tls-junction-svg__connection-casing {
  stroke: var(--sesam-card-bg, var(--bs-body-bg));
  stroke-width: 7;
}

.sesam-tls-junction-svg__connection {
  stroke-width: 4;
}

/* Unsaved signalized connections have geometry but no authoritative SUMO link index/state until netconvert
   processes the staged topology. */
.sesam-tls-junction-svg__connection--pending {
  stroke: var(--bs-secondary-color);
  stroke-dasharray: 7 5;
}

/* The head has the white edge of the line casing (drawn below the fill), so it stands out from the lines it crosses.
   The stroke goes below the fill through the SVG attribute paint-order="stroke" (signal_plan_preview.js): the W3C CSS
   validator does not know the paint-order property. */
.sesam-tls-junction-svg__arrow {
  stroke: var(--sesam-card-bg, var(--bs-body-bg));
  stroke-width: 1.5;
  stroke-linejoin: round;
}

.sesam-tls-junction-svg__arrow--pending {
  fill: var(--bs-secondary-color);
}

/* Narrow dialogs: the preview above the table. */
@media (max-width: 991.98px) {
  .sesam-tls-split {
    grid-template-columns: 1fr;
  }

  .sesam-tls-preview-pane {
    order: -1;
  }

  .sesam-tls-preview {
    height: 14rem;
  }

  .sesam-tls-table {
    overflow-x: auto;
  }

  .sesam-tls-chips {
    flex: 1 1 100%;
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .sesam-tls-preview-pane {
    position: static;
  }

  .sesam-tls-modal-header {
    flex-wrap: wrap;
  }
}
