@media (min-width: 1024px) {
.fi-mobile-panel-bar {
    display: none;
}

.fi-body .fi-sidebar {
    --sidebar-width: 15rem;
}

.fi-body .fi-panel-dashboard-group > .fi-sidebar-group-items {
    gap: 0;
}

.fi-body .fi-panel-dashboard-group .fi-sidebar-item-button {
    min-height: 2.05rem;
    padding-top: 0.3rem;
    padding-bottom: 0.2rem;
}

.fi-body .fi-sidebar-nav {
    padding-top: 0.8rem;
}

.fi-body .fi-sidebar-nav-groups {
    gap: 0.45rem;
}

.fi-body .fi-sidebar-group {
    gap: 0.2rem;
}

.fi-body .fi-sidebar-group-button {
    padding-bottom: 0.2rem;
}

.fi-body .fi-sidebar-group-items {
    gap: 0.08rem;
}

/* Collapsed: keep nav item badges (e.g. Action Center warning count) visible.
   Filament hides the badge's wrapper span via x-show when the sidebar closes,
   so the Alpine inline display:none must be overridden with !important; the
   badge becomes a mini pill pinned to the button's top-right corner. The
   panel-switcher group is excluded — its badges (bell unread + per-panel
   unseen-rows counts) have their own corner-pill rules below. */
.fi-body .fi-sidebar:not(.fi-sidebar-open) .fi-sidebar-group:not(.fi-panel-switcher-group) .fi-sidebar-item-button > span:has(> .fi-badge) {
    display: flex !important;
    position: absolute;
    top: -0.15rem;
    inset-inline-end: -0.15rem;
    pointer-events: none;
}

.fi-body .fi-sidebar:not(.fi-sidebar-open) .fi-sidebar-group:not(.fi-panel-switcher-group) .fi-sidebar-item-button > span > .fi-badge {
    min-width: 1rem;
    height: 1rem;
    padding: 0 0.25rem;
    font-size: 0.58rem;
    line-height: 1;
    border-radius: 9999px;
}

.fi-body .fi-sidebar {
    background-color: #fafafa;
    z-index: 50;
    overflow: visible;
}

/* z-index 50 lets the sidebar's flyouts and collapsed badges spill over the page, but it
   also beats Filament's modal layers (z-40): a wide modal (7xl on a 1600px screen) slid
   UNDER the sidebar. While any modal is open the sidebar drops below them; toasts (z-50)
   stay above the modal as Filament intends. */
.fi-body:has(.fi-modal.fi-modal-open) .fi-sidebar {
    z-index: 30;
}

.fi-body .fi-main-sidebar {
        translate: none !important;
    }

.fi-body .fi-sidebar > div:first-child {
        overflow: visible;
    }

/* Header: no divider (Filament's ring + shadow are dropped too) and the nav's
   flat top colour, so brand and menu read as one surface. */
.fi-body .fi-sidebar-header {
        position: relative;
        overflow: visible;
        height: 3.1rem;
        padding-inline: 0.95rem 0.6rem;
        box-shadow: none;
        background-color: #f5f5f5;
    }

.fi-body .fi-sidebar:not(.fi-sidebar-open) .fi-sidebar-header > div:first-child {
        display: flex !important;
        flex: 1 1 auto;
        align-items: center;
        justify-content: center;
    }

.fi-body .fi-sidebar:not(.fi-sidebar-open) .fi-sidebar-header > div:first-child .gap-3 {
        gap: 0;
        justify-content: center;
    }

.fi-body .fi-sidebar:not(.fi-sidebar-open) .fi-sidebar-header > div:first-child .gap-3 > span {
        display: none;
    }

/* Brand-integrated expand/collapse chevron (replaces Filament's floating circle). */
.fi-body .fi-sidebar-header > .fi-icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.6rem;
    color: #64748b !important;
    box-shadow: none;
    backdrop-filter: none;
    transition: opacity 200ms ease, background-color 150ms ease, color 150ms ease, transform 200ms ease;
}

.dark .fi-body .fi-sidebar-header > .fi-icon-btn {
    color: #94a3b8 !important;
}

.fi-body .fi-sidebar-header > .fi-icon-btn .fi-icon-btn-icon {
    height: 1.2rem;
    width: 1.2rem;
    stroke-width: 2;
}

/* Expanded: collapse chevron sits to the right of the app name, subtle until hover. */
.fi-body .fi-sidebar.fi-sidebar-open .fi-sidebar-header > .fi-icon-btn {
    height: 2rem;
    width: 2rem;
    opacity: 0.5;
}

.fi-body .fi-sidebar.fi-sidebar-open .fi-sidebar-header:hover > .fi-icon-btn {
    opacity: 1;
}

.fi-body .fi-sidebar.fi-sidebar-open .fi-sidebar-header > .fi-icon-btn:hover {
    background: rgba(var(--primary-600), 0.12);
    color: rgba(var(--primary-600), 1) !important;
}

.dark .fi-body .fi-sidebar.fi-sidebar-open .fi-sidebar-header > .fi-icon-btn:hover {
    background: rgba(var(--primary-400), 0.18);
    color: rgba(var(--primary-300), 1) !important;
}

/* Collapsed: chevron fills the header and cross-fades in over the logo on hover. */
.fi-body .fi-sidebar:not(.fi-sidebar-open) .fi-sidebar-header > div:first-child {
    transition: opacity 200ms ease;
    pointer-events: none;
}

.fi-body .fi-sidebar:not(.fi-sidebar-open) .fi-sidebar-header > .fi-icon-btn {
    position: absolute;
    inset: 0;
    height: auto;
    width: auto;
    opacity: 0;
}

.fi-body .fi-sidebar:not(.fi-sidebar-open) .fi-sidebar-header > .fi-icon-btn .fi-icon-btn-icon {
    transform: scale(0.8);
    transition: transform 200ms ease;
}

.fi-body .fi-sidebar:not(.fi-sidebar-open) .fi-sidebar-header:hover > div:first-child {
    opacity: 0;
}

.fi-body .fi-sidebar:not(.fi-sidebar-open) .fi-sidebar-header:hover > .fi-icon-btn {
    opacity: 1;
}

.fi-body .fi-sidebar:not(.fi-sidebar-open) .fi-sidebar-header:hover > .fi-icon-btn .fi-icon-btn-icon {
    transform: scale(1);
}

.fi-body .fi-sidebar:not(.fi-sidebar-open) .fi-sidebar-header > .fi-icon-btn:hover {
    color: rgba(var(--primary-600), 1) !important;
}

.dark .fi-body .fi-sidebar:not(.fi-sidebar-open) .fi-sidebar-header > .fi-icon-btn:hover {
    color: rgba(var(--primary-300), 1) !important;
}

.fi-body .fi-sidebar-nav,
.fi-body .fi-sidebar-user-menu-panel {
    background-image: linear-gradient(180deg, rgba(245, 245, 245, 0.98) 0%, rgba(229, 229, 229, 0.92) 100%);
    background-color: transparent;
}

.dark .fi-body .fi-sidebar {
    background-color: #27272a;
}

.dark .fi-body .fi-sidebar-header {
    background-color: #27272a;
}


.dark .fi-body .fi-sidebar-nav,
.dark .fi-body .fi-sidebar-user-menu-panel {
    background-image: linear-gradient(180deg, rgba(39, 39, 42, 0.98) 0%, rgba(24, 24, 27, 1) 100%);
    background-color: #18181b;
}

.fi-body .fi-sidebar-user-menu-panel {
    border-top-color: rgba(148, 163, 184, 0.16);
}

.fi-body .fi-sidebar-group-label {
    color: #64748b;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-size: 0.72rem;
    font-weight: 600;
}

.fi-body .fi-sidebar-group-icon {
    opacity: 0.7;
}

/* Menu rows + footer buttons: flat (no border, no shadow). Hover is a soft
   tinted pill that fades in; on menu rows the icon takes the panel's primary
   colour and the label full contrast. Press deepens the tint; keyboard focus
   gets an inset primary ring. The active row keeps its slit, no pill. */
.fi-body .fi-sidebar-item-button,
.fi-body .fi-sidebar-user-menu-panel .fi-sidebar-footer-btn,
.fi-body .fi-sidebar-user-menu-panel .fi-sidebar-user-trigger {
    border: 1px solid transparent;
    border-radius: 0.6rem;
    box-shadow: none;
    transition: background-color 160ms ease, color 160ms ease;
}

.fi-body .fi-sidebar-item-button :is(.fi-sidebar-item-icon, .fi-sidebar-item-label) {
    transition: color 160ms ease;
}

.fi-body .fi-sidebar-item-button:hover,
.fi-body .fi-sidebar-user-menu-panel .fi-sidebar-footer-btn:hover,
.fi-body .fi-sidebar-user-menu-panel .fi-sidebar-user-trigger:hover {
    background-color: rgba(15, 23, 42, 0.05);
}

.fi-body .fi-sidebar-item-button:active,
.fi-body .fi-sidebar-user-menu-panel .fi-sidebar-footer-btn:active,
.fi-body .fi-sidebar-user-menu-panel .fi-sidebar-user-trigger:active {
    background-color: rgba(15, 23, 42, 0.08);
}

.fi-body .fi-sidebar-item-button:focus-visible,
.fi-body .fi-sidebar-user-menu-panel .fi-sidebar-footer-btn:focus-visible,
.fi-body .fi-sidebar-user-menu-panel .fi-sidebar-user-trigger:focus-visible {
    outline: 2px solid rgba(var(--primary-500), 0.55);
    outline-offset: -2px;
}

.fi-body .fi-sidebar-item:not(.fi-active) > .fi-sidebar-item-button:is(:hover, :focus-visible) .fi-sidebar-item-icon {
    color: rgba(var(--primary-600), 1);
}

.fi-body .fi-sidebar-item:not(.fi-active) > .fi-sidebar-item-button:is(:hover, :focus-visible) .fi-sidebar-item-label {
    color: #0f172a;
}

.fi-body .fi-sidebar-group-button {
    border: 1px solid transparent;
    border-radius: 0.875rem;
    box-shadow: none;
    transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease;
}

.fi-body .fi-sidebar-group-button:hover,
.fi-body .fi-sidebar-group-button:focus-visible {
    background-color: transparent;
    border-color: transparent;
}

.dark .fi-body .fi-sidebar-item-button:hover,
.dark .fi-body .fi-sidebar-user-menu-panel .fi-sidebar-footer-btn:hover,
.dark .fi-body .fi-sidebar-user-menu-panel .fi-sidebar-user-trigger:hover {
    background-color: rgba(255, 255, 255, 0.06);
}

.dark .fi-body .fi-sidebar-item-button:active,
.dark .fi-body .fi-sidebar-user-menu-panel .fi-sidebar-footer-btn:active,
.dark .fi-body .fi-sidebar-user-menu-panel .fi-sidebar-user-trigger:active {
    background-color: rgba(255, 255, 255, 0.09);
}

.dark .fi-body .fi-sidebar-item:not(.fi-active) > .fi-sidebar-item-button:is(:hover, :focus-visible) .fi-sidebar-item-icon {
    color: rgba(var(--primary-400), 1);
}

.dark .fi-body .fi-sidebar-item:not(.fi-active) > .fi-sidebar-item-button:is(:hover, :focus-visible) .fi-sidebar-item-label {
    color: #fff;
}

.dark .fi-body .fi-sidebar-group-button:hover,
.dark .fi-body .fi-sidebar-group-button:focus-visible {
    background-color: transparent;
}

.fi-body .fi-sidebar-item.fi-active .fi-sidebar-item-button {
    background-color: transparent;
    border-color: transparent;
    box-shadow: none;
    position: relative;
}

.dark .fi-body .fi-sidebar-item.fi-active .fi-sidebar-item-button {
    background-color: transparent;
    border-color: transparent;
    box-shadow: none;
}

.fi-body .fi-sidebar-item.fi-active .fi-sidebar-item-button::before {
    content: '';
    position: absolute;
    inset-inline-start: -0.4rem;
    top: 50%;
    height: 1.05rem;
    width: 0.2rem;
    transform: translateY(-50%);
    border-radius: 9999px;
    background: rgba(var(--primary-600), 1);
}

.dark .fi-body .fi-sidebar-item.fi-active .fi-sidebar-item-button::before {
    background: rgba(var(--primary-300), 1);
}

.fi-body .fi-sidebar-group.fi-active > .fi-sidebar-group-button {
    background-color: transparent;
    border-color: transparent;
    box-shadow: none;
}

.dark .fi-body .fi-sidebar-group.fi-active > .fi-sidebar-group-button {
    background-color: transparent;
}

.fi-body .fi-sidebar-item-icon,
.fi-body .fi-sidebar-group-icon,
.fi-body .fi-sidebar-user-menu-panel svg {
    color: #64748b;
}

.dark .fi-body .fi-sidebar-item-icon,
.dark .fi-body .fi-sidebar-group-icon,
.dark .fi-body .fi-sidebar-user-menu-panel svg {
    color: #94a3b8;
}

.fi-body .fi-sidebar-item.fi-active .fi-sidebar-item-icon,
.fi-body .fi-sidebar-item.fi-active .fi-sidebar-item-label {
    color: rgba(var(--primary-600), 1);
}

.fi-body .fi-sidebar-item.fi-active .fi-sidebar-item-label {
    font-weight: 700;
}

.fi-body .fi-sidebar-item.fi-active .fi-sidebar-item-icon {
    stroke-width: 2.15;
}

.dark .fi-body .fi-sidebar-item.fi-active .fi-sidebar-item-icon,
.dark .fi-body .fi-sidebar-item.fi-active .fi-sidebar-item-label {
    color: rgba(var(--primary-300), 1);
}

.fi-body .fi-sidebar,
.fi-body .fi-sidebar-nav {
    scrollbar-width: thin;
    scrollbar-color: transparent transparent;
}

.fi-body .fi-sidebar:hover,
.fi-body .fi-sidebar-nav:hover {
    scrollbar-color: rgba(148, 163, 184, 0.5) rgba(15, 23, 42, 0.2);
}

.fi-body .fi-sidebar::-webkit-scrollbar,
.fi-body .fi-sidebar-nav::-webkit-scrollbar {
    width: 0.32rem;
    height: 0.32rem;
}

.fi-body .fi-sidebar::-webkit-scrollbar-track,
.fi-body .fi-sidebar-nav::-webkit-scrollbar-track {
    background: transparent;
}

.fi-body .fi-sidebar:hover::-webkit-scrollbar-track,
.fi-body .fi-sidebar-nav:hover::-webkit-scrollbar-track {
    background: rgba(15, 23, 42, 0.2);
}

.fi-body .fi-sidebar::-webkit-scrollbar-thumb,
.fi-body .fi-sidebar-nav::-webkit-scrollbar-thumb {
    background: transparent;
    border-radius: 9999px;
}

.fi-body .fi-sidebar:hover::-webkit-scrollbar-thumb,
.fi-body .fi-sidebar-nav:hover::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.5);
}

.fi-body .fi-sidebar::-webkit-scrollbar-thumb:hover,
.fi-body .fi-sidebar-nav::-webkit-scrollbar-thumb:hover {
    background: rgba(203, 213, 225, 0.7);
}

.dark .fi-body .fi-sidebar,
.dark .fi-body .fi-sidebar-nav {
    scrollbar-color: transparent transparent;
}

.dark .fi-body .fi-sidebar:hover,
.dark .fi-body .fi-sidebar-nav:hover {
    scrollbar-color: rgba(100, 116, 139, 0.68) rgba(2, 6, 23, 0.4);
}

.dark .fi-body .fi-sidebar::-webkit-scrollbar-track,
.dark .fi-body .fi-sidebar-nav::-webkit-scrollbar-track {
    background: transparent;
}

.dark .fi-body .fi-sidebar:hover::-webkit-scrollbar-track,
.dark .fi-body .fi-sidebar-nav:hover::-webkit-scrollbar-track {
    background: rgba(2, 6, 23, 0.4);
}

.dark .fi-body .fi-sidebar:hover::-webkit-scrollbar-thumb,
.dark .fi-body .fi-sidebar-nav:hover::-webkit-scrollbar-thumb {
    background: rgba(100, 116, 139, 0.68);
}

.dark .fi-body .fi-sidebar::-webkit-scrollbar-thumb:hover,
.dark .fi-body .fi-sidebar-nav::-webkit-scrollbar-thumb:hover {
    background: rgba(148, 163, 184, 0.82);
}

/* --- Search + panel switcher header ---
   One sticky block at the top of the nav: the search trigger (moved in by the
   navigation-search-sidebar blade) above the Management | Execution pill.
   top / margin-top = minus the nav's padding-top: Chrome offsets sticky boxes
   from the scroll container's content edge. The negative inline margin spans
   the nav's side padding so the opaque background hides the menu scrolling
   under it; the padding then insets search + pill 10px from both sidebar
   edges (the nav-groups list's -mx-2 pulls the group 8px left, the reserved
   scrollbar gutter takes 10px on the right). Expanded, the pill is text-only
   and exactly as tall as the search box; collapsed, both become stacked icon
   pills. Radii nest: inner = outer - padding - border. */
.fi-body .fi-panel-switcher-group > .fi-sidebar-group-button {
    display: none;
}

.fi-body .fi-panel-switcher-group {
    position: sticky;
    top: -0.8rem;
    z-index: 20;
    margin-top: -0.8rem;
    margin-inline: -1.5rem;
    padding: 0.35rem 0.5rem 0.35rem 1.15rem;
    background-color: #f5f5f5;
}

.dark .fi-body .fi-panel-switcher-group {
    background-color: #27272a;
}

.fi-body .fi-sidebar:not(.fi-sidebar-open) .fi-panel-switcher-group {
    align-items: center;
    padding: 0.6rem 0 0.35rem;
}

.fi-body .fi-panel-switcher-group > .fi-sidebar-group-items {
    box-sizing: border-box;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    width: 100%;
    height: 2.1rem;
    gap: 0.15rem;
    padding: 0.15rem;
    border: 1px solid rgba(148, 163, 184, 0.24);
    border-radius: 0.65rem;
    background-color: rgba(255, 255, 255, 0.6);
}

.dark .fi-body .fi-panel-switcher-group > .fi-sidebar-group-items {
    border-color: rgba(148, 163, 184, 0.16);
    background-color: rgba(0, 0, 0, 0.22);
}

.fi-body .fi-sidebar:not(.fi-sidebar-open) .fi-panel-switcher-group > .fi-sidebar-group-items {
    flex-direction: column;
    justify-content: center;
    width: auto;
    height: auto;
    gap: 0.2rem;
    padding: 0.2rem;
    border-radius: 0.85rem;
}

.fi-body .fi-panel-switcher-group .fi-sidebar-item {
    flex: 1 1 0;
    min-width: 0;
    height: 100%;
}

.fi-body .fi-sidebar:not(.fi-sidebar-open) .fi-panel-switcher-group .fi-sidebar-item {
    flex: 0 0 auto;
    width: 100%;
    height: auto;
}

.fi-body .fi-panel-switcher-group .fi-sidebar-item-button {
    gap: 0.3rem;
    justify-content: center;
    width: 100%;
    min-width: 0;
    height: 100%;
    min-height: 0;
    padding: 0 0.25rem;
    border-color: transparent;
    border-radius: calc(0.65rem - 0.15rem - 1px);
    box-shadow: none;
}

.fi-body .fi-sidebar:not(.fi-sidebar-open) .fi-panel-switcher-group .fi-sidebar-item-button {
    width: auto;
    height: auto;
    min-width: 2.35rem;
    min-height: 2.35rem;
    padding: 0;
    border-radius: calc(0.85rem - 0.2rem - 1px);
}

.fi-body .fi-panel-switcher-group .fi-sidebar-item-button::before,
.fi-body .fi-sidebar:not(.fi-sidebar-open) .fi-panel-switcher-group .fi-sidebar-item-label {
    display: none !important;
}

.fi-body .fi-sidebar.fi-sidebar-open .fi-panel-switcher-group .fi-sidebar-item-icon {
    display: none;
}

.fi-body .fi-sidebar.fi-sidebar-open .fi-panel-switcher-group .fi-sidebar-item-label {
    display: block;
    order: 2;
    flex: 0 1 auto;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.8rem;
}

.fi-body .fi-panel-switcher-group .fi-sidebar-item.fi-active .fi-sidebar-item-button {
    background-color: #fff;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12);
}

.dark .fi-body .fi-panel-switcher-group .fi-sidebar-item.fi-active .fi-sidebar-item-button {
    background-color: rgba(255, 255, 255, 0.08);
    box-shadow: none;
}

/* Hovering a segment only recolours it, in ITS panel's colour (Management
   indigo, Execution amber) rather than the current panel's primary. */
.fi-body .fi-panel-switcher-group .fi-sidebar-item:not(.fi-active) .fi-sidebar-item-button:is(:hover, :focus-visible) {
    background-color: transparent;
    border-color: transparent;
    box-shadow: none;
}

.fi-body .fi-panel-switcher-group .fi-sidebar-item:not(.fi-active) .fi-sidebar-item-button[href$="/management"]:is(:hover, :focus-visible) :is(.fi-sidebar-item-label, .fi-sidebar-item-icon) {
    color: #4f46e5;
}

.fi-body .fi-panel-switcher-group .fi-sidebar-item:not(.fi-active) .fi-sidebar-item-button[href$="/execution"]:is(:hover, :focus-visible) :is(.fi-sidebar-item-label, .fi-sidebar-item-icon) {
    color: #d97706;
}

.dark .fi-body .fi-panel-switcher-group .fi-sidebar-item:not(.fi-active) .fi-sidebar-item-button[href$="/management"]:is(:hover, :focus-visible) :is(.fi-sidebar-item-label, .fi-sidebar-item-icon) {
    color: #818cf8;
}

.dark .fi-body .fi-panel-switcher-group .fi-sidebar-item:not(.fi-active) .fi-sidebar-item-button[href$="/execution"]:is(:hover, :focus-visible) :is(.fi-sidebar-item-label, .fi-sidebar-item-icon) {
    color: #fbbf24;
}

/* Panel counts: after the label when expanded, pinned to the segment corner
   when collapsed (Filament x-show-hides the wrapper there, hence !important).
   The badge itself is styled by the shared nav-badge rule. */
.fi-body .fi-sidebar.fi-sidebar-open .fi-panel-switcher-group .fi-sidebar-item-button > span:has(> .fi-badge) {
    display: flex;
    position: relative;
    z-index: 1;
    order: 3;
    align-self: center;
    margin: 0 0 0 0.05rem;
    pointer-events: none;
}

.fi-body .fi-sidebar:not(.fi-sidebar-open) .fi-panel-switcher-group .fi-sidebar-item-button > span:has(> .fi-badge) {
    display: flex !important;
    position: absolute;
    top: -0.28rem;
    inset-inline-end: -0.1rem;
    pointer-events: none;
}

.fi-body .fi-sidebar:not(.fi-sidebar-open) .fi-nav-search-trigger-row {
    padding: 0.2rem;
    border: 1px solid rgba(148, 163, 184, 0.24);
    border-radius: 0.85rem;
    background-color: rgba(255, 255, 255, 0.6);
}

.dark .fi-body .fi-sidebar:not(.fi-sidebar-open) .fi-nav-search-trigger-row {
    border-color: rgba(148, 163, 184, 0.16);
    background-color: rgba(0, 0, 0, 0.22);
}

/* --- Brand --- */
.fi-body .fi-sidebar-header .gap-3 {
    gap: 0.55rem;
}

.fi-body .fi-sidebar-header .gap-3 > img {
    width: 1.55rem;
    height: 1.55rem;
}

.fi-body .fi-sidebar-header .gap-3 > span {
    font-size: 1.2rem;
}

/* --- Collapsed rail ---
   One centre line for logo, nav icons and footer: the nav's inline
   scrollbar-gutter (vendor style attribute, hence !important) would reserve
   10px on the right and shift every nav icon 5px left of the header/footer;
   the rail scrolls by wheel/touch without a visible bar. A faint rule
   separates the menu groups whose labels are hidden. */
.fi-body .fi-sidebar:not(.fi-sidebar-open) .fi-sidebar-nav {
    scrollbar-gutter: auto !important;
    scrollbar-width: none;
}

.fi-body .fi-sidebar:not(.fi-sidebar-open) .fi-sidebar-nav::-webkit-scrollbar {
    display: none;
}

.fi-body .fi-sidebar:not(.fi-sidebar-open) .fi-sidebar-header {
    padding-inline: 0;
}

.fi-body .fi-sidebar:not(.fi-sidebar-open) .fi-sidebar-nav-groups > .fi-sidebar-group:not(.fi-panel-switcher-group):not(.fi-nav-search-group) + .fi-sidebar-group,
.fi-body .fi-sidebar:not(.fi-sidebar-open) .fi-sidebar-nav-groups > .fi-nav-search-group:has(.fi-nav-search-pinned-item) + .fi-sidebar-group {
    position: relative;
    padding-top: 0.5rem;
}

.fi-body .fi-sidebar:not(.fi-sidebar-open) .fi-sidebar-nav-groups > .fi-sidebar-group:not(.fi-panel-switcher-group):not(.fi-nav-search-group) + .fi-sidebar-group::before,
.fi-body .fi-sidebar:not(.fi-sidebar-open) .fi-sidebar-nav-groups > .fi-nav-search-group:has(.fi-nav-search-pinned-item) + .fi-sidebar-group::before {
    content: '';
    position: absolute;
    top: 0;
    inset-inline: 0.55rem;
    border-top: 1px solid rgba(148, 163, 184, 0.2);
}

.dark .fi-body .fi-sidebar:not(.fi-sidebar-open) .fi-sidebar-nav-groups > .fi-sidebar-group:not(.fi-panel-switcher-group):not(.fi-nav-search-group) + .fi-sidebar-group::before,
.dark .fi-body .fi-sidebar:not(.fi-sidebar-open) .fi-sidebar-nav-groups > .fi-nav-search-group:has(.fi-nav-search-pinned-item) + .fi-sidebar-group::before {
    border-top-color: rgba(148, 163, 184, 0.12);
}
}

@media (max-width: 1023.98px) {
    /* Sidebar becomes a slide-up bottom sheet on mobile. */
    .fi-body .fi-sidebar {
        position: fixed;
        inset-inline: 0;
        bottom: 0;
        top: auto;
        width: 100% !important;
        max-width: 100%;
        height: auto;
        max-height: 85vh;
        border-radius: 1.25rem 1.25rem 0 0;
        box-shadow: 0 -18px 40px rgba(15, 23, 42, 0.22);
        overflow-y: auto;
        overflow-x: hidden;
        transition: transform 300ms ease;
        background-color: #fafafa;
    }

    .dark .fi-body .fi-sidebar {
        background-color: #27272a;
    }

    .fi-body .fi-sidebar > div:first-child {
        min-height: 0;
        overflow: visible;
    }

    /* Closed = slid down off-screen; open = slid up into view. */
    .fi-body .fi-sidebar:not(.fi-sidebar-open) {
        transform: translateY(100%) !important;
        translate: none;
    }

    .fi-body .fi-sidebar.fi-sidebar-open {
        transform: translateY(0) !important;
        translate: none;
    }

    /* Opaque, sticky sheet header so menu items don't show through under the logo while scrolling. */
    .fi-body .fi-sidebar-header {
        position: sticky;
        top: 0;
        z-index: 10;
        overflow: visible;
        background-color: #fafafa;
        border-bottom: 1px solid rgba(148, 163, 184, 0.18);
    }

    .dark .fi-body .fi-sidebar-header {
        background-color: #27272a;
    }

    .fi-body .fi-sidebar-header::before {
        content: '';
        position: absolute;
        top: 0.4rem;
        left: 50%;
        transform: translateX(-50%);
        width: 2.5rem;
        height: 0.28rem;
        border-radius: 9999px;
        background: rgba(148, 163, 184, 0.5);
    }

    /* The header chevron is hidden on mobile; the bottom bar handles navigation. */
    .fi-body .fi-sidebar-header > .fi-icon-btn {
        display: none !important;
    }

    /* The panels live in the fixed bottom bar; hide the switcher inside the
       open sheet — but not its group, which also hosts the search trigger. */
    .fi-body .fi-panel-switcher-group > .fi-sidebar-group-button,
    .fi-body .fi-panel-switcher-group > .fi-sidebar-group-items {
        display: none;
    }

    /* --- Sheet menu list styled to match the desktop sidebar (background, fonts, padding, hover, active slit) --- */
    .fi-body .fi-sidebar-nav {
        padding-top: 1.3rem;
        border-top: 1px solid rgba(148, 163, 184, 0.16);
    }

    .fi-body .fi-sidebar-nav-groups {
        gap: 0.45rem;
    }

    .fi-body .fi-sidebar-group {
        gap: 0.2rem;
    }

    .fi-body .fi-sidebar-group-button {
        padding-bottom: 0.2rem;
    }

    .fi-body .fi-sidebar-group-items {
        gap: 0.08rem;
    }

    .fi-body .fi-panel-dashboard-group > .fi-sidebar-group-items {
        gap: 0;
    }

    .fi-body .fi-panel-dashboard-group .fi-sidebar-item-button {
        min-height: 2.05rem;
        padding-top: 0.3rem;
        padding-bottom: 0.2rem;
    }

    .fi-body .fi-sidebar-nav {
        background-image: linear-gradient(180deg, rgba(245, 245, 245, 0.98) 0%, rgba(229, 229, 229, 0.92) 100%);
        background-color: transparent;
    }

    .fi-body .fi-sidebar-group-label {
        color: #64748b;
        letter-spacing: 0.08em;
        text-transform: uppercase;
        font-size: 0.72rem;
        font-weight: 600;
    }

    .fi-body .fi-sidebar-group-icon {
        opacity: 0.7;
    }

    .fi-body .fi-sidebar-item-button {
        border: 1px solid transparent;
        border-radius: 0.6rem;
        box-shadow: none;
        transition: background-color 160ms ease, color 160ms ease;
    }

    .fi-body .fi-sidebar-item:not(.fi-active) .fi-sidebar-item-button:is(:hover, :active) {
        background-color: rgba(15, 23, 42, 0.06);
    }

    .fi-body .fi-sidebar-item-icon,
    .fi-body .fi-sidebar-group-icon {
        color: #64748b;
    }

    .fi-body .fi-sidebar-item.fi-active .fi-sidebar-item-button {
        background-color: transparent;
        border-color: transparent;
        box-shadow: none;
        position: relative;
    }

    .fi-body .fi-sidebar-item.fi-active .fi-sidebar-item-button::before {
        content: '';
        position: absolute;
        inset-inline-start: -0.4rem;
        top: 50%;
        height: 1.05rem;
        width: 0.2rem;
        transform: translateY(-50%);
        border-radius: 9999px;
        background: rgba(var(--primary-600), 1);
    }

    .fi-body .fi-sidebar-item.fi-active .fi-sidebar-item-icon,
    .fi-body .fi-sidebar-item.fi-active .fi-sidebar-item-label {
        color: rgba(var(--primary-600), 1);
    }

    .fi-body .fi-sidebar-item.fi-active .fi-sidebar-item-label {
        font-weight: 700;
    }

    .fi-body .fi-sidebar-item.fi-active .fi-sidebar-item-icon {
        stroke-width: 2.15;
    }

    .dark .fi-body .fi-sidebar-nav {
        background-image: linear-gradient(180deg, rgba(39, 39, 42, 0.98) 0%, rgba(24, 24, 27, 1) 100%);
        background-color: #18181b;
    }

    .dark .fi-body .fi-sidebar-item:not(.fi-active) .fi-sidebar-item-button:is(:hover, :active) {
        background-color: rgba(255, 255, 255, 0.07);
    }

    .dark .fi-body .fi-sidebar-item-icon,
    .dark .fi-body .fi-sidebar-group-icon {
        color: #94a3b8;
    }

    .dark .fi-body .fi-sidebar-item.fi-active .fi-sidebar-item-button::before {
        background: rgba(var(--primary-300), 1);
    }

    .dark .fi-body .fi-sidebar-item.fi-active .fi-sidebar-item-icon,
    .dark .fi-body .fi-sidebar-item.fi-active .fi-sidebar-item-label {
        color: rgba(var(--primary-300), 1);
    }

    /* Keep page content clear of the fixed bottom panel bar. */
    .fi-body .fi-main {
        padding-bottom: 5rem;
    }

    /* The user menu now lives in the bottom bar; hide the sheet's footer copy. */
    .fi-body .fi-sidebar-user-menu-panel {
        display: none !important;
    }

    /* Let the last menu items scroll clear of the fixed bottom bar. */
    .fi-body .fi-sidebar-nav {
        padding-bottom: 4.5rem;
    }

    /* === Mobile bottom panel bar (icon-only; active accent = panel primary, like desktop) === */
    .fi-mobile-panel-bar {
        position: fixed;
        inset-inline: 0;
        bottom: 0;
        z-index: 40;
        display: flex;
        align-items: stretch;
        border-top: 1px solid rgba(226, 232, 240, 0.7);
        background-color: rgba(255, 255, 255, 0.95);
        -webkit-backdrop-filter: blur(10px);
        backdrop-filter: blur(10px);
        padding-bottom: env(safe-area-inset-bottom);
    }

    /* Hide the bar while a modal/slide-over is open so it never overlaps the
       modal's sticky footer (the save/submit button sits at screen bottom). */
    body:has(.fi-modal.fi-modal-open) .fi-mobile-panel-bar {
        display: none;
    }

    .dark .fi-mobile-panel-bar {
        border-top-color: rgba(255, 255, 255, 0.1);
        background-color: rgba(24, 24, 27, 0.95);
    }

    .fi-mobile-panel-bar-dropdown,
    .fi-mobile-panel-bar-dropdown > .fi-dropdown-trigger {
        display: flex;
        flex: 1 1 0;
        min-width: 0;
    }

    .fi-mobile-panel-bar-item {
        position: relative;
        display: flex;
        flex: 1 1 0;
        width: 100%;
        align-items: center;
        justify-content: center;
        padding-block: 0.85rem;
        color: #64748b;
        transition: color 150ms ease;
        -webkit-tap-highlight-color: transparent;
    }

    .fi-mobile-panel-bar-item:hover {
        color: #334155;
    }

    .dark .fi-mobile-panel-bar-item {
        color: #94a3b8;
    }

    .dark .fi-mobile-panel-bar-item:hover {
        color: #e2e8f0;
    }

    .fi-mobile-panel-bar-item.fi-active {
        color: rgba(var(--primary-600), 1);
    }

    .dark .fi-mobile-panel-bar-item.fi-active {
        color: rgba(var(--primary-300), 1);
    }

    .fi-mobile-panel-bar-icon {
        height: 1.5rem;
        width: 1.5rem;
        flex-shrink: 0;
    }

    /* Slit indicator centered below the active icon (mobile mirror of the desktop left-slit). */
    .fi-mobile-panel-bar-item.fi-active::after {
        content: '';
        position: absolute;
        bottom: 0.3rem;
        left: 50%;
        transform: translateX(-50%);
        height: 0.2rem;
        width: 1.1rem;
        border-radius: 9999px;
        background-color: rgba(var(--primary-600), 1);
    }

    .dark .fi-mobile-panel-bar-item.fi-active::after {
        background-color: rgba(var(--primary-300), 1);
    }

    .fi-mobile-panel-bar-user .fi-avatar {
        height: 1.6rem !important;
        width: 1.6rem !important;
        min-width: 1.6rem;
    }

    .fi-mobile-panel-bar-bell-dot {
        position: absolute;
        top: 0.4rem;
        left: calc(50% + 0.3rem);
        display: flex;
        align-items: center;
        justify-content: center;
        min-width: 1rem;
        height: 1rem;
        padding: 0 0.25rem;
        border-radius: 9999px;
        background: #dc2626;
        color: #fff;
        font-size: 0.58rem;
        font-weight: 600;
        line-height: 1;
    }
}
/* Remove number input spinners */
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
input[type=number] {
    -moz-appearance: textfield;
}

/* Compact nav item rows (desktop + mobile). Lower specificity than the switcher/dashboard
   rules so those keep their own sizing. */
.fi-body .fi-sidebar-item-button {
    min-height: 1.9rem;
    padding-top: 0.2rem;
    padding-bottom: 0.2rem;
}


/* === Notifications feed ===
   Rendered inside the notifications drawer (notifications-panel-host blade),
   opened by the sidebar footer bell and the mobile bar bell. The feed rules
   further down style its cards. Unscoped by media on purpose: the drawer is
   the same on desktop and mobile. */


/* === Sidebar footer (sidebar-user-menu blade) ===
   Expanded: one row — the user (avatar + name + role line → user menu,
   opening upward), then the bell and the AI assistant. Collapsed: bell,
   assistant and avatar stacked. Configuration + Help live in the user menu. */
.fi-body .fi-sidebar-user-menu-panel {
    border-top-width: 1px;
    border-top-style: solid;
    padding: 0.4rem 0.6rem 0.45rem;
}

.fi-body .fi-sidebar-footer-expanded {
    display: flex;
    align-items: center;
    gap: 0.15rem;
}

.fi-body .fi-sidebar-footer-collapsed {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.15rem;
}

.fi-body .fi-sidebar-user-menu-panel .fi-sidebar-footer-btn {
    position: relative;
    display: inline-flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    width: 2.15rem;
    height: 2.15rem;
    border-radius: 0.7rem;
    box-shadow: none;
}

.fi-body .fi-sidebar-user-menu-panel .fi-sidebar-footer-btn svg {
    width: 1.3rem;
    height: 1.3rem;
}

.fi-body .fi-sidebar-footer-btn-badge {
    position: absolute;
    top: 0.05rem;
    inset-inline-start: 1.25rem;
    display: flex;
    pointer-events: none;
}

.fi-body .fi-sidebar-user-dropdown {
    display: block;
    flex: 1 1 auto;
    min-width: 0;
}

.fi-body .fi-sidebar-user-dropdown > .fi-dropdown-trigger {
    display: block;
    width: 100%;
}

.fi-body .fi-sidebar-user-menu-panel .fi-sidebar-user-trigger {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    width: 100%;
    padding: 0.3rem 0.4rem;
    text-align: start;
    box-shadow: none;
}

.fi-body .fi-sidebar-user-trigger .fi-avatar,
.fi-body .fi-sidebar-user-avatar-trigger .fi-avatar {
    width: 2.25rem;
    height: 2.25rem;
    flex-shrink: 0;
}

.fi-body .fi-sidebar-user-text {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-width: 0;
    line-height: 1.25;
}

.fi-body .fi-sidebar-user-name,
.fi-body .fi-sidebar-user-role {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.fi-body .fi-sidebar-user-name {
    font-size: 0.95rem;
    font-weight: 700;
    color: #0f172a;
}

.dark .fi-body .fi-sidebar-user-name {
    color: #fff;
}

.fi-body .fi-sidebar-user-role {
    font-size: 0.78rem;
    color: #64748b;
}

.dark .fi-body .fi-sidebar-user-role {
    color: #94a3b8;
}

.fi-body .fi-sidebar-user-avatar-trigger {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.6rem;
    height: 2.6rem;
}

/* === Notifications drawer chrome (notifications-panel-host blade) ===
   Header in the navbar's language: a soft primary tile + bold title, a quiet
   rounded close button, one hairline under it; it stays pinned while the
   feed scrolls. The content box drops the modal's px-6/py-6 so the rows run
   edge to edge — the rows carry their own inline padding. */
.fi-body [data-fi-modal-id="notifications-panel"] .fi-modal-header {
    position: sticky;
    top: 0;
    z-index: 10;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.18);
    background: inherit;
}

.fi-body [data-fi-modal-id="notifications-panel"] .fi-modal-header > .absolute {
    top: 0.85rem;
    inset-inline-end: 0.85rem;
}

.fi-body [data-fi-modal-id="notifications-panel"] .fi-modal-close-btn {
    width: 2rem;
    height: 2rem;
    border-radius: 0.6rem;
    transition: background-color 160ms ease, color 160ms ease;
}

.fi-body [data-fi-modal-id="notifications-panel"] .fi-modal-close-btn:hover {
    background-color: rgba(15, 23, 42, 0.05);
}

.dark .fi-body [data-fi-modal-id="notifications-panel"] .fi-modal-close-btn:hover {
    background-color: rgba(255, 255, 255, 0.06);
}

.fi-body [data-fi-modal-id="notifications-panel"] .fi-modal-close-btn .fi-icon-btn-icon {
    width: 1.15rem;
    height: 1.15rem;
}

.fi-body [data-fi-modal-id="notifications-panel"] .fi-modal-content {
    gap: 0;
    padding: 0;
}

.fi-body .fi-notifications-panel-heading {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    min-height: 2rem;
    padding-inline-end: 2.5rem;
}

.fi-body .fi-notifications-panel-heading-icon {
    display: inline-flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 0.6rem;
    background-color: rgba(var(--primary-500), 0.12);
    color: rgba(var(--primary-600), 1);
}

.dark .fi-body .fi-notifications-panel-heading-icon {
    background-color: rgba(var(--primary-400), 0.14);
    color: rgba(var(--primary-300), 1);
}

.fi-body .fi-notifications-panel-heading-icon svg {
    width: 1.1rem;
    height: 1.1rem;
}

.fi-body .fi-notifications-panel-heading-title {
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: #0f172a;
}

.dark .fi-body .fi-notifications-panel-heading-title {
    color: #fff;
}

/* Toolbar: unread status on the left, quiet icon+label buttons on the right
   (the navbar's hover tint and focus ring; Clear tints red on hover). */
.fi-body .fi-sidebar-notifications-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.5rem 0.6rem 0.5rem 1rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.18);
}

.fi-body .fi-sidebar-notifications-status {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.75rem;
    font-weight: 600;
    color: #64748b;
}

.dark .fi-body .fi-sidebar-notifications-status {
    color: #94a3b8;
}

.fi-body .fi-sidebar-notifications-status.fi-has-unread {
    color: rgba(var(--primary-600), 1);
}

.dark .fi-body .fi-sidebar-notifications-status.fi-has-unread {
    color: rgba(var(--primary-300), 1);
}

.fi-body .fi-sidebar-notifications-action-buttons {
    display: flex;
    flex-shrink: 0;
    align-items: center;
    gap: 0.15rem;
}

.fi-body .fi-sidebar-notifications-action {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    height: 1.85rem;
    padding: 0 0.55rem;
    border-radius: 0.6rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: #475569;
    transition: background-color 160ms ease, color 160ms ease;
}

.dark .fi-body .fi-sidebar-notifications-action {
    color: #cbd5e1;
}

.fi-body .fi-sidebar-notifications-action svg {
    width: 0.95rem;
    height: 0.95rem;
    flex-shrink: 0;
}

.fi-body .fi-sidebar-notifications-action:hover {
    background-color: rgba(15, 23, 42, 0.05);
    color: #0f172a;
}

.dark .fi-body .fi-sidebar-notifications-action:hover {
    background-color: rgba(255, 255, 255, 0.06);
    color: #fff;
}

.fi-body .fi-sidebar-notifications-action.fi-danger:hover {
    background-color: rgba(220, 38, 38, 0.08);
    color: #dc2626;
}

.dark .fi-body .fi-sidebar-notifications-action.fi-danger:hover {
    background-color: rgba(248, 113, 113, 0.12);
    color: #f87171;
}

.fi-body .fi-sidebar-notifications-action:focus-visible {
    outline: 2px solid rgba(var(--primary-500), 0.55);
    outline-offset: -2px;
}

.fi-body .fi-sidebar-notifications-action:disabled {
    opacity: 0.6;
}

/* Compact the cards: Filament's inline notification ships p-4 / gap-3 / h-6
   icons. Rows run edge to edge of the drawer, so the inline padding here is
   the drawer's gutter. (.p-4 targets the card's own layout div — vendor
   markup.) */
.fi-body .fi-sidebar-notifications-item .fi-notification .p-4 {
    padding: 0.75rem 1.1rem 0.75rem 1rem;
    gap: 0.65rem;
}

.fi-body .fi-sidebar-notifications-item .fi-no-notification-icon {
    height: 1.1rem;
    width: 1.1rem;
}

/* Filament's "×" deletes the entry; the drawer replaces it with its own read
   toggle + Remove (SidebarDatabaseNotifications), so the vendor button is gone. */
.fi-body .fi-sidebar-notifications-item .fi-no-notification-close-btn {
    display: none;
}

/* The card's own icon is its read marker: in colour while unread, grey once read. A
   transparent button laid exactly over it (above the stretched link, z 1) toggles read.
   Remove sits where the "open" chevron used to be, bottom-right, shown on hover (touch
   devices keep it visible). Geometry follows the compact card: .p-4 is 0.75rem / 1rem,
   the icon 1.1rem. */
.fi-body .fi-sidebar-notifications-item:not(.fi-unread) .fi-no-notification-icon {
    color: #94a3b8 !important;
}

.dark .fi-body .fi-sidebar-notifications-item:not(.fi-unread) .fi-no-notification-icon {
    color: #64748b !important;
}

.fi-body .fi-sidebar-notifications-read-toggle {
    position: absolute;
    top: 0.75rem;
    inset-inline-start: 0.75rem;
    z-index: 2;
    height: 1.6rem;
    width: 1.6rem;
    border-radius: 9999px;
    transition: background-color 120ms ease, box-shadow 120ms ease;
}

.fi-body .fi-sidebar-notifications-read-toggle:hover {
    background: rgba(148, 163, 184, 0.18);
    box-shadow: 0 0 0 1px rgba(148, 163, 184, 0.45);
}

.dark .fi-body .fi-sidebar-notifications-read-toggle:hover {
    background: rgba(255, 255, 255, 0.06);
}

.fi-body .fi-sidebar-notifications-read-toggle:focus-visible {
    outline: 2px solid rgba(var(--primary-500), 0.55);
    outline-offset: 1px;
}

.fi-body .fi-sidebar-notifications-remove {
    position: absolute;
    bottom: 0.45rem;
    inset-inline-end: 0.6rem;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 1.45rem;
    width: 1.45rem;
    border-radius: 9999px;
    color: #94a3b8;
    transition: background-color 120ms ease, color 120ms ease, opacity 120ms ease;
}

.fi-body .fi-sidebar-notifications-remove:hover {
    background: rgba(var(--danger-500), 0.1);
    color: rgba(var(--danger-600), 1);
}

.fi-body .fi-sidebar-notifications-remove svg {
    height: 0.85rem;
    width: 0.85rem;
}

.fi-body .fi-sidebar-notifications-item.fi-marks-read-on-click {
    cursor: pointer;
}

@media (hover: hover) {
    .fi-body .fi-sidebar-notifications-remove {
        opacity: 0;
    }

    .fi-body .fi-sidebar-notifications-item:hover .fi-sidebar-notifications-remove,
    .fi-body .fi-sidebar-notifications-remove:focus-visible {
        opacity: 1;
    }
}

/* Unread / All: a segmented pair on the toolbar's left, the unread count as a pill. */
.fi-body .fi-sidebar-notifications-tabs {
    display: inline-flex;
    gap: 0.1rem;
    padding: 0.15rem;
    border-radius: 0.65rem;
    background: rgba(148, 163, 184, 0.14);
}

.fi-body .fi-sidebar-notifications-tab {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    height: 1.6rem;
    padding: 0 0.6rem;
    border-radius: 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: #64748b;
    transition: background-color 120ms ease, color 120ms ease;
}

.dark .fi-body .fi-sidebar-notifications-tab {
    color: #94a3b8;
}

.fi-body .fi-sidebar-notifications-tab.fi-active {
    background: #fff;
    color: #0f172a;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.12);
}

.dark .fi-body .fi-sidebar-notifications-tab.fi-active {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.fi-body .fi-sidebar-notifications-tab-count {
    min-width: 1.1rem;
    padding: 0 0.3rem;
    border-radius: 9999px;
    background: rgba(var(--primary-500), 1);
    color: #fff;
    font-size: 0.65rem;
    line-height: 1.1rem;
    text-align: center;
}

/* The drawer autofocuses its first control on open: no ring for that, only for keyboard focus. */
.fi-body .fi-sidebar-notifications-tab:focus:not(:focus-visible) {
    outline: none;
}

.fi-body .fi-sidebar-notifications-tab:focus-visible {
    outline: 2px solid rgba(var(--primary-500), 0.55);
    outline-offset: 1px;
}

/* Day groups: Today / Yesterday / Earlier. */
.fi-body .fi-sidebar-notifications-group {
    padding: 0.6rem 1rem 0.3rem;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #94a3b8;
}

.fi-body .fi-sidebar-notifications-item .fi-no-notification-title {
    font-size: 0.8rem;
    line-height: 1.3;
}

.fi-body .fi-sidebar-notifications-item .fi-no-notification-body {
    font-size: 0.75rem;
    line-height: 1.35;
}

/* Age: small, muted, pushed to the card bottom (grid order beats DOM position). */
.fi-body .fi-sidebar-notifications-item .fi-no-notification-date {
    order: 10;
    margin-top: 0.35rem;
    font-size: 0.65rem;
    line-height: 1;
    opacity: 0.7;
}

/* The whole card navigates: the View action anchor is collapsed to zero size
   and stretched over the card via ::after, so a click anywhere hits the REAL
   link — its markAsRead handler and wire:navigate included. (Single-action
   cards only; a second action's overlay would cover the first.) The anchor's
   ::after escapes .fi-notification's overflow-hidden because its containing
   block is the item, which sits outside that box. */
.fi-body .fi-sidebar-notifications-item .fi-no-notification-actions {
    margin: 0;
    height: 0;
    /* Hides the "View ..." label (its inner span carries its own font-size, so
       font-size:0 cannot); the stretched ::after re-enables visibility on itself. */
    visibility: hidden;
}

.fi-body .fi-sidebar-notifications-item .fi-no-notification-actions .fi-link {
    position: static;
}

.fi-body .fi-sidebar-notifications-item .fi-no-notification-actions .fi-link::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 1;
    visibility: visible;
}

/* Affordance: hovering a card that opens something tints it. */
.fi-body .fi-sidebar-notifications-item:has(.fi-no-notification-actions .fi-link):hover {
    background: rgba(148, 163, 184, 0.12);
}

.dark .fi-body .fi-sidebar-notifications-item:has(.fi-no-notification-actions .fi-link):hover {
    background: rgba(255, 255, 255, 0.05);
}

.fi-body .fi-sidebar-notifications-item {
    position: relative;
}

.fi-body .fi-sidebar-notifications-item + .fi-sidebar-notifications-item {
    border-top: 1px solid rgba(148, 163, 184, 0.18);
}

/* Unread: a faint primary wash plus a slit on the drawer edge. */
.fi-body .fi-sidebar-notifications-item.fi-unread {
    background: rgba(var(--primary-500), 0.05);
}

.dark .fi-body .fi-sidebar-notifications-item.fi-unread {
    background: rgba(var(--primary-400), 0.06);
}

.fi-body .fi-sidebar-notifications-item.fi-unread::before {
    content: '';
    position: absolute;
    inset-inline-start: 0;
    top: 0;
    height: 100%;
    width: 3px;
    background: rgba(var(--primary-600), 1);
}

.dark .fi-body .fi-sidebar-notifications-item.fi-unread::before {
    background: rgba(var(--primary-300), 1);
}

.fi-body .fi-sidebar-notifications-list {
    border-bottom: 1px solid rgba(148, 163, 184, 0.18);
}

.fi-body .fi-sidebar-notifications-pagination {
    padding: 0.75rem 1rem;
}

.fi-body .fi-sidebar-notifications-empty {
    padding: 3rem 1rem;
    text-align: center;
    color: #64748b;
}

.dark .fi-body .fi-sidebar-notifications-empty {
    color: #94a3b8;
}

.fi-body .fi-sidebar-notifications-empty-icon {
    height: 1.6rem;
    width: 1.6rem;
    margin: 0 auto 0.5rem;
    opacity: 0.7;
}

.fi-body .fi-sidebar-notifications-empty-heading {
    font-size: 0.85rem;
    font-weight: 600;
}

.fi-body .fi-sidebar-notifications-empty-description {
    font-size: 0.78rem;
    margin-top: 0.2rem;
}

/* Nav count badges — the bell, Action Center, unseen-rows and cluster
   counters: compact solid counters (matching the mobile bar's bell dot).
   Cosmetics only — POSITION lives on the badge's wrapper span (the
   collapsed-state and bell rules above pin it to the button corner; the
   expanded-state rule below pins it to the icon corner), because the
   wrapper is what Filament x-show-toggles and what those rules absolutely
   position. A positioned .fi-badge inside an absolutely-positioned wrapper
   would land outside the collapsed button (that exact bug shipped once).
   The fill comes from each badge's own Filament palette variable (info =
   unseen rows, warning/danger = Action Center, danger = the bell); the
   variables are comma-separated RGB triples, hence rgba(var(), 1). */
.fi-body .fi-sidebar-nav .fi-sidebar-item-button .fi-badge,
.fi-body .fi-sidebar-footer-btn-badge .fi-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 1rem;
    height: 1rem;
    padding: 0 0.25rem;
    border-radius: 9999px;
    background: rgba(var(--c-600, 220, 38, 38), 1);
    color: #fff;
    font-size: 0.58rem;
    font-weight: 600;
    line-height: 1;
    box-shadow: none;
}

/* Expanded sidebar (and the mobile sheet): pin the badge wrapper to the
   item icon's top-right corner — px-2 padding + 1.5rem icon puts the
   corner at ~2rem. Collapsed pinning stays with the collapse rules; the
   panel-switcher bell keeps its own pinning; icon-less sub-grouped rows
   keep the stock inline badge. */
.fi-body .fi-sidebar.fi-sidebar-open .fi-sidebar-group:not(.fi-panel-switcher-group) .fi-sidebar-item-button:has(.fi-sidebar-item-icon) > span:has(> .fi-badge) {
    display: flex;
    position: absolute;
    top: 0.05rem;
    inset-inline-start: 1.45rem;
    pointer-events: none;
}

/* === Collapsible group headers: compact row, chevron on hover ===
   Filament's collapse control is a 2.25rem icon button, which set the header
   row's height; it shrinks to a 1.25rem glyph. The alias icon is chevron-down
   (ConfiguresSidebarChrome): down while the group is open, turned to point
   right when Filament marks it collapsed (its -rotate-180 class). On devices
   with hover it only shows while the header is hovered or focused. */
.fi-body .fi-sidebar-group-button {
    gap: 0.5rem;
    padding-top: 0.15rem;
    padding-bottom: 0.15rem;
}

.fi-body .fi-sidebar-group-label {
    line-height: 1.25rem;
}

.fi-body .fi-sidebar-group-collapse-button {
    width: 1.25rem;
    height: 1.25rem;
    margin: 0;
    padding: 0;
    border-radius: 0.35rem;
    transition: opacity 120ms ease, transform 150ms ease;
}

.fi-body .fi-sidebar-group-collapse-button svg {
    width: 0.9rem;
    height: 0.9rem;
}

.fi-body .fi-sidebar-group-collapse-button.-rotate-180 {
    transform: rotate(-90deg);
}

@media (hover: hover) {
    .fi-body .fi-sidebar-group-collapse-button {
        opacity: 0;
    }

    .fi-body .fi-sidebar-group-button:hover .fi-sidebar-group-collapse-button,
    .fi-body .fi-sidebar-group-collapse-button:focus-visible {
        opacity: 1;
    }
}

/* === Search trigger + Pinned section (navigation-search-sidebar blade) ===
   The trigger is a button styled as an input (the palette owns the real
   input); collapsed, a magnifier icon button. Pinned rows use Filament's item
   markup, so only the inline SVG sizing and the hover unpin ✕ are new. */
.fi-body .fi-nav-search-trigger-row {
    display: flex;
    justify-content: center;
    margin-bottom: 0.3rem;
}

.fi-body .fi-nav-search-trigger {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    height: 2.1rem;
    padding: 0 0.55rem;
    border: 1px solid rgba(148, 163, 184, 0.26);
    border-radius: 0.65rem;
    background-color: rgba(255, 255, 255, 0.6);
    color: #64748b;
    font-size: 0.82rem;
    text-align: start;
    cursor: text;
    transition: border-color 150ms ease, background-color 150ms ease;
}

.dark .fi-body .fi-nav-search-trigger {
    border-color: rgba(148, 163, 184, 0.16);
    background-color: rgba(0, 0, 0, 0.22);
    color: #94a3b8;
}

.fi-body .fi-nav-search-trigger:hover {
    border-color: rgba(148, 163, 184, 0.45);
}

.fi-body .fi-nav-search-trigger:focus-visible {
    outline: 2px solid rgba(var(--primary-500), 0.6);
    outline-offset: 1px;
}

.fi-body .fi-nav-search-trigger-icon {
    width: 1rem;
    height: 1rem;
    flex-shrink: 0;
}

.fi-body .fi-nav-search-trigger-label {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.fi-body .fi-nav-search-trigger-kbd {
    flex-shrink: 0;
    padding: 0.05rem 0.35rem;
    border: 1px solid rgba(148, 163, 184, 0.3);
    border-radius: 0.3rem;
    font-family: inherit;
    font-size: 0.64rem;
    font-weight: 600;
    line-height: 1.2;
}

.fi-body .fi-nav-search-trigger-icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.35rem;
    height: 2.35rem;
    border-radius: calc(0.85rem - 0.2rem - 1px);
    color: #64748b;
}

.fi-body .fi-nav-search-trigger-icon-btn svg {
    width: 1.25rem;
    height: 1.25rem;
}

.dark .fi-body .fi-nav-search-trigger-icon-btn {
    color: #94a3b8;
}

/* Like the switcher: hover only recolours the glyph (the panel's primary). */
.fi-body .fi-nav-search-trigger-icon-btn:is(:hover, :focus-visible) {
    color: rgba(var(--primary-600), 1);
}

.dark .fi-body .fi-nav-search-trigger-icon-btn:is(:hover, :focus-visible) {
    color: rgba(var(--primary-400), 1);
}

.fi-body .fi-nav-search-pinned-icon {
    display: flex;
    flex-shrink: 0;
}

.fi-body .fi-nav-search-pinned-icon svg {
    width: 100%;
    height: 100%;
}

.fi-body .fi-nav-search-pinned-item {
    position: relative;
}

.fi-body .fi-nav-search-unpin {
    position: absolute;
    top: 50%;
    inset-inline-end: 0.3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.4rem;
    height: 1.4rem;
    transform: translateY(-50%);
    border-radius: 0.4rem;
    color: #94a3b8;
    opacity: 0;
    transition: opacity 120ms ease;
}

.fi-body .fi-nav-search-pinned-item:hover .fi-nav-search-unpin,
.fi-body .fi-nav-search-unpin:focus-visible {
    opacity: 1;
}

.fi-body .fi-nav-search-unpin:hover {
    background-color: rgba(148, 163, 184, 0.16);
    color: #0f172a;
}

.dark .fi-body .fi-nav-search-unpin:hover {
    color: #fff;
}

@media (hover: none) {
    .fi-body .fi-nav-search-unpin {
        opacity: 1;
    }
}

/* User menu header (collapsed sidebar's menu): who is signed in. */
.fi-body .fi-user-menu-header {
    display: flex;
    align-items: baseline;
    gap: 0.45rem;
    padding: 0.65rem 0.8rem 0.55rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.16);
    font-size: 0.85rem;
}

.fi-body .fi-user-menu-header-name {
    font-weight: 700;
    color: #0f172a;
}

.dark .fi-body .fi-user-menu-header-name {
    color: #fff;
}

.fi-body .fi-user-menu-header-role {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.78rem;
    color: #64748b;
}

.dark .fi-body .fi-user-menu-header-role {
    color: #94a3b8;
}

/* User menu appearance rows (theme + language): only the active choice is
   coloured — primary, on a primary-tinted pill; the rest stay gray (Filament's
   theme-switcher binding and the locale buttons' own classes). The sidebar
   user menu paints every svg slate (see the sidebar icon rule above), so these
   icons inherit their button's colour instead. */
.fi-body .fi-user-menu-appearance .fi-theme-switcher-btn.fi-active,
.fi-body .fi-user-menu-appearance .fi-locale-switcher-btn.fi-active {
    background-color: rgb(var(--primary-500) / 0.12);
}

.dark .fi-body .fi-user-menu-appearance .fi-theme-switcher-btn.fi-active,
.dark .fi-body .fi-user-menu-appearance .fi-locale-switcher-btn.fi-active {
    background-color: rgb(var(--primary-400) / 0.16);
}

.fi-body .fi-user-menu-appearance .fi-theme-switcher-btn svg,
.fi-body .fi-user-menu-appearance .fi-locale-switcher-icon svg {
    color: inherit;
}

.fi-body .fi-dropdown-list-item.fi-color-danger .fi-dropdown-list-item-icon {
    color: rgb(var(--danger-500));
}

.dark .fi-body .fi-dropdown-list-item.fi-color-danger .fi-dropdown-list-item-icon {
    color: rgb(var(--danger-400));
}

/* The search group is left empty once its trigger moves into the switcher and
   nothing is pinned — drop it, or the nav-groups gap doubles below the pill. */
.fi-body .fi-nav-search-group:not(:has(.fi-nav-search-pinned-item)):not(:has(.fi-nav-search-trigger-row)) {
    display: none;
}

/* Pinned rows can be dragged to reorder; the ghost marks the slot. */
.fi-body .fi-nav-search-pinned-ghost {
    opacity: 0.35;
}

/* === Collapsed rail: "more below" fade ===
   The rail hides its scrollbar; while there is more to scroll to, the bottom
   of the nav fades out (fi-nav-more-below is kept up to date by the
   sidebar-scroll-memory script). */
@media (min-width: 1024px) {
    .fi-body .fi-sidebar:not(.fi-sidebar-open) .fi-sidebar-nav.fi-nav-more-below {
        -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 2.75rem), transparent);
        mask-image: linear-gradient(to bottom, #000 calc(100% - 2.75rem), transparent);
    }
}

/* === Mobile sheet header ===
   Brand on the left, a quiet ✕ on the right (Filament's own collapse button —
   it calls $store.sidebar.close(), which closes the sheet — restyled; the old
   drag-handle pill did nothing and is gone). The search sits right under it
   and stays pinned at the top of the menu list: the list scrolls on its own
   (Filament centres the active item on load), which used to push the search
   half under the header. The ⌘K hint is dropped — phones have no keyboard. */
@media (max-width: 1023.98px) {
    .fi-body .fi-sidebar-header {
        height: 3.75rem;
        padding-inline: 1.25rem 0.85rem;
        border-bottom: 0;
        box-shadow: none;
    }

    .fi-body .fi-sidebar-header::before {
        content: none;
    }

    .fi-body .fi-sidebar-header .gap-3 {
        gap: 0.6rem;
    }

    .fi-body .fi-sidebar-header .gap-3 > img {
        width: 1.7rem;
        height: 1.7rem;
    }

    .fi-body .fi-sidebar-header .gap-3 > span {
        font-size: 1.3rem;
    }

    .fi-body .fi-sidebar-header > .fi-icon-btn:last-child {
        position: relative;
        display: flex !important;
        width: 2.5rem;
        height: 2.5rem;
        margin-inline-start: auto;
        border-radius: 0.6rem;
        background-color: transparent;
        color: #94a3b8;
        transition: background-color 150ms ease, color 150ms ease;
    }

    .dark .fi-body .fi-sidebar-header > .fi-icon-btn:last-child {
        background-color: transparent;
        color: #71717a;
    }

    .fi-body .fi-sidebar-header > .fi-icon-btn:last-child:active {
        background-color: rgba(148, 163, 184, 0.14);
        color: #475569;
    }

    .dark .fi-body .fi-sidebar-header > .fi-icon-btn:last-child:active {
        background-color: rgba(255, 255, 255, 0.06);
        color: #d4d4d8;
    }

    .fi-body .fi-sidebar-header > .fi-icon-btn:last-child .fi-icon-btn-icon {
        display: none;
    }

    .fi-body .fi-sidebar-header > .fi-icon-btn:last-child::before,
    .fi-body .fi-sidebar-header > .fi-icon-btn:last-child::after {
        content: '';
        position: absolute;
        top: 50%;
        left: 50%;
        width: 1rem;
        height: 1.5px;
        border-radius: 9999px;
        background-color: currentColor;
    }

    .fi-body .fi-sidebar-header > .fi-icon-btn:last-child::before {
        transform: translate(-50%, -50%) rotate(45deg);
    }

    .fi-body .fi-sidebar-header > .fi-icon-btn:last-child::after {
        transform: translate(-50%, -50%) rotate(-45deg);
    }

    /* One scroller: the sheet is a column capped at 85vh whose header stays
       put and whose menu list scrolls. (The sheet itself used to scroll too,
       sliding the list under the sticky header.) */
    .fi-body .fi-sidebar {
        overflow-y: hidden;
    }

    .fi-body .fi-sidebar > div:first-child {
        flex: none;
    }

    /* Pinned search: sticky inside the scrolling menu list (top/margin-top =
       minus the list's padding-top — Chrome offsets sticky boxes from the
       content edge), full-bleed opaque background so rows scroll under it. */
    .fi-body .fi-sidebar-nav {
        flex: 1 1 auto;
        min-height: 0;
        overflow-y: auto;
        padding-top: 0.25rem;
        border-top: 0;
    }

    /* One flat surface: the sheet colour behind header, search and list alike
       (the list's desktop gradient made the pinned search read as a band). */
    .fi-body .fi-sidebar-nav,
    .dark .fi-body .fi-sidebar-nav {
        background-image: none;
        background-color: transparent;
    }

    .fi-body .fi-panel-switcher-group {
        position: sticky;
        top: -0.25rem;
        z-index: 5;
        margin-top: -0.25rem;
        margin-inline: -1rem;
        padding: 0.25rem 1rem 0.75rem;
        background-color: #fafafa;
    }

    .dark .fi-body .fi-panel-switcher-group {
        background-color: #27272a;
    }

    .fi-body .fi-nav-search-trigger-row {
        margin-bottom: 0;
    }

    .fi-body .fi-nav-search-trigger {
        height: 2.85rem;
        padding-inline: 0.9rem;
        gap: 0.65rem;
        border-radius: 0.85rem;
        font-size: 0.95rem;
    }

    .fi-body .fi-nav-search-trigger-icon {
        width: 1.15rem;
        height: 1.15rem;
    }

    .fi-body .fi-nav-search-trigger-kbd {
        display: none;
    }
}
