/* 利润分析模块（/profit）：在管理后台 admin.css 之上的补充样式 */

.pf-sidebar-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pf-module-tag {
    font-size: 11px; color: var(--sidebar-ink-2); border: 1px solid var(--sidebar-line);
    border-radius: 999px; padding: 1px 8px;
}
.pf-back-btn {
    width: 100%; margin-bottom: 10px; background: var(--accent); color: #fff; border: none;
    border-radius: var(--radius-control); padding: 8px 10px; cursor: pointer; font-size: 13px;
}
.pf-back-btn:hover { background: var(--accent-ink); }

.pf-forbidden { width: 100%; display: flex; align-items: center; justify-content: center; }
.pf-forbidden .card { max-width: 420px; text-align: center; display: flex; flex-direction: column; gap: 12px; }

.pf-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.pf-def { max-width: 520px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-control); padding: 8px 12px; font-size: 12px; color: var(--ink-2); }
.pf-def summary { cursor: pointer; color: var(--accent-ink); }
.pf-def div { margin-top: 6px; line-height: 1.7; }

.pf-field { display: inline-flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--ink-3); }
.pf-field[hidden] { display: none; }
.pf-field > span:first-child { white-space: nowrap; }
.pf-range { display: inline-flex; align-items: center; gap: 4px; color: var(--ink-3); }
.pf-check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; }
.pf-check input { width: auto; }
.form-group label.pf-check { display: inline-flex; margin-bottom: 0; }
.form-group .pf-check input[type="checkbox"] { width: auto; padding: 0; }
.pf-spacer { flex: 1; }
.pf-hint { font-size: 12px; color: var(--ink-3); margin: 4px 0 8px; line-height: 1.6; }
.pf-result { font-size: 13px; color: var(--ink-2); margin-top: 8px; line-height: 1.6; }
.pf-totals { font-size: 13px; color: var(--ink-2); margin: 4px 0 8px; }
.pf-scroll { overflow: auto; }
.filter-bar.pf-filters { align-items: flex-end; }
.filter-bar { align-items: flex-end; }

/* KPI 卡片 */
.pf-kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin: 12px 0; }
.pf-kpi {
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-card);
    padding: 12px 14px; box-shadow: var(--shadow-card);
}
.pf-kpi.pf-click { cursor: pointer; }
.pf-kpi.pf-click:hover { border-color: var(--accent); }
.pf-kpi-label { font-size: 12px; color: var(--ink-3); }
.pf-kpi-value { font-size: 20px; font-weight: 600; margin-top: 4px; font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.pf-kpi-sub { font-size: 11px; color: var(--ink-4); margin-top: 2px; }
.pf-kpi.pf-danger .pf-kpi-value { color: var(--danger); }
.pf-kpi.pf-warn .pf-kpi-value { color: var(--warn); }
.pf-kpi.pf-good .pf-kpi-value { color: var(--success); }

.pf-grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 12px; margin-bottom: 12px; }
.pf-grid-2 > .card { margin-bottom: 0; }
.pf-chart { position: relative; height: 280px; }

/* 利润率色阶 */
.pf-m { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-weight: 600; }
.pf-m-loss { color: var(--danger); }
.pf-m-low { color: #c2410c; }
.pf-m-mid { color: var(--warn); }
.pf-m-ok { color: var(--ink); }
.pf-m-good { color: var(--success); }
.pf-m-none { color: var(--ink-4); font-weight: 400; }

/* 热力表 */
table.pf-heat { border-collapse: separate; border-spacing: 3px; width: auto; }
table.pf-heat th { font-size: 12px; color: var(--ink-3); font-weight: 500; padding: 4px 8px; text-align: center; background: none; }
table.pf-heat td {
    min-width: 70px; padding: 6px 8px; border-radius: 6px; text-align: center; cursor: pointer;
    font-family: var(--font-mono); font-size: 12px; border: none;
}
table.pf-heat td small { display: block; font-size: 10px; opacity: 0.8; }
table.pf-heat td.pf-empty { cursor: default; background: var(--surface-2); color: var(--ink-4); }

/* 订单表 */
table.pf-table td, table.pf-table th { white-space: nowrap; }
table.pf-table td.pf-wrap { white-space: normal; min-width: 180px; }
th.pf-sort { cursor: pointer; user-select: none; }
th.pf-sort::after { content: " ⇅"; color: var(--ink-4); font-size: 10px; }
th.pf-sort.pf-asc::after { content: " ▲"; color: var(--accent); }
th.pf-sort.pf-desc::after { content: " ▼"; color: var(--accent); }
tr.pf-selected td { background: var(--accent-soft); }
.pf-strike { text-decoration: line-through; color: var(--ink-4); }
.pf-issue { margin-right: 3px; }
.pf-link { color: var(--accent-ink); cursor: pointer; text-decoration: none; }
.pf-link:hover { text-decoration: underline; }

/* 快捷筛选标签 */
.pf-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.pf-chip {
    border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink-2);
    border-radius: 999px; padding: 3px 10px; font-size: 12px; cursor: pointer;
}
.pf-chip:hover { border-color: var(--accent); }
.pf-chip.pf-on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-ink); }
.pf-chip .pf-x { margin-left: 4px; color: var(--ink-4); }

/* 批量操作栏 */
.pf-bulk {
    display: flex; align-items: center; gap: 8px; padding: 8px 12px; margin-bottom: 8px;
    background: var(--accent-soft); border: 1px solid var(--accent); border-radius: var(--radius-control);
}
.pf-bulk[hidden] { display: none; }

.pf-banner {
    background: var(--warn-soft); color: var(--warn); border: 1px solid rgba(180, 83, 9, 0.25);
    border-radius: var(--radius-control); padding: 10px 14px; margin-bottom: 12px; font-size: 13px;
}

/* 抽屉 */
.pf-drawer-mask { display: none; position: fixed; inset: 0; background: rgba(0, 0, 0, 0.3); z-index: 900; }
.pf-drawer-mask.active { display: block; }
.pf-drawer {
    position: fixed; top: 0; right: 0; bottom: 0; width: min(880px, 96vw); background: var(--surface);
    box-shadow: -8px 0 24px rgba(16, 24, 40, 0.12); z-index: 901; transform: translateX(100%);
    transition: transform 0.18s ease; display: flex; flex-direction: column;
}
.pf-drawer.active { transform: translateX(0); }
.pf-drawer-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.pf-drawer-body { padding: 14px 18px; overflow: auto; flex: 1; }
.pf-drawer-body h4 { margin: 16px 0 8px; font-size: 13px; color: var(--ink-2); }
.pf-kv { display: grid; grid-template-columns: 140px 1fr; gap: 4px 12px; font-size: 13px; }
.pf-kv dt { color: var(--ink-3); }
.pf-kv dd { margin: 0; }
.pf-timeline { list-style: none; padding: 0; margin: 0; }
.pf-timeline li { border-left: 2px solid var(--line-strong); padding: 0 0 10px 12px; position: relative; font-size: 12px; }
.pf-timeline li::before {
    content: ""; position: absolute; left: -5px; top: 4px; width: 8px; height: 8px;
    border-radius: 50%; background: var(--accent);
}

/* 弹窗 */
.modal.pf-modal-wide { max-width: 980px; width: 96%; }
.pf-modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.pf-row-error td { background: var(--danger-soft); }

/* 订单详情：成本明细 */
.pf-cost-lines tfoot td { border-top: 2px solid var(--line-strong); }
.pf-cost-credit td.num { color: var(--success); }
.pf-fees-cost-title { margin: 18px 0 8px; font-size: 13px; color: var(--ink-2); }

/* 调价：费用明细编辑 */
.pf-fees input { padding: 5px 8px; text-align: left; }
.pf-fees input[type="number"] { width: 120px; text-align: right; }
.pf-fees tfoot td { border-top: 2px solid var(--line-strong); }
.pf-fee-removed td { color: var(--ink-4); }
.pf-fee-removed input { text-decoration: line-through; }
.pf-fee-changes { display: inline-block; margin-top: 2px; padding-left: 8px; border-left: 2px solid var(--line-strong); color: var(--ink-3); }
.pf-fee-changes + .pf-fee-changes { margin-top: 0; }

.pf-import-grid { display: grid; grid-template-columns: minmax(260px, 1fr) 2fr; gap: 16px; margin-bottom: 8px; }
.pf-import-grid textarea { width: 100%; font-family: var(--font-mono); font-size: 12px; padding: 8px; border: 1px solid var(--line-strong); border-radius: var(--radius-control); }

.pf-form { display: flex; flex-direction: column; gap: 10px; max-width: 360px; }
.pf-form .pf-field input, .pf-form .pf-field select { padding: 6px 8px; }
.pf-calc-result .pf-kv { grid-template-columns: 120px 1fr; }
.pf-calc-price { font-size: 26px; font-weight: 600; font-family: var(--font-mono); margin: 4px 0 12px; }

/* 导入 / 导出进度浮层：全页遮罩，长操作期间挡住点击 */
.pf-progress-overlay {
    display: none; position: fixed; inset: 0; z-index: 3000;
    background: rgba(0, 0, 0, 0.45); align-items: center; justify-content: center;
}
.pf-progress-overlay.show { display: flex; }
.pf-progress-card {
    width: min(420px, 90vw); background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--radius-control); padding: 20px 22px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
    display: flex; flex-direction: column; gap: 10px;
}
.pf-progress-title { font-size: 15px; font-weight: 600; color: var(--ink-1, inherit); }
.pf-progress-text { font-size: 13px; color: var(--ink-2); line-height: 1.5; }
.pf-progress-elapsed { font-size: 12px; color: var(--ink-3); }
.pf-progress-bar { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; position: relative; }
.pf-progress-fill { height: 100%; width: 0; background: var(--accent); border-radius: 999px; transition: width 0.15s linear; }
.pf-progress-bar.pf-indeterminate .pf-progress-fill {
    position: absolute; width: 35%; animation: pf-progress-slide 1.1s ease-in-out infinite;
}
@keyframes pf-progress-slide { from { left: -35%; } to { left: 100%; } }
