/*
 * eca-nav-rail.css — the navigation rail (`EcaNavRail`, `EcaShell.MenuStyle.Rail`).
 *
 * This sheet is the ONE owner of the rail's chrome: width, head, toggle, section control, count,
 * peek, section flyout and the narrow-width drawer. Grouping and rows are the shared menu
 * component's (`eca-menu__section`, `eca-menu__section-title`, `eca-menu__icon`), so this file
 * changes their DENSITY inside a rail and does not restate the component.
 *
 * Mobile first: the base is the <900 px drawer (off-canvas, closed), and the ≥900 block turns the
 * same markup into the static 248/56 px column. No `max-width` correction block.
 *
 * The measured values are the ones the prototype was judged on: 248 px expanded, 56 px collapsed,
 * 252 px flyout, 34 px rows, a 10 px section title, a peek/flyout to the RIGHT of the bar.
 */

:root {
  --nav-rail-width: 15.5rem;    /* 248 */
  --nav-rail-bar: 3.5rem;      /* 56 */
  --nav-rail-flyout: 15.75rem; /* 252 */
  --nav-rail-bar-h: 3.25rem;   /* 52 */
  --nav-rail-row: 2.125rem;    /* 34 */
  --nav-rail-row-text: 0.8125rem; /* 13 */
  --nav-rail-title: 0.625rem;  /* 10 */
}

/* ── the rail, base = an off-canvas drawer ───────────────────────────────────────────────────── */

.eca-nav-rail {
  position: fixed;
  inset-block: var(--nav-rail-bar-h) 0;
  inset-inline-start: calc(-1 * var(--nav-rail-width));
  z-index: 90;
  display: flex;
  flex-direction: column;
  flex: none;
  width: var(--nav-rail-width);
  min-height: 0;
  background: var(--color-surface);
  border-inline-end: 1px solid var(--color-line);
  box-shadow: var(--shadow-3);
  transition: inset-inline-start var(--motion-fast) ease;
}

.eca-nav-rail[data-nav="collapsed"] { width: var(--nav-rail-bar); }

.eca-nav-rail__body {
  display: flex;
  flex: 1 0 auto;
  min-height: 0;
  overflow-x: clip;
}

.eca-nav-rail__body > .eaw-page {
  /* `flex: 1 0 auto` made the page column keep its MAX-CONTENT width and refuse to shrink: at 145 %
   * text the rail is 360 px and the page measured 1425 px, i.e. its right edge sat 345 px past the
   * viewport, with `overflow-x: clip` hiding it — the form's date field was cut off and the document
   * did not scroll. The page column is the thing that takes the remaining width, so it must shrink
   * (and its own content scrolls inside it, where the app already owns that). */
  flex: 1 1 auto;
  min-width: 0;
}

.eca-nav-rail__body[data-nav-drawer="open"] .eca-nav-rail { inset-inline-start: 0; }

.eca-nav-rail__scrim {
  position: fixed;
  inset-block: var(--nav-rail-bar-h) 0;
  inset-inline: 0;
  z-index: 80;
  background: color-mix(in oklab, var(--color-ink) 34%, transparent);
}

/* ── the bar above the rail ──────────────────────────────────────────────────────────────────── */

.eca-nav-rail__bar {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-height: var(--nav-rail-bar-h);
  padding-inline: var(--space-3);
  background: var(--color-surface);
  border-block-end: 1px solid var(--color-line);
}

.eca-nav-rail__bar-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-inline-start: auto;
}

/* A rail has no menu item naming the product (the rail's own header says "Navigation"), so the
 * deployment's brand is the bar's identity at EVERY width here. The design system hides
 * `.eca-brand` at ≥900 because a bar whose menu already names the product would say it twice;
 * that reason does not hold in rail mode. */
.eca-nav-rail__bar .eca-brand {
  display: inline-flex;
  flex: 0 1 auto;
}

/* ── the bar's ACTIONS: disclosures, not a second navigation ──────────────────────────────────
 *
 * Search, Create, Notifications and the account sit at the inline end of the rail's bar. Each is
 * the shared `details.eca-menu__group`, so `disclosure-group.js` still gives one-open-at-a-time,
 * outside-click and Escape. What the rail has to add is PLACEMENT: a bar group is a popover at
 * EVERY width here — the rail itself is the narrow-width drawer, so the bar must not hand its own
 * actions to a second drawer — and it opens to the inline END so the last action's panel cannot
 * run off the viewport. The shared sheet states a panel's width only inside its ≥900 block; a
 * phone gets the same panel bounded to the viewport instead of a shrink-to-longest-word column.
 */
.eca-nav-rail__actions {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  flex: none;
  /* NOT positioned: it was the popovers' containing block when they were pinned to the cluster, and
   * that is what capped every phone panel at the cluster's own 159 px (`max-width: 100%`). At desk
   * widths the shared anchor placement ignores it; on a phone the BAR is the containing block. */
}

/* At DESK WIDTHS the bar's popovers are the SHARED ones: each panel opens under ITS OWN trigger and
 * the browser computes the flips (ui-system.css `@supports (position-try-fallbacks: flip-inline)`),
 * with `disclosure-group.js` naming each trigger. The rail states no placement here on purpose —
 * aligning every panel to the actions cluster put the SEARCH popover at the far right, a column away
 * from the control that opened it.
 *
 * Below 900 the shared sheet makes a panel an in-flow list for the DRAWER, which a bar cannot use.
 * The phone contract is therefore stated here: a popover aligned to the bar's inline end, so a panel
 * wider than the space beside its trigger can never run off the edge (the notifications panel is
 * 358 px on a 390 px viewport). */
@media (max-width: 899px) {
  .eca-nav-rail__bar { position: relative; }

  .eca-nav-rail__bar-primary .eca-menu__group,
  .eca-nav-rail__actions .eca-menu__group { position: static; }

  .eca-nav-rail__bar-primary .eca-menu__group > .eca-menu__panel,
  .eca-nav-rail__actions .eca-menu__group > .eca-menu__panel {
    position: absolute;
    inset-inline-start: auto;
    /* The containing block is the BAR's padding box, which already carries the gutter — so `0`, and
     * `100%` for the width. `100vw` was 15 px too wide (the scrollbar is not in `vw`): the 366 px
     * notifications panel measured x = −15 on a 390 px viewport. Measured: bar 375 px wide, padding
     * box 12..363, panel 351 px at x = 12. */
    inset-inline-end: var(--space-3);
    top: calc(100% + var(--space-1));
    z-index: 96;
    width: max-content;
    max-width: min(24rem, calc(100% - 2 * var(--space-3)));
    max-height: min(70vh, 32rem);
    overflow-y: auto;
  }
}

.eca-nav-rail__bar-primary {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  flex: 0 1 auto;
  min-width: 0;
}

.eca-nav-rail__actions > .eca-menu__group > summary {
  min-height: var(--control-h-sm);
  padding: var(--space-1) var(--space-2);
}

/* The bar's account is a CHIP, as the mock draws it (`SY`). The name is the control's accessible
 * name and the first line of its panel — it does not also need to occupy the bar, where it costs
 * ~150 px of the reader's own page. */
.eca-nav-rail__actions .eca-person__name { display: none; }

/* The search affordance: the mock promises ⌘K. The palette is its own unit; until it exists this
 * is the disclosure that still reaches Directory and Advanced search, so the destination is not
 * lost. */
.eca-nav-rail__jump {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  /* The mock's jump field: a wide muted control, the keycap at its inline end. It takes the space
   * it can and gives it back before the actions ever move. */
  min-width: 13rem;
  max-width: 22rem;
  flex: 0 1 auto;
  min-height: var(--control-h-sm);
  padding: var(--space-1) var(--space-2);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-field);
  background: var(--color-surface-sunken);
  color: var(--color-ink-3);
  font-size: var(--text-sm);
  font-family: inherit;
  text-align: start;
  cursor: pointer;
  list-style: none;
}
.eca-nav-rail__jump::-webkit-details-marker { display: none; }
.eca-nav-rail__jump .eca-nav-rail__kbd { margin-inline-start: auto; }
.eca-nav-rail__jump:hover { border-color: var(--color-primary); color: var(--color-primary); }

@media (max-width: 899px) {
  /* Five controls share 390 px. The icon is the affordance, the word survives as the accessible
   * name (every one of these summaries carries an `aria-label`), and the reader's own name yields
   * to their identity chip. Without this the bar measured 535 px inside a 375 px viewport and
   * `document.scrollWidth` grew by 145 px — the page scrolled sideways on every phone. */
  .eca-nav-rail__jump { min-width: 0; max-width: none; }
  .eca-nav-rail__jump-label,
  .eca-nav-rail__jump .eca-nav-rail__kbd,
  .eca-nav-rail__create-label { display: none; }
  /* A drawer toggle is a TOUCH target: 32 px is a desk control. */
  .eca-nav-rail__drawer-toggle {
    width: var(--control-h-touch);
    height: var(--control-h-touch);
  }
}

/* The brand is the bar's identity, and it is the first thing to give way when the actions need the
 * room: a truncating product name beats a bar that pushes the reader's own controls off-screen. */
.eca-nav-rail__bar .eca-brand { flex: 0 0 auto; min-width: 0; overflow: hidden; }
.eca-nav-rail__bar .eca-brand > * {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 599px) {
  /* A phone's bar carries five controls: the wordmark is the product's NAME and stays, the square
   * monogram beside it is the first thing to go — squeezed to fit it reads as a stray blob, which
   * is worse than absent. `.eca-header__mark` is the design system's own brand-part class (the
   * same sheet that draws `.eca-brand`), so this is not an assumption about an app's markup. */
  .eca-nav-rail__bar .eca-header__mark { display: none; }
}


/* ── the JUMP PALETTE (⌘K / Ctrl+K) ──────────────────────────────────────────────────────────────
 *
 * A keycap on the bar promises a jump palette; this is it. The earlier bar control carried ⌘K and
 * opened a two-item dropdown, which the owner rightly called useless: a shortcut badge on something
 * that is not a jump is a false affordance.
 *
 * It is the INDEX of the one navigation, not a second surface: every row of every section, plus the
 * bar's actions, filtered by a real input. `hidden` is the state; the island owns it.
 */
.eca-nav-rail__palette {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: start center;
  padding-block-start: 10vh;
  padding-inline: var(--space-3);
  overflow-y: auto;
  overscroll-behavior: contain;
  background: color-mix(in oklab, var(--color-ink) 38%, transparent);
  /* The focus ring belongs to the field, not to the overlay or the box. */
  outline: none;
}
.eca-nav-rail__palette[hidden] { display: none; }

/* The box is a column: the field and the footer stay put, only the list scrolls. Its 34rem cap
 * leaves a 390 px phone with the gutters it came in with, and the input's `min-width: 0` is what
 * stops a long placeholder from widening the box. */
.eca-nav-rail__palette-box {
  display: flex;
  flex-direction: column;
  width: min(34rem, 100%);
  max-height: min(70vh, 32rem);
  overflow: hidden;
  background: var(--color-surface);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-box);
  box-shadow: var(--shadow-3);
  /* The box is the panel around the field; it never draws the focus ring. */
  outline: none;
}

/* ── the field ─────────────────────────────────────────────────────────────────────────────────
 *
 * The icon, the input and the Esc keycap are ONE control. Idle, the field is a plain text line:
 * its border is TRANSPARENT (so the box never changes size) and it has no shadow. The primary
 * border and the focus ring appear only under `:focus-within`. A faint hairline on pointer hover
 * is the one other state, for discoverability.
 */

.eca-nav-rail__palette-field {
  display: flex;
  flex: none;
  align-items: center;
  gap: var(--space-2);
  min-height: 2.75rem; /* 44 px, a real input, not the 32 px table row control */
  margin: var(--space-2) var(--space-2) 0;
  padding-inline: var(--space-3);
  background: transparent;
  border: var(--border) solid transparent;
  border-radius: var(--radius-box);
  box-shadow: none;
  outline: none;
}
.eca-nav-rail__palette-field:hover {
  border-color: var(--color-line);
}
.eca-nav-rail__palette-field:focus-within {
  /* No outline anywhere: the ring is the field's own border + focus shadow. */
  outline: none;
  border-color: var(--color-primary);
  box-shadow: var(--focus-ring);
}

.eca-nav-rail__palette-glyph {
  display: grid;
  flex: none;
  place-items: center;
  color: var(--color-muted);
}

/* The input is the field: no second border, no margin, no box of its own. 16 px type is the
 * comfortable size the owner asked for; `min-width: 0` lets it shrink inside the box.
 *
 * The `input[type="search"]` reset in `ui-system.css` is more specific than a bare class, so this
 * selector names the field too (0,3,0 / 0,4,0 with the pseudo-class) and wins the border, ground
 * and ring: otherwise the native search field would paint its own border inside the idle field. */
.eca-nav-rail__palette .eca-nav-rail__palette-field > .eca-nav-rail__palette-input,
.eca-nav-rail__palette .eca-nav-rail__palette-field > .eca-nav-rail__palette-input:focus,
.eca-nav-rail__palette .eca-nav-rail__palette-field > .eca-nav-rail__palette-input:focus-visible {
  flex: 1 1 auto;
  min-width: 0;
  width: auto;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  outline: none;
  color: var(--color-ink);
  font-size: var(--text-base);
}
.eca-nav-rail__palette-input::placeholder { color: var(--color-ink-3); }

.eca-nav-rail__palette-esc {
  flex: none;
  color: var(--color-ink-3);
  font-size: var(--text-xs);
}

/* ── the grouped list ────────────────────────────────────────────────────────────────────────── */

.eca-nav-rail__palette-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.eca-nav-rail__palette-list {
  list-style: none;
  margin: 0;
  padding: var(--space-1);
}

/* A group label is a SECTION DIVIDER: a full-width surface-sunken band (with a hairline) that
 * sticks to the top of the scroll region, so a row's kind is never guessed. The band is the
 * sunken token rather than the row ground, and the rows themselves are not tinted. The negative
 * inline margin cancels the list's 4 px padding, so the band spans the list's full width. The ink
 * is mixed from `--color-ink` (not the fixed light-theme `--color-muted`): measured >= 9:1 on the
 * band in both the light and the dark daisy themes. */
.eca-nav-rail__palette-group-label {
  position: sticky;
  top: 0;
  z-index: 1;
  margin-inline: calc(-1 * var(--space-1));
  padding: var(--space-1) var(--space-3);
  background: var(--color-surface-sunken);
  border-block: 1px solid var(--color-line);
  color: color-mix(in oklab, var(--color-ink) 80%, var(--color-surface-sunken));
  font-size: var(--text-xs);
  font-weight: 650;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
}

.eca-nav-rail__palette-group[hidden],
.eca-nav-rail__palette-remote[hidden] { display: none; }

.eca-nav-rail__palette-item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-field);
  color: var(--color-ink);
  text-decoration: none;
  scroll-margin-block: 1.75rem; /* keep an active row clear of the sticky label */
}
.eca-nav-rail__palette-item:hover {
  background: var(--color-surface-sunken);
}

/* The keyboard cursor is drawn on the ROW, not only on the link inside it: a 1 px inset marker on
 * the leading edge plus the wash reads at a glance and at 390. */
.eca-nav-rail__palette-item--active {
  background: color-mix(in oklab, var(--color-primary) 12%, var(--color-surface));
  color: var(--color-primary);
  box-shadow: inset 2px 0 0 var(--color-primary);
}

/* The label takes the room; a hint keeps its own and truncates. Neither wraps in a 34rem box. */
.eca-nav-rail__palette-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.eca-nav-rail__palette-hint {
  flex: 0 1 auto;
  min-width: 0;
  max-width: 45%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--color-ink-3);
  font-size: var(--text-sm);
}

.eca-nav-rail__palette-loading,
.eca-nav-rail__palette-empty {
  flex: none;
  margin: 0;
  padding: var(--space-2) var(--space-3);
  border-block-start: 1px solid var(--color-line);
  color: var(--color-ink-3);
  font-size: var(--text-sm);
}
.eca-nav-rail__palette-loading[hidden],
.eca-nav-rail__palette-empty[hidden] { display: none; }

.eca-nav-rail__palette-foot {
  display: flex;
  flex: none;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border-block-start: 1px solid var(--color-line);
  color: var(--color-ink-3);
  font-size: var(--text-sm);
}

/* 390: the box takes the viewport minus the gutters, and the whole overlay can scroll if the
 * on-screen keyboard leaves the 70vh box taller than the visible area. */
@media (max-width: 480px) {
  .eca-nav-rail__palette {
    padding-block-start: var(--space-4);
    padding-inline: var(--space-2);
  }
  .eca-nav-rail__palette-box { max-height: calc(100dvh - 2 * var(--space-4)); }
}

/* ── the rail's head: chrome, not a section label ────────────────────────────────────────────── */

.eca-nav-rail__head {
  display: flex;
  flex: none;
  align-items: center;
  gap: var(--space-2);
  min-height: var(--control-h-touch);
  padding: var(--space-2);
  background: var(--color-surface-sunken);
  border-block-end: 1px solid var(--color-line-strong);
}

.eca-nav-rail__title {
  flex: 1;
  min-width: 0;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.eca-nav-rail__toggle,
.eca-nav-rail__help-button,
.eca-nav-rail__drawer-toggle {
  flex: none;
  display: grid;
  place-items: center;
  width: var(--control-h-sm);
  height: var(--control-h-sm);
  padding: 0;
  /* The head spaces these with `gap`. A generic button margin (0.1em) made the wrapper 4 px larger
   * than the control, and the help popover is anchored to that wrapper: the promise is "10 px to
   * the right of the button", so the button must BE the wrapper's box. */
  margin: 0;
  border: 1px solid var(--color-line);
  border-radius: var(--radius-field);
  background: var(--color-surface);
  color: var(--color-ink);
  font-family: inherit;
  cursor: pointer;
}

.eca-nav-rail__toggle:hover,
.eca-nav-rail__help-button:hover,
.eca-nav-rail__drawer-toggle:hover {
  background: var(--color-surface-sunken);
  border-color: var(--color-primary);
  color: var(--color-primary);
}

/* The collapse control shows one of two glyphs, never a rotated one. The state is on the rail
 * root, so the icons are a pure CSS consequence of `data-nav`. */
.eca-nav-rail__icon { display: block; }
.eca-nav-rail__icon--collapse { display: block; }
.eca-nav-rail__icon--expand { display: none; }
.eca-nav-rail[data-nav="collapsed"] .eca-nav-rail__icon--collapse { display: none; }
.eca-nav-rail[data-nav="collapsed"] .eca-nav-rail__icon--expand { display: block; }

.eca-nav-rail[data-nav="collapsed"] .eca-nav-rail__head {
  justify-content: center;
  padding-inline: 0;
}

.eca-nav-rail[data-nav="collapsed"] .eca-nav-rail__title,
.eca-nav-rail[data-nav="collapsed"] .eca-nav-rail__help { display: none; }

/* ── the rail's scroll region and section controls ───────────────────────────────────────────── */

.eca-nav-rail__scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding-block: var(--space-2);
}

/* The section title keeps the shared component's rank and voice but takes the rail's measured
 * density: 10 px uppercase muted, the mock's overline, one step below the page's own label.
 *
 * It is also the palette's section band: a full-width surface-sunken row with a hairline top and
 * bottom. This is the header row only — the destinations below keep their own rows and 44 px
 * targets. The same rule covers the collapsed 56 px button and the expanded 248 px label; the
 * flyout header gets its own copy below. */
.eca-nav-rail .eca-menu__section-title {
  font-size: var(--nav-rail-title);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: color-mix(in oklab, var(--color-ink) 80%, var(--color-surface-sunken));
  background: var(--color-surface-sunken);
  border-block: 1px solid var(--color-line);
}

/* The section title is a real control. Its typography is the shared component's
 * (`eca-menu__section-title`); this rule only resets the button box and states the click target. */
.eca-nav-rail__section-toggle {
  width: 100%;
  margin: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font-family: inherit;
  text-align: start;
  cursor: pointer;
  border-radius: var(--radius-field);
}

.eca-nav-rail__section-toggle:hover { background: var(--color-surface-sunken); }

.eca-nav-rail__section-toggle[aria-current="true"] {
  color: var(--color-primary);
  /* Keep the section band; the current state adds a primary wash on it, not a replacement. */
  background: color-mix(in oklab, var(--color-primary) 9%, var(--color-surface-sunken));
}

.eca-nav-rail__section-label { min-width: 0; }

/* Expanded, the heading is a label; collapsed, the control is a button. One of the two is
 * `display:none` in each state, so exactly one is in the accessibility tree and the tab order. */
.eca-nav-rail[data-nav="expanded"] .eca-nav-rail__section-toggle { display: none; }
.eca-nav-rail[data-nav="collapsed"] .eca-nav-rail__section-label-title { display: none; }

/* Collapsed: the section header is plain chrome, not a band. The 56 px activity bar must not
 * show a grey slab behind every icon; the band belongs to the EXPANDED rail (and the flyout,
 * which is an opened surface) where the heading is a visual divider. The color/ink stays the
 * same, so the icon remains legible. */
.eca-nav-rail[data-nav="collapsed"] .eca-nav-rail__section-toggle {
  background: transparent;
  border-block: 0;
  border-radius: 0;
}

/* Collapsed: the title is the icon alone. The label stays in the accessibility tree — the glyph
 * is `aria-hidden`, so `display:none` here would leave the button without a name (WCAG 4.1.2). */
.eca-nav-rail[data-nav="collapsed"] .eca-nav-rail__section-toggle {
  justify-content: center;
  min-height: 2.5rem;
  padding-inline: 0;
}

.eca-nav-rail[data-nav="collapsed"] .eca-nav-rail__section-label {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.eca-nav-rail[data-nav="collapsed"] .eca-menu__section > .item { display: none; }

/* ── a rail row: 34 px, muted ink, a left marker for the current page ─────────────────────────── */

.eca-nav-rail .eca-menu__section > .item,
.eca-nav-rail__flyout > .item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-height: var(--nav-rail-row);
  padding: var(--space-1) var(--space-3);
  border-inline-start: 2px solid transparent;
  border-radius: var(--radius-field);
  color: var(--color-muted);
  font-size: var(--nav-rail-row-text);
  text-decoration: none;
  position: relative;
}

.eca-nav-rail .eca-menu__section > .item:hover,
.eca-nav-rail__flyout > .item:hover {
  background: var(--color-surface-sunken);
  text-decoration: none;
}

/* One current-page signal inside the rail: the tinted left marker the prototype measured. The
 * shared menu draws its marker UNDER the label; inside a rail the two would sit on the same row,
 * so the rail keeps one and suppresses the shared one (one state, one mark). */
/* The current row's state is its ground and ink, not a coloured leading rule or a rounded pill.
 * The 2 px border stays TRANSPARENT so removing the accent does not shift the label by 2 px; the
 * radius is 0 so the highlight is a rectangular band. Non-current rows keep their own radius. */
.eca-nav-rail .eca-menu__section > .item[aria-current],
.eca-nav-rail__flyout > .item[aria-current] {
  border-inline-start-color: transparent;
  border-radius: 0;
  background: color-mix(in oklab, var(--color-primary) 9%, var(--color-surface));
  color: var(--color-primary);
  font-weight: 600;
}

.eca-nav-rail .eca-menu__section > .item::after { display: none; }

.eca-nav-rail__label { min-width: 0; }

.eca-nav-rail__count {
  margin-inline-start: auto;
  padding-inline: var(--space-1);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-pill);
  background: var(--color-surface-sunken);
  color: var(--color-muted);
  font-size: var(--text-xs);
  font-weight: 600;
  white-space: nowrap;
}

.eca-nav-rail__flyout > .item[aria-current] .eca-nav-rail__count {
  border-color: var(--color-primary);
  background: var(--color-surface);
  color: var(--color-primary);
}

/* ── collapsed rail: peek and the section flyout ──────────────────────────────────────────────── */

/* A peek must sit to the RIGHT of the 56 px bar and never cover an open panel. */
.eca-nav-rail__peek {
  position: fixed;
  inset-block-start: 0;
  inset-inline-start: var(--nav-rail-bar);
  z-index: 96;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-3);
  border: 1px solid var(--color-line);
  border-inline-start: 0;
  border-radius: 0 var(--radius-field) var(--radius-field) 0;
  background: var(--color-surface);
  box-shadow: var(--shadow-3);
  color: var(--color-ink);
  font-size: var(--text-sm);
  font-weight: 600;
  white-space: nowrap;
}

.eca-nav-rail__peek-name { font-weight: 600; }

.eca-nav-rail__flyout {
  position: fixed;
  inset-block-start: 0;
  inset-inline-start: var(--nav-rail-bar);
  z-index: 95;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  width: var(--nav-rail-flyout);
  max-height: 70vh;
  overflow-y: auto;
  padding: var(--space-1) 0 var(--space-2);
  border: 1px solid var(--color-line);
  border-inline-start: 0;
  border-radius: 0 var(--radius-box) var(--radius-box) 0;
  background: var(--color-surface);
  box-shadow: var(--shadow-3);
}

.eca-nav-rail__flyout-title {
  padding: var(--space-1) var(--space-3);
  background: var(--color-surface-sunken);
  border-block: 1px solid var(--color-line);
  color: color-mix(in oklab, var(--color-ink) 80%, var(--color-surface-sunken));
  font-size: var(--nav-rail-title);
  font-weight: 650;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
}

.eca-nav-rail[data-nav="expanded"] .eca-nav-rail__peek,
.eca-nav-rail[data-nav="expanded"] .eca-nav-rail__flyout { display: none; }

/* The script shows/hides these three with the `hidden` attribute. A component rule that sets
 * `display` would otherwise beat the UA's `[hidden]` rule — the same defect `.eca-repeat__remove`
 * was written for. Stated here, once, for every element this island owns. */
.eca-nav-rail__peek[hidden],
.eca-nav-rail__flyout[hidden],
.eca-nav-rail__scrim[hidden] { display: none; }

/* ── help: a hover/focus popover, no close button ─────────────────────────────────────────────── */

.eca-nav-rail__help { position: relative; flex: none; }

.eca-nav-rail__help-pop {
  display: none;
  position: absolute;
  z-index: 120;
  /* 10 px to the RIGHT of the button, top-aligned at -6 px: one rule, anchored to its trigger. */
  inset-block-start: -6px;
  inset-inline-start: calc(100% + 10px);
  width: max-content;
  max-width: min(18.75rem, calc(100vw - var(--nav-rail-width) - var(--space-4)));
  padding: var(--space-3);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-box);
  background: var(--color-surface);
  box-shadow: var(--shadow-3);
  color: var(--color-ink);
  font-size: var(--text-sm);
  line-height: var(--leading-normal);
  text-align: start;
}

.eca-nav-rail__help:hover .eca-nav-rail__help-pop,
.eca-nav-rail__help:focus-within .eca-nav-rail__help-pop { display: block; }

.eca-nav-rail__help-row {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
}

.eca-nav-rail__help-row + .eca-nav-rail__help-row { margin-block-start: var(--space-1); }

.eca-nav-rail__kbd {
  flex: none;
  min-width: 1.625rem;
  padding: 1px var(--space-1);
  border: 1px solid var(--color-line);
  border-block-end-width: 2px;
  border-radius: var(--radius-field);
  background: var(--color-surface-sunken);
  font-family: inherit;
  font-size: var(--nav-rail-title);
  text-align: center;
}

.eca-nav-rail__muted { color: var(--color-muted); }

/* ── ≥900: the drawer becomes the column, beside the page ─────────────────────────────────────── */

@media (min-width: 900px) {
  .eca-nav-rail {
    position: static;
    inset: auto;
    width: var(--nav-rail-width);
    min-height: 0;
    box-shadow: none;
    transition: width var(--motion-fast) ease;
  }

  .eca-nav-rail[data-nav="collapsed"] { width: var(--nav-rail-bar); }

  .eca-nav-rail__drawer-toggle { display: none; }

  .eca-nav-rail__scrim {
    position: static;
    display: none;
  }
}
