/* SmartCo CRM - permanent business rail + contextual flyout */

@media (min-width: 1024px) {

    html.smartco-nav-ready,
    body.smartco-nav-ready {
        --crm-sidebar-width: 68px !important;
        --sidebar-width: 68px !important;
    }

    /* Permanent rail */

    .smartco-nav-rail {
        position: fixed;
        z-index: 100;
        inset: 0 auto 0 0;

        width: 68px;
        height: 100vh;

        display: flex;
        flex-direction: column;

        background: #0b2238;
        border-right: 1px solid #173b55;

        overflow-y: auto;
        overflow-x: hidden;

        scrollbar-width: none;
    }

    .smartco-nav-rail::-webkit-scrollbar {
        display: none;
    }

    .smartco-nav-brand {
        height: 62px;
        min-height: 62px;

        display: flex;
        align-items: center;
        justify-content: center;

        padding: 7px;

        background: #fff;
        border-bottom: 1px solid #dce5ec;
    }

    .smartco-nav-brand img {
        display: block !important;

        width: auto !important;
        height: auto !important;

        max-width: 49px !important;
        max-height: 39px !important;

        object-fit: contain;
    }

    .smartco-nav-brand strong {
        color: #004e8c;
        font-size: 14px;
        font-weight: 700;
    }

    .smartco-nav-items {
        display: flex;
        flex-direction: column;

        gap: 1px;

        padding: 7px 4px 14px;
    }

    .smartco-nav-button {
        position: relative;

        width: 60px;
        min-height: 54px;

        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;

        gap: 3px;

        padding: 5px 2px;

        border: 0 !important;
        border-radius: 3px !important;

        background: transparent !important;
        color: #a9bac8 !important;

        box-shadow: none !important;

        cursor: pointer;
    }

    .smartco-nav-button:hover {
        background: rgba(255,255,255,.07) !important;
        color: #fff !important;
    }

    .smartco-nav-button.is-active {
        color: #fff !important;
    }

    .smartco-nav-button.is-active::before {
        content: "";

        position: absolute;

        left: -4px;
        top: 10px;
        bottom: 10px;

        width: 3px;

        background: #12aaa9;
    }

    .smartco-nav-button.is-selected {
        background: rgba(255,255,255,.11) !important;
        color: #fff !important;
    }

    .smartco-nav-icon {
        width: 20px;
        height: 20px;

        display: flex;
        align-items: center;
        justify-content: center;
    }

    .smartco-nav-icon svg {
        width: 20px !important;
        height: 20px !important;

        color: inherit !important;
    }

    .smartco-nav-label {
        display: block;

        max-width: 57px;

        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;

        color: inherit !important;

        font-size: 9px !important;
        line-height: 1.15 !important;
        font-weight: 500 !important;
    }


    /* Existing Filament sidebar becomes flyout */

    html.smartco-nav-ready .fi-sidebar,
    body.smartco-nav-ready .fi-sidebar {
        position: fixed !important;

        top: 0 !important;
        bottom: 0 !important;

        left: 68px !important;
        inset-inline-start: 68px !important;

        width: 250px !important;
        min-width: 250px !important;
        max-width: 250px !important;

        z-index: 90 !important;

        background: #fff !important;

        border-right: 1px solid #dce5ec !important;

        box-shadow:
            9px 0 26px rgba(15,40,64,.09) !important;

        transform: translateX(-260px) !important;

        transition: transform .17s ease !important;

        visibility: visible !important;
    }

    html.smartco-nav-ready
    .fi-sidebar.smartco-nav-flyout-open,
    body.smartco-nav-ready
    .fi-sidebar.smartco-nav-flyout-open {
        transform: translateX(0) !important;
    }

    html.smartco-nav-ready .fi-sidebar-header,
    body.smartco-nav-ready .fi-sidebar-header {
        display: none !important;
    }

    html.smartco-nav-ready .fi-sidebar-nav,
    body.smartco-nav-ready .fi-sidebar-nav {
        height: 100vh !important;

        padding: 20px 12px 24px !important;

        overflow-y: auto !important;
    }

    html.smartco-nav-ready .fi-sidebar-group,
    body.smartco-nav-ready .fi-sidebar-group {
        display: block !important;

        margin: 0 !important;
        padding: 0 !important;
    }

    html.smartco-nav-ready
    .smartco-nav-group-hidden,
    body.smartco-nav-ready
    .smartco-nav-group-hidden {
        display: none !important;
    }

    /* Context title */

    html.smartco-nav-ready
    .fi-sidebar-group-label,
    body.smartco-nav-ready
    .fi-sidebar-group-label {
        display: flex !important;

        margin: 0 2px 12px !important;

        padding: 0 5px 13px !important;

        border-bottom: 1px solid #e5ebf0 !important;

        color: #17354c !important;

        font-size: 17px !important;
        line-height: 1.2 !important;
        font-weight: 650 !important;

        letter-spacing: -.02em !important;

        text-transform: none !important;
    }

    html.smartco-nav-ready
    .fi-sidebar-group-items,
    body.smartco-nav-ready
    .fi-sidebar-group-items {
        gap: 2px !important;
    }

    /* Flyout items */

    html.smartco-nav-ready
    .fi-sidebar-item,
    body.smartco-nav-ready
    .fi-sidebar-item {
        margin: 0 !important;
        padding: 0 !important;
    }

    html.smartco-nav-ready
    .fi-sidebar-item-button,
    body.smartco-nav-ready
    .fi-sidebar-item-button {
        min-height: 35px !important;

        padding: 7px 9px !important;

        gap: 8px !important;

        border-radius: 3px !important;

        border-left:
            2px solid transparent !important;

        box-shadow: none !important;
    }

    html.smartco-nav-ready
    .fi-sidebar-item-label,
    body.smartco-nav-ready
    .fi-sidebar-item-label {
        color: #40576a !important;

        font-size: 12.5px !important;
        line-height: 1.25 !important;
        font-weight: 500 !important;
    }

    html.smartco-nav-ready
    .fi-sidebar-item-active
    .fi-sidebar-item-button,
    body.smartco-nav-ready
    .fi-sidebar-item-active
    .fi-sidebar-item-button {
        background: #edf8f8 !important;

        border-left-color:
            #12aaa9 !important;
    }

    html.smartco-nav-ready
    .fi-sidebar-item-active
    .fi-sidebar-item-label,
    body.smartco-nav-ready
    .fi-sidebar-item-active
    .fi-sidebar-item-label {
        color: #087c7b !important;
        font-weight: 600 !important;
    }

    /* Main workspace only reserves rail width */

    html.smartco-nav-ready .fi-main-ctn,
    body.smartco-nav-ready .fi-main-ctn {
        --sidebar-width: 68px !important;
    }
}


/* Mobile remains standard Filament for the moment */

@media (max-width: 1023px) {

    .smartco-nav-rail {
        display: none !important;
    }
}


/* =========================================================
   SmartCo CRM - push workspace when contextual menu is open
   ========================================================= */

@media (min-width: 1024px) {

    html.smartco-nav-ready .fi-main-ctn,
    body.smartco-nav-ready .fi-main-ctn {
        transition:
            margin-left .17s ease,
            padding-left .17s ease !important;
    }

    html.smartco-nav-ready.smartco-nav-panel-open,
    body.smartco-nav-ready.smartco-nav-panel-open {
        --sidebar-width: 318px !important;
    }

    html.smartco-nav-ready.smartco-nav-panel-open .fi-main-ctn,
    body.smartco-nav-ready.smartco-nav-panel-open .fi-main-ctn {
        --sidebar-width: 318px !important;
    }
}


/* =========================================================
   SmartCo CRM - authoritative workspace positioning
   ========================================================= */

@media (min-width: 1024px) {

    /*
     * Rail only
     */
    html.smartco-nav-ready .fi-main-ctn,
    body.smartco-nav-ready .fi-main-ctn {
        margin-inline-start: 68px !important;
        transition: margin-inline-start .17s ease !important;
    }

    html.smartco-nav-ready .fi-topbar,
    body.smartco-nav-ready .fi-topbar {
        inset-inline-start: 68px !important;
        width: calc(100% - 68px) !important;
        transition:
            inset-inline-start .17s ease,
            width .17s ease !important;
    }


    /*
     * Rail + 250px contextual menu
     */
    html.smartco-nav-ready.smartco-nav-panel-open .fi-main-ctn,
    body.smartco-nav-ready.smartco-nav-panel-open .fi-main-ctn {
        margin-inline-start: 318px !important;
    }

    html.smartco-nav-ready.smartco-nav-panel-open .fi-topbar,
    body.smartco-nav-ready.smartco-nav-panel-open .fi-topbar {
        inset-inline-start: 318px !important;
        width: calc(100% - 318px) !important;
    }

}






/* Expanded flyout / panel header */
.smartco-nav-panel-header,
.smartco-nav-brand,
.fi-sidebar-header {
    overflow: visible !important;
}

/* Give the brand zone enough room */
.smartco-nav-panel-header,
.fi-sidebar-header {
    min-height: 72px !important;
    padding: 10px 14px !important;
}

/* Make the logo render cleanly and not crop */
.fi-logo,
.fi-sidebar-header img,
.fi-topbar-brand img,
.smartco-nav-brand img {
    display: block !important;
    width: auto !important;
    max-width: 100% !important;
    max-height: 42px !important;
    object-fit: contain !important;
    object-position: left center !important;
}

/* If the expanded panel is too narrow, widen it slightly */
:root {
    --smartco-nav-panel-width: 200px;
}

/* Common expanded sidebar / flyout width targets */
.fi-sidebar {
    overflow: visible !important;
}

.smartco-nav-panel,
.smartco-nav-flyout,
.fi-sidebar-nav {
    overflow: visible !important;
}

/* =========================================================
   SmartCo navigation - larger rail icons
   ========================================================= */

@media (min-width: 1024px) {

    .smartco-nav-button {
        min-height: 57px !important;
    }

    .smartco-nav-icon {
        width: 23px !important;
        height: 23px !important;
    }

    .smartco-nav-icon svg {
        width: 23px !important;
        height: 23px !important;
    }

}


/* =========================================================
   SmartCo CRM - FINAL navigation logo treatment
   ========================================================= */

@media (min-width: 1024px) {

    /*
     * The dark rail is navigation only.
     * Never place another SmartCo logo here.
     */
    .smartco-nav-brand {
        display: none !important;
    }

    .smartco-nav-brand img,
    .smartco-nav-brand strong {
        display: none !important;
    }


    /*
     * Main SmartCo logo lives exclusively in the top bar.
     */
    .fi-topbar {
        overflow: visible !important;
    }

    .fi-topbar-start,
    .fi-topbar .fi-topbar-start {
        width: 310px !important;
        min-width: 310px !important;
        max-width: 310px !important;

        margin: 0 !important;
        padding: 0 12px !important;

        overflow: visible !important;
    }


    /*
     * Handle either Filament markup:
     * .fi-logo may itself be IMG, or may contain IMG.
     */
    .fi-topbar .fi-logo {
        display: block !important;

        width: auto !important;
        min-width: 0 !important;
        max-width: 280px !important;

        height: auto !important;
        max-height: 46px !important;

        margin: 0 !important;
        padding: 0 !important;

        position: static !important;

        transform: none !important;
        translate: none !important;

        overflow: visible !important;

        object-fit: contain !important;
        object-position: left center !important;
    }

    .fi-topbar .fi-logo img {
        display: block !important;

        width: auto !important;
        max-width: 280px !important;

        height: auto !important;
        max-height: 46px !important;

        margin: 0 !important;
        padding: 0 !important;

        transform: none !important;

        object-fit: contain !important;
        object-position: left center !important;
    }

}

/* =========================================================
   SmartCo CRM - topbar logo alignment
   ========================================================= */

@media (min-width: 1024px) {

    .fi-topbar-start,
    .fi-topbar .fi-topbar-start {
        padding-left: 22px !important;
        padding-right: 12px !important;
    }

}

/* SmartCo CRM - stronger topbar logo offset */
@media (min-width: 1024px) {

    .fi-topbar-start,
    .fi-topbar .fi-topbar-start {
        padding-left: 62px !important;
        padding-right: 12px !important;
    }

}


/* =========================================================
   SmartCo CRM - navigation readability polish
   ========================================================= */

@media (min-width: 1024px) {

    /* -----------------------------------------
       Permanent rail
       ----------------------------------------- */

    .smartco-nav-button {
        min-height: 64px !important;
        gap: 5px !important;
        padding-top: 7px !important;
        padding-bottom: 7px !important;
    }

    .smartco-nav-icon {
        width: 28px !important;
        height: 28px !important;
    }

    .smartco-nav-icon svg {
        width: 28px !important;
        height: 28px !important;
    }

    .smartco-nav-label {
        max-width: 60px !important;

        font-size: 10.5px !important;
        line-height: 1.15 !important;
        font-weight: 500 !important;

        letter-spacing: 0 !important;
    }


    /* -----------------------------------------
       Contextual submenu
       ----------------------------------------- */

    body.smartco-nav-ready .fi-sidebar-item-label,
    html.smartco-nav-ready .fi-sidebar-item-label {
        font-size: 13.5px !important;
        line-height: 1.35 !important;
        font-weight: 400 !important;
        letter-spacing: 0 !important;
    }

    body.smartco-nav-ready .fi-sidebar-item-button,
    html.smartco-nav-ready .fi-sidebar-item-button {
        min-height: 39px !important;

        padding-top: 8px !important;
        padding-bottom: 8px !important;

        gap: 9px !important;
    }

    body.smartco-nav-ready .fi-sidebar-item svg,
    html.smartco-nav-ready .fi-sidebar-item svg,
    body.smartco-nav-ready .fi-sidebar-item img,
    html.smartco-nav-ready .fi-sidebar-item img {
        width: 19px !important;
        height: 19px !important;
    }

    /* Current submenu item - visible but not heavy */
    body.smartco-nav-ready
    .fi-sidebar-item-active
    .fi-sidebar-item-label,

    html.smartco-nav-ready
    .fi-sidebar-item-active
    .fi-sidebar-item-label {
        font-weight: 500 !important;
    }

}
