/* ZenithUI — Sidebar / NavGroup / NavItem / ThemeToggle
 * All colors via --zen-* variables so theme/palette switching applies automatically.
 * Use position: sticky for header/footer inside a scrollable body — works inside any
 * flex/grid layout the consumer provides.
 */

/* ─────────────────────────────────────────────────────────────────
   UNLAYERED resets — needed to win against the host app's unlayered
   global link resets (e.g. `a { text-decoration: underline }`) which
   ship without @layer. Unlayered rules ALWAYS beat @layer rules per CSS
   spec, so the rules below — kept minimal — guarantee correct render
   regardless of what the consumer loads alongside ZenithUI.
   Higher specificity (compound `.zen-sidebar a.zen-sidebar__item`)
   plus `:where()` for state colors keeps the resets robust without
   blocking consumer overrides.
   ───────────────────────────────────────────────────────────────── */
.zen-sidebar a.zen-sidebar__item,
.zen-sidebar a.zen-sidebar__item:hover,
.zen-sidebar a.zen-sidebar__item:focus,
.zen-sidebar a.zen-sidebar__item:visited {
  text-decoration: none;
  color: var(--zen-shell-text-secondary, var(--zen-text-secondary));
}

.zen-sidebar a.zen-sidebar__item:hover {
  color: var(--zen-shell-text, var(--zen-text-primary));
}

/* Active item text is MAX contrast (not accent) — the accent lives in the
   3px edge; the identity gesture is edge + elevated surface + strong text. */
.zen-sidebar a.zen-sidebar__item--active,
.zen-sidebar a.zen-sidebar__item--active:hover,
.zen-sidebar a.zen-sidebar__item--active:focus {
  color: var(--zen-shell-text, var(--zen-text-primary));
}

@layer zenith-components {

  /* ─────────────────────────────────────────────
     Wrapper
     ───────────────────────────────────────────── */
  .zen-sidebar {
    display: flex;
    flex-direction: column;
    width: var(--zen-sidebar-width, 260px);
    /* Fixed at viewport height — NOT min-height. The consumer typically mounts
       the sidebar in a flex row layout, where flex items default to
       `align-items: stretch`. With min-height (a floor, not a ceiling), the
       flex stretch will grow the sidebar to the height of the tallest sibling
       (often the main content area, which can be 2-3x the viewport on long
       pages). That defeats `position: sticky` because there is no remaining
       scroll space for the sidebar to "stick" against. Using a fixed `height`
       caps the size regardless of flex behavior; the inner .zen-sidebar__nav
       already handles overflow when nav content itself exceeds the viewport. */
    height: 100vh;
    /* Warm dark drawer in BOTH themes — the shell is the identity layer; the
       content canvas follows the user's theme. --zen-sidebar-bg remains the
       consumer hook to tint or replace the drawer surface. */
    background: var(--zen-sidebar-bg, var(--zen-shell-bg, var(--zen-bg-surface)));
    border-right: 1px solid var(--zen-shell-border, var(--zen-border));
    color: var(--zen-shell-text, var(--zen-text-primary));
    /* The shell speaks the suite's typeface even when the host page doesn't. */
    font-family: var(--zen-font-family, system-ui, sans-serif);
    transition: width 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
    position: sticky;
    top: 0;
    /* Expanded: overflow visible so footer popovers (ZenPaletteSwitcher menu) can escape upward.
       The inner .zen-sidebar__nav handles its own vertical scroll. NOTE: overflow-x:hidden with
       overflow-y:visible makes the browser clamp overflow-y to auto (CSS spec) — which would clip the
       popover. So horizontal clipping is applied ONLY when collapsed (where label overflow matters). */
    overflow: visible;
  }

  .zen-sidebar--collapsed {
    width: var(--zen-sidebar-collapsed-width, 64px);
    overflow-x: hidden;
  }

  /* ─────────────────────────────────────────────
     Brand
     ───────────────────────────────────────────── */
  .zen-sidebar__brand {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--zen-space-2, 8px);
    /* Same height as the topbar so the brand row and topbar form one continuous strip. */
    height: var(--zen-topbar-height, 56px);
    padding: 0 var(--zen-space-3, 12px);
    /* Same 2px accent edge as the topbar — the two form one continuous top
       strip, landed by a single full-width accent line. */
    border-bottom: 2px solid var(--zen-accent);
    flex-shrink: 0;
    box-sizing: border-box;
  }

  .zen-sidebar__brand-content {
    display: flex;
    align-items: center;
    gap: var(--zen-space-2, 8px);
    flex: 1;
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
  }

  /* In collapsed mode hide brand-content entirely (display: none) — width: 0
     alone is not enough because flex: 1 still claims grow space, which pushes
     the chevron toggle off-center even with justify-content: center. */
  .zen-sidebar--collapsed .zen-sidebar__brand-content {
    display: none;
  }

  /* Center the chevron toggle horizontally so it lines up with the icon
     column below. Padding goes to 0 so the button itself is the centered item. */
  .zen-sidebar--collapsed .zen-sidebar__brand {
    justify-content: center;
    padding-left: 0;
    padding-right: 0;
  }

  .zen-sidebar__icon-btn {
    flex-shrink: 0;
    width: var(--zen-control-h);
    height: var(--zen-control-h);
    /* Subtle border + strong text so the collapse control is discoverable, not invisible (Bolsón F13). */
    border: 1px solid var(--zen-shell-border, var(--zen-border));
    background: transparent;
    color: var(--zen-shell-text, var(--zen-text-primary));
    border-radius: var(--zen-radius-action);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.12s, color 0.12s, border-color 0.12s;
  }

  /* Warm/Material icon buttons are circular. */
  [data-zen-skin="warm"] .zen-sidebar__icon-btn,
  [data-zen-skin="material"] .zen-sidebar__icon-btn {
    border-radius: 50%;
  }

  .zen-sidebar__icon-btn:hover {
    background: var(--zen-shell-hover, var(--zen-bg-muted));
    color: var(--zen-shell-text, var(--zen-text-primary));
    border-color: var(--zen-shell-border, var(--zen-border));
  }

  .zen-sidebar__icon-btn:focus-visible {
    outline: none;
    box-shadow: var(--zen-focus-shadow);
  }

  .zen-sidebar__icon-btn svg {
    width: 16px;
    height: 16px;
  }

  /* ─────────────────────────────────────────────
     Nav body (scrollable)
     ───────────────────────────────────────────── */
  .zen-sidebar__nav {
    flex: 1 1 auto;
    overflow-y: auto;
    overflow-x: hidden;
    padding: var(--zen-space-2, 8px);
    display: flex;
    flex-direction: column;
    gap: var(--zen-space-1, 4px);
  }

  /* Breathing room between top-level groups (ZenNavParent) and the loose top items. */
  .zen-sidebar__nav > .zen-sidebar__parent {
    margin-top: var(--zen-space-2, 8px);
  }

  /* Custom scrollbar (subtle, theme-aware) */
  .zen-sidebar__nav::-webkit-scrollbar {
    width: 6px;
  }
  .zen-sidebar__nav::-webkit-scrollbar-thumb {
    background: var(--zen-shell-border, var(--zen-border));
    border-radius: 3px;
  }
  .zen-sidebar__nav::-webkit-scrollbar-thumb:hover {
    background: var(--zen-shell-text-muted, var(--zen-text-muted));
  }

  /* ─────────────────────────────────────────────
     NavGroup
     ───────────────────────────────────────────── */
  .zen-sidebar__group {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-top: var(--zen-space-4, 16px);
  }

  .zen-sidebar__group-label {
    font-size: 0.7rem;
    font-weight: var(--zen-font-weight-semibold, 600);
    text-transform: uppercase;
    /* Wide tracking on tiny uppercase — the section-label voice of the shell. */
    letter-spacing: 0.08em;
    color: var(--zen-shell-text-muted, var(--zen-text-muted));
    padding: var(--zen-space-1, 4px) var(--zen-space-3, 12px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    transition: opacity 0.15s;
  }

  .zen-sidebar--collapsed .zen-sidebar__group-label {
    opacity: 0;
    height: 0;
    padding: 0;
    margin: 0;
    pointer-events: none;
  }

  /* ─────────────────────────────────────────────
     NavItem
     ───────────────────────────────────────────── */
  .zen-sidebar__item {
    display: flex;
    align-items: center;
    gap: var(--zen-space-2, 10px);
    padding: 9px var(--zen-space-3, 12px);
    color: var(--zen-shell-text-secondary, var(--zen-text-secondary));
    text-decoration: none;
    border-radius: var(--zen-radius-menu);
    font-size: 0.9rem;
    font-weight: var(--zen-font-weight-medium, 500);
    transition: background 0.12s, color 0.12s, box-shadow 0.12s;
    cursor: pointer;
    border: 1px solid transparent;
    /* Accent bar slot on the left (transparent until active) — the "you are here" cue.
       Drawn with an inset box-shadow so it doesn't shift layout. */
    box-shadow: inset 3px 0 0 transparent;
    overflow: hidden;
    white-space: nowrap;
  }

  .zen-sidebar__item:hover {
    background: var(--zen-shell-hover, var(--zen-bg-muted));
    color: var(--zen-shell-text, var(--zen-text-primary));
  }

  .zen-sidebar__item:focus-visible {
    outline: none;
    box-shadow: var(--zen-focus-shadow), inset 3px 0 0 transparent;
  }

  /* Active = the identity gesture: 3px accent edge + slightly elevated warm
     surface + max-contrast text. The accent stays in the edge (and icon),
     not in the text — long-session legibility over decoration. */
  .zen-sidebar__item--active {
    background: var(--zen-shell-active, color-mix(in srgb, var(--zen-accent) 12%, transparent));
    color: var(--zen-shell-text, var(--zen-text-primary));
    font-weight: var(--zen-font-weight-semibold, 600);
    box-shadow: inset 3px 0 0 var(--zen-accent);
  }

  /* Warm/Material drop Standard's left accent bar — the tinted rounded surface alone is the cue. */
  [data-zen-skin="warm"] .zen-sidebar__item--active,
  [data-zen-skin="material"] .zen-sidebar__item--active {
    box-shadow: none;
  }

  .zen-sidebar__item--active:hover {
    background: color-mix(in srgb, var(--zen-shell-active, var(--zen-bg-muted)) 88%, white);
    color: var(--zen-shell-text, var(--zen-text-primary));
  }

  .zen-sidebar__item-icon {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    /* Icons pop with the active palette accent. Override per-app:
         .my-sidebar { --zen-sidebar-icon-color: var(--zen-text-secondary); } */
    color: var(--zen-sidebar-icon-color, var(--zen-accent));
    transition: color 0.12s;
  }

  .zen-sidebar__item-icon svg {
    width: 18px;
    height: 18px;
  }

  /* Hover/active keep the same accent (consistency); opacity pop on hover */
  .zen-sidebar__item:hover .zen-sidebar__item-icon {
    color: var(--zen-sidebar-icon-color-hover, var(--zen-accent-hover, var(--zen-accent)));
  }

  .zen-sidebar__item-label {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: opacity 0.15s;
  }

  .zen-sidebar--collapsed .zen-sidebar__item {
    justify-content: center;
    padding-left: 0;
    padding-right: 0;
  }

  /* Hide label and badge entirely with display: none — same reason as
     brand-content: the base rule has flex: 1 on the label, so width: 0 alone
     leaves the icon left-aligned because the label still claims grow space. */
  .zen-sidebar--collapsed .zen-sidebar__item-label,
  .zen-sidebar--collapsed .zen-sidebar__item-badge {
    display: none;
  }

  /* ─────────────────────────────────────────────
     Badge variants on NavItem
     ───────────────────────────────────────────── */
  .zen-sidebar__item-badge {
    flex-shrink: 0;
    padding: 1px 8px;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: var(--zen-font-weight-semibold, 600);
    line-height: 1.4;
    transition: opacity 0.15s;
  }

  .zen-sidebar__item-badge--info {
    background: var(--zen-info-muted);
    color: var(--zen-info-text, var(--zen-info));
  }
  .zen-sidebar__item-badge--success {
    background: var(--zen-success-muted);
    color: var(--zen-success-text, var(--zen-success));
  }
  .zen-sidebar__item-badge--warning {
    background: var(--zen-warning-muted);
    color: var(--zen-warning-text, var(--zen-warning));
  }
  .zen-sidebar__item-badge--danger {
    background: var(--zen-danger-muted);
    color: var(--zen-danger-text, var(--zen-danger));
  }
  .zen-sidebar__item-badge--neutral {
    background: var(--zen-shell-hover, var(--zen-bg-muted));
    color: var(--zen-shell-text-secondary, var(--zen-text-secondary));
  }
  .zen-sidebar__item-badge--default {
    background: var(--zen-shell-hover, var(--zen-bg-muted));
    color: var(--zen-shell-text-secondary, var(--zen-text-secondary));
  }

  /* Semantic badge text is mixed towards white so it clears the warm dark
     drawer in BOTH themes (the plain state colors are tuned per light/dark
     canvas, not for the fixed shell). */
  .zen-sidebar__item-badge--info    { color: color-mix(in srgb, var(--zen-info) 55%, white); }
  .zen-sidebar__item-badge--success { color: color-mix(in srgb, var(--zen-success) 55%, white); }
  .zen-sidebar__item-badge--warning { color: color-mix(in srgb, var(--zen-warning) 55%, white); }
  .zen-sidebar__item-badge--danger  { color: color-mix(in srgb, var(--zen-danger) 55%, white); }

  /* ─────────────────────────────────────────────
     NavParent (expandable sub-group)
     ───────────────────────────────────────────── */
  .zen-sidebar__parent {
    display: flex;
    flex-direction: column;
  }

  .zen-sidebar__parent-trigger {
    /* Inherits .zen-sidebar__item styling; this just adds parent-specific bits */
    width: 100%;
    text-align: left;
    background: transparent;
    border: 1px solid transparent;
    cursor: pointer;
    font-family: inherit;
  }

  .zen-sidebar__parent-trigger:focus-visible {
    outline: none;
    box-shadow: var(--zen-focus-shadow);
  }

  /* Subtle highlight on the parent itself when one of its children is active. */
  .zen-sidebar__parent--has-active > .zen-sidebar__parent-trigger {
    color: var(--zen-shell-text, var(--zen-text-primary));
  }

  /* Chevron rotates 90° when expanded */
  .zen-sidebar__parent-chevron {
    flex-shrink: 0;
    width: 14px;
    height: 14px;
    margin-left: auto;
    color: var(--zen-shell-text-muted, var(--zen-text-muted));
    transition: transform 0.18s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .zen-sidebar__parent-chevron svg {
    width: 14px;
    height: 14px;
  }

  .zen-sidebar__parent--expanded > .zen-sidebar__parent-trigger .zen-sidebar__parent-chevron {
    transform: rotate(90deg);
  }

  /* Children container — collapsed by default with grid trick for smooth height anim */
  .zen-sidebar__parent-children {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows 0.18s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
  }

  .zen-sidebar__parent--expanded > .zen-sidebar__parent-children {
    grid-template-rows: 1fr;
  }

  /* Single inner div is the only grid item — min-height: 0 lets the row collapse to 0. */
  .zen-sidebar__parent-children-inner {
    min-height: 0;
  }

  /* Depth-aware indent for nested ZenNavParent levels.
     Per CSS spec, using `--x: calc(var(--x, 0) + 1)` to "count" depth via a single
     cascading custom property is detected as a cycle and resolves to the fallback —
     so we use explicit descendant selectors instead. Specificity grows naturally with
     depth, so deeper rules win the cascade.
     Depth 1 step = icon width + gap = 28px (matches the parent's icon column).
     Depth 2+  step = 16px per additional level — visibly indented but tighter than
     the first level so deep trees stay readable.
     Both are exposed as custom properties so consumers can tune visually. */
  .zen-sidebar {
    --zen-nav-indent-first: calc(18px + var(--zen-space-2, 10px));  /* 28px */
    --zen-nav-indent-sub: 16px;                                       /* tighter for nested */
  }

  /* Depth 1 — direct child of ONE parent inner */
  .zen-sidebar__parent-children-inner > .zen-sidebar__item,
  .zen-sidebar__parent-children-inner > .zen-sidebar__parent > .zen-sidebar__parent-trigger {
    padding-left: calc(var(--zen-space-3, 12px) + var(--zen-nav-indent-first));
  }

  /* Depth 2 — nested two levels deep */
  .zen-sidebar__parent-children-inner .zen-sidebar__parent-children-inner > .zen-sidebar__item,
  .zen-sidebar__parent-children-inner .zen-sidebar__parent-children-inner > .zen-sidebar__parent > .zen-sidebar__parent-trigger {
    padding-left: calc(var(--zen-space-3, 12px) + var(--zen-nav-indent-first) + var(--zen-nav-indent-sub));
  }

  /* Depth 3 — nested three levels deep */
  .zen-sidebar__parent-children-inner .zen-sidebar__parent-children-inner .zen-sidebar__parent-children-inner > .zen-sidebar__item,
  .zen-sidebar__parent-children-inner .zen-sidebar__parent-children-inner .zen-sidebar__parent-children-inner > .zen-sidebar__parent > .zen-sidebar__parent-trigger {
    padding-left: calc(var(--zen-space-3, 12px) + var(--zen-nav-indent-first) + var(--zen-nav-indent-sub) * 2);
  }

  /* Depth 4 — practical cap; deeper trees fall through and reuse this padding */
  .zen-sidebar__parent-children-inner .zen-sidebar__parent-children-inner .zen-sidebar__parent-children-inner .zen-sidebar__parent-children-inner > .zen-sidebar__item,
  .zen-sidebar__parent-children-inner .zen-sidebar__parent-children-inner .zen-sidebar__parent-children-inner .zen-sidebar__parent-children-inner > .zen-sidebar__parent > .zen-sidebar__parent-trigger {
    padding-left: calc(var(--zen-space-3, 12px) + var(--zen-nav-indent-first) + var(--zen-nav-indent-sub) * 3);
  }

  .zen-sidebar__parent-popover-header {
    display: none; /* Only shown in collapsed-mode flyout */
  }

  /* ─────────────────────────────────────────────
     Collapsed mode — flyout for expandable parents
     ───────────────────────────────────────────── */
  .zen-sidebar--collapsed .zen-sidebar__parent {
    position: relative;
  }

  .zen-sidebar--collapsed .zen-sidebar__parent-trigger {
    justify-content: center;
    padding-left: 0;
    padding-right: 0;
  }

  .zen-sidebar--collapsed .zen-sidebar__parent-chevron,
  .zen-sidebar--collapsed .zen-sidebar__parent-trigger .zen-sidebar__item-label {
    display: none;
  }

  .zen-sidebar--collapsed .zen-sidebar__parent-children {
    /* Replace inline expand animation with a hover flyout to the right */
    position: absolute;
    left: 100%;
    top: 0;
    margin-left: 6px;
    min-width: 220px;
    /* Flyouts emanate from the drawer — they keep the shell surface. */
    background: var(--zen-shell-surface, var(--zen-bg-elevated));
    border: 1px solid var(--zen-shell-border, var(--zen-border));
    border-radius: var(--zen-radius-menu);
    box-shadow: var(--zen-elev-overlay);
    padding: var(--zen-space-1, 4px);
    z-index: 9999;

    /* Hidden until trigger or popover is hovered */
    display: flex;
    flex-direction: column;
    gap: 2px;
    grid-template-rows: none;
    overflow: visible;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateX(-4px);
    transition: opacity 0.12s, transform 0.12s, visibility 0s linear 0.12s;
  }

  .zen-sidebar--collapsed .zen-sidebar__parent:hover .zen-sidebar__parent-children,
  .zen-sidebar--collapsed .zen-sidebar__parent:focus-within .zen-sidebar__parent-children {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateX(0);
    transition: opacity 0.12s, transform 0.12s, visibility 0s;
  }

  .zen-sidebar--collapsed .zen-sidebar__parent-popover-header {
    display: block;
    padding: 6px 12px 4px;
    font-size: 0.7rem;
    font-weight: var(--zen-font-weight-semibold, 600);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--zen-shell-text-muted, var(--zen-text-muted));
    border-bottom: 1px solid var(--zen-shell-border, var(--zen-border));
    margin-bottom: 4px;
  }

  /* In flyout mode the inner wrapper becomes transparent so flex gap applies to items directly */
  .zen-sidebar--collapsed .zen-sidebar__parent-children-inner {
    display: contents;
  }

  /* Items inside the flyout get full padding back (override the depth indent).
     Also covers nested parent triggers — the flyout flattens the tree visually
     since each nested parent reveals its own sub-flyout to the right (recursive sub-flyout pattern). */
  .zen-sidebar--collapsed .zen-sidebar__parent-children-inner > .zen-sidebar__item,
  .zen-sidebar--collapsed .zen-sidebar__parent-children-inner > .zen-sidebar__parent > .zen-sidebar__parent-trigger {
    padding-left: var(--zen-space-3, 12px);
    justify-content: flex-start;
  }

  /* Labels become visible inside the flyout — overrides display:none from the
     general collapsed rule. Same for nested parent labels and chevrons. */
  .zen-sidebar--collapsed .zen-sidebar__parent-children-inner .zen-sidebar__item-label {
    display: inline;
    opacity: 1;
    visibility: visible;
  }

  .zen-sidebar--collapsed .zen-sidebar__parent-children-inner .zen-sidebar__parent-chevron {
    display: inline-flex;
  }

  /* ─────────────────────────────────────────────
     Footer
     ───────────────────────────────────────────── */
  .zen-sidebar__footer {
    flex-shrink: 0;
    padding: var(--zen-space-2, 8px) var(--zen-space-3, 12px);
    border-top: 1px solid var(--zen-shell-border, var(--zen-border));
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--zen-space-2, 8px);
  }

  .zen-sidebar--collapsed .zen-sidebar__footer {
    flex-direction: column-reverse;
    padding: var(--zen-space-2, 8px) var(--zen-space-1, 4px);
  }

  .zen-sidebar--collapsed .zen-sidebar__footer > *:not(.zen-sidebar__icon-btn) {
    display: none;
  }

  /* ── ZenPaletteSwitcher ─────────────────────────────────────────────
     Palette selector (swatch + name) with a pop-up list. Menu opens UPWARD
     since the switcher usually lives in the sidebar footer. */
  .zen-palette-switcher {
    position: relative;
  }
  .zen-palette-switcher__trigger {
    display: inline-flex;
    align-items: center;
    gap: var(--zen-space-2, 8px);
    padding: 6px 10px;
    background: transparent;
    border: 1px solid var(--zen-shell-border, var(--zen-border));
    border-radius: var(--zen-radius-md, 6px);
    color: var(--zen-shell-text, var(--zen-text-primary));
    font: inherit;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s;
  }
  .zen-palette-switcher__trigger:hover {
    background: var(--zen-shell-hover, var(--zen-bg-muted));
    border-color: var(--zen-accent);
  }
  .zen-palette-switcher__dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12);
  }
  .zen-palette-switcher__menu {
    position: absolute;
    left: 0;
    bottom: calc(100% + 6px);
    z-index: 1000;
    min-width: 168px;
    padding: 6px;
    /* Opens over the drawer footer — keeps the shell surface. */
    background: var(--zen-shell-surface, var(--zen-bg-elevated, var(--zen-bg-surface)));
    border: 1px solid var(--zen-shell-border, var(--zen-border));
    border-radius: var(--zen-radius-lg, 10px);
    box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.18);
    display: flex;
    flex-direction: column;
    gap: 2px;
  }
  .zen-palette-switcher__option {
    display: flex;
    align-items: center;
    gap: var(--zen-space-2, 9px);
    width: 100%;
    padding: 8px 10px;
    background: none;
    border: none;
    border-radius: var(--zen-radius-md, 7px);
    color: var(--zen-shell-text, var(--zen-text-primary));
    font: inherit;
    font-size: 0.82rem;
    text-align: left;
    cursor: pointer;
  }
  .zen-palette-switcher__option:hover {
    background: var(--zen-shell-hover, var(--zen-bg-muted));
  }
  .zen-palette-switcher__option--current {
    font-weight: 700;
  }
}

/* ─────────────────────────────────────────────
   Reduced motion — collapse/expand, chevron, and flyout movement become
   instant (0.01ms keeps transitionend firing; delay cleared so the flyout's
   visibility switch is immediate too).
   ───────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  @layer zenith-components {
    .zen-sidebar,
    .zen-sidebar__parent-chevron,
    .zen-sidebar__parent-children,
    .zen-sidebar--collapsed .zen-sidebar__parent .zen-sidebar__parent-children,
    .zen-sidebar--collapsed .zen-sidebar__parent:hover .zen-sidebar__parent-children,
    .zen-sidebar--collapsed .zen-sidebar__parent:focus-within .zen-sidebar__parent-children {
      transition-duration: 0.01ms;
      transition-delay: 0s;
    }
  }
}
