/* ==========================================================================
   Shell B — complex-portal sidebar (Syncfusion EJ2 Sidebar, "Responsive Panel")
   Loaded by _Layout.cshtml only. Every selector targets classes/ids that only
   _Layout emits (.torrec-has-sb, .torrec-app__main, #torrecSidebar, .torrec-sb*,
   .torrec-sb-* state classes), so nothing here reaches _LayoutPlatform/_LayoutBare.

   Three modes, chosen by viewport width (same breakpoints in _Layout's head
   script and wwwroot/js/portal-sidebar.js):

     mobile  < 768px     hidden; slides in over the page as a drawer
     tablet  768–1199    docked 76px icon rail; expands over the page
     desktop ≥ 1200px    pinned open (272px) beside the content, or docked
                         to the icon rail if the user chose that

   State classes on <html> (set before first paint by _Layout's head script,
   kept current by portal-sidebar.js):
     .torrec-has-sb            a sidebar exists on this page (server-rendered)
     .torrec-sb-mode-{mobile|tablet|desktop}
     .torrec-sb-docked         the rail is showing as icons only
     .torrec-sb-is-open        the rail is expanded (pinned or floating)
     .torrec-sb-floating       expanded OVER the page (mobile/tablet) — scrim, close button, focus trap
     .torrec-sb-ready          settled after load; transitions are allowed from here on
     .torrec-sb-fallback       EJ2 never constructed the Sidebar; CSS alone positions it

   Geometry is owned by EJ2 once it has constructed the control (inline width +
   transform on the rail, inline margin-left on .e-main-content). The
   "#torrecSidebar:not(.e-sidebar)" rules reproduce the same geometry for the
   moment before construction and for the fallback, and the "Load-time hold"
   rules below cover the gap between construction and portal-sidebar.js, so
   the page never jumps.
   ========================================================================== */

/* ---- Tokens ---------------------------------------------------------------
   The rail is always a deep brand surface, in both themes: a teal "tower" column
   with the terracotta accent marking where you are. Contrast (WCAG 2.x):
     --sb-ink        on --sb-bg-bottom ≈ 9.6:1
     --sb-ink-muted  on --sb-bg-bottom ≈ 6.1:1
     --sb-accent     on --sb-bg-bottom ≈ 5.0:1  (icon/indicator only, never body text) */
#torrecSidebar {
  --sb-w: 272px;
  --sb-dock: 76px;
  --sb-bg-top: #6F6B67;
  --sb-bg-bottom: #232120;
  --sb-glow: rgba(246, 243, 240, .14);
  --sb-ink: rgba(255, 255, 255, .84);
  --sb-ink-strong: #FFFFFF;
  --sb-ink-muted: rgba(255, 255, 255, .64);
  --sb-line: rgba(255, 255, 255, .10);
  --sb-hover: rgba(255, 255, 255, .07);
  --sb-tile: rgba(255, 255, 255, .07);
  --sb-aqua: #ECE7E2;
  --sb-accent: #F08A5D;          /* --torrec-terracotta lifted for contrast on teal */
  --sb-accent-rgb: 240, 138, 93;
  --sb-focus: #ECE7E2;
  --sb-skyline: rgba(255, 255, 255, .045);
  --sb-dur: 260ms;
}
/* Dark palette: the teal drops to a graphite-teal so the rail doesn't glow
   against the #161513 page; the accent and aqua stay. Duplicated for the OS
   preference and the explicit toggle, like the tokens in torrec-theme.css. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) #torrecSidebar {
    --sb-bg-top: #242322;
    --sb-bg-bottom: #151413;
    --sb-glow: rgba(210, 203, 196, .14);
    --sb-skyline: rgba(255, 255, 255, .035);
  }
}
:root[data-theme="dark"] #torrecSidebar {
  --sb-bg-top: #242322;
  --sb-bg-bottom: #151413;
  --sb-glow: rgba(210, 203, 196, .14);
  --sb-skyline: rgba(255, 255, 255, .035);
}

/* ---- Page frame -------------------------------------------------------------
   The header, content and footer now sit inside .torrec-app__main (the element
   EJ2 offsets), so the body-level sticky-footer rules in torrec-theme.css are
   restated one level down. */
.torrec-app__main {
  display: flex;
  flex-direction: column;
  flex: 1 0 auto;
  min-width: 0;
  min-height: 100vh;
  min-height: 100dvh;
}
.torrec-app__main > header { flex-shrink: 0; }

/* Content column beside the rail — replaces .torrec-layout--with-sidebar, whose
   width maths included the old in-flow 240px sidebar. */
.torrec-layout.torrec-layout--app {
  width: 100%;
  max-width: calc(1200px + 3rem);
  margin-inline: auto;
  padding-inline: 1.5rem;
}
@media (max-width: 767.98px) {
  .torrec-layout.torrec-layout--app { padding-inline: 1rem; }
}

/* Margin for the content before EJ2 sets it inline (and in the fallback). */
.torrec-has-sb .torrec-app__main { margin-left: 272px; }
.torrec-has-sb.torrec-sb-docked .torrec-app__main { margin-left: 76px; }
.torrec-has-sb.torrec-sb-mode-mobile .torrec-app__main { margin-left: 0; }
@media (max-width: 767.98px) {
  .torrec-has-sb .torrec-app__main { margin-left: 0; }
}

/* Load-time hold: keep the pre-init geometry until portal-sidebar.js has settled.
   The Sidebar is built inside <ejs-scripts> as isOpen=false + enableDock, so EJ2
   first lays it out as a closed 76px rail and writes margin-left:76px onto
   .e-main-content. portal-sidebar.js only opens it after the browser has fetched
   site.js and portal-sidebar.js, and the browser paints a frame in that gap, so on
   every page load the content jumped left 196px and back (the "whole page
   reloads" blink, measured 2026-11-13 as two layout shifts around first paint).
   Until .torrec-sb-ready, the state classes the head script already set win over
   EJ2's inline styles. sync() writes the same values, so releasing the hold moves
   nothing. Don't remove without recording layout-shift entries on a page change. */
.torrec-has-sb:not(.torrec-sb-ready) #torrecSidebar {
  width: var(--sb-w) !important;
  transform: none !important;
  visibility: visible !important;
}
.torrec-has-sb.torrec-sb-docked:not(.torrec-sb-ready) #torrecSidebar {
  width: var(--sb-dock) !important;
}
.torrec-has-sb.torrec-sb-mode-mobile:not(.torrec-sb-ready) #torrecSidebar {
  transform: translateX(-100%) !important;
  visibility: hidden !important;
}
.torrec-has-sb:not(.torrec-sb-ready) .torrec-app__main {
  margin-left: 272px !important;
  transform: none !important;
}
.torrec-has-sb.torrec-sb-docked:not(.torrec-sb-ready) .torrec-app__main { margin-left: 76px !important; }
.torrec-has-sb.torrec-sb-mode-mobile:not(.torrec-sb-ready) .torrec-app__main { margin-left: 0 !important; }
@media (max-width: 767.98px) {
  .torrec-has-sb:not(.torrec-sb-ready) .torrec-app__main { margin-left: 0 !important; }
  html.torrec-has-sb:not(.torrec-sb-is-open):not(.torrec-sb-ready) #torrecSidebar {
    transform: translateX(-100%) !important;
    visibility: hidden !important;
  }
}

/* A page that grows taller than the window once its grids and charts load used to
   gain a scrollbar mid-load and shift everything 15px sideways (Windows browsers
   draw classic scrollbars). Reserving the gutter keeps the layout still. */
html.torrec-has-sb { scrollbar-gutter: stable; }

/* ---- Header changes in this shell ------------------------------------------ */
/* The rail carries the logo from tablet up, so the header drops its own copy. */
.torrec-has-sb:not(.torrec-sb-mode-mobile) .torrec-navbar .torrec-brand { display: none; }
@media (max-width: 767.98px) {
  .torrec-has-sb .torrec-navbar .torrec-brand { display: inline-flex; }
}
/* With the brand gone, keep avatar + user menu on the right. */
.torrec-has-sb .torrec-headerbar { margin-left: auto; }

/* Header button: hamburger on phones, "expand" on tablets. Desktop docks from
   the rail's own foot instead. */
.torrec-sbtoggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  margin-right: .5rem;
  padding: 0;
  border: 1px solid var(--torrec-border);
  border-radius: 10px;
  background: var(--torrec-surface-2);
  color: var(--torrec-text);
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
  transition: border-color .15s ease, color .15s ease, background-color .15s ease;
}
.torrec-sbtoggle:hover,
.torrec-sbtoggle:focus-visible {
  border-color: var(--torrec-teal);
  color: var(--torrec-teal);
}
.torrec-sbtoggle:focus-visible {
  outline: var(--torrec-focus-ring);
  outline-offset: var(--torrec-focus-offset);
}
.torrec-sb-mode-desktop .torrec-sbtoggle { display: none; }

/* ---- The rail ---------------------------------------------------------------- */
#torrecSidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  height: 100vh;
  height: 100dvh;
  z-index: 1042;               /* above the header (1030) and the scrim (1041); below the assistant (1045) */
  overflow: hidden;            /* the nav scrolls inside; the brand and the foot stay put */
  color: var(--sb-ink);
  background:
    radial-gradient(130% 55% at 0% 0%, var(--sb-glow), transparent 62%),
    linear-gradient(180deg, var(--sb-bg-top) 0%, var(--sb-bg-bottom) 100%);
  border-right: 0;
  box-shadow: 1px 0 0 rgba(0, 0, 0, .10);
  font-family: var(--torrec-font-sans);
}
/* EJ2's own .e-sidebar rule paints a theme background and hides closed panels;
   the rail is always visible except when it is a closed phone drawer. */
#torrecSidebar.e-sidebar {
  background:
    radial-gradient(130% 55% at 0% 0%, var(--sb-glow), transparent 62%),
    linear-gradient(180deg, var(--sb-bg-top) 0%, var(--sb-bg-bottom) 100%);
  visibility: visible;
  overflow: hidden;
}
.torrec-sb-floating #torrecSidebar {
  box-shadow: 18px 0 44px rgba(17, 16, 15, .38);
}

/* Pre-init + fallback geometry (see header). */
#torrecSidebar:not(.e-sidebar) { width: var(--sb-w); }
.torrec-sb-docked #torrecSidebar:not(.e-sidebar) { width: var(--sb-dock); }
.torrec-sb-mode-mobile #torrecSidebar:not(.e-sidebar) {
  width: var(--sb-w);
  transform: translateX(-100%);
  visibility: hidden;
}
.torrec-sb-mode-mobile.torrec-sb-is-open #torrecSidebar:not(.e-sidebar) {
  transform: none;
  visibility: visible;
}
@media (max-width: 767.98px) {
  html:not(.torrec-sb-is-open) #torrecSidebar:not(.e-sidebar) {
    transform: translateX(-100%);
    visibility: hidden;
  }
}

/* Closed phone drawer: off-canvas AND hidden, so nothing inside it can take
   focus. Visibility flips after the slide-out, not before it. */
.torrec-sb-mode-mobile #torrecSidebar.e-sidebar.e-close {
  transform: translateX(-100%) !important;
  visibility: hidden;
}

/* Motion — only after the page has settled, so loading a page never animates
   the rail into place. EJ2's own 0.5s is tightened to the portal's curve. */
.torrec-has-sb:not(.torrec-sb-ready) #torrecSidebar,
.torrec-has-sb:not(.torrec-sb-ready) .torrec-app__main {
  transition: none !important;
}
.torrec-sb-ready #torrecSidebar,
.torrec-sb-ready #torrecSidebar.e-sidebar.e-transition {
  transition:
    width var(--sb-dur) var(--torrec-ease-out),
    transform var(--sb-dur) var(--torrec-ease-out),
    box-shadow var(--sb-dur) var(--torrec-ease-out),
    visibility 0s linear 0s;
}
.torrec-sb-ready.torrec-sb-mode-mobile #torrecSidebar.e-close {
  transition:
    transform var(--sb-dur) var(--torrec-ease-out),
    visibility 0s linear var(--sb-dur);
}
.torrec-sb-ready .torrec-app__main {
  transition: margin-left var(--sb-dur) var(--torrec-ease-out);
}

/* Scrim behind the floating rail. EJ2 appends .e-sidebar-overlay to <body>
   (showBackdrop); it is restyled here to the portal's tint. The fallback has no
   EJ2 overlay, so it gets the same look from body::after — a click on it lands
   on <body>, which portal-sidebar.js treats as "outside" and closes. */
.torrec-app > .e-sidebar-overlay {
  z-index: 1041;
  opacity: 1;
  background-color: rgba(20, 20, 19, .46);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}
.torrec-sb-fallback.torrec-sb-floating body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 1041;
  background-color: rgba(20, 20, 19, .46);
}
.torrec-sb-floating body { overflow: hidden; }

/* ---- Layout inside the rail --------------------------------------------------- */
.torrec-sb {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-width: 0;
}
/* Grafito y barro: the band's fine grain, a little light at the top, and a hairline of light where the rail
   meets the page (rebrand_flow_plan.md §0). */
.torrec-sb::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, .014) 0 1px, transparent 1px 4px),
    linear-gradient(180deg, rgba(255, 255, 255, .05), transparent 30%);
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, .08);
  pointer-events: none;
}

/* Brand block.
   Its height IS the header's height: both read --torrec-header-h (declared in
   torrec-theme.css :root, stepped per breakpoint there), so the hairline below
   and the header's bottom edge are the same y in every mode — phone drawer,
   tablet rail (docked or floating) and desktop. The header's 3px accent bar
   sits INSIDE that height, at its bottom; the hairline is the same thickness
   (--torrec-accent-h) and also sits at the bottom, so the two read as one line
   running from the rail into the header. Premium-pages sprint, Phase 0. */
.torrec-sb__brand {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: .5rem;
  box-sizing: border-box;
  height: var(--torrec-header-h, 72px);
  min-height: 0;
  flex: 0 0 auto;
  padding: 0 .9rem 0 1.1rem;
}
.torrec-sb__brand::after {   /* echo of the header's accent bar — same y, same thickness */
  content: "";
  position: absolute;
  left: 1.1rem;
  right: 1.1rem;
  bottom: 0;
  height: var(--torrec-accent-h, 3px);
  border-radius: 3px 3px 0 0;
  background: linear-gradient(90deg, rgba(var(--sb-accent-rgb), .75), var(--sb-line) 45%, transparent);
}
.torrec-sb__brandlink {
  display: inline-flex;
  align-items: center;
  gap: .65rem;
  min-width: 0;
  flex: 1 1 auto;
  border-radius: 10px;
  color: var(--sb-ink-strong);
  text-decoration: none;
}
.torrec-sb__brandlink:hover { color: var(--sb-ink-strong); }
.torrec-sb__mark {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  color: var(--sb-aqua);
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, .25));
}
.torrec-sb__mark-cap { fill: var(--sb-accent); }
.torrec-sb__wordmark {
  font-family: var(--torrec-font-display);
  font-weight: 700;
  font-size: 1.4rem;
  letter-spacing: -.02em;
  line-height: 1;
  white-space: nowrap;
}
.torrec-sb__wordmark b { color: var(--sb-accent); font-size: 1.18em; }

.torrec-sb__close {
  display: none;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--sb-line);
  border-radius: 999px;
  background: var(--sb-tile);
  color: var(--sb-ink);
  font-size: .95rem;
  cursor: pointer;
  transition: background-color .15s ease, color .15s ease;
}
.torrec-sb__close:hover { background: rgba(255, 255, 255, .14); color: var(--sb-ink-strong); }
.torrec-sb-floating #torrecSidebar .torrec-sb__close { display: inline-flex; }

/* Scrolling nav */
.torrec-sb__nav {
  position: relative;
  z-index: 1;
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: .85rem 0 1.25rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, .18) transparent;
}
.torrec-sb__nav::-webkit-scrollbar { width: 8px; }
.torrec-sb__nav::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, .16);
  border-radius: 8px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
.torrec-sb__list,
.torrec-sb__items {
  list-style: none;
  margin: 0;
  padding: 0;
}

/* Items */
.torrec-sb__item {
  position: relative;
  display: flex;
  align-items: center;
  gap: .75rem;
  min-height: 40px;
  margin: 1px .6rem;
  padding: .5rem .75rem .5rem .8rem;
  border-radius: 10px;
  color: var(--sb-ink);
  font-size: .9rem;
  font-weight: 500;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color .15s ease, color .15s ease;
}
.torrec-sb__item:hover {
  background-color: var(--sb-hover);
  color: var(--sb-ink-strong);
}
.torrec-sb__icon {
  flex: 0 0 auto;
  width: 1.25rem;
  font-size: 1.1rem;
  line-height: 1;
  text-align: center;
  color: var(--sb-ink-muted);
  transition: color .15s ease, transform var(--torrec-dur-fast) var(--torrec-ease-out);
}
.torrec-sb__item:hover .torrec-sb__icon { color: var(--sb-aqua); }
.torrec-sb__label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Live counter on an entry (Votaciones: open votes still awaiting this unit's ballot, GitHub issue #140). */
.torrec-sb__badge {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  min-width: 1.35rem;
  height: 1.35rem;
  margin-left: auto;
  padding-inline: .38rem;
  border-radius: 999px;
  background: var(--sb-accent);
  color: #1F1D1C;
  font-size: .7rem;
  font-weight: 700;
  line-height: 1;
  box-shadow: 0 0 0 2px rgba(var(--sb-accent-rgb), .22);
}
.torrec-sb__badge[hidden] { display: none; }

/* Current page: warm tint + a glowing terracotta bar on the rail's guide line. */
.torrec-sb__item.is-active {
  color: var(--sb-ink-strong);
  font-weight: 600;
  background: linear-gradient(90deg, rgba(var(--sb-accent-rgb), .26), rgba(var(--sb-accent-rgb), .07) 85%);
  box-shadow: inset 0 0 0 1px rgba(var(--sb-accent-rgb), .20);
}
.torrec-sb__item.is-active .torrec-sb__icon { color: var(--sb-accent); }
.torrec-sb__item.is-active::before {
  content: "";
  position: absolute;
  top: 8px;
  bottom: 8px;
  left: -.6rem;
  width: 4px;
  border-radius: 0 4px 4px 0;
  background: var(--sb-accent);
  box-shadow: 0 0 12px rgba(var(--sb-accent-rgb), .65);
}

/* Groups */
.torrec-sb__group { margin-top: .55rem; }
.torrec-sb__grouphead {
  display: flex;
  align-items: center;
  gap: .7rem;
  width: calc(100% - 1.2rem);
  margin: 0 .6rem .15rem;
  padding: .4rem .6rem .4rem .45rem;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--sb-ink-muted);
  font-family: inherit;
  font-size: .7rem;
  font-weight: 600;
  letter-spacing: .1em;
  line-height: 1.2;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color .15s ease, color .15s ease;
}
.torrec-sb__grouphead:hover {
  background: var(--sb-hover);
  color: var(--sb-ink-strong);
}
.torrec-sb__groupicon {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--sb-tile);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .06);
  color: var(--sb-aqua);
  font-size: .95rem;
  letter-spacing: 0;
}
.torrec-sb__grouplabel {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.torrec-sb__chevron {
  flex: 0 0 auto;
  font-size: .7rem;
  opacity: .7;
  transition: transform var(--torrec-dur-base) var(--torrec-ease-out);
}
.torrec-sb__group.is-collapsed .torrec-sb__chevron { transform: rotate(-90deg); }
.torrec-sb__group.is-current .torrec-sb__groupicon {
  background: rgba(var(--sb-accent-rgb), .18);
  box-shadow: inset 0 0 0 1px rgba(var(--sb-accent-rgb), .28);
  color: var(--sb-accent);
}
.torrec-sb__group.is-current .torrec-sb__grouplabel { color: var(--sb-ink-strong); }

/* Collapsible panel — a 1fr ⇄ 0fr grid row animates to the content's real
   height. visibility (delayed on close) keeps collapsed links out of Tab order. */
.torrec-sb__collapse {
  display: grid;
  grid-template-rows: 1fr;
  visibility: visible;
}
.torrec-sb__collapse > .torrec-sb__items { min-height: 0; overflow: hidden; }
.torrec-sb__group.is-collapsed .torrec-sb__collapse {
  grid-template-rows: 0fr;
  visibility: hidden;
}
.torrec-sb-ready .torrec-sb__collapse {
  transition: grid-template-rows var(--torrec-dur-base) var(--torrec-ease-out), visibility 0s linear 0s;
}
.torrec-sb-ready .torrec-sb__group.is-collapsed .torrec-sb__collapse {
  transition: grid-template-rows var(--torrec-dur-base) var(--torrec-ease-out), visibility 0s linear var(--torrec-dur-base);
}

/* Tree guide: items hang off a hairline under the group's icon tile. The
   active bar (::before) lands exactly on that line. */
.torrec-sb__group .torrec-sb__items {
  margin-left: calc(.6rem + .45rem + 13px);
  border-left: 1px solid var(--sb-line);
}
.torrec-sb__group .torrec-sb__item {
  margin-left: .5rem;
  padding-left: .7rem;
}
.torrec-sb__group .torrec-sb__item.is-active::before { left: calc(-.5rem - 2px); }

/* Foot: dock toggle (desktop only) */
.torrec-sb__foot {
  position: relative;
  z-index: 1;
  display: none;
  padding: .6rem .6rem calc(.75rem + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--sb-line);
  background: linear-gradient(to top, var(--sb-bg-bottom) 55%, transparent);
}
.torrec-sb-mode-desktop .torrec-sb__foot { display: block; }
.torrec-sb__dock {
  display: flex;
  align-items: center;
  gap: .7rem;
  width: 100%;
  min-height: 40px;
  padding: .5rem .8rem;
  border: 1px solid var(--sb-line);
  border-radius: 10px;
  background: rgba(255, 255, 255, .04);
  color: var(--sb-ink-muted);
  font-family: inherit;
  font-size: .82rem;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}
.torrec-sb__dock:hover {
  background: var(--sb-hover);
  border-color: rgba(255, 255, 255, .18);
  color: var(--sb-ink-strong);
}
.torrec-sb__dockicon {
  flex: 0 0 auto;
  width: 1.25rem;
  text-align: center;
  transition: transform var(--sb-dur) var(--torrec-ease-out);
}

/* Decorative skyline */
.torrec-sb__skyline {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 0;
  width: 100%;
  height: 120px;
  fill: var(--sb-skyline);
  pointer-events: none;
}
.torrec-sb__skyline .torrec-sb__skyline-cap { fill: rgba(var(--sb-accent-rgb), .35); }

/* ---- Docked rail (icons only) -------------------------------------------------
   Labels are clipped, not display:none, so every link keeps its accessible
   name; sighted users get the label from the hover/focus tooltip instead. */
.torrec-sb-docked #torrecSidebar .torrec-sb__brand {
  justify-content: center;
  padding-inline: 0;
}
.torrec-sb-docked #torrecSidebar .torrec-sb__brand::after { left: 16px; right: 16px; }
.torrec-sb-docked #torrecSidebar .torrec-sb__brandlink { flex: 0 0 auto; }
.torrec-sb-docked #torrecSidebar .torrec-sb__wordmark,
.torrec-sb-docked #torrecSidebar .torrec-sb__label,
.torrec-sb-docked #torrecSidebar .torrec-sb__docklabel {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}
.torrec-sb-docked #torrecSidebar .torrec-sb__item {
  justify-content: center;
  margin-inline: .7rem;
  padding-inline: 0;
}
.torrec-sb-docked #torrecSidebar .torrec-sb__icon { font-size: 1.2rem; }
/* Docked to icons there is no room beside the label: the counter rides on the icon's corner. */
.torrec-sb-docked #torrecSidebar .torrec-sb__badge {
  position: absolute;
  top: 2px;
  right: 6px;
  min-width: 1.1rem;
  height: 1.1rem;
  padding-inline: .25rem;
  font-size: .62rem;
}
.torrec-sb-docked #torrecSidebar .torrec-sb__item.is-active::before { left: -.7rem; }
/* Groups flatten to icon runs separated by a hairline; every group shows its
   items (a collapsed group would hide destinations behind nothing). */
.torrec-sb-docked #torrecSidebar .torrec-sb__grouphead { display: none; }
.torrec-sb-docked #torrecSidebar .torrec-sb__group {
  margin: .5rem 1rem 0;
  padding-top: .5rem;
  border-top: 1px solid var(--sb-line);
}
.torrec-sb-docked #torrecSidebar .torrec-sb__group .torrec-sb__items {
  margin-left: 0;
  border-left: 0;
}
.torrec-sb-docked #torrecSidebar .torrec-sb__group .torrec-sb__item {
  margin-inline: -.3rem;
  padding-left: 0;
}
.torrec-sb-docked #torrecSidebar .torrec-sb__group .torrec-sb__item.is-active::before { left: -1rem; }
.torrec-sb-docked #torrecSidebar .torrec-sb__group.is-collapsed .torrec-sb__collapse {
  grid-template-rows: 1fr;
  visibility: visible;
}
.torrec-sb-docked #torrecSidebar .torrec-sb__dock { justify-content: center; padding-inline: 0; }
.torrec-sb-docked #torrecSidebar .torrec-sb__dockicon { transform: rotate(180deg); }

/* Tooltip for the docked rail (portal-sidebar.js appends one to <body>). */
.torrec-sb-tip {
  position: fixed;
  z-index: 1046;
  max-width: 240px;
  padding: .38rem .65rem;
  border-radius: 8px;
  background: #1F1D1B;
  color: #FFFFFF;
  font-family: var(--torrec-font-sans);
  font-size: .8rem;
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
  box-shadow: var(--torrec-elev-3);
  pointer-events: none;
  opacity: 0;
  transform: translate(-4px, -50%);
  transition: opacity var(--torrec-dur-fast) ease, transform var(--torrec-dur-fast) var(--torrec-ease-out);
}
.torrec-sb-tip::before {
  content: "";
  position: absolute;
  top: 50%;
  left: -4px;
  width: 8px;
  height: 8px;
  background: inherit;
  transform: translateY(-50%) rotate(45deg);
  border-radius: 1px;
}
.torrec-sb-tip.is-visible { opacity: 1; transform: translate(0, -50%); }

/* ---- Focus ----------------------------------------------------------------------
   The portal's teal focus ring disappears on the teal rail; use a pale aqua
   ring, drawn inside so the scrolling nav never clips it. */
#torrecSidebar a:focus-visible,
#torrecSidebar button:focus-visible {
  outline: 2px solid var(--sb-focus);
  outline-offset: -2px;
}

/* ---- Motion preferences & print ------------------------------------------------ */
@media (prefers-reduced-motion: no-preference) {
  .torrec-sb__item.is-active::before {
    animation: torrec-sb-indicator 260ms var(--torrec-ease-out);
  }
}
@keyframes torrec-sb-indicator {
  from { transform: scaleY(.2); opacity: 0; }
  to   { transform: scaleY(1); opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  #torrecSidebar,
  #torrecSidebar *,
  .torrec-has-sb .torrec-app__main,
  .torrec-sb-tip {
    transition: none !important;
    animation: none !important;
  }
}

@media print {
  #torrecSidebar,
  .torrec-sbtoggle,
  .e-sidebar-overlay,
  .torrec-sb-tip { display: none !important; }
  .torrec-has-sb .torrec-app__main { margin-left: 0 !important; }
}
