/* Homepage statistics period controls */
#homepageStatsDynamic {
    position: relative;
}

#homepageStatsDynamic.stats-is-loading .stats-toolbar-loading {
    display: inline-flex;
}

#homepageStatsDynamic.stats-is-loading .homepage-stats,
#homepageStatsDynamic.stats-is-loading .homepage-insights > .container > .row {
    opacity: 0.58;
    pointer-events: none;
}

.homepage-stats,
.homepage-insights > .container > .row {
    transition: opacity 150ms ease;
}

.stats-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 18px;
    padding-bottom: 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.09);
}

.stats-toolbar-copy {
    min-width: 0;
}

.stats-toolbar-title,
.stats-toolbar-range {
    display: block;
}

.stats-toolbar-title {
    color: #fff;
    font-size: 15px;
    line-height: 1.2;
    font-weight: 700;
}

.stats-toolbar-range {
    margin-top: 4px;
    overflow: hidden;
    color: rgba(255, 255, 255, 0.56);
    font-size: 11px;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.stats-toolbar-loading {
    display: none;
    align-items: center;
    gap: 5px;
    margin-top: 5px;
    color: rgba(118, 185, 239, 0.78);
    font-size: 10px;
    font-weight: 600;
}

.stats-toolbar-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    flex: 0 0 auto;
}

.stats-quick-filter,
.stats-filter-trigger {
    height: 32px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 5px;
    color: rgba(255, 255, 255, 0.72);
    background: rgba(0, 0, 0, 0.13);
    font-size: 11px;
    font-weight: 600;
    line-height: 30px;
    text-decoration: none !important;
    transition: border-color 140ms ease, background 140ms ease, color 140ms ease;
}

.stats-quick-filter {
    padding: 0 10px;
}

.stats-quick-filter:hover,
.stats-quick-filter:focus,
.stats-filter-trigger:hover,
.stats-filter-trigger:focus {
    border-color: rgba(255, 255, 255, 0.28);
    color: #fff;
    background: rgba(255, 255, 255, 0.06);
    outline: none;
}

.stats-quick-filter.active,
.stats-filter-menu.active > .stats-filter-trigger {
    border-color: rgba(96, 169, 232, 0.55);
    color: #fff;
    background: rgba(64, 137, 199, 0.19);
}

.stats-filter-menu {
    position: relative;
}

.stats-filter-menu > summary {
    list-style: none;
}

.stats-filter-menu > summary::-webkit-details-marker {
    display: none;
}

.stats-filter-trigger {
    display: flex;
    align-items: center;
    gap: 7px;
    min-width: 94px;
    padding: 0 9px;
    cursor: pointer;
    user-select: none;
}

.stats-filter-trigger > span {
    flex: 1 1 auto;
    text-align: left;
}

.stats-filter-trigger .fa-calendar {
    color: #76b9ef;
}

.stats-filter-chevron {
    color: rgba(255, 255, 255, 0.44);
    transition: transform 140ms ease;
}

.stats-filter-menu[open] .stats-filter-chevron {
    transform: rotate(180deg);
}

.stats-filter-popover {
    position: absolute;
    z-index: 60;
    top: calc(100% + 9px);
    right: 0;
    width: 500px;
    padding: 0;
    overflow: hidden;
    border: 1px solid rgba(129, 180, 224, 0.22);
    border-radius: 10px;
    background: linear-gradient(180deg, #181f28 0%, #121820 100%);
    box-shadow: 0 22px 52px rgba(0, 0, 0, 0.48), 0 0 0 1px rgba(255, 255, 255, 0.02) inset;
    text-align: left;
}

.stats-filter-popover::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(92, 166, 229, 0.9), transparent);
}

.stats-filter-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 17px 13px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.stats-filter-heading {
    min-width: 0;
}

.stats-filter-eyebrow {
    display: block;
    margin-bottom: 3px;
    color: #6faee3;
    font-size: 13px;
    font-weight: 800;
}

.stats-filter-heading strong {
    display: block;
    overflow: hidden;
    color: #f4f8fb;
    font-size: 13px;
    font-weight: 650;
    line-height: 1.3;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.stats-filter-reset {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    flex: 0 0 auto;
    padding: 5px 7px;
    border-radius: 5px;
    color: rgba(255, 255, 255, 0.52);
    font-size: 10px;
    font-weight: 600;
    text-decoration: none !important;
    transition: color 130ms ease, background 130ms ease;
}

.stats-filter-reset:hover,
.stats-filter-reset:focus {
    color: #fff;
    background: rgba(255, 255, 255, 0.06);
}

.stats-filter-section {
    padding: 13px 16px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.stats-filter-section-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}

.stats-filter-section-head > span {
    color: rgba(255, 255, 255, 0.82);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stats-filter-section-head > small {
    color: rgba(255, 255, 255, 0.34);
    font-size: 9px;
}

.stats-year-nav {
    display: grid;
    grid-template-columns: 27px minmax(0, 1fr) 27px;
    align-items: center;
    gap: 6px;
}

.stats-year-scroll {
    width: 27px;
    height: 29px;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: 5px;
    color: rgba(255, 255, 255, 0.46);
    background: rgba(255, 255, 255, 0.025);
    cursor: pointer;
    transition: color 130ms ease, border-color 130ms ease, background 130ms ease;
}

.stats-year-scroll:hover,
.stats-year-scroll:focus {
    border-color: rgba(255, 255, 255, 0.22);
    color: #fff;
    background: rgba(255, 255, 255, 0.06);
    outline: none;
}

.stats-year-strip {
    display: flex;
    gap: 5px;
    min-width: 0;
    padding: 1px;
    overflow-x: auto;
    scrollbar-width: none;
    scroll-behavior: smooth;
}

.stats-year-strip::-webkit-scrollbar {
    display: none;
}

.stats-year-chip {
    flex: 0 0 auto;
    min-width: 49px;
    height: 29px;
    padding: 0 9px;
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: 5px;
    color: rgba(255, 255, 255, 0.60);
    background: rgba(255, 255, 255, 0.022);
    font-size: 10px;
    font-weight: 650;
    line-height: 27px;
    text-align: center;
    text-decoration: none !important;
    transition: border-color 130ms ease, color 130ms ease, background 130ms ease;
}

.stats-year-chip:hover,
.stats-year-chip:focus {
    border-color: rgba(255, 255, 255, 0.23);
    color: #fff;
    background: rgba(255, 255, 255, 0.055);
}

.stats-year-chip.active {
    border-color: rgba(92, 166, 229, 0.62);
    color: #fff;
    background: rgba(64, 137, 199, 0.23);
    box-shadow: 0 0 0 1px rgba(92, 166, 229, 0.08) inset;
}

.stats-range-form {
    padding: 15px 16px 14px;
}

.stats-range-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 98px minmax(0, 1fr);
    align-items: end;
    gap: 10px;
}

.stats-date-card {
    min-width: 0;
    margin: 0;
    cursor: pointer;
}

.stats-date-label {
    display: block;
    margin: 0 0 6px 1px;
    color: rgba(255, 255, 255, 0.43);
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.stats-date-control {
    display: flex;
    align-items: center;
    gap: 7px;
    height: 39px;
    padding: 0 10px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 7px;
    background: rgba(7, 11, 16, 0.47);
    transition: border-color 130ms ease, background 130ms ease, box-shadow 130ms ease;
}

.stats-date-card:focus-within .stats-date-control {
    border-color: rgba(92, 166, 229, 0.68);
    background: rgba(8, 14, 20, 0.72);
    box-shadow: 0 0 0 2px rgba(92, 166, 229, 0.08);
}

.stats-date-control > .fa {
    color: rgba(118, 185, 239, 0.72);
    font-size: 11px;
}

.stats-date-control input {
    min-width: 0;
    width: 100%;
    padding: 0;
    border: 0;
    outline: 0;
    color: #edf4f9;
    background: transparent;
    font-size: 11px;
    font-weight: 600;
    line-height: 1;
}

.stats-date-control input::-webkit-calendar-picker-indicator {
    filter: invert(1);
    opacity: 0.42;
    cursor: pointer;
}

.stats-range-bridge {
    display: flex;
    align-items: center;
    gap: 6px;
    height: 39px;
}

.stats-range-line {
    flex: 1 1 auto;
    height: 1px;
    background: linear-gradient(90deg, rgba(92, 166, 229, 0.12), rgba(92, 166, 229, 0.54));
}

.stats-range-line:last-child {
    background: linear-gradient(90deg, rgba(92, 166, 229, 0.54), rgba(92, 166, 229, 0.12));
}

.stats-range-duration {
    flex: 0 0 auto;
    padding: 3px 7px;
    border: 1px solid rgba(92, 166, 229, 0.20);
    border-radius: 999px;
    color: rgba(188, 220, 247, 0.82);
    background: rgba(63, 128, 184, 0.10);
    font-size: 8px;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
}

.stats-filter-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-top: 13px;
}

.stats-filter-context {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    color: rgba(255, 255, 255, 0.36);
    font-size: 9px;
    line-height: 1.3;
}

.stats-filter-context .fa {
    color: rgba(118, 185, 239, 0.62);
}

.stats-range-apply {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    height: 34px;
    padding: 0 13px;
    border: 1px solid #428bca;
    border-radius: 5px;
    color: #fff;
    background: #428bca;
    font-size: 10px;
    font-weight: 700;
    white-space: nowrap;
    transition: border-color 130ms ease, background 130ms ease, transform 130ms ease;
}

.stats-range-apply:hover,
.stats-range-apply:focus {
    border-color: #5ba1de;
    color: #fff;
    background: #5ba1de;
    outline: none;
}

.stats-range-apply:active {
    transform: translateY(1px);
}

.stats-kpi-row {
    margin-top: 0;
}

@media (max-width: 767px) {
    .stats-toolbar {
        align-items: flex-start;
        flex-direction: column;
        gap: 10px;
    }

    .stats-toolbar-actions {
        width: 100%;
        justify-content: flex-start;
        overflow: visible;
    }

    .stats-quick-filter {
        padding: 0 8px;
    }

    .stats-filter-menu {
        margin-left: auto;
    }

    .stats-filter-popover {
        position: fixed;
        top: auto;
        right: 12px;
        bottom: 12px;
        left: 12px;
        width: auto;
        max-height: calc(100vh - 24px);
        overflow-y: auto;
    }

    .stats-range-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .stats-range-bridge {
        height: 22px;
    }

    .stats-filter-footer {
        align-items: stretch;
        flex-direction: column;
    }

    .stats-range-apply {
        width: 100%;
    }
}

@media (max-width: 460px) {
    .stats-toolbar-actions {
        gap: 4px;
    }

    .stats-quick-filter {
        font-size: 10px;
    }

    .stats-filter-trigger {
        min-width: 82px;
        font-size: 10px;
    }

    .stats-filter-section-head > small {
        display: none;
    }

    .stats-filter-header,
    .stats-filter-section,
    .stats-range-form {
        padding-left: 13px;
        padding-right: 13px;
    }
}
