/* 账号全量刷新：全站左下角可收起悬浮框（max-height 400px） */
.afr-panel {
    position: fixed;
    left: 16px;
    bottom: 16px;
    z-index: 10040;
    width: min(360px, calc(100vw - 32px));
    max-height: 400px;
    box-sizing: border-box;
    font-family: Arial, sans-serif;
    font-size: 15px;
    line-height: 1.45;
    color: #1f2937;
    pointer-events: none;
}

.afr-panel[hidden] {
    display: none !important;
}

.afr-panel * {
    box-sizing: border-box;
}

.afr-panel-collapsed,
.afr-panel-expanded {
    pointer-events: auto;
}

.afr-panel-collapsed {
    display: none;
    align-items: center;
    gap: 8px;
    max-width: 100%;
    padding: 10px 14px;
    border: 1px solid #bfdbfe;
    border-radius: 999px;
    background: #eff6ff;
    color: #1d4ed8;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.afr-panel.is-collapsed .afr-panel-collapsed {
    display: inline-flex;
}

.afr-panel.is-collapsed .afr-panel-expanded {
    display: none;
}

.afr-panel-collapsed-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid rgba(29, 78, 216, 0.25);
    border-top-color: #1d4ed8;
    border-radius: 50%;
    animation: afr-spin 0.8s linear infinite;
    flex-shrink: 0;
}

.afr-panel-collapsed-check {
    display: none;
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    position: relative;
}

.afr-panel-collapsed-check::before {
    content: '';
    position: absolute;
    left: 3px;
    top: 1px;
    width: 5px;
    height: 9px;
    border: solid #047857;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* 整批完成后的收起胶囊：停转圈、绿底勾选，点击可关闭 */
.afr-panel.is-completed .afr-panel-collapsed {
    background: #ecfdf5;
    border-color: #a7f3d0;
    color: #047857;
}

.afr-panel.is-completed .afr-panel-collapsed-spinner {
    display: none;
}

.afr-panel.is-completed .afr-panel-collapsed-check {
    display: inline-block;
}

.afr-panel.is-completed .afr-panel-expanded {
    display: none;
}

.afr-panel.is-completed.is-collapsed .afr-panel-collapsed {
    display: inline-flex;
}

.afr-panel-expanded {
    display: flex;
    flex-direction: column;
    max-height: 400px;
    overflow: hidden;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.14);
}

.afr-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    border-bottom: 1px solid #eef2f7;
    background: #f8fafc;
    flex-shrink: 0;
}

.afr-panel-title {
    flex: 1 1 auto;
    font-weight: 700;
    font-size: 15px;
    color: #0f172a;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.afr-panel-notice {
    margin: 0 12px 8px;
    padding: 8px 10px;
    border-radius: 8px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #b91c1c;
    font-size: 15px;
    line-height: 1.4;
    font-weight: 600;
}

.afr-panel-notice[hidden] {
    display: none !important;
}

.afr-panel-toggle {
    border: none;
    background: transparent;
    color: #2563eb;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    padding: 2px 4px;
    white-space: nowrap;
}

.afr-panel-toggle:hover {
    color: #1d4ed8;
}

.afr-panel-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.afr-panel-cancel {
    border: none;
    background: transparent;
    color: #dc2626;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    padding: 2px 4px;
    white-space: nowrap;
}

.afr-panel-cancel:hover:not(:disabled):not(.is-disabled) {
    color: #b91c1c;
}

.afr-panel-cancel:disabled,
.afr-panel-cancel.is-disabled {
    color: #fca5a5;
    cursor: not-allowed;
    opacity: 1;
}

.afr-panel-list {
    overflow-x: hidden;
    overflow-y: auto;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 0;
    flex: 1 1 auto;
}

.afr-panel-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 10px 10px;
    border-radius: 8px;
    background: #f8fafc;
    border: 1px solid #eef2f7;
}

.afr-panel-item.is-running,
.afr-panel-item.is-queued {
    background: #eff6ff;
    border-color: #bfdbfe;
}

.afr-panel-item.is-success {
    background: #ecfdf5;
    border-color: #a7f3d0;
}

.afr-panel-item.is-failed {
    background: #fef2f2;
    border-color: #fecaca;
}

.afr-panel-item-top {
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.afr-panel-item-spinner {
    width: 14px;
    height: 14px;
    margin-top: 2px;
    border: 2px solid rgba(37, 99, 235, 0.25);
    border-top-color: #2563eb;
    border-radius: 50%;
    animation: afr-spin 0.8s linear infinite;
    flex-shrink: 0;
}

.afr-panel-item-main {
    min-width: 0;
    flex: 1 1 auto;
}

.afr-panel-item-name {
    font-weight: 700;
    font-size: 15px;
    color: #0f172a;
    word-break: break-word;
}

.afr-panel-item-stage {
    font-size: 15px;
    color: #475569;
    word-break: break-word;
}

.afr-panel-item.is-success .afr-panel-item-stage {
    color: #047857;
}

.afr-panel-item.is-failed .afr-panel-item-stage {
    color: #b91c1c;
}

.afr-panel-item-close {
    border: none;
    background: transparent;
    color: #94a3b8;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    padding: 0 2px;
    flex-shrink: 0;
}

.afr-panel-item-close:hover {
    color: #64748b;
}

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