/* ===== 导入进度（右下角悬浮圆圈） ===== */
.xw_import-widget {
    position: fixed;
    right: 24px;
    bottom: 24px;
    /* 全局最高层级：盖住弹窗遮罩、通知、抽屉等所有浮层 */
    z-index: 2147483000;
    width: 46px;
    height: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--xw_navbar-dropdown-bg, #fff);
    box-shadow: 0 6px 20px rgba(0, 0, 0, .16), 0 2px 6px rgba(0, 0, 0, .08);
    cursor: pointer;
    color: var(--xw_text-default-color);
    transition: box-shadow .2s ease, transform .2s ease;
}

.xw_import-widget:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 26px rgba(0, 0, 0, .2), 0 2px 8px rgba(0, 0, 0, .1);
}

.xw_import-trigger {
    position: relative;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.xw_import-ring {
    width: 40px;
    height: 40px;
    transform: rotate(-90deg);
}

.xw_import-ring-track {
    fill: none;
    stroke: var(--xw-accent-light, #e8f3ff);
    stroke-width: 3;
}

.xw_import-ring-bar {
    fill: none;
    stroke: var(--xw-accent, #1456f0);
    stroke-width: 3;
    stroke-linecap: round;
    transition: stroke-dashoffset .4s ease, stroke .2s ease;
}

.xw_import-ring-text {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 600;
    line-height: 1;
    color: var(--xw-accent, #1456f0);
    pointer-events: none;
}

/* 进行中：进度未知时整体旋转 */
.xw_import-widget.is-indeterminate .xw_import-ring {
    animation: xw_import-spin 1s linear infinite;
}

@keyframes xw_import-spin {
    from { transform: rotate(-90deg); }
    to { transform: rotate(270deg); }
}

/* 完成 / 失败 */
.xw_import-widget.is-done .xw_import-ring-bar { stroke: #22c55e; }
.xw_import-widget.is-done .xw_import-ring-text { color: #22c55e; font-size: 16px; }

.xw_import-widget.is-failed .xw_import-ring-bar { stroke: #f53f3f; }
.xw_import-widget.is-failed .xw_import-ring-text { color: #f53f3f; font-size: 18px; font-weight: 700; }

/* 角标：并发任务数 */
.xw_import-badge {
    position: absolute;
    top: 0;
    right: 0;
    min-width: 16px;
    height: 16px;
    line-height: 16px;
    padding: 0 4px;
    background: var(--xw-accent, #1456f0);
    color: #fff;
    font-size: 10px;
    font-weight: 600;
    border-radius: 8px;
    text-align: center;
    pointer-events: none;
    box-shadow: 0 1px 2px rgba(20, 86, 240, .3);
}

/* ===== 气泡（向上展开） ===== */
.xw_import-popover {
    position: absolute;
    right: 0;
    bottom: calc(100% + 14px);
    width: 320px;
    background: var(--xw_navbar-dropdown-bg, #fff);
    border: 1px solid rgba(0, 0, 0, .06);
    border-radius: 8px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(4px);
    transition: all .2s cubic-bezier(.4, 0, .2, 1);
    z-index: 1001;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .08), 0 2px 8px rgba(0, 0, 0, .04);
    cursor: default;
    text-align: left;
}

/* 小三角指向下方圆圈 */
.xw_import-popover::before {
    content: '';
    position: absolute;
    bottom: -5px;
    right: 16px;
    width: 10px;
    height: 10px;
    background: var(--xw_navbar-dropdown-bg, #fff);
    border: 1px solid rgba(0, 0, 0, .06);
    border-top: none;
    border-left: none;
    transform: rotate(45deg);
}

.xw_import-widget.xw_import-open .xw_import-popover {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.xw_import-popover-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px 12px;
    border-bottom: 1px solid rgba(0, 0, 0, .05);
    font-size: 13px;
    font-weight: 600;
    color: var(--xw_text-default-color);
}

.xw_import-popover-clear {
    cursor: pointer;
    font-size: 12px;
    font-weight: 400;
    color: #86909c;
    padding: 2px 8px;
    border-radius: 4px;
    transition: all .15s ease;
}

.xw_import-popover-clear:hover {
    color: #f53f3f;
    background: rgba(245, 63, 63, .06);
}

.xw_import-list {
    max-height: 280px;
    overflow-y: auto;
    padding: 6px;
}

.xw_import-list::-webkit-scrollbar { width: 4px; }
.xw_import-list::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, .1); border-radius: 2px; }
.xw_import-list::-webkit-scrollbar-track { background: transparent; }

.xw_import-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 36px 16px;
    color: #c9cdd4;
    font-size: 12px;
}

.xw_import-popover-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    border-top: 1px solid rgba(0, 0, 0, .05);
    font-size: 11px;
    color: #a9aeb8;
}

/* ===== 任务项 ===== */
.xw_import-task {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 6px;
    transition: background .15s ease;
}

.xw_import-task:hover {
    background: var(--xw_navbar-dropdown-hover-bg);
}

/* 迷你圆环 */
.xw_import-task-ring {
    position: relative;
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.xw_import-task-ring svg {
    width: 28px;
    height: 28px;
    transform: rotate(-90deg);
}

.xw_import-task-ring-track {
    fill: none;
    stroke: var(--xw-accent-light, #e8f3ff);
    stroke-width: 3;
}

.xw_import-task-ring-bar {
    fill: none;
    stroke: var(--xw-accent, #1456f0);
    stroke-width: 3;
    stroke-linecap: round;
    transition: stroke-dashoffset .4s ease, stroke .2s ease;
}

.xw_import-task-ring.is-indeterminate svg {
    animation: xw_import-spin 1s linear infinite;
}

.xw_import-task-ring-completed .xw_import-task-ring-bar { stroke: #22c55e; }
.xw_import-task-ring-failed .xw_import-task-ring-bar { stroke: #f53f3f; }

.xw_import-task-percent {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 8px;
    font-weight: 600;
    color: var(--xw-accent, #1456f0);
    pointer-events: none;
}

.xw_import-task-ring-completed .xw_import-task-percent { color: #22c55e; font-size: 12px; }
.xw_import-task-ring-failed .xw_import-task-percent { color: #f53f3f; font-size: 12px; }

.xw_import-task-info {
    flex: 1;
    min-width: 0;
}

.xw_import-task-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--xw_text-default-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.xw_import-task-meta {
    margin-top: 2px;
    font-size: 11px;
    color: #86909c;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.xw_import-task-failed .xw_import-task-meta {
    color: #f53f3f;
}

/* 细进度条 */
.xw_import-task-progress {
    width: 100%;
    height: 3px;
    margin-top: 6px;
    background: var(--xw-accent-light, #e8f3ff);
    border-radius: 2px;
    overflow: hidden;
}

.xw_import-task-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #1456f0, #4080ff);
    border-radius: 2px;
    transition: width .4s ease;
}

/* 状态 */
.xw_import-task-status {
    flex-shrink: 0;
    font-size: 11px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.xw_import-task-status::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.xw_import-status-running { color: var(--xw-accent, #1456f0); }
.xw_import-status-running::before {
    background: var(--xw-accent, #1456f0);
    animation: xw_import-pulse 1.2s ease-in-out infinite;
}

.xw_import-status-completed { color: #22c55e; }
.xw_import-status-completed::before { background: #22c55e; }

.xw_import-status-failed { color: #f53f3f; }
.xw_import-status-failed::before { background: #f53f3f; }

@keyframes xw_import-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: .3; }
}

/* 删除 */
.xw_import-task-remove {
    flex-shrink: 0;
    cursor: pointer;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    color: #c9cdd4;
    opacity: 0;
    transition: all .15s ease;
}

.xw_import-task:hover .xw_import-task-remove {
    opacity: 1;
}

.xw_import-task-remove:hover {
    background: rgba(245, 63, 63, .06);
    color: #f53f3f;
}
