/* ==========================================================================
   宝之通增长中台 · pages-customer-detail.css — 客户详情页样式
   --------------------------------------------------------------------------
   由 scripts/css_split_customers.py 从 pages-customers.css 拆出。
   包含章节：[customer-table-base], [customer-detail-hero], [customer-table-detail], [detail-import-trash], [detail-hero-card], [detail-timeline]
   --------------------------------------------------------------------------
   TOC（章节锥点）— grep '=== \[<id>\]' 可直接跳转：
     [customer-table-base]     customer 表格基础
     [customer-detail-hero]    customer 详情页 hero 与电话区
     [customer-table-detail]   customer 表格详细规则与空状态
     [detail-hero-card]        detail.html 顶栏卡片 hero
     [detail-timeline]         detail.html 跟进时间线
   ========================================================================== */

/* === [customer-table-base] customer 表格基础（由 app.css 迁入，2026-05 整理）=== */
.customer-rich-card {
    overflow-x: auto !important;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    scrollbar-width: thin;
}
.customer-rich-table { border-spacing: 0 10px !important; }
.customer-summary-row > td { border-top: 1px solid var(--surface-border) !important; border-bottom: 1px solid var(--surface-border) !important; }
.customer-summary-row > td:first-child { border-left: 1px solid var(--surface-border) !important; }
.customer-summary-row > td:last-child { border-right: 1px solid var(--surface-border) !important; }
.customer-spacer-row > td { height: 0 !important; }
.customer-side-panel { top: calc(var(--topbar-height) + 18px) !important; }

/* === [customer-detail-hero] customer 详情页 hero 与电话区（由 app.css 迁入）=== */
.customer-real-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 16px;
    align-items: center;
    padding: 16px 18px;
    margin-bottom: 16px;
    border: 1px solid var(--accent-line);
    border-radius: var(--radius-md);
    background: linear-gradient(180deg, var(--surface) 0%, var(--accent-softer) 100%);
}
.customer-real-hero-neutral { border-color: var(--surface-border); background: linear-gradient(180deg, var(--surface) 0%, var(--surface-soft) 100%); }
.customer-real-hero-pending { border-color: rgba(217, 119, 6, 0.25); background: linear-gradient(180deg, var(--surface) 0%, var(--warning-soft) 100%); }
.customer-real-hero-main {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}
.customer-real-hero-icon {
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    color: var(--accent);
    background: var(--accent-soft);
    border: 1px solid var(--accent-line);
}
.customer-real-hero-title {
    color: var(--text-main);
    font-size: 0.98rem;
    font-weight: 700;
}
.customer-real-hero-copy {
    margin-top: 4px;
    color: var(--text-secondary);
    font-size: 0.88rem;
    line-height: 1.6;
}
.customer-real-hero-stats {
    display: flex;
    align-items: stretch;
    gap: 10px;
}
.customer-real-hero-stat {
    min-width: 84px;
    padding: 10px 12px;
    border: 1px solid var(--accent-line);
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.84);
    text-align: center;
}
.customer-real-hero-stat strong {
    display: block;
    color: var(--text-main);
    font-size: 1.05rem;
}
.customer-real-hero-stat span { color: var(--text-muted); font-size: 0.74rem; }

.customer-phone-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.customer-phone-item {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    padding: 14px;
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-md);
    background: var(--surface-soft);
}
.customer-phone-item-real { border-color: var(--accent-line); background: linear-gradient(180deg, var(--surface) 0%, var(--accent-softer) 100%); }
.customer-phone-main {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.customer-phone-heading { row-gap: 8px; }
.customer-phone-number {
    color: var(--accent);
    font-weight: 700;
    text-decoration: none;
    word-break: break-all;
}
.customer-phone-chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.customer-phone-chip {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 0 10px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent-pressed);
    border: 1px solid var(--accent-line);
    font-size: 0.76rem;
    font-weight: 700;
}
.customer-phone-detail-grid { display: grid; gap: 8px; }
.customer-phone-detail-line {
    display: grid;
    grid-template-columns: 76px minmax(0, 1fr);
    gap: 8px;
    align-items: start;
}
.customer-phone-detail-label {
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 700;
}
.customer-phone-detail-value {
    color: var(--text-main);
    font-size: 0.88rem;
    line-height: 1.55;
    word-break: break-word;
}
.customer-phone-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 10px;
    color: var(--text-muted);
    font-size: 0.78rem;
}
.customer-phone-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    flex-shrink: 0;
}

/* === [customer-table-detail] customer 表格详细规则与空状态（由 app.css 迁入）=== */
.customer-empty-state {
    display: flex;
    min-height: 200px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 36px 16px;
    color: var(--text-main);
    text-align: center;
}
.customer-empty-icon {
    width: 56px;
    height: 56px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1.5px solid var(--accent-line);
    border-radius: 50%;
    background: linear-gradient(135deg, var(--surface-soft) 0%, var(--accent-softer) 100%);
    color: var(--accent);
    font-size: 1.4rem;
    box-shadow: 0 2px 10px rgba(37,99,235,0.10);
}
.customer-rich-table {
    width: 100%;
    min-width: 980px;
    margin-bottom: 0;
    border-collapse: separate;
}
.customer-rich-table thead {
    position: sticky;
    top: 0;
    z-index: 10;
}
.customer-rich-table th {
    padding: 10px 16px 6px;
    background: var(--page-bg) !important;
    white-space: nowrap;
}
.customer-rich-table td {
    padding: 14px 16px;
    vertical-align: top;
    border: none;
}
.customer-summary-row > td { padding-top: 16px; box-shadow: 0 -2px 8px rgba(15, 23, 42, 0.03); }
.customer-summary-row > td:first-child { border-top-left-radius: 8px !important; }
.customer-summary-row > td:last-child { border-top-right-radius: 8px !important; box-shadow: none !important; }
.customer-detail-row { display: none; }
.customer-detail-row.open { display: table-row; }
.customer-detail-row > td {
    padding: 0 16px 16px;
    border-bottom-left-radius: 8px !important;
    border-bottom-right-radius: 8px !important;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.04);
}
.customer-detail-row.open > td {
    padding: 0 16px 18px !important;
    background: var(--surface) !important;
    border-right: 1px solid var(--surface-border) !important;
    border-bottom: 1px solid var(--surface-border) !important;
    border-left: 1px solid var(--surface-border) !important;
    border-bottom-right-radius: 8px !important;
    border-bottom-left-radius: 8px !important;
    box-shadow: 0 16px 32px rgba(15, 23, 42, 0.08) !important;
}
.customer-main-cell .company-name {
    display: inline-block;
    max-width: none;
    font-size: 0.92rem;
    line-height: 1.4;
    white-space: normal;
}
.customer-summary-row[data-toggle-detail] { cursor: pointer; }

@media (max-width: 768px) {
    .crm-table-card,
    .customer-rich-card,
    .trash-table-card { overflow: visible !important; }

    .crm-table-card .table-responsive,
    .customer-rich-card .table-responsive,
    .trash-table-card .table-responsive { overflow-x: visible; }

    .crm-my-table,
    .crm-pool-table,
    .trash-table-card .data-table {
        min-width: 0 !important;
        width: 100%;
        border-spacing: 0 10px !important;
    }

    .crm-my-table thead,
    .crm-pool-table thead,
    .trash-table-card .data-table thead { display: none; }

    .crm-my-table tbody,
    .crm-my-table tr,
    .crm-my-table td,
    .crm-pool-table tbody,
    .crm-pool-table tr,
    .crm-pool-table td,
    .trash-table-card .data-table tbody,
    .trash-table-card .data-table tr,
    .trash-table-card .data-table td { display: block; width: 100% !important; }

    .crm-my-table tr[data-crm-preview-row],
    .crm-pool-table .pool-summary-row,
    .trash-table-card .data-table tbody tr {
        margin-bottom: 10px;
        border: 1px solid var(--surface-border);
        border-radius: var(--radius-md);
        background: var(--surface);
        box-shadow: var(--shadow-sm);
    }

    .crm-my-table tbody td,
    .crm-pool-table .pool-summary-row > td,
    .trash-table-card .data-table tbody td {
        display: grid;
        grid-template-columns: 86px minmax(0, 1fr);
        gap: 10px;
        align-items: start;
        padding: 9px 12px !important;
        border: 0 !important;
        border-bottom: 1px solid var(--surface-border) !important;
        background: transparent !important;
        text-align: left !important;
        white-space: normal !important;
        box-shadow: none !important;
    }

    .crm-my-table tbody td::before,
    .crm-pool-table .pool-summary-row > td::before,
    .trash-table-card .data-table tbody td::before {
        content: attr(data-label);
        color: var(--text-muted);
        font-size: 12px;
        font-weight: 700;
        line-height: 1.4;
    }

    .crm-my-table tbody td:last-child,
    .crm-pool-table .pool-summary-row > td:last-child,
    .trash-table-card .data-table tbody td:last-child { border-bottom: 0 !important; }

    .crm-pool-table .pool-col-check { grid-template-columns: minmax(0, 1fr) auto !important; }

    .crm-pool-table .customer-detail-row,
    .crm-pool-table .customer-detail-row.open,
    .crm-pool-table .customer-spacer-row { display: none !important; }

    .crm-pool-table .crm-company-line,
    .crm-pool-table .crm-tag-row,
    .crm-pool-table td[data-crm-column="actions"]:not(.d-none),
    .crm-my-table td[data-crm-column="actions"]:not(.d-none),
    .trash-actions-cell {
        display: flex !important;
        flex-wrap: wrap;
        gap: 6px;
        align-items: center;
    }

    .crm-pool-table td[data-crm-column="actions"]:not(.d-none)::before { flex: 0 0 100%; }
    .crm-my-table td[data-crm-column="actions"]:not(.d-none)::before { flex: 0 0 100%; }

    .crm-my-actions { min-width: 0; }

    .crm-my-action-row {
        justify-content: flex-start;
        width: 100%;
    }

    .crm-pool-table .crm-company-name,
.crm-pool-table .crm-company-meta,
.crm-pool-table .crm-tag,
.crm-my-table .company-name,
.crm-my-table .company-meta {
        max-width: 100%;
        white-space: normal;
        overflow-wrap: anywhere;
    }

    .table-action-label { display: inline; margin-left: 4px; }

    .crm-col-actions .table-action,
    .crm-my-table .table-action {
        width: auto;
        min-height: 32px;
        padding-inline: 9px;
    }

    .crm-pool-table td[data-crm-column="actions"] .table-action {
        flex: 1 1 88px;
        justify-content: center;
        margin-left: 0;
    }

    .customer-summary-row[data-toggle-detail] { cursor: default; }
}
@media (min-width: 901px) { .main-content { padding: calc(var(--topbar-height) + 24px) 24px 34px !important; }
}

@media (max-width: 768px) {
    nav:not(.pool-pagination) .pagination {
        flex-wrap: nowrap;
        justify-content: flex-start !important;
        overflow-x: auto;
        overflow-y: hidden;
        max-width: 100%;
        padding: 2px 2px 8px;
        margin-bottom: 0;
        -webkit-overflow-scrolling: touch;
        scrollbar-gutter: stable;
    }

    nav:not(.pool-pagination) .pagination .page-item { flex: 0 0 auto; }

    nav:not(.pool-pagination) .pagination .page-link {
        min-width: 36px;
        min-height: 36px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        white-space: nowrap;
    }

    .responsive-card-table,
    .admin-users-table,
    .import-task-table,
    .aiqicha-accounts-table,
    .aiqicha-scope-table {
        min-width: 0 !important;
        width: 100%;
        border-spacing: 0 10px !important;
    }

    .responsive-card-table thead,
    .admin-users-table thead,
    .import-task-table thead,
    .aiqicha-accounts-table thead,
    .aiqicha-scope-table thead { display: none; }

    .responsive-card-table tbody,
    .responsive-card-table tr,
    .responsive-card-table td,
    .admin-users-table tbody,
    .admin-users-table tr,
    .admin-users-table td,
    .import-task-table tbody,
    .import-task-table tr,
    .import-task-table td,
    .aiqicha-accounts-table tbody,
    .aiqicha-accounts-table tr,
    .aiqicha-accounts-table td,
    .aiqicha-scope-table tbody,
    .aiqicha-scope-table tr,
    .aiqicha-scope-table td { display: block; width: 100% !important; }

    .responsive-card-table tbody tr,
    .admin-users-table tbody tr,
    .import-task-table tbody tr,
    .aiqicha-accounts-table tbody tr,
    .aiqicha-scope-table tbody tr {
        margin-bottom: 10px;
        border: 1px solid var(--surface-border);
        border-radius: var(--radius-md);
        background: var(--surface);
        box-shadow: var(--shadow-sm);
    }

    .responsive-card-table tbody td,
    .admin-users-table tbody td,
    .import-task-table tbody td,
    .aiqicha-accounts-table tbody td,
    .aiqicha-scope-table tbody td {
        display: grid;
        grid-template-columns: 86px minmax(0, 1fr);
        gap: 10px;
        align-items: start;
        padding: 9px 12px !important;
        border: 0 !important;
        border-bottom: 1px solid var(--surface-border) !important;
        background: transparent !important;
        text-align: left !important;
        white-space: normal !important;
        overflow-wrap: anywhere;
        box-shadow: none !important;
    }

    .responsive-card-table tbody td::before,
    .admin-users-table tbody td::before,
    .import-task-table tbody td::before,
    .aiqicha-accounts-table tbody td::before,
    .aiqicha-scope-table tbody td::before {
        content: attr(data-label);
        color: var(--text-muted);
        font-size: 12px;
        font-weight: 700;
        line-height: 1.4;
    }

    .responsive-card-table tbody td:last-child,
    .admin-users-table tbody td:last-child,
    .import-task-table tbody td:last-child,
    .aiqicha-accounts-table tbody td:last-child,
    .aiqicha-scope-table tbody td:last-child { border-bottom: 0 !important; }

    .admin-users-table tbody td[data-label="操作"],
.import-task-table tbody td[data-label="操作"],
.admin-products-table tbody td[data-label="操作"],
.aiqicha-accounts-table tbody td[data-label="操作"],
.aiqicha-scope-table tbody td[data-label="操作"],
.ai-logs-table tbody td[data-label="详情"] {
        display: flex !important;
        flex-wrap: wrap;
        gap: 6px;
        justify-content: flex-start !important;
    }

    .admin-users-table tbody td[data-label="操作"]::before,
.import-task-table tbody td[data-label="操作"]::before,
.admin-products-table tbody td[data-label="操作"]::before,
.aiqicha-accounts-table tbody td[data-label="操作"]::before,
.aiqicha-scope-table tbody td[data-label="操作"]::before,
.ai-logs-table tbody td[data-label="详情"]::before { flex: 0 0 100%; }

    .import-task-progress-cell { min-width: 0; max-width: none; }

    .import-task-panel-meta,
    .import-task-panel-alert,
    .import-task-name,
    .import-task-scope,
    .import-task-stats { white-space: normal; overflow-wrap: anywhere; }

    .import-task-table .num-cell { text-align: left !important; }

    .admin-products-table .btn,
    .admin-products-table form { margin-right: 0 !important; }

    .admin-company-config-cell { min-width: 0; }

    .admin-company-config-panel { grid-template-columns: 1fr; }

    .admin-company-row-actions { flex-wrap: wrap; justify-content: flex-start; }

    .admin-company-config-fields { grid-template-columns: minmax(88px, 1fr) 40px; }

    .admin-company-table .company-name,
    .admin-company-table .company-meta {
        max-width: 100%;
        white-space: normal;
        overflow-wrap: anywhere;
    }

    .admin-company-row-actions .btn { width: 34px; height: 34px; }

    .aiqicha-accounts-table .btn,
    .aiqicha-scope-table .btn,
    .crm-my-table td[data-crm-column="actions"] .btn,
    .crm-my-table .phone-cell .btn {
        max-width: 100%;
        white-space: normal;
        overflow-wrap: anywhere;
    }

    .aiqicha-account-actions { justify-content: flex-start; }

    .crm-my-table td[data-crm-column="actions"] form { display: inline-flex !important; }

    .crm-my-table td[data-crm-column="actions"] .btn { margin-right: 0 !important; }
}

@media (max-width: 430px) {
    .crm-view-strip {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 6px;
        overflow-x: visible;
        padding-right: 0;
        -webkit-mask-image: none;
        mask-image: none;
    }

    .crm-view-tab {
        justify-content: center;
        min-width: 0;
        white-space: normal;
        text-align: center;
    }

    .task-center-tabs {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 6px;
        padding: 4px;
        overflow-x: visible;
        -webkit-mask-image: none;
        mask-image: none;
    }

    .task-center-tab {
        justify-content: center;
        min-width: 0;
        padding: 8px 10px;
        white-space: normal;
        text-align: center;
    }

    .customer-batch-controls { gap: 6px; }

    .customer-batch-controls .btn { flex: 1 1 100%; }
}

/* === [detail-import-trash] 补齐 detail / import / trash 模板使用但未定义的样式（round25 审计）=== */

/* ----- 通用：min-width-0 工具类（用于 grid/flex 子项防溢出） ----- */
.min-width-0 { min-width: 0; }

/* === [detail-hero-card] detail.html：顶栏卡片 hero === */
.customer-detail-hero {
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--accent-soft), var(--surface) 65%);
    box-shadow: var(--shadow-xs);
    transition: border-color var(--motion-base) var(--easing),
                box-shadow var(--motion-base) var(--easing);
}
.customer-detail-hero .customer-hero-call {
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.02em;
}

/* === [detail-timeline] detail.html：跟进时间线 === */
.customer-timeline {
    position: relative;
    padding-left: 4px;
    margin: 0;
}
.customer-timeline > li {
    position: relative;
    padding: 4px 0 4px 0;
    border-radius: var(--radius-sm);
    transition: background var(--motion-fast) var(--easing);
}
.customer-timeline > li + li {
    margin-top: 6px;
    padding-top: 14px;
    border-top: 1px dashed var(--surface-border);
}
.customer-timeline > li:hover { background: var(--surface-soft); }
.customer-timeline strong {
    color: var(--text-main);
    font-size: var(--fs-sm);
    font-weight: 700;
}
.customer-timeline .bi {
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--surface-soft);
    border: 1px solid var(--surface-border);
}
.customer-timeline .text-success .bi { background: var(--success-soft); border-color: rgba(5,150,105,0.25); }
.customer-timeline .text-warning .bi { background: var(--warning-soft); border-color: rgba(217,119,6,0.25); }
.customer-timeline .text-danger .bi { background: var(--danger-soft); border-color: rgba(220,38,38,0.25); }
.customer-timeline .text-primary .bi,
.customer-timeline .text-info .bi { background: var(--accent-soft); border-color: rgba(37,99,235,0.2); }

/* === [pool-hero-call] 迁自 pages-customers.css === */
.customer-hero-call {
    font-weight: 600;
    letter-spacing: 0.2px;
    font-variant-numeric: tabular-nums;
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.04);
    transition: transform var(--motion-fast) var(--easing-emphasized),
                box-shadow var(--motion-fast) var(--easing-emphasized);
}
.customer-hero-call:hover,
.customer-hero-call:focus-visible {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px -2px rgba(37, 99, 235, 0.32);
}

/* === [trash-table] 迁自 pages-customers.css === */
.trash-customer-table {
    width: 100%;
    min-width: 0;
}
.trash-customer-table thead th:first-child,
.trash-customer-table tbody td:first-child {
    width: 44px;
    text-align: center;
}
.trash-customer-table tbody td {
    vertical-align: middle;
}
.trash-row-check {
    cursor: pointer;
    transform: scale(1.05);
}
.trash-row-check:checked {
    background-color: var(--accent);
    border-color: var(--accent);
}
.trash-row-check:focus-visible {
    box-shadow: var(--shadow-focus);
}

/* ==========================================================================
   [detail-hero-v2] 客户详情页 Hero 重设计
   ========================================================================== */
.detail-hero-v2 {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    padding: 20px 22px;
    border-radius: var(--radius-md);
    background: var(--surface);
    border: 1px solid var(--surface-border);
    box-shadow: var(--shadow-sm);
    border-left: 5px solid var(--surface-border);
}
.detail-hero-grade-a { border-left-color: #ef4444; }
.detail-hero-grade-b { border-left-color: #f59e0b; }
.detail-hero-grade-c { border-left-color: #3b82f6; }
.detail-hero-grade-x { border-left-color: #94a3b8; }

.detail-hero-v2-grade-col { flex-shrink: 0; }
.detail-hero-grade-avatar {
    width: 52px;
    height: 52px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--surface);
    background: var(--surface-border);
    letter-spacing: -1px;
}
.detail-hero-avatar-a { background: #ef4444; box-shadow: 0 2px 8px rgba(239,68,68,.3); }
.detail-hero-avatar-b { background: #f59e0b; box-shadow: 0 2px 8px rgba(245,158,11,.3); }
.detail-hero-avatar-c { background: #3b82f6; box-shadow: 0 2px 8px rgba(59,130,246,.3); }
.detail-hero-avatar-x { background: #94a3b8; }
.detail-hero-avatar-none { background: var(--text-faint); font-size: 1rem; }

.detail-hero-v2-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.detail-hero-v2-heading {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.detail-hero-v2-name {
    margin: 0;
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text-main);
    line-height: 1.3;
}
.detail-hero-v2-name i { color: var(--text-faint); font-size: 1.1rem; }
.detail-hero-badge-target {
    background: #d1fae5;
    color: var(--success-darker);
    border: 1px solid #6ee7b7;
    font-size: 11px;
    font-weight: 700;
}
.detail-hero-badge-nontarget {
    background: var(--surface-muted);
    color: var(--text-muted);
    border: 1px solid var(--surface-border);
    font-size: 11px;
}

.detail-hero-v2-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 16px;
    color: var(--text-secondary);
    font-size: 13px;
}
.detail-hero-v2-meta span { display: inline-flex; align-items: center; gap: 4px; }
.detail-hero-v2-meta i { color: var(--text-faint); font-size: 12px; }

.detail-hero-v2-metrics {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 4px;
}
.detail-hero-metric {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    min-width: 60px;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    background: var(--surface-soft);
    border: 1px solid var(--surface-border);
}
.detail-hero-metric-value {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-main);
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
}
.detail-hero-metric-label {
    font-size: 11px;
    color: var(--text-faint);
    font-weight: 600;
    margin-top: 2px;
}

.detail-hero-v2-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: flex-start;
    flex-shrink: 0;
}
.detail-hero-follow-select { min-width: 90px; max-width: 120px; }
.customer-hero-call { font-weight: 600; letter-spacing: 0.01em; }

/* ==========================================================================
   [detail-info-sections] 基础信息 Tab 分节布局
   ========================================================================== */
.detail-info-sections {
    display: flex;
    flex-direction: column;
    gap: 0;
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}
.detail-info-section {
    padding: 16px 20px;
    border-bottom: 1px solid var(--surface-border);
}
.detail-info-section:last-child { border-bottom: 0; }

.detail-info-section-hd {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12.5px;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin-bottom: 12px;
}
.detail-info-section-hd i { color: var(--accent); font-size: 13px; }
.detail-info-section-ai .detail-info-section-hd i { color: #8b5cf6; }

.detail-info-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px 20px;
}
.detail-info-cell-wide { grid-column: 1 / -1; }

.detail-info-label {
    font-size: 11.5px;
    font-weight: 600;
    color: var(--text-faint);
    margin-bottom: 3px;
}
.detail-info-value {
    font-size: 14px;
    color: var(--text-main);
    line-height: 1.55;
}
.detail-info-value-mono { font-size: 12px; color: var(--text-muted); font-family: monospace; }
.detail-info-link { color: var(--accent); text-decoration: none; font-weight: 600; }
.detail-info-link:hover { text-decoration: underline; }

/* AI 分析区 */
.detail-info-section-ai { background: linear-gradient(135deg, #faf5ff 0%, var(--surface) 60%); }
.detail-ai-verdict-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}
.detail-ai-verdict-cell {
    min-width: 100px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    background: rgba(255,255,255,0.85);
    border: 1px solid rgba(139, 92, 246, 0.18);
}
.detail-ai-verdict-label {
    font-size: 11px;
    font-weight: 700;
    color: #7c3aed;
    margin-bottom: 4px;
}
.detail-ai-verdict-val { font-size: 14px; color: var(--text-main); font-weight: 600; }
.detail-ai-confidence { font-size: 12px; color: var(--text-muted); margin-left: 4px; }

.detail-ai-reason-box {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    background: rgba(139, 92, 246, 0.06);
    border: 1px solid rgba(139, 92, 246, 0.18);
    position: relative;
}
.detail-ai-reason-icon { color: #8b5cf6; font-size: 1rem; flex-shrink: 0; margin-top: 2px; }
.detail-ai-reason-text {
    font-size: 13.5px;
    color: var(--text-secondary);
    line-height: 1.65;
    flex: 1;
    min-width: 0;
}

/* 可折叠文本 */
.detail-collapsible-wrap {
    position: relative;
}
.detail-collapsible-wrap.is-collapsed .detail-collapsible-inner {
    max-height: 88px;
    overflow: hidden;
}
.detail-collapsible-wrap.is-collapsed .detail-collapsible-inner::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 40px;
    background: linear-gradient(transparent, rgba(139,92,246,0.06) 100%);
    pointer-events: none;
}
.detail-expand-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 6px;
    padding: 3px 10px;
    border: 1px solid rgba(139,92,246,0.25);
    border-radius: 999px;
    background: var(--surface);
    color: #7c3aed;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--motion-fast);
    width: fit-content;
    align-self: flex-end;
}
.detail-expand-btn:hover { background: rgba(139,92,246,0.08); }

/* 话术折叠 */
.detail-pitch-collapsible-wrap {
    position: relative;
    display: flex;
    flex-direction: column;
    flex: 1;
}
.detail-pitch-collapsible-wrap.is-collapsed .detail-pitch-text {
    max-height: 160px;
    overflow: hidden;
}
.detail-pitch-collapsible-wrap.is-collapsed .detail-pitch-text::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 48px;
    background: linear-gradient(transparent, var(--surface) 100%);
    pointer-events: none;
}
.detail-pitch-expand-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 6px 14px;
    border-top: 1px solid var(--surface-border);
    background: var(--surface-soft);
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    width: 100%;
    transition: background var(--motion-fast);
    border-top: 1px solid var(--surface-border) !important;
}
.detail-pitch-expand-btn:hover { background: var(--accent-soft); color: var(--accent); }

.detail-priority-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 700;
    color: var(--surface);
    font-variant-numeric: tabular-nums;
}
.detail-priority-num-hi { background: #ef4444; }
.detail-priority-num-mid { background: #f59e0b; }
.detail-priority-num-lo { background: #94a3b8; }

/* ==========================================================================
   [detail-pitch-grid] 话术 Tab 三列卡片
   ========================================================================== */
.detail-pitch-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 14px;
}
.detail-pitch-card {
    display: flex;
    flex-direction: column;
    border-radius: var(--radius-md);
    border: 1px solid var(--surface-border);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}
.detail-pitch-card-hd {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--surface-border);
    background: var(--surface-soft);
}
.detail-pitch-icon {
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--surface);
    flex-shrink: 0;
}
.detail-pitch-phone .detail-pitch-icon { background: #22c55e; }
.detail-pitch-sms .detail-pitch-icon { background: #3b82f6; }
.detail-pitch-wechat .detail-pitch-icon { background: #07c160; }
.detail-pitch-phone .detail-pitch-card-hd { border-top: 3px solid #22c55e; }
.detail-pitch-sms .detail-pitch-card-hd { border-top: 3px solid #3b82f6; }
.detail-pitch-wechat .detail-pitch-card-hd { border-top: 3px solid #07c160; }

.detail-pitch-card-title { flex: 1; font-size: 13px; font-weight: 700; color: var(--text-main); }
.detail-pitch-copy {
    padding: 3px 8px;
    color: var(--text-muted);
    border: 1px solid var(--surface-border);
    background: var(--surface);
    border-radius: var(--radius-sm);
    font-size: 12px;
}
.detail-pitch-copy:hover { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent); }

.detail-pitch-text {
    position: relative;
    padding: 14px 16px;
    font-size: 13.5px;
    color: var(--text-secondary);
    line-height: 1.7;
    white-space: pre-wrap;
    word-break: break-word;
}

/* ==========================================================================
   响应式
   ========================================================================== */
@media (max-width: 768px) {
    .detail-hero-v2 { flex-wrap: wrap; gap: 14px; padding: 16px; }
    .detail-hero-v2-grade-col { display: none; }
    .detail-hero-v2-actions { width: 100%; }
    .detail-info-grid { grid-template-columns: repeat(2, 1fr); }
    .detail-info-cell-wide { grid-column: 1 / -1; }
    .detail-ai-verdict-row { gap: 8px; }
    .detail-pitch-grid { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
    .detail-info-grid { grid-template-columns: 1fr; }
    .detail-info-cell-wide { grid-column: 1; }
}

/* sticky 标签栏 */
.customer-detail-tabs {
    position: sticky;
    top: var(--topbar-height, 58px);
    z-index: 30;
    background: var(--page-bg, #f4f6fa);
    padding-bottom: 4px;
    margin-bottom: 12px !important;
}
