/* ==========================================================================
   宝之通增长中台 · pages-pipeline.css — 任务中心专属样式
   ========================================================================== */

/* === [pipeline-chrome] 任务中心提示栏 / 统计卡 / Tabs === */
.task-center-hint-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
    padding: 10px 14px;
    border: 1px solid var(--accent-line);
    border-radius: var(--radius-md);
    background: linear-gradient(90deg, var(--accent-soft) 0%, var(--surface) 100%);
}
.task-center-hint-bar.is-compact { padding: 8px 12px; }
.task-center-hint-main { display: flex; align-items: center; gap: 8px; font-size: var(--fs-sm); color: var(--text-secondary); }

.task-center-stats .task-center-stat-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 18px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--surface-border);
    background: var(--surface);
    text-decoration: none;
    color: inherit;
    height: 100%;
    position: relative;
    overflow: hidden;
    transition: border-color var(--motion-base) var(--easing),
                box-shadow var(--motion-base) var(--easing),
                transform var(--motion-base) var(--easing);
}
.task-center-stats .task-center-stat-card::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 3px;
    background: var(--surface-border);
    border-radius: 3px 0 0 3px;
}
.task-center-stats > :nth-child(1) .task-center-stat-card::before { background: var(--accent); width: 3.5px; }
.task-center-stats > :nth-child(2) .task-center-stat-card::before { background: #06b6d4; width: 3.5px; }
.task-center-stats > :nth-child(3) .task-center-stat-card::before { background: var(--success); width: 3.5px; }
.task-center-stats .task-center-stat-card:hover {
    border-color: var(--accent-line);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}
.task-center-stats .task-center-stat-card.is-active {
    border-color: var(--accent);
    background: var(--accent-soft);
    box-shadow: 0 0 0 1px var(--accent);
}
.task-center-stat-card .stat-card-body { flex: 1; min-width: 0; }
.task-center-stat-card .stat-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 600;
    letter-spacing: 0.02em;
    margin-bottom: 4px;
}
.task-center-stat-card .stat-value {
    font-size: 1.75rem;
    font-weight: 800;
    line-height: 1.1;
    color: var(--text-main);
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
}
.task-center-stat-card .stat-sub { font-size: 0.73rem; color: var(--text-faint); margin-top: 5px; line-height: 1.4; }
.task-center-stat-card .stat-sub-link { color: var(--text-muted); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.task-center-stat-card .stat-sub-link:hover { color: var(--accent); }

.task-center-tabs {
    position: relative;
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 16px;
    padding: 4px 18px 4px 4px;
    background: var(--surface-soft, #f4f6f8);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-md);
    overflow-x: auto;
    scrollbar-width: thin;
}

.task-center-tab {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 13px;
    border-radius: var(--radius-sm);
    color: var(--text-muted, var(--text-muted));
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    transition: background var(--motion-fast) var(--easing), color var(--motion-fast) var(--easing);
}

.task-center-tab:hover { color: var(--text-main, #1f2937); background: rgba(255, 255, 255, 0.7); }

.task-center-tab.active {
    background: var(--surface);
    color: var(--bs-primary, #0d6efd);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
    position: relative;
}
.task-center-tab.active::after {
    content: '';
    position: absolute;
    left: 8px; right: 8px; bottom: 2px;
    height: 2px;
    border-radius: 1px;
    background: var(--accent, var(--accent));
}

@media (min-width: 901px) {
    .task-center-hint-bar {
        margin-bottom: 10px;
        padding: 9px 14px;
        border-radius: var(--radius-md);
    }
    .task-center-hint-bar.is-compact { padding: 8px 12px; }
    .task-center-hint-main { font-size: var(--fs-sm); }

    .task-filter-card {
        padding: 12px 16px !important;
        margin-bottom: 12px !important;
    }
    .task-filter-card form.row {
        align-items: end !important;
        row-gap: 8px !important;
    }
    .task-filter-card .form-label {
        min-height: 16px;
        line-height: 1.2;
    }
    .task-filter-card .form-control,
    .task-filter-card .form-select,
    .task-filter-card .btn {
        min-height: 34px !important;
    }
    .task-filter-card .btn {
        width: auto !important;
        padding: 0 12px !important;
        white-space: nowrap;
    }
    .task-filter-card .col-xl-1 {
        width: auto;
        flex: 0 0 auto;
    }
    .task-center-tabs { margin-bottom: 12px; }
    .task-center-stats .task-center-stat-card { padding: 12px 14px; }
    .task-center-stat-card .stat-value { font-size: 1.35rem; }
}

/* === [pipeline-task-table] 任务中心表格 === */
.pipeline-table-card {
    padding: 0;
    overflow: hidden;
    border-radius: var(--radius-lg);
    border: 1px solid var(--surface-border);
    box-shadow: var(--shadow-sm);
}

.pipeline-table-card .table-responsive {
    overflow-x: auto;
    overflow-y: visible;
}

.pipeline-task-table {
    width: 100%;
    min-width: 1160px;
    table-layout: fixed;
    border-collapse: collapse;
}

.pipeline-task-table thead tr {
    background: var(--surface-soft);
    border-bottom: 2px solid var(--surface-border);
}

.pipeline-task-table thead th {
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.pipeline-task-table tbody tr {
    border-bottom: 1px solid var(--surface-border);
    transition: background var(--motion-base);
}

.pipeline-task-table tbody tr:last-child {
    border-bottom: 0;
}

.pipeline-task-table tbody tr:hover {
    background: var(--surface-soft);
}

.pipeline-task-table th:last-child,
.pipeline-task-table td:last-child {
    position: static !important;
    box-shadow: none !important;
}

.pipeline-task-table th,
.pipeline-task-table td {
    padding: 8px 12px !important;
    vertical-align: middle !important;
}
.pipeline-col-select,
.pipeline-select-col { width: 42px; min-width: 42px; max-width: 42px; }
.pipeline-col-progress,
.pipeline-progress-col { width: 64%; min-width: 700px; }
.pipeline-col-task,
.pipeline-task-col { width: 36%; min-width: 390px; }
.pipeline-task-id {
    color: var(--text-main);
    font-size: 0.9rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.pipeline-task-time {
    color: var(--text-secondary);
    font-size: 0.84rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.pipeline-task-title {
    flex: 1 1 auto;
    min-width: 0;
    color: var(--text-main);
    font-size: 0.88rem;
    font-weight: 600;
    line-height: 1.35;
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 1;
    line-clamp: 1;
}

.pipeline-task-note,
.pipeline-task-source,
.pipeline-scope-sub,
.pipeline-progress-summary {
    color: var(--text-faint);
    font-size: 0.76rem;
    line-height: 1.4;
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 1;
    line-clamp: 1;
}

.pipeline-task-source {
    margin-top: 0;
    min-width: 0;
}

.pipeline-scope-main {
    color: var(--text-main);
    font-size: 0.84rem;
    font-weight: 700;
    line-height: 1.4;
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
}

/* === [pipeline-pills] 类型/状态 pill === */
.pipeline-type-pill,
.pipeline-status-pill {
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    padding: 3px 8px;
    border: 1px solid transparent;
    border-radius: 999px;
    font-size: var(--fs-xs);
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
    letter-spacing: 0.01em;
}

.pipeline-type-pill.is-pipeline {
    color: var(--success-dark);
    border-color: rgba(5, 150, 105, 0.25);
    background: var(--success-soft);
}

.pipeline-type-pill.is-import {
    color: var(--accent-pressed);
    border-color: rgba(37, 99, 235, 0.2);
    background: var(--accent-soft);
}

.pipeline-type-pill.is-aiqicha {
    color: var(--warning-dark);
    border-color: rgba(217, 119, 6, 0.25);
    background: var(--warning-soft);
}

.pipeline-status-pill.is-success { color: var(--success-dark); border-color: rgba(5, 150, 105, 0.25); background: var(--success-soft); }
.pipeline-status-pill.is-primary { color: var(--accent-pressed); border-color: rgba(37, 99, 235, 0.2); background: var(--accent-soft); }
.pipeline-status-pill.is-info    { color: var(--accent-pressed); border-color: rgba(37, 99, 235, 0.25); background: var(--accent-softer); }
.pipeline-status-pill.is-warning { color: var(--warning-dark); border-color: rgba(217, 119, 6, 0.25); background: var(--warning-soft); }
.pipeline-status-pill.is-danger  { color: var(--danger-pressed); border-color: rgba(220, 38, 38, 0.25); background: var(--danger-soft); }
.pipeline-status-pill.is-secondary { color: var(--text-secondary); border-color: var(--surface-border); background: var(--surface-soft); }

/* === [pipeline-progress] 进度条 === */
.pipeline-progress-cell { min-width: 0; }

.pipeline-progress-row {
    display: grid;
    grid-template-columns: minmax(280px, 1fr) minmax(260px, 34%) max-content;
    align-items: center;
    gap: 14px;
    width: 100%;
    min-width: 0;
}

.pipeline-progress-main {
    grid-column: 1;
    min-width: 0;
}

.pipeline-progress-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 4px;
    color: var(--text-main);
    font-size: 0.78rem;
    font-weight: 600;
}

.pipeline-progress-head span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pipeline-progress-head strong {
    color: var(--text-muted);
    font-size: var(--fs-xs);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    flex: 0 0 auto;
}

.pipeline-progress-track {
    width: 100%;
    height: 5px;
    overflow: hidden;
    border-radius: 999px;
    background: #eef2f7;
    box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.18);
}

.pipeline-task-line {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-bottom: 4px;
    min-width: 0;
}

.pipeline-task-id-badge {
    flex-shrink: 0;
    color: var(--text-faint);
    font-size: 11px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.pipeline-task-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: nowrap;
    margin-bottom: 2px;
    min-width: 0;
    overflow: hidden;
}

.pipeline-meta-scope,
.pipeline-scope-sub,
.pipeline-task-source,
.pipeline-meta-time {
    flex: 0 1 auto;
    min-width: 0;
}

.pipeline-type-pill,
.pipeline-meta-time {
    flex-shrink: 0;
}

.pipeline-meta-scope {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 600;
}

.pipeline-meta-time {
    font-size: 11px;
    color: var(--text-faint);
    font-variant-numeric: tabular-nums;
}

.pipeline-task-line .pipeline-status-pill {
    flex: 0 0 auto;
}

.pipeline-progress-fill {
    display: block;
    height: 100%;
    border: 0;
    max-width: 100%;
    border-radius: inherit;
    transition: width var(--motion-slow) var(--easing);
}

.pipeline-progress-fill.is-success { background: var(--success); }
.pipeline-progress-fill.is-primary { background: var(--accent); }
.pipeline-progress-fill.is-info    { background: var(--accent-line); }
.pipeline-progress-fill.is-warning { background: var(--warning); }
.pipeline-progress-fill.is-danger { background: var(--danger); }
.pipeline-progress-fill.is-secondary { background: var(--text-faint); }

.pipeline-progress-summary {
    margin-top: 4px;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

.pipeline-fact-grid {
    grid-column: 2;
    display: flex;
    align-items: stretch;
    gap: 6px;
    margin-top: 0;
    min-width: 0;
}

.pipeline-fact-grid span {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    flex: 1 1 0;
    min-width: 0;
    min-height: 30px;
    padding: 4px 8px;
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-sm);
    background: var(--surface-soft);
}

.pipeline-fact-grid em,
.pipeline-fact-grid b {
    font-style: normal;
    line-height: 1.2;
}

.pipeline-fact-grid em {
    color: var(--text-faint);
    font-size: 10px;
    font-weight: 600;
}

.pipeline-fact-grid b {
    margin-top: 0;
    color: var(--text-main);
    font-size: 12px;
    font-weight: 750;
    font-variant-numeric: tabular-nums;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pipeline-progress-ops {
    display: none;
    flex-wrap: nowrap;
    gap: 4px 8px;
    margin-top: 3px;
    color: var(--text-muted);
    font-size: 10.5px;
    line-height: 1.35;
    min-width: 0;
    overflow: hidden;
}

.pipeline-progress-ops span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (max-width: 575.98px) {
    .pipeline-progress-ops span {
        white-space: normal;
    }
}

.pipeline-primary-action {
    min-width: 74px;
    justify-content: center;
    white-space: nowrap;
}

.pipeline-action-group {
    grid-column: 3;
    justify-self: end;
    align-self: center;
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    width: auto;
    min-width: 112px;
    white-space: nowrap;
}

.pipeline-action-group .dropdown {
    flex: 0 0 auto;
}

.pipeline-action-group form {
    display: inline-flex;
    margin: 0;
}

.pipeline-action-group .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    max-width: 100%;
    min-height: 32px;
    padding: 5px 9px;
    line-height: 1.2;
}

.pipeline-action-group .dropdown > .btn {
    width: 32px;
    min-width: 32px;
    padding: 0;
}

@media (max-width: 768px) {
    .task-center-tabs {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 6px;
        padding: 4px;
        overflow: visible;
        -webkit-mask-image: none;
        mask-image: none;
    }

    .task-center-tab {
        justify-content: center;
        min-width: 0;
        padding: 7px 8px;
        overflow: hidden;
    }

    .task-center-tab i {
        flex: 0 0 auto;
    }

    .task-center-tab-badge {
        flex: 0 0 auto;
    }

    .pipeline-table-card .table-responsive {
        overflow-x: visible !important;
    }

    .body-role-manager .pipeline-table-card .pipeline-task-table,
    .body-role-sales .pipeline-table-card .pipeline-task-table,
    .pipeline-task-table {
        min-width: 0 !important;
        width: 100% !important;
        display: block;
        border-spacing: 0 10px !important;
    }

    .pipeline-task-table thead {
        display: none;
    }

    .pipeline-task-table tbody,
    .pipeline-task-table tr,
    .pipeline-task-table td {
        display: block;
        width: 100% !important;
    }

    .pipeline-task-table tbody tr {
        margin-bottom: 10px;
        overflow: hidden;
        border: 1px solid var(--surface-border);
        border-radius: var(--radius-md);
        background: var(--surface);
        box-shadow: var(--shadow-sm);
    }

    .pipeline-task-table tbody td {
        display: grid;
        grid-template-columns: 88px minmax(0, 1fr);
        gap: 8px 10px;
        align-items: start;
        padding: 10px 12px !important;
        border: 0 !important;
        border-bottom: 1px solid var(--surface-border) !important;
        background: transparent !important;
        text-align: left !important;
        white-space: normal !important;
    }

    .pipeline-task-table tbody td::before {
        content: attr(data-label);
        color: var(--text-muted);
        font-size: 12px;
        font-weight: 700;
        line-height: 1.4;
    }

    .pipeline-task-table tbody td:last-child {
        border-bottom: 0 !important;
    }

    .pipeline-progress-row {
        grid-template-columns: minmax(0, 1fr);
        gap: 10px;
        align-items: stretch;
    }

    .pipeline-progress-main,
    .pipeline-fact-grid,
    .pipeline-action-group {
        grid-column: auto;
    }

    .pipeline-action-group {
        justify-self: start;
        justify-content: flex-start;
        flex-wrap: wrap;
        min-width: 0;
    }

    .pipeline-task-title,
    .pipeline-scope-main,
    .pipeline-progress-summary {
        -webkit-line-clamp: unset;
        line-clamp: unset;
        display: block;
        overflow: visible;
    }

    .pipeline-fact-grid {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

/* === [P4] 运行中进度条脉冲 === */
@keyframes pipeline-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.55; }
}
.pipeline-progress-fill.is-primary {
    animation: pipeline-pulse 2s ease-in-out infinite;
}

/* === [P4] 空状态打磨 === */
.pipeline-task-table .customer-empty-state {
    padding: 48px 20px 56px;
}
.pipeline-task-table .customer-empty-icon {
    font-size: 2.8rem;
    color: var(--text-faint);
    margin-bottom: 14px;
    opacity: 0.5;
}

/* === [P4] 自动刷新指示器 === */
.pipeline-auto-refresh-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent-dark);
    font-size: 11px;
    font-weight: 600;
    animation: pipeline-pulse 2.5s ease-in-out infinite;
}
.pipeline-auto-refresh-badge::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent);
}

/* === [P4] 任务行新建高亮渐隐 === */
.pipeline-task-table tbody tr.table-warning {
    animation: pipeline-row-highlight 3s ease-out forwards;
}
@keyframes pipeline-row-highlight {
    0% { background: var(--warning-soft); }
    100% { background: transparent; }
}

/* === [stat-strip] 统计内联条 === */
.task-stat-strip {
    display: flex;
    align-items: center;
    gap: 0;
    padding: 8px 10px;
    flex-wrap: wrap;
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-md);
    background: var(--surface);
}

.task-stat-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: var(--text-secondary);
    font-size: var(--fs-sm);
    transition: background var(--motion-fast) var(--easing), color var(--motion-fast) var(--easing);
    white-space: nowrap;
}

.task-stat-item i { font-size: 13px; color: var(--text-faint); }
.task-stat-item strong { font-size: 15px; font-weight: 700; color: var(--text-main); font-variant-numeric: tabular-nums; }
.task-stat-label { font-weight: 600; }
.task-stat-sub { color: var(--text-faint); font-size: 11px; }

.task-stat-item:hover { background: var(--surface-muted); color: var(--text-main); }
.task-stat-item:hover i { color: var(--accent); }
.task-stat-item.is-active { background: var(--accent-soft); color: var(--accent-dark); }
.task-stat-item.is-active i { color: var(--accent); }
.task-stat-item.is-active strong { color: var(--accent-dark); }

.task-stat-sep { width: 1px; height: 20px; background: var(--surface-border); margin: 0 2px; flex-shrink: 0; }
.task-stat-spacer { flex: 1; }

.task-stat-action {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: var(--fs-sm);
    font-weight: 600;
    color: var(--accent-dark);
    text-decoration: none;
    border: 1px solid var(--accent-line);
    background: var(--accent-soft);
    transition: background var(--motion-fast) var(--easing);
    white-space: nowrap;
}
.task-stat-action:hover { background: var(--accent); color: var(--surface); }

@media (max-width: 768px) {
    .task-stat-sub { display: none; }
    .task-stat-spacer { display: none; }
    .task-stat-action { display: none; }
}
