/* ── components/navbar/navbar.css ── */
/* -- Navbar component --------------------------------------------- */

@layer components {
  /* An app bar: .navbar-start / .navbar-center / .navbar-end regions (start
     and end share the free space equally, so the center stays truly
     centered), a .navbar-brand, a .navbar-menu of links (with <details>
     submenus), and any component inside - buttons, inputs, dropdowns,
     avatars, indicators. Responsive collapse is native: the collapsible
     part is a popover (.navbar-collapse[popover]) shown INLINE from the
     data-collapse breakpoint up and opened by a .navbar-toggle below it - one
     menu in the markup, no JavaScript. anchor-scope keeps each navbar's
     toggle anchor to itself. */
  .navbar {
    --_h: 3.5rem;
    anchor-scope: --navbar-toggle;
    box-sizing: border-box; /* the size IS the bar height */
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-height: var(--_h);
    padding: 0.5rem 1rem;
    background-color: var(--background);
    color: var(--foreground);
    border-bottom: 1px solid var(--border);

    /* -- Sizes -------------------------------------------------------- */
    &[data-size="sm"] {
      --_h: 3rem;
      padding-block: 0.25rem;
    }
    &[data-size="md"] {
      --_h: 3.5rem;
    }
    &[data-size="lg"] {
      --_h: 4.5rem;
      padding-block: 0.75rem;
    }

    /* -- Variants ------------------------------------------------------ */
    &[data-variant="muted"] {
      background-color: var(--muted);
      border-color: transparent;
    }
    &[data-variant="primary"] {
      background-color: var(--primary);
      color: var(--primary-foreground);
      border-color: transparent;
    }
    /* a charcoal bar (like the neutral card): the inverse colors, softened */
    &[data-variant="neutral"] {
      background-color: color-mix(in oklch, var(--foreground) 78%, var(--background));
      color: var(--background);
      border-color: transparent;
    }
    &[data-variant="ghost"] {
      background-color: transparent;
      border-color: transparent;
    }
    &[data-variant="glass"] {
      background-color: color-mix(in oklch, var(--background) 62%, transparent);
      border-color: color-mix(in oklch, var(--foreground) 12%, transparent);
      backdrop-filter: blur(14px) saturate(1.4);
    }
    /* a floating pill: rounded, bordered all round, a shadow - put it inside
       a padded container */
    &[data-variant="floating"] {
      border: 1px solid var(--border);
      border-radius: var(--radius-xl);
      box-shadow: var(--shadow-md);
    }

    /* -- Position ------------------------------------------------------ */
    &[data-position="sticky"] {
      position: sticky;
      top: 0;
      z-index: 40;
    }

    /* ghost / link buttons on a colored bar take its text color */
    &:is([data-variant="primary"], [data-variant="neutral"]) .btn:is([data-variant="ghost"], [data-variant="link"]) {
      color: inherit;

      &:hover {
        background-color: color-mix(in oklch, currentColor 16%, transparent);
        color: inherit;
      }
    }
  }

  .navbar-start,
  .navbar-end {
    flex: 1 1 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
  }
  .navbar-end {
    justify-content: flex-end;
  }
  .navbar-center {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 0.5rem;
  }

  /* -- Brand ------------------------------------------------------------ */
  .navbar-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-md);
    color: inherit;
    font-size: 1.0625rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    text-decoration: none;
    white-space: nowrap;

    & :is(img, svg) {
      height: 1.5rem;
      width: auto;
    }
    &:is(a):hover {
      background-color: color-mix(in oklch, currentColor 8%, transparent);
    }
    &:focus-visible {
      outline: 2px solid var(--ring);
      outline-offset: 2px;
    }
  }

  /* -- Menu ------------------------------------------------------------- */
  .navbar-menu {
    display: flex;
    align-items: center;
    gap: 0.125rem;
    margin: 0;
    padding: 0;
    list-style: none;

    & :is(a, summary) {
      display: flex;
      align-items: center;
      gap: 0.375rem;
      padding: 0.375rem 0.75rem;
      border-radius: var(--radius-md);
      color: color-mix(in oklch, currentColor 72%, transparent);
      font-size: 0.875rem;
      font-weight: 500;
      text-decoration: none;
      white-space: nowrap;
      cursor: pointer;
      list-style: none;

      &:hover {
        color: inherit;
        background-color: color-mix(in oklch, currentColor 8%, transparent);
      }
      &:focus-visible {
        outline: 2px solid var(--ring);
        outline-offset: 2px;
      }
      & svg {
        width: 1rem;
        height: 1rem;
      }
    }
    & :is(a, summary):hover {
      color: currentColor;
    }
    & a[aria-current="page"] {
      color: inherit;
      background-color: color-mix(in oklch, currentColor 10%, transparent);
    }

    /* a submenu: <details><summary>…</summary><ul>…</ul></details> - the
       chevron turns when open; the list drops below as a small popover-like
       panel. <details name="…"> keeps one open at a time. */
    & details {
      position: relative;
    }
    & summary::-webkit-details-marker {
      display: none;
    }
    & summary::after {
      content: "";
      width: 0.375rem;
      height: 0.375rem;
      margin-inline-start: 0.125rem;
      border-right: 1.5px solid currentColor;
      border-bottom: 1.5px solid currentColor;
      rotate: 45deg;
      translate: 0 -0.125rem;
      transition: rotate 150ms ease;
    }
    & details[open] > summary::after {
      rotate: -135deg;
      translate: 0 0.0625rem;
    }
    & details > ul {
      position: absolute;
      top: calc(100% + 0.375rem);
      left: 0;
      z-index: 50;
      display: grid;
      gap: 0.125rem;
      min-width: 11rem;
      margin: 0;
      padding: 0.25rem;
      list-style: none;
      background-color: var(--popover);
      color: var(--popover-foreground);
      border: 1px solid var(--border);
      border-radius: var(--radius-lg);
      box-shadow: var(--shadow-md);
    }
  }

  /* -- Responsive collapse ------------------------------------------------
     .navbar-collapse[popover] renders INLINE (the UA's popover styles are
     reset) unless its navbar collapses at the current width - then it is a
     real popover, anchored under the .navbar-toggle. */
  .navbar-toggle {
    anchor-name: --navbar-toggle;
    display: none;
  }
  .navbar-collapse[popover] {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    position: static;
    inset: auto;
    width: auto;
    height: auto;
    margin: 0;
    padding: 0;
    overflow: visible;
    border: 0;
    background: none;
    color: inherit;
  }

  /* shared: the collapsed state (inside a media query per breakpoint) */
  .navbar[data-collapse="always"] {
    & .navbar-toggle {
      display: inline-flex;
    }
    & .navbar-collapse[popover]:not(:popover-open) {
      display: none;
    }
    & .navbar-collapse[popover]:popover-open {
      position: fixed;
      position-anchor: --navbar-toggle;
      inset: auto;
      top: anchor(bottom);
      left: anchor(left);
      position-try-fallbacks: flip-inline;
      display: grid;
      align-items: stretch;
      min-width: 14rem;
      margin: 0.5rem 0 0;
      padding: 0.375rem;
      background-color: var(--popover);
      color: var(--popover-foreground);
      border: 1px solid var(--border);
      border-radius: var(--radius-lg);
      box-shadow: var(--shadow-lg);

      & .navbar-menu {
        flex-direction: column;
        align-items: stretch;
      }
      & .navbar-menu details > ul {
        position: static;
        box-shadow: none;
        border: 0;
        padding: 0 0 0 0.75rem;
      }
    }
  }
  @media (max-width: 39.99rem) {
    .navbar[data-collapse="sm"] {
      & .navbar-toggle {
        display: inline-flex;
      }
      & .navbar-collapse[popover]:not(:popover-open) {
        display: none;
      }
      & .navbar-collapse[popover]:popover-open {
        position: fixed;
        position-anchor: --navbar-toggle;
        inset: auto;
        top: anchor(bottom);
        left: anchor(left);
        position-try-fallbacks: flip-inline;
        display: grid;
        align-items: stretch;
        min-width: 14rem;
        margin: 0.5rem 0 0;
        padding: 0.375rem;
        background-color: var(--popover);
        color: var(--popover-foreground);
        border: 1px solid var(--border);
        border-radius: var(--radius-lg);
        box-shadow: var(--shadow-lg);
        & .navbar-menu {
          flex-direction: column;
          align-items: stretch;
        }
        & .navbar-menu details > ul {
          position: static;
          box-shadow: none;
          border: 0;
          padding: 0 0 0 0.75rem;
        }
      }
    }
  }
  @media (max-width: 47.99rem) {
    .navbar[data-collapse="md"] {
      & .navbar-toggle {
        display: inline-flex;
      }
      & .navbar-collapse[popover]:not(:popover-open) {
        display: none;
      }
      & .navbar-collapse[popover]:popover-open {
        position: fixed;
        position-anchor: --navbar-toggle;
        inset: auto;
        top: anchor(bottom);
        left: anchor(left);
        position-try-fallbacks: flip-inline;
        display: grid;
        align-items: stretch;
        min-width: 14rem;
        margin: 0.5rem 0 0;
        padding: 0.375rem;
        background-color: var(--popover);
        color: var(--popover-foreground);
        border: 1px solid var(--border);
        border-radius: var(--radius-lg);
        box-shadow: var(--shadow-lg);
        & .navbar-menu {
          flex-direction: column;
          align-items: stretch;
        }
        & .navbar-menu details > ul {
          position: static;
          box-shadow: none;
          border: 0;
          padding: 0 0 0 0.75rem;
        }
      }
    }
  }
  @media (max-width: 63.99rem) {
    .navbar[data-collapse="lg"] {
      & .navbar-toggle {
        display: inline-flex;
      }
      & .navbar-collapse[popover]:not(:popover-open) {
        display: none;
      }
      & .navbar-collapse[popover]:popover-open {
        position: fixed;
        position-anchor: --navbar-toggle;
        inset: auto;
        top: anchor(bottom);
        left: anchor(left);
        position-try-fallbacks: flip-inline;
        display: grid;
        align-items: stretch;
        min-width: 14rem;
        margin: 0.5rem 0 0;
        padding: 0.375rem;
        background-color: var(--popover);
        color: var(--popover-foreground);
        border: 1px solid var(--border);
        border-radius: var(--radius-lg);
        box-shadow: var(--shadow-lg);
        & .navbar-menu {
          flex-direction: column;
          align-items: stretch;
        }
        & .navbar-menu details > ul {
          position: static;
          box-shadow: none;
          border: 0;
          padding: 0 0 0 0.75rem;
        }
      }
    }
  }

  /* -- Accessibility -------------------------------------------------- */
  @media (prefers-reduced-motion: reduce) {
    .navbar-menu summary::after {
      transition: none;
    }
  }
  @media (forced-colors: active) {
    .navbar {
      border-bottom: 1px solid CanvasText;
    }
    .navbar-menu a[aria-current="page"] {
      outline: 1px solid Highlight;
    }
  }
}

/* ── components/dock/dock.css ── */
/* -- Dock component ------------------------------------------------ */

@layer components {
  /* A bottom navigation bar (daisyUI's dock, plus): a <nav class="dock"> of
     .dock-item links / buttons / labels, each an icon (.dock-icon - an svg
     or an emoji, optionally with a .dock-badge or .dock-dot) over a
     .dock-label. Fixed to the bottom of the viewport by default, clear of
     the device's safe area. The active item is aria-current="page" (links),
     aria-pressed="true" (buttons) or a checked radio inside a <label> - the
     radio form switches the active item with no JavaScript at all.
     data-indicator: bar (default) / pill / dot. CSS only. */
  .dock {
    --_h: 4rem;
    box-sizing: border-box; /* the size IS the bar height, border included */
    --_icon: 1.375rem;
    --_label: 0.6875rem;
    --_accent: var(--primary);
    position: fixed;
    z-index: 40;
    inset-inline: 0;
    bottom: 0;
    display: flex;
    align-items: stretch;
    justify-content: space-around;
    height: calc(var(--_h) + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    padding-inline: 0.25rem;
    border-top: 1px solid var(--border);
    background-color: var(--background);
    color: var(--muted-foreground);

    /* -- Placement ------------------------------------------------------- */
    &[data-position="static"] {
      position: static;
      height: var(--_h);
      padding-bottom: 0;
    }
    &[data-position="top"] {
      bottom: auto;
      top: 0;
      border-top: 0;
      border-bottom: 1px solid var(--border);
      padding-bottom: 0;
      height: var(--_h);
    }
    &[data-attach="container"] {
      position: absolute;
    }
    /* side docks: a column down the left / right edge */
    &:is([data-position="left"], [data-position="right"]) {
      inset: 0 auto 0 0;
      flex-direction: column;
      justify-content: center;
      gap: 0.25rem;
      width: calc(var(--_h) + 0.5rem);
      height: auto;
      padding: 0.5rem 0.25rem;
      border-top: 0;
      border-inline-end: 1px solid var(--border);

      & .dock-item {
        flex: 0 0 auto;
        padding-block: 0.625rem;
      }
    }
    &[data-position="right"] {
      inset: 0 0 0 auto;
      border-inline-end: 0;
      border-inline-start: 1px solid var(--border);
    }

    /* -- Sizes ------------------------------------------------------------ */
    &[data-size="xs"] {
      --_h: 2.75rem;
      --_icon: 1.125rem;
      --_label: 0.625rem;
    }
    &[data-size="sm"] {
      --_h: 3.375rem;
      --_icon: 1.25rem;
      --_label: 0.625rem;
    }
    &[data-size="md"] {
      --_h: 4rem;
      --_icon: 1.375rem;
      --_label: 0.6875rem;
    }
    &[data-size="lg"] {
      --_h: 4.75rem;
      --_icon: 1.625rem;
      --_label: 0.75rem;
    }
    &[data-size="xl"] {
      --_h: 5.5rem;
      --_icon: 1.875rem;
      --_label: 0.8125rem;
    }

    /* -- Surfaces --------------------------------------------------------- */
    &[data-variant="muted"] {
      background-color: var(--muted);
      border-color: transparent;
    }
    &[data-variant="primary"] {
      --_accent: var(--primary-foreground);
      background-color: var(--primary);
      color: color-mix(in oklch, var(--primary-foreground) 65%, transparent);
      border-color: transparent;
    }
    &[data-variant="neutral"] {
      --_accent: var(--background);
      background-color: color-mix(in oklch, var(--foreground) 82%, var(--background));
      color: color-mix(in oklch, var(--background) 62%, transparent);
      border-color: transparent;
    }
    &[data-variant="glass"] {
      background-color: color-mix(in oklch, var(--background) 60%, transparent);
      backdrop-filter: blur(16px) saturate(1.5);
      border-color: color-mix(in oklch, var(--foreground) 12%, transparent);
    }
    /* floating: a rounded bar hovering above the bottom edge */
    &[data-variant="floating"] {
      inset-inline: 1rem;
      bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
      height: var(--_h);
      padding: 0 0.375rem;
      border: 1px solid var(--border);
      border-radius: 9999px;
      box-shadow: var(--shadow-lg);
      max-width: 32rem;
      margin-inline: auto;
    }
    &[data-variant="floating"][data-position="static"] {
      margin-block: 0.5rem;
    }
    &[data-variant="floating"]:is([data-position="left"], [data-position="right"]) {
      inset-block: 0;
      height: fit-content;
      max-height: calc(100% - 2rem);
      margin-block: auto;
      margin-inline: 0;
      padding: 0.375rem 0.25rem;
      border: 1px solid var(--border);
    }
    &[data-variant="floating"][data-position="left"] {
      left: 1rem;
    }
    &[data-variant="floating"][data-position="right"] {
      right: 1rem;
      left: auto;
    }
    &[data-variant="floating"][data-position="top"] {
      top: 1rem;
      bottom: auto;
    }
  }

  /* -- Items ------------------------------------------------------------ */
  .dock-item {
    position: relative;
    display: flex;
    flex: 1 1 0;
    min-width: 0;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    padding: 0.25rem;
    border: 0;
    background: none;
    color: inherit;
    font: inherit;
    text-decoration: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition:
      color 150ms ease,
      scale 180ms ease,
      translate 180ms ease;

    &:hover {
      color: var(--foreground);
    }
    .dock:is([data-variant="primary"], [data-variant="neutral"]) &:hover {
      color: var(--_accent);
    }
    &:focus-visible {
      outline: 2px solid var(--ring);
      outline-offset: -4px;
      border-radius: var(--radius-lg);
    }
    &:has(> input:focus-visible) {
      outline: 2px solid var(--ring);
      outline-offset: -4px;
      border-radius: var(--radius-lg);
    }
    &:is(:disabled, [aria-disabled="true"]) {
      opacity: 0.45;
      pointer-events: none;
    }

    /* the radio form: the input is invisible, the label is the item */
    & > input[type="radio"] {
      position: absolute;
      opacity: 0;
      pointer-events: none;
    }
  }
  .dock-icon {
    position: relative;
    display: inline-grid;
    place-items: center;
    width: calc(var(--_icon) + 1.5rem);
    height: calc(var(--_icon) + 0.375rem);
    border-radius: 9999px;
    font-size: var(--_icon);
    line-height: 1;
    transition:
      background-color 180ms ease,
      color 180ms ease;

    & svg {
      width: var(--_icon);
      height: var(--_icon);
    }
  }
  .dock-label {
    max-width: 100%;
    overflow: hidden;
    font-size: var(--_label);
    font-weight: 500;
    line-height: 1.2;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  /* -- Active item ------------------------------------------------------ */
  .dock-item:is(
    [aria-current="page"],
    [aria-current="true"],
    [aria-pressed="true"],
    [data-active],
    :has(> input:checked)
  ) {
    color: var(--_accent);

    & .dock-label {
      font-weight: 600;
    }
  }
  /* bar (default): a short line on the top edge (bottom edge for a top dock) */
  .dock:not([data-indicator]) .dock-item::before,
  .dock[data-indicator="bar"] .dock-item::before {
    content: "";
    position: absolute;
    top: 0;
    left: 50%;
    width: 0;
    height: 3px;
    translate: -50% 0;
    border-radius: 0 0 3px 3px;
    background-color: var(--_accent);
    transition: width 200ms ease;
  }
  .dock[data-position="top"] .dock-item::before {
    top: auto;
    bottom: 0;
    border-radius: 3px 3px 0 0;
  }
  .dock:is([data-position="left"], [data-position="right"]) .dock-item::before {
    top: 50%;
    left: 0;
    width: 3px;
    height: 0;
    translate: 0 -50%;
    border-radius: 0 3px 3px 0;
    transition: height 200ms ease;
  }
  .dock[data-position="right"] .dock-item::before {
    left: auto;
    right: 0;
    border-radius: 3px 0 0 3px;
  }
  .dock:is([data-position="left"], [data-position="right"]):is(:not([data-indicator]), [data-indicator="bar"])
    .dock-item:is(
      [aria-current="page"],
      [aria-current="true"],
      [aria-pressed="true"],
      [data-active],
      :has(> input:checked)
    )::before {
    width: 3px;
    height: 2.25rem;
  }
  .dock:is(:not([data-indicator]), [data-indicator="bar"])
    .dock-item:is(
      [aria-current="page"],
      [aria-current="true"],
      [aria-pressed="true"],
      [data-active],
      :has(> input:checked)
    )::before {
    width: 2.25rem;
  }
  .dock[data-variant="floating"]:not([data-indicator]) .dock-item::before {
    display: none;
  }
  .dock[data-variant="floating"]:not([data-indicator]) .dock-item:is([aria-current="page"], [aria-current="true"], [aria-pressed="true"], [data-active], :has(> input:checked)) .dock-icon,
  /* pill: a tinted capsule behind the active icon (Material 3) */
  .dock[data-indicator="pill"] .dock-item:is([aria-current="page"], [aria-current="true"], [aria-pressed="true"], [data-active], :has(> input:checked)) .dock-icon {
    background-color: color-mix(in oklch, var(--_accent) 16%, transparent);
  }
  /* dot: a small dot under the label */
  .dock[data-indicator="dot"] .dock-item::after {
    content: "";
    position: absolute;
    bottom: 0.3rem;
    left: 50%;
    width: 4px;
    height: 4px;
    translate: -50% 0;
    border-radius: 9999px;
    background-color: var(--_accent);
    scale: 0;
    transition: scale 180ms ease;
  }
  .dock[data-indicator="dot"]
    .dock-item:is(
      [aria-current="page"],
      [aria-current="true"],
      [aria-pressed="true"],
      [data-active],
      :has(> input:checked)
    )::after {
    scale: 1;
  }

  /* -- Labels: always (default), only for the active item, or none ------ */
  .dock[data-labels="active"]
    .dock-item:not(
      [aria-current="page"],
      [aria-current="true"],
      [aria-pressed="true"],
      [data-active],
      :has(> input:checked)
    )
    .dock-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }
  .dock[data-labels="none"] .dock-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }

  /* -- Badges and dots on an icon ---------------------------------------- */
  .dock-badge {
    position: absolute;
    top: -0.3rem;
    inset-inline-start: calc(50% + 0.35rem);
    min-width: 1.125rem;
    height: 1.125rem;
    padding-inline: 0.3rem;
    border-radius: 9999px;
    background-color: var(--destructive);
    color: var(--destructive-foreground, #fff);
    box-shadow: 0 0 0 2px var(--background);
    font-size: 0.625rem;
    font-weight: 700;
    line-height: 1.125rem;
    text-align: center;
  }
  .dock-dot {
    position: absolute;
    top: 0;
    inset-inline-start: calc(50% + 0.45rem);
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 9999px;
    background-color: var(--_c, var(--primary));
    box-shadow: 0 0 0 2px var(--background);

    &[data-tone="success"] {
      --_c: oklch(0.65 0.17 150);
    }
    &[data-tone="warning"] {
      --_c: oklch(0.78 0.16 75);
    }
    &[data-tone="destructive"] {
      --_c: var(--destructive);
    }
    &[data-animate="ping"]::after {
      content: "";
      position: absolute;
      inset: 0;
      border-radius: inherit;
      background-color: inherit;
      animation: dock-ping 1.4s cubic-bezier(0, 0, 0.2, 1) infinite;
    }
  }
  @keyframes dock-ping {
    75%,
    100% {
      scale: 2.4;
      opacity: 0;
    }
  }

  /* -- Raised center action (data-raised on an item) --------------------- */
  .dock-item[data-raised],
  .dock-item[data-raised]:is([aria-current], [aria-pressed="true"], [data-active], :has(> input:checked)) {
    /* always the primary-foreground glyph - the accent color of an active
       item is --primary, the raised disc's own color */
    color: var(--primary-foreground);

    & .dock-icon {
      width: calc(var(--_h) - 0.75rem);
      height: calc(var(--_h) - 0.75rem);
      /* lifted with a margin, not a transform: a FAB menu anchored to this
         icon (anchor positioning ignores transforms) lands where it shows */
      margin-block-start: calc((var(--_h) - 0.75rem) * -0.7);
      padding: 0;
      border: 0;
      background-color: var(--primary);
      color: var(--primary-foreground);
      box-shadow:
        var(--shadow-lg),
        0 0 0 4px var(--background);
      cursor: pointer;
    }
    & .dock-icon:focus-visible {
      outline: 2px solid var(--ring);
      outline-offset: 3px;
    }
    & .dock-label {
      position: absolute;
      width: 1px;
      height: 1px;
      overflow: hidden;
      clip-path: inset(50%);
    }
    &::before,
    &::after {
      display: none;
    }
    &:hover {
      color: var(--primary-foreground);
    }
    &:hover .dock-icon {
      background-color: color-mix(in oklch, var(--primary) 88%, var(--primary-foreground));
    }
  }
  /* a FAB as the raised item: <div class="dock-item fab" data-raised
     data-layout="flower" data-position="bottom-center"> with a
     .fab-trigger.dock-icon button and a .fab-menu popover - the dial fans
     out over the dock (fab.css: a semicircle from the center) */
  .dock .fab.dock-item {
    position: relative;
    inset: auto;
    z-index: auto;
    justify-content: center;
    pointer-events: auto;
  }
  .dock .fab.dock-item > .fab-trigger {
    box-shadow:
      var(--shadow-lg),
      0 0 0 4px var(--background);
  }

  /* -- Magnify (macOS): the hovered item grows, its neighbours a little -- */
  .dock[data-effect="magnify"] {
    overflow: visible;
    align-items: center;
    border: 0;

    & .dock-item {
      transform-origin: 50% 100%;
    }
    & .dock-item:hover {
      scale: 1.35;
      translate: 0 -0.35rem;
      z-index: 1;
    }
    & .dock-item:has(+ .dock-item:hover),
    & .dock-item:hover + .dock-item {
      scale: 1.15;
      translate: 0 -0.15rem;
    }
    &[data-position="top"] .dock-item {
      transform-origin: 50% 0;
    }
    &[data-position="top"] .dock-item:hover {
      translate: 0 0.35rem;
    }
    &[data-position="top"] :is(.dock-item:has(+ .dock-item:hover), .dock-item:hover + .dock-item) {
      translate: 0 0.15rem;
    }
    &[data-position="left"] .dock-item {
      transform-origin: 0 50%;
    }
    &[data-position="left"] .dock-item:hover {
      translate: 0.35rem 0;
    }
    &[data-position="left"] :is(.dock-item:has(+ .dock-item:hover), .dock-item:hover + .dock-item) {
      translate: 0.15rem 0;
    }
    &[data-position="right"] .dock-item {
      transform-origin: 100% 50%;
    }
    &[data-position="right"] .dock-item:hover {
      translate: -0.35rem 0;
    }
    &[data-position="right"] :is(.dock-item:has(+ .dock-item:hover), .dock-item:hover + .dock-item) {
      translate: -0.15rem 0;
    }
  }

  /* -- Autohide: tucked away at its edge, it slides in when the pointer
     comes close (a strip of it stays reachable, plus a hit zone past it)
     or when focus enters - the macOS dock. data-autohide on the .dock. */
  .dock[data-autohide] {
    --_peek: 6px;
    transition: translate 260ms cubic-bezier(0.2, 0.8, 0.2, 1);
    translate: 0 calc(100% - var(--_peek));

    &[data-variant="floating"] {
      translate: 0 calc(100% + 1rem - var(--_peek));
    }
    &[data-position="top"] {
      translate: 0 calc(-100% + var(--_peek));
    }
    &[data-position="top"][data-variant="floating"] {
      translate: 0 calc(-100% - 1rem + var(--_peek));
    }
    &[data-position="left"] {
      translate: calc(-100% + var(--_peek)) 0;
    }
    &[data-position="left"][data-variant="floating"] {
      translate: calc(-100% - 1rem + var(--_peek)) 0;
    }
    &[data-position="right"] {
      translate: calc(100% - var(--_peek)) 0;
    }
    &[data-position="right"][data-variant="floating"] {
      translate: calc(100% + 1rem - var(--_peek)) 0;
    }
    &:is(:hover, :focus-within) {
      translate: 0 0;
    }

    /* reach: an invisible zone beyond the tucked edge */
    &::after {
      content: "";
      position: absolute;
      inset-inline: 0;
      bottom: 100%;
      height: 1.5rem;
    }
    &[data-position="top"]::after {
      bottom: auto;
      top: 100%;
    }
    &[data-position="left"]::after {
      inset: 0 auto 0 100%;
      width: 1.5rem;
      height: auto;
    }
    &[data-position="right"]::after {
      inset: 0 100% 0 auto;
      width: 1.5rem;
      height: auto;
    }
  }

  /* -- Views: the dock switches a card's content, CSS only --------------
     A .dock-view holds the radio .dock and a .dock-panels of .dock-panel
     elements in the same order as the items: the panel at position k shows
     while item k's radio is checked. (An item without a radio - the raised
     action - keeps its place with an empty panel.) */
  .dock-panel {
    display: none;
  }
  /* a card that closes with its dock: <div class="card dock-view"> holds the
     .dock-panels and an in-flow dock as its footer - the dock drops its own
     edges and the card's rounded corners clip it (one frame, no square
     border under a round corner) */
  .card.dock-view {
    display: flex;
    flex-direction: column;

    & > .dock-panels {
      flex: 1 1 auto;
    }
    & > .dock[data-position="static"] {
      border-inline: 0;
      border-bottom: 0;
      border-radius: 0;
      box-shadow: none;
    }
  }
  .dock-view:has(.dock > .dock-item:nth-child(1) > input:checked) .dock-panels > .dock-panel:nth-child(1),
  .dock-view:has(.dock > .dock-item:nth-child(2) > input:checked) .dock-panels > .dock-panel:nth-child(2),
  .dock-view:has(.dock > .dock-item:nth-child(3) > input:checked) .dock-panels > .dock-panel:nth-child(3),
  .dock-view:has(.dock > .dock-item:nth-child(4) > input:checked) .dock-panels > .dock-panel:nth-child(4),
  .dock-view:has(.dock > .dock-item:nth-child(5) > input:checked) .dock-panels > .dock-panel:nth-child(5),
  .dock-view:has(.dock > .dock-item:nth-child(6) > input:checked) .dock-panels > .dock-panel:nth-child(6),
  .dock-view:has(.dock > .dock-item:nth-child(7) > input:checked) .dock-panels > .dock-panel:nth-child(7) {
    display: block;
    animation: dock-panel-in 220ms ease both;
  }
  @keyframes dock-panel-in {
    from {
      opacity: 0;
      translate: 0 6px;
    }
  }

  /* -- Accessibility ------------------------------------------------------ */
  @media (prefers-reduced-motion: reduce) {
    .dock-item,
    .dock-icon,
    .dock-item::before,
    .dock-item::after {
      transition: none;
    }
    .dock[data-effect="magnify"] .dock-item {
      scale: none !important;
      translate: none !important;
    }
    .dock-dot[data-animate]::after {
      animation: none;
    }
    .dock-panel {
      animation: none !important;
    }
    .dock[data-autohide] {
      transition: none;
    }
  }
  @media (forced-colors: active) {
    .dock {
      border-top: 1px solid CanvasText;
    }
    .dock-item:is([aria-current="page"], [aria-pressed="true"], [data-active], :has(> input:checked)) {
      outline: 2px solid Highlight;
      outline-offset: -4px;
    }
  }
}

/* ── components/breadcrumb/breadcrumb.css ── */
@layer components {
  .breadcrumb-list {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.375rem;
    list-style: none;
    margin: 0;
    padding: 0;
    font-size: 0.875rem;
  }
  .breadcrumb-item {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
  }
  .breadcrumb-link {
    color: var(--muted-foreground);
    text-decoration: none;
    border-radius: var(--radius-sm);
    outline: none;
    transition: color 150ms ease;
    &:hover {
      color: var(--foreground);
    }
    /* only a real link underlines - a .breadcrumb-link button (dropdown /
       ellipsis trigger) is not navigation and keeps the color-only hover */
    &:is(a[href]):hover {
      text-decoration: underline;
      text-decoration-thickness: 1px;
      text-underline-offset: 3px;
    }
    &:focus-visible {
      outline: 2px solid var(--ring);
      outline-offset: 2px;
    }
  }
  /* -- Sizes ------------------------------------------------------
     data-size on the .breadcrumb nav scales the trail's type and separators,
     mirroring the shared field/button ladder (md = 0.875rem = default). */
  .breadcrumb[data-size="xs"] .breadcrumb-list {
    font-size: 0.75rem;
  }
  .breadcrumb[data-size="xs"] .breadcrumb-separator svg {
    width: 0.75rem;
    height: 0.75rem;
  }
  .breadcrumb[data-size="sm"] .breadcrumb-list {
    font-size: 0.8125rem;
  }
  .breadcrumb[data-size="md"] .breadcrumb-list {
    font-size: 0.875rem;
  }
  .breadcrumb[data-size="lg"] .breadcrumb-list {
    font-size: 1rem;
  }
  .breadcrumb[data-size="lg"] .breadcrumb-separator svg {
    width: 1rem;
    height: 1rem;
  }
  .breadcrumb[data-size="xl"] .breadcrumb-list {
    font-size: 1.125rem;
  }
  .breadcrumb[data-size="xl"] .breadcrumb-separator svg {
    width: 1.125rem;
    height: 1.125rem;
  }

  .breadcrumb-separator {
    color: var(--muted-foreground);
    font-size: 0.75rem;
    /* flex (not inline): an inline <svg> sits on the text baseline, so icon
       separators render a few px above the labels' optical center */
    display: flex;
    align-items: center;
    & svg {
      width: 0.875rem;
      height: 0.875rem;
      flex-shrink: 0;
    }

    /* RTL: auto-flip chevron separators */
    [dir="rtl"] & svg {
      scale: -1 1;
    }
  }
  .breadcrumb-page {
    color: var(--foreground);
    font-weight: 400;
  }

  /* -- Icons / emoji in front of a crumb ---------------------------
     An <svg> or a <span class="breadcrumb-icon"> (emoji) before the label:
     link and page line them up on the label's center and size them to the
     text (1em - so data-size scales them too). */
  .breadcrumb-link,
  .breadcrumb-page {
    &:has(> :is(svg, .breadcrumb-icon)) {
      display: inline-flex;
      align-items: center;
      gap: 0.375em;
    }
    & > svg {
      width: 1em;
      height: 1em;
      flex-shrink: 0;
    }
  }
  .breadcrumb-icon {
    display: inline-grid;
    place-items: center;
    width: 1.15em;
    height: 1.15em;
    flex-shrink: 0;
    line-height: 1;
    font-style: normal;
  }
  .breadcrumb-ellipsis {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    color: var(--muted-foreground);
    & span {
      position: absolute;
      width: 1px;
      height: 1px;
      overflow: hidden;
      clip: rect(0, 0, 0, 0);
      white-space: nowrap;
    }
  }

  /* -- Accessibility ------------------------------------------ */

  @media (prefers-reduced-motion: reduce) {
    .breadcrumb-link {
      transition: none;
    }
  }

  @media (prefers-contrast: more) {
    .breadcrumb-link {
      text-decoration: underline;
    }
    .breadcrumb-page {
      font-weight: 600;
    }
  }

  @media (forced-colors: active) {
    .breadcrumb-link {
      &:hover {
        forced-color-adjust: none;
        color: HighlightText;
        background: Highlight;
      }
    }
    .breadcrumb-page {
      color: CanvasText;
    }
    .breadcrumb-separator {
      color: GrayText;
    }
  }
}

/* ── components/toc/toc.css ── */
/* -- Table of Contents component ------------------------------ */

@layer components {
  .toc {
    display: block;
  }

  .toc-title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--foreground);
    margin: 0 0 0.5rem;
    padding: 0 0.5rem;
  }

  /* -- Density ----------------------------------------------------
     data-density on the .toc root scales the vertical rhythm of the links
     (0.75 / 1 / 1.25 of the 3px block padding); comfortable matches the
     unsized default. Font size stays put - whitespace, not zoom. */
  .toc:where([data-density="compact"]) .toc-link {
    padding: 0.125rem 0.5rem;
  }
  .toc:where([data-density="comfortable"]) .toc-link {
    padding: 0.1875rem 0.5rem;
  }
  .toc:where([data-density="spacious"]) .toc-link {
    padding: 0.25rem 0.5rem;
  }

  .toc-link {
    display: block;
    padding: 0.1875rem 0.5rem;
    font-size: 0.8125rem;
    color: var(--muted-foreground);
    text-decoration: none;
    border-left: 2px solid transparent;
    transition:
      color 150ms,
      border-color 150ms;
    line-height: 1.6;

    &:hover {
      color: var(--foreground);
    }

    &[aria-current="location"] {
      color: var(--foreground);
      border-left-color: var(--primary);
    }
  }

  @media (prefers-reduced-motion: reduce) {
    .toc-link {
      transition: none;
    }
  }

  @media (forced-colors: active) {
    .toc-link[aria-current="location"] {
      border-left-color: LinkText;
    }
  }
}

/* ── components/pagination/pagination.css ── */
@layer components {
  .pagination {
    display: flex;
    justify-content: center;
  }
  .pagination-list {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    list-style: none;
    margin: 0;
    padding: 0;
  }
  .pagination-link,
  .pagination-prev,
  .pagination-next {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.25rem;
    height: 2.25rem;
    padding-inline: 0.5rem;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    color: var(--foreground);
    text-decoration: none;
    cursor: pointer;
    outline: none;
    transition:
      background-color 150ms ease,
      border-color 150ms ease;
    gap: 0.25rem;
    &:hover {
      background-color: var(--accent);
    }
    &:focus-visible {
      outline: 2px solid var(--ring);
      outline-offset: 2px;
    }
    & svg {
      width: 1rem;
      height: 1rem;
      flex-shrink: 0;
    }

    /* Disabled state for prev/next at boundaries */
    &[aria-disabled="true"],
    &.disabled {
      pointer-events: none;
      opacity: 0.5;
    }
  }
  .pagination-prev,
  .pagination-next {
    padding-inline: 0.75rem;
    gap: 0.375rem;
  }
  .pagination-active {
    border-color: var(--border);
    background-color: var(--background);
    font-weight: 500;
  }
  .pagination-ellipsis {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    color: var(--muted-foreground);
    & span {
      position: absolute;
      width: 1px;
      height: 1px;
      overflow: hidden;
      clip: rect(0, 0, 0, 0);
      white-space: nowrap;
    }
  }

  /* -- Sizes ----------------------------------------------------
     Set data-size on the .pagination nav; every cell (page links, prev/next,
     ellipsis) scales. :where() keeps each rule at one class of specificity
     so the .pagination-prev padding-inline above still wins per-item.
     md == the unsized default. */
  .pagination:where([data-size="xs"]) {
    & :is(.pagination-link, .pagination-prev, .pagination-next) {
      min-width: 1.75rem;
      height: 1.75rem;
      font-size: 0.75rem;
    }
    & .pagination-ellipsis {
      width: 1.75rem;
      height: 1.75rem;
    }
  }
  .pagination:where([data-size="sm"]) {
    & :is(.pagination-link, .pagination-prev, .pagination-next) {
      min-width: 2rem;
      height: 2rem;
      font-size: 0.8125rem;
    }
    & .pagination-ellipsis {
      width: 2rem;
      height: 2rem;
    }
  }
  .pagination:where([data-size="md"]) {
    & :is(.pagination-link, .pagination-prev, .pagination-next) {
      min-width: 2.25rem;
      height: 2.25rem;
      font-size: 0.875rem;
    }
    & .pagination-ellipsis {
      width: 2.25rem;
      height: 2.25rem;
    }
  }
  .pagination:where([data-size="lg"]) {
    & :is(.pagination-link, .pagination-prev, .pagination-next) {
      min-width: 2.5rem;
      height: 2.5rem;
      font-size: 1rem;
    }
    & .pagination-ellipsis {
      width: 2.5rem;
      height: 2.5rem;
    }
  }
  .pagination:where([data-size="xl"]) {
    & :is(.pagination-link, .pagination-prev, .pagination-next) {
      min-width: 2.75rem;
      height: 2.75rem;
      font-size: 1.125rem;
    }
    & .pagination-ellipsis {
      width: 2.75rem;
      height: 2.75rem;
    }
  }

  /* -- Variants (data-variant on the .pagination nav) -----------
     outline: every cell a bordered button; joined: one segmented bar -
     shared borders collapse, only the outer corners round (logical radii,
     so RTL mirrors for free). The active page gets a filled surface so it
     still stands out among bordered cells. */
  .pagination:is([data-variant="outline"], [data-variant="joined"]) {
    & :is(.pagination-link, .pagination-prev, .pagination-next) {
      border-color: var(--border);
      background-color: var(--background);
      box-shadow: var(--shadow-xs);
      &:hover {
        background-color: var(--accent);
        color: var(--accent-foreground);
      }
    }
    & .pagination-active {
      background-color: var(--accent);
      color: var(--accent-foreground);
    }
  }
  .pagination[data-variant="joined"] {
    & .pagination-list {
      gap: 0;
    }
    & :is(.pagination-link, .pagination-prev, .pagination-next, .pagination-ellipsis) {
      border-radius: 0;
    }
    /* the ellipsis joins the chain instead of floating between two groups */
    & .pagination-ellipsis {
      border: 1px solid var(--border);
      background-color: var(--background);
    }
    & .pagination-list > li:first-child > * {
      border-start-start-radius: var(--radius-md);
      border-end-start-radius: var(--radius-md);
    }
    & .pagination-list > li:last-child > * {
      border-start-end-radius: var(--radius-md);
      border-end-end-radius: var(--radius-md);
    }
    & .pagination-list > li + li > * {
      margin-inline-start: -1px;
    }
    /* the hovered / focused / active cell's own border stays on top */
    & :is(.pagination-link, .pagination-prev, .pagination-next):is(:hover, :focus-visible),
    & .pagination-active {
      position: relative;
      z-index: 1;
    }
  }

  /* -- Layout: split - previous / next as two equal columns across the
     full width (daisyUI's two-column pager) --------------------------- */
  .pagination[data-layout="split"] {
    width: 100%;
    & .pagination-list {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 0.5rem;
      width: 100%;
    }
    & .pagination-list > li {
      display: flex;
    }
    & :is(.pagination-link, .pagination-prev, .pagination-next) {
      flex: 1;
    }
  }
  .pagination[data-layout="split"][data-variant="joined"] .pagination-list {
    gap: 0;
  }

  /* -- Accessibility ------------------------------------------ */

  @media (prefers-reduced-motion: reduce) {
    .pagination-link,
    .pagination-prev,
    .pagination-next {
      transition: none;
    }
  }

  @media (prefers-contrast: more) {
    .pagination-link,
    .pagination-prev,
    .pagination-next {
      border-color: var(--border);
      &:hover {
        border-color: var(--foreground);
      }
    }
    .pagination-active {
      border-width: 2px;
    }
  }

  @media (forced-colors: active) {
    .pagination-active {
      border-color: Highlight;
    }
    .pagination-link,
    .pagination-prev,
    .pagination-next {
      &:hover {
        forced-color-adjust: none;
        background: Highlight;
        color: HighlightText;
      }
      &[aria-disabled="true"],
      &.disabled {
        color: GrayText;
      }
    }
    .pagination[data-variant="joined"] :is(.pagination-link, .pagination-prev, .pagination-next, .pagination-ellipsis) {
      border-color: ButtonText;
    }
  }
  /* -- Density ----------------------------------------------------
     data-density on the .pagination nav scales only the inter-cell gap —
     the size ladder owns cell dimensions, so size and density stay
     independent axes. Ratio mirrors sizing.css (0.75 / 1 / 1.25). */
  .pagination:where([data-density="compact"]) {
    & .pagination-list {
      gap: 0.125rem;
    }
  }
  .pagination:where([data-density="comfortable"]) {
    & .pagination-list {
      gap: 0.25rem;
    }
  }
  .pagination:where([data-density="spacious"]) {
    & .pagination-list {
      gap: 0.5rem;
    }
  }
}

/* ── components/steps/steps.css ── */
@layer components {
  /* --_accent / --_accent-fg: the color of done (complete) and current steps -
     --primary unless data-variant (on the list, or on one step) picks another */
  .steps {
    --_accent: var(--primary);
    --_accent-fg: var(--primary-foreground);
    display: flex;
    gap: 0.5rem;
    list-style: none;
    margin: 0;
    padding: 0;
  }
  .step {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    position: relative;
    text-align: center;
    &:not(:last-child)::after {
      content: "";
      position: absolute;
      top: 1rem;
      left: calc(50% + 1.25rem);
      right: calc(-50% + 1.25rem);
      height: 2px;
      background-color: var(--border);
    }
    &[data-status="complete"]::after {
      background-color: var(--_accent);
    }
    &[data-status="error"]::after {
      background-color: var(--destructive);
    }
  }
  .step-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
    border: 2px solid var(--border);
    color: var(--muted-foreground);
    background-color: var(--background);
    position: relative;
    z-index: 1;
    .step[data-status="current"] & {
      border-color: var(--_accent);
      color: var(--_accent);
    }
    .step[data-status="complete"] & {
      border-color: var(--_accent);
      background-color: var(--_accent);
      color: var(--_accent-fg);
    }
    .step[data-status="error"] & {
      border-color: var(--destructive);
      background-color: var(--destructive);
      color: var(--destructive-foreground);
    }

    & svg {
      width: 0.875rem;
      height: 0.875rem;
      pointer-events: none;
    }
    /* a glyph of your own - emoji, symbol, icon - a size up from the number */
    & .step-icon {
      font-size: 1.5em;
      line-height: 1;
      display: grid;
      place-items: center;
    }
    & .step-icon svg {
      width: 1.2em;
      height: 1.2em;
    }
  }
  /* data-variant="plain" on the indicator: no circle - just the glyph
     (an emoji step); the status still tints a symbol or icon */
  .steps .step .step-indicator[data-variant="plain"] {
    border-color: transparent;
    background-color: transparent;
    font-size: 1.25rem;
  }
  .steps .step:is([data-status="complete"], [data-status="current"]) .step-indicator[data-variant="plain"] {
    color: var(--_accent);
  }
  .steps .step[data-status="error"] .step-indicator[data-variant="plain"] {
    color: var(--destructive);
  }

  /* -- Colors: data-variant on .steps (every step) or on one .step -------
     secondary / accent use --chart-2 / --chart-4 (the tokens' --secondary /
     --accent are pale surfaces); success / warning / info are literals - the
     token set has no such pairs. */
  :is(.steps, .step)[data-variant="neutral"] {
    --_accent: var(--foreground);
    --_accent-fg: var(--background);
  }
  :is(.steps, .step)[data-variant="primary"] {
    --_accent: var(--primary);
    --_accent-fg: var(--primary-foreground);
  }
  :is(.steps, .step)[data-variant="secondary"] {
    --_accent: var(--chart-2);
    --_accent-fg: #fff;
  }
  :is(.steps, .step)[data-variant="accent"] {
    --_accent: var(--chart-4);
    --_accent-fg: #fff;
  }
  :is(.steps, .step)[data-variant="info"] {
    --_accent: #0ea5e9;
    --_accent-fg: #fff;
  }
  :is(.steps, .step)[data-variant="success"] {
    --_accent: #16a34a;
    --_accent-fg: #fff;
  }
  :is(.steps, .step)[data-variant="warning"] {
    --_accent: #f59e0b;
    --_accent-fg: #1c1917;
  }
  :is(.steps, .step):is([data-variant="destructive"], [data-variant="error"]) {
    --_accent: var(--destructive);
    --_accent-fg: var(--destructive-foreground);
  }
  .step-content {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
  }
  .step-title {
    margin: 0;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--foreground);
  }
  .step-description {
    margin: 0;
    font-size: 0.75rem;
    color: var(--muted-foreground);
  }

  /* -- Clickable steps ---------------------------------------- */
  .step[data-clickable] .step-indicator {
    cursor: pointer;
    &:hover {
      opacity: 0.85;
    }
  }

  /* -- Size variants ------------------------------------------
     Five-step ladder (xs–xl). md == the unsized default (2rem indicator),
     so md is selectable everywhere without a visual jump. Connector
     offsets follow the existing pattern per indicator size I: horizontal
     top = I/2, left inset = I/2 + 0.25rem; vertical top = I + 0.25rem,
     left = I/2 - 1px (centers the 2px bar under the indicator). */
  .steps[data-size="xs"] {
    & .step:not(:last-child)::after {
      top: 0.625rem;
      left: calc(50% + 0.875rem);
      right: calc(-50% + 0.875rem);
    }
    & .step-indicator {
      width: 1.25rem;
      height: 1.25rem;
      font-size: 0.625rem;
    }
    & .step-indicator svg {
      width: 0.625rem;
      height: 0.625rem;
    }
    & .step-title {
      font-size: 0.6875rem;
    }
    & .step-description {
      font-size: 0.625rem;
    }
    &[data-orientation="vertical"] .step:not(:last-child)::after {
      top: 1.5rem;
      left: 0.5625rem;
      height: calc(100% - 1.5rem);
    }
  }

  .steps[data-size="sm"] {
    & .step:not(:last-child)::after {
      top: 0.75rem;
      left: calc(50% + 1rem);
      right: calc(-50% + 1rem);
    }
    & .step-indicator {
      width: 1.5rem;
      height: 1.5rem;
      font-size: 0.6875rem;
    }
    & .step-indicator svg {
      width: 0.75rem;
      height: 0.75rem;
    }
    & .step-title {
      font-size: 0.75rem;
    }
    & .step-description {
      font-size: 0.6875rem;
    }
    &[data-orientation="vertical"] .step:not(:last-child)::after {
      top: 1.75rem;
      left: 0.6875rem;
      height: calc(100% - 1.75rem);
    }
  }

  .steps[data-size="md"] {
    & .step:not(:last-child)::after {
      top: 1rem;
      left: calc(50% + 1.25rem);
      right: calc(-50% + 1.25rem);
    }
    & .step-indicator {
      width: 2rem;
      height: 2rem;
      font-size: 0.75rem;
    }
    & .step-indicator svg {
      width: 0.875rem;
      height: 0.875rem;
    }
    & .step-title {
      font-size: 0.8125rem;
    }
    & .step-description {
      font-size: 0.75rem;
    }
    &[data-orientation="vertical"] .step:not(:last-child)::after {
      top: 2.25rem;
      left: 0.9375rem;
      height: calc(100% - 2.25rem);
    }
  }

  .steps[data-size="lg"] {
    & .step:not(:last-child)::after {
      top: 1.25rem;
      left: calc(50% + 1.5rem);
      right: calc(-50% + 1.5rem);
    }
    & .step-indicator {
      width: 2.5rem;
      height: 2.5rem;
      font-size: 0.875rem;
    }
    & .step-indicator svg {
      width: 1rem;
      height: 1rem;
    }
    & .step-title {
      font-size: 0.9375rem;
    }
    & .step-description {
      font-size: 0.8125rem;
    }
    &[data-orientation="vertical"] .step:not(:last-child)::after {
      top: 2.75rem;
      left: 1.1875rem;
      height: calc(100% - 2.75rem);
    }
  }

  .steps[data-size="xl"] {
    & .step:not(:last-child)::after {
      top: 1.5rem;
      left: calc(50% + 1.75rem);
      right: calc(-50% + 1.75rem);
    }
    & .step-indicator {
      width: 3rem;
      height: 3rem;
      font-size: 1rem;
    }
    & .step-indicator svg {
      width: 1.125rem;
      height: 1.125rem;
    }
    & .step-title {
      font-size: 1.0625rem;
    }
    & .step-description {
      font-size: 0.875rem;
    }
    &[data-orientation="vertical"] .step:not(:last-child)::after {
      top: 3.25rem;
      left: 1.4375rem;
      height: calc(100% - 3.25rem);
    }
  }

  /* -- Vertical orientation ---------------------------------- */
  .steps[data-orientation="vertical"] {
    flex-direction: column;
    gap: 0;

    & .step {
      flex-direction: row;
      align-items: flex-start;
      text-align: left;
      padding-bottom: 1.5rem;

      &:not(:last-child)::after {
        top: 2.25rem;
        left: 0.9375rem;
        right: auto;
        width: 2px;
        height: calc(100% - 2.25rem);
      }
    }

    & .step-content {
      padding-top: 0.25rem;
    }
  }

  /* -- Responsive: data-orientation="responsive" stacks vertically below
     48rem and runs horizontally from there up (DaisyUI's
     steps-vertical lg:steps-horizontal) */
  @media (max-width: 47.99rem) {
    .steps[data-orientation="responsive"] {
      flex-direction: column;
      gap: 0;

      & .step {
        flex-direction: row;
        align-items: flex-start;
        text-align: left;
        padding-bottom: 1.5rem;

        &:not(:last-child)::after {
          top: 2.25rem;
          left: 0.9375rem;
          right: auto;
          width: 2px;
          height: calc(100% - 2.25rem);
        }
      }

      & .step-content {
        padding-top: 0.25rem;
      }
      &[data-size="xs"] .step:not(:last-child)::after {
        top: 1.5rem;
        left: 0.5625rem;
        height: calc(100% - 1.5rem);
      }
      &[data-size="sm"] .step:not(:last-child)::after {
        top: 1.75rem;
        left: 0.6875rem;
        height: calc(100% - 1.75rem);
      }
      &[data-size="md"] .step:not(:last-child)::after {
        top: 2.25rem;
        left: 0.9375rem;
        height: calc(100% - 2.25rem);
      }
      &[data-size="lg"] .step:not(:last-child)::after {
        top: 2.75rem;
        left: 1.1875rem;
        height: calc(100% - 2.75rem);
      }
      &[data-size="xl"] .step:not(:last-child)::after {
        top: 3.25rem;
        left: 1.4375rem;
        height: calc(100% - 3.25rem);
      }
    }
  }

  /* -- Accessibility ------------------------------------------ */

  @media (prefers-reduced-motion: reduce) {
    .step-indicator,
    .step:not(:last-child)::after {
      transition: none;
    }
  }

  @media (prefers-contrast: more) {
    .step-indicator {
      border-width: 3px;
    }
    .step:not(:last-child)::after {
      height: 3px;
    }
    .steps[data-orientation="vertical"] .step:not(:last-child)::after {
      width: 3px;
      height: calc(100% - 2.25rem);
    }
  }

  @media (forced-colors: active) {
    .step-indicator {
      border-color: ButtonText;
      .step[data-status="current"] & {
        border-color: Highlight;
        color: Highlight;
      }
      .step[data-status="complete"] & {
        border-color: Highlight;
        background: Highlight;
        color: HighlightText;
      }
      .step[data-status="error"] & {
        border-color: Mark;
        background: Mark;
        color: MarkText;
      }
    }
    .step:not(:last-child)::after {
      background: ButtonText;
    }
    .step[data-status="complete"]:not(:last-child)::after {
      background: Highlight;
    }
    .step[data-status="error"]:not(:last-child)::after {
      background: Mark;
    }
  }
  /* -- Density ----------------------------------------------------
     data-density on the .steps root scales the flex gaps only - the size
     ladder owns indicator/typography, size and density stay independent.
     comfortable == the unsized default (.5rem / .125rem). */
  .steps:where([data-density="compact"]) {
    gap: 0.375rem;
    & .step {
      gap: 0.375rem;
    }
    & .step-content {
      gap: 0.0625rem;
    }
  }
  .steps:where([data-density="comfortable"]) {
    gap: 0.5rem;
    & .step {
      gap: 0.5rem;
    }
    & .step-content {
      gap: 0.125rem;
    }
  }
  .steps:where([data-density="spacious"]) {
    gap: 0.75rem;
    & .step {
      gap: 0.75rem;
    }
    & .step-content {
      gap: 0.25rem;
    }
  }
}

/* ── components/tabs/tabs.css ── */
/* -- Tabs component -------------------------------------------- */

@layer components {
  /* -- Default (pill) variant ----------------------------------- */
  /* An inline GRID, one minmax(0, max-content) track per tab: when the row
     is too narrow, every track grows from 0 at the same pace, so short labels
     reach their full width first and only the long ones are cut ("…") -
     flex-shrink would clip a short "Churn" as eagerly as a long label. */
  .tab-list {
    display: inline-grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(0, max-content);
    align-items: center;
    /* never wider than its container: the triggers shrink and ellipsize */
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    background: var(--muted);
    border-radius: var(--radius-lg);
    padding: 0.25rem;
    gap: 0.125rem;

    /* -- Sizes: trigger font + padding scale (set data-size on .tab-list).
       :where() keeps these at one class of specificity over the plain
       .tab-trigger base. md == each variant's own base padding, so md is
       selectable everywhere without a visual change. Paddings are logical
       (block / inline), so they turn with the vertical labels of side tabs.
       The line variant's trigger base (0.5rem/1rem, nested in
       [data-variant="line"]) outranks the :where() rules, so its overrides
       are un-:where()'d (two attrs). */
    &:where([data-size="xs"]) .tab-trigger {
      padding-block: 0.25rem;
      padding-inline: 0.5rem;
      font-size: 0.75rem;
    }
    &:where([data-size="sm"]) .tab-trigger {
      padding-block: 0.3125rem;
      padding-inline: 0.625rem;
      font-size: 0.8125rem;
    }
    &:where([data-size="md"]) .tab-trigger {
      padding-block: 0.375rem;
      padding-inline: 0.75rem;
      font-size: 0.875rem;
    }
    &:where([data-size="lg"]) .tab-trigger {
      padding-block: 0.5rem;
      padding-inline: 1rem;
      font-size: 1rem;
    }
    &:where([data-size="xl"]) .tab-trigger {
      padding-block: 0.625rem;
      padding-inline: 1.25rem;
      font-size: 1.125rem;
    }
    &[data-variant="line"][data-size="xs"] .tab-trigger {
      padding-block: 0.25rem;
      padding-inline: 0.5rem;
    }
    &[data-variant="line"][data-size="sm"] .tab-trigger {
      padding-block: 0.375rem;
      padding-inline: 0.75rem;
    }
    &[data-variant="line"][data-size="md"] .tab-trigger {
      padding-block: 0.5rem;
      padding-inline: 1rem;
    }
    &[data-variant="line"][data-size="lg"] .tab-trigger {
      padding-block: 0.625rem;
      padding-inline: 1.25rem;
    }
    &[data-variant="line"][data-size="xl"] .tab-trigger {
      padding-block: 0.75rem;
      padding-inline: 1.5rem;
    }

    /* -- Line variant --------------------------------------------- */
    &[data-variant="line"] {
      background: transparent;
      border-radius: 0;
      padding: 0;
      gap: 0;
      border-bottom: 1px solid var(--border);

      & .tab-trigger {
        border-radius: 0;
        padding-block: 0.5rem;
        padding-inline: 1rem;
        border-bottom: 2px solid transparent;
        margin-bottom: -1px;

        &[aria-selected="true"] {
          background: transparent;
          color: var(--foreground);
          border-bottom-color: var(--primary);
          box-shadow: none;
        }
      }
    }

    /* -- Vertical orientation ------------------------------------ */
    &[aria-orientation="vertical"] {
      grid-auto-flow: row;
      grid-auto-rows: minmax(0, max-content);
      grid-auto-columns: auto;
      align-items: stretch;
      width: auto;

      & .tab-trigger {
        text-align: start;
      }
    }
  }

  /* A trigger is a BLOCK box (not inline-flex): text-overflow only works on
     a block container's own line, and a flex container would wrap a bare
     label in an anonymous box that never ellipsizes. Icons and emoji ride
     inline in front of the label - svg / img / .tab-icon - so plain
     <button>Label</button> markup keeps working and a long label ends in "…"
     when the list runs out of room (horizontal and vertical alike). */
  .tab-trigger {
    display: block;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: center;
    line-height: 1.25rem;
    padding-block: 0.375rem;
    padding-inline: 0.75rem;
    border-radius: calc(var(--radius) * 0.6);
    font-size: 0.875rem;
    font-weight: 500;
    border: none;
    background: transparent;
    color: var(--muted-foreground);
    cursor: pointer;
    transition: all 150ms ease;
    outline: none;

    & :is(svg, img, .tab-icon) {
      display: inline-block;
      vertical-align: middle;
      margin-inline-end: 0.5em;
      line-height: 1;
    }
    & :is(svg, img) {
      inline-size: 1em;
      block-size: 1em;
      translate: 0 -0.0625em;
    }

    &[aria-selected="true"] {
      background: var(--background);
      color: var(--foreground);
      box-shadow:
        0 1px 3px oklch(0 0 0 / 0.08),
        0 0 0 1px var(--border);
    }

    &:focus-visible {
      outline: 2px solid var(--ring);
      outline-offset: 2px;
    }

    &:disabled {
      cursor: not-allowed;
      opacity: 0.5;
    }
  }

  /* -- Layout: which side of the panel the tabs sit on ---------
     data-side="top|bottom|left|right" on .tabs (default top; a vertical
     tablist without data-side keeps the old settings-nav layout) and
     data-align="start|center|end" for where the tabs cluster along that
     edge (top/bottom: start = left; left/right: start = top). The DOM order
     never changes - tablist first - only the visual side. :where() keeps the
     side selectors at zero specificity, so variants override them cleanly. */
  .tabs {
    display: flex;
    flex-direction: column;
    min-width: 0;

    & > .tab-list {
      align-self: flex-start;
    }
    &[data-align="center"] > .tab-list {
      align-self: center;
    }
    &[data-align="end"] > .tab-list {
      align-self: flex-end;
    }

    &:where([data-side="bottom"]) {
      & > .tab-list {
        order: 2;
      }
      & > .tab-content {
        margin-top: 0;
        margin-bottom: 0.75rem;
      }
    }

    /* the older aria-orientation-only markup: a settings nav beside the
       panel, horizontal labels (ellipsized past 40% of the width) */
    &:where(:not([data-side]):has(> .tab-list[aria-orientation="vertical"])) {
      flex-direction: row;
      align-items: flex-start;
      gap: 1rem;

      & > .tab-list {
        max-width: 40%;
      }
      & > .tab-content {
        margin: 0;
        flex: 1;
        min-width: 0;
      }
      &:dir(rtl) {
        flex-direction: row-reverse;
      }
    }

    /* data-side left / right: a two-column grid. The tab column has
       height 0 + min-height 100% - it adds nothing to the row, so the PANEL
       decides the height and the column fills it: when the labels need more
       room than the panel is tall, they shrink and ellipsize. left / right
       are physical sides, also in RTL. */
    &:where([data-side="left"], [data-side="right"]) {
      display: grid;
      grid-template-columns: auto minmax(0, 1fr);
      grid-template-areas: "list panel";
      column-gap: 1rem;

      & > .tab-list {
        grid-area: list;
        grid-auto-flow: row;
        grid-auto-rows: minmax(0, max-content);
        grid-auto-columns: auto;
        align-items: stretch;
        align-self: stretch;
        align-content: start;
        height: 0;
        min-height: 100%;
        max-width: none;
      }
      &[data-align="center"] > .tab-list {
        align-content: center;
      }
      &[data-align="end"] > .tab-list {
        align-content: end;
      }
      & > .tab-content {
        grid-area: panel;
        margin: 0;
        min-width: 0;
      }

      /* the labels run vertically along the panel edge - right-hand tabs
         read top to bottom, left-hand ones bottom to top (like book spines;
         sideways-lr where supported, else top to bottom too). The logical
         trigger paddings turn with the writing mode, and icons and emoji
         turn with the label: text-orientation: sideways lays emoji on
         their side like any other glyph, and svg / img (which a vertical
         line would keep upright) rotate a quarter turn. */
      & > .tab-list .tab-trigger {
        writing-mode: vertical-rl;
        text-orientation: sideways;
        text-align: center;

        & :is(svg, img) {
          rotate: 90deg;
        }
      }
    }
    &:where([data-side="right"]) {
      grid-template-columns: minmax(0, 1fr) auto;
      grid-template-areas: "panel list";
    }
    &:where([data-side="left"]):dir(rtl) {
      grid-template-columns: minmax(0, 1fr) auto;
      grid-template-areas: "panel list";
    }
    &:where([data-side="right"]):dir(rtl) {
      grid-template-columns: auto minmax(0, 1fr);
      grid-template-areas: "list panel";
    }
    @supports (writing-mode: sideways-lr) {
      /* sideways-lr lays emoji on their side, but svg / img keep their
         orientation: a quarter turn back, so they point up the line */
      &:where([data-side="left"]) > .tab-list .tab-trigger {
        writing-mode: sideways-lr;

        & :is(svg, img) {
          rotate: -90deg;
        }
      }
    }
  }

  /* line variant: the rule sits on the edge that faces the panel (physical
     sides for left / right - the trigger's own writing mode is vertical, so
     its logical inline-end would point down) */
  .tabs[data-side="bottom"] > .tab-list[data-variant="line"] {
    border-bottom: none;
    border-top: 1px solid var(--border);

    & .tab-trigger {
      border-bottom: none;
      border-top: 2px solid transparent;
      margin-bottom: 0;
      margin-top: -1px;

      &[aria-selected="true"] {
        border-top-color: var(--primary);
      }
    }
  }
  .tabs:is([data-side="left"], [data-side="right"], :not([data-side]):has(> .tab-list[aria-orientation="vertical"]))
    > .tab-list[data-variant="line"] {
    border-bottom: none;

    & .tab-trigger {
      border-bottom: none;
      margin-bottom: 0;
    }
  }
  .tabs:is([data-side="left"], :not([data-side]):has(> .tab-list[aria-orientation="vertical"]))
    > .tab-list[data-variant="line"] {
    border-right: 1px solid var(--border);

    & .tab-trigger {
      border-right: 2px solid transparent;
      margin-right: -1px;

      &[aria-selected="true"] {
        border-right-color: var(--primary);
      }
    }
  }
  .tabs[data-side="right"] > .tab-list[data-variant="line"] {
    border-left: 1px solid var(--border);

    & .tab-trigger {
      border-left: 2px solid transparent;
      margin-left: -1px;

      &[aria-selected="true"] {
        border-left-color: var(--primary);
      }
    }
  }

  /* -- Attached variant: folder tabs joined to the panel's card --
     data-variant="attached" on the .tab-list; each panel holds a .card.
     The selected tab takes the card surface and covers the card's border
     where they meet, so tab and card read as one shape. The card corner the
     tabs grow from is squared; every ROUNDED corner keeps the tabs a card
     radius (--radius-xl) away, so no tab ever sits on a curve - start keeps
     the far end clear, end the near one, center both. */
  .tab-list[data-variant="attached"] {
    background: transparent;
    border-radius: 0;
    padding: 0;
    gap: 0.25rem;
    position: relative;
    z-index: 1;

    & .tab-trigger {
      border: 1px solid var(--border);
      background: var(--muted);
      box-shadow: none;
      border-radius: var(--radius-md) var(--radius-md) 0 0;

      &[aria-selected="true"] {
        background: var(--card);
        color: var(--card-foreground);
        box-shadow: none;
        border-bottom-color: var(--card);
      }
    }
  }
  .tabs:has(> .tab-list[data-variant="attached"]) {
    gap: 0;
    column-gap: 0;

    & > .tab-content {
      margin: 0;
    }

    /* top (default) / bottom: the tabs overlap the card border by 1px and
       stay clear of the rounded corner(s) along the row */
    & > .tab-list[data-variant="attached"] {
      margin-bottom: -1px;
      margin-inline-end: var(--radius-xl);
      max-width: calc(100% - var(--radius-xl));
    }
    &[data-align="end"] > .tab-list[data-variant="attached"] {
      margin-inline: var(--radius-xl) 0;
    }
    &[data-align="center"] > .tab-list[data-variant="attached"] {
      margin-inline: var(--radius-xl);
      max-width: calc(100% - 2 * var(--radius-xl));
    }

    &[data-side="bottom"] > .tab-list[data-variant="attached"] {
      margin-top: -1px;
      margin-bottom: 0;

      & .tab-trigger {
        border-radius: 0 0 var(--radius-md) var(--radius-md);
        &[aria-selected="true"] {
          border-bottom-color: var(--border);
          border-top-color: var(--card);
        }
      }
    }

    /* left / right (and the legacy column): the gap runs down the column */
    &:is([data-side="left"], [data-side="right"], :not([data-side]):has(> .tab-list[aria-orientation="vertical"])) {
      & > .tab-list[data-variant="attached"] {
        margin-block: 0;
        margin-inline: 0;
        max-width: none;
        grid-auto-flow: row;
        grid-auto-rows: minmax(0, max-content);
        grid-auto-columns: auto;
        padding-bottom: var(--radius-xl);

        & .tab-trigger {
          width: 100%;
        }
      }
      &[data-align="end"] > .tab-list[data-variant="attached"] {
        padding-block: var(--radius-xl) 0;
      }
      &[data-align="center"] > .tab-list[data-variant="attached"] {
        padding-block: var(--radius-xl);
      }
    }
    /* legacy column (a flex row): the card grows to the column's height */
    &:not([data-side]):has(> .tab-list[aria-orientation="vertical"]) {
      & > .tab-list[data-variant="attached"] {
        max-width: 40%;
      }
      & > .tab-content:not([hidden]) {
        align-self: stretch;
        display: flex;
        flex-direction: column;

        & > .card {
          flex: 1;
        }
      }
    }
    &:is([data-side="left"], :not([data-side]):has(> .tab-list[aria-orientation="vertical"]))
      > .tab-list[data-variant="attached"] {
      margin-right: -1px;

      & .tab-trigger {
        border-radius: var(--radius-md) 0 0 var(--radius-md);
        &[aria-selected="true"] {
          border-bottom-color: var(--border);
          border-right-color: var(--card);
        }
      }
    }
    &[data-side="right"] > .tab-list[data-variant="attached"] {
      margin-left: -1px;

      & .tab-trigger {
        border-radius: 0 var(--radius-md) var(--radius-md) 0;
        &[aria-selected="true"] {
          border-bottom-color: var(--border);
          border-left-color: var(--card);
        }
      }
    }

    /* the card corner the aligned tabs grow from is square */
    &:not([data-side]):not(:has(> .tab-list[aria-orientation="vertical"])):not([data-align="center"]):not(
        [data-align="end"]
      )
      > .tab-content
      > .card {
      border-start-start-radius: 0;
    }
    &:not([data-side]):not(:has(> .tab-list[aria-orientation="vertical"]))[data-align="end"] > .tab-content > .card {
      border-start-end-radius: 0;
    }
    &[data-side="top"]:not([data-align="center"]):not([data-align="end"]) > .tab-content > .card {
      border-start-start-radius: 0;
    }
    &[data-side="top"][data-align="end"] > .tab-content > .card {
      border-start-end-radius: 0;
    }
    &[data-side="bottom"]:not([data-align="center"]):not([data-align="end"]) > .tab-content > .card {
      border-end-start-radius: 0;
    }
    &[data-side="bottom"][data-align="end"] > .tab-content > .card {
      border-end-end-radius: 0;
    }
    &:is([data-side="left"], :not([data-side]):has(> .tab-list[aria-orientation="vertical"])):not(
        [data-align="center"]
      ):not([data-align="end"])
      > .tab-content
      > .card {
      border-top-left-radius: 0;
    }
    &:is([data-side="left"], :not([data-side]):has(> .tab-list[aria-orientation="vertical"]))[data-align="end"]
      > .tab-content
      > .card {
      border-bottom-left-radius: 0;
    }
    &[data-side="right"]:not([data-align="center"]):not([data-align="end"]) > .tab-content > .card {
      border-top-right-radius: 0;
    }
    &[data-side="right"][data-align="end"] > .tab-content > .card {
      border-bottom-right-radius: 0;
    }
  }

  /* -- Panel ---------------------------------------------------- */
  .tab-content {
    margin-top: 0.75rem;

    &:focus-visible {
      outline: 2px solid var(--ring);
      outline-offset: 2px;
    }

    &[hidden] {
      display: none;
    }
  }

  /* -- Accessibility ------------------------------------------ */

  @media (prefers-reduced-motion: reduce) {
    .tab-trigger {
      transition: none;
    }
  }

  @media (forced-colors: active) {
    .tab-trigger[aria-selected="true"] {
      border: 2px solid Highlight;
      box-shadow: none;
    }
    .tab-trigger:disabled {
      color: GrayText;
    }

    .tab-list[data-variant="line"] .tab-trigger[aria-selected="true"] {
      border: none;
      border-bottom: 2px solid Highlight;
    }
  }
}

/* ── components/dropdown/dropdown.css ── */
/* -- Dropdown component ---------------------------------------- */

@layer components {
  .dropdown-content {
    background-color: var(--popover);
    color: var(--popover-foreground);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 0.25rem;
    min-width: 8rem;
    box-shadow:
      0 4px 16px oklch(0 0 0 / 0.12),
      0 0 0 1px var(--border);

    /* -- Anchor positioning ------------------------------------ */
    position: fixed;
    inset: auto;
    top: anchor(bottom);
    left: anchor(left);
    margin: 0;
    margin-top: 4px;
    /* the preferred edge first; when the menu would leave the viewport it
       flips to the trigger's OTHER edge (flip-inline swaps left: anchor(left)
       <-> right: anchor(right)), above the trigger (flip-block), or both */
    position-try-fallbacks:
      flip-inline,
      flip-block,
      flip-block flip-inline;

    /* data-align="end": the menu's end edge lines up with the trigger's end
       (a split button's chevron, an icon trigger at a row's end) instead of
       hanging out past it - and falls back to start-aligned under the
       trigger when there is no room for that (the fallbacks above) */
    &[data-align="end"] {
      left: auto;
      right: anchor(right);
    }

    /* -- Animation --------------------------------------------- */
    opacity: 0;
    transform: scale(0.96) translateY(-0.25rem);
    /* overlay keeps a closing menu in the top layer until its exit
       animation ends - otherwise a closing SUBMENU drops back into its
       parent menu for 150ms, where the parent's transform makes it the
       containing block: the parent grew scrollbars and resized */
    transition:
      opacity 150ms ease,
      transform 150ms ease,
      overlay 150ms allow-discrete,
      display 150ms allow-discrete;
    /* a menu never scrolls sideways; submenus live in the top layer */
    overflow-x: hidden;

    &:popover-open {
      opacity: 1;
      transform: scale(1) translateY(0);
    }
  }

  @starting-style {
    .dropdown-content:popover-open {
      opacity: 0;
      transform: scale(0.96) translateY(-0.25rem);
    }
  }

  .dropdown-item {
    box-sizing: border-box;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.375rem 0.5rem;
    border-radius: calc(var(--radius) * 0.6);
    font-size: 0.875rem;
    border: none;
    background: transparent;
    color: var(--foreground);
    cursor: pointer;
    outline: none;
    text-align: start;
    text-decoration: none;
    font: inherit;
    font-size: 0.875rem;

    &:hover,
    &[data-highlighted] {
      background-color: var(--accent);
      color: var(--accent-foreground);
    }

    &[data-variant="destructive"] {
      &:hover,
      &[data-highlighted] {
        background-color: var(--destructive);
        color: var(--destructive-foreground);
      }
    }

    &:disabled,
    &[aria-disabled="true"] {
      pointer-events: none;
      opacity: 0.5;
    }

    /* data-inset: lines a plain item (or a label) up with the text of
       checkbox / radio items */
    &[data-inset] {
      padding-inline-start: 1.5rem;
    }
    & > svg {
      width: 1rem;
      height: 1rem;
      flex-shrink: 0;
      color: var(--muted-foreground);
    }
    &[data-variant="destructive"] > svg {
      color: currentColor;
    }
  }
  .dropdown-label[data-inset] {
    padding-inline-start: 1.5rem;
  }

  /* -- Submenus ----------------------------------------------------
     <div class="dropdown-sub">
       <button class="dropdown-item dropdown-sub-trigger" role="menuitem">…</button>
       <div class="dropdown-content dropdown-sub-content" role="menu" popover>…</div>
     </div>
     The submenu is a DOM descendant of its menu, so the Popover API keeps
     the parent open while it shows, closes open siblings and light-dismisses
     the whole tree - any depth. It opens beside its trigger (flipping to
     the other side, or up, when there is no room); dropdown.js anchors it. */
  .dropdown-sub {
    display: contents;
  }
  .dropdown-sub-trigger {
    &::after {
      content: "";
      width: 1rem;
      height: 1rem;
      margin-inline-start: auto;
      flex-shrink: 0;
      background-color: currentColor;
      opacity: 0.6;
      mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m9 18 6-6-6-6'/%3E%3C/svg%3E")
        center / contain no-repeat;
    }
    &:dir(rtl)::after {
      scale: -1 1;
    }
    /* the shortcut sits before the chevron */
    & .dropdown-shortcut {
      margin-inline-start: auto;
    }
    &:has(.dropdown-shortcut)::after {
      margin-inline-start: 0.5rem;
    }
    &[aria-expanded="true"] {
      background-color: var(--accent);
      color: var(--accent-foreground);
    }
  }
  .dropdown-content.dropdown-sub-content {
    top: anchor(top);
    left: anchor(right);
    margin: 0;
    margin-block-start: calc(-0.25rem - 1px);
    margin-inline-start: 0.125rem;
    position-try-fallbacks:
      flip-inline,
      flip-block,
      flip-block flip-inline;
    transform: scale(0.96) translateX(-0.25rem);

    &:popover-open {
      transform: none;
    }
    &:dir(rtl) {
      left: auto;
      right: anchor(left);
    }
  }
  @starting-style {
    .dropdown-content.dropdown-sub-content:popover-open {
      opacity: 0;
      transform: scale(0.96) translateX(-0.25rem);
    }
  }

  /* -- Checkbox / Radio indicators ----------------------------- */
  .dropdown-check,
  .dropdown-radio {
    padding-inline-start: 1.5rem;
    position: relative;

    &::before {
      content: "";
      position: absolute;
      inset-inline-start: 0.375rem;
      top: 50%;
      transform: translateY(-50%);
      width: 0.875rem;
      height: 0.875rem;
    }
  }

  /* Mask (not background-image): a data: URI SVG resolves currentColor to
     BLACK when used as an image, making the checks invisible in dark mode.
     Masking paints them with background-color: currentColor instead. */
  .dropdown-check[aria-checked="true"]::before,
  .dropdown-radio[aria-checked="true"]::before {
    background-color: currentColor;
  }

  .dropdown-check[aria-checked="true"]::before {
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E");
  }

  .dropdown-radio[aria-checked="true"]::before {
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='black'%3E%3Ccircle cx='12' cy='12' r='4.5'/%3E%3C/svg%3E");
  }

  .dropdown-check[aria-checked="true"]::before,
  .dropdown-radio[aria-checked="true"]::before {
    mask-size: contain;
    mask-repeat: no-repeat;
  }

  .dropdown-separator {
    height: 1px;
    background: var(--border);
    margin: 0.25rem -0.25rem;
  }

  .dropdown-label {
    padding: 0.375rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--muted-foreground);
  }

  .dropdown-shortcut {
    margin-inline-start: auto;
    font-size: 0.75rem;
    color: var(--muted-foreground);
    letter-spacing: 0.05em;
  }
  /* one highlighted item: a menu that opens under a resting pointer has the item under it hovered and its first item
     highlighted - the highlight (keys and mouse move it) wins, the hovered one stays plain until the pointer moves */
  .dropdown-content:has([data-highlighted]) .dropdown-item:hover:not([data-highlighted], :focus-visible, :disabled) {
    background-color: transparent;
    color: inherit;
  }
  /* on a destructive highlight the shortcut follows the item's foreground
     (muted grey on red was unreadable) */
  .dropdown-item[data-variant="destructive"]:is(:hover, [data-highlighted]) .dropdown-shortcut {
    color: inherit;
    opacity: 0.8;
  }

  /* -- Sizes ----------------------------------------------------
     data-size goes on the .dropdown-content popover; items, labels,
     shortcuts and the check indicators scale together. md == the unsized
     default. The [data-size] compound outranks the single-class item
     rules; it only touches block padding/font so the check/radio inline
     padding (padding-inline-start) keeps working. */
  .dropdown-content[data-size="xs"] {
    & .dropdown-item {
      padding-block: 0.1875rem;
      font-size: 0.75rem;
    }
    & .dropdown-label {
      padding-block: 0.1875rem;
      font-size: 0.6875rem;
    }
    & .dropdown-shortcut {
      font-size: 0.6875rem;
    }
    & :is(.dropdown-check, .dropdown-radio)::before {
      width: 0.75rem;
      height: 0.75rem;
    }
  }
  .dropdown-content[data-size="sm"] {
    & .dropdown-item {
      padding-block: 0.25rem;
      font-size: 0.8125rem;
    }
    & .dropdown-shortcut {
      font-size: 0.75rem;
    }
  }
  .dropdown-content[data-size="md"] {
    & .dropdown-item {
      padding-block: 0.375rem;
      font-size: 0.875rem;
    }
  }
  .dropdown-content[data-size="lg"] {
    & .dropdown-item {
      padding-block: 0.5rem;
      font-size: 1rem;
    }
    & .dropdown-label {
      font-size: 0.8125rem;
    }
    & .dropdown-shortcut {
      font-size: 0.875rem;
    }
  }
  .dropdown-content[data-size="xl"] {
    & .dropdown-item {
      padding-block: 0.625rem;
      font-size: 1.125rem;
    }
    & .dropdown-label {
      font-size: 0.875rem;
    }
    & .dropdown-shortcut {
      font-size: 1rem;
    }
  }

  /* -- Accessibility ------------------------------------------ */

  @media (prefers-reduced-motion: reduce) {
    .dropdown-content {
      transition: none;
    }
    .dropdown-item {
      transition: none;
    }
  }

  @media (forced-colors: active) {
    .dropdown-content {
      border-color: ButtonText;
    }
    .dropdown-item {
      &:hover,
      &[data-highlighted] {
        forced-color-adjust: none;
        background: Highlight;
        color: HighlightText;
      }
    }
  }
}

/* ── components/menubar/menubar.css ── */
/* -- Menubar component ----------------------------------------------- */
/* A horizontal bar of menu triggers - File, Edit, View - each opening a
   dropdown menu (dropdown.css / dropdown.js, submenus included). The bar
   is the menubar; menubar.js adds moving between the menus. */

@layer components {
  .menubar {
    display: flex;
    align-items: center;
    gap: 0.125rem;
    width: fit-content;
    max-width: 100%;
    padding: 0.25rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--background);
    box-shadow: var(--shadow-2xs);

    &[data-variant="ghost"] {
      border-color: transparent;
      box-shadow: none;
      padding: 0;
    }
    &[data-variant="muted"] {
      background: var(--muted);
      border-color: transparent;
      box-shadow: none;
    }

    /* -- Sizes: the triggers scale (the menus keep their own data-size) */
    &[data-size="sm"] .menubar-trigger {
      height: 1.625rem;
      padding-inline: 0.5rem;
      font-size: 0.8125rem;
    }
    &[data-size="lg"] .menubar-trigger {
      height: 2.25rem;
      padding-inline: 0.875rem;
      font-size: 0.9375rem;
    }
  }

  .menubar-trigger {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    height: 1.875rem;
    padding-inline: 0.625rem;
    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--foreground);
    font: inherit;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: default;
    user-select: none;
    outline: none;

    & svg {
      width: 1rem;
      height: 1rem;
      flex-shrink: 0;
    }
    &:hover,
    &:focus-visible {
      background-color: var(--accent);
      color: var(--accent-foreground);
    }
    &[aria-expanded="true"] {
      background-color: var(--accent);
      color: var(--accent-foreground);
    }
    &:focus-visible {
      outline: 2px solid var(--ring);
      outline-offset: 1px;
    }
    &:disabled,
    &[aria-disabled="true"] {
      opacity: 0.5;
      pointer-events: none;
    }
  }

  /* the menus hang just under the bar */
  .menubar > .dropdown-content {
    margin-top: 0.5rem;
  }
  .menubar:dir(rtl) > .dropdown-content:not(.dropdown-sub-content) {
    left: auto;
    right: anchor(right);
  }
}

@media (prefers-contrast: more) {
  @layer components {
    .menubar {
      border-color: var(--foreground);
    }
    .menubar-trigger[aria-expanded="true"] {
      outline: 1px solid var(--foreground);
    }
  }
}

@media (forced-colors: active) {
  @layer components {
    .menubar {
      border-color: CanvasText;
    }
    .menubar-trigger:is(:hover, :focus-visible, [aria-expanded="true"]) {
      forced-color-adjust: none;
      background: Highlight;
      color: HighlightText;
    }
  }
}

/* ── components/navigation-menu/navigation-menu.css ── */
@layer components {
  .nav-menu-list {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    list-style: none;
    margin: 0;
    padding: 0;
  }
  .nav-menu-link,
  .nav-menu-trigger {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.5rem 0.75rem;
    border: none;
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--foreground);
    font-size: 0.875rem;
    font-weight: 500;
    font-family: inherit;
    text-decoration: none;
    cursor: pointer;
    transition:
      background-color 150ms ease,
      color 150ms ease;
    outline: none;
    &:hover {
      background-color: var(--accent);
      color: var(--accent-foreground);
    }
    &:focus-visible {
      outline: 2px solid var(--ring);
      outline-offset: 2px;
    }
    & svg {
      width: 0.875rem;
      height: 0.875rem;
      color: var(--muted-foreground);
      transition: transform 200ms ease;
    }
  }

  /* -- Density: set data-density on the .nav-menu nav to scale the gap
     between top-level items (0.5× / 1 / 1.5× of the 0.25rem base);
     comfortable matches the unsized default. Link padding belongs to
     data-size - density is the row rhythm only. */
  .nav-menu:where([data-density="compact"]) .nav-menu-list {
    gap: 0.125rem;
  }
  .nav-menu:where([data-density="comfortable"]) .nav-menu-list {
    gap: 0.25rem;
  }
  .nav-menu:where([data-density="spacious"]) .nav-menu-list {
    gap: 0.375rem;
  }

  /* -- Sizes: set data-size on the .nav-menu nav; every link/trigger and
     the popover's rows scale together. md == the unsized default. */
  .nav-menu[data-size="xs"] {
    & :is(.nav-menu-link, .nav-menu-trigger) {
      padding: 0.25rem 0.5rem;
      font-size: 0.75rem;
    }
    & .nav-menu-content-link {
      padding: 0.25rem 0.5rem;
      font-size: 0.75rem;
    }
  }
  .nav-menu[data-size="sm"] {
    & :is(.nav-menu-link, .nav-menu-trigger) {
      padding: 0.375rem 0.625rem;
      font-size: 0.8125rem;
    }
    & .nav-menu-content-link {
      padding: 0.375rem 0.625rem;
      font-size: 0.8125rem;
    }
  }
  .nav-menu[data-size="md"] {
    & :is(.nav-menu-link, .nav-menu-trigger) {
      padding: 0.5rem 0.75rem;
      font-size: 0.875rem;
    }
  }
  .nav-menu[data-size="lg"] {
    & :is(.nav-menu-link, .nav-menu-trigger) {
      padding: 0.625rem 1rem;
      font-size: 1rem;
    }
    & .nav-menu-content-link {
      padding: 0.625rem 1rem;
      font-size: 1rem;
    }
  }
  .nav-menu[data-size="xl"] {
    & :is(.nav-menu-link, .nav-menu-trigger) {
      padding: 0.75rem 1.25rem;
      font-size: 1.125rem;
    }
    & .nav-menu-content-link {
      padding: 0.75rem 1.25rem;
      font-size: 1.125rem;
    }
  }

  /* Rotate chevron when popover is open */
  .nav-menu-trigger:has(+ .nav-menu-content:popover-open) svg {
    transform: rotate(180deg);
  }

  .nav-menu-content {
    position: fixed;
    inset: auto;
    margin: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    background-color: var(--popover);
    color: var(--popover-foreground);
    padding: 1rem;
    box-shadow: var(--shadow-md);
    min-width: 14rem;
    opacity: 0;
    transform: translateY(-4px);
    transition:
      opacity 150ms ease,
      transform 150ms ease,
      display 150ms allow-discrete;

    /* -- Anchor positioning -- */
    top: anchor(bottom);
    left: anchor(left);
    margin-top: 4px;
    position-try-fallbacks: flip-block;

    &:popover-open {
      opacity: 1;
      transform: translateY(0);
    }
  }
  @starting-style {
    .nav-menu-content:popover-open {
      opacity: 0;
      transform: translateY(-4px);
    }
  }
  .nav-menu-content-link {
    display: block;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-md);
    text-decoration: none;
    color: var(--foreground);
    font-size: 0.875rem;
    transition: background-color 150ms ease;
    &:hover {
      background-color: var(--accent);
    }
    &:focus-visible {
      outline: 2px solid var(--ring);
      outline-offset: 2px;
    }
    & p {
      margin: 0.125rem 0 0;
      font-size: 0.75rem;
      color: var(--muted-foreground);
      font-weight: 400;
    }
  }

  /* -- Megamenu ------------------------------------------------------
     The .nav-menu is an anchor (scoped per menu) so a panel can take the
     menu's own width - data-width="wide" - or the page's - "full". Inside a
     panel: .nav-menu-grid (auto-fit columns, or data-columns 2 / 3 / 4) of
     .nav-menu-section (a .nav-menu-heading + links), links with a
     .nav-menu-icon and a description, a .nav-menu-feature promo block and a
     .nav-menu-footer row. CSS only - the triggers stay native popovers. */
  .nav-menu {
    anchor-name: --nav-menu-root;
    anchor-scope: --nav-menu-root;
  }
  .nav-menu-content[data-width="wide"] {
    left: anchor(--nav-menu-root left, 0px);
    right: anchor(--nav-menu-root right, 0px);
    width: auto;
  }
  .nav-menu-content[data-width="full"] {
    left: 0;
    right: 0;
    width: auto;
    border-radius: 0;
    border-inline: 0;
    padding-inline: max(1rem, calc((100vw - 72rem) / 2));
  }

  /* the open trigger stays highlighted; aria-current marks the page */
  .nav-menu-trigger:has(+ .nav-menu-content:popover-open),
  .nav-menu-link[aria-current="page"] {
    background-color: var(--accent);
    color: var(--accent-foreground);
  }

  .nav-menu-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr));
    gap: 1rem 1.5rem;

    &[data-columns="2"] {
      grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    &[data-columns="3"] {
      grid-template-columns: repeat(3, minmax(0, 1fr));
    }
    &[data-columns="4"] {
      grid-template-columns: repeat(4, minmax(0, 1fr));
    }
  }
  .nav-menu-section {
    display: grid;
    align-content: start;
    gap: 0.125rem;
    min-width: 0;
  }
  .nav-menu-heading {
    margin: 0 0 0.25rem;
    padding: 0 0.75rem;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted-foreground);
  }
  /* a link with an icon: icon | title over description */
  .nav-menu-content-link:has(> .nav-menu-icon) {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    column-gap: 0.75rem;
    align-items: start;

    & > :not(.nav-menu-icon) {
      grid-column: 2;
    }
  }
  .nav-menu-icon {
    grid-row: span 2;
    display: grid;
    place-items: center;
    width: 2rem;
    height: 2rem;
    border-radius: var(--radius-md);
    background-color: var(--muted);
    color: var(--foreground);

    & svg {
      width: 1rem;
      height: 1rem;
    }
  }
  /* a promo / featured block: image (optional) + title + text */
  .nav-menu-feature {
    display: grid;
    align-content: end;
    gap: 0.25rem;
    min-height: 9rem;
    padding: 1rem;
    border-radius: var(--radius-lg);
    background: linear-gradient(160deg, color-mix(in oklch, var(--primary) 14%, var(--muted)), var(--muted));
    color: var(--foreground);
    text-decoration: none;

    & img {
      width: 100%;
      aspect-ratio: 16 / 9;
      object-fit: cover;
      border-radius: var(--radius-md);
      margin-bottom: 0.5rem;
    }
    & strong {
      font-size: 0.9375rem;
    }
    & p {
      margin: 0;
      font-size: 0.8125rem;
      color: var(--muted-foreground);
    }
    &:hover {
      background: linear-gradient(160deg, color-mix(in oklch, var(--primary) 22%, var(--muted)), var(--muted));
    }
    &:focus-visible {
      outline: 2px solid var(--ring);
      outline-offset: 2px;
    }
  }
  .nav-menu-footer {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem 1rem;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
    font-size: 0.8125rem;
    color: var(--muted-foreground);

    & a {
      color: var(--foreground);
      font-weight: 500;
      text-decoration: none;
    }
    & a:hover {
      text-decoration: underline;
    }
  }

  /* -- Vertical: a side menu whose panels fly out to the right (and drop
     below the trigger when there is no room). "responsive" is vertical
     below 48rem and horizontal from there up. */
  .nav-menu[data-orientation="vertical"] {
    & .nav-menu-list {
      flex-direction: column;
      align-items: stretch;
    }
    & :is(.nav-menu-link, .nav-menu-trigger) {
      justify-content: space-between;
      width: 100%;
    }
    & .nav-menu-trigger svg {
      transform: rotate(-90deg);
    }
    & .nav-menu-content {
      top: anchor(top);
      left: anchor(right);
      margin: 0 0 0 4px;
      position-try-fallbacks: --nav-menu-below;
    }
  }
  @media (max-width: 47.99rem) {
    .nav-menu[data-orientation="responsive"] {
      & .nav-menu-list {
        flex-direction: column;
        align-items: stretch;
      }
      & :is(.nav-menu-link, .nav-menu-trigger) {
        justify-content: space-between;
        width: 100%;
      }
      & .nav-menu-trigger svg {
        transform: rotate(-90deg);
      }
      & .nav-menu-content {
        top: anchor(top);
        left: anchor(right);
        margin: 0 0 0 4px;
        position-try-fallbacks: --nav-menu-below;
      }
      & .nav-menu-grid[data-columns] {
        grid-template-columns: minmax(0, 1fr);
      }
    }
  }

  /* -- Accessibility ------------------------------------------ */

  @media (prefers-reduced-motion: reduce) {
    .nav-menu-link,
    .nav-menu-trigger,
    .nav-menu-content,
    .nav-menu-content-link {
      transition: none;
    }
    .nav-menu-trigger svg {
      transition: none;
    }
  }

  @media (forced-colors: active) {
    .nav-menu-content {
      border-color: ButtonText;
    }
  }
}

/* the vertical menu's fallback when a panel has no room at the side:
   below its trigger (top-level: @position-try is not a layered rule) */
@position-try --nav-menu-below {
  top: anchor(bottom);
  left: anchor(left);
  margin: 4px 0 0;
}

/* ── components/theme-switcher/theme-switcher.css ── */
/* -- Theme Switcher component ---------------------------------
   Dropdown that swaps a <link id="theme-css"> stylesheet. Own popover +
   anchor rules (self-contained, mirrors .dropdown-content) + menu rows with
   theme color dots. */

@layer components {
  .theme-switcher {
    position: relative;
    display: inline-flex;
  }

  .theme-switcher-trigger {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    max-width: 14rem;

    & .theme-switcher-dot {
      width: 0.75rem;
      height: 0.75rem;
      border-radius: 9999px;
      border: 1px solid var(--border);
      flex-shrink: 0;
      /* the active theme's primary color, set inline by theme-switcher.js */
      background: var(--primary);
    }

    & .theme-switcher-label {
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }

    & .theme-switcher-chevron {
      width: 1rem;
      height: 1rem;
      margin-inline-start: auto;
      flex-shrink: 0;
      opacity: 0.6;
    }
  }

  .theme-switcher-menu {
    background-color: var(--popover);
    color: var(--popover-foreground);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 0.25rem;
    min-width: 12rem;
    max-height: 18rem;
    overflow-y: auto;
    overscroll-behavior: contain;
    box-shadow:
      0 4px 16px oklch(0 0 0 / 0.12),
      0 0 0 1px var(--border);

    /* Anchor positioning - the trigger names itself, the menu follows */
    position: fixed;
    inset: auto;
    top: anchor(bottom);
    left: anchor(left);
    margin: 0;
    margin-top: 4px;
    position-try-fallbacks: flip-block;

    /* Enter/exit animation on the discrete display switch */
    opacity: 0;
    transform: scale(0.96) translateY(-0.25rem);
    transition:
      opacity 150ms ease,
      transform 150ms ease,
      display 150ms allow-discrete;

    &:popover-open {
      opacity: 1;
      transform: scale(1) translateY(0);
    }
  }

  @starting-style {
    .theme-switcher-menu:popover-open {
      opacity: 0;
      transform: scale(0.96) translateY(-0.25rem);
    }
  }

  .theme-switcher-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.375rem 0.5rem;
    border-radius: calc(var(--radius) * 0.6);
    font-size: 0.875rem;
    border: none;
    background: transparent;
    color: inherit;
    cursor: pointer;
    text-align: start;

    &:hover,
    &:focus-visible,
    &[data-highlighted] {
      background: var(--accent);
      color: var(--accent-foreground);
      outline: none;
    }

    &[aria-checked="true"] {
      font-weight: 500;

      & .theme-switcher-check {
        visibility: visible;
      }
    }

    & .theme-switcher-dots {
      display: inline-flex;
      gap: 2px;
      flex-shrink: 0;
    }

    & .theme-switcher-dots span {
      width: 0.5rem;
      height: 0.5rem;
      border-radius: 9999px;
    }

    & .theme-switcher-name {
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }

    & .theme-switcher-check {
      width: 1rem;
      height: 1rem;
      margin-inline-start: auto;
      visibility: hidden;
      flex-shrink: 0;
    }
  }

  /* Accessibility */
  @media (prefers-reduced-motion: reduce) {
    .theme-switcher-menu {
      transition: none;
    }
  }

  @media (forced-colors: active) {
    .theme-switcher-menu {
      border: 1px solid CanvasText;
    }
  }
}

/* ── components/language-switcher/language-switcher.css ── */
/* -- Language Switcher component -------------------------------------
   The runtime writes a shipped Combobox (a Swap, or radio items for a
   Dropdown Menu) into the element; these
   rules size it to its content and draw the flags. A flag is the language's
   code (::before) under its SVG (::after): a flag that fails to load leaves
   the code readable. Shape, scale and finish are attributes on the root. */

@layer components {
  .language-switcher {
    --language-switcher-flag-height: 1rem;
    display: inline-flex;
    align-items: center;
    vertical-align: middle;

    /* -- Flag scale ----------------------------------------------- */
    &[data-flag-size="xs"] {
      --language-switcher-flag-height: 0.75rem;
    }
    &[data-flag-size="sm"] {
      --language-switcher-flag-height: 0.875rem;
    }
    &[data-flag-size="lg"] {
      --language-switcher-flag-height: 1.25rem;
    }
    &[data-flag-size="xl"] {
      --language-switcher-flag-height: 1.75rem;
    }

    /* -- Flag shapes ---------------------------------------------- */
    &[data-flag-shape="rounded"] .language-switcher-flag {
      border-radius: calc(var(--language-switcher-flag-height) * 0.25);
    }
    &[data-flag-shape="square"] .language-switcher-flag {
      inline-size: var(--language-switcher-flag-height);
    }
    &[data-flag-shape="squircle"] .language-switcher-flag {
      inline-size: var(--language-switcher-flag-height);
      border-radius: 32%;
    }
    &[data-flag-shape="circle"] .language-switcher-flag {
      inline-size: var(--language-switcher-flag-height);
      border-radius: 50%;
    }

    /* -- Flag finishes -------------------------------------------- */
    &[data-flag-style="ring"] .language-switcher-flag {
      outline: 1px solid color-mix(in oklch, var(--foreground) 22%, transparent);
      outline-offset: -1px;
    }
    &[data-flag-style="shadow"] .language-switcher-flag {
      box-shadow:
        0 0 0 1px var(--border),
        var(--shadow-sm);
    }
    &[data-flag-style="glossy"] .language-switcher-flag {
      --language-switcher-gloss: linear-gradient(
        160deg,
        oklch(1 0 0 / 0.55),
        oklch(1 0 0 / 0) 42%,
        oklch(0 0 0 / 0) 58%,
        oklch(0 0 0 / 0.2)
      );
      outline: 1px solid oklch(0 0 0 / 0.12);
      outline-offset: -1px;
    }

    /* the code shown instead of a name (a condensed footer, a toolbar) */
    &[data-display="code"] .language-switcher-label {
      font-family: var(--font-mono);
      font-size: 0.75rem;
      letter-spacing: 0.04em;
    }
  }

  .language-switcher-flag {
    position: relative;
    display: inline-block;
    flex: none;
    inline-size: calc(var(--language-switcher-flag-height) * 4 / 3);
    block-size: var(--language-switcher-flag-height);
    border-radius: 2px;
    overflow: hidden;
    background-color: var(--muted);
    transition: scale 150ms ease;

    &::before {
      content: attr(data-code);
      position: absolute;
      inset: 0;
      display: grid;
      place-items: center;
      font-family: var(--font-mono);
      font-size: calc(var(--language-switcher-flag-height) * 0.5);
      font-weight: 600;
      line-height: 1;
      color: var(--muted-foreground);
    }

    &::after {
      content: "";
      position: absolute;
      inset: 0;
      background-image: var(--language-switcher-gloss, none), var(--language-switcher-flag, none);
      background-position: center;
      background-size: cover;
      background-repeat: no-repeat;
    }

    /* a flag in the dark is a little dimmer, so it does not glare beside the text */
    :where(.dark) &::after {
      filter: brightness(0.92) saturate(0.95);
    }
  }

  .language-switcher-icon {
    flex: none;
    width: 1rem;
    height: 1rem;
  }

  .language-switcher-label {
    white-space: nowrap;
  }

  /* -- The Combobox face ------------------------------------------ */
  .language-switcher-combobox {
    display: inline-block;

    & .combobox-trigger {
      width: auto;
      justify-content: flex-start;
      gap: 0.5rem;
    }

    & .combobox-value {
      display: inline-flex;
      align-items: center;
      gap: 0.5rem;
      flex: none;
      font-weight: 500;
    }

    /* a language is always chosen: no clear button, the chevron stays */
    & .combobox-clear {
      display: none !important;
    }
    &.combobox:has(.combobox-value) .combobox-trigger > .combobox-chevron {
      display: block;
    }

    & .combobox-content {
      width: max-content;
      min-width: max(anchor-size(width), 13rem);
      max-width: min(22rem, calc(100vw - 1rem));
      position-try-fallbacks:
        flip-inline,
        flip-block,
        flip-block flip-inline;
    }

    /* a short list needs no search box; it stays for the keys (arrows, Enter) */
    & .combobox-search[data-quiet] {
      position: absolute;
      width: 1px;
      height: 1px;
      padding: 0;
      border: 0;
      overflow: hidden;
      clip-path: inset(50%);
      white-space: nowrap;
    }
  }

  /* the list opens toward the start edge where the switcher sits at the end (a header's right side) */
  .language-switcher[data-align="end"] .combobox-content {
    left: auto;
    right: anchor(right);
  }

  .language-switcher-option {
    gap: 0.625rem;

    &[data-highlighted] .language-switcher-flag,
    &:hover .language-switcher-flag {
      scale: 1.08;
    }
  }

  .language-switcher-name {
    white-space: nowrap;
  }

  .language-switcher-alt {
    margin-inline-start: auto;
    padding-inline-start: 1rem;
    font-size: 0.75rem;
    color: var(--muted-foreground);
    white-space: nowrap;

    &[hidden] {
      display: none;
    }
    .language-switcher-option[data-highlighted] &,
    .language-switcher-option:hover & {
      color: inherit;
      opacity: 0.75;
    }
  }

  /* -- The Menu face: radio items in a Dropdown Menu ----------------- */
  .language-switcher[data-variant="menu"] {
    display: block;
  }
  .language-switcher-menu {
    display: contents;
  }
  .language-switcher-item {
    gap: 0.625rem;

    &[data-highlighted] .language-switcher-flag,
    &:hover .language-switcher-flag {
      scale: 1.08;
    }
    & .language-switcher-alt {
      color: var(--muted-foreground);
    }
  }

  /* -- The Swap face ---------------------------------------------- */
  .language-switcher-swap {
    & .swap-on,
    & .swap-off {
      gap: 0.375rem;
      padding-inline: 0.375rem;
    }
    & .language-switcher-label {
      font-weight: 500;
    }
  }

  /* -- Accessibility ---------------------------------------------- */
  @media (prefers-reduced-motion: reduce) {
    .language-switcher-flag {
      transition: none;
    }
    :is(.language-switcher-option, .language-switcher-item) .language-switcher-flag {
      scale: none !important;
    }
  }

  @media (prefers-contrast: more) {
    .language-switcher-flag {
      outline: 1px solid var(--foreground);
      outline-offset: -1px;
    }
    .language-switcher-alt {
      color: var(--foreground);
    }
  }

  @media (forced-colors: active) {
    /* the flag keeps its own colors; a system-color frame marks its edge */
    .language-switcher-flag {
      forced-color-adjust: none;
      outline: 1px solid CanvasText;
      outline-offset: -1px;
    }
  }
}
