/* ── First-import progress (success screen, manage view) ─────────────────────── */

.sync-progress {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-3);
    background: #f8faff;
    border: 1px solid #e0e7ff;
    border-radius: var(--radius-md);
    font-size: var(--font-size-xs);
    color: var(--text-medium);
    text-align: left;
}

.sync-progress__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
}

.sync-progress__label {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    min-width: 0;
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
    color: var(--text-dark);
}

.sync-progress__label i {
    flex-shrink: 0;
    font-size: 0.8rem;
    color: var(--primary);
}

.sync-progress__count {
    flex-shrink: 0;
    font-weight: var(--font-weight-medium);
    color: var(--text-light);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.sync-progress__count:empty {
    display: none;
}

.sync-progress__track {
    position: relative;
    height: 6px;
    background: #e5e9f5;
    border-radius: var(--radius-full);
    overflow: hidden;
}

.sync-progress__fill {
    height: 100%;
    width: 0;
    border-radius: inherit;
    background: linear-gradient(90deg, #3b5bdb 0%, var(--primary) 100%);
    transition: width 0.8s ease;
}

.sync-progress__note {
    margin: 0;
    line-height: 1.45;
    color: var(--text-light);
}

/* No total yet (still retrieving from the CRM): one smooth, continuous sweep. */
.sync-progress--indeterminate .sync-progress__fill {
    position: absolute;
    inset: 0 auto 0 0;
    width: 35%;
    transition: none;
    animation: syncProgressSweep 1.6s cubic-bezier(0.65, 0.05, 0.36, 1) infinite;
}

.sync-progress--completed {
    background: var(--success-bg);
    border-color: var(--success-border);
}

.sync-progress--completed .sync-progress__label i {
    color: var(--success);
}

.sync-progress--failed {
    background: var(--danger-bg);
    border-color: var(--danger-border);
}

.sync-progress--failed .sync-progress__label i {
    color: var(--danger);
}

.sync-progress--completed .sync-progress__track,
.sync-progress--failed .sync-progress__track {
    display: none;
}

@keyframes syncProgressSweep {
    0%   { transform: translateX(-100%); }
    100% { transform: translateX(290%);  }
}

@media (prefers-reduced-motion: reduce) {
    .sync-progress--indeterminate .sync-progress__fill {
        animation: none;
        width: 100%;
        opacity: 0.35;
    }
}

/* Success screen: the progress sits as a full-width row under the connection, not squeezed beside the badge. */
.sc-item:has(> .sync-progress) {
    flex-wrap: wrap;
}

.sc-item > .sync-progress {
    flex-basis: 100%;
}

/* "Running" status while the first import is in progress (success screen + sub-account rows). Doubled class so it
   wins over success.css / sub-accounts.css, which load after this file. */
.sc-item-badge.sc-item-badge--running,
.sa-connection__badge.sa-connection__badge--running {
    color: var(--primary);
    background: var(--primary-light);
    border-color: #c7d2fe;
}
