@keyframes app-spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes app-slide {
    from {
        transform: translateX(-100%);
    }

    to {
        transform: translateX(290%);
    }
}

@keyframes app-pulse {
    50% {
        opacity: 0.45;
    }
}

.app-refresh-host {
    position: relative;
}

.app-refresh-host > :has(> .app-refresh) {
    order: 99;
    align-self: flex-end;
}

@media (min-width: 768px) {
    .app-refresh-host > :has(> .app-refresh) {
        flex: 1 1 10rem;
    }
}

.app-refresh {
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
    min-height: 2.25rem;
}

.app-refresh-status {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 2.25rem;
    font-size: 0.8125rem;
    line-height: 1.25rem;
    white-space: nowrap;
    color: color-mix(in srgb, currentColor 60%, transparent);
}

.app-refresh-status[data-state='loading'] {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--primary-600);
}

.app-refresh-status[data-state='done'] {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--success-600);
}

.dark .app-refresh-status[data-state='loading'] {
    color: var(--primary-400);
}

.dark .app-refresh-status[data-state='done'] {
    color: var(--success-400);
}

.app-refresh-icon {
    flex: none;
    width: 1rem;
    height: 1rem;
}

.app-refresh-spin {
    animation: app-spin 0.8s linear infinite;
}

.app-refresh-bar {
    position: absolute;
    inset-inline: 0;
    bottom: -0.75rem;
    height: 3px;
    overflow: hidden;
    border-radius: 3px;
    background: color-mix(in srgb, var(--primary-500) 18%, transparent);
}

.app-refresh-bar > span {
    display: block;
    width: 35%;
    height: 100%;
    border-radius: inherit;
    background: var(--primary-600);
    animation: app-slide 1.2s ease-in-out infinite;
}

.dark .app-refresh-bar > span {
    background: var(--primary-400);
}

.fi-page :is(.fi-wi-stats-overview-stat-value, .fi-wi-stats-overview-stat-description, .fi-wi-stats-overview-stat-chart, .fi-wi-chart-canvas-ctn, .fi-ta-content-ctn, .fi-ta-content) {
    transition: opacity 0.15s ease;
}

.app-refreshing :is(.fi-wi-stats-overview-stat-value, .fi-wi-stats-overview-stat-description, .fi-wi-stats-overview-stat-chart, .fi-wi-chart-canvas-ctn, .fi-ta-content-ctn, .fi-ta-content) {
    opacity: 0.45;
}

.app-refreshing :is(.fi-wi-stats-overview-stat, .fi-wi-widget:not(.fi-wi-stats-overview)) {
    position: relative;
}

.app-refreshing :is(.fi-wi-stats-overview-stat, .fi-wi-widget:not(.fi-wi-stats-overview))::after {
    content: '';
    position: absolute;
    z-index: 1;
    top: 0.625rem;
    inset-inline-end: 0.625rem;
    width: 0.75rem;
    height: 0.75rem;
    box-sizing: border-box;
    border-radius: 9999px;
    border: 2px solid color-mix(in srgb, var(--primary-600) 25%, transparent);
    border-top-color: var(--primary-600);
    animation: app-spin 0.8s linear infinite;
}

.dark .app-refreshing :is(.fi-wi-stats-overview-stat, .fi-wi-widget:not(.fi-wi-stats-overview))::after {
    border-color: color-mix(in srgb, var(--primary-400) 25%, transparent);
    border-top-color: var(--primary-400);
}

.app-skeleton-stats {
    display: grid;
    gap: 1.5rem;
    grid-template-columns: minmax(0, 1fr);
}

@media (min-width: 768px) {
    .app-skeleton-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 1024px) {
    .app-skeleton-stats {
        grid-template-columns: repeat(var(--app-skeleton-cols, 4), minmax(0, 1fr));
    }
}

.app-skeleton-stat {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.75rem;
}

.app-skeleton-panel {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    box-sizing: border-box;
    padding: 1.5rem;
    overflow: hidden;
}

.app-skeleton-heading {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.app-skeleton-bar {
    display: block;
    height: 0.75rem;
    border-radius: 9999px;
    background: color-mix(in srgb, currentColor 10%, transparent);
    animation: app-pulse 1.6s ease-in-out infinite;
}

.app-skeleton-bar-lg {
    height: 1.75rem;
    border-radius: 0.5rem;
}

.app-skeleton-chart {
    flex: 1;
    display: flex;
    align-items: flex-end;
    gap: 6%;
    padding-inline: 0.5rem;
    border-bottom: 1px solid color-mix(in srgb, currentColor 10%, transparent);
}

.app-skeleton-chart > .app-skeleton-bar {
    flex: 1;
    border-radius: 0.25rem 0.25rem 0 0;
}

.app-skeleton-rows {
    display: flex;
    flex-direction: column;
}

.app-skeleton-row {
    display: grid;
    grid-template-columns: minmax(0, 2fr) repeat(3, minmax(0, 1fr));
    gap: 1.5rem;
    align-items: center;
    padding-block: 1.125rem;
    border-top: 1px solid color-mix(in srgb, currentColor 8%, transparent);
}

@media (max-width: 767px) {
    .app-refresh-host > :has(> .app-refresh) {
        align-self: stretch;
    }

    .app-refresh {
        justify-content: flex-start;
    }

    .app-skeleton-row {
        grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
    }

    .app-skeleton-row > .app-skeleton-bar:nth-child(n + 3) {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .app-refresh-spin,
    .app-refresh-bar > span,
    .app-skeleton-bar,
    .app-refreshing :is(.fi-wi-stats-overview-stat, .fi-wi-widget)::after {
        animation: none;
    }
}
