/* ============================================================
   Varial Layout — structural shell (sidebar + content)
   Loaded after bootstrap.min.css. Replaces Falcon's layout layer.
   No !important. No Falcon dependency. Zero dead code.
   ============================================================ */

/* ── 1. Sidebar toggle button sizing ────────────────────────────────────
   Used by the sidebar header toggle (sidebar.html .navbar-vertical-toggle).
   ─────────────────────────────────────────────────────────────────────── */
.navbar-toggler-humburger-icon {
  padding: 0.25rem 0.5rem;
  line-height: 1;
  /* Guarantee a 44x44 tap target — this is the only nav control on mobile
     (sidebar-only nav, #3188). Icon stays centred at its intrinsic size. */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
}

/* ── 2. Avatar ──────────────────────────────────────────────────────────
   Falcon's .avatar / .avatar-xl / .avatar-name. Replaced with 6 rules.
   ─────────────────────────────────────────────────────────────────────── */
.avatar {
  position: relative;
  display: inline-block;
  width: 2rem;
  height: 2rem;
}
.avatar-xl {
  width: 2rem;
  height: 2rem;
}
.avatar-name {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background-color: var(--varial-primary, #1B3AA0);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Unverified-email notification dot — sits top-right of the sidebar avatar */
.avatar-verification-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 8px;
  height: 8px;
  background-color: var(--bs-danger);
  border-radius: 50%;
  border: 1.5px solid #fff;
  display: block;
}

/* The badge tooltip renders over the account summary; let the click through to it. */
.vrl-account-badge-tip {
  pointer-events: none;
}

/* ── 3b. Sidebar header strip (brand + toggle) ──────────────────────────
   Replaces .d-flex.align-items-center — owning the class avoids fighting
   Bootstrap's d-flex !important. Visible at every breakpoint: it owns the
   sidebar toggle (burger at <1200px, pin/favicon at desktop).
   ─────────────────────────────────────────────────────────────────────── */
.navbar-vertical-header {
  display: flex;
  align-items: center;
  /* Fixed height so the nav content starts at the same Y in all three states.
     Derived from: brand SVG height (34px) + Bootstrap .navbar-brand padding-y
     (0.3125rem × 2 = ~10px) = ~44px. Use 2.875rem (46px) for a tiny margin. */
  min-height: 2.875rem;
  flex-shrink: 0;
}

/* ── 4. Sidebar structure ───────────────────────────────────────────────
   At desktop (≥1200px): fixed left edge, full height, scrollable nav content.
   At tablet (<1200px): Bootstrap's navbar-expand-xl collapse mechanism handles
   it as a stacked dropdown — no positioning needed.
   ─────────────────────────────────────────────────────────────────────── */
@media (min-width: 1200px) {
  .navbar-vertical {
    position: fixed;
    top: var(--vrl-sidebar-gap, 0.75rem);
    left: var(--vrl-sidebar-gap, 0.75rem);
    bottom: var(--vrl-sidebar-gap, 0.75rem);
    height: calc(100vh - (var(--vrl-sidebar-gap, 0.75rem) * 2));
    width: var(--vrl-sidebar-w, 12.625rem);
    /* Above every in-page fixed/sticky layer (results nav 1020, wizard chrome
       1030, the chart hover panel 1040 — chart-hover.css) so the sidebar is
       never occluded by page content; still below real modal overlays
       (Bootstrap modals/tooltips, chat widget, quick-add modal — all >=1050),
       which should cover it like everything else. */
    z-index: 1045;
    display: flex;
    flex-direction: column;
    align-items: stretch; /* Bootstrap .navbar-expand-xl sets center — override so .navbar-collapse fills full sidebar width */
    overflow: hidden;
    border-radius: var(--varial-radius-lg, 0.75rem);
    transition: width 0.2s ease;
    /* Sidebar carries role="button" for the tablet/mobile whole-navbar tap
       target. At desktop the click/keyboard handlers are no-ops, so the
       generic `[role="button"] { cursor: pointer }` rule from base styles
       would be misleading — reset to default arrow. */
    cursor: auto;
  }

  /* At desktop, Bootstrap's .navbar-expand-xl already sets
     .navbar-collapse { display: flex !important }. The nav content
     should fill remaining height and scroll. Bootstrap also sets
     align-items: center on the navbar — override to stretch so
     .navbar-vertical-content (SimpleBar) fills the full sidebar width. */
  .navbar-vertical .navbar-collapse {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: stretch;
  }
}

/* Sidebar inner scroll container (SimpleBar target) */
.navbar-vertical-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}

/* ── 5. Content area ────────────────────────────────────────────────────
   Offset left to clear the fixed sidebar at desktop.
   ─────────────────────────────────────────────────────────────────────── */
/* base_app.html wraps {% block app_nav %} in this <nav> unconditionally, even
   on pages that leave it empty (e.g. the platform page's own page-hero
   fills that role) — :not(:empty) means only pages that actually put
   content in app_nav (breadcrumbs etc.) get the spacing below it. */
.app-nav:not(:empty) {
  margin-bottom: 1rem;
}

.content {
  min-height: 100vh;
  transition: margin-left 0.2s ease;
  display: flex;
  flex-direction: column;
}

/* Cap content width and own horizontal padding so it doesn't stretch on
   ultra-wide screens and so padding is adjustable in one place.
   The direct-child selector avoids affecting any nested container-fluids.
   Edit --vrl-content-px to change the side padding app-wide. */
.content > .container-fluid {
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--vrl-content-px, 0.75rem);
  padding-right: var(--vrl-content-px, 0.75rem);
}

/* Main content block grows to fill remaining height, pushing footer down.
   py-3 distinguishes the app-content wrapper from the footer's container-fluid,
   avoiding :first-of-type which breaks when impersonation banners appear first. */
.content > .container-fluid.py-3 {
  flex: 1;
}

@media (min-width: 1200px) {
  .content {
    margin-left: calc(var(--vrl-sidebar-w, 12.625rem) + (var(--vrl-sidebar-gap, 0.75rem) * 2));
  }

  /* When the sidebar block is suppressed (public/marketing pages), no
     .navbar-vertical exists — reset the offset so content is not shifted. */
  body:not(:has(.navbar-vertical)) .content {
    margin-left: 0;
  }
}

/* ── 7. Collapsed state (desktop only) ──────────────────────────────────
   html.navbar-vertical-collapsed is now the PERMANENT desktop resting
   state (set unconditionally in layout.js — there's no more toggle button
   at this breakpoint, see .navbar-vertical-toggle in branding.css). The
   sidebar narrows to an icon-rail; hovering it temporarily widens it back
   out as an overlay (below) without shifting .content, which stays sized
   for the narrow rail throughout.
   ─────────────────────────────────────────────────────────────────────── */
@media (min-width: 1200px) {
  .navbar-vertical-collapsed .navbar-vertical {
    width: var(--vrl-sidebar-collapsed, 3.125rem);
  }
  .navbar-vertical-collapsed .content {
    margin-left: calc(var(--vrl-sidebar-collapsed, 3.125rem) + (var(--vrl-sidebar-gap, 0.75rem) * 2));
  }

  /* Hide nav labels and section headings in icon-rail (collapsed) state.
     Sidebar is overflow:hidden so they're visually clipped, but we also set
     visibility:hidden so Playwright / screen-readers treat them as hidden. */
  .navbar-vertical-collapsed .navbar-vertical .nav-link-text,
  .navbar-vertical-collapsed .navbar-vertical .navbar-vertical-label,
  .navbar-vertical-collapsed .navbar-vertical .sidebar-footer-label,
  .navbar-vertical-collapsed .navbar-vertical .nav-side-pill {
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s ease, visibility 0.15s ease;
  }

  /* Unlike the labels above, .nav-side-pill is a flex:0 0 auto sibling in
     .nav-link-split-row (e.g. Book beside Value-it, Revert beside Price-it),
     not a block element — opacity/visibility alone left its full
     padded+bordered box reserved in the flex layout, pushing the row (and
     the active-state background painted on it) wider than the collapsed
     rail and out past its rounded edge. Zero its box too, restoring it only
     on hover-expand below. */
  .navbar-vertical-collapsed .navbar-vertical .nav-side-pill {
    width: 0;
    min-width: 0;
    margin: 0;
    padding: 0;
    border-width: 0;
    overflow: hidden;
  }

  /* Both label types keep IDENTICAL padding/height in collapsed and
     hover-expanded states — only their text opacity/visibility toggles
     (rule above). Previously hover grew these paddings back to the
     original expanded-sidebar values (e.g. navbar-vertical-label's
     padding-top: 0.375rem -> 1.75rem), which pushed every icon below a
     label down by 26-52px between collapsed and hover: icons no longer
     lined up with their collapsed position, and different sections drifted
     by different amounts depending on how many labels sat above them. */
  .navbar-vertical-collapsed .navbar-vertical .navbar-vertical-label {
    padding-top: 0.375rem;
    padding-bottom: 0;
  }
  .navbar-vertical-collapsed .navbar-vertical .sidebar-footer-label {
    height: auto;
    padding-top: 0.4rem;
    padding-bottom: 0.15rem;
    overflow: visible;
  }

  /* ── Hover-expand: widen the rail back out on :hover, restoring the
     labels/padding the rules above hid. .content's margin is untouched —
     this is a pure overlay (the sidebar is already position:fixed), so
     nothing else on the page reflows while it's open. The rail also stays
     wide while the account menu is open, as the Varial X rail does, so the
     menu does not depend on the pointer staying over the rail. ── */
  .navbar-vertical-collapsed .navbar-vertical:hover,
  .navbar-vertical-collapsed .navbar-vertical:has(.vrl-account[open]) {
    width: var(--vrl-sidebar-w, 12.625rem);
  }
  .navbar-vertical-collapsed .navbar-vertical:hover .nav-link-text,
  .navbar-vertical-collapsed .navbar-vertical:has(.vrl-account[open]) .nav-link-text,
  .navbar-vertical-collapsed .navbar-vertical:hover .navbar-vertical-label,
  .navbar-vertical-collapsed .navbar-vertical:has(.vrl-account[open]) .navbar-vertical-label,
  .navbar-vertical-collapsed .navbar-vertical:hover .sidebar-footer-label,
  .navbar-vertical-collapsed .navbar-vertical:has(.vrl-account[open]) .sidebar-footer-label,
  .navbar-vertical-collapsed .navbar-vertical:hover .nav-side-pill,
  .navbar-vertical-collapsed .navbar-vertical:has(.vrl-account[open]) .nav-side-pill {
    opacity: 1;
    visibility: visible;
  }
  .navbar-vertical-collapsed .navbar-vertical .vrl-nav-pages { display: none; }
  .navbar-vertical-collapsed .navbar-vertical:hover .vrl-nav-pages,
  .navbar-vertical-collapsed .navbar-vertical:has(.vrl-account[open]) .vrl-nav-pages { display: grid; }
  .navbar-vertical-collapsed .navbar-vertical:hover .nav-side-pill,
  .navbar-vertical-collapsed .navbar-vertical:has(.vrl-account[open]) .nav-side-pill {
    width: auto;
    min-width: 0;
    margin: auto 0.5rem auto 0;
    padding: 0.1rem 0.5rem;
    border-width: 1px;
    overflow: visible;
  }
}

/* ── Side pill — a secondary nav destination riding alongside a main
   product nav-link (.nav-link-split-row/-main below), implying it's part
   of that workflow rather than its own nav item. Used for Book beside
   Value-it and Revert beside Price-it — neither is a required step before
   its neighbour, so both stay a lightweight pill, not a full nav-link. ── */
.nav-side-pill {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  margin: auto 0.5rem auto 0;
  padding: 0.1rem 0.5rem;
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--varial-gray-600, #4D4A46);
  background: rgba(4, 43, 29, 0.06);
  border: 1px solid rgba(4, 43, 29, 0.10);
  border-radius: 999px;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.nav-side-pill:hover,
.nav-side-pill:focus-visible {
  background: rgba(37, 99, 235, 0.10);
  color: var(--varial-primary, #2563EB);
  border-color: rgba(37, 99, 235, 0.25);
  outline: 0;
}
.nav-side-pill.active {
  background: rgba(37, 99, 235, 0.14);
  color: var(--varial-primary, #2563EB);
  border-color: rgba(37, 99, 235, 0.3);
}

/* External-link mark (Contact opens in a new tab) — inherits the nav-link's
   own colour via currentColor (rather than Bootstrap's text-muted, which
   overrode it to a mismatched grey that didn't track hover/active state)
   at reduced opacity, so it stays in sync with the link automatically. */
.nav-link-extlink {
  margin-left: 0.3em;
  font-size: 0.7em;
  opacity: 0.55;
  vertical-align: 0.1em;
}

/* ── 8a. Sidebar dropdown group (Book) ─────────────────────────────────
   A native <details>: the summary row opens the group's pages beneath it, the same
   pattern as a Varial X side nav section. In the collapsed icon rail the pages are
   hidden until the rail expands on hover (rules in the collapsed block above).
   ─────────────────────────────────────────────────────────────────────── */
.vrl-nav-group > summary { list-style: none; cursor: pointer; }
.vrl-nav-group > summary::-webkit-details-marker { display: none; }
/* A linked group heading navigates, sized to its icon and name; the rest of the row, */
/* including the outlined caret, toggles its pages. The link is the summary's sibling, laid */
/* over the left of the summary row in one grid cell: a summary is a button, and a link */
/* inside it would be one control nested in another. Its box matches the .nav-link row */
/* (branding.css) so the icon and name sit where the row puts them. */
.vrl-nav-group-item { display: grid; }
.vrl-nav-group-item > .vrl-nav-group-destination,
.vrl-nav-group-item > .vrl-nav-group { grid-area: 1 / 1; min-width: 0; }
.vrl-nav-group-destination {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  align-self: start;
  justify-self: start;
  max-width: 100%;
  min-height: 2.5rem;
  padding-left: 0.6875rem;
  border-radius: 0.5625rem;
  color: var(--varial-gray-600, #4D4A46);
  font-size: 0.8125rem;
  font-weight: 600;
  text-decoration: none;
}
/* From 1200px Bootstrap's navbar rule sets every .nav-link's side padding to its navbar value; */
/* the link is not a .nav-link, so it takes the same value here or its icon sits right of the rest. */
@media (min-width: 1200px) {
  .navbar-expand-xl .navbar-nav .vrl-nav-group-destination { padding-left: var(--bs-navbar-nav-link-padding-x); }
}
.vrl-nav-group-destination:hover { color: var(--varial-gray-900, #131210); text-decoration: none; }
.vrl-nav-group-destination:focus-visible { outline: 2px solid var(--varial-primary, #0F745B); outline-offset: -2px; }
/* The row reads as one control: pointing at the link lights the summary row behind it, and */
/* the name darkens on hover and on the group's current page as a .nav-link's does. */
.vrl-nav-group-item:has(> .vrl-nav-group-destination:hover) > .vrl-nav-group > summary {
  background-color: rgba(4, 43, 29, 0.06);
}
.vrl-nav-group-item:has(> .vrl-nav-group-destination:hover) > .vrl-nav-group > summary.active {
  background-color: rgba(15, 116, 91, 0.12);
}
.navbar-vertical .vrl-nav-group-destination:hover .nav-link-text,
.navbar-vertical .vrl-nav-group-destination.active .nav-link-text,
.navbar-vertical .vrl-nav-group-item:has(> .vrl-nav-group > summary:hover) > .vrl-nav-group-destination .nav-link-text {
  color: var(--varial-gray-900, #131210);
}

/* Credits: the team's balance as a small pill at the row's right, red at zero and green above
   it. It carries nav-link-text, so it shows only while the nav is open. */
.navbar-vertical .nav-link .vrl-credit-badge {
  margin-left: auto;
  padding: 0 0.4rem;
  border-radius: 999px;
  font-size: 0.6875rem;
  font-weight: 700;
  line-height: 1.15rem;
  white-space: nowrap;
  color: var(--varial-white, #fff);
}
/* The nav darkens every label on hover and on the current page; the badge keeps its white text. */
.navbar-vertical .nav-link.active .nav-link-text.vrl-credit-badge,
.navbar-vertical .nav-link:hover .nav-link-text.vrl-credit-badge,
.navbar-vertical .nav-link:focus-visible .nav-link-text.vrl-credit-badge {
  color: var(--varial-white, #fff);
}
/* The pill's 11px white label needs 4.5:1, which the action teal (3.8:1) misses; the deeper
   hover teal holds 5.7:1. */
.vrl-credit-badge--ok { background: var(--varial-action-hover, #0F745B); }
/* In the account menu the badge sits at the Credits link's right and keeps its white text. */
.vrl-account-links .vrl-account-credits { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.vrl-account-credits .vrl-credit-badge,
.vrl-account-links .vrl-account-credits:hover .vrl-credit-badge {
  padding: 0 0.4rem;
  border-radius: 999px;
  font-size: 0.6875rem;
  font-weight: 700;
  line-height: 1.15rem;
  color: var(--varial-white, #fff);
}
.vrl-credit-badge--empty { background: var(--varial-danger, #DC2626); }

/* The collapsed rail gives each label a fixed full width so its text doesn't reflow as the nav
   opens on hover; these small extras keep their own width instead. */
@media (min-width: 1200px) {
  .navbar-vertical-collapsed .navbar-vertical .vrl-credit-badge,
  .navbar-vertical-collapsed .navbar-vertical .vrl-nav-external {
    width: auto;
  }
}

/* Docs opens in a new tab; this outlined arrow at the right of its row says so. */
.vrl-nav-external {
  flex: none;
  margin-left: auto;
  opacity: 0.55;
}

.vrl-nav-caret {
  flex: none;
  box-sizing: content-box;
  margin: 0 -0.25rem 0 auto;
  padding: 0.3125rem;
  border: 1px solid rgba(4, 43, 29, 0.18);
  border-radius: 0.375rem;
  opacity: 0.7;
  transition: transform 0.2s ease, background-color 150ms ease, opacity 150ms ease;
}
.vrl-nav-group > summary:hover .vrl-nav-caret {
  background-color: rgba(4, 43, 29, 0.08);
  opacity: 1;
}
/* Thin rule that sets Docs apart from the product links. */
.vrl-nav-divider {
  height: 0;
  margin: 0.375rem 0.75rem;
  border-top: 1px solid rgba(4, 43, 29, 0.12);
  list-style: none;
}
/* Nothing follows it for a signed-out visitor, so it would only double the footer's rule. */
.vrl-nav-divider:last-child { display: none; }
/* Side nav outline icons (templates/includes/partials/_nav_icon.html), the Varial X set. */
.vrl-nav-glyph { display: block; margin: 0 auto; }
.vrl-nav-group[open] .vrl-nav-caret { transform: rotate(180deg); }
.vrl-nav-pages { display: grid; gap: 1px; margin: 0.125rem 0 0.375rem; }
.vrl-nav-pages a,
.vrl-nav-pages .vrl-nav-placeholder {
  padding: 0.3rem 0.75rem 0.3rem 2.75rem;
  border-radius: 0.5rem;
  color: var(--varial-gray-600, #4D4A46);
  font-size: 0.8125rem;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}
.vrl-nav-pages a:hover,
.vrl-nav-pages a:focus-visible { background: rgba(4, 43, 29, 0.06); color: var(--varial-gray-900, #131210); }
.vrl-nav-pages a.active { background: rgba(15, 116, 91, 0.12); color: var(--varial-gray-900, #131210); font-weight: 600; }
.vrl-nav-pages--inputs > a,
.vrl-nav-pages--inputs > .vrl-nav-placeholder { display:flex; align-items:center; justify-content:space-between; gap:.5rem; }
.vrl-nav-placeholder { cursor:default; }
.vrl-nav-wip { flex:none; padding:.12rem .3rem; border-radius:.25rem; font-size:.55rem; font-weight:600; line-height:1.2; letter-spacing:.04em; color:var(--varial-brand-amber-deep); background:color-mix(in srgb, var(--varial-brand-amber) 12%, transparent); }
[data-bs-theme=dark] .vrl-nav-wip { color:var(--varial-brand-amber-light); }


/* ── 8b. Sidebar nested submenu (VAR / Possies) ─────────────────────────
   Split-row: the VAR nav-link and the chevron toggle are separate elements
   so each can be clicked independently. Bootstrap collapse drives open/close.
   In icon-rail (collapsed) mode the submenu and toggle are hidden.
   ─────────────────────────────────────────────────────────────────────── */

/* Split row: main nav link + separate chevron toggle */
.nav-link-split-row {
  display: flex;
  align-items: stretch;
}

.nav-link-split-main {
  flex: 1 1 auto;
  /* Without this, the flex item's default min-width:auto floors it at its
     content's min-content size (icon + text) — in the collapsed icon-rail,
     the text is only visibility:hidden (still sized), so the link refused
     to shrink to the rail's width and its active-state background spilled
     out past the sidebar's edge. */
  min-width: 0;
  display: flex;
  align-items: center;
  margin: 0;
  border-radius: 0.375rem;
  padding-right: 0.125rem;
}

.nav-link-split-toggle {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  padding: 0 0.5rem;
  color: rgba(255, 255, 255, 0.78);
  transition: color 0.2s ease;
}

.nav-link-split-toggle:hover,
.nav-link-split-toggle:focus-visible,
.nav-link-split-toggle[aria-expanded="true"] {
  color: #fff;
  outline: 0;
}

.nav-submenu-caret {
  font-size: 0.625rem;
  opacity: 0.65;
  transition: transform 0.25s ease;
}

.nav-link-split-toggle[aria-expanded="true"] .nav-submenu-caret {
  transform: rotate(180deg);
}

.nav-submenu {
  margin-top: 0.0625rem;
  margin-bottom: 0.375rem;
}

.nav-submenu .nav-link-submenu {
  display: flex;
  align-items: center;
  padding-top: 0.25rem;
  padding-bottom: 0.25rem;
  padding-left: 2.75rem;
  font-size: 0.8125rem;
}

.nav-submenu .nav-link-submenu .nav-link-icon {
  min-width: 1rem;
  display: inline-flex;
  justify-content: center;
}

@media (min-width: 1200px) {
  .navbar-vertical-collapsed
    .nav-item-submenu
    .nav-submenu {
    display: none;
  }

  .navbar-vertical-collapsed
    .nav-link-split-toggle {
    display: none;
  }
}

/* ── 9. Tablet (<1200px) ────────────────────────────────────────────────
   The sidebar header (logo + toggle) stays visible at tablet — it owns the
   burger that reveals the sidebar (see the icon-swap rules in 9b below).
   ─────────────────────────────────────────────────────────────────────── */
@media (max-width: 1199.98px) {
  .navbar-vertical {
    margin: 0;
  }
}

/* ── 9b. Tablet/mobile hover-open + tap-to-pin ──────────────────────────
   At <1200px the sidebar is collapsed by default and the pin icon is small
   & undiscoverable. We add two state classes (driven by layout.js):
     .is-hovered  — set on mouseenter (gated until the pointer leaves once
                    after a pin/unpin) and cleared on mouseleave
     .is-pinned   — toggled by tap anywhere on .navbar-vertical that isn't
                    an interactive child; persisted to sessionStorage
   Either class forces the collapsed drawer visible. The whole sidebar gets
   cursor:pointer so the tap affordance is discoverable.
   ─────────────────────────────────────────────────────────────────────── */
@media (max-width: 1199.98px) {
  /* Whole-sidebar tap target — cursor:pointer signals the affordance.
     Bootstrap's links/buttons already define cursor:pointer; form-check
     and bare flex spacers inherit pointer which is what we want
     (clicking them WILL toggle the pin). */
  .navbar-vertical {
    cursor: pointer;
  }
  /* Restore default cursor for inputs only — links/buttons keep pointer. */
  .navbar-vertical input,
  .navbar-vertical textarea,
  .navbar-vertical select {
    cursor: auto;
  }

  /* Focus ring on the sidebar when it's the tap/keyboard target. */
  .navbar-vertical:focus-visible {
    outline: 2px solid var(--varial-primary, #1B3AA0);
    outline-offset: -2px;
  }

  /* Issue 1 fix: Bootstrap's default .navbar sets align-items:center and
     justify-content:space-between, which would center the .navbar-collapse
     drawer horizontally inside .navbar-vertical at <1200px (the desktop
     override at line 119 only applies ≥1200px). Force left-aligned stack. */
  .navbar-vertical {
    align-items: stretch;
    justify-content: flex-start;
  }

  /* Push burger icon to the right-hand side of the header on mobile, with a
     bit of breathing room from the edge. */
  .navbar-vertical-header {
    justify-content: space-between;
    width: 100%;
    padding-right: 0.75rem;
  }
  .navbar-vertical .navbar-collapse {
    align-items: stretch;
    text-align: left;
  }

  /* Drawer open/close animation.
     Bootstrap's .collapse sets display:none; .show flips it. CSS transitions
     don't work on display, so at this breakpoint we override .navbar-collapse
     to always be display:flex but visually closed via max-height/opacity/
     translateY. The state classes (.is-hovered / .is-pinned on .navbar-vertical)
     animate it open. We piggy-back on the parent state class so Bootstrap's
     own .show toggle still works too.
     !important required to defeat Bootstrap's .collapse:not(.show){display:none}
     which is the only place at this breakpoint where state would otherwise win. */
  .navbar-vertical > .navbar-collapse {
    display: flex !important;
    flex-direction: column;
    align-items: stretch;
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    transform: translateY(-0.5rem);
    visibility: hidden;
    transition:
      max-height 280ms ease,
      opacity 200ms ease,
      transform 280ms ease,
      visibility 0s linear 280ms;
  }
  .navbar-vertical.is-hovered > .navbar-collapse,
  .navbar-vertical.is-pinned > .navbar-collapse {
    max-height: 100vh;
    opacity: 1;
    transform: translateY(0);
    visibility: visible;
    overflow-y: auto;
    transition:
      max-height 320ms ease,
      opacity 240ms ease,
      transform 280ms ease,
      visibility 0s linear 0s;
  }
  /* Respect user motion preferences — disable the animation. */
  @media (prefers-reduced-motion: reduce) {
    .navbar-vertical > .navbar-collapse,
    .navbar-vertical.is-hovered > .navbar-collapse,
    .navbar-vertical.is-pinned > .navbar-collapse {
      transition: none;
    }
  }

  /* Pinned-state hint on the header — subtle inset border so users see the
     pin is active. Uses brand token with fallback. */
  .navbar-vertical.is-pinned .navbar-vertical-header[data-sidebar-header] {
    box-shadow: inset 3px 0 0 var(--varial-accent, #C49A1A);
  }

  /* Toggle icon at tablet/mobile: always the burger (☰) — the universally
     recognised "open menu" affordance on narrow screens. The desktop
     directional chevrons (branding.css, ≥1200px) stay hidden here; the
     burger's open/close state is driven by .is-pinned on .navbar-vertical
     via the same drawer animation above, so the icon itself doesn't swap. */
  .navbar-vertical .navbar-vertical-toggle .vrl-toggle--burger {
    display: inline-flex;
  }
}

/* ── 9c. Tablet/mobile: pin the top navbar above the wizard chrome ───────
   The Spot/VAR wizard chrome is `position: fixed; z-index: 1030` (wizard.css) and
   is pushed to `top: 2.875rem` so it clears the collapsed top navbar. But that
   navbar sat in normal flow with no z-index, so two things broke on narrow screens:
     • expanding the burger dropped the drawer *behind* the fixed chrome — the wizard
       step-nav stayed on top when the top nav should win;
     • scrolling let the navbar slide out from under the fixed chrome, so the step-nav
       overlapped it.
   Pinning the navbar (sticky top:0) and lifting it above the chrome (z-index 1045 >
   1030) fixes both: the drawer overlays the step-nav, and the navbar always renders
   on top of (never under) the chrome — matching the desktop rule's z-index above,
   which is set for the same "sidebar beats every in-page layer" reason. */
@media (max-width: 1199.98px) {
  .navbar-vertical {
    position: sticky;
    top: 0;
    z-index: 1045;
  }
}

/* ── 11. Sidebar footer — region + user, pinned to bottom ───────────────
   Lives inside .navbar-collapse (flex column), after .navbar-vertical-content.
   At desktop it's always visible; at tablet it scrolls with the nav.
   ─────────────────────────────────────────────────────────────────────── */
.sidebar-footer {
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  gap: 2px;
  padding: 0.625rem 0.625rem 0.25rem;
  border-top: 1px solid var(--varial-border, #dce4e1);
}

.sidebar-footer-label {
  padding: 0.4rem 0.75rem 0.15rem;
  font-size: 0.6rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(255, 255, 255, 0.35);
}

/* Account menu: avatar + name row that opens a panel, the same control as Varial X's
   (static/css/pages/varial_x_rail.css). At desktop the panel is fixed so the nav's
   overflow cannot clip it and it opens beside the nav; below 1200px the nav collapse is
   transformed, so the panel opens in place under the row instead. */
.vrl-account > summary { list-style: none; cursor: pointer; }
.vrl-account > summary::-webkit-details-marker { display: none; }
.vrl-account[open] > summary { background: rgba(4, 43, 29, 0.06); color: var(--varial-gray-900, #131210); }
.vrl-account-name { overflow: hidden; text-overflow: ellipsis; }
.vrl-account-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  height: 1.25rem;
  border: 1px solid var(--varial-brand-teal, #0D9488);
  border-radius: 50%;
  font-size: 0.625rem;
  font-weight: 700;
}
.vrl-account-panel {
  position: fixed;
  /* Fixed, never a top-layer popover: initAccountMenu says why. */
  top: auto;
  right: auto;
  bottom: 1rem;
  left: calc(var(--vrl-sidebar-w, 12.625rem) + (var(--vrl-sidebar-gap, 0.75rem) * 2));
  margin: 0;
  z-index: 1046;
  width: 17.5rem;
  padding: 0.875rem;
  border: 1px solid var(--varial-border, #dce4e1);
  border-radius: 0.75rem;
  background: var(--varial-card-bg, #fff);
  box-shadow: 0 20px 55px rgba(0, 0, 0, 0.18);
  color: inherit;
  font-size: 0.8125rem;
  line-height: 1.45;
  white-space: normal;
}
.vrl-account-who { display: grid; gap: 2px; margin: 0 0 0.75rem; overflow-wrap: anywhere; }
.vrl-account-who small { color: var(--varial-fg-muted, #6b6862); }
.vrl-account-links {
  display: grid;
  gap: 0.5rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--varial-border, #dce4e1);
}
.vrl-account-links a,
.vrl-account-links button {
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.vrl-account-links a:hover,
.vrl-account-links button:hover { color: var(--varial-brand-teal, #0D9488); }
.vrl-account-links form { margin: 0; }
@media (max-width: 1199.98px) {
  .vrl-account-panel { position: static; width: auto; margin: 0.25rem 0; box-shadow: none; }
}

/* Shared button shape for region + user triggers */
.sidebar-footer-item {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 2.5rem;
  padding: 0 0.6875rem;
  background: none;
  border: none;
  border-radius: 0.5625rem;
  color: var(--varial-gray-600, #4D4A46);
  font-size: 0.8125rem;
  font-weight: 600;
  text-align: left;
  white-space: nowrap;
  transition: color 0.15s ease, background 0.15s ease;
  --bs-dropdown-caret: none;
}
.sidebar-footer-item.active { background: rgba(15, 116, 91, 0.12); }
.sidebar-footer-item .nav-link-text { flex-direction: column; line-height: 1.2; }
.sidebar-footer-item .nav-link-text small { display: block; margin-top: 0.125rem; color: var(--varial-gray-500, #6b6862); font-size: 0.6875rem; font-weight: 500; }

.sidebar-footer-item::after,
.sidebar-footer-item.dropdown-toggle::after {
  display: none; /* suppress Bootstrap's auto-caret — we use our own chevron icon */
}

.sidebar-footer-item:hover,
.sidebar-footer-item:focus-visible {
  color: var(--varial-gray-900, #131210);
  background: rgba(4, 43, 29, 0.06);
  outline: none;
}

/* Scale down the avatar in the footer */
.sidebar-footer-item .avatar {
  width: 1.375rem;
  height: 1.375rem;
}

.sidebar-footer-item .avatar-name {
  font-size: 0.6rem;
  line-height: 1;
}

/* Chevron icon inside user button — flips open when dropdown is shown */
.sidebar-footer-user .show .sidebar-footer-chevron,
.sidebar-footer-user.show .sidebar-footer-chevron,
.sidebar-footer-region .show .sidebar-footer-chevron,
.sidebar-footer-region.show .sidebar-footer-chevron {
  transform: rotate(180deg);
}

.sidebar-footer-chevron {
  transition: transform 0.2s ease;
  font-size: 0.6rem;
  opacity: 0.5;
}

/* ── Active-team switch confirmation tick ─────────────────────────────────
   Rendered only on the first render after a team switch (group_just_switched).
   The team icon briefly flips to a green tick (overlaid in the same slot, so no
   layout shift) then fades back — pure CSS, no JS timer. Works in both the
   expanded sidebar and the collapsed icon-rail since it lives on the icon. */
.sidebar-switch-icon {
  position: relative;
}

.sidebar-switch-icon .sidebar-switch-confirm {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--varial-success, #16a34a);
  opacity: 0;
  pointer-events: none;
  animation: vrl-switch-confirm 1.8s ease forwards;
}

/* Base team icon fades out while the tick is shown, then back in. */
.sidebar-switch-icon.is-switching .sidebar-switch-base-icon {
  animation: vrl-switch-base-icon 1.8s ease forwards;
}

@keyframes vrl-switch-confirm {
  0% { opacity: 0; transform: scale(0.5); }
  12% { opacity: 1; transform: scale(1.15); }
  22% { transform: scale(1); }
  72% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(0.9); }
}

@keyframes vrl-switch-base-icon {
  0%, 75% { opacity: 0; }
  100% { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .sidebar-switch-icon .sidebar-switch-confirm,
  .sidebar-switch-icon.is-switching .sidebar-switch-base-icon {
    animation-duration: 0.01ms;
    animation-iteration-count: 1;
  }
}

/* ── Sidebar nested submenu (DIYvar) ─────────────────────────────────── */
.nav-link-submenu-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: transparent;
  border: 0;
  text-align: left;
}

/* Split row: main nav link + separate chevron toggle */
.nav-link-split-row {
  display: flex;
  align-items: stretch;
}

.nav-link-split-main {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  margin: 0;
  border-radius: 0.375rem;
  padding-right: 0.125rem;
}

.nav-link-split-toggle {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  margin-right: 0.25rem;
  border-radius: 0.375rem;
  padding: 0;
  background: transparent;
  border: 0;
  color: rgba(255, 255, 255, 0.78);
  transition: color 0.2s ease;
}

.nav-link-split-toggle:hover {
  color: #fff;
}

.nav-link-split-toggle:focus-visible {
  color: #fff;
  outline: 0;
}

.nav-link-split-toggle[aria-expanded="true"] .nav-submenu-caret {
  transform: rotate(180deg);
}

.nav-link-split-toggle[aria-expanded="true"] {
  color: #fff;
}

.nav-submenu-caret {
  font-size: 0.625rem;
  opacity: 0.65;
  transition: transform 0.2s ease;
}

.nav-item-submenu > .collapse.show + .nav-submenu-caret,
.nav-item-submenu.open .nav-submenu-caret,
.nav-link-submenu-toggle[aria-expanded="true"] .nav-submenu-caret {
  transform: rotate(180deg);
}

.nav-submenu {
  margin-top: 0.0625rem;
  margin-bottom: 0.375rem;
}

.nav-submenu .nav-link-submenu {
  display: flex;
  align-items: center;
  padding-top: 0.25rem;
  padding-bottom: 0.25rem;
  padding-left: 2.75rem;
  font-size: 0.8125rem;
}

.nav-submenu .nav-link-submenu .nav-link-icon {
  min-width: 1rem;
  display: inline-flex;
  justify-content: center;
}

@media (min-width: 1200px) {
  .navbar-vertical-collapsed
    .nav-item-submenu
    .nav-submenu {
    display: none;
  }

  .navbar-vertical-collapsed
    .nav-item-submenu
    .nav-submenu-caret {
    display: none;
  }

  .navbar-vertical-collapsed
    .nav-link-split-toggle {
    display: none;
  }
}

/* ── Sidebar footer dropdowns — dark-themed to match sidebar ────────────
   Bootstrap defaults to a white dropdown; the sidebar is #0D1B2E so we
   override every token to a dark palette that feels native to the shell. */
.sidebar-footer .dropdown-menu {
  /* Position: open upward, sized a fraction narrower than the sidebar so the
     menu sits fully inside it. The sidebar is overflow:hidden, so a menu wider
     than --vrl-sidebar-w gets clipped at the right edge (looked cropped). */
  bottom: 100%;
  top: auto;
  margin-bottom: 0.25rem;
  width: calc(var(--vrl-sidebar-w, 12.625rem) - 0.25rem);
  min-width: 0;
  max-width: calc(var(--vrl-sidebar-w, 12.625rem) - 0.25rem);
  /* Dark palette */
  background-color: #1a2e47;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 0.375rem;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.5);
  padding: 0.25rem 0;
  font-size: 0.8125rem;
  /* Override Bootstrap's CSS variable so nested selectors inherit correctly */
  --bs-dropdown-bg: #1a2e47;
  --bs-dropdown-color: rgba(255, 255, 255, 0.85);
  --bs-dropdown-border-color: rgba(255, 255, 255, 0.12);
  --bs-dropdown-link-color: rgba(255, 255, 255, 0.78);
  --bs-dropdown-link-hover-color: #fff;
  --bs-dropdown-link-hover-bg: rgba(255, 255, 255, 0.08);
  --bs-dropdown-link-active-color: #fff;
  --bs-dropdown-link-active-bg: rgba(255, 255, 255, 0.14);
  --bs-dropdown-link-disabled-color: rgba(255, 255, 255, 0.3);
}

/* Optional header rows inside the menu (e.g. "Switch account") */
.sidebar-footer .dropdown-header {
  color: rgba(255, 255, 255, 0.35);
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.375rem 0.75rem 0.125rem;
}

.sidebar-footer .dropdown-divider {
  border-color: rgba(255, 255, 255, 0.1);
}

.sidebar-footer .dropdown-item {
  color: rgba(255, 255, 255, 0.78);
  padding: 0.35rem 0.75rem;
  border-radius: 0;
}

.sidebar-footer .dropdown-item:hover,
.sidebar-footer .dropdown-item:focus {
  background-color: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.sidebar-footer .dropdown-item.active,
.sidebar-footer .dropdown-item:active {
  background-color: rgba(255, 255, 255, 0.14);
  color: #fff;
}

.sidebar-footer .dropdown-item.disabled,
.sidebar-footer .dropdown-item:disabled {
  color: rgba(255, 255, 255, 0.3);
  pointer-events: none;
}

/* ── Collapsed icon-rail mode — hide footer text, disable dropdowns ─────
   display:none (not opacity/visibility) so justify-content:center
   centres the icon without invisible text taking up flex space.

   Scoped to (min-width: 1200px) because .navbar-vertical-collapsed is a
   desktop-only state (set from localStorage on every page load — see
   layout.js init block). At <1200px the sidebar is a drawer and the
   .is-pinned source-of-truth governs whether it's visible; a stale
   .navbar-vertical-collapsed leftover from a desktop visit must NOT
   collapse the footer there, or a pinned mobile drawer ends up with
   a tiny center-aligned avatar while the rest of the drawer is wide. */
@media (min-width: 1200px) {
  .navbar-vertical-collapsed
    .navbar-vertical .sidebar-footer-item .nav-link-text,
  .navbar-vertical-collapsed
    .navbar-vertical .sidebar-footer .sidebar-footer-chevron {
    display: none;
  }

  /* Keep the collapsed sidebar footer compact */
  .navbar-vertical-collapsed
    .navbar-vertical .sidebar-footer-item {
    justify-content: center;
    padding-left: 0;
    padding-right: 0;
  }

  /* Hover-expand: restore the footer item's label and left alignment to
     match every other nav item once the rail widens back out. Without this,
     .sidebar-footer-item stayed icon-only and centered even on hover — the
     rules above have no :hover carve-out, unlike the general
     .nav-link-text opacity rule they duplicate. */
  .navbar-vertical-collapsed
    .navbar-vertical:hover .sidebar-footer-item .nav-link-text,
  .navbar-vertical-collapsed
    .navbar-vertical:has(.vrl-account[open]) .sidebar-footer-item .nav-link-text {
    display: flex;
  }
  .navbar-vertical-collapsed
    .navbar-vertical:hover .sidebar-footer-item,
  .navbar-vertical-collapsed
    .navbar-vertical:has(.vrl-account[open]) .sidebar-footer-item {
    justify-content: flex-start;
    padding-left: 0.6875rem;
    padding-right: 0.6875rem;
  }

  /* Prevent dropdown triggers from opening in icon-rail mode —
     there is no room for a readable menu when the sidebar is 3.5rem wide. */
  .navbar-vertical-collapsed
    .navbar-vertical .sidebar-footer .dropdown-toggle {
    pointer-events: none;
  }
}

/* App switch at the top of the sidebar footer: Varial X and Varial Energy (this app), as in
   the Varial X side nav. The marks stay visible in the collapsed icon rail. */
.vrl-app-switch { display: flex; flex-direction: column; gap: 2px; padding-bottom: .5rem; margin-bottom: .375rem; border-bottom: 1px solid var(--varial-border, #dce4e1); }
.vrl-app-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 5px;
  color: var(--varial-white, #fff);
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
}
.vrl-app-mark--energy { background: var(--varial-brand-teal-deep, #0f745b); }
.vrl-app-mark--x { background: var(--varial-brand-violet-deep, #7614d0); }
.vrl-app-current .nav-link-text { font-weight: 700; }

/* The arrow at the foot of the nav keeps it open (desktop only), as in the Varial X nav. */
.vrl-nav-pin {
  display: none;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  flex: none;
  margin: 0.375rem 0 0 0.25rem;
  padding: 0;
  border: 1px solid var(--varial-border, #dce4e1);
  border-radius: 50%;
  background: var(--varial-card-bg, #fff);
  color: var(--varial-gray-600, #4D4A46);
  cursor: pointer;
}
.vrl-nav-pin:hover,
.vrl-nav-pin:focus-visible { color: var(--varial-gray-900, #131210); border-color: var(--varial-brand-teal-deep, #0f745b); }
.vrl-nav-pin-chevron { width: 15px; height: 15px; transition: transform .18s ease; }
html:not(.navbar-vertical-collapsed) .vrl-nav-pin-chevron { transform: rotate(180deg); }
@media (min-width: 1200px) {
  .vrl-nav-pin { display: flex; }
}
@media (prefers-reduced-motion: reduce) {
  .vrl-nav-pin-chevron { transition: none; }
}

/* On a phone the bottom bar (components/bottom-nav.css) carries the navigation, so the top nav is not
   shown. Both come from the same template block, so one is never rendered without the other. */
@media (max-width: 760px) {
  .navbar-vertical { display: none; }
}
