/* Custom logo display sizing */
.brand-logo img {
    max-height: 44px !important;
    max-width: 175px !important;
    object-fit: contain !important;
}

.brand-logo-mini {
    line-height: 65px !important;
    text-align: center !important;
}

.brand-logo-mini img {
    max-height: 34px !important;
    max-width: 34px !important;
    object-fit: contain !important;
    vertical-align: middle !important;
}

/* Never allow horizontal page scroll - content should wrap/shrink, not overflow.
   !important is required: the app's own JS sets an inline style="overflow: initial"
   on <body> (popover/modal scroll-lock handling), which otherwise wins over a
   plain rule here since inline styles outrank normal stylesheet declarations. */
html,
body {
    max-width: 100vw !important;
    overflow-x: hidden !important;
}

/* ============================================================
   Lifecard Brokers brand theme (blue gradient redesign)
   Colors sampled directly from the Lifecard Brokers logo.
   ============================================================ */
:root {
    --lc-navy: #0a1a5c;
    --lc-blue: #0b57d0;
    --lc-blue-bright: #2e7bf0;
    --lc-bg: #f2f5fb;
    --lc-radius: 18px;
    --lc-radius-sm: 14px;
    --lc-shadow: 0 10px 30px rgba(10, 26, 92, 0.08);
}

/* Decorative app background */
body {
    background-color: var(--lc-bg) !important;
    position: relative;
}

body::before,
body::after {
    content: "";
    position: fixed;
    border-radius: 50%;
    filter: blur(70px);
    z-index: 0;
    pointer-events: none;
}

body::before {
    width: 420px;
    height: 420px;
    top: -140px;
    right: -120px;
    background: radial-gradient(circle, rgba(46, 123, 240, 0.25), rgba(46, 123, 240, 0) 70%);
}

body::after {
    width: 380px;
    height: 380px;
    bottom: -160px;
    left: 280px;
    background: radial-gradient(circle, rgba(10, 26, 92, 0.15), rgba(10, 26, 92, 0) 70%);
}

/* Sidebar */
.sidebar {
    background: linear-gradient(195deg, var(--lc-navy) 0%, var(--lc-blue) 100%) !important;
    border-right: none !important;
    box-shadow: 4px 0 24px rgba(10, 26, 92, 0.18);
}

/* Scroll shadows: a soft fade appears at the top/bottom edge only while
   there is more menu content to scroll to in that direction. */
.sidebar-scroll {
    background-color: transparent !important;
    background-image:
        linear-gradient(var(--lc-navy) 30%, rgba(10, 26, 92, 0)),
        linear-gradient(rgba(10, 26, 92, 0), var(--lc-navy) 70%),
        radial-gradient(farthest-side at 50% 0, rgba(0, 0, 0, 0.35), rgba(0, 0, 0, 0)),
        radial-gradient(farthest-side at 50% 100%, rgba(0, 0, 0, 0.35), rgba(0, 0, 0, 0)) !important;
    background-repeat: no-repeat !important;
    background-position: top, bottom, top, bottom !important;
    background-size: 100% 36px, 100% 36px, 100% 12px, 100% 12px !important;
    background-attachment: local, local, scroll, scroll !important;
}

.sidebar-scroll::-webkit-scrollbar {
    width: 6px;
}

.sidebar-scroll::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.25);
    border-radius: 999px;
}

.sidebar-scroll::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-brand {
    background: transparent !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12) !important;
}

.sidebar-brand img {
    background: #fff;
    border-radius: 50%;
    padding: 3px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
}

.sidebar-menu li a {
    color: rgba(255, 255, 255, 0.75) !important;
    border-radius: 999px !important;
    margin: 2px 12px !important;
}

.sidebar-menu li a:hover,
.sidebar-menu li a:focus,
.sidebar-menu li a:active {
    background-color: rgba(255, 255, 255, 0.12) !important;
    color: #fff !important;
}

.sidebar-menu li.active > a {
    background-color: rgba(255, 255, 255, 0.18) !important;
    color: #fff !important;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.25);
}

.sidebar-menu li ul li a {
    color: rgba(255, 255, 255, 0.6) !important;
}

.sidebar-menu li ul li a:hover {
    color: #fff !important;
}

.sidebar-menu .badge {
    background-color: rgba(255, 255, 255, 0.25) !important;
}

#sidebar-menu li.expand.open > a::before,
#sidebar-menu li.expand > a::before {
    border-color: rgba(255, 255, 255, 0.7);
}

/* Floating topbar */
.navbar-custom {
    left: 270px !important;
    right: 20px !important;
    top: 16px !important;
    min-height: 60px !important;
    border-radius: var(--lc-radius-sm) !important;
    border: none !important;
    box-shadow: var(--lc-shadow);
    background: #fff !important;
}

.sidebar-toggled .navbar-custom {
    left: 90px !important;
}

.page-container {
    margin-top: 100px !important;
    padding: 0 20px 20px 20px;
}

/* Cards & page headers */
.card {
    border: none !important;
    border-radius: var(--lc-radius) !important;
    box-shadow: var(--lc-shadow);
}

.card .card-header {
    border-radius: var(--lc-radius) var(--lc-radius) 0 0 !important;
}

.page-title {
    border: none !important;
    border-radius: var(--lc-radius) var(--lc-radius) 0 0 !important;
}

/* Buttons */
.btn-primary,
.btn-default {
    background: linear-gradient(135deg, var(--lc-blue) 0%, var(--lc-blue-bright) 100%) !important;
    border: none !important;
    border-radius: 999px !important;
    color: #fff !important;
    box-shadow: 0 6px 16px rgba(11, 87, 208, 0.3);
}

.btn-primary:hover,
.btn-primary:focus,
.btn-default:hover,
.btn-default:focus {
    filter: brightness(1.08);
    color: #fff !important;
}

/* Segmented pill button groups (e.g. Month / Week / Day / List toggles) */
.btn-group .btn {
    border-radius: 999px !important;
    margin: 0 2px;
}

.btn-group .btn.active,
.btn-group .btn:active,
.btn-group label.active {
    background: var(--lc-blue) !important;
    color: #fff !important;
    border-color: var(--lc-blue) !important;
}

/* Keep icons/buttons that sit directly on the gradient sidebar legible */
.sidebar .sidebar-toggle-btn,
.sidebar #left-menu-topbar-button-container .nav-link {
    color: #fff !important;
}

.sidebar .sidebar-scroll {
    border-top-color: rgba(255, 255, 255, 0.15) !important;
}

/* Active nav item gets a left accent bar, on top of the pill highlight */
.sidebar-menu li a {
    position: relative;
}

.sidebar-menu li.active > a::before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 60%;
    border-radius: 0 4px 4px 0;
    background: #fff;
}

.brand-logo-mini-title {
    display: none;
    margin-left: 10px;
    font-weight: 700;
    font-size: 16px;
    color: #fff;
    vertical-align: middle;
    white-space: nowrap;
}

/* Mobile: collapse the floating chrome back to full-width so it doesn't run off-screen */
@media (max-width: 990px) {
    .navbar-custom {
        left: 16px !important;
        right: 16px !important;
    }

    .page-container {
        padding: 0 16px 16px 16px;
    }

    /* .page-container's 16px above is the single source of horizontal gutter on
       mobile - these inner wrappers each carry their own competing left/right
       padding (10-25px depending on the page), which stacked on top of the
       navbar's 16px inset and produced visibly inconsistent edges between the
       topbar and the content/cards below it. Zero their horizontal padding so
       every page lines up with the topbar at exactly the same 16px. */
    #page-content:not(.no-padding),
    .page-wrapper,
    .page-content {
        padding-left: 0 !important;
        padding-right: 0 !important;
    }

    /* Off-canvas menu header: logo + app title on the left, close/search on the right.
       Right padding (96px) clears both circular buttons; the title truncates with
       an ellipsis instead of overlapping them on long app names / narrow phones. */
    .sidebar-brand.brand-logo-mini {
        display: flex !important;
        align-items: center;
        justify-content: flex-start;
        text-align: left !important;
        line-height: normal !important;
        padding: 0 96px 0 16px;
        overflow: hidden;
    }

    .brand-logo-mini-title {
        display: inline-block;
        flex: 1 1 auto;
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        font-size: 14px;
    }

    .sidebar-brand.brand-logo-mini img {
        flex-shrink: 0;
    }

    .sidebar .sidebar-toggle-btn,
    .sidebar #left-menu-topbar-button-container .nav-link {
        width: 38px;
        height: 38px;
        padding: 0 !important;
        margin: 14px 6px 0 0 !important;
        border-radius: 50% !important;
        background: rgba(255, 255, 255, 0.12);
        display: flex !important;
        align-items: center;
        justify-content: center;
    }

    #left-menu-topbar-button-container {
        top: 0;
        right: 44px;
        position: absolute;
        z-index: 1006;
    }

    /* The close button is the primary way to dismiss the menu, so make it
       unmistakable: a solid, high-contrast circle instead of a faint tint. */
    .sidebar .sidebar-toggle-btn {
        position: absolute;
        right: 0;
        top: 0;
        z-index: 1006;
        background: #fff !important;
        color: var(--lc-navy) !important;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    }

    /* roomier touch targets for nav items */
    .sidebar-menu li a {
        padding: 12px 18px !important;
        font-size: 15px;
    }

    .sidebar-menu li.active > a {
        font-weight: 600;
    }

    /* Off-canvas panel: a slide-in drawer, not a full-bleed takeover, so the
       app underneath stays visibly present at the edge. Must reach bottom:0 -
       a base rule at <=590px reserves 84px at the bottom for the fixed mobile
       bottom-nav bar (meant for when the sidebar is a rail alongside it), but
       the open drawer is a full-screen overlay and should sit above that bar
       entirely, not leave a gap that exposes it. */
    .sidebar-toggled .sidebar {
        width: 90% !important;
        max-width: 360px;
        bottom: 0 !important;
        box-shadow: 10px 0 40px rgba(0, 0, 0, 0.35);
    }

    .sidebar-toggled .sidebar .sidebar-scroll {
        height: calc(100vh - 66px) !important;
    }

    /* Dimmed backdrop behind the drawer — tap anywhere on it to close.
       Above the mobile bottom-nav bar (z-index 99) too, so it can't be
       tapped through to the page underneath while the menu is open. */
    .sidebar-backdrop {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(5, 10, 35, 0.55);
        z-index: 1004;
    }

    body.sidebar-toggled .sidebar-backdrop {
        display: block;
    }
}

@media (max-width: 767px) {
    .card {
        box-shadow: none !important;
    }
}